%PDF- %PDF-
Direktori : /home/alliance/domains/congress-intercultural.eu/public_html/inc/classes/ |
Current File : /home/alliance/domains/congress-intercultural.eu/public_html/inc/classes/Theme.php |
<?php class Theme extends Load { var $bd; var $lang; var $nom_table='theme'; var $clef_primaire='id_theme'; var $table=array('couleur','ordre','icone','id_parent','photo','photo2'); var $table_lang=array('libelle','description'); function Theme($connection) { //constructor parent::Load($connection); $this->bd = new BaseOps($connection); $this->lang = new Lang($connection); $this->trad = new Traduction($connection); } function liste_themes($lang = false) { if(!$lang) { $lang = $this->lang->getlangid(); } $html=""; $query = "SELECT t.*,tl.titre FROM `theme` t LEFT JOIN `theme_lang` tl ON t.id=tl.theme"; if($categorie) { $query .= " LEFT JOIN `theme_cat` tc ON t.id=tc.theme WHERE tc.categorie = ".$categorie." AND tl.lang=".$lang; } else { $query .= " WHERE tl.lang=".$lang; } $query .= " ORDER BY t.ordre ASC"; $result = $this->bd->select_arrays($query); return $result; } function liste_themes_admin($lang = false) { if(!$lang) { $lang = $this->lang->getlangid(); } $html=""; $result = $this->getList($lang, true,"AND id_parent=0"); $i = 0; foreach($result as $theme) { $html.='<li> <div> <strong>'.$theme['libelle'].'</strong> <a href="admin/modifier_theme.php?id='.$theme['id_theme'].'">'.$this->trad->t("Modifier le theme","admin").'</a> <a href="admin/suppr_theme.php?id='.$theme['id_theme'].'" class="confirm">'.$this->trad->t("Supprimer le theme","admin").'</a>'; if($theme['ordre'] != 1) { $html.='<a href="admin/monter.php?table=theme&id='.$theme['id_theme'].'&avant='.$prev.'" style="color: #fff !important;">'.$this->trad->t("Monter","admin").'</a>'; } $html.='</div>'; $html.='</li>'; $sous_cats = $this->getList($lang, true,"AND id_parent=".$theme["id_theme"]); if($sous_cats!=null){ foreach($sous_cats as $sous_cat) { $html.='<li class="sous_cat"> <div> <strong>'.$sous_cat['libelle'].'</strong> <a href="admin/modifier_theme.php?id='.$sous_cat['id_theme'].'">'.$this->trad->t("Modifier le theme","admin").'</a> <a href="admin/suppr_theme.php?id='.$sous_cat['id_theme'].'" class="confirm">'.$this->trad->t("Supprimer le theme","admin").'</a>'; if($sous_cat['ordre'] != 1) { $html.='<a href="admin/monter.php?table=theme&id='.$sous_cat['id_theme'].'&avant='.$prevsous.'" style="color: #fff !important;">'.$this->trad->t("Monter","admin").'</a>'; } $html.='</div> </li>'; $prevsous=$sous_cat['id_theme']; } } $i++; $prev = $theme['id_theme']; } return $html; } function getListSelect($lang=false,$ordre=false,$value="",$parent=""){ if(!$lang){ $lang = $this->lang->getlangid(); } if($parent!==""){ $entrees=$this->getList($lang,$ordre," AND id_parent=".$parent); } else{ $entrees=$this->getList($lang,$ordre); } $return=""; if($value=="" || $value==0){ $return.='<option selected="selected" value="0">'.$this->trad->t("Pas de parent","admin").'</option>'; } else{ $return.='<option value="0">'.$this->trad->t("Pas de parent","admin").'</option>'; } foreach($entrees as $entree){ if($value==$entree['id_theme']){ $return.='<option selected="selected" value="'.$entree['id_theme'].'">'.$entree['libelle'].'</option>'; } else{ $return.='<option value="'.$entree['id_theme'].'">'.$entree['libelle'].'</option>'; } } return $return; } function getListSelectTheme($lang=false,$value=""){ if(!$lang){ $lang = $this->lang->getlangid(); } $niveau1=$this->getList($lang,true," AND id_parent=0"); $return=""; if($niveau1!=null){ foreach($niveau1 as $entree){ $return.='<option disabled="disabled" value="'.$entree['id_theme'].'">'.$entree['libelle'].'</option>'; $niveau2=$this->getList($lang,true," AND id_parent=".$entree['id_theme']); if($niveau2!=null){ foreach($niveau2 as $entree2){ if($value==$entree2['id_theme']){ $return.='<option selected="selected" value="'.$entree2['id_theme'].'"> '.$entree2['libelle'].'</option>'; } else{ $return.='<option value="'.$entree2['id_theme'].'"> '.$entree2['libelle'].'</option>'; } } } } } return $return; } function getListTheme($lang=false,$all=false){ if(!$lang) { $lang = $this->lang->getlangid(); } $html=""; $return=array(); $result = $this->getList($lang, true,"AND id_parent=0"); $i = 0; foreach($result as $theme) { $return[]=$theme; $html.='<option value="'.$theme['id_theme'].'">'.$theme['libelle'].'</option>'; $sous_cats = $this->getList($lang, true,"AND id_parent=".$theme["id_theme"]); if($sous_cats!=null){ foreach($sous_cats as $sous_cat) { $return[]=$sous_cat; $html.='<option value="'.$sous_cat['id_theme'].'"> '.$sous_cat['libelle'].'</option>'; } } } return $return; } function getSousTheme($lang=false,$parent=false,$value=""){ if(!$lang){ $lang = $this->lang->getlangid(); } if($parent!==""){ $entrees=$this->getList($lang,$ordre," AND id_parent=".$parent); } else{ $entrees=$this->getList($lang,$ordre); } $return=""; if($value=="" || $value==0){ $return.='<option selected="selected" value="0">'.$this->trad->t("Pas de parent","admin").'</option>'; } else{ $return.='<option value="0">'.$this->trad->t("Pas de parent","admin").'</option>'; } foreach($entrees as $entree){ if($value==$entree['id_theme']){ $return.='<option selected="selected" value="'.$entree['id_theme'].'">'.$entree['libelle'].'</option>'; } else{ $return.='<option value="'.$entree['id_theme'].'">'.$entree['libelle'].'</option>'; } } return $return; } function getSubThemes($lang=false,$parent=false){ $ordre=true; if(!$lang){ $lang = $this->lang->getlangid(); } if($parent!==""){ $entrees=$this->getList($lang,$ordre," AND id_parent=".$parent); } return $entrees; } function getSubThemesSelect($parent=false,$lang=false){ $ordre=true; if(!$lang){ $lang = $this->lang->getlangid(); } $return=""; if($parent!==""){ $entrees=$this->getList($lang,$ordre," AND id_parent=".$parent); } foreach($entrees as $entree){ if($value==$entree['id_theme']){ $return.='<option selected="selected" value="'.$entree['id_theme'].'">'.$entree['libelle'].'</option>'; } else{ $return.='<option value="'.$entree['id_theme'].'">'.$entree['libelle'].'</option>'; } } return $return; } } ?>