[ Index ]
 

Code source de Symfony 1.0.0

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/data/generator/sfPropelCrud/default/template/actions/ -> actions.class.php (source)

   1  [?php
   2  
   3  /**
   4   * <?php echo $this->getGeneratedModuleName() ?> actions.
   5   *
   6   * @package    ##PROJECT_NAME##
   7   * @subpackage <?php echo $this->getGeneratedModuleName() ?>
   8  
   9   * @author     ##AUTHOR_NAME##
  10   * @version    SVN: $Id: actions.class.php 3335 2007-01-23 16:19:56Z fabien $
  11   */
  12  class <?php echo $this->getGeneratedModuleName() ?>Actions extends sfActions
  13  {
  14    public function executeIndex()
  15    {
  16      return $this->forward('<?php echo $this->getModuleName() ?>', 'list');
  17    }
  18  
  19    public function executeList()
  20    {
  21      $this-><?php echo $this->getPluralName() ?> = <?php echo $this->getClassName() ?>Peer::doSelect(new Criteria());
  22    }
  23  
  24    public function executeShow()
  25    {
  26      $this-><?php echo $this->getSingularName() ?> = <?php echo $this->getClassName() ?>Peer::retrieveByPk(<?php echo $this->getRetrieveByPkParamsForAction(49) ?>);
  27      $this->forward404Unless($this-><?php echo $this->getSingularName() ?>);
  28    }
  29  
  30    public function executeCreate()
  31    {
  32      $this-><?php echo $this->getSingularName() ?> = new <?php echo $this->getClassName() ?>();
  33  
  34      $this->setTemplate('edit');
  35    }
  36  
  37    public function executeEdit()
  38    {
  39      $this-><?php echo $this->getSingularName() ?> = <?php echo $this->getClassName() ?>Peer::retrieveByPk(<?php echo $this->getRetrieveByPkParamsForAction(49) ?>);
  40      $this->forward404Unless($this-><?php echo $this->getSingularName() ?>);
  41    }
  42  
  43    public function executeUpdate()
  44    {
  45      if (<?php echo $this->getTestPksForGetOrCreate(false) ?>)
  46      {
  47        $<?php echo $this->getSingularName() ?> = new <?php echo $this->getClassName() ?>();
  48      }
  49      else
  50      {
  51        $<?php echo $this->getSingularName() ?> = <?php echo $this->getClassName() ?>Peer::retrieveByPk(<?php echo $this->getRetrieveByPkParamsForAction(45) ?>);
  52        $this->forward404Unless($<?php echo $this->getSingularName() ?>);
  53      }
  54  
  55  <?php foreach ($this->getTableMap()->getColumns() as $name => $column): $type = $column->getCreoleType(); ?>
  56  <?php if ($name == 'CREATED_AT' || $name == 'UPDATED_AT') continue ?>
  57  <?php $name = sfInflector::underscore($column->getPhpName()) ?>
  58  <?php if ($type == CreoleTypes::DATE || $type == CreoleTypes::TIMESTAMP): ?>
  59      if ($this->getRequestParameter('<?php echo $name ?>'))
  60      {
  61        list($d, $m, $y) = sfI18N::getDateForCulture($this->getRequestParameter('<?php echo $name ?>'), $this->getUser()->getCulture());
  62        $<?php echo $this->getSingularName() ?>->set<?php echo $column->getPhpName() ?>("$y-$m-$d");
  63      }
  64  <?php elseif ($type == CreoleTypes::BOOLEAN): ?>
  65      $<?php echo $this->getSingularName() ?>->set<?php echo $column->getPhpName() ?>($this->getRequestParameter('<?php echo $name ?>', 0));
  66  <?php elseif ($column->isForeignKey()): ?>
  67      $<?php echo $this->getSingularName() ?>->set<?php echo $column->getPhpName() ?>($this->getRequestParameter('<?php echo $name ?>') ? $this->getRequestParameter('<?php echo $name ?>') : null);
  68  <?php else: ?>
  69      $<?php echo $this->getSingularName() ?>->set<?php echo $column->getPhpName() ?>($this->getRequestParameter('<?php echo $name ?>'));
  70  <?php endif; ?>
  71  <?php endforeach; ?>
  72  
  73      $<?php echo $this->getSingularName() ?>->save();
  74  
  75      return $this->redirect('<?php echo $this->getModuleName() ?>/show?<?php echo $this->getPrimaryKeyUrlParams() ?>);
  76  <?php //' ?>
  77    }
  78  
  79    public function executeDelete()
  80    {
  81      $<?php echo $this->getSingularName() ?> = <?php echo $this->getClassName() ?>Peer::retrieveByPk(<?php echo $this->getRetrieveByPkParamsForAction(43) ?>);
  82  
  83      $this->forward404Unless($<?php echo $this->getSingularName() ?>);
  84  
  85      $<?php echo $this->getSingularName() ?>->delete();
  86  
  87      return $this->redirect('<?php echo $this->getModuleName() ?>/list');
  88    }
  89  }


Généré le : Fri Mar 16 22:42:14 2007 par Balluche grâce à PHPXref 0.7