function __construct($table = 'page', $table_parent = 'article') { parent::__construct($table, $table_parent); }
function __construct($http_request = '') { $this->http_request = $http_request; if(!empty($http_request['m'])) { $id_element_cible = $http_request['m']; $this->nom_zone_cible = "menu"; } elseif(!empty($http_request['s'])) { $id_element_cible = $http_request['s']; $this->nom_zone_cible = "sousmenu"; } elseif(!empty($http_request['p'])) { $id_element_cible = $http_request['p']; $this->nom_zone_cible = "page"; } elseif(!empty($http_request['v'])) { $id_element_cible = $http_request['v']; $this->nom_zone_cible = "video"; } elseif(!empty($http_request['g'])) { $id_element_cible = $http_request['g']; $this->nom_zone_cible = "galerie"; } else { $cible_objet = new CMenu(); $id_element_cible = $cible_objet->get_id_first_element(); $this->nom_zone_cible= 'menu'; } switch($this->nom_zone_cible) { case 'menu' : $this->id_menu_courant = $id_element_cible; $sousmenu_objet = new CSousmenu(); $page_objet = new CPage(); $this->id_sousmenu_courant = $sousmenu_objet->get_id_first_element($this->id_menu_courant); $this->id_page_courant = $page_objet->get_id_first_element($this->id_sousmenu_courant); break; case 'sousmenu' : $this->id_sousmenu_courant = $id_element_cible; $page_objet = new CPage(); $sousmenu_objet = new CSousMenu(); $this->id_page_courant = $page_objet->get_id_first_element($this->id_sousmenu_courant); $this->id_menu_courant = $sousmenu_objet->get_id_element_parent($this->id_sousmenu_courant); break; case 'page' : $this->id_page_courant = $id_element_cible; $page_objet = new CPage(); $sousmenu_objet = new CSousmenu(); $this->id_sousmenu_courant = $page_objet->get_id_element_parent($this->id_page_courant); $this->id_menu_courant = $sousmenu_objet->get_id_element_parent($this->id_sousmenu_courant); break; case 'galerie' : $this->id_galerie_courant = $id_element_cible; $sql = "SELECT idpage FROM galerie WHERE id = " . $id_element_cible ; $id_page = CBdd::select_one($sql, 'idpage'); $this->id_page_courant = $id_page; $page_objet = new CPage(); $sousmenu_objet = new CSousmenu(); $this->id_sousmenu_courant = $page_objet->get_id_element_parent($this->id_page_courant); $this->id_menu_courant = $sousmenu_objet->get_id_element_parent($this->id_sousmenu_courant); break; case 'video' : $this->id_video_courant = $id_element_cible; $sql = "SELECT id_page FROM video WHERE id = " . $id_element_cible ; $id_page = CBdd::select_one($sql, 'id_page'); $this->id_page_courant = $id_page; $page_objet = new CPage(); $sousmenu_objet = new CSousmenu(); $this->id_sousmenu_courant = $page_objet->get_id_element_parent($this->id_page_courant); $this->id_menu_courant = $sousmenu_objet->get_id_element_parent($this->id_sousmenu_courant); break; } }
function __construct($table = 'faqs', $table_parent = '') { parent::__construct($table, $table_parent); }
<div id="menu_g"> <div class="conteneur"> <h2>menu principal</h2> <?php $menu_objet = new CMenu(); $menu_liste = $menu_objet->get_elements(); if($menu_objet->nb_elements > 0) { ?> <ul> <?php while($menu_element = mysql_fetch_assoc($menu_liste)) { ?> <li<?php if($menu_element['id'] == $id_menu_courant) echo ' class="courant"' ?>><a href="<?php echo CUrl::get_href('menu', $menu_element['id'], $menu_element['nom'] ) ?>"><?php echo $menu_element['nom'] ?></a> <?php $sousmenu_objet = new CSousmenu(); $sousmenu_liste = $sousmenu_objet->get_elements($menu_element['id']); if($sousmenu_objet->nb_elements > 1) { ?> <dl> <?php while($sousmenu_element = mysql_fetch_assoc($sousmenu_liste)) { ?> <dt<?php if($sousmenu_element['id'] == $id_sousmenu_courant) echo ' class="courant"' ?>><a href="<?php echo CUrl::get_href('sousmenu', $sousmenu_element['id'], $sousmenu_element['nom'] ) ?>" title="<?php echo $sousmenu_element['nom'] ?>"><?php echo $sousmenu_element['nom'] ?></a></dt> <?php } ?> </dl> <?php }?> </li> <?php } ?> </ul> <?php } ?> </div>