Fixing user name order

skala
Julio Montoya 13 years ago
parent a94cac7509
commit 8a2b4a48c1
  1. 18
      main/calendar/agenda.inc.php
  2. 2
      main/calendar/agenda.lib.php
  3. 7
      main/calendar/agenda_js.php

@ -937,8 +937,16 @@ function get_course_groups() {
* @return html code
*/
function show_to_form($to_already_selected) {
$user_list = get_course_users();
$group_list = get_course_groups();
/*$user_list = get_course_users();
$group_list = get_course_groups();*/
$order = 'lastname';
if (api_is_western_name_order) {
$order = 'firstname';
}
$user_list = CourseManager::get_user_list_from_course_code(api_get_course_id(), api_get_session_id(), null, $order);
$group_list = CourseManager::get_group_list_of_course(api_get_course_id(), api_get_session_id());
construct_not_selected_select_form($group_list, $user_list, $to_already_selected);
}
@ -976,10 +984,10 @@ function construct_not_selected_select_form($group_list=null, $user_list=null, $
echo '<optgroup label="'.get_lang('Users').'">';
foreach($user_list as $this_user) {
// $to_already_selected is the array containing the users (and groups) that are already selected
if (!is_array($to_already_selected) || !in_array("USER:".$this_user['uid'],$to_already_selected)) {
if (!is_array($to_already_selected) || !in_array("USER:".$this_user['user_id'],$to_already_selected)) {
$username = api_htmlentities(sprintf(get_lang('LoginX'), $this_user['username']), ENT_QUOTES);
$user_info = api_get_person_name($this_user['firstName'], $this_user['lastName']).' ('.$this_user['username'].')';
echo "<option title='$username' value='USER:".$this_user['uid']."'>$user_info</option>";
$user_info = api_get_person_name($this_user['firstname'], $this_user['lastname']).' ('.$this_user['username'].')';
echo "<option title='$username' value='USER:".$this_user['user_id']."'>$user_info</option>";
}
}
echo "</optgroup>";

@ -682,7 +682,7 @@ class Agenda {
if (is_array($group_list)) {
$html .= '<optgroup label="'.get_lang('Users').'">';
}
foreach($user_list as $this_user) {
foreach ($user_list as $this_user) {
// $to_already_selected is the array containing the users (and groups) that are already selected
if (!is_array($to_already_selected) || !in_array("USER:".$this_user['user_id'],$to_already_selected)) {
$username = api_htmlentities(sprintf(get_lang('LoginX'), $this_user['username']), ENT_QUOTES);

@ -96,8 +96,11 @@ $course_code = api_get_course_id();
if (api_is_allowed_to_edit() && $course_code != '-1' && $type == 'course') {
$user_list = CourseManager::get_user_list_from_course_code(api_get_course_id());
$order = 'lastname';
if (api_is_western_name_order) {
$order = 'firstname';
}
$user_list = CourseManager::get_user_list_from_course_code(api_get_course_id(), api_get_session_id(), null, $order);
$group_list = CourseManager::get_group_list_of_course(api_get_course_id(), api_get_session_id());
$agenda = new Agenda();

Loading…
Cancel
Save