예제 #1
0
 public function executeIndex(sfWebRequest $request)
 {
     $this->step = sfConfig::get('app_max_usergroups_on_usergrouplist');
     $this->getUser()->syncParameters($this, 'usergroup', '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, UsergroupPeer::getSortAliases(), $this->sort_direction);
     $c->setOffset($this->offset);
     if ($this->limit >= 0) {
         $c->setLimit($this->limit);
     }
     $this->usergroup_list = UsergroupPeer::doSelect($c);
     $c2 = new Criteria();
     $this->count = UsergroupPeer::doCount($c2);
     if ($this->offset < 0 || $this->offset >= $this->count && $this->count > 0) {
         $this->forward404();
     }
 }