Controller/WikiTagController.php
changeset 53 22377c9e2eae
parent 52 e804ae133f27
child 54 ec51b9f4695f
equal deleted inserted replaced
52:e804ae133f27 53:22377c9e2eae
    47      * Renders the little html to add the javascript
    47      * Renders the little html to add the javascript
    48      *
    48      *
    49      * @param unknown_type $tags_list
    49      * @param unknown_type $tags_list
    50      * @return \Symfony\Bundle\FrameworkBundle\Controller\Response
    50      * @return \Symfony\Bundle\FrameworkBundle\Controller\Response
    51      */
    51      */
    52     public function addJavascriptAction($tags_list=false)
    52     public function addJavascriptAction($tags_list=false, $profile_name=null)
    53     {
    53     {
    54         $cats = $this->getDoctrine()->getRepository('WikiTagBundle:Category')->findOrderedCategories();
    54         $cats = $this->getDoctrine()->getRepository('WikiTagBundle:Category')->findOrderedCategories();
    55         // $cats is {"Label":"Créateur"},{"Label":"Datation"},...
    55         // $cats is {"Label":"Créateur"},{"Label":"Datation"},...
    56         $nbCats = count($cats);
    56         $nbCats = count($cats);
    57         $ar = array('' => '');
    57         $ar = array('' => '');
    59             $temp = array($cats[$i]["label"] => $cats[$i]["label"]);
    59             $temp = array($cats[$i]["label"] => $cats[$i]["label"]);
    60             $ar = array_merge($ar, $temp);
    60             $ar = array_merge($ar, $temp);
    61         }
    61         }
    62         // ... so we create is json like {"":""},{"Créateur":"Créateur"},{"Datation":"Datation"},...
    62         // ... so we create is json like {"":""},{"Créateur":"Créateur"},{"Datation":"Datation"},...
    63         $categories = json_encode($ar);
    63         $categories = json_encode($ar);
    64         return $this->render('WikiTagBundle:WikiTag:javascript.html.twig', array('categories' => $categories, 'tags_list' => $tags_list));
    64         // Management of profiles for the list of displayed columns and reorder tag button
       
    65         $profile_array = $this->container->getParameter("wiki_tag.document_list_profile");
       
    66         $columns_array = null;
       
    67         if($profile_array!=null && $profile_name!=null && $profile_name!=""){
       
    68             $columns_array = $profile_array[$profile_name];
       
    69         }
       
    70         return $this->render('WikiTagBundle:WikiTag:javascript.html.twig', array('categories' => $categories, 'tags_list' => $tags_list, 'columns' => $columns_array));
    65     }
    71     }
    66 
    72 
    67     /**
    73     /**
    68      * Renders the little html to add the javascript for context search
    74      * Renders the little html to add the javascript for context search
    69      */
    75      */
    98         if($profile_array!=null && $profile_name!=null && $profile_name!=""){
   104         if($profile_array!=null && $profile_name!=null && $profile_name!=""){
    99             $columns_array = $profile_array[$profile_name];
   105             $columns_array = $profile_array[$profile_name];
   100         }
   106         }
   101         
   107         
   102         $ordered_tags = $this->getDoctrine()->getRepository('WikiTagBundle:DocumentTag')->findOrderedTagsForDoc($id_doc);
   108         $ordered_tags = $this->getDoctrine()->getRepository('WikiTagBundle:DocumentTag')->findOrderedTagsForDoc($id_doc);
   103         return $this->render('WikiTagBundle:WikiTag:documentTags.html.twig', array('ordered_tags' => $ordered_tags, 'doc_id' => $id_doc, 'profile_name' => $profile_name, 'columns' => $columns_array));
   109         return $this->render('WikiTagBundle:WikiTag:documentTags.html.twig', array('ordered_tags' => $ordered_tags, 'doc_id' => $id_doc, 'columns' => $columns_array));
   104     }
   110     }
   105 
   111 
   106     /**
   112     /**
   107      *
   113      *
   108      * The action called when a tag is moved in a document tag list.
   114      * The action called when a tag is moved in a document tag list.
   410     /**
   416     /**
   411      *
   417      *
   412      * Generic render partial template
   418      * Generic render partial template
   413      * @param unknown_type $id_doc
   419      * @param unknown_type $id_doc
   414      */
   420      */
   415     public function renderDocTags($id_doc, $profile_name)
   421     public function renderDocTags($id_doc)
   416     {
   422     {
   417         // Management of profiles for the list of displayed columns and reorder tag button
       
   418         $profile_array = $this->container->getParameter("wiki_tag.document_list_profile");
       
   419         $columns_array = null;
       
   420         if($profile_array!=null && $profile_name!=null && $profile_name!=""){
       
   421             $columns_array = $profile_array[$profile_name];
       
   422         }
       
   423         // Get tags and render the table
   423         // Get tags and render the table
   424         $ordered_tags = $this->getDoctrine()->getRepository('WikiTagBundle:DocumentTag')->findOrderedTagsForDoc($id_doc);
   424         $ordered_tags = $this->getDoctrine()->getRepository('WikiTagBundle:DocumentTag')->findOrderedTagsForDoc($id_doc);
   425         return $this->render('WikiTagBundle:WikiTag:tagTable.html.twig', array('ordered_tags' => $ordered_tags, 'doc_id' => $id_doc, 'columns' => $columns_array));
   425         return $this->render('WikiTagBundle:WikiTag:tagTable.html.twig', array('ordered_tags' => $ordered_tags, 'doc_id' => $id_doc));
   426     }
   426     }
   427 
   427 
   428 
   428 
   429     /**
   429     /**
   430      * Action to update the tag alias.
   430      * Action to update the tag alias.