|
@@ -11,6 +11,7 @@ use Muzich\CoreBundle\Entity\Element;
|
11
|
11
|
use Muzich\CoreBundle\Util\TagLike;
|
12
|
12
|
use Muzich\CoreBundle\Entity\User;
|
13
|
13
|
use Muzich\CoreBundle\lib\AutoplayManager;
|
|
14
|
+use Muzich\CoreBundle\Searcher\ElementSearcher;
|
14
|
15
|
|
15
|
16
|
class ElementController extends Controller
|
16
|
17
|
{
|
|
@@ -993,7 +994,7 @@ class ElementController extends Controller
|
993
|
994
|
* @param "filter"|"show"|"favorites" $type
|
994
|
995
|
* @param ~ $data
|
995
|
996
|
*/
|
996
|
|
- public function getDatasAutoplayAction(Request $request, $type, $data)
|
|
997
|
+ public function getDatasAutoplayAction(Request $request, $type, $data, $show_type = null, $show_id = null)
|
997
|
998
|
{
|
998
|
999
|
if (($response = $this->mustBeConnected(true)))
|
999
|
1000
|
{
|
|
@@ -1012,6 +1013,30 @@ class ElementController extends Controller
|
1012
|
1013
|
));
|
1013
|
1014
|
$elements = $search_object->getElements($this->getDoctrine(), $this->getUserId());
|
1014
|
1015
|
}
|
|
1016
|
+ elseif ($type == 'show')
|
|
1017
|
+ {
|
|
1018
|
+ if ($show_type != 'user' && $show_type != 'group')
|
|
1019
|
+ {
|
|
1020
|
+ throw $this->createNotFoundException('Not found');
|
|
1021
|
+ }
|
|
1022
|
+
|
|
1023
|
+ $tag_ids = json_decode($data);
|
|
1024
|
+ $search_object = new ElementSearcher();
|
|
1025
|
+
|
|
1026
|
+ $tags = array();
|
|
1027
|
+ foreach ($tag_ids as $id)
|
|
1028
|
+ {
|
|
1029
|
+ $tags[$id] = $id;
|
|
1030
|
+ }
|
|
1031
|
+
|
|
1032
|
+ $search_object->init(array(
|
|
1033
|
+ 'tags' => $tags,
|
|
1034
|
+ $show_type.'_id' => $show_id,
|
|
1035
|
+ 'count' => $this->container->getParameter('autoplay_max_elements')
|
|
1036
|
+ ));
|
|
1037
|
+
|
|
1038
|
+ $elements = $search_object->getElements($this->getDoctrine(), $this->getUserId());
|
|
1039
|
+ }
|
1015
|
1040
|
|
1016
|
1041
|
if (count($elements))
|
1017
|
1042
|
{
|