public function executeRecentPosts()
 {
   $this->posts = sfSimpleBlogPostQuery::create()
     ->select(array('Title', 'PublishedAt', 'StrippedTitle'))
     ->recent()
     ->published()
     ->limit(sfConfig::get('app_sfSimpleBlog_post_recent', 5))
     ->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 executeRestoreVersion(sfWebRequest $request)
  {
    $request->checkCSRFProtection();
    
    $this->forward404Unless($post = sfSimpleBlogPostQuery::create()->findPk($request->getParameter('id')));

    $new_version = $request->getParameter('version');
    $post->toVersion($new_version)->save();
    
    $this->getUser()->setFlash('notice', 'item has been restored to version = '.$new_version);
    $this->redirect('@sf_simple_blog_post_edit?id='.$post->getId());
  }
 public function executeMonthArchives(sfWebRequest $request)
 {
   $month = $request->getParameter('month');
   $year = $request->getParameter('year');
   $this_month = mktime(0, 0, 0, $month, 1, $year);
   $next_month = mktime(0, 0, 0, $month+1, 1, $year);
   $this->posts = sfSimpleBlogPostQuery::create()
     ->recent()
     ->published()
     ->filterByPublishedAt($this_month, Criteria::GREATER_EQUAL)
     ->filterByPublishedAt($next_month, Criteria::LESS_THAN)
     ->find();
   $this->this_month = $this_month;
 }
  public function executePostsForTagFeed(sfWebRequest $request)
  {
    sfApplicationConfiguration::getActive()->loadHelpers(array('I18N'));
    $this->forward404Unless($tag = $request->getParameter('tag'));
    $posts = sfSimpleBlogPostQuery::create()
      ->recent()
      ->tagged($tag)
      ->limit($request->getParameter('nb', sfConfig::get('app_sfSimpleBlog_feed_count', 5)))
      ->find();

      $this->feed = sfFeedPeer::createFromObjects(
      $posts,
      array(
        'format'      => $request->getParameter('format', 'atom1'),
        'title'       => __('Posts tagged "%1%" from %2%', array('%1%' => $tag, '%2%' => sfConfig::get('app_sfSimpleBlog_title', ''))),
        'link'        => $this->getController()->genUrl('sfSimpleBlog/showByTag?tag='.$tag),
        'authorName'  => sfConfig::get('app_sfSimpleBlog_author', ''),
        'methods'     => array('authorEmail' => '')
      )
    );
    $this->setTemplate('feed');
  }
 public function getNextPost()
 {
   return sfSimpleBlogPostQuery::create()
       ->nextPublished($this->getInternalPublishedAt())
       ->findOne();
 }
<?php use_helper('I18N') ?>
<div id="sf_admin_container" class="clearfix">
  <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>