Controller/WikiTagController.php
changeset 7 7a877de630fd
parent 5 45378793512a
child 8 7d2fb5d7c9ff
--- a/Controller/WikiTagController.php	Wed Oct 19 14:33:40 2011 +0200
+++ b/Controller/WikiTagController.php	Wed Oct 19 15:44:23 2011 +0200
@@ -46,7 +46,7 @@
         $nbCats = count($cats);
         $ar = array('' => '');
         for($i=0;$i<$nbCats;$i++){
-            $temp = array($cats[$i]["Label"] => $cats[$i]["Label"]);
+            $temp = array($cats[$i]["label"] => $cats[$i]["label"]);
             $ar = array_merge($ar, $temp);
         }
         // ... so we create is json like {"":""},{"Créateur":"Créateur"},{"Datation":"Datation"},...
@@ -55,17 +55,6 @@
     }
 
     /**
-     * List all tags for doc
-     * TODO: doc_id as parameter
-     * TODO: Is this controller usefull ?
-     */
-    public function allTagsAction()
-    {
-        $ordered_tags = $this->getDoctrine()->getRepository('WikiTagBundle:DocumentTag')->findAll();
-        return $this->render('WikiTagBundle:WikiTag:documentTags.html.twig', array('ordered_tags' => $ordered_tags, 'doc_id' => 1));
-    }
-
-    /**
      * Display a list of ordered tag for a document
      * @param integer $id_doc
      */
@@ -190,17 +179,9 @@
 
     /**
      *
-     * TODO: Enter description here ...
-     */
-    public function resetWpInfoAction()
-    {
-        $id_doc = $this->getRequest()->request->get('wikitag_document_id');
-        return $this->renderDocTags($id_doc);
-    }
-
-    /**
-     *
+     * @Route("/wtrtd")
      * TODO : Enter description here ...
+     * TODO : implement
      */
     public function reorderTagDocumentAction()
     {
@@ -305,19 +286,6 @@
 
     /**
      *
-     * TODO : Enter description here ...
-     * TODO : implement
-     * @return \Symfony\Bundle\FrameworkBundle\Controller\Response
-     */
-    public function updateTagAliasAction()
-    {
-        $id_doc = $this->getRequest()->request->get('wikitag_document_id');
-        return $this->renderDocTags($id_doc);
-    }
-
-
-    /**
-     *
      * TODO: Enter description here ...
      */
     public function updateTagCategoryAction()
@@ -352,6 +320,46 @@
         $ordered_tags = $this->getDoctrine()->getRepository('WikiTagBundle:DocumentTag')->findOrderedTagsForDoc($id_doc);
         return $this->render('WikiTagBundle:WikiTag:tagTable.html.twig', array('ordered_tags' => $ordered_tags, 'doc_id' => $id_doc));
     }
+    
+    /**
+     * 
+     * @Route("/wtrwi")
+     * TODO: Enter description here ...
+     * TODO : implement
+     */
+    public function resetWpInfoAction()
+    {
+        $id_doc = $this->getRequest()->request->get('wikitag_document_id');
+        return $this->renderDocTags($id_doc);
+    }
+
+
+    /**
+     *
+     * TODO : Enter description here ...
+     * TODO : implement
+     * @return \Symfony\Bundle\FrameworkBundle\Controller\Response
+     */
+    public function updateTagAliasAction()
+    {
+        $id_doc = $this->getRequest()->request->get('wikitag_document_id');
+        return $this->renderDocTags($id_doc);
+    }
+    
+    /**
+     * List of all tags
+     * TODO: Enter description here ...
+     */
+    public function allTagsAction()
+    {
+        $tags = $this->getDoctrine()->getRepository('WikiTagBundle:WikiTagTag')->findAll();
+        // $this->getRequest()->query->get('foo') does not work "because" we are a second controller. So we have to use $_GET.
+        $toto = null;
+        if(array_key_exists('toto', $_GET)){
+            $toto = $_GET['toto'];
+        }
+        return $this->render('WikiTagBundle:WikiTag:TagList.html.twig', array('tags' => $tags, 'toto' => $toto));
+    }
 
 
 }
\ No newline at end of file