Browse Source

Evolution #196: Liste de lecture

Sevajol Bastien 12 years ago
parent
commit
2c924abf0d

+ 24 - 0
src/Muzich/CoreBundle/Controller/ElementController.php View File

@@ -1041,6 +1041,30 @@ class ElementController extends Controller
1041 1041
       
1042 1042
       $elements = $search_object->getElements($this->getDoctrine(), $this->getUserId());
1043 1043
     }
1044
+    elseif ($type == 'favorite')
1045
+    {
1046
+      $tags = null;
1047
+      $tag_ids = json_decode($data);
1048
+      $search_object = new ElementSearcher();
1049
+      
1050
+      if (count($tag_ids))
1051
+      {
1052
+        $tags = array();
1053
+        foreach ($tag_ids as $id)
1054
+        {
1055
+          $tags[$id] = $id;
1056
+        }
1057
+      }
1058
+
1059
+      $search_object->init(array(
1060
+        'tags'     => $tags,
1061
+        'user_id'  => $show_id,
1062
+        'favorite' => true,
1063
+        'count'    => $this->container->getParameter('autoplay_max_elements')
1064
+      ));
1065
+      
1066
+      $elements = $search_object->getElements($this->getDoctrine(), $this->getUserId());
1067
+    }
1044 1068
     
1045 1069
     if (count($elements))
1046 1070
     {

+ 4 - 0
src/Muzich/CoreBundle/Resources/config/routing.yml View File

@@ -168,6 +168,10 @@ elements_get_filter_data_autoplay_show:
168 168
   pattern: /ajax/show/{show_type}/{show_id}/elements/get/datas/autoplay/{data}
169 169
   defaults: { _controller: MuzichCoreBundle:Element:getDatasAutoplay, type: 'show', data: null }
170 170
     
171
+elements_get_filter_data_autoplay_favorite:
172
+  pattern: /ajax/favorite/{show_type}/{show_id}/elements/get/datas/autoplay/{data}
173
+  defaults: { _controller: MuzichCoreBundle:Element:getDatasAutoplay, type: 'favorite', data: null }
174
+    
171 175
 element_show_need_tags:
172 176
   pattern: /need-tags
173 177
   defaults: { _controller: MuzichHomeBundle:Home:needTags }

+ 7 - 3
src/Muzich/FavoriteBundle/Controller/FavoriteController.php View File

@@ -246,11 +246,15 @@ class FavoriteController extends Controller
246 246
     
247 247
     $tag_ids = json_decode($tags_ids_json);
248 248
     $search_object = new ElementSearcher();
249
+    $tags = null;
249 250
     
250
-    $tags = array();
251
-    foreach ($tag_ids as $id)
251
+    if (count($tag_ids))
252 252
     {
253
-      $tags[$id] = $id;
253
+      $tags = array();
254
+      foreach ($tag_ids as $id)
255
+      {
256
+        $tags[$id] = $id;
257
+      }
254 258
     }
255 259
     
256 260
     $search_object->init(array(

+ 16 - 1
src/Muzich/FavoriteBundle/Resources/views/Favorite/myList.html.twig View File

@@ -12,6 +12,15 @@
12 12
     'user_id' : app.user.id
13 13
   } %}
14 14
   
15
+  <a href="{{ path('elements_get_filter_data_autoplay_favorite', {
16
+        'show_type'  : 'user',
17
+        'show_id'    : app.user.id, 
18
+        'data'       : '[]'
19
+      }) }}" class="button" id="autoplay_launch" 
20
+     title="{{ 'elements.autoplay.launch'|trans({}, 'elements') }}" >
21
+    <img src="{{ asset('/bundles/muzichcore/img/1353494305_player_play.png') }}" alt="" />
22
+  </a>
23
+  
15 24
   {% include "MuzichCoreBundle:SearchElement:default.html.twig" %}
16 25
     
17 26
   <div class="elements_loader_div">
@@ -21,10 +30,16 @@
21 30
   {% if elements|length %}
22 31
      <span class="elements_more">
23 32
        <input type="hidden" id="more_elements_url" value="{{ path('favorite_get', {'user_id': app.user.id, 'tags_ids_json' : ''}) }}" />
24
-       <a href="{{ path('favorite_get', {'user_id': app.user.id, 'tags_ids_json' : tags_id_json}) }}" class="elements_more button">
33
+       <a href="{{ path('favorite_get', {'user_id': app.user.id, 'tags_ids_json' : '[]'}) }}" class="elements_more button">
25 34
          {{ 'more'|trans({}, 'userui') }}
26 35
        </a>
27 36
      </span>
28 37
   {% endif %}
38
+  
39
+  <input type="hidden" id="autoplay_url" value="{{ path('elements_get_filter_data_autoplay_favorite', {
40
+    'show_type'  : 'user',
41
+    'show_id'    : app.user.id, 
42
+    'data' : ''
43
+  }) }}" />
29 44
     
30 45
 {% endblock %}

+ 17 - 1
src/Muzich/FavoriteBundle/Resources/views/Favorite/userList.html.twig View File

@@ -19,6 +19,16 @@
19 19
   {% include "MuzichCoreBundle:Tag:tagsList.favorite.html.twig" with {
20 20
     'user_id' : viewed_user.id
21 21
   } %}
22
+  
23
+  <a href="{{ path('elements_get_filter_data_autoplay_favorite', {
24
+        'show_type'  : 'user',
25
+        'show_id'    : viewed_user.id, 
26
+        'data'       : '[]'
27
+      }) }}" class="button" id="autoplay_launch" 
28
+     title="{{ 'elements.autoplay.launch'|trans({}, 'elements') }}" >
29
+    <img src="{{ asset('/bundles/muzichcore/img/1353494305_player_play.png') }}" alt="" />
30
+  </a>
31
+  
22 32
 
23 33
   {% include "MuzichCoreBundle:SearchElement:default.html.twig" %}
24 34
     
@@ -29,10 +39,16 @@
29 39
   {% if elements|length %}
30 40
      <span class="elements_more">
31 41
        <input type="hidden" id="more_elements_url" value="{{ path('favorite_get', {'user_id': viewed_user.id, 'tags_ids_json' : ''}) }}" />
32
-       <a href="{{ path('favorite_get', {'user_id': viewed_user.id, 'tags_ids_json' : tags_id_json}) }}" class="elements_more button">
42
+       <a href="{{ path('favorite_get', {'user_id': viewed_user.id, 'tags_ids_json' : '[]'}) }}" class="elements_more button">
33 43
          {{ 'more'|trans({}, 'userui') }}
34 44
        </a>
35 45
      </span>
36 46
   {% endif %}
47
+  
48
+  <input type="hidden" id="autoplay_url" value="{{ path('elements_get_filter_data_autoplay_favorite', {
49
+    'show_type'  : 'user',
50
+    'show_id'    : viewed_user.id, 
51
+    'data' : ''
52
+  }) }}" />
37 53
     
38 54
 {% endblock %}

+ 6 - 5
src/Muzich/HomeBundle/Resources/views/Show/showGroup.html.twig View File

@@ -101,11 +101,6 @@
101 101
         'object_id'     : group.id, 
102 102
         'tags_ids_json' : ''
103 103
       }) }}" />
104
-     <input type="hidden" id="autoplay_url" value="{{ path('elements_get_filter_data_autoplay_show', {
105
-        'show_type'          : 'group',
106
-        'show_id'            : group.id, 
107
-        'data' : ''
108
-      }) }}" />
109 104
      <a href="{{ path('show_elements_get', {
110 105
         'type'          : 'group',
111 106
         'object_id'     : group.id, 
@@ -117,4 +112,10 @@
117 112
   {% endif %}
118 113
   {% endif %}
119 114
   
115
+  <input type="hidden" id="autoplay_url" value="{{ path('elements_get_filter_data_autoplay_show', {
116
+    'show_type'          : 'group',
117
+    'show_id'            : group.id, 
118
+    'data' : ''
119
+  }) }}" />
120
+            
120 121
 {% endblock %}

+ 6 - 5
src/Muzich/HomeBundle/Resources/views/Show/showUser.html.twig View File

@@ -108,11 +108,6 @@
108 108
         'object_id'     : viewed_user.id, 
109 109
         'tags_ids_json' : ''
110 110
       }) }}" />
111
-     <input type="hidden" id="autoplay_url" value="{{ path('elements_get_filter_data_autoplay_show', {
112
-        'show_type'          : 'user',
113
-        'show_id'     : viewed_user.id, 
114
-        'data' : ''
115
-      }) }}" />
116 111
      <a href="{{ path('show_elements_get', {
117 112
         'type'          : 'user',
118 113
         'object_id'     : viewed_user.id, 
@@ -124,4 +119,10 @@
124 119
   {% endif %}
125 120
   {% endif %}
126 121
   
122
+  <input type="hidden" id="autoplay_url" value="{{ path('elements_get_filter_data_autoplay_show', {
123
+    'show_type'          : 'user',
124
+    'show_id'     : viewed_user.id, 
125
+    'data' : ''
126
+  }) }}" />
127
+  
127 128
 {% endblock %}