Controller/WikiTagController.php
changeset 53 22377c9e2eae
parent 52 e804ae133f27
child 54 ec51b9f4695f
--- a/Controller/WikiTagController.php	Fri Dec 02 11:31:51 2011 +0100
+++ b/Controller/WikiTagController.php	Wed Dec 07 15:06:35 2011 +0100
@@ -49,7 +49,7 @@
      * @param unknown_type $tags_list
      * @return \Symfony\Bundle\FrameworkBundle\Controller\Response
      */
-    public function addJavascriptAction($tags_list=false)
+    public function addJavascriptAction($tags_list=false, $profile_name=null)
     {
         $cats = $this->getDoctrine()->getRepository('WikiTagBundle:Category')->findOrderedCategories();
         // $cats is {"Label":"Créateur"},{"Label":"Datation"},...
@@ -61,7 +61,13 @@
         }
         // ... so we create is json like {"":""},{"Créateur":"Créateur"},{"Datation":"Datation"},...
         $categories = json_encode($ar);
-        return $this->render('WikiTagBundle:WikiTag:javascript.html.twig', array('categories' => $categories, 'tags_list' => $tags_list));
+        // Management of profiles for the list of displayed columns and reorder tag button
+        $profile_array = $this->container->getParameter("wiki_tag.document_list_profile");
+        $columns_array = null;
+        if($profile_array!=null && $profile_name!=null && $profile_name!=""){
+            $columns_array = $profile_array[$profile_name];
+        }
+        return $this->render('WikiTagBundle:WikiTag:javascript.html.twig', array('categories' => $categories, 'tags_list' => $tags_list, 'columns' => $columns_array));
     }
 
     /**
@@ -100,7 +106,7 @@
         }
         
         $ordered_tags = $this->getDoctrine()->getRepository('WikiTagBundle:DocumentTag')->findOrderedTagsForDoc($id_doc);
-        return $this->render('WikiTagBundle:WikiTag:documentTags.html.twig', array('ordered_tags' => $ordered_tags, 'doc_id' => $id_doc, 'profile_name' => $profile_name, 'columns' => $columns_array));
+        return $this->render('WikiTagBundle:WikiTag:documentTags.html.twig', array('ordered_tags' => $ordered_tags, 'doc_id' => $id_doc, 'columns' => $columns_array));
     }
 
     /**
@@ -412,17 +418,11 @@
      * Generic render partial template
      * @param unknown_type $id_doc
      */
-    public function renderDocTags($id_doc, $profile_name)
+    public function renderDocTags($id_doc)
     {
-        // Management of profiles for the list of displayed columns and reorder tag button
-        $profile_array = $this->container->getParameter("wiki_tag.document_list_profile");
-        $columns_array = null;
-        if($profile_array!=null && $profile_name!=null && $profile_name!=""){
-            $columns_array = $profile_array[$profile_name];
-        }
         // Get tags and render the table
         $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, 'columns' => $columns_array));
+        return $this->render('WikiTagBundle:WikiTag:tagTable.html.twig', array('ordered_tags' => $ordered_tags, 'doc_id' => $id_doc));
     }