|
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 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 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 |
?> |
|---|