Bastien Sevajol 11 лет назад
Родитель
Сommit
de542a0a4f

+ 2 - 0
app/Resources/translations/navigationui.fr.yml Просмотреть файл

@@ -5,6 +5,7 @@ container_menu:
5 5
   my_favorites:         Mes favoris
6 6
   my_feeds:             Mes diffusions
7 7
   return:               Retour
8
+  need_tags:            Demandes
8 9
   
9 10
 top_bar:
10 11
   my_account:           Mon compte (%name%)
@@ -39,6 +40,7 @@ title:
39 40
   hello:                Découvrez et partagez la musique !
40 41
   element:
41 42
     edit:               Modification d'un élément
43
+  need_tags:            Partages en demande de tags
42 44
   
43 45
   
44 46
 bottom_menu:

+ 7 - 1
app/Resources/translations/userui.fr.yml Просмотреть файл

@@ -152,4 +152,10 @@ search_tag:
152 152
   title:                 Recherche de tag correspondant à \"%string_search%\" ...
153 153
   
154 154
 global_search:
155
-  no_results:            Il n'y a aucun résultat a votre recherche.
155
+  no_results:            Il n'y a aucun résultat a votre recherche.
156
+  
157
+need_tags:
158
+  text_help:             |
159
+                         Les utilisateurs ayant partagés leurs découvertes ont
160
+                         demandé de l'aide pour tagger correctement leurs partages.
161
+                         Gagnez en réputation en leurs proposants les tags qui conviennent !

+ 1 - 0
src/Muzich/CoreBundle/Controller/ElementController.php Просмотреть файл

@@ -742,6 +742,7 @@ class ElementController extends Controller
742 742
       $element->addTag($tag);
743 743
     }
744 744
     $element->setHasTagProposition(false);
745
+    $element->setNeedTags(false);
745 746
     $this->getDoctrine()->getEntityManager()->persist($element);
746 747
     
747 748
     $event = new EventElement($this->container);

+ 13 - 2
src/Muzich/CoreBundle/Resources/config/routing.yml Просмотреть файл

@@ -154,5 +154,16 @@ global_search:
154 154
 teapot:
155 155
   pattern: /what/are/you
156 156
   defaults: { _controller: MuzichCoreBundle:Info:teapot }
157
-  
158
-  
157
+
158
+#
159
+
160
+element_retrieve_api_datas:
161
+  pattern: /ajax/element/get/datas/api
162
+  defaults: { _controller: MuzichCoreBundle:Element:getDatasApi }
163
+  requirements:
164
+    method:  POST
165
+    
166
+element_show_need_tags:
167
+  pattern: /need-tags
168
+  defaults: { _controller: MuzichHomeBundle:Home:needTags }
169
+

+ 8 - 3
src/Muzich/CoreBundle/Resources/views/Menu/containerMenu.html.twig Просмотреть файл

@@ -12,14 +12,19 @@
12 12
         {{ 'container_menu.my_network'|trans({}, 'navigationui') }}
13 13
       </a>
14 14
     </li>
15
-    <li {% if active == 'myfeeds' %} class="active" {% endif %}>
16
-      <a href="{{ path('show_user', {'slug': app.user.slug}) }}">
17
-        {{ 'container_menu.my_feeds'|trans({}, 'navigationui') }}
15
+    <li {% if active == 'needs-tags' %} class="active" {% endif %}>
16
+      <a href="{{ path('element_show_need_tags') }}">
17
+        {{ 'container_menu.need_tags'|trans({}, 'navigationui') }}
18 18
       </a>
19 19
     </li>
20 20
   </ul>
21 21
 
22 22
   <ul class="top-tabs-right">
23
+    <li {% if active == 'myfeeds' %} class="active" {% endif %}>
24
+      <a href="{{ path('show_user', {'slug': app.user.slug}) }}">
25
+        {{ 'container_menu.my_feeds'|trans({}, 'navigationui') }}
26
+      </a>
27
+    </li>
23 28
     <li class="{% if active == 'mygroups' %}active{% endif %}">
24 29
       <a href="{{ path('groups_own_list') }}" >
25 30
         {{ 'network.mygroups'|trans({}, 'navigationui') }}

+ 15 - 5
src/Muzich/CoreBundle/Searcher/ElementSearcher.php Просмотреть файл

@@ -107,11 +107,12 @@ class ElementSearcher extends Searcher implements SearcherInterface
107 107
    */
108 108
   protected $string = null;
109 109
   
110
-  private $attributes = array(
111
-    'network', 'tags', 'count', 'user_id', 'group_id', 
112
-    'favorite', 'id_limit', 'searchnew', 'ids', 'ids_display',
113
-    'tag_strict', 'string'
114
-  );
110
+  /**
111
+   * Pour la recherche de partage qui demande des tags.
112
+   * 
113
+   * @var boolean 
114
+   */
115
+  protected $need_tags = false;
115 116
   
116 117
   /**
117 118
    * @see SearcherInterface
@@ -339,4 +340,13 @@ class ElementSearcher extends Searcher implements SearcherInterface
339 340
     return $this->searchnew;
340 341
   }
341 342
   
343
+  public function isNeedTags()
344
+  {
345
+    if ($this->need_tags)
346
+    {
347
+      return true;
348
+    }
349
+    return false;
350
+  }
351
+  
342 352
 }

+ 11 - 0
src/Muzich/CoreBundle/Searcher/ElementSearcherQueryBuilder.php Просмотреть файл

@@ -264,6 +264,15 @@ class ElementSearcherQueryBuilder
264 264
       }
265 265
     }
266 266
   }
267
+  
268
+  private function buildNeedTags()
269
+  {
270
+    // Si id_limit est précisé c'est que l'on demande "la suite" ou "les nouveaux"
271
+    if ($this->es->isNeedTags())
272
+    {
273
+      $this->query_ids->andWhere("e.need_tags  = '1'");
274
+    }
275
+  }
267 276
 
268 277
   /**
269 278
    *
@@ -299,6 +308,8 @@ class ElementSearcherQueryBuilder
299 308
     $this->buildLimits();
300 309
     // Si on recherche les tags de manière stricte
301 310
     $this->buildStrict();
311
+    // Si on recherche des partages en demande de tags
312
+    $this->buildNeedTags();
302 313
     
303 314
     $this->query_ids->setParameters($this->parameters_ids);
304 315
   }

+ 7 - 8
src/Muzich/CoreBundle/Searcher/Searcher.php Просмотреть файл

@@ -23,15 +23,14 @@ abstract class Searcher
23 23
     foreach ($params as $param_id => $param_value)
24 24
     {
25 25
       // TODO: check existance attribut
26
-//      if (isset($this->$param_id))
27
-//      {
26
+      if (property_exists($this, $param_id))
27
+      {
28 28
         $this->$param_id = $param_value;
29
-//      }
30
-//      else
31
-//      {
32
-//        die(var_dump($this->$param_id));
33
-//        throw new \Exception("You're trying access unknow attribute '$param_id'");
34
-//      }
29
+      }
30
+      else
31
+      {
32
+        throw new \Exception("You're trying access unknow attribute '$param_id'");
33
+      }
35 34
     }
36 35
   }
37 36
 

+ 17 - 6
src/Muzich/HomeBundle/Controller/HomeController.php Просмотреть файл

@@ -4,10 +4,7 @@ namespace Muzich\HomeBundle\Controller;
4 4
 
5 5
 use Muzich\CoreBundle\lib\Controller;
6 6
 use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
7
-
8
-use Doctrine\ORM\Query;
9
-use Muzich\CoreBundle\Form\Search\ElementSearchForm;
10
-use Muzich\CoreBundle\Form\Element\ElementAddForm;
7
+use Muzich\CoreBundle\Searcher\ElementSearcher;
11 8
 
12 9
 class HomeController extends Controller
13 10
 {
@@ -29,12 +26,12 @@ class HomeController extends Controller
29 26
     $add_form = $this->getAddForm();
30 27
     
31 28
     $elements = $search_object->getElements($this->getDoctrine(), $this->getUserId());
32
-    $count_elements = count($elements);
29
+    //$count_elements = count($elements);
33 30
     
34 31
     return array(
35 32
       'search_tags_id'   => $search_object->getTags(),
36 33
       'ids_display'      => $search_object->getIdsDisplay(),
37
-      'user'             => $this->getUser(),
34
+      'user'             => $user,
38 35
       'add_form'         => $add_form->createView(),
39 36
       'add_form_name'    => 'add',
40 37
       'search_form'      => $search_form->createView(),
@@ -44,4 +41,18 @@ class HomeController extends Controller
44 41
       //'display_more_button' => ($count_elements >= $this->container->getParameter('search_default_count'))?true:false
45 42
     );
46 43
   }
44
+  
45
+  public function needTagsAction()
46
+  {
47
+    $es = new ElementSearcher();
48
+    $es->init(array(
49
+      'count'     => $this->container->getParameter('search_default_count'),
50
+      'need_tags' => true
51
+    ));
52
+    
53
+    return $this->render('MuzichHomeBundle:Home:need_tags.html.twig', array(
54
+      'elements' => $es->getElements($this->getDoctrine(), $this->getUserId())
55
+    ));
56
+  }
57
+  
47 58
 }

+ 27 - 0
src/Muzich/HomeBundle/Resources/views/Home/need_tags.html.twig Просмотреть файл

@@ -0,0 +1,27 @@
1
+{% extends "MuzichHomeBundle::layout.html.twig" %}
2
+
3
+{% block title %}{{ 'title.need_tags'|trans({}, 'navigationui') }}{% endblock %}
4
+
5
+{% block content %}
6
+
7
+  <h1>{{ 'title.need_tags'|trans({}, 'navigationui') }}</h1>
8
+
9
+  <p>{{ 'need_tags.text_help'|trans({}, 'userui') }}</p>
10
+  
11
+  <div class="display_more_elements" style="display: none;">
12
+    <span></span>
13
+  </div>
14
+
15
+  <div class="elements_loader_div">
16
+    <img class="elements_new_loader" style="display: none;" src="{{ asset('/bundles/muzichcore/img/ajax-loader.gif') }}" alt="loading" />
17
+  </div>
18
+
19
+  {% include "MuzichCoreBundle:SearchElement:default.html.twig" %}
20
+    
21
+  {% include "MuzichCoreBundle:SearchElement:more_button.html.twig" with {
22
+    'display_more_button' : true,
23
+    'elements_length'     : elements|length,
24
+    'more_path'           : 'search_elements'
25
+  }%}
26
+  
27
+{% endblock %}