Browse Source

Evolution #179: Proposition de tag: évolution

bastien 13 years ago
parent
commit
f6a55524a5

+ 10 - 0
src/Muzich/CoreBundle/Entity/Element.php View File

@@ -509,6 +509,16 @@ class Element
509 509
     return $this->has_tags_proposition;
510 510
   }
511 511
   
512
+  public function getTagsProposition()
513
+  {
514
+    return $this->tags_propositions;
515
+  }
516
+  
517
+  public function setTagsPRopositions($propositions)
518
+  {
519
+    $this->tags_propositions = $propositions;
520
+  }
521
+  
512 522
   /**
513 523
    * Etablie des relation vers des tags.
514 524
    * (Supprime les anciens tags, au niveau de l'objet seulement)

+ 13 - 4
src/Muzich/CoreBundle/Repository/ElementRepository.php View File

@@ -53,9 +53,9 @@ class ElementRepository extends EntityRepository
53 53
       
54 54
       if (($id_limit = $searcher->getIdLimit()))
55 55
       {
56
-        return $this->getSelectElementForSearchQuery($params_select, $user_id, $searcher->getIds(), $id_limit, $searcher->getCount());
56
+        return $this->getSelectElementForSearchQuery($params_select, $user_id, $searcher->getIds(), $id_limit, $searcher->getCount(), $searcher->getIdsDisplay());
57 57
       }
58
-      return $this->getSelectElementForSearchQuery($params_select, $user_id, $searcher->getIds());
58
+      return $this->getSelectElementForSearchQuery($params_select, $user_id, $searcher->getIds(), null, null, $searcher->getIdsDisplay());
59 59
     }
60 60
     
61 61
     
@@ -232,7 +232,7 @@ class ElementRepository extends EntityRepository
232 232
     ;
233 233
   }
234 234
   
235
-  protected function getSelectElementForSearchQuery($params_select, $user_id, $ids, $id_limit = null, $count_limit = null)
235
+  protected function getSelectElementForSearchQuery($params_select, $user_id, $ids, $id_limit = null, $count_limit = null, $ids_display = null)
236 236
   {    
237 237
     $where = "";
238 238
     if ($id_limit)
@@ -240,14 +240,23 @@ class ElementRepository extends EntityRepository
240 240
       $where = "AND e.id < :id_limit";
241 241
       $params_select['id_limit'] = $id_limit;
242 242
     }
243
+    
244
+    $select = '';
245
+    $left_join = '';
246
+    if ($ids_display)
247
+    {
248
+      $select = ', tp, tpu, tpt';
249
+      $left_join = 'LEFT JOIN e.tags_propositions tp LEFT JOIN tp.user tpu LEFT JOIN tp.tags tpt';
250
+    }
243 251
       
244 252
     // C'est la requête qui récupérera les données element avec ses jointures.
245
-    $query_select = "SELECT e, t, o, g, fav
253
+    $query_select = "SELECT e, t, o, g, fav $select
246 254
       FROM MuzichCoreBundle:Element e 
247 255
       LEFT JOIN e.group g 
248 256
       LEFT JOIN e.tags t WITH (t.tomoderate = 'FALSE' OR t.tomoderate IS NULL
249 257
         OR t.privateids LIKE :uidt)
250 258
       LEFT JOIN e.elements_favorites fav WITH fav.user = :uid
259
+      $left_join
251 260
       JOIN e.owner o
252 261
       WHERE e.id IN (:ids) $where
253 262
       ORDER BY e.created DESC, e.id DESC"

+ 11 - 0
src/Muzich/CoreBundle/Resources/views/SearchElement/element.html.twig View File

@@ -209,6 +209,17 @@
209 209
   </tr>
210 210
 </table>
211 211
 
212
+{% if ids_display is defined %}
213
+{% if ids_display == event_const('TYPE_TAGS_PROPOSED') %}
214
+
215
+  {% include 'MuzichCoreBundle:Element:tag.propositions.html.twig' with {
216
+    'propositions' : element.getTagsProposition,
217
+    'element_id'   : element.id
218
+  } %}
219
+
220
+{% endif %}
221
+{% endif %}
222
+
212 223
 {% if element.embed %}
213 224
   {% autoescape false %}
214 225
     <div id="embed_{{ element.id }}" class="element_embed" style="display: none;">

+ 1 - 0
web/bundles/muzichcore/js/muzich.js View File

@@ -1789,6 +1789,7 @@ $(document).ready(function(){
1789 1789
     $(this).parents('div.tag_proposition').slideUp();
1790 1790
   });
1791 1791
   
1792
+  // Ouvrir les propositions de tags de l'élément
1792 1793
   $('a.element_view_propositions_link').live('click', function(){
1793 1794
     
1794 1795
     var link = $(this);