Файловый менеджер - Редактировать - /home/lakoyani/lakoyani.com.fj/group.tar
Назад
group.php 0000644 00000026310 14710744420 0006416 0 ustar 00 <?php /* For licensing terms, see /license.txt */ use ChamiloSession as Session; /** * Main page for the group module. * This script displays the general group settings, * and a list of groups with buttons to view, edit... * * @author Thomas Depraetere, Hugues Peeters, Christophe Gesche: initial versions * @author Bert Vanderkimpen, improved self-unsubscribe for cvs * @author Patrick Cool, show group comment under the group name * @author Roan Embrechts, initial self-unsubscribe code, code cleaning, virtual course support * @author Bart Mollet, code cleaning, use of Display-library, list of courseAdmin-tools, use of GroupManager * @author Isaac Flores, code cleaning and improvements */ require_once __DIR__.'/../inc/global.inc.php'; $is_allowed_in_course = api_is_allowed_in_course(); $userId = api_get_user_id(); $this_section = SECTION_COURSES; $current_course_tool = TOOL_GROUP; $course_id = api_get_course_int_id(); $sessionId = api_get_session_id(); // Notice for unauthorized people. api_protect_course_script(true, false, 'group'); $htmlHeadXtra[] = '<script> $(function() { var i; for (i=0; i<$(".actions").length; i++) { if ($(".actions:eq("+i+")").html()=="<table border=\"0\"></table>" || $(".actions:eq("+i+")").html()=="" || $(".actions:eq("+i+")").html()==null) { $(".actions:eq("+i+")").hide(); } } }); </script>'; $nameTools = get_lang('GroupManagement'); /* * Self-registration and un-registration */ $my_group_id = isset($_GET['group_id']) ? (int) $_GET['group_id'] : null; $my_group = isset($_REQUEST['group']) ? Security::remove_XSS($_REQUEST['group']) : null; $my_get_id1 = isset($_GET['id1']) ? Security::remove_XSS($_GET['id1']) : null; $my_get_id2 = isset($_GET['id2']) ? Security::remove_XSS($_GET['id2']) : null; $my_get_id = isset($_GET['id']) ? Security::remove_XSS($_GET['id']) : null; $currentUrl = api_get_path(WEB_CODE_PATH).'group/group.php?'.api_get_cidreq(); $groupInfo = GroupManager::get_group_properties($my_group_id); if (isset($_GET['action']) && $is_allowed_in_course) { switch ($_GET['action']) { case 'set_visible': if (api_is_allowed_to_edit()) { GroupManager::setVisible($my_get_id); Display::addFlash(Display::return_message(get_lang('ItemUpdated'))); header("Location: $currentUrl"); exit; } break; case 'set_invisible': if (api_is_allowed_to_edit()) { GroupManager::setInvisible($my_get_id); Display::addFlash(Display::return_message(get_lang('ItemUpdated'))); header("Location: $currentUrl"); exit; } break; case 'self_reg': if (GroupManager::is_self_registration_allowed($userId, $groupInfo)) { GroupManager::subscribe_users($userId, $groupInfo); Display::addFlash(Display::return_message(get_lang('GroupNowMember'))); header("Location: $currentUrl"); exit; } else { Display::addFlash(Display::return_message(get_lang('Error'))); header("Location: $currentUrl"); exit; } break; case 'self_unreg': if (GroupManager::is_self_unregistration_allowed($userId, $groupInfo)) { GroupManager::unsubscribe_users($userId, $groupInfo); Display::addFlash(Display::return_message(get_lang('StudentDeletesHimself'))); header("Location: $currentUrl"); exit; } break; } } /* * Group-admin functions */ if (api_is_allowed_to_edit(false, true)) { // Post-actions if (isset($_POST['action'])) { switch ($_POST['action']) { case 'delete_selected': if (is_array($_POST['group'])) { foreach ($_POST['group'] as $myGroupId) { $groupInfo = GroupManager::get_group_properties($myGroupId); GroupManager::deleteGroup($groupInfo); } Display::addFlash(Display::return_message(get_lang('SelectedGroupsDeleted'))); header("Location: $currentUrl"); exit; } break; case 'empty_selected': if (is_array($_POST['group'])) { foreach ($_POST['group'] as $myGroupId) { $groupInfo = GroupManager::get_group_properties($myGroupId); GroupManager::unsubscribe_all_users($groupInfo); } Display::addFlash(Display::return_message(get_lang('SelectedGroupsEmptied'))); header("Location: $currentUrl"); exit; } break; case 'fill_selected': if (is_array($_POST['group'])) { foreach ($_POST['group'] as $myGroupId) { $groupInfo = GroupManager::get_group_properties($myGroupId); GroupManager::fillGroupWithUsers($groupInfo); } Display::addFlash(Display::return_message(get_lang('SelectedGroupsFilled'))); header("Location: $currentUrl"); exit; } break; } } // Get-actions if (isset($_GET['action'])) { switch ($_GET['action']) { case 'swap_cat_order': GroupManager::swap_category_order($my_get_id1, $my_get_id2); Display::addFlash(Display::return_message(get_lang('CategoryOrderChanged'))); header("Location: $currentUrl"); exit; break; case 'delete_one': $groupInfo = GroupManager::get_group_properties($my_get_id); GroupManager::deleteGroup($groupInfo); Display::addFlash(Display::return_message(get_lang('GroupDel'))); header("Location: $currentUrl"); exit; break; case 'fill_one': $groupInfo = GroupManager::get_group_properties($my_get_id); GroupManager::fillGroupWithUsers($groupInfo); Display::addFlash(Display::return_message(get_lang('GroupFilledGroups'))); header("Location: $currentUrl"); exit; break; case 'delete_category': if (empty($sessionId)) { GroupManager::delete_category($my_get_id); Display::addFlash( Display::return_message(get_lang('CategoryDeleted')) ); header("Location: $currentUrl"); exit; } break; } } } Display::display_header(get_lang('Groups')); Display::display_introduction_section(TOOL_GROUP); $actionsLeft = ''; if (api_is_allowed_to_edit(false, true)) { $actionsLeft .= '<a href="group_creation.php?'.api_get_cidreq().'">'. Display::return_icon('add-groups.png', get_lang('NewGroupCreate'), '', ICON_SIZE_MEDIUM).'</a>'; if (empty($sessionId) && 'true' === api_get_setting('allow_group_categories')) { $actionsLeft .= '<a href="group_category.php?'.api_get_cidreq().'&action=add_category">'. Display::return_icon('new_folder.png', get_lang('AddCategory'), '', ICON_SIZE_MEDIUM).'</a>'; } $actionsLeft .= '<a href="import.php?'.api_get_cidreq().'&action=import">'. Display::return_icon('import_csv.png', get_lang('Import'), '', ICON_SIZE_MEDIUM).'</a>'; $actionsLeft .= '<a href="group_overview.php?'.api_get_cidreq().'&action=export_all&type=csv">'. Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), '', ICON_SIZE_MEDIUM).'</a>'; $actionsLeft .= '<a href="group_overview.php?'.api_get_cidreq().'&action=export_all&type=xls">'. Display::return_icon('export_excel.png', get_lang('ExportAsXLS'), '', ICON_SIZE_MEDIUM).'</a>'; $actionsLeft .= '<a href="group_overview.php?'.api_get_cidreq().'&action=export_pdf">'. Display::return_icon('pdf.png', get_lang('ExportToPDF'), '', ICON_SIZE_MEDIUM).'</a>'; $actionsLeft .= '<a href="group_overview.php?'.api_get_cidreq().'">'. Display::return_icon('group_summary.png', get_lang('GroupOverview'), '', ICON_SIZE_MEDIUM).'</a>'; } $actionsRight = GroupManager::getSearchForm(); $toolbar = Display::toolbarAction('toolbar-groups', [$actionsLeft, $actionsRight]); $group_cats = GroupManager::get_categories(api_get_course_id()); echo $toolbar; echo UserManager::getUserSubscriptionTab(3); /* List all categories */ if (api_get_setting('allow_group_categories') === 'true') { $defaultCategory = [ 'id' => 0, 'iid' => 0, 'description' => '', 'title' => get_lang('DefaultGroupCategory'), ]; $group_cats = array_merge([$defaultCategory], $group_cats); foreach ($group_cats as $index => $category) { $categoryId = $category['id']; $group_list = GroupManager::get_group_list($categoryId); $groupToShow = GroupManager::process_groups($group_list, $categoryId); if (empty($categoryId) && empty($group_list)) { continue; } $label = Display::label(count($group_list).' '.get_lang('ExistingGroups'), 'info'); $actions = null; if (api_is_allowed_to_edit(false, true) && !empty($categoryId) && empty($sessionId)) { // Edit $actions .= '<a href="group_category.php?'.api_get_cidreq().'&id='.$categoryId.'" title="'.get_lang('Edit').'">'. Display::return_icon('edit.png', get_lang('EditCategory'), '', ICON_SIZE_SMALL).'</a>'; // Delete $actions .= Display::url( Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL), 'group.php?'.api_get_cidreq().'&action=delete_category&id='.$categoryId, [ 'onclick' => 'javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES))."'".')) return false;', ] ); // Move if ($index != 0) { $actions .= ' <a href="group.php?'.api_get_cidreq().'&action=swap_cat_order&id1='.$categoryId.'&id2='.$group_cats[$index - 1]['id'].'">'. Display::return_icon('up.png', ' ', '', ICON_SIZE_SMALL).'</a>'; } if ($index != count($group_cats) - 1) { $actions .= ' <a href="group.php?'.api_get_cidreq().'&action=swap_cat_order&id1='.$categoryId.'&id2='.$group_cats[$index + 1]['id'].'">'. Display::return_icon('down.png', ' ', '', ICON_SIZE_SMALL).'</a>'; } } echo Display::page_header( Security::remove_XSS($category['title'].' '.$label.' ').$actions, null, 'h4', false ); echo Security::remove_XSS($category['description']); echo $groupToShow; } } else { echo GroupManager::process_groups(GroupManager::get_group_list()); } if (!isset($_GET['origin']) || $_GET['origin'] != 'learnpath') { Display::display_footer(); } Session::write('_gid', 0); group_creation.php 0000644 00000033327 14710744420 0010310 0 ustar 00 <?php /* For licensing terms, see /license.txt */ require_once __DIR__.'/../inc/global.inc.php'; $this_section = SECTION_COURSES; $current_course_tool = TOOL_GROUP; // Notice for unauthorized people. api_protect_course_script(true); if (!api_is_allowed_to_edit(false, true)) { api_not_allowed(true); } $currentUrl = api_get_path(WEB_CODE_PATH).'group/group.php?'.api_get_cidreq(); $sessionId = api_get_session_id(); /* Create the groups */ if (isset($_POST['action'])) { switch ($_POST['action']) { case 'create_groups': $groups = []; $useOnlyFirstCategory = false; $firstCategory = isset($_POST['group_0_category']) ? $_POST['group_0_category'] : 0; if (isset($_POST['same_category']) && $_POST['same_category']) { $useOnlyFirstCategory = true; } for ($i = 0; $i < $_POST['number_of_groups']; $i++) { $group1['name'] = empty($_POST['group_'.$i.'_name']) ? get_lang('Group').' '.$i : $_POST['group_'.$i.'_name']; $group1['category'] = isset($_POST['group_'.$i.'_category']) ? $_POST['group_'.$i.'_category'] : null; if ($useOnlyFirstCategory) { $group1['category'] = $firstCategory; } $group1['tutor'] = isset($_POST['group_'.$i.'_tutor']) ? $_POST['group_'.$i.'_tutor'] : null; $group1['places'] = isset($_POST['group_'.$i.'_places']) ? $_POST['group_'.$i.'_places'] : null; $groups[] = $group1; } foreach ($groups as $index => $group) { if (!empty($_POST['same_tutor'])) { $group['tutor'] = $_POST['group_0_tutor']; } if (!empty($_POST['same_places'])) { $group['places'] = $_POST['group_0_places']; } GroupManager::create_group( $group['name'], $group['category'], $group['tutor'], $group['places'] ); } Display::addFlash(Display::return_message(get_lang('GroupsAdded'))); header('Location: '.$currentUrl); exit; break; case 'create_subgroups': GroupManager::create_subgroups( $_POST['base_group'], $_POST['number_of_groups'] ); Display::addFlash(Display::return_message(get_lang('GroupsAdded'))); header('Location: '.$currentUrl); exit; break; case 'create_class_groups': GroupManager::create_class_groups($_POST['group_category']); Display::addFlash(Display::return_message(get_lang('GroupsAdded'))); header('Location: '.$currentUrl); exit; break; } } $nameTools = get_lang('GroupCreation'); $interbreadcrumb[] = [ 'url' => api_get_path(WEB_CODE_PATH).'group/group.php?'.api_get_cidreq(), 'name' => get_lang('Groups'), ]; Display::display_header($nameTools, 'Group'); if (isset($_POST['number_of_groups'])) { if (!is_numeric($_POST['number_of_groups']) || intval($_POST['number_of_groups']) < 1) { echo Display::return_message( get_lang('PleaseEnterValidNumber').'<br /><br /> <a href="group_creation.php?'.api_get_cidreq().'">« '.get_lang('Back').'</a>', 'error', false ); } else { $number_of_groups = intval($_POST['number_of_groups']); if ($number_of_groups > 1) { ?> <script> var number_of_groups = <?php echo $number_of_groups; ?>; function switch_state(key) { ref = document.getElementById(key+'_0'); for(i=1; i<number_of_groups; i++) { var id = "#"+key+'_'+i; element = document.getElementById(key+'_'+i); element.disabled = !element.disabled; disabled = element.disabled; $(id).prop('disabled', disabled); $(id).prop('value', ref.value); $(id).selectpicker('refresh'); } if (disabled) { ref.addEventListener("change", copy, false); } else { ref.removeEventListener("change", copy, false); } copy_value(key); } function copy(e) { key = e.currentTarget.id; var re = new RegExp ('_0', '') ; var key = key.replace(re, '') ; copy_value(key); } function copy_value(key) { ref = document.getElementById(key+'_0'); for( i=1; i<number_of_groups; i++) { element = document.getElementById(key+'_'+i); element.value = ref.value; } } </script> <?php } $group_categories = GroupManager::get_categories(); $group_id = GroupManager::get_number_of_groups() + 1; $cat_options = []; foreach ($group_categories as $index => $category) { $cat_options[$category['id']] = $category['title']; } $form = new FormValidator('create_groups_step2', 'POST', api_get_self().'?'.api_get_cidreq()); // Modify the default templates $renderer = $form->defaultRenderer(); $form_template = "<form {attributes}>\n<div class='create-groups'>\n<table>\n{content}\n</table>\n</div>\n</form>"; $renderer->setFormTemplate($form_template); $element_template = <<<EOT <tr class="separate"> <td> <!-- BEGIN required --> <span class="form_required">*</span> <!-- END required -->{label} </td> <td> <!-- BEGIN error --> <span class="form_error">{error}</span><br /><!-- END error --> {element} </td> </tr> EOT; $renderer->setCustomElementTemplate($element_template); $form->addElement('header', $nameTools); $form->addElement('hidden', 'action'); $form->addElement('hidden', 'number_of_groups'); $defaults = []; // Table heading $group_el = []; $group_el[] = $form->createElement('static', null, null, '<b>'.get_lang('GroupName').'</b>'); if (api_get_setting('allow_group_categories') === 'true') { $group_el[] = $form->createElement('static', null, null, '<b>'.get_lang('GroupCategory').'</b>'); } $group_el[] = $form->createElement('static', null, null, '<b>'.get_lang('GroupPlacesThis').'</b>'); $form->addGroup($group_el, 'groups', null, "</td><td>", false); // Checkboxes if ($_POST['number_of_groups'] > 1) { $group_el = []; $group_el[] = $form->createElement('static', null, null, ' '); if (api_get_setting('allow_group_categories') === 'true') { $group_el[] = $form->createElement( 'checkbox', 'same_category', null, get_lang('SameForAll'), ['onclick' => "javascript: switch_state('category');"] ); } $group_el[] = $form->createElement( 'checkbox', 'same_places', null, get_lang('SameForAll'), ['onclick' => "javascript: switch_state('places');"] ); $form->addGroup($group_el, 'groups', null, '</td><td>', false); } // Properties for all groups for ($group_number = 0; $group_number < $_POST['number_of_groups']; $group_number++) { $group_el = []; $group_el[] = $form->createElement('text', 'group_'.$group_number.'_name'); if (api_get_setting('allow_group_categories') === 'true') { $group_el[] = $form->createElement( 'select', 'group_'.$group_number.'_category', null, $cat_options, ['id' => 'category_'.$group_number] ); } else { $group_el[] = $form->createElement('hidden', 'group_'.$group_number.'_category', 0); $defaults['group_'.$group_number.'_category'] = array_keys($cat_options)[0]; } $group_el[] = $form->createElement( 'text', 'group_'.$group_number.'_places', null, ['class' => 'span1', 'id' => 'places_'.$group_number] ); if ($_POST['number_of_groups'] < 10000) { if ($group_id < 10) { $prev = '000'; } elseif ($group_id < 100) { $prev = '00'; } elseif ($group_id < 1000) { $prev = '0'; } else { $prev = ''; } } $defaults['group_'.$group_number.'_name'] = get_lang('GroupSingle').' '.$prev.$group_id++; $form->addGroup($group_el, 'group_'.$group_number, null, '</td><td>', false); } $defaults['action'] = 'create_groups'; $defaults['number_of_groups'] = (int) $_POST['number_of_groups']; $form->setDefaults($defaults); $form->addButtonCreate(get_lang('CreateGroup'), 'submit'); $form->display(); } } else { /* * Show form to generate new groups */ $create_groups_form = new FormValidator('create_groups', 'post', api_get_self().'?'.api_get_cidreq()); $create_groups_form->addElement('header', $nameTools); $create_groups_form->addText('number_of_groups', get_lang('NumberOfGroupsToCreate'), null, ['value' => '1']); $create_groups_form->addButton('submit', get_lang('ProceedToCreateGroup'), 'plus', 'primary'); $defaults = []; $defaults['number_of_groups'] = 1; $create_groups_form->setDefaults($defaults); $create_groups_form->display(); /* * Show form to generate subgroups */ if (api_get_setting('allow_group_categories') === 'true') { $groups = GroupManager::get_group_list(); if (!empty($groups)) { $base_group_options = []; foreach ($groups as $index => $group) { $number_of_students = GroupManager::number_of_students($group['id']); if ($number_of_students > 0) { $base_group_options[$group['id']] = $group['name'].' ('.$number_of_students.' '.get_lang('Users').')'; } } if (count($base_group_options) > 0) { $create_subgroups_form = new FormValidator( 'create_subgroups', 'post', api_get_self().'?'.api_get_cidreq() ); $create_subgroups_form->addElement('header', get_lang('CreateSubgroups')); $create_subgroups_form->addElement('html', get_lang('CreateSubgroupsInfo')); $create_subgroups_form->addElement('hidden', 'action'); $group_el = []; $group_el[] = $create_subgroups_form->createElement( 'static', null, null, get_lang('CreateNumberOfGroups') ); $group_el[] = $create_subgroups_form->createElement('text', 'number_of_groups', null, ['size' => 3]); $group_el[] = $create_subgroups_form->createElement('static', null, null, get_lang('WithUsersFrom')); $group_el[] = $create_subgroups_form->createElement('select', 'base_group', null, $base_group_options); $group_el[] = $create_subgroups_form->addButtonSave(get_lang('Ok'), 'submit', true); $create_subgroups_form->addGroup($group_el, 'create_groups', null, null, false); $defaults = []; $defaults['action'] = 'create_subgroups'; $create_subgroups_form->setDefaults($defaults); $create_subgroups_form->display(); } } } /* * Show form to generate groups from classes subscribed to the course */ if (empty($sessionId)) { $options['where'] = [' usergroup.course_id = ? ' => api_get_course_int_id()]; } else { $options['session_id'] = $sessionId; $options['where'] = [' usergroup.session_id = ? ' => $sessionId]; } $obj = new UserGroup(); $classes = $obj->getUserGroupInCourse($options); if (count($classes) > 0) { $description = '<p>'.get_lang('GroupsFromClassesInfo').'</p>'; $description .= '<ul>'; foreach ($classes as $index => $class) { $number_of_users = count($obj->get_users_by_usergroup($class['id'])); $description .= '<li>'; $description .= $class['name']; $description .= ' ('.$number_of_users.' '.get_lang('Users').')'; $description .= '</li>'; } $description .= '</ul>'; $classForm = new FormValidator( 'create_class_groups_form', 'post', api_get_self().'?'.api_get_cidreq() ); $classForm->addHeader(get_lang('GroupsFromClasses')); $classForm->addHtml($description); $classForm->addElement('hidden', 'action'); if (api_get_setting('allow_group_categories') === 'true') { $group_categories = GroupManager::get_categories(); $cat_options = []; foreach ($group_categories as $index => $category) { $cat_options[$category['id']] = $category['title']; } $classForm->addElement('select', 'group_category', null, $cat_options); } else { $classForm->addElement('hidden', 'group_category'); } $classForm->addButtonSave(get_lang('Ok')); $defaults['group_category'] = GroupManager::DEFAULT_GROUP_CATEGORY; $defaults['action'] = 'create_class_groups'; $classForm->setDefaults($defaults); $classForm->display(); } } Display::display_footer(); tutor_settings.php 0000644 00000015421 14710744420 0010360 0 ustar 00 <?php /* For licensing terms, see /license.txt */ /** * This script displays an area where teachers can edit the group properties and member list. * Groups are also often called "teams" in the Dokeos code. * * @author various contributors * @author Roan Embrechts (VUB), partial code cleanup, initial virtual course support * * @todo course admin functionality to create groups based on who is in which course (or class). */ require_once __DIR__.'/../inc/global.inc.php'; $this_section = SECTION_COURSES; $current_course_tool = TOOL_GROUP; // Notice for unauthorized people. api_protect_course_script(true); $group_id = api_get_group_id(); $current_group = GroupManager::get_group_properties($group_id); $nameTools = get_lang('EditGroup'); $interbreadcrumb[] = ['url' => 'group.php?'.api_get_cidreq(), 'name' => get_lang('Groups')]; $interbreadcrumb[] = ['url' => 'group_space.php?'.api_get_cidreq(), 'name' => $current_group['name']]; $is_group_member = GroupManager::is_tutor_of_group(api_get_user_id(), $current_group); if (!api_is_allowed_to_edit(false, true) && !$is_group_member) { api_not_allowed(true); } /** * Function to sort users after getting the list in the DB. * Necessary because there are 2 or 3 queries. Called by usort(). */ function sort_users($user_a, $user_b) { $orderListByOfficialCode = api_get_setting('order_user_list_by_official_code'); if ($orderListByOfficialCode === 'true') { $cmp = api_strcmp($user_a['official_code'], $user_b['official_code']); if ($cmp !== 0) { return $cmp; } else { $cmp = api_strcmp($user_a['lastname'], $user_b['lastname']); if ($cmp !== 0) { return $cmp; } else { return api_strcmp($user_a['username'], $user_b['username']); } } } if (api_sort_by_first_name()) { $cmp = api_strcmp($user_a['firstname'], $user_b['firstname']); if ($cmp !== 0) { return $cmp; } else { $cmp = api_strcmp($user_a['lastname'], $user_b['lastname']); if ($cmp !== 0) { return $cmp; } else { return api_strcmp($user_a['username'], $user_b['username']); } } } else { $cmp = api_strcmp($user_a['lastname'], $user_b['lastname']); if ($cmp !== 0) { return $cmp; } else { $cmp = api_strcmp($user_a['firstname'], $user_b['firstname']); if ($cmp !== 0) { return $cmp; } else { return api_strcmp($user_a['username'], $user_b['username']); } } } } $htmlHeadXtra[] = '<script> $(function() { $("#max_member").on("focus", function() { $("#max_member_selected").attr("checked", true); }); }); </script>'; // Build form $form = new FormValidator('group_edit', 'post', api_get_self().'?'.api_get_cidreq()); $form->addElement('hidden', 'action'); // Group tutors $group_tutor_list = GroupManager::get_subscribed_tutors($current_group); $selected_tutors = []; foreach ($group_tutor_list as $index => $user) { $selected_tutors[] = $user['user_id']; } $complete_user_list = CourseManager::get_user_list_from_course_code( api_get_course_id(), api_get_session_id() ); $possible_users = []; $userGroup = new UserGroup(); $subscribedUsers = GroupManager::get_subscribed_users($current_group); if ($subscribedUsers) { $subscribedUsers = array_column($subscribedUsers, 'user_id'); } $orderUserListByOfficialCode = api_get_setting('order_user_list_by_official_code'); if (!empty($complete_user_list)) { usort($complete_user_list, 'sort_users'); foreach ($complete_user_list as $index => $user) { if (in_array($user['user_id'], $subscribedUsers)) { continue; } //prevent invitee users add to groups or tutors - see #8091 if ($user['status'] != INVITEE) { $officialCode = !empty($user['official_code']) ? ' - '.$user['official_code'] : null; $groups = $userGroup->getUserGroupListByUser($user['user_id']); $groupNameListToString = ''; if (!empty($groups)) { $groupNameList = array_column($groups, 'name'); $groupNameListToString = ' - ['.implode(', ', $groupNameList).']'; } $name = api_get_person_name( $user['firstname'], $user['lastname'] ).' ('.$user['username'].')'.$officialCode; if ($orderUserListByOfficialCode === 'true') { $officialCode = !empty($user['official_code']) ? $user['official_code']." - " : '? - '; $name = $officialCode.' '.api_get_person_name( $user['firstname'], $user['lastname'] ).' ('.$user['username'].')'; } $possible_users[$user['user_id']] = $name.$groupNameListToString; } } } $group_tutors_element = $form->addElement( 'advmultiselect', 'group_tutors', get_lang('GroupTutors'), $possible_users, 'style="width: 280px;"' ); // submit button $form->addButtonSave(get_lang('SaveSettings')); if ($form->validate()) { $values = $form->exportValues(); // Storing the tutors (we first remove all the tutors and then add only those who were selected) GroupManager::unsubscribe_all_tutors($current_group['iid']); if (isset($_POST['group_tutors']) && count($_POST['group_tutors']) > 0) { GroupManager::subscribe_tutors($values['group_tutors'], $current_group); } // Returning to the group area (note: this is inconsistent with the rest of chamilo) $cat = GroupManager::get_category_from_group($current_group['iid']); if (isset($_POST['group_members']) && count($_POST['group_members']) > $max_member && $max_member != GroupManager::MEMBER_PER_GROUP_NO_LIMIT ) { Display::addFlash(Display::return_message(get_lang('GroupTooMuchMembers'), 'warning')); header('Location: group.php?'.api_get_cidreq(true, false)); } else { Display::addFlash(Display::return_message(get_lang('GroupSettingsModified'), 'success')); header('Location: group.php?'.api_get_cidreq(true, false).'&category='.$cat['id']); } exit; } $defaults = $current_group; $defaults['group_tutors'] = $selected_tutors; $action = isset($_GET['action']) ? $_GET['action'] : ''; $defaults['action'] = $action; if (!empty($_GET['keyword']) && !empty($_GET['submit'])) { $keyword_name = Security::remove_XSS($_GET['keyword']); echo '<br/>'.get_lang('SearchResultsFor').' <span style="font-style: italic ;"> '.$keyword_name.' </span><br>'; } Display::display_header($nameTools, 'Group'); $form->setDefaults($defaults); echo GroupManager::getSettingBar('tutor'); $form->display(); Display::display_footer(); index.html 0000644 00000000143 14710744420 0006542 0 ustar 00 <html> <head> <meta http-equiv="refresh" content="0; url=group.php"> </head> <body> </body> </html>