|
|
|
|
@ -48,11 +48,12 @@ $interbreadcrumb[] = ['url' => '#', 'name' => strip_tags($category->getName())]; |
|
|
|
|
|
|
|
|
|
$url = api_get_self().'?'.api_get_cidreq().'&action=add_users_to_category&id='.$categoryId; |
|
|
|
|
|
|
|
|
|
Display::addFlash(Display::return_message(get_lang('UserLpCategorySubscriptionDescription'))); |
|
|
|
|
$message = Display::return_message(get_lang('UserLpCategorySubscriptionDescription')); |
|
|
|
|
|
|
|
|
|
// Building the form for Groups |
|
|
|
|
$form = new FormValidator('lp_edit', 'post', $url); |
|
|
|
|
$form->addElement('hidden', 'group_form', 1); |
|
|
|
|
$form->addLabel('', $message); |
|
|
|
|
|
|
|
|
|
// Group list |
|
|
|
|
$groupList = \CourseManager::get_group_list_of_course( |
|
|
|
|
@ -119,7 +120,6 @@ foreach ($subscribedUsers as $user) { |
|
|
|
|
|
|
|
|
|
// Getting subscribed users to a category. |
|
|
|
|
$subscribedUsersInCategory = $category->getUsers(); |
|
|
|
|
|
|
|
|
|
$selectedChoices = []; |
|
|
|
|
foreach ($subscribedUsersInCategory as $item) { |
|
|
|
|
$selectedChoices[] = $item->getUser()->getId(); |
|
|
|
|
@ -128,6 +128,7 @@ foreach ($subscribedUsersInCategory as $item) { |
|
|
|
|
// Building the form for Users |
|
|
|
|
$formUsers = new FormValidator('lp_edit', 'post', $url); |
|
|
|
|
$formUsers->addElement('hidden', 'user_form', 1); |
|
|
|
|
$formUsers->addLabel('', $message); |
|
|
|
|
|
|
|
|
|
$userMultiSelect = $formUsers->addElement( |
|
|
|
|
'advmultiselect', |
|
|
|
|
@ -138,7 +139,6 @@ $userMultiSelect = $formUsers->addElement( |
|
|
|
|
$formUsers->addButtonSave(get_lang('Save')); |
|
|
|
|
|
|
|
|
|
$defaults = []; |
|
|
|
|
|
|
|
|
|
if (!empty($selectedChoices)) { |
|
|
|
|
$defaults['users'] = $selectedChoices; |
|
|
|
|
} |
|
|
|
|
@ -205,8 +205,6 @@ if ($formUsers->validate()) { |
|
|
|
|
get_lang('SubscribeGroupsToLpCategory') |
|
|
|
|
]; |
|
|
|
|
$tabs = Display::tabs($headers, [$formUsers->toHtml(), $form->toHtml()]); |
|
|
|
|
$tpl->assign('tabs', $tabs); |
|
|
|
|
$tpl->assign('content', $tabs); |
|
|
|
|
$tpl->display_one_col_template(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$layout = $tpl->get_template('learnpath/subscribe_users.tpl'); |
|
|
|
|
$tpl->display($layout); |
|
|
|
|
|