コード例 #1
0
ファイル: actions.class.php プロジェクト: jfesquet/tempos
 public function executeIndex(sfWebRequest $request)
 {
     $this->step = sfConfig::get('app_max_activities_on_activitylist');
     $this->getUser()->syncParameters($this, 'activity', '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, ActivityPeer::getSortAliases(), $this->sort_direction);
     $c->setOffset($this->offset);
     if ($this->limit >= 0) {
         $c->setLimit($this->limit);
     }
     $this->activity_list = ActivityPeer::doSelect($c);
     $this->count = ActivityPeer::doCount(new Criteria());
     if ($this->offset < 0 || $this->offset >= $this->count && $this->count > 0) {
         $this->forward404();
     }
 }