%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/alliance/domains/congress-eldw.eu/public_html/inc/classes/
Upload File :
Create Path :
Current File : /home/alliance/domains/congress-eldw.eu/public_html/inc/classes/TopAccueil.php

<?php

class TopAccueil extends Load {

	var $bd;
	var $lang;
	var $nom_table='top_accueil';
	var $clef_primaire='id_top_accueil';
	var $table=array('type','ordre','photo','disposition','id_page','id_section','lien'); 
	
	var $table_lang=array('titre','copyright'); 

	function TopAccueil() {
		//constructor
		parent::Load();
		$this->bd = new BaseOps;
		$this->lang = new Lang;
		$this->page = new Page;
		$this->section = new Section;
		
	}
	
	function getTops() {
		$query = "SELECT * FROM top_accueil ORDER BY ordre";
		$tops = $this->bd->select_arrays($query);
		$return=array();
		
		foreach($tops as $key=>$top){
			
			$query = "SELECT * FROM top_accueil_lang WHERE id_top_accueil=".$top['id_top_accueil']." AND id_lang=".$this->lang->id();
			$top_lang=$this->bd->select_array($query);
			$query = "SELECT * FROM top_accueil_lang WHERE id_top_accueil=".$top['id_top_accueil']." AND id_lang=2";
			$top_lang_en=$this->bd->select_array($query);
			if($top['type']=="page"){
				$this_page=$this->page->aff_actu($top['id_page'],$this->lang->id());	
			}
			elseif($top['type']=="theme"){
				$this_theme=$this->section->getSection($top['id_section'],$this->lang->id());	
			}
			
			// le titre
			if($top_lang['titre']!=""){
				$return[$key]['titre']=$top_lang['titre'];
			}
			elseif($top_lang_en['titre']!=""){
				$return[$key]['titre']=$top_lang_en['titre'];
			}
			else{
				if($top['type']=="page"){
					$return[$key]['titre']=$this_page['titre'];
				}
				elseif($top['type']=="theme"){
					$return[$key]['titre']=$this_theme['titre'];					
				}
			}
			
			// lien 
			if($top['type']=="lien"){
				$return[$key]['lien']=$top['lien'];
			}
			elseif($top['type']=="page"){
				$return[$key]['lien']=$this->lang->getlang()."/".$this_page['type']."/".$this_page['id_page'].'-'.$this_page['permalien'].'.html';
			}
			else{
				$return[$key]['lien']=$this->lang->getlang()."/theme/".$this_theme['id_section'].'-'.$this_theme['permalien'].'.html';
			}
			$return[$key]['id_top_accueil']=$top['id_top_accueil'];
			$return[$key]['ordre']=$top['ordre'];
			$return[$key]['disposition']=$top['disposition'];
			//photo
			if($top['photo']!=""){
				$return[$key]['photo']=$top['photo'];
			}
			else{
				if($top['type']=="page"){
					$return[$key]['photo']=$this_page['photo'];
					$return[$key]['copyright']=$this_page['copyright'];
					
				}
				elseif($top['type']=="theme"){
					$return[$key]['photo']=$this_theme['photo'];
					$return[$key]['copyright']=cleanUrl($this_theme['titre']);
					
				}
			}
			
		}
		return $return;
	}
	
	
	function getTopAccueil($id_top_accueil){
		$query = "SELECT * FROM `top_accueil` WHERE id_top_accueil =".$id_top_accueil;
		$return=$this->bd->select_array($query);
		$query = "SELECT * FROM `top_accueil_lang` WHERE `id_top_accueil`=".$id_top_accueil;
		$lang_traductions=$this->bd->select_arrays($query);
		foreach($lang_traductions as $lang_traduction){
			foreach($this->table_lang as $unchamp){ 
				$return[$unchamp.'_'.$lang_traduction['id_lang']]=$lang_traduction[$unchamp];
			}
		}
		return $return;
	}
	
}

?>

Zerion Mini Shell 1.0