public function executeIndex(sfWebRequest $request) { $this->step = sfConfig::get('app_max_cards_on_cardlist'); $this->getUser()->syncParameters($this, 'card', 'index', array('offset', 'limit', 'numberPattern', 'sort_column', 'sort_direction'), $request); if (is_null($this->sort_column)) { $this->sort_column = 'card_number'; $this->sort_direction = 'up'; } $this->searchForm = new CardSearchForm(); $c = CardPeer::getSortByNumberAscCriteria(); SortCriteria::addSortCriteria($c, $this->sort_column, CardPeer::getSortAliases(), $this->sort_direction); if (is_null($this->offset)) { $this->offset = 0; } if (is_null($this->limit) || $this->limit <= 0) { $this->limit = $this->step; } if (!empty($this->numberPattern)) { $tmpc = CardPeer::getSearchNumberPatternCriteria($this->numberPattern); $this->searchCount = CardPeer::getCardsCount($tmpc); $c = CardPeer::getSearchNumberPatternCriteria($this->numberPattern, $c); } $this->card_list = CardPeer::doSelectCards($this->offset, $this->limit, $c); $this->count = CardPeer::getCardsCount(); if ($this->offset < 0 || $this->offset >= $this->count && $this->count > 0) { $this->forward404(); } }