Úvod'; while ($row = mysql_fetch_array($result)) { $num--; if($num==0) {$nbrStyle='nbr';} else {$nbrStyle='';} $nbrStyle.=' '.hiliteMenu($row['id'], $GLOBALS['gSekce']['id']); if($GLOBALS['modrew']==1 && $row['seorewrite']<>'' && $row['seorewrite']<>'Null') { $out .= ''.$row['nazev'].''; /// modrewrite ON } else { $out .= ''.$row['nazev'].''; /// modrewrite OFF } } mysql_free_result($result); return $out; } function hiliteMenu($v1, $v2) { $tOut=''; if($v1==$v2) { $tOut = 'active'; } return $tOut; } function cmsSubMenu($id) { if($id>0) { // musí být jiný než 0 (root) //$link = mysql_connect(DB_HOST, DB_USER, DB_PWD) or trigger_error(mysql_error(),E_USER_ERROR);mysql_select_db(DB_NAME); $query = "SELECT menu.id, menu.nazev, menu.seorewrite FROM menu WHERE (menu.parent = $id) AND (menu.pub = 1) ORDER BY menu.poradi, menu.id"; $result = mysql_query($query); while ($row = mysql_fetch_array($result)) { $nbrStyle = hiliteMenu($row['id'], $GLOBALS['gSekce']['id']); if($GLOBALS['modrew']==1 && $row['seorewrite']<>'' && $row['seorewrite']<>'Null') { $out .= ''.$row['nazev'].''; /// modrewrite ON } else { $out .= ''.$row['nazev'].''; /// modrewrite OFF } //$out .= ''.$row['nazev'].''; } mysql_free_result($result); return $out; } } function cmsGetPageInfo($id) { //$link = mysql_connect(DB_HOST, DB_USER, DB_PWD) or trigger_error(mysql_error(),E_USER_ERROR);mysql_select_db(DB_NAME); $query = "SELECT stranky.id, stranky.nazev, stranky.abstrakt, stranky.img1, stranky.img2, stranky.obsah, stranky.seotitle, stranky.seodesc, stranky.seokeywords, stranky.seorewrite, stranky.parent FROM stranky WHERE (stranky.id = $id)"; $result = mysql_query($query); $row = mysql_fetch_array($result); $GLOBALS['gPage'] = array( "detid" => $row['id'], "seoTitle" => $row['seotitle'], "seoKeywords" => $row['seokeywords'], "seoDescription" => $row['seodesc'], "seoRewrite" => $row['seorewrite'], "titulek" => $row['nazev'], "abstrakt" => $row['abstrakt'], "absfoto1" => $row['img1'], "absfoto2" => $row['img2'], "obsah"=> $row['obsah'], "parent"=> $row['parent'], "autor"=> 0, "datum"=> 0 ); //$GLOBALS['gPage'] = array_merge($GLOBALS['gPage'], $out); mysql_free_result($result); } function articleView($id) { $query = "SELECT stranky.obsah FROM stranky WHERE id=$id LIMIT 1"; $result = mysql_query($query); $row = mysql_fetch_array($result); return $row['obsah']; } function cmsGetLastArticles($sek,$num) { $query = "SELECT stranky.id, stranky.seorewrite, stranky.abstrakt, stranky.nazev FROM stranky WHERE (stranky.parent = $sek) ORDER BY stranky.id DESC"; if($num>0) { $query = $query.' LIMIT '.$num; } $result = mysql_query($query); $tOut = array(); while($row=mysql_fetch_assoc($result)) { array_push($tOut, $row); } return $tOut; } function cmsGetPriorArticles() { $query = "SELECT stranky.nazev, stranky.seorewrite, stranky.id, stranky_priority.id AS posid, stranky.img2, stranky.img1, stranky.abstrakt FROM stranky_priority INNER JOIN stranky ON (stranky_priority.strid=stranky.id)"; $result = mysql_query($query); $tOut = array(); while($row=mysql_fetch_assoc($result)) { array_push($tOut, $row); } return $tOut; } function cmsGetSekceInfo($sekceID) { //$link = mysql_connect(DB_HOST, DB_USER, DB_PWD) or trigger_error(mysql_error(),E_USER_ERROR);mysql_select_db(DB_NAME); $query = "SELECT menu.strankovani, menu.seorewrite, menu.seokeywords, menu.seodesc, menu.seotitle, menu.styl, menu.typ, menu.nazev, menu.radit, menu.parent, menu.id, menu.lang FROM menu WHERE (menu.id = $sekceID)"; $result = mysql_query($query); $row = mysql_fetch_array($result); $GLOBALS['gSekce'] = array( "id" => $row['id'], "strankovani" => $row['strankovani'], "radit" => $row['radit'], "seoTitle" => $row['seotitle'], "seoKeywords" => $row['seokeywords'], "seoDescription" => $row['seodesc'], "seoRewrite" => $row['seorewrite'], "titulek" => $row['nazev'], "parent"=> $row['parent'], "typ"=> $row['typ'], "styl"=> $row['styl'], "lang"=>$row['lang'], "autor"=> 0, "datum"=> 0 ); //$GLOBALS['gPage'] = array_merge($GLOBALS['gPage'], $out); mysql_free_result($result); } function cmsGetParentSekce($n) { if($n>0) { //$link = mysql_connect(DB_HOST, DB_USER, DB_PWD) or trigger_error(mysql_error(),E_USER_ERROR);mysql_select_db(DB_NAME); $query = "SELECT menu.parent, menu.nazev, menu.typ, menu.styl, menu.seotitle, menu.seorewrite, menu.id FROM menu WHERE (menu.id = $n)"; $result = mysql_query($query); $row = mysql_fetch_array($result); //if($row['parent']<>0) { $GLOBALS['pSekce']['id'] = $row['id']; $GLOBALS['pSekce']['parent'] = $row['parent']; $GLOBALS['pSekce']['url'] = 0; $GLOBALS['pSekce']['titulek'] = $row['nazev']; $GLOBALS['pSekce']['seoTitle'] = $row['seotitle']; $GLOBALS['pSekce']['seoRewrite'] = $row['seorewrite']; $GLOBALS['pSekce']['styl'] = $row['styl']; $GLOBALS['pSekce']['typ'] = $row['typ']; //} else { //$GLOBALS['gPage']['sParentTitulek'] = "root"; //} mysql_free_result($result); } else { $GLOBALS['pSekce']='root'; } } function cmsGetSekcePocetClanku($sekceID) { //$link = mysql_connect(DB_HOST, DB_USER, DB_PWD) or trigger_error(mysql_error(),E_USER_ERROR);mysql_select_db(DB_NAME); $query = "SELECT stranky.id FROM stranky WHERE (stranky.parent = $sekceID) AND (stranky.pub = 1)"; $result = mysql_query($query); $num = mysql_num_rows($result); if($num==1) { $row = mysql_fetch_array($result); $GLOBALS['gPage']['prvniClanekID'] = $row['id']; } mysql_free_result($result); return $num; } function cmsGetSekceTyp($sekceID) { //$link = mysql_connect(DB_HOST, DB_USER, DB_PWD) or trigger_error(mysql_error(),E_USER_ERROR);mysql_select_db(DB_NAME); $query = "SELECT menu.typ FROM menu WHERE (menu.id = $sekceID)"; $result = mysql_query($query); $row = mysql_fetch_array($result); $out = $row['typ']; mysql_free_result($result); return $out; } function cmsPaging($pocetClanku, $strana = 1) { if($GLOBALS['gSekce']['strankovani']>0) { $stran_celkem = ceil($pocetClanku / $GLOBALS['gSekce']['strankovani']); $out = '
'; // $out = "pocet Clanku: ". $pocetClanku; // $out .= "
Pocet stran: ".$stran_celkem."
" ; if($_GET['page']>0) { $out .= '<< '; } for($i=0; $i<$stran_celkem; $i++) { if($_GET['page']==$i ) { $out .= ''.($i+1).''; } else { $out .= ''.($i+1).''; } if($i<($stran_celkem-1)) { $out .= " | "; } } if($_GET['page']<($stran_celkem-1)) { $out .= ' >>'; } $out .="
"; return $out; } else { return null; } } function cmsGetSekceCList($sekceID, $razeni, $limitDown = 0, $limitNum = 0) { //$link = mysql_connect(DB_HOST, DB_USER, DB_PWD) or trigger_error(mysql_error(),E_USER_ERROR);mysql_select_db(DB_NAME); $query = "SELECT stranky.id, stranky.nazev, stranky.abstrakt, stranky.seorewrite, stranky.img1 FROM stranky WHERE (stranky.parent = $sekceID) AND (stranky.pub = 1)"; // řazení článků switch ($razeni) { case 1: $queryAdd = "ORDER BY stranky.id DESC"; break; case 2: $queryAdd = "ORDER BY stranky.nazev"; break; case 3: $queryAdd = "ORDER BY stranky.nazev DESC"; break; default: $queryAdd = "ORDER BY stranky.id"; break; } $query .= ' '.$queryAdd; // limity pro stránkování if($limitNum>0) { if(!$limitDown) { $limitDown=0;} $query .= " LIMIT $limitDown, $limitNum"; //echo $query; } $result = mysql_query($query); while ($row = mysql_fetch_array($result)) { $tout = array( "id"=> $row['id'], "titulek"=> $row['nazev'], "abstrakt"=> $row['abstrakt'], "seorewrite"=> $row['seorewrite'], "absfoto"=>$row['img1'] ); // vlož jako prvek do cList array_push($GLOBALS['gPage']['cList'],$tout); } mysql_free_result($result); } function cmsCheckModuleLinked($moduleID,$sParam) { if($sParam=='ID') { $out = 0; $i=1; foreach ($GLOBALS['gAppz'] as $module) { if($module['appAdminId']==$moduleID) { $out = $i; } $i++; } } elseif ($sParam=='NAME') { $out = 0; $i=1; foreach ($GLOBALS['gAppz'] as $module) { if($module['appName']==$moduleID) { $out = $i; } $i++; } } return $out; } function strtrim($str, $maxlen=100, $elli=NULL, $maxoverflow=15) { if (strlen($str) > $maxlen) { $output = NULL; $body = explode(" ", $str); $body_count = count($body); $i=0; do { $output .= $body[$i]." "; $thisLen = strlen($output); $cycle = ($thisLen < $maxlen && $i < $body_count-1 && ($thisLen+strlen($body[$i+1])) < $maxlen+$maxoverflow?true:false); $i++; } while ($cycle); return $output.$elli; } else return $str; } function firstPage($id) { //$link = mysql_connect(DB_HOST, DB_USER, DB_PWD) or trigger_error(mysql_error(),E_USER_ERROR);mysql_select_db(DB_NAME); $query = "SELECT stranky.nazev, stranky.abstrakt, stranky.obsah, stranky.seotitle, stranky.seodesc, stranky.seokeywords, stranky.seorewrite FROM stranky LEFT OUTER JOIN menu ON (stranky.parent=menu.id) WHERE (menu.id = $id)"; $result = mysql_query($query); $row = mysql_fetch_array($result); $out = array( "nazev" => $row['nazev'], "abstrakt" => $row['abstrakt'], "obsah" => $row['obsah'], "seotitle" => $row['seotitle'], "seodesc" => $row['seodesc'], "seokeywords" => $row['seokeywords'], "seorewrite" => $row['seorewrite']); mysql_free_result($result); return $out; } function kurzMinMaxDate($id){ //$link = mysql_connect(DB_HOST, DB_USER, DB_PWD) or trigger_error(mysql_error(),E_USER_ERROR);mysql_select_db(DB_NAME); $query = "SELECT DATE_FORMAT(MIN(kurzmoduly.term_od),'%e.%c.%Y') AS mindate, DATE_FORMAT(MAX(kurzmoduly.term_do),'%e.%c.%Y') AS maxdate FROM kurzmoduly WHERE (kurzmoduly.id = $id) GROUP BY kurzmoduly.parentid"; $result = mysql_query($query); $row = mysql_fetch_array($result); mysql_free_result($result); return $row; } function seznamOtevrenychKurzu($id) { //$link = mysql_connect(DB_HOST, DB_USER, DB_PWD) or trigger_error(mysql_error(),E_USER_ERROR); mysql_select_db(DB_NAME); $query = "SELECT stranky.id, stranky.nazev, kurzy.nazev AS knazev, kurzy.id AS kid FROM kurzy INNER JOIN stranky ON (kurzy.parentid=stranky.id) WHERE (stranky.pub = 1) AND (kurzy.pub = 1) AND (stranky.id = $id)"; $result = mysql_query($query); $num = mysql_num_rows($result); $data = "Počet otevřených kurzů: ".$num.""; $data .=''; while ($row = mysql_fetch_array($result)) { if($datum = kurzMinMaxDate($row['kid'])) { $datum = $datum['mindate'].' - '.$datum['maxdate']; } else { $datum = 'Není stanoven termín.'; } $data .= ''; } $data .='
#'.$row['kid'].''.$datum.''.$row['knazev'].' - Objednat kurz
'; mysql_free_result($result); return $data; } function seznamClanku($id, $addinfo = 0) { //$link = mysql_connect(DB_HOST, DB_USER, DB_PWD) or trigger_error(mysql_error(),E_USER_ERROR); mysql_select_db(DB_NAME); $query = "SELECT stranky.id, stranky.nazev, stranky.abstrakt, stranky.seorewrite FROM stranky WHERE (stranky.parent = $id) AND (stranky.pub = 1) ORDER BY id DESC"; $result = mysql_query($query); // seznam článků $data = '
'; while ($row = mysql_fetch_array($result)) { $data .= '
'."\n"; if($afoto) { $data .= 'tempImage'; } //$data .= '

'.$row['nazev'].'

'."\n"; if($GLOBALS['modrew']==1 && $row['seorewrite']<>'' && $row['seorewrite']<>'Null') { $data .= '

x'.$row['nazev'].'

'; /// modrewrite ON } else { $data .= '

x'.$row['nazev'].'

'; /// modrewrite OFF } if($addinfo!=0) { if($addinfo==1) { // zobraz informace o kurzech $data .= seznamOtevrenychKurzu($row['id']);} elseif ($addinfo==2) { // zobraz informace o kurzech + abstrakt $data .= '
'.$row['abstrakt'].'
'."\n"; $data .= '
'.seznamOtevrenychKurzu($row['id']).'
'; //$data .= ''."\n"; } else { // neexistujici addinfo, nevypisuj nic $data .='';} } else { $data .= '
'.$row['abstrakt'].'
'."\n"; $data .= ''."\n"; } $data .= '
'."\n"; } $data .='
'; //mysql_free_result($result); // seo z nastavení sekce $query2 = "SELECT menu.nazev, menu.seotitle, menu.seodesc, menu.seokeywords, menu.seorewrite FROM menu WHERE (menu.id = $id)"; $result2 = mysql_query($query2); $row2 = mysql_fetch_array($result2); $out = array("nazev" => $row2['nazev'], "abstrakt" => "", "obsah" => $data, "seotitle" => $row2['seotitle'], "seodesc" => $row2['seodesc'], "seokeywords" => $row2['seokeywords'], "seorewrite" => $row2['seorewrite']); //$out = array("obsah" => $data); //mysql_free_result($result); //mysql_close($link); return $out; } function fromSqlDate($sqlDate) { $tDate= explode(" ",$sqlDate); $tDatum = explode("-",$tDate[0]); $tCas = explode(":",$tDate[1]); $tOutDatum = array('day' => $tDatum[2], 'month' => $tDatum[1], 'year' => $tDatum[0]); $tOutCas = array('hour' => $tCas[0], 'minute' => $tCas[1]); $tOut = array('date' => $tOutDatum, 'time' => $tOutCas); return $tOut; } function ZobrazUpoutavku($num) { $query = "SELECT modupoutavky.nazev, modupoutavky.obsah FROM modupoutavky WHERE (modupoutavky.id = $num)"; $result = mysql_query($query); if($row = mysql_fetch_array($result, MYSQL_ASSOC)) { return $row['obsah']; } return 0; } function goBack($dok) { //$link = mysql_connect(DB_HOST, DB_USER, DB_PWD) or trigger_error(mysql_error(),E_USER_ERROR); mysql_select_db(DB_NAME); $query="SELECT menu.parent FROM menu INNER JOIN stranky ON (menu.id=stranky.parent) WHERE (stranky.id = $dok)"; $result = mysql_query($query); $row = mysql_fetch_array($result); mysql_free_result($result); if($row['parent']==0) { echo "prvni sekce"; } else { echo "zpět"; } } function getPath($sekceId) { //$link = mysql_connect(DB_HOST, DB_USER, DB_PWD) or trigger_error(mysql_error(),E_USER_ERROR); mysql_select_db(DB_NAME); $query = "SELECT menu.nazev, menu.id, menu.parent, menu.seorewrite FROM menu WHERE (menu.id = $sekceId)"; $result = mysql_query($query); $row = mysql_fetch_array($result); //$pathItem = ''.$row['nazev'].''; if($GLOBALS['modrew']==1 && $row['seorewrite']<>'' && $row['seorewrite']<>'Null') { $pathItem .= ''.$row['nazev'].''; /// modrewrite ON } else { $pathItem .= ''.$row['nazev'].''; /// modrewrite OFF } $aPath = $GLOBALS['gSekce']['path']; $GLOBALS['gSekce']['path'] = $pathItem." > ".$aPath; if($row['parent']<>0) { getPath($row['parent']); } else { $GLOBALS['gSekce']['path'] = ''.home.' > '.$GLOBALS['gSekce']['path']; } mysql_free_result($result); } ?>