Vlastní funkce
function FormatCeny($cena){
if($cena>=1000) {$cena=substr($cena,0,-3)." ".substr($cena,-3)." Kč";}
else {$cena=$cena." Kč";}
return $cena;
}
function BezDiakritiky($nazev){
$coNahradit=array("á","é","í","ó","ú","ů","ý","ž","š","č","ř","ď","ť","ň","ě","Á","É","Í","Ó","Ú","Ů","Ž","Š","Č","Ř","Ď","Ť","Ň","Ě","Ý");
$cimNahradit=array("a","e","i","o","u","u","y","z","s","c","r","d","t","n","e","A","E","I","O","U","U","Z","S","C","R","D","T","N","E","Y");
return str_replace($coNahradit,$cimNahradit,$nazev);
}
function zkratitText($text,$delka){
if(strlen($text)>$delka){
$text=substr($text,0,$delka)
$mezera=strrpos($text," ");
$text=substr($text,0,$mezera)."...";
}
return $text;
}
function ceskeDatum($datumd){
$rok=substr($datumd,0,4);
$mesic=substr($datumd,5,2);
$den=substr($datumd,8,2);
if(substr($mesic,0,1)=="0"){$mesic=substr($mesic,1,1);}
if(substr($den,0,1)=="0"){$den=substr($den,1,1);}
return "$den.$mesic.$rok";
}
function databazoveDatum($datumc){
$tecka1=strpos($datumc,".");
$tecka2=strpos($datumc,".",$tecka1+1);
$tecka2=strrpos($datumc,".");
$den=substr($datumc,0,$tecka1);
$mesic=substr($datumc,$tecka1+1,$tecka2-$tecka1-1);
$rok=substr($datumc,$tecka2+1);
if(strlen($den)==1){$den="0".$den; }
if(strlen($mesic)==1){$mesic="0".$mesic;}
return "$rok-$mesic-$den";
}
function datumRC($rc){
$rok=substr($rc,0,2);
$aktRok=date("y"); if($rok<=$aktRok){$rok="20$rok";} else {$rok="19$rok";}
$mes=substr($rc,2,2);
if($mes>12){$mes=$mes-50;} else {$mes=$mes-0; }
$den=substr($rc,4,2);
$den=$den+0; return "$den.$mes.$rok";
}