root/trunk/apps/snippets/modules/comment/actions/actions.class.php

Revision 2, 1.0 kB (checked in by fabien, 4 years ago)

initial import

  • Property svn:mime-type set to text/x-php
  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
Line 
1 <?php
2
3 /**
4  * comment actions.
5  *
6  * @package    sf_sandbox
7  * @subpackage comment
8  * @author     Your name here
9  * @version    SVN: $Id$
10  */
11 class commentActions extends sfActions
12 {
13   /**
14    * Executes index action
15    *
16    */
17   public function executeAdd()
18   {
19     if($this->getRequestParameter('body'))
20     {
21       $comment = new SnippetComment();
22       $comment->setSnippetId($this->getRequestParameter('snippet_id'));
23       $comment->setUserId($this->getUser()->getUserId());
24       $comment->setBody($this->getRequestParameter('body'));
25
26       $comment->save();
27
28       $this->comment = $comment;
29       $this->rank = $this->getRequestParameter('rank');
30     }
31     else
32     {
33       return sfView::NONE;
34     }
35   }
36
37   public function executeDelete()
38   {
39     $comment = SnippetCommentPeer::retrieveByPk($this->getRequestParameter('id'));
40     $this->forward404Unless($comment);
41
42     $snippet = $comment->getSnippetSnippet();
43
44     $comment->delete();
45
46     $this->redirect('snippet/show?id='.$snippet->getId());
47   }
48 }
49
50 ?>
Note: See TracBrowser for help on using the browser.