From a7183282962fa95b30d6540013060a057cd79982 Mon Sep 17 00:00:00 2001 From: Hubert Borderiou Date: Tue, 10 Jan 2012 09:57:33 +0100 Subject: [PATCH] Add username after firstname-lastname to avoid homonymous for wiki -ref #4030 --- main/wiki/index.php | 22 +++++++++++----------- main/wiki/wiki.inc.php | 9 ++++----- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/main/wiki/index.php b/main/wiki/index.php index 0f866828bc..2beef548f5 100644 --- a/main/wiki/index.php +++ b/main/wiki/index.php @@ -280,7 +280,7 @@ if ($_GET['view']) { $userinfo=Database::get_user_info_from_id($last_row['is_editing']); - $is_being_edited= get_lang('ThisPageisBeginEditedBy').' '.api_get_person_name($userinfo['firstname'], $userinfo['lastname']).'. '.get_lang('ThisPageisBeginEditedTryLater').' '.date( "i",$rest_time).' '.get_lang('MinMinutes').''; + $is_being_edited= get_lang('ThisPageisBeginEditedBy').' '.api_get_person_name($userinfo['firstname'], $userinfo['lastname']).' ('.$userinfo['username'].'). '.get_lang('ThisPageisBeginEditedTryLater').' '.date( "i",$rest_time).' '.get_lang('MinMinutes').''; Display::display_normal_message($is_being_edited, false); } else { @@ -1008,7 +1008,7 @@ if ($_GET['action']=='mactiveusers') { $userinfo=Database::get_user_info_from_id($obj->user_id); $row = array (); - $row[] = $obj->user_id <>0 ? ''.api_htmlentities(api_get_person_name($userinfo['firstname'], $userinfo['lastname'])).'' : get_lang('Anonymous').' ('.$obj->user_ip.')'; + $row[] = $obj->user_id <>0 ? ''.api_htmlentities(api_get_person_name($userinfo['firstname'], $userinfo['lastname'])).' ('.$userinfo['username'].')' : get_lang('Anonymous').' ('.$obj->user_ip.')'; $row[] =''.$obj->NUM_EDIT.''; $rows[] = $row; } @@ -1026,7 +1026,7 @@ if ($_GET['action']=='mactiveusers') { if ($_GET['action']=='usercontrib') { $userinfo=Database::get_user_info_from_id($_GET['user_id']); - echo '
'.get_lang('UserContributions').': '.api_htmlentities(api_get_person_name($userinfo['firstname'], $userinfo['lastname'])).'
'; + echo '
'.get_lang('UserContributions').': '.api_htmlentities(api_get_person_name($userinfo['firstname'], $userinfo['lastname'])).' ('.$userinfo['username'].')
'; if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) { //only by professors if page is hidden @@ -1558,7 +1558,7 @@ if ($_GET['action']=='links') { $row = array (); $row[] =$ShowAssignment; $row[] = ''.api_htmlentities($obj->title).''; - $row[] = $obj->user_id <>0 ? ''.api_htmlentities(api_get_person_name($userinfo['firstname'], $userinfo['lastname'])).'' : get_lang('Anonymous').' ('.$obj->user_ip.')'; + $row[] = $obj->user_id <>0 ? ''.api_htmlentities(api_get_person_name($userinfo['firstname'], $userinfo['lastname'])).' ('.$userinfo['username'].')' : get_lang('Anonymous').' ('.$obj->user_ip.')'; $row[] = $year.'-'.$month.'-'.$day.' '.$hours.":".$minutes.":".$seconds; $rows[] = $row; } @@ -1810,7 +1810,7 @@ if ($_GET['action']=='edit') { $userinfo=Database::get_user_info_from_id($row['is_editing']); - $is_being_edited= get_lang('ThisPageisBeginEditedBy').' '.api_htmlentities(api_get_person_name($userinfo['firstname'], $userinfo['lastname'])).'. '.get_lang('ThisPageisBeginEditedTryLater').' '.date( "i",$rest_time).' '.get_lang('MinMinutes').''; + $is_being_edited= get_lang('ThisPageisBeginEditedBy').' '.api_htmlentities(api_get_person_name($userinfo['firstname'], $userinfo['lastname'])).' ('.$userinfo['username'].'). '.get_lang('ThisPageisBeginEditedTryLater').' '.date( "i",$rest_time).' '.get_lang('MinMinutes').''; Display::display_normal_message($is_being_edited, false); exit; } @@ -2076,7 +2076,7 @@ if ($_GET['action']=='history' or $_POST['HistoryDifferences']) { echo ' ('.get_lang('Version').' '.$row['version'].')'; echo ' '.get_lang('By').' '; if ($row['user_id']<>0) { - echo ''.api_htmlentities(api_get_person_name($userinfo['firstname'], $userinfo['lastname'])).''; + echo ''.api_htmlentities(api_get_person_name($userinfo['firstname'], $userinfo['lastname'])).' ('.$userinfo['username'].')'; } else { echo get_lang('Anonymous').' ('.api_htmlentities($row[user_ip]).')'; } @@ -2235,7 +2235,7 @@ if ($_GET['action']=='recentchanges') { $row[] = $ShowAssignment.$icon_task; $row[] = ''.api_htmlentities($obj->title).''; $row[] = $obj->version>1 ? get_lang('EditedBy') : get_lang('AddedBy'); - $row[] = $obj->user_id <> 0 ? ''.api_htmlentities(api_get_person_name($userinfo['firstname'], $userinfo['lastname'])).'' : get_lang('Anonymous').' ('.api_htmlentities($obj->user_ip).')'; + $row[] = $obj->user_id <> 0 ? ''.api_htmlentities(api_get_person_name($userinfo['firstname'], $userinfo['lastname'])).' ('.$userinfo['username'].')' : get_lang('Anonymous').' ('.api_htmlentities($obj->user_ip).')'; $rows[] = $row; } @@ -2300,7 +2300,7 @@ if ($_GET['action']=='allpages') { $row = array (); $row[] =$ShowAssignment.$icon_task; $row[] = ''.api_htmlentities($obj->title).''; - $row[] = $obj->user_id <>0 ? ''.api_htmlentities(api_get_person_name($userinfo['firstname'], $userinfo['lastname'])).'' : get_lang('Anonymous').' ('.api_htmlentities($obj->user_ip).')'; + $row[] = $obj->user_id <>0 ? ''.api_htmlentities(api_get_person_name($userinfo['firstname'], $userinfo['lastname'])).' ('.$userinfo['username'].')' : get_lang('Anonymous').' ('.api_htmlentities($obj->user_ip).')'; $row[] = api_get_local_time($obj->dtime, null, date_default_timezone_get()); if (api_is_allowed_to_edit(false,true)|| api_is_platform_admin()) { @@ -2431,7 +2431,7 @@ if ($_GET['action']=='discuss') { echo $icon_assignment.'   '.api_htmlentities($row['title']); - echo ' ('.get_lang('MostRecentVersionBy').' '.api_htmlentities(api_get_person_name($lastuserinfo['firstname'], $lastuserinfo['lastname'])).' '.$lastversiondate.$countWPost.')'.$avg_WPost_score.' '; //TODO: read average score + echo ' ('.get_lang('MostRecentVersionBy').' '.api_htmlentities(api_get_person_name($lastuserinfo['firstname'], $lastuserinfo['lastname'])).' ('.$lastuserinfo['username'].') '.$lastversiondate.$countWPost.')'.$avg_WPost_score.' '; //TODO: read average score echo ''; @@ -2536,7 +2536,7 @@ if ($_GET['action']=='discuss') { } $user_id=$row['userc_id']; - $name = api_get_person_name($userinfo['firstname'], $userinfo['lastname']); + $name = api_get_person_name($userinfo['firstname'], $userinfo['lastname']).' ('.$userinfo['username'].')'; $attrb=array(); if ($user_id<>0) { $image_path = UserManager::get_user_picture_path_by_id($user_id,'web',false, true); @@ -2588,7 +2588,7 @@ if ($_GET['action']=='discuss') { echo '

'; echo ''; echo ''; - echo ''; + echo ''; echo ''; echo ''; echo ''; diff --git a/main/wiki/wiki.inc.php b/main/wiki/wiki.inc.php index a057ced656..ba8b114ac3 100644 --- a/main/wiki/wiki.inc.php +++ b/main/wiki/wiki.inc.php @@ -1870,7 +1870,7 @@ function auto_add_page_users($assignment_type) { //data about teacher $userinfo=Database::get_user_info_from_id(api_get_user_id()); - $name = api_get_person_name($userinfo['firstname'], $userinfo['lastname']); + $name = api_get_person_name($userinfo['firstname'], $userinfo['lastname']).' ('.$userinfo['username'].')'; if (api_get_user_id()<>0) { $image_path = UserManager::get_user_picture_path_by_id(api_get_user_id(),'web',false, true); $image_repository = $image_path['dir']; @@ -1889,7 +1889,7 @@ function auto_add_page_users($assignment_type) { //first: teacher name, photo, and assignment description (original content) // $content_orig_A='
'.$photo.'
'.api_get_person_name($userinfo['firstname'], $userinfo['lastname']).'
('.get_lang('Teacher').')

'; - $content_orig_A='
'.$author_photo.''.api_htmlentities(api_get_person_name($userinfo['firstname'], $userinfo['lastname'])).' ('.$author_status.') '.api_get_local_time($row['dtime'], null, date_default_timezone_get()).' - '.get_lang('Rating').': '.$row['p_score'].' '.$imagerating.' '.api_htmlentities(api_get_person_name($userinfo['firstname'], $userinfo['lastname'])).' ('.$userinfo['username'].') ('.$author_status.') '.api_get_local_time($row['dtime'], null, date_default_timezone_get()).' - '.get_lang('Rating').': '.$row['p_score'].' '.$imagerating.'
'.api_htmlentities($row['comment']).'
'.get_lang('AssignmentDesc').'
'.$photo.'
'.api_get_person_name($userinfo['firstname'], $userinfo['lastname']).'
'; + $content_orig_A='

'.get_lang('AssignmentDesc').'
'.$photo.'
'.api_get_person_name($userinfo['firstname'], $userinfo['lastname']).' ('.$userinfo['username'].')
'; $content_orig_B='
'.get_lang('AssignmentDescription').': '.$title_orig.'

'.$_POST['content']; @@ -1905,7 +1905,7 @@ function auto_add_page_users($assignment_type) { $image_path = UserManager::get_user_picture_path_by_id($assig_user_id,'web',false, true); $image_repository = $image_path['dir']; $existing_image = $image_path['file']; - $name = api_get_person_name($o_user_to_add['firstname'], $o_user_to_add['lastname']); + $name = api_get_person_name($o_user_to_add['firstname'], $o_user_to_add['lastname']).' ('.$o_user_to_add['username'].')'; $photo= ''.$name.''; $is_tutor_of_group = GroupManager :: is_tutor_of_group($assig_user_id,$_clean['group_id']); //student is tutor @@ -1935,7 +1935,7 @@ function auto_add_page_users($assignment_type) { $_POST['content']='
'.get_lang('AssignmentWork').'
'.$photo.'
'.$name.'
[['.$link2teacher.' | '.get_lang('AssignmentLinktoTeacherPage').']] '; //If $content_orig_B is added here, the task written by the professor was copied to the page of each student. TODO: config options //AssignmentLinktoTeacherPage - $all_students_pages[] = '
  • '.strtoupper($o_user_to_add['lastname']).', '.$o_user_to_add['firstname'].' [['.$_POST['title']."_uass".$assig_user_id.' | '.$photo.']] '.$status_in_group.'
  • '; //don't change this line without guaranteeing that users will be ordered by last names in the following format (surname, name) + $all_students_pages[] = '
  • '.strtoupper($o_user_to_add['lastname']).', '.$o_user_to_add['firstname'].' ('.$o_user_to_add['username'].') [['.$_POST['title']."_uass".$assig_user_id.' | '.$photo.']] '.$status_in_group.'
  • '; //don't change this line without guaranteeing that users will be ordered by last names in the following format (surname, name) //$all_students_pages[] = '
  • '.api_get_person_name($o_user_to_add['lastname'], $o_user_to_add['firstname']).'[['.$_POST['title']."_uass".$assig_user_id.' | '.$photo.']] '.$status_in_group.'
  • '; @@ -1947,7 +1947,6 @@ function auto_add_page_users($assignment_type) { }//end foreach for each user - foreach($a_users_to_add as $user_id=>$o_user_to_add) {