Controller/WikiTagController.php
changeset 54 ec51b9f4695f
parent 53 22377c9e2eae
child 59 ea562f37d7a5
equal deleted inserted replaced
53:22377c9e2eae 54:ec51b9f4695f
   616         $reverse_sort = $ar[5];
   616         $reverse_sort = $ar[5];
   617         
   617         
   618         return $this->render('WikiTagBundle:WikiTag:TagListTable.html.twig',
   618         return $this->render('WikiTagBundle:WikiTag:TagListTable.html.twig',
   619             array('tags' => $tags, 'searched' => $searched, 'nb_by_page' => $nb_by_page, 'sort' => $sort, 'num_page' => $num_page,
   619             array('tags' => $tags, 'searched' => $searched, 'nb_by_page' => $nb_by_page, 'sort' => $sort, 'num_page' => $num_page,
   620         	'reverse_sort' => $reverse_sort, 'route_for_documents_by_tag' => $this->container->getParameter("wiki_tag.route_for_documents_by_tag")));
   620         	'reverse_sort' => $reverse_sort, 'route_for_documents_by_tag' => $this->container->getParameter("wiki_tag.route_for_documents_by_tag")));
   621         
       
   622         return $this->getAllTags();
       
   623     }
   621     }
   624 
   622 
   625 
   623 
   626     /**
   624     /**
   627      * Generic to get all tags with the context (pagination number, nb by page, searched string, sort)
   625      * Generic to get all tags with the context (pagination number, nb by page, searched string, sort)
   631         // We get/set all the parameters for the search and pagination.
   629         // We get/set all the parameters for the search and pagination.
   632         // Searched string
   630         // Searched string
   633         if($searched==NULL){
   631         if($searched==NULL){
   634             $searched = "";
   632             $searched = "";
   635         }
   633         }
       
   634         $searched = urldecode($searched);
   636         // Number of tags per page
   635         // Number of tags per page
   637         if($nb_by_page==NULL){
   636         if($nb_by_page==NULL){
   638             $nb_by_page = 50;
   637             $nb_by_page = 50;
   639         }
   638         }
   640         // Current page number
   639         // Current page number
   641         if($num_page==NULL){
   640         if($num_page==NULL){
   642             $num_page = 1;
   641             $num_page = 1;
   643         }
   642         }
   644         
       
   645         // We build the query.
   643         // We build the query.
   646         $qb = $this->getDoctrine()->getEntityManager()->createQueryBuilder();
   644         $qb = $this->getDoctrine()->getEntityManager()->createQueryBuilder();
   647         $qb->select('t', 'COUNT( dt.id ) AS nb_docs');
   645         $qb->select('t', 'COUNT( dt.id ) AS nb_docs');
   648         $qb->from('WikiTagBundle:Tag','t');
   646         $qb->from('WikiTagBundle:Tag','t');
   649         $qb->leftJoin('t.documents', 'dt', 'WITH', 't = dt.tag');
   647         $qb->leftJoin('t.documents', 'dt', 'WITH', 't = dt.tag');