Exemplo n.º 1
0
 public function beforeSave()
 {
     if (parent::beforeSave()) {
         if ($this->isNewRecord) {
             $this->pubdate = time();
             $this->approved = self::APPROVED_PUBLISHED;
             $this->agent = CHttpRequest::getUserAgent();
             $this->uid = Yii::app()->user->id;
             $this->ip = CHttpRequest::getUserHostAddress();
             $this->author = Yii::app()->user->name;
             $this->url = Yii::app()->request->getRequestUri();
             $this->email = Profile::model()->getEmail();
         } else {
         }
         return true;
     } else {
         return false;
     }
 }