/** * @return array customized attribute labels (name=>label) */ public function attributeLabels() { return array('ID' => 'ID', 'Name' => '名字', 'Tel' => '电话', 'Email' => 'Email', 'Content' => '内容', 'Reply' => '回复', 'CreateTime' => '发布时间', 'UpdateTime' => '更新时间'); } /** * Retrieves a list of models based on the current search/filter conditions. * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions. */ public function search() {
public function beforeSave() { if (parent::beforeSave()) { if ($this->isNewRecord) { $this->CreateTime = $this->UpdateTime = time(); $this->AuthorID = Yii::app()->user->id; } else { $this->UpdateTime = time(); } return true; } else { return false; } }
public function beforeSave() { if (parent::beforeSave()) { if ($this->isNewRecord) { $this->CreateTime = $this->UpdateTime = time(); $this->Status = '0'; $this->UserID = Yii::app()->user->id; $this->OrganID = Yii::app()->user->getState('OrganID'); } else { $this->UpdateTime = time(); } return true; } else { return false; } }
protected function beforeSave() { if (parent::beforeSave()) { if ($this->isNewRecord) { $this->CreateTime = time(); $this->UpdateTime = time(); $this->OrganID = Yii::app()->user->getOrganID(); } else { $this->CreateTime = time(); $this->UpdateTime = time(); $this->OrganID = Yii::app()->user->getOrganID(); } return true; } else { return false; } }