Replace custom tpl with a generic, fix php error, fix message BT#10882

when adding users to a LP category.0
pull/2458/head
jmontoyaa 8 years ago
parent d389ac2782
commit cbbe78f79e
  1. 12
      main/lp/lp_subscribe_users_to_category.php

@ -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; $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 // Building the form for Groups
$form = new FormValidator('lp_edit', 'post', $url); $form = new FormValidator('lp_edit', 'post', $url);
$form->addElement('hidden', 'group_form', 1); $form->addElement('hidden', 'group_form', 1);
$form->addLabel('', $message);
// Group list // Group list
$groupList = \CourseManager::get_group_list_of_course( $groupList = \CourseManager::get_group_list_of_course(
@ -119,7 +120,6 @@ foreach ($subscribedUsers as $user) {
// Getting subscribed users to a category. // Getting subscribed users to a category.
$subscribedUsersInCategory = $category->getUsers(); $subscribedUsersInCategory = $category->getUsers();
$selectedChoices = []; $selectedChoices = [];
foreach ($subscribedUsersInCategory as $item) { foreach ($subscribedUsersInCategory as $item) {
$selectedChoices[] = $item->getUser()->getId(); $selectedChoices[] = $item->getUser()->getId();
@ -128,6 +128,7 @@ foreach ($subscribedUsersInCategory as $item) {
// Building the form for Users // Building the form for Users
$formUsers = new FormValidator('lp_edit', 'post', $url); $formUsers = new FormValidator('lp_edit', 'post', $url);
$formUsers->addElement('hidden', 'user_form', 1); $formUsers->addElement('hidden', 'user_form', 1);
$formUsers->addLabel('', $message);
$userMultiSelect = $formUsers->addElement( $userMultiSelect = $formUsers->addElement(
'advmultiselect', 'advmultiselect',
@ -138,7 +139,6 @@ $userMultiSelect = $formUsers->addElement(
$formUsers->addButtonSave(get_lang('Save')); $formUsers->addButtonSave(get_lang('Save'));
$defaults = []; $defaults = [];
if (!empty($selectedChoices)) { if (!empty($selectedChoices)) {
$defaults['users'] = $selectedChoices; $defaults['users'] = $selectedChoices;
} }
@ -205,8 +205,6 @@ if ($formUsers->validate()) {
get_lang('SubscribeGroupsToLpCategory') get_lang('SubscribeGroupsToLpCategory')
]; ];
$tabs = Display::tabs($headers, [$formUsers->toHtml(), $form->toHtml()]); $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);

Loading…
Cancel
Save