Controller/WikiTagController.php
changeset 12 81cc9274c20a
parent 11 5f038a505cd7
child 13 c288952a089f
--- a/Controller/WikiTagController.php	Mon Oct 24 18:45:34 2011 +0200
+++ b/Controller/WikiTagController.php	Mon Oct 24 19:08:04 2011 +0200
@@ -339,7 +339,6 @@
     
     /**
      * 
-     * @Route("/wtrwi")
      * TODO: Enter description here ...
      * TODO : implement
      */
@@ -358,8 +357,27 @@
      */
     public function updateTagAliasAction()
     {
+        $id_tag = $this->getRequest()->request->get('id');
+        $alias = $this->getRequest()->request->get('value');
+        // We get the Tag and update its category.
+        $em = $this->getDoctrine()->getEntityManager();
+        $tag = $this->getDoctrine()->getRepository('WikiTagBundle:Tag')->find($id_tag);
+        $tag->setAlias($alias);
+        $em->flush();
+        
         $id_doc = $this->getRequest()->request->get('wikitag_document_id');
-        return $this->renderDocTags($id_doc);
+        if($id_doc && $id_doc!=""){
+            // In case we changed the alias from the document view
+            return $this->renderDocTags($id_doc);
+        }
+        else{
+            // In case we changed the alias from the tag list.
+            $num_page = $this->getRequest()->request->get('num_page');
+            $nb_by_page = $this->getRequest()->request->get('nb_by_page');
+            $sort = $this->getRequest()->request->get('sort');
+            $searched = $this->getRequest()->request->get('searched');
+            return $this->renderAllTags($num_page, $nb_by_page, $sort, $searched);
+        }
     }
     
     /**
@@ -444,7 +462,6 @@
         $searched = $ar[3];
         $sort = $ar[4];
         $reverse_sort = $ar[5];
-        //$pagerfanta = $ar[6];
         
         return $this->render('WikiTagBundle:WikiTag:TagListTable.html.twig', 
             array('tags' => $tags, 'searched' => $searched, 'nb_by_page' => $nb_by_page, 'sort' => $sort, 'num_page' => $num_page, 'reverse_sort' => $reverse_sort));