芝麻web文件管理V1.00
编辑当前文件:/home/p/r/i/prismawe/www/resuamer/site/application/classes/model/parti.php
array( 'model' => 'candidat', 'foreign_key' => 'parti_id' ), 'partislang' => array( 'model' => 'partilang', 'foreign_key' => 'parti_id' ), ); // /* public $id; public $nom; public $initiales; public $description; public $metadescription; public $dateCreation; public $dateDissolution;//*/ public function getId() { return $this->id; } public function setId($id) { $this->id = $id; } public function getNom(){ $lang = ORM::factory('lang')->where('name', '=', I18n::$lang)->find(); if($lang->loaded()) return $this->partislang->where('lang_id', '=', $lang->id)->find()->getNom(); else{ return $this->partislang->where('lang_id', '=', 1)->find()->getNom(); } } public function getInitiales() { $lang = ORM::factory('lang')->where('name', '=', I18n::$lang)->find(); if($lang->loaded()) return $this->partislang->where('lang_id', '=', $lang->id)->find()->getInitiales(); else return $this->partislang->where('lang_id', '=', 1)->find()->getInitiales(); } public function getDescription() { $lang = ORM::factory('lang')->where('name', '=', I18n::$lang)->find(); if($lang->loaded()) return $this->partislang->where('lang_id', '=', $lang->id)->find()->getDescription(); else return $this->partislang->where('lang_id', '=', 1)->find()->getDescription(); } public function getMetadescription() { $lang = ORM::factory('lang')->where('name', '=', I18n::$lang)->find(); if($lang->loaded()) return $this->partislang->where('lang_id', '=', $lang->id)->find()->getMetadescription(); else return $this->partislang->where('lang_id', '=', 1)->find()->getMetadescription(); } public function getDateCreation($format = 'aaaa-mm-jj') { switch ($format) { case 'jj/mm/aaaa': $tmp = explode(' ', $this->date_creation); $tmp = explode('-', $tmp[0]); if(count($tmp)==3){ return $tmp[2].'/'.$tmp[1].'/'.$tmp[0]; }else{ return false; } break; case 'aaaa-mm-jj': return $this->date_creation; break; case 'jj/mm': $tmp = explode(' ', $this->date_creation); $tmp = explode('-', $tmp[0]); if(count($tmp)==3){ return $tmp[2].'/'.$tmp[1]; }else{ return false; } break; case 'long': $MONTH = array('01'=> 'Janvier','02'=> 'Février','03'=> 'Mars','04'=> 'Avril','05'=> 'Mai', '06'=> 'Juin','07'=> 'Juillet','08'=> 'Août','09'=> 'Septembre','10'=> 'Octobre', '11'=> 'Novembre','12'=> 'Décembre'); $tmp = explode(' ', $this->date_creation); if(count($tmp)==2){ $tmpDATE = explode('-', $tmp[0]); $tmpTIME = explode(':', $tmp[1]); if(count($tmpDATE)==3 && count($tmpTIME)==3){ return $tmpDATE[2].' '.$MONTH[$tmpDATE[1]].' '.$tmpDATE[0].' à '.$tmpTIME[0].'h'.$tmpTIME[1]; }else{ return false; } }else{ return false; } break; default: $tmp = explode('-', $this->date_creation); if(count($tmp)==3){ return $tmp[2].'/'.$tmp[1].'/'.$tmp[0]; }else{ return false; } break; } } public function setDateCreation($date_creation) { $this->date_creation = $date_creation; } public function getDateDissolution($format = 'aaaa-mm-jj') { switch ($format) { case 'jj/mm/aaaa': $tmp = explode(' ', $this->date_dissolution); $tmp = explode('-', $tmp[0]); if(count($tmp)==3){ return $tmp[2].'/'.$tmp[1].'/'.$tmp[0]; }else{ return false; } break; case 'aaaa-mm-jj': return $this->date_dissolution; break; case 'jj/mm': $tmp = explode(' ', $this->date_dissolution); $tmp = explode('-', $tmp[0]); if(count($tmp)==3){ return $tmp[2].'/'.$tmp[1]; }else{ return false; } break; case 'long': $MONTH = array('01'=> 'Janvier','02'=> 'Février','03'=> 'Mars','04'=> 'Avril','05'=> 'Mai', '06'=> 'Juin','07'=> 'Juillet','08'=> 'Août','09'=> 'Septembre','10'=> 'Octobre', '11'=> 'Novembre','12'=> 'Décembre'); $tmp = explode(' ', $this->date_dissolution); if(count($tmp)==2){ $tmpDATE = explode('-', $tmp[0]); $tmpTIME = explode(':', $tmp[1]); if(count($tmpDATE)==3 && count($tmpTIME)==3){ return $tmpDATE[2].' '.$MONTH[$tmpDATE[1]].' '.$tmpDATE[0].' à '.$tmpTIME[0].'h'.$tmpTIME[1]; }else{ return false; } }else{ return false; } break; default: $tmp = explode('-', $this->date_dissolution); if(count($tmp)==3){ return $tmp[2].'/'.$tmp[1].'/'.$tmp[0]; }else{ return false; } break; } } public function setDateDissolution($date_dissolution) { $this->date_dissolution = $date_dissolution; } }