芝麻web文件管理V1.00
编辑当前文件:/home/p/r/i/prismawe/www/resuamer/site/application/classes/model/video.php
array( 'model' => 'candidat', 'foreign_key' => 'candidat_id' ) ); protected $_has_many = array( 'videoslang' => array( 'model' => 'videolang', 'foreign_key' => 'video_id' ) ); /* public $date; public $candidat_id; public $lieu; public $video; public $titre; //*/ public function getId() { return $this->id; } public function setId($id) { $this->id = $id; } public function getDate($format = 'aaaa-mm-jj') { switch ($format) { case 'jj/mm/aaaa': $tmp = explode(' ', $this->date); $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; break; case 'jj/mm': $tmp = explode(' ', $this->date); $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); 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); if(count($tmp)==3){ return $tmp[2].'/'.$tmp[1].'/'.$tmp[0]; }else{ return false; } break; } } public function setDate($date) { $this->date = $date; } public function getCandidat_id() { return $this->candidat_id; } public function setCandidat_id($candidat_id) { $this->candidat_id = $candidat_id; } public function getLieu() { return $this->lieu; } public function setLieu($lieu) { $this->lieu = $lieu; } public function getVideo() { return $this->video; } public function setVideo($video) { $this->video = $video; } public function getTitre() { $lang = ORM::factory('lang')->where('name', '=', I18n::$lang)->find(); if($lang->loaded()) return $this->videoslang->where('lang_id', '=', $lang->id)->find()->getTitre(); else{ return $this->videoslang->where('lang_id', '=', 1)->find()->getTitre(); } } }