|
@@ -36,16 +36,36 @@ class ShowController extends Controller
|
36
|
36
|
$tags_id[] = $tag->getId();
|
37
|
37
|
}
|
38
|
38
|
|
|
39
|
+ $element_ids_owned = $this->getDoctrine()->getRepository('MuzichCoreBundle:User')
|
|
40
|
+ ->getElementIdsOwned($viewed_user->getId())
|
|
41
|
+ ;
|
|
42
|
+
|
|
43
|
+ $count_favorited = $this->getDoctrine()->getRepository('MuzichCoreBundle:UsersElementsFavorites')
|
|
44
|
+ ->countFavoritedForUserElements($viewed_user->getId(), $element_ids_owned)
|
|
45
|
+ ;
|
|
46
|
+
|
|
47
|
+ $count_favorited_users = $this->getDoctrine()->getRepository('MuzichCoreBundle:UsersElementsFavorites')
|
|
48
|
+ ->countFavoritedUsersForUserElements($viewed_user->getId(), $element_ids_owned)
|
|
49
|
+ ;
|
|
50
|
+
|
|
51
|
+ $count_followers = $this->getDoctrine()->getRepository('MuzichCoreBundle:User')
|
|
52
|
+ ->countFollowers($viewed_user->getId())
|
|
53
|
+ ;
|
|
54
|
+
|
39
|
55
|
return array(
|
40
|
|
- 'tags' => $tags,
|
41
|
|
- 'tags_id_json' => json_encode($tags_id),
|
42
|
|
- 'viewed_user' => $viewed_user,
|
43
|
|
- 'elements' => $search_object->getElements($this->getDoctrine(), $this->getUserId()),
|
44
|
|
- 'following' => $this->getUser()->isFollowingUserByQuery($this->getDoctrine(), $viewed_user->getId()),
|
45
|
|
- 'user' => $this->getUser(),
|
46
|
|
- 'more_count' => ($count)?$count+$this->container->getParameter('search_default_count'):$this->container->getParameter('search_default_count')*2,
|
47
|
|
- 'more_route' => 'show_user_more',
|
48
|
|
- 'topmenu_active' => ($viewed_user->getId() == $this->getUserId()) ? 'myfeeds' : 'public'
|
|
56
|
+ 'tags' => $tags,
|
|
57
|
+ 'tags_id_json' => json_encode($tags_id),
|
|
58
|
+ 'viewed_user' => $viewed_user,
|
|
59
|
+ 'elements' => $search_object->getElements($this->getDoctrine(), $this->getUserId()),
|
|
60
|
+ 'following' => $this->getUser()->isFollowingUserByQuery($this->getDoctrine(), $viewed_user->getId()),
|
|
61
|
+ 'user' => $this->getUser(),
|
|
62
|
+ 'more_count' => ($count)?$count+$this->container->getParameter('search_default_count'):$this->container->getParameter('search_default_count')*2,
|
|
63
|
+ 'more_route' => 'show_user_more',
|
|
64
|
+ 'topmenu_active' => ($viewed_user->getId() == $this->getUserId()) ? 'myfeeds' : 'public',
|
|
65
|
+ 'count_owned' => count($element_ids_owned),
|
|
66
|
+ 'count_favorited' => $count_favorited,
|
|
67
|
+ 'count_favorited_users' => $count_favorited_users,
|
|
68
|
+ 'count_followers' => $count_followers
|
49
|
69
|
);
|
50
|
70
|
}
|
51
|
71
|
|
|
@@ -80,6 +100,22 @@ class ShowController extends Controller
|
80
|
100
|
$tags_id[] = $tag->getId();
|
81
|
101
|
}
|
82
|
102
|
|
|
103
|
+ $element_ids_owned = $this->getDoctrine()->getRepository('MuzichCoreBundle:Group')
|
|
104
|
+ ->getElementIdsOwned($group->getId())
|
|
105
|
+ ;
|
|
106
|
+
|
|
107
|
+ $count_favorited = $this->getDoctrine()->getRepository('MuzichCoreBundle:UsersElementsFavorites')
|
|
108
|
+ ->countFavoritedForUserElements(null, $element_ids_owned)
|
|
109
|
+ ;
|
|
110
|
+
|
|
111
|
+ $count_favorited_users = $this->getDoctrine()->getRepository('MuzichCoreBundle:UsersElementsFavorites')
|
|
112
|
+ ->countFavoritedUsersForUserElements(null, $element_ids_owned)
|
|
113
|
+ ;
|
|
114
|
+
|
|
115
|
+ $count_followers = $this->getDoctrine()->getRepository('MuzichCoreBundle:Group')
|
|
116
|
+ ->countFollowers($group->getId())
|
|
117
|
+ ;
|
|
118
|
+
|
83
|
119
|
return array(
|
84
|
120
|
'tags' => $tags,
|
85
|
121
|
'tags_id_json' => json_encode($tags_id),
|
|
@@ -91,7 +127,11 @@ class ShowController extends Controller
|
91
|
127
|
'add_form' => (isset($add_form)) ? $add_form->createView() : null,
|
92
|
128
|
'add_form_name' => (isset($add_form)) ? 'add' : null,
|
93
|
129
|
'more_count' => ($count)?$count+$this->container->getParameter('search_default_count'):$this->container->getParameter('search_default_count')*2,
|
94
|
|
- 'more_route' => 'show_group_more'
|
|
130
|
+ 'more_route' => 'show_group_more',
|
|
131
|
+ 'count_owned' => count($element_ids_owned),
|
|
132
|
+ 'count_favorited' => $count_favorited,
|
|
133
|
+ 'count_favorited_users' => $count_favorited_users,
|
|
134
|
+ 'count_followers' => $count_followers
|
95
|
135
|
);
|
96
|
136
|
}
|
97
|
137
|
|