コード例 #1
0
 public function resolve(IRequest $request)
 {
     if ($request->hasGetParameter('action')) {
         return $this->createActionByName($request->getGetParameter('action'));
     }
     return $this->createDefaultAction();
 }
コード例 #2
0
 public function process(IRequest $request)
 {
     if (!$request->hasGetParameter('post_id')) {
         $this->getRenderer()->render('404', new NullResponse());
         return;
     }
     $this->getRenderer()->render('post', new Response($this->getDaoFactory()->getPostDao()->getById($request->getGetParameter('post_id')), $this->getDaoFactory()->getPostCommentDao()->getListByPostId($request->getGetParameter('post_id'))));
 }
コード例 #3
0
 public function process(IRequest $request)
 {
     if ($request->isPosted()) {
         $form = (new AuthorizationForm())->import($request->getPostParameters());
         if ($form->isValid()) {
             $this->authorize($form);
             $this->getRenderer()->render('index', new RedirectResponse('index'));
         }
     }
     $this->getRenderer()->render('authorization', new NullResponse());
 }
コード例 #4
0
 public function process(IRequest $request)
 {
     if ($request->isPosted()) {
         $form = (new AddCommentForm())->import($request->getPostParameters());
         if ($form->isValid()) {
             try {
                 $this->addComment($form);
             } catch (Exception $e) {
                 echo 'Bad SQL request';
             }
             $this->getRenderer()->render('viewPost', new RedirectResponse('viewPost', array('post_id' => $form->getPostId())));
         }
     }
     $this->getRenderer()->render('404', new NullResponse());
 }
コード例 #5
0
ファイル: AddPostAction.php プロジェクト: aletyagin/test-blog
 public function process(IRequest $request)
 {
     if ($request->isPosted()) {
         $form = (new AddPostForm())->import($request->getPostParameters());
         if ($form->isValid()) {
             try {
                 $this->addPost($form);
             } catch (Exception $e) {
                 echo 'Bad SQL request';
             }
             $this->getRenderer()->render('index', new RedirectResponse('index'));
         }
     }
     $this->getRenderer()->render('addPost', new NullResponse());
 }