Skip to content

Commit cbbe78f

Browse files
committed
Replace custom tpl with a generic, fix php error, fix message BT#10882
when adding users to a LP category.0
1 parent d389ac2 commit cbbe78f

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

main/lp/lp_subscribe_users_to_category.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,12 @@
4848

4949
$url = api_get_self().'?'.api_get_cidreq().'&action=add_users_to_category&id='.$categoryId;
5050

51-
Display::addFlash(Display::return_message(get_lang('UserLpCategorySubscriptionDescription')));
51+
$message = Display::return_message(get_lang('UserLpCategorySubscriptionDescription'));
5252

5353
// Building the form for Groups
5454
$form = new FormValidator('lp_edit', 'post', $url);
5555
$form->addElement('hidden', 'group_form', 1);
56+
$form->addLabel('', $message);
5657

5758
// Group list
5859
$groupList = \CourseManager::get_group_list_of_course(
@@ -119,7 +120,6 @@
119120

120121
// Getting subscribed users to a category.
121122
$subscribedUsersInCategory = $category->getUsers();
122-
123123
$selectedChoices = [];
124124
foreach ($subscribedUsersInCategory as $item) {
125125
$selectedChoices[] = $item->getUser()->getId();
@@ -128,6 +128,7 @@
128128
// Building the form for Users
129129
$formUsers = new FormValidator('lp_edit', 'post', $url);
130130
$formUsers->addElement('hidden', 'user_form', 1);
131+
$formUsers->addLabel('', $message);
131132

132133
$userMultiSelect = $formUsers->addElement(
133134
'advmultiselect',
@@ -138,7 +139,6 @@
138139
$formUsers->addButtonSave(get_lang('Save'));
139140

140141
$defaults = [];
141-
142142
if (!empty($selectedChoices)) {
143143
$defaults['users'] = $selectedChoices;
144144
}
@@ -205,8 +205,6 @@
205205
get_lang('SubscribeGroupsToLpCategory')
206206
];
207207
$tabs = Display::tabs($headers, [$formUsers->toHtml(), $form->toHtml()]);
208-
$tpl->assign('tabs', $tabs);
208+
$tpl->assign('content', $tabs);
209+
$tpl->display_one_col_template();
209210
}
210-
211-
$layout = $tpl->get_template('learnpath/subscribe_users.tpl');
212-
$tpl->display($layout);

0 commit comments

Comments
 (0)