Controller/WikiTagController.php
changeset 12 81cc9274c20a
parent 11 5f038a505cd7
child 13 c288952a089f
equal deleted inserted replaced
11:5f038a505cd7 12:81cc9274c20a
   337         return $this->render('WikiTagBundle:WikiTag:tagTable.html.twig', array('ordered_tags' => $ordered_tags, 'doc_id' => $id_doc));
   337         return $this->render('WikiTagBundle:WikiTag:tagTable.html.twig', array('ordered_tags' => $ordered_tags, 'doc_id' => $id_doc));
   338     }
   338     }
   339     
   339     
   340     /**
   340     /**
   341      * 
   341      * 
   342      * @Route("/wtrwi")
       
   343      * TODO: Enter description here ...
   342      * TODO: Enter description here ...
   344      * TODO : implement
   343      * TODO : implement
   345      */
   344      */
   346     public function resetWpInfoAction()
   345     public function resetWpInfoAction()
   347     {
   346     {
   356      * TODO : implement
   355      * TODO : implement
   357      * @return \Symfony\Bundle\FrameworkBundle\Controller\Response
   356      * @return \Symfony\Bundle\FrameworkBundle\Controller\Response
   358      */
   357      */
   359     public function updateTagAliasAction()
   358     public function updateTagAliasAction()
   360     {
   359     {
   361         $id_doc = $this->getRequest()->request->get('wikitag_document_id');
   360         $id_tag = $this->getRequest()->request->get('id');
   362         return $this->renderDocTags($id_doc);
   361         $alias = $this->getRequest()->request->get('value');
       
   362         // We get the Tag and update its category.
       
   363         $em = $this->getDoctrine()->getEntityManager();
       
   364         $tag = $this->getDoctrine()->getRepository('WikiTagBundle:Tag')->find($id_tag);
       
   365         $tag->setAlias($alias);
       
   366         $em->flush();
       
   367         
       
   368         $id_doc = $this->getRequest()->request->get('wikitag_document_id');
       
   369         if($id_doc && $id_doc!=""){
       
   370             // In case we changed the alias from the document view
       
   371             return $this->renderDocTags($id_doc);
       
   372         }
       
   373         else{
       
   374             // In case we changed the alias from the tag list.
       
   375             $num_page = $this->getRequest()->request->get('num_page');
       
   376             $nb_by_page = $this->getRequest()->request->get('nb_by_page');
       
   377             $sort = $this->getRequest()->request->get('sort');
       
   378             $searched = $this->getRequest()->request->get('searched');
       
   379             return $this->renderAllTags($num_page, $nb_by_page, $sort, $searched);
       
   380         }
   363     }
   381     }
   364     
   382     
   365     /**
   383     /**
   366      * List of all tags
   384      * List of all tags
   367      * TODO: Enter description here ...
   385      * TODO: Enter description here ...
   442         $num_page = $ar[1];
   460         $num_page = $ar[1];
   443         $nb_by_page = $ar[2];
   461         $nb_by_page = $ar[2];
   444         $searched = $ar[3];
   462         $searched = $ar[3];
   445         $sort = $ar[4];
   463         $sort = $ar[4];
   446         $reverse_sort = $ar[5];
   464         $reverse_sort = $ar[5];
   447         //$pagerfanta = $ar[6];
       
   448         
   465         
   449         return $this->render('WikiTagBundle:WikiTag:TagListTable.html.twig', 
   466         return $this->render('WikiTagBundle:WikiTag:TagListTable.html.twig', 
   450             array('tags' => $tags, 'searched' => $searched, 'nb_by_page' => $nb_by_page, 'sort' => $sort, 'num_page' => $num_page, 'reverse_sort' => $reverse_sort));
   467             array('tags' => $tags, 'searched' => $searched, 'nb_by_page' => $nb_by_page, 'sort' => $sort, 'num_page' => $num_page, 'reverse_sort' => $reverse_sort));
   451     }
   468     }
   452 
   469