<?php
// auto-generated by sfPropelCrud
// date: 2008/01/21 16:03:00
?>
<?php

include_once("lib.backend/class.httpdownload.php"); 
/**
 * presentation actions.
 *
 * @package    tvtl
 * @subpackage presentation
 * @author     Your name here
 * @version    SVN: $Id: actions.class.php 3335 2007-01-23 16:19:56Z fabien $
 */
class presentationActions extends autopresentationActions
{
  public function executeShow()
  {
    $this->tblpresentation = TblpresentationPeer::retrieveByPk($this->getRequestParameter('pr_id'));
    $this->forward404Unless($this->tblpresentation);
  }

  public function executeCreate()
  {
    $this->tblpresentation = new Tblpresentation();

    $this->setTemplate('edit');
  }

  public function executeEdit()
  {
    $this->tblpresentation = TblpresentationPeer::retrieveByPk($this->getRequestParameter('pr_id'));
    $this->forward404Unless($this->tblpresentation);
  }

  public function executeUpdate()
  {
    if (!$this->getRequestParameter('pr_id'))
    {
      $tblpresentation = new Tblpresentation();
    }
    else
    {
      $tblpresentation = TblpresentationPeer::retrieveByPk($this->getRequestParameter('pr_id'));
      $this->forward404Unless($tblpresentation);
    }

    $tblpresentation->setPrId($this->getRequestParameter('pr_id'));
    $tblpresentation->setPrCategory($this->getRequestParameter('pr_category'));
    $tblpresentation->setPrName($this->getRequestParameter('pr_name'));
    $tblpresentation->setPrSource($this->getRequestParameter('pr_source'));
    $tblpresentation->setPrKeyword($this->getRequestParameter('pr_keyword'));
    $tblpresentation->setPrType($this->getRequestParameter('pr_type'));
    $tblpresentation->setPrFilename($this->getRequestParameter('pr_filename'));
    $tblpresentation->setPrUser($this->getRequestParameter('pr_user'));
    $tblpresentation->setPrSlides($this->getRequestParameter('pr_slides'));
    if ($this->getRequestParameter('pr_date'))
    {
      list($d, $m, $y) = sfI18N::getDateForCulture($this->getRequestParameter('pr_date'), $this->getUser()->getCulture());
      $tblpresentation->setPrDate("$y-$m-$d");
    }
    $tblpresentation->setPrHit($this->getRequestParameter('pr_hit'));
    $tblpresentation->setPrStatus($this->getRequestParameter('pr_status'));
    $tblpresentation->setPrPlayername($this->getRequestParameter('pr_playername'));
    $tblpresentation->setPrContent($this->getRequestParameter('pr_content'));
    $tblpresentation->setPrView($this->getRequestParameter('pr_view'));
    $tblpresentation->setPrPrice($this->getRequestParameter('pr_price'));

    if ($this->getRequestParameter('clearThumbnail')==1) {
       @unlink($tblpresentation->getBasePath() . "/images/Slide0.jpg");
    }

    $tblpresentation->save();

    return $this->redirect('presentation/show?pr_id='.$tblpresentation->getPrId());
  }

  public function executeDelete()
  {
    $tblpresentation = TblpresentationPeer::retrieveByPk($this->getRequestParameter('pr_id'));

    $this->forward404Unless($tblpresentation);

    $tblpresentation->delete();

    return $this->redirect('presentation/list');
  }
}
