Server IP : 103.233.192.212 / Your IP : 3.15.165.138 Web Server : Apache/2 System : Linux sv1.inde.co.th 3.10.0-1160.36.2.el7.x86_64 #1 SMP Wed Jul 21 11:57:15 UTC 2021 x86_64 User : sumpatuan ( 1058) PHP Version : 5.5.38 Disable Function : symlink,shell_exec,exec,proc_close,proc_open,popen,system,dl,putenv,passthru,escapeshellarg,escapeshellcmd,pcntl_exec,proc_get_status,proc_nice,proc_terminate,pclose,ini_alter,virtual,openlog,ini_restore MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /home/sumpatuan/public_html/backup/protected/models/ |
Upload File : |
<?php class tbOPT extends CActiveRecord { public static function model($className = __CLASS__) { return parent::model($className); } public function tableName() { return 'tb_opt'; } public function attributeLabels() { return array( 'id' => 'ID', 'opt_type' => 'เธเธฃเธฐเน€เธ เธ—', 'opt_title' => 'เธซเธฑเธงเธเนเธญ', 'opt_detail' => 'เธฃเธฒเธขเธฅเธฐเน€เธญเธตเธขเธ”', 'opt_status' => 'เธชเธ–เธฒเธเธฐ', //'opt_date_true' => 'เธงเธฑเธเธ—เธตเนเธฅเธเธเนเธฒเธง', //'opt_date' => 'เธงเธฑเธเธ—เธตเนเธชเธฃเนเธฒเธ', 'opt_views' => 'เธเธณเธเธงเธเธเธฒเธฃเธ”เธน', ); } public function rules() { return array( array('opt_title', 'required', 'message'=>'{attribute} ## เธซเนเธฒเธกเน€เธเนเธเธเนเธญเธกเธนเธฅเธงเนเธฒเธ.'), array('opt_title', 'unique', 'message'=>'{attribute} ## เธซเนเธฒเธกเธเนเธณเธเธฑเธ.'), // array('tender_title', 'match', 'pattern'=>'/^[เธ-เธฎเธฐ-เนเน€ A-Za-z0-9]+$/', 'message'=>'{attribute} ## เธ•เนเธญเธเน€เธเนเธ เธ เธฒเธฉเธฒเนเธ—เธข, เธ เธฒเธฉเธฒเธญเธฑเธเธเธคเธฉ, เธ•เธฑเธงเน€เธฅเธ เนเธฅเธฐ เธเนเธญเธเธงเนเธฒเธเน€เธ—เนเธฒเธเธฑเนเธ.'), array('id, opt_detail, opt_type, opt_status, opt_views', 'safe'), ); } public function relations() { return array( 'tbOPTFile' => array(self::HAS_MANY, 'tbOPTFile', 'tb_opt_id'), ); } public function statusThai($data, $row) { return OtherFunction::statusThai($data->opt_status); } public function beforeSave() { if ($this->isNewRecord) { //$this->tender_date = new CDbExpression('NOW()'); $this->opt_views = 0; } //if ($this->tender_date_true) { // $this->tender_date_true = date('Y-m-d', strtotime($this->tender_date_true)); //} return parent::beforesave(); } /*public function afterFind() { if ($this->tender_date_true) { $this->tender_date_true = date('d-m-Y', strtotime($this->tender_date_true)); } return parent::afterFind(); } public function dateThai($data, $row) { return OtherFunction::DateThai($data->tender_date_true); }*/ public function typeThai($data, $row) { switch($data->opt_type) { case 'opt1': return 'เธกเธฒเธ•เธฃเธเธฒเธฃเธเนเธญเธเธเธฑเธเธเธฒเธฃเธ—เธธเธเธฃเธดเธ•'; break; case 'opt2': return 'เธเธนเนเธกเธทเธญเธเธฒเธฃเธ”เธณเน€เธเธดเธเธเธฒเธ'; break; case 'opt3': return 'เธเธฃเธฐเธเธฒเธจ/เธเธณเธชเธฑเนเธ'; break; } } } ?>