コード例 #1
0
 public function beforeSave()
 {
     if ($this->isNewRecord()) {
         $this->added_by = WebApp::get()->user()->id;
         $this->added_time = date('Y-m-d H:i:s');
     }
     return parent::beforeSave();
     // TODO: Change the autogenerated stub
 }
コード例 #2
0
 public function beforeSave()
 {
     if (WebApp::get()->user()->isConnected()) {
         $this->user_id = WebApp::get()->user()->id;
         $this->username = WebApp::get()->user()->name;
         $this->email = WebApp::get()->user()->email;
     } elseif (!trim($this->email)) {
         $this->setError('email', 'Email is required  for guests!');
         return false;
     } elseif (!trim($this->username)) {
         $this->setError('username', 'Name is required for quests!');
         return false;
     }
     $this->published_time = date('Y-m-d H:i:s');
     $this->status = BlogComment::STATUS_OK;
     return parent::beforeSave();
     // TODO: Change the autogenerated stub
 }
コード例 #3
0
 public function beforeSave()
 {
     if ($this->isNewRecord()) {
         $this->user_id = WebApp::get()->user()->id;
     }
     return parent::beforeSave();
 }
コード例 #4
0
 public function beforeSave()
 {
     if (is_a(App::get(), '\\mpf\\WebApp') && WebApp::get()->request()->getModule()) {
         if (!UserAccess::get()->isSectionAdmin($this->section_id)) {
             Messages::get()->error("You don't have access to edit this user group!");
             return false;
         }
     }
     return parent::beforeSave();
 }
コード例 #5
0
 public function beforeSave()
 {
     if (!UserAccess::get()->isSectionAdmin($this->section_id)) {
         Messages::get()->error("You can't edit this category!");
         return false;
     }
     if ($this->isNewRecord()) {
         $this->user_id = WebApp::get()->user()->id;
     }
     return parent::beforeSave();
 }