23 ?EO_UserToGroup $currentUserRelationItem,
30 $isProject = (bool)$group->get(
'PROJECT');
31 $isScrum = ($isProject && $group->get(
'SCRUM_MASTER_ID') > 0);
33 if (in_array(WorkgroupList::AVAILABLE_ACTION_VIEW, $actions,
true))
36 $title =
Loc::getMessage(
'SOCIALNETWORK_HELPER_UI_GRID_ACTION_VIEW_TITLE');
39 $title =
Loc::getMessage(
'SOCIALNETWORK_HELPER_UI_GRID_ACTION_VIEW_TITLE_SCRUM');
43 $title =
Loc::getMessage(
'SOCIALNETWORK_HELPER_UI_GRID_ACTION_VIEW_TITLE_PROJECT');
46 $groupUrl = str_replace(
47 [
'#id#',
'#ID#',
'#GROUP_ID#',
'#group_id#' ],
49 $params[
'PATH_TO_GROUP']
53 $groupUrl = (
new Uri($groupUrl))
54 ->addParams([
'scrum' =>
'Y'])
66 if (in_array(WorkgroupList::AVAILABLE_ACTION_ADD_TO_FAVORITES, $actions,
true))
68 $text =
Loc::getMessage(
'SOCIALNETWORK_HELPER_UI_GRID_ACTION_ADD_TO_FAVORITES');
69 $title =
Loc::getMessage(
'SOCIALNETWORK_HELPER_UI_GRID_ACTION_ADD_TO_FAVORITES_TITLE');
72 $title =
Loc::getMessage(
'SOCIALNETWORK_HELPER_UI_GRID_ACTION_ADD_TO_FAVORITES_TITLE_SCRUM');
76 $title =
Loc::getMessage(
'SOCIALNETWORK_HELPER_UI_GRID_ACTION_ADD_TO_FAVORITES_TITLE_PROJECT');
82 'onclick' =>
'BX.Socialnetwork.WorkgroupList.Manager.getById("' . $params[
'GRID_ID'] .
'").getActionManager().act({
83 action: "' . WorkgroupList::AJAX_ACTION_ADD_TO_FAVORITES .
'",
84 groupId: "' . $group->getId() .
'",
89 if (in_array(WorkgroupList::AVAILABLE_ACTION_REMOVE_FROM_FAVORITES, $actions,
true))
91 $text =
Loc::getMessage(
'SOCIALNETWORK_HELPER_UI_GRID_ACTION_REMOVE_FROM_FAVORITES');
92 $title =
Loc::getMessage(
'SOCIALNETWORK_HELPER_UI_GRID_ACTION_REMOVE_FROM_FAVORITES_TITLE');
95 $title =
Loc::getMessage(
'SOCIALNETWORK_HELPER_UI_GRID_ACTION_REMOVE_FROM_FAVORITES_TITLE_SCRUM');
99 $title =
Loc::getMessage(
'SOCIALNETWORK_HELPER_UI_GRID_ACTION_REMOVE_FROM_FAVORITES_TITLE_PROJECT');
105 'onclick' =>
'BX.Socialnetwork.WorkgroupList.Manager.getById("' . $params[
'GRID_ID'] .
'").getActionManager().act({
106 action: "' . WorkgroupList::AJAX_ACTION_REMOVE_FROM_FAVORITES .
'",
107 groupId: "' . $group->getId() .
'",
112 if (in_array(WorkgroupList::AVAILABLE_ACTION_EDIT, $actions,
true))
115 $title =
Loc::getMessage(
'SOCIALNETWORK_HELPER_UI_GRID_ACTION_EDIT_TITLE');
118 $title =
Loc::getMessage(
'SOCIALNETWORK_HELPER_UI_GRID_ACTION_EDIT_TITLE_SCRUM');
122 $title =
Loc::getMessage(
'SOCIALNETWORK_HELPER_UI_GRID_ACTION_EDIT_TITLE_PROJECT');
128 'href' => str_replace([
'#id#',
'#ID#',
'#GROUP_ID#',
'#group_id#' ], $group->getId(), $params[
'PATH_TO_GROUP_EDIT']),
132 if (in_array(WorkgroupList::AVAILABLE_ACTION_JOIN, $actions,
true))
135 $title =
Loc::getMessage(
'SOCIALNETWORK_HELPER_UI_GRID_ACTION_JOIN_TITLE');
138 $title =
Loc::getMessage(
'SOCIALNETWORK_HELPER_UI_GRID_ACTION_JOIN_TITLE_SCRUM');
142 $title =
Loc::getMessage(
'SOCIALNETWORK_HELPER_UI_GRID_ACTION_JOIN_TITLE_PROJECT');
153 $currentUserRelationItem
154 && $currentUserRelationItem->get(
'ROLE') === UserToGroupTable::ROLE_REQUEST
155 && $currentUserRelationItem->get(
'INITIATED_BY_TYPE') === UserToGroupTable::INITIATED_BY_GROUP
159 $menuItem[
'onclick'] =
'BX.Socialnetwork.WorkgroupList.Manager.getById("' . $params[
'GRID_ID'] .
'").getActionManager().act({
160 action: "' . WorkgroupList::AJAX_ACTION_JOIN .
'",
161 groupId: "' . $group->getId() .
'",
166 $menuItem[
'href'] = str_replace([
'#id#',
'#ID#',
'#GROUP_ID#',
'#group_id#' ], $group->getId(), $params[
'PATH_TO_JOIN_GROUP']);
169 $result[] = $menuItem;
172 if (in_array(WorkgroupList::AVAILABLE_ACTION_LEAVE, $actions,
true))
175 $title =
Loc::getMessage(
'SOCIALNETWORK_HELPER_UI_GRID_ACTION_LEAVE_TITLE');
178 $title =
Loc::getMessage(
'SOCIALNETWORK_HELPER_UI_GRID_ACTION_LEAVE_TITLE_SCRUM');
182 $title =
Loc::getMessage(
'SOCIALNETWORK_HELPER_UI_GRID_ACTION_LEAVE_TITLE_PROJECT');
188 'href' => str_replace([
'#id#',
'#ID#',
'#GROUP_ID#',
'#group_id#' ], $group->getId(), $params[
'PATH_TO_LEAVE_GROUP']),
192 if (in_array(WorkgroupList::AVAILABLE_ACTION_DELETE_INCOMING_REQUEST, $actions,
true))
194 $text =
Loc::getMessage(
'SOCIALNETWORK_HELPER_UI_GRID_ACTION_DELETE_INCOMING_REQUEST');
195 $title =
Loc::getMessage(
'SOCIALNETWORK_HELPER_UI_GRID_ACTION_DELETE_INCOMING_REQUEST_TITLE');
198 $title =
Loc::getMessage(
'SOCIALNETWORK_HELPER_UI_GRID_ACTION_DELETE_INCOMING_REQUEST_TITLE_SCRUM');
202 $title =
Loc::getMessage(
'SOCIALNETWORK_HELPER_UI_GRID_ACTION_DELETE_INCOMING_REQUEST_TITLE_PROJECT');
208 'onclick' =>
'BX.Socialnetwork.WorkgroupList.Manager.getById("' . $params[
'GRID_ID'] .
'").getActionManager().act({
209 action: "' . WorkgroupList::AJAX_ACTION_DELETE_INCOMING_REQUEST .
'",
210 groupId: "' . $group->getId() .
'",
215 if (in_array(WorkgroupList::AVAILABLE_ACTION_ADD_TO_ARCHIVE, $actions,
true))
217 $text =
Loc::getMessage(
'SOCIALNETWORK_HELPER_UI_GRID_ACTION_ADD_TO_ARCHIVE');
218 $title =
Loc::getMessage(
'SOCIALNETWORK_HELPER_UI_GRID_ACTION_ADD_TO_ARCHIVE_TITLE');
221 $title =
Loc::getMessage(
'SOCIALNETWORK_HELPER_UI_GRID_ACTION_ADD_TO_ARCHIVE_TITLE_SCRUM');
225 $title =
Loc::getMessage(
'SOCIALNETWORK_HELPER_UI_GRID_ACTION_ADD_TO_ARCHIVE_TITLE_PROJECT');
231 'onclick' =>
'BX.Socialnetwork.WorkgroupList.Manager.getById("' . $params[
'GRID_ID'] .
'").getActionManager().act({
232 action: "' . WorkgroupList::AJAX_ACTION_ADD_TO_ARCHIVE .
'",
233 groupId: "' . $group->getId() .
'",
238 if (in_array(WorkgroupList::AVAILABLE_ACTION_REMOVE_FROM_ARCHIVE, $actions,
true))
240 $text =
Loc::getMessage(
'SOCIALNETWORK_HELPER_UI_GRID_ACTION_REMOVE_FROM_ARCHIVE');
241 $title =
Loc::getMessage(
'SOCIALNETWORK_HELPER_UI_GRID_ACTION_REMOVE_FROM_ARCHIVE_TITLE');
244 $title =
Loc::getMessage(
'SOCIALNETWORK_HELPER_UI_GRID_ACTION_REMOVE_FROM_ARCHIVE_TITLE_SCRUM');
248 $title =
Loc::getMessage(
'SOCIALNETWORK_HELPER_UI_GRID_ACTION_REMOVE_FROM_ARCHIVE_TITLE_PROJECT');
254 'onclick' =>
'BX.Socialnetwork.WorkgroupList.Manager.getById("' . $params[
'GRID_ID'] .
'").getActionManager().act({
255 action: "' . WorkgroupList::AJAX_ACTION_REMOVE_FROM_ARCHIVE .
'",
256 groupId: "' . $group->getId() .
'",
261 if (in_array(WorkgroupList::AVAILABLE_ACTION_DELETE, $actions,
true))
264 $title =
Loc::getMessage(
'SOCIALNETWORK_HELPER_UI_GRID_ACTION_DELETE_TITLE');
267 $title =
Loc::getMessage(
'SOCIALNETWORK_HELPER_UI_GRID_ACTION_DELETE_TITLE_SCRUM');
271 $title =
Loc::getMessage(
'SOCIALNETWORK_HELPER_UI_GRID_ACTION_DELETE_TITLE_PROJECT');
277 'href' => str_replace([
'#id#',
'#ID#',
'#GROUP_ID#',
'#group_id#' ], $group->getId(), $params[
'PATH_TO_GROUP_DELETE']),