コード例 #1
0
ファイル: actions.class.php プロジェクト: jfesquet/tempos
 public function executeIndex(sfWebRequest $request)
 {
     $this->step = sfConfig::get('app_max_features_on_featurelist');
     $this->getUser()->syncParameters($this, 'energyaction', 'index', array('offset', 'limit', 'sort_column', 'sort_direction'), $request);
     if (is_null($this->sort_column)) {
         $this->sort_column = 'name';
         $this->sort_direction = 'up';
     }
     if (is_null($this->offset)) {
         $this->offset = 0;
     }
     if (is_null($this->limit) || $this->limit <= 0) {
         $this->limit = $this->step;
     }
     $c = new Criteria();
     SortCriteria::addSortCriteria($c, $this->sort_column, EnergyactionPeer::getSortAliases(), $this->sort_direction);
     $c->setOffset($this->offset);
     if ($this->limit >= 0) {
         $c->setLimit($this->limit);
     }
     $this->energyaction_list = EnergyactionPeer::doSelect($c);
     $this->count = EnergyactionPeer::doCount(new Criteria());
     if ($this->offset < 0 || $this->offset >= $this->count && $this->count > 0) {
         $this->forward404();
     }
 }