class articleActions extends sfActions { public function executeIndex(sfWebRequest $request) { // sorting if ($request->getParameter('sort') && $this- >isValidSortColumn($request->getParameter('sort'))) { $this->setSort(array($request->getParameter('sort'), $request- >getParameter('sort_type'))); }
// pager if ($request->getParameter('page')) { $this->setPage($request->getParameter('page')); } $this->sort = $this->getSort(); $this->pager = $this->getPager(); } public function executeShow(sfWebRequest $request) { $this->tracker_article = Doctrine::getTable('TrackerArticle')- >find(array($request->getParameter('id'))); $this->forward404Unless($this->tracker_article); } public function executeConfirm(sfWebRequest $request) { $this->tracker_article = Doctrine::getTable('TrackerArticle')- >find(array($request->getParameter('id'))); $this->forward404Unless($this->tracker_article); } public function executeReturn(sfWebRequest $request) { $this->tracker_article = Doctrine::getTable('TrackerArticle')- >find(array($request->getParameter('id'))); $this->forward404Unless($this->tracker_article); } public function executeChangeStatus(sfWebRequest $request) { $id=$request->getParameter('id'); $q= Doctrine_Query::create() ->update('TrackerArticle') ->set('id_statut_article', $id) ->where('id=6'); $this->tracker_article = $q->execute(); $this->redirect('article/index'); } /* public function executeFilter(sfWebRequest $request) { $this->setPage(1); if ($request->hasParameter('_reset')) { $this->setFilters($this->getFilterDefaults()); $this->redirect('article/index'); } $this->filters = new TrackerArticleFormFilter($this- >getFilters()); $this->filters->bind($request->getParameter($this->filters- >getName())); if ($this->filters->isValid()) { $this->setFilters($this->filters->getValues()); $this->redirect('article/index'); } $this->pager = $this->getPager(); $this->sort = $this->getSort(); $this->setTemplate('index'); }*/ public function executeFilter(sfWebRequest $request) { $this->setPage(1); if ($request->hasParameter('_reset')) { $this->setFilters(array()); //reset, filtre vide $this->redirect('article/index'); } $this->filters = new TrackerArticleFormFilter($this- >getFilters()); $this->filters->bind($request->getParameter($this->filters- >getName())); if ($this->filters->isValid()) { $this->setFilters($this->filters->getValues()); $this->redirect('article/index'); } $this->pager = $this->getPager(); $this->sort = $this->getSort(); $this->setTemplate('index'); } public function executeNew(sfWebRequest $request) { $this->form = new TrackerArticleForm(); } public function executeCreate(sfWebRequest $request) { $this->forward404Unless($request->isMethod(sfRequest::POST)); $this->form = new TrackerArticleForm(); $this->processForm($request, $this->form); $this->setTemplate('new'); } public function executeEdit(sfWebRequest $request) { $this->forward404Unless($tracker_article = Doctrine::getTable('TrackerArticle')->find(array($request- >getParameter('id'))), sprintf('Object tracker_article does not exist (%s).', $request->getParameter('id'))); $this->form = new TrackerArticleForm($tracker_article); } public function executeUpdate(sfWebRequest $request) { $this->forward404Unless($request->isMethod(sfRequest::POST) || $request->isMethod(sfRequest::PUT)); $this->forward404Unless($tracker_article = Doctrine::getTable('TrackerArticle')->find(array($request- >getParameter('id'))), sprintf('Object tracker_article does not exist (%s).', $request->getParameter('id'))); $this->form = new TrackerArticleForm($tracker_article); $this->processForm($request, $this->form); $this->setTemplate('edit'); } public function executeDelete(sfWebRequest $request) { $request->checkCSRFProtection(); $this->forward404Unless($tracker_article = Doctrine::getTable('TrackerArticle')->find(array($request- >getParameter('id'))), sprintf('Object tracker_article does not exist (%s).', $request->getParameter('id'))); $tracker_article->delete(); $this->redirect('article/index'); } /* protected function processForm(sfWebRequest $request, sfForm $form) { $form->bind($request->getParameter($form->getName()), $request- >getFiles($form->getName())); if ($form->isValid()) { $tracker_article = $form->save(); $this->redirect('article/edit?id='.$tracker_article->getId()); } } */ protected function processForm(sfWebRequest $request, sfForm $form) { $form->bind($request->getParameter($form->getName()), $request- >getFiles($form->getName())); if ($form->isValid()) { $tracker_article = $form->save(); $this->redirect('article/confirm?id='.$tracker_article- >getId()); } } protected function getFilters() { return $this->getUser()->getAttribute('article.filters', $this- >getFilterDefaults()); } protected function setFilters(array $filters) { return $this->getUser()->setAttribute('article.filters', $filters); } protected function getPager() { $pager = new sfDoctrinePager('TrackerArticle',5); $pager->setQuery($this->buildQuery()); $pager->setPage($this->getPage()); $pager->init(); return $pager; } protected function setPage($page) { $this->getUser()->setAttribute('article.page', $page); } protected function getPage() { return $this->getUser()->getAttribute('article.page',1); } protected function buildQuery() { $this->filters = new TrackerArticleFormFilter($this- >getFilters()); $query = $this->filters->buildQuery($this->getFilters()); $this->addSortQuery($query); return $query; } protected function addSortQuery($query) { if (array(null, null) == ($sort = $this->getSort())) { return; } $query->addOrderBy($sort[0] . ' ' . $sort[1]); } protected function getSort() { if (null !== $sort = $this->getUser()- >getAttribute('article.sort', null)) { return $sort; } $this->setSort($this->getDefaultSort()); return $this->getUser()->getAttribute('article.sort'); } protected function setSort(array $sort) { if (null !== $sort[0] && null === $sort[1]) { $sort[1] = 'asc'; } $this->getUser()->setAttribute('article.sort', $sort); } // those methods are moved from configuration protected function getDefaultSort() { return array(null, null); } public function getFilterDefaults() { return array(); } protected function isValidSortColumn($column) { return Doctrine::getTable('TrackerArticle')->hasColumn($column); } } On 27 août, 17:14, Gustavo Adrian <comfortablynum...@gmail.com> wrote: > Could you show us your action's code? > > On Fri, Aug 27, 2010 at 12:11 PM, ziclo <lauren...@gmail.com> wrote: > > More explanation about this issue : > > > If the number of objects returned is > 10 then objects are displayed. > > If number of objects returned < 10 then nothing is displayed. > > I think there is a problem with the pager. But what ? > > > An idea ? > > > Thank you > > > On 6 août, 15:46, ziclo <lauren...@gmail.com> wrote: > > > My symfony version : 1.4.1 withdoctrine > > > > On 6 août, 14:57, ziclo <lauren...@gmail.com> wrote: > > > > > Hi everybody ! > > > > > On the frontend i have a module called "articles" which is composed by > > > > a list of results. I usedoctrinepagerlike the one in the admin > > > > backend. > > > > > I have set up a max number of rows for thepager(=10). I also use a > > > >doctrinefilter (on the same view as result, like the admin backend). > > > > > Here is the sequence : > > > > > 1 / I select an article's category > > > > 2 / I send the form (filter) by clicking on the submit button > > > > 3 / A list of articles is displayed. > > > > > But if the result (number of articles found with the request (filter)) > > > > is < max per page parameter (10) nothing is displayed. > > > > > An idea ? > > > > > Thank you very much > > > -- > > If you want to report a vulnerability issue on symfony, please send it to > > security at symfony-project.com > > > You received this message because you are subscribed to the Google > > Groups "symfony users" group. > > To post to this group, send email to symfony-users@googlegroups.com > > To unsubscribe from this group, send email to > > symfony-users+unsubscr...@googlegroups.com<symfony-users%2bunsubscr...@googlegroups.com> > > For more options, visit this group at > >http://groups.google.com/group/symfony-users?hl=en -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en