%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/Hotpage.php |
<?php class Hotpage extends Load { var $bd; var $language; var $sect; var $nom_table='hotpage'; var $clef_primaire='id_hotpage'; var $table=array('id_page','ordre','type'); var $table_lang=array('titre','soustitre','permalien'); function Hotpage() { //constructor parent::Load(); $this->bd = new BaseOps; $this->language = new Lang; $this->lang = new Lang; } function getHotpage($id_hotpage){ $query = "SELECT * FROM `hotpage` WHERE id_hotpage =".$id_hotpage; return $this->bd->select_array($query); } function getHotpageByPage($id_page){ $query = "SELECT * FROM `hotpage` WHERE id_page =".$id_page; return $this->bd->select_array($query); } // supprime une actu de la hotpage et recalcule l'ordre suivant le type function removeHotpage($id_hotpage){ $unehotpage=$this->getHotpage($id_hotpage); $this->bd->delete("hotpage", "id_hotpage = ".$id_hotpage); $this->bd->recalcordre("hotpage", "type = '".$unehotpage['type']."'"); return true; } function addHotpage($id_page,$type='top'){ $query="UPDATE hotpage SET ordre=ordre+1 WHERE `type`='".$type."'"; $this->bd->q($query); $values = array( "ordre" => 1, "type" => $type, "id_page" => $id_page ); $this->bd->insert("hotpage", $values); return true; } function editTypeHotpage($id_page,$type){ $hotpage=$this->getHotpageByPage($id_page); $next_ordre=$this->bd->next_ordre("hotpage", 'type="'.$type.'"'); $values = array( "type" => $type, "ordre" => $next_ordre ); $this->bd->update("hotpage", $values,"id_page=".$id_page); $this->bd->recalcordre("hotpage", "type = 'top'"); $this->bd->recalcordre("hotpage", "type = 'bottom'"); return true; } function listHotpage($type=null){ if($type!=null){ $query = 'SELECT * FROM `hotpage` WHERE type ="'.$type.'" ORDER BY `ordre`'; } else{ $query = "SELECT * FROM `hotpage` ORDER BY `ordre`"; } return $this->bd->select_arrays($query); } function isHotpage($id_page){ $query = "SELECT * FROM `hotpage` WHERE id_page =".$id_page; if($this->bd->select_array($query)!=""){ return true; } else{ return false; } } function charger_aff($id_hotpage,$lang){ $hotpage=$this->getHotpage($id_hotpage); $objpage=new Page; $objpage->getPage($hotpage['id_page']); } } ?>