Esempio n. 1
0
 public function newAction(rtRequest $request)
 {
     $this->catagories = Catagory::getAll();
     if ($request->getMethod() == rtRequest::POST) {
         $post = new Post();
         $post->title = $request->getParameter('title');
         $post->content = $request->getParameter('content');
         $post->catagory_id = $request->getParameter('catagory_id');
         if ($post->isValid()) {
             $post->save();
             $this->setFlash('notice', '成功发布博文:)');
             $this->redirect('blog/index');
         }
     }
 }
Esempio n. 2
0
 public function executeCatagory()
 {
     $this->catagories = Catagory::getAll();
 }