equal
deleted
inserted
replaced
141 } |
141 } |
142 } |
142 } |
143 // Save datas. |
143 // Save datas. |
144 $em->flush(); |
144 $em->flush(); |
145 |
145 |
146 return $this->renderDocTags($id_doc); |
146 return $this->renderDocTags($id_doc, $req->get('wikitag_document_profile')); |
147 } |
147 } |
148 |
148 |
149 /** |
149 /** |
150 * Action to remove a tag from a document tag list |
150 * Action to remove a tag from a document tag list |
151 * @return \Symfony\Bundle\FrameworkBundle\Controller\Response |
151 * @return \Symfony\Bundle\FrameworkBundle\Controller\Response |
159 |
159 |
160 $dt = $this->getDoctrine()->getRepository('WikiTagBundle:DocumentTag')->findOneByDocumentExternalId($id_doc, array('tag' => $id_tag)); |
160 $dt = $this->getDoctrine()->getRepository('WikiTagBundle:DocumentTag')->findOneByDocumentExternalId($id_doc, array('tag' => $id_tag)); |
161 $em->remove($dt); |
161 $em->remove($dt); |
162 $em->flush(); |
162 $em->flush(); |
163 |
163 |
164 return $this->renderDocTags($id_doc); |
164 return $this->renderDocTags($id_doc, $this->getRequest()->request->get('wikitag_document_profile')); |
165 } |
165 } |
166 |
166 |
167 /** |
167 /** |
168 * Modify the tag in the context of a tag list for one document |
168 * Modify the tag in the context of a tag list for one document |
169 * |
169 * |
221 $doc->setManualOrder(true); |
221 $doc->setManualOrder(true); |
222 // We save the datas |
222 // We save the datas |
223 $em->flush(); |
223 $em->flush(); |
224 } |
224 } |
225 // We render the document's tags |
225 // We render the document's tags |
226 return $this->renderDocTags($id_doc); |
226 return $this->renderDocTags($id_doc, $this->getRequest()->request->get('wikitag_document_profile')); |
227 |
227 |
228 } |
228 } |
229 |
229 |
230 /** |
230 /** |
231 * The action called to reorder the the tags of a document. The tags are reordered according to the indexation score of the tag label on the document. |
231 * The action called to reorder the the tags of a document. The tags are reordered according to the indexation score of the tag label on the document. |
244 |
244 |
245 $search_service->reorderTagsForDocument($doc); |
245 $search_service->reorderTagsForDocument($doc); |
246 |
246 |
247 $this->getDoctrine()->getEntityManager()->flush(); |
247 $this->getDoctrine()->getEntityManager()->flush(); |
248 |
248 |
249 return $this->renderDocTags($id_doc); |
249 return $this->renderDocTags($id_doc, $this->getRequest()->request->get('wikitag_document_profile')); |
250 } |
250 } |
251 |
251 |
252 /** |
252 /** |
253 * The action called to add a new tag (especially from the completion box) |
253 * The action called to add a new tag (especially from the completion box) |
254 */ |
254 */ |
296 $new_DT->setWikipediaRevisionId($revision_id); |
296 $new_DT->setWikipediaRevisionId($revision_id); |
297 $em->persist($new_DT); |
297 $em->persist($new_DT); |
298 $em->flush(); |
298 $em->flush(); |
299 } |
299 } |
300 |
300 |
301 return $this->renderDocTags($id_doc); |
301 return $this->renderDocTags($id_doc, $this->getRequest()->request->get('wikitag_document_profile')); |
302 } |
302 } |
303 |
303 |
304 |
304 |
305 /** |
305 /** |
306 * Action to remove the wikipedia link form a tag. This action create a copy of the original tag with all the link to wikipedia set to null. |
306 * Action to remove the wikipedia link form a tag. This action create a copy of the original tag with all the link to wikipedia set to null. |
339 if($id_doc && $id_doc!=""){ |
339 if($id_doc && $id_doc!=""){ |
340 // We associate the unsemantized tag to the DocumentTag and save datas |
340 // We associate the unsemantized tag to the DocumentTag and save datas |
341 $dt = $this->getDoctrine()->getRepository('WikiTagBundle:DocumentTag')->findOneByDocumentExternalId($id_doc, array('tag' => $id_tag)); |
341 $dt = $this->getDoctrine()->getRepository('WikiTagBundle:DocumentTag')->findOneByDocumentExternalId($id_doc, array('tag' => $id_tag)); |
342 $dt->setTag($un_tag); |
342 $dt->setTag($un_tag); |
343 $em->flush(); |
343 $em->flush(); |
344 return $this->renderDocTags($id_doc); |
344 return $this->renderDocTags($id_doc, $this->getRequest()->request->get('wikitag_document_profile')); |
345 } |
345 } |
346 else{ |
346 else{ |
347 // Here we are in the context of tag list. |
347 // Here we are in the context of tag list. |
348 if($un_tag_created==TRUE){ |
348 if($un_tag_created==TRUE){ |
349 $em->flush(); |
349 $em->flush(); |
382 $tag->setCategory($cat); |
382 $tag->setCategory($cat); |
383 } |
383 } |
384 $em->flush(); |
384 $em->flush(); |
385 |
385 |
386 if($id_doc && $id_doc!=""){ |
386 if($id_doc && $id_doc!=""){ |
387 return $this->renderDocTags($id_doc); |
387 return $this->renderDocTags($id_doc, $this->getRequest()->request->get('wikitag_document_profile')); |
388 } |
388 } |
389 else{ |
389 else{ |
390 $num_page = $this->getRequest()->request->get('num_page'); |
390 $num_page = $this->getRequest()->request->get('num_page'); |
391 $nb_by_page = $this->getRequest()->request->get('nb_by_page'); |
391 $nb_by_page = $this->getRequest()->request->get('nb_by_page'); |
392 $sort = $this->getRequest()->request->get('sort'); |
392 $sort = $this->getRequest()->request->get('sort'); |
399 /** |
399 /** |
400 * |
400 * |
401 * Generic render partial template |
401 * Generic render partial template |
402 * @param unknown_type $id_doc |
402 * @param unknown_type $id_doc |
403 */ |
403 */ |
404 public function renderDocTags($id_doc) |
404 public function renderDocTags($id_doc, $profile_name) |
405 { |
405 { |
|
406 // Management of profiles for the list of displayed columns and reorder tag button |
|
407 $profile_array = $this->container->getParameter("wiki_tag.document_list_profile"); |
|
408 $columns_array = null; |
|
409 if($profile_array!=null && $profile_name!=null && $profile_name!=""){ |
|
410 $columns_array = $profile_array[$profile_name]; |
|
411 } |
|
412 // Get tags and render the table |
406 $ordered_tags = $this->getDoctrine()->getRepository('WikiTagBundle:DocumentTag')->findOrderedTagsForDoc($id_doc); |
413 $ordered_tags = $this->getDoctrine()->getRepository('WikiTagBundle:DocumentTag')->findOrderedTagsForDoc($id_doc); |
407 return $this->render('WikiTagBundle:WikiTag:tagTable.html.twig', array('ordered_tags' => $ordered_tags, 'doc_id' => $id_doc, 'columns' => null)); |
414 return $this->render('WikiTagBundle:WikiTag:tagTable.html.twig', array('ordered_tags' => $ordered_tags, 'doc_id' => $id_doc, 'columns' => $columns_array)); |
408 } |
415 } |
409 |
416 |
410 |
417 |
411 /** |
418 /** |
412 * Action to update the tag alias. |
419 * Action to update the tag alias. |
424 $em->flush(); |
431 $em->flush(); |
425 |
432 |
426 $id_doc = $this->getRequest()->request->get('wikitag_document_id'); |
433 $id_doc = $this->getRequest()->request->get('wikitag_document_id'); |
427 if($id_doc && $id_doc!=""){ |
434 if($id_doc && $id_doc!=""){ |
428 // In case we changed the alias from the document view |
435 // In case we changed the alias from the document view |
429 return $this->renderDocTags($id_doc); |
436 return $this->renderDocTags($id_doc, $this->getRequest()->request->get('wikitag_document_profile')); |
430 } |
437 } |
431 else{ |
438 else{ |
432 // In case we changed the alias from the tag list. |
439 // In case we changed the alias from the tag list. |
433 $num_page = $this->getRequest()->request->get('num_page'); |
440 $num_page = $this->getRequest()->request->get('num_page'); |
434 $nb_by_page = $this->getRequest()->request->get('nb_by_page'); |
441 $nb_by_page = $this->getRequest()->request->get('nb_by_page'); |