diff -r 7a877de630fd -r 7d2fb5d7c9ff Controller/WikiTagController.php --- a/Controller/WikiTagController.php Wed Oct 19 15:44:23 2011 +0200 +++ b/Controller/WikiTagController.php Thu Oct 20 18:35:33 2011 +0200 @@ -215,13 +215,12 @@ //TODO : translation return new Response(json_encode(array('error' => 'duplicate_tag', 'message' => sprintf("Le tag %s existe déjà pour cette fiche.", $tag_label))),400); } - // $tag, $revision_id, $created + // returns array($tag, $revision_id, $created) $ar = WikiTagUtils::getOrCreateTag($tag_label, $this->getDoctrine());// tag, revision_id, created = get_or_create_tag(tag_label) - $tag = $ar[0]; $revision_id = $ar[1]; $created = $ar[2]; - + $tags = $this->getDoctrine()->getRepository('WikiTagBundle:DocumentTag')->findByDocumentExternalId($id_doc, array('tag'=>$tag->getId())); $nb_tags = count($tags); @@ -276,7 +275,7 @@ } // We associate the unsemantized tag to the DocumentTag and save datas // TODO: do the request on external id of document - $dt = $this->getDoctrine()->getRepository('WikiTagBundle:DocumentTag')->findOneByDocumentExternalId($id_doc, array('tag' => $idTag)); + $dt = $this->getDoctrine()->getRepository('WikiTagBundle:DocumentTag')->findOneBy(array('document' => $id_doc, 'tag' => $id_tag)); $dt->setTag($un_tag); $em->flush(); @@ -352,13 +351,25 @@ */ public function allTagsAction() { - $tags = $this->getDoctrine()->getRepository('WikiTagBundle:WikiTagTag')->findAll(); + $tags = $this->getDoctrine()->getRepository('WikiTagBundle:Tag')->findBy(array('id' => '10')); // $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)); + $searched = "truc"; + $search_def = array('A', 'B'); + $nb_by_page = 50; + $sort = "p+"; + $current_page = NULL;// avec start_index et end_index + $nb_total = "truc";// nb de pages + $num_page = 2; + $last_page = 4; + $prev_page = 1; + $next_page = 3; + return $this->render('WikiTagBundle:WikiTag:TagList.html.twig', + array('tags' => $tags, 'searched' => $searched, '$search_def' => $search_def, '$nb_by_page' => $nb_by_page, '$sort' => $sort, '$current_page' => $current_page, + '$nb_total' => $nb_total, '$num_page' => $num_page, '$last_page' => $last_page, '$prev_page' => $prev_page, '$next_page' => $next_page)); }