From cbbe78f79e82ab0321907d4ca39d324d81a30e95 Mon Sep 17 00:00:00 2001 From: jmontoyaa Date: Mon, 5 Feb 2018 10:38:22 +0100 Subject: [PATCH] Replace custom tpl with a generic, fix php error, fix message BT#10882 when adding users to a LP category.0 --- main/lp/lp_subscribe_users_to_category.php | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/main/lp/lp_subscribe_users_to_category.php b/main/lp/lp_subscribe_users_to_category.php index 910e84b8d2..5854c2dd64 100644 --- a/main/lp/lp_subscribe_users_to_category.php +++ b/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; -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);