public function executeRecentComments() { $this->comments = sfNestedCommentQuery::create() ->recent() ->approved() ->limit(sfNestedCommentConfig::getMaxRecentCommet()) ->find(); }
public function executeSaveDraft(sfWebRequest $request) { $this->quickForm = new sfSimpleBlogPostSimpleForm(); if ($this->quickForm->bindAndSave($request->getParameter($this->quickForm->getName()))) { return $this->redirect('sfSimpleBlogAdmin/dashboard'); } $this->recentComments = sfNestedCommentQuery::create()->recent()->limit(5)->find(); $this->drafts = sfSimpleBlogPostQuery::create()->draft()->find(); $this->setTemplate('dashboard'); }
public function executeNew(sfWebRequest $request) { parent::executeNew($request); $this->parent_comment = sfNestedCommentQuery::create()->findPk($request->getParameter('id')); $this->form->setDefault('sf_comment_id', $this->parent_comment->getId()); $this->form->setDefault('commentable_model', $this->parent_comment->getsfNestedCommentableModel()->getCommentableModel()); $this->form->setDefault('commentable_id', $this->parent_comment->getsfNestedCommentableModel()->getCommentableId()); $this->form->setDefault('sf_commentable_model_id', $this->parent_comment->getSfCommentableModelId()); $this->form->setDefault('author_name', $this->getUser()->getAuthorName()); $this->form->setDefault('author_email', $this->getUser()->getAuthorEmail()); $this->form->setDefault('author_url', $this->getUser()->getAuthorWebsite()); $this->form->setDefault('user_id', $this->getUser()->getAuthorId()); }
protected function updateCommentCounterObject(PropelPDO $con = null) { $commentable = $this->getsfNestedCommentableModel($con); $comments = sfNestedCommentQuery::create() ->filterBySfCommentableModelId($commentable->getId()) ->count($con); $approveds = sfNestedCommentQuery::create() ->approved() ->filterBySfCommentableModelId($commentable->getId()) ->count($con); $commentable->setNbApprovedComments($approveds); $commentable->setNbComments($comments); $commentable->save($con); }
protected function doUpdateObject($values) { parent::doUpdateObject($values); $commentable = sfNestedCommentableModelQuery::create()->model($this->getValues())->findOneOrCreate(); $commentable->setCommentableId($this->getValue('commentable_id')); $commentable->setCommentableModel($this->getValue('commentable_model')); $automoderation = sfNestedCommentConfig::getMailAutomoderation(); if($automoderation === true || (($automoderation == 'first_post') && !sfNestedCommentQuery::create()->isAuthorApproved($this->getObject()->getAuthorName(), $this->getObject()->getAuthorEmail()))) { $this->getObject()->setIsModerated(true); } $this->getObject()->setsfNestedCommentableModel($commentable); }
<div class="dashboard_box"> <div class="box"> <h2><?php echo __('At a Glance', null, 'sf_simple_blog') ?></h2> <table> <tbody> <tr> <td><h3><?php echo __('Contents', null, 'sf_simple_blog') ?></h3></td> <td><h3><?php echo __('Comments', null, 'sf_simple_blog') ?></h3></td> </tr> <tr> <td><?php echo sfSimpleBlogPostQuery::create()->count() ?> Posts</td> <td><?php echo $nbComments = sfNestedCommentQuery::create()->count() ?> Comments</td> </tr> <tr> <td><?php echo sfSimpleBlogPageQuery::create()->count() ?> Pages</td> <td><?php echo $nbApprovedComments = sfNestedCommentQuery::create()->approved()->count() ?> Approved</td> </tr> <tr> <td><?php echo sfSimpleBlogCategoryQuery::create()->count() ?> Categories</td> <td><?php echo $nbComments - $nbApprovedComments ?> Pending</td> </tr> <tr> <td><?php echo TagQuery::create()->count() ?> Tags</td> </tr> </tbody> </table> </div> <div class="box"> <h2><?php echo __('Recent Comments', null, 'sf_simple_blog') ?></h2> <table> <tbody>