Esempio n. 1
0
 public function actionAdd()
 {
     $article = new BlogPost();
     $article->author_id = WebApp::get()->user()->id;
     $article->time_written = date('Y-m-d H:i:s');
     $article->status = BlogPost::STATUS_NEW;
     if (isset($_POST['BlogPost']) && $article->setAttributes($_POST['BlogPost'])->save()) {
         $article->afterAdminEdit();
         $this->goToPage('home', 'read', ['id' => $article->id, 'title' => $article->url]);
     }
     $this->assign('model', $article);
     Messages::get()->info("Add " . BlogConfig::get()->introductionSeparator . " to set the limit for text displayed on the articles list!");
 }