Finalise to implement the document profile with the list of columns.
authorcavaliet
Mon, 28 Nov 2011 15:58:34 +0100
changeset 49 e854d8cb376c
parent 48 16b5fd8d5405
child 50 e967654e90cb
child 57 186c4121c7b3
Finalise to implement the document profile with the list of columns.
Controller/WikiTagController.php
--- a/Controller/WikiTagController.php	Mon Nov 28 12:31:32 2011 +0100
+++ b/Controller/WikiTagController.php	Mon Nov 28 15:58:34 2011 +0100
@@ -143,7 +143,7 @@
         // Save datas.
         $em->flush();
 
-        return $this->renderDocTags($id_doc);
+        return $this->renderDocTags($id_doc, $req->get('wikitag_document_profile'));
     }
 
     /**
@@ -161,7 +161,7 @@
         $em->remove($dt);
         $em->flush();
 
-        return $this->renderDocTags($id_doc);
+        return $this->renderDocTags($id_doc, $this->getRequest()->request->get('wikitag_document_profile'));
     }
 
     /**
@@ -223,7 +223,7 @@
             $em->flush();
         }
         // We render the document's tags
-        return $this->renderDocTags($id_doc);
+        return $this->renderDocTags($id_doc, $this->getRequest()->request->get('wikitag_document_profile'));
 
     }
 
@@ -246,7 +246,7 @@
         
         $this->getDoctrine()->getEntityManager()->flush();
 
-        return $this->renderDocTags($id_doc);
+        return $this->renderDocTags($id_doc, $this->getRequest()->request->get('wikitag_document_profile'));
     }
 
     /**
@@ -298,7 +298,7 @@
             $em->flush();
         }
 
-        return $this->renderDocTags($id_doc);
+        return $this->renderDocTags($id_doc, $this->getRequest()->request->get('wikitag_document_profile'));
     }
 
 
@@ -341,7 +341,7 @@
             $dt = $this->getDoctrine()->getRepository('WikiTagBundle:DocumentTag')->findOneByDocumentExternalId($id_doc, array('tag' => $id_tag));
             $dt->setTag($un_tag);
             $em->flush();
-            return $this->renderDocTags($id_doc);
+            return $this->renderDocTags($id_doc, $this->getRequest()->request->get('wikitag_document_profile'));
         }
         else{
             // Here we are in the context of tag list.
@@ -384,7 +384,7 @@
         $em->flush();
 
         if($id_doc && $id_doc!=""){
-            return $this->renderDocTags($id_doc);
+            return $this->renderDocTags($id_doc, $this->getRequest()->request->get('wikitag_document_profile'));
         }
         else{
             $num_page = $this->getRequest()->request->get('num_page');
@@ -401,10 +401,17 @@
      * Generic render partial template
      * @param unknown_type $id_doc
      */
-    public function renderDocTags($id_doc)
+    public function renderDocTags($id_doc, $profile_name)
     {
+        // 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' => null));
+        return $this->render('WikiTagBundle:WikiTag:tagTable.html.twig', array('ordered_tags' => $ordered_tags, 'doc_id' => $id_doc, 'columns' => $columns_array));
     }
 
 
@@ -426,7 +433,7 @@
         $id_doc = $this->getRequest()->request->get('wikitag_document_id');
         if($id_doc && $id_doc!=""){
             // In case we changed the alias from the document view
-            return $this->renderDocTags($id_doc);
+            return $this->renderDocTags($id_doc, $this->getRequest()->request->get('wikitag_document_profile'));
         }
         else{
             // In case we changed the alias from the tag list.