<?php

/**
 * public actions.
 *
 * @package    sf_sandbox
 * @subpackage public
 * @author     Your name here
 * @version    SVN: $Id: actions.class.php 9301 2008-05-27 01:08:46Z dwhittle $
 */
class publicActions extends sfActions
{
 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
    public function executeIndex($request)
    {
        $c = new Criteria(); 
        $c->addDescendingOrderByColumn(PhotoPeer::CREATED_AT); 
        $this->photos = PhotoPeer::doSelect($c);
    }
    public function preExecute() 
    { 
        $this->getResponse()->addStylesheet('frontend');  
    }
    public function executePhoto() 
    { 
        $photo = PhotoPeer::retrieveByPk($this->getRequestParameter('id')); 
        $this->forward404unless($photo); 
        $this->photo = $photo; 
    }
    public function executeFullSizeImage() 
    { 
        $photo = PhotoPeer::retrieveByPk($this->getRequestParameter('id')); 
        $this->forward404unless($photo); 
        $this->photo = $photo; 
    }
    public function executeAddComment() 
    { 
        $this->forward404unless($photo = PhotoPeer::retrieveByPk($this->getRequestParameter('photo_id'))); 
        $comment = new Comment(); 
        $comment->setPhoto($photo); 
        $comment->setAuthor($this->getRequestParameter('author')); 
        $comment->setBody($this->getRequestParameter('body')); 
        $comment->save(); 
            
        $this->comment = $comment;
        $this->photo=$photo;
    }
}
