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
       
1041
       
1042
       $elements = $search_object->getElements($this->getDoctrine(), $this->getUserId());
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
     if (count($elements))
1069
     if (count($elements))
1046
     {
1070
     {

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

168
   pattern: /ajax/show/{show_type}/{show_id}/elements/get/datas/autoplay/{data}
168
   pattern: /ajax/show/{show_type}/{show_id}/elements/get/datas/autoplay/{data}
169
   defaults: { _controller: MuzichCoreBundle:Element:getDatasAutoplay, type: 'show', data: null }
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
 element_show_need_tags:
175
 element_show_need_tags:
172
   pattern: /need-tags
176
   pattern: /need-tags
173
   defaults: { _controller: MuzichHomeBundle:Home:needTags }
177
   defaults: { _controller: MuzichHomeBundle:Home:needTags }

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

246
     
246
     
247
     $tag_ids = json_decode($tags_ids_json);
247
     $tag_ids = json_decode($tags_ids_json);
248
     $search_object = new ElementSearcher();
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
     $search_object->init(array(
260
     $search_object->init(array(

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

12
     'user_id' : app.user.id
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
   {% include "MuzichCoreBundle:SearchElement:default.html.twig" %}
24
   {% include "MuzichCoreBundle:SearchElement:default.html.twig" %}
16
     
25
     
17
   <div class="elements_loader_div">
26
   <div class="elements_loader_div">
21
   {% if elements|length %}
30
   {% if elements|length %}
22
      <span class="elements_more">
31
      <span class="elements_more">
23
        <input type="hidden" id="more_elements_url" value="{{ path('favorite_get', {'user_id': app.user.id, 'tags_ids_json' : ''}) }}" />
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
          {{ 'more'|trans({}, 'userui') }}
34
          {{ 'more'|trans({}, 'userui') }}
26
        </a>
35
        </a>
27
      </span>
36
      </span>
28
   {% endif %}
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
 {% endblock %}
45
 {% endblock %}

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

19
   {% include "MuzichCoreBundle:Tag:tagsList.favorite.html.twig" with {
19
   {% include "MuzichCoreBundle:Tag:tagsList.favorite.html.twig" with {
20
     'user_id' : viewed_user.id
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
   {% include "MuzichCoreBundle:SearchElement:default.html.twig" %}
33
   {% include "MuzichCoreBundle:SearchElement:default.html.twig" %}
24
     
34
     
29
   {% if elements|length %}
39
   {% if elements|length %}
30
      <span class="elements_more">
40
      <span class="elements_more">
31
        <input type="hidden" id="more_elements_url" value="{{ path('favorite_get', {'user_id': viewed_user.id, 'tags_ids_json' : ''}) }}" />
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
          {{ 'more'|trans({}, 'userui') }}
43
          {{ 'more'|trans({}, 'userui') }}
34
        </a>
44
        </a>
35
      </span>
45
      </span>
36
   {% endif %}
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
 {% endblock %}
54
 {% endblock %}

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

101
         'object_id'     : group.id, 
101
         'object_id'     : group.id, 
102
         'tags_ids_json' : ''
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
      <a href="{{ path('show_elements_get', {
104
      <a href="{{ path('show_elements_get', {
110
         'type'          : 'group',
105
         'type'          : 'group',
111
         'object_id'     : group.id, 
106
         'object_id'     : group.id, 
117
   {% endif %}
112
   {% endif %}
118
   {% endif %}
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
 {% endblock %}
121
 {% endblock %}

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

108
         'object_id'     : viewed_user.id, 
108
         'object_id'     : viewed_user.id, 
109
         'tags_ids_json' : ''
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
      <a href="{{ path('show_elements_get', {
111
      <a href="{{ path('show_elements_get', {
117
         'type'          : 'user',
112
         'type'          : 'user',
118
         'object_id'     : viewed_user.id, 
113
         'object_id'     : viewed_user.id, 
124
   {% endif %}
119
   {% endif %}
125
   {% endif %}
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
 {% endblock %}
128
 {% endblock %}