Bug #3646 and Issue #306 - Forums tool: Fixing person name order to be dependable on the internationalization settings, other minor corrections.

skala
Ivan Tcholakov 16 years ago
parent 6d283c34df
commit a130b1e0c0
  1. 4
      main/forum/editpost.php
  2. 14
      main/forum/forumfunction.inc.php
  3. 2
      main/forum/forumqualify.php
  4. 2
      main/forum/iframe_thread.php
  5. 2
      main/forum/index.php
  6. 4
      main/forum/reply.php
  7. 14
      main/forum/viewforum.php
  8. 2
      main/forum/viewforumcategory.php
  9. 2
      main/forum/viewpost.inc.php
  10. 2
      main/forum/viewthread_flat.inc.php
  11. 2
      main/forum/viewthread_nested.inc.php
  12. 2
      main/forum/viewthread_threaded.inc.php

@ -148,14 +148,14 @@ if (!empty($_SESSION['toolgroup'])) {
$interbreadcrumb[] = array ("url" => "../group/group.php", "name" => get_lang('Groups'));
$interbreadcrumb[] = array ("url"=>"../group/group_space.php?gidReq=".$_SESSION['toolgroup'], "name"=> get_lang('GroupSpace').' ('.$group_properties['name'].')');
$interbreadcrumb[] = array("url" => "viewforum.php?origin=".$origin."&gidReq=".$_SESSION['toolgroup']."&forum=".Security::remove_XSS($_GET['forum']),"name" => prepare4display($current_forum['forum_title']));
$interbreadcrumb[] = array("url" => "#","name" => get_lang('EditPost'));
$interbreadcrumb[] = array("url" => "javascript: void (0);","name" => get_lang('EditPost'));
} else {
$interbreadcrumb[]=array("url" => "index.php?gradebook=$gradebook","name" => $nameTools);
$interbreadcrumb[]=array("url" => "viewforumcategory.php?forumcategory=".$current_forum_category['cat_id'],"name" => prepare4display($current_forum_category['cat_title']));
$interbreadcrumb[]=array("url" => "viewforum.php?origin=".$origin."&forum=".Security::remove_XSS($_GET['forum']),"name" => prepare4display($current_forum['forum_title']));
$interbreadcrumb[]=array("url" => "viewthread.php?gradebook=$gradebook&origin=".$origin."&forum=".Security::remove_XSS($_GET['forum'])."&thread=".$_GET['thread'],"name" => prepare4display($current_thread['thread_title']));
$interbreadcrumb[]=array("url" => "#","name" => get_lang('EditPost'));
$interbreadcrumb[]=array("url" => "javascript: void (0);","name" => get_lang('EditPost'));
}
/*
-----------------------------------------------------------

@ -1985,7 +1985,7 @@ function show_add_post_form($action='', $id='', $form_values='') {
// When we are quoting a message then we have to put that message into the wysiwyg editor.
// note: the style has to be hardcoded here because using class="quote" didn't work
if($action=='quote') {
$defaults['post_text']='<div>&nbsp;</div><div style="margin: 5px;"><div style="font-size: 90%; font-style: italic;">'.get_lang('Quoting').' '.$values['firstname'].' '.$values['lastname'].':</div><div style="color: #006600; font-size: 90%; font-style: italic; background-color: #FAFAFA; border: #D1D7DC 1px solid; padding: 3px;">'.prepare4display($values['post_text']).'</div></div><div>&nbsp;</div><div>&nbsp;</div>';
$defaults['post_text']='<div>&nbsp;</div><div style="margin: 5px;"><div style="font-size: 90%; font-style: italic;">'.get_lang('Quoting').' '.api_get_person_name($values['firstname'], $values['lastname']).':</div><div style="color: #006600; font-size: 90%; font-style: italic; background-color: #FAFAFA; border: #D1D7DC 1px solid; padding: 3px;">'.prepare4display($values['post_text']).'</div></div><div>&nbsp;</div><div>&nbsp;</div>';
}
}
$form->setDefaults(isset($defaults)?$defaults:null);
@ -2925,7 +2925,7 @@ function send_mail($user_info=array(), $thread_information=array()) {
if (isset($thread_information) and is_array($thread_information)) {
$thread_link= api_get_path('WEB_CODE_PATH').'forum/viewthread.php?'.api_get_cidreq().'&forum='.$thread_information['forum_id'].'&thread='.$thread_information['thread_id'];
}
$email_body= $user_info['firstname']." ".$user_info['lastname']."\n\r";
$email_body = api_get_person_name($user_info['firstname'], $user_info['lastname'], null, PERSON_NAME_EMAIL_ADDRESS)."\n\r";
$email_body .= '['.$_course['official_code'].'] - ['.$_course['name']."]<br>\n";
$email_body .= get_lang('NewForumPost')."\n";
$email_body .= get_lang('YouWantedToStayInformed')."<br><br>\n";
@ -2938,7 +2938,7 @@ function send_mail($user_info=array(), $thread_information=array()) {
}
if ($user_info['user_id']<>$_user['user_id']) {
$newmail = api_mail_html($user_info["lastname"].' '.$user_info["firstname"], $user_info["email"], $email_subject, $email_body, $_SESSION['_user']['lastName'].' '.$_SESSION['_user']['firstName'], $_SESSION['_user']['mail']);
$newmail = api_mail_html(api_get_person_name($user_info['firstname'], $user_info['lastname'], null, PERSON_NAME_EMAIL_ADDRESS), $user_info['email'], $email_subject, $email_body, api_get_person_name($_SESSION['_user']['firstName'], $_SESSION['_user']['lastName'], null, PERSON_NAME_EMAIL_ADDRESS), $_SESSION['_user']['mail']);
}
}
@ -3695,7 +3695,7 @@ function send_notifications($forum_id=0, $thread_id=0, $post_id=0) {
if (is_array($users_to_be_notified)) {
foreach ($users_to_be_notified as $key=>$value) {
if ($value['email'] <> $_user['email']) {
$email_body= $value['firstname']." ".$value['lastname']."\n\r";
$email_body = api_get_person_name($value['firstname'], $value['lastname'], null, PERSON_NAME_EMAIL_ADDRESS)."\n\r";
$email_body .= '['.$_course['official_code'].'] - ['.$_course['name']."]<br>\n";
$email_body .= get_lang('NewForumPost')."\n";
$email_body .= get_lang('YouWantedToStayInformed')."<br><br>\n";
@ -3707,7 +3707,7 @@ function send_notifications($forum_id=0, $thread_id=0, $post_id=0) {
$charset='ISO-8859-1';
}
$newmail = api_mail_html($value['lastname'].' '.$value['firstname'], $value['email'], $email_subject, $email_body, $_SESSION['_user']['lastName'].' '.$_SESSION['_user']['firstName'], $_SESSION['_user']['mail']);
$newmail = api_mail_html(api_get_person_name($value['firstname'], $value['lastname'], null, PERSON_NAME_EMAIL_ADDRESS), $value['email'], $email_subject, $email_body, api_get_person_name($_SESSION['_user']['firstName'], $_SESSION['_user']['lastName'], null, PERSON_NAME_EMAIL_ADDRESS), $_SESSION['_user']['mail']);
}
}
}
@ -3866,10 +3866,10 @@ function get_thread_user_post($course_db, $thread_id, $user_id )
*/
function get_name_user_by_id($user_id) {
$t_users = Database :: get_main_table(TABLE_MAIN_USER);
$sql ="SELECT CONCAT(firstname,' ',lastname) FROM ".$t_users." WHERE user_id = '".$user_id."' ";
$sql = "SELECT firstname, lastname FROM ".$t_users." WHERE user_id = '".$user_id."' ";
$result = api_sql_query($sql, __FILE__, __LINE__);
$row = Database::fetch_array($result);
return $row[0];
return api_get_person_name($row[0], $row[1]);
}
/** This function get the name of an thread by id

@ -313,7 +313,7 @@ if ($allowed_to_edit) {
for($i=0;$i<count($qualify_historic);$i++) {
$my_user_info=api_get_user_info($qualify_historic[$i]['qualify_user_id']);
$name = $my_user_info['firstName']." ".$my_user_info['lastName'];
$name = api_get_person_name($my_user_info['firstName'], $my_user_info['lastName']);
$table_list.= '<tr class="'.$class.'"><td>'.$name.'</td>';
$table_list.= '<td>'.$qualify_historic[$i]['qualify'].'</td>';
$table_list.= '<td>'.$qualify_historic[$i]['qualify_time'].'</td></tr>';

@ -150,7 +150,7 @@ while ($row=Database::fetch_array($result)) {
if ($row['user_id']=='0') {
$name=$row['poster_name'];
} else {
$name=$row['firstname'].' '.$row['lastname'];
$name=api_get_person_name($row['firstname'], $row['lastname']);
}
echo $name.'<br />';
echo $row['post_date'].'<br /><br />';

@ -408,7 +408,7 @@ if (isset($_GET['action']) && $_GET['action'] == 'notify' AND isset($_GET['conte
$name=$forum['last_poster_name'];
$poster_id=0;
} else {
$name=$forum['last_poster_firstname'].' '.$forum['last_poster_lastname'];
$name = api_get_person_name($forum['last_poster_firstname'], $forum['last_poster_lastname']);
$poster_id=$forum['last_poster_id'];
}
echo "\t\t<td nowrap=\"nowrap\">";

@ -129,14 +129,14 @@ if (!empty($_SESSION['toolgroup'])) {
$interbreadcrumb[] = array ("url" => "../group/group_space.php?gidReq=".$_SESSION['toolgroup'], "name"=> get_lang('GroupSpace').' ('.$group_properties['name'].')');
$interbreadcrumb[]=array("url" => "viewforum.php?origin=".$origin."&forum=".Security::remove_XSS($_GET['forum']),"name" => $current_forum['forum_title']);
$interbreadcrumb[]=array("url" => "viewthread.php?origin=".$origin."&gradebook=".$gradebook."&forum=".Security::remove_XSS($_GET['forum'])."&amp;thread=".Security::remove_XSS($_GET['thread']),"name" => $current_thread['thread_title']);
$interbreadcrumb[]=array("url" => "#","name" => get_lang('Reply'));
$interbreadcrumb[]=array("url" => "javascript: void(0);","name" => get_lang('Reply'));
} else {
$interbreadcrumb[]=array("url" => "index.php?gradebook=$gradebook","name" => $nameTools);
$interbreadcrumb[]=array("url" => "viewforumcategory.php?forumcategory=".$current_forum_category['cat_id'],"name" => $current_forum_category['cat_title']);
$interbreadcrumb[]=array("url" => "viewforum.php?origin=".$origin."&forum=".Security::remove_XSS($_GET['forum']),"name" => $current_forum['forum_title']);
$interbreadcrumb[]=array("url" => "viewthread.php?origin=".$origin."&gradebook=".$gradebook."&forum=".Security::remove_XSS($_GET['forum'])."&amp;thread=".Security::remove_XSS($_GET['thread']),"name" => $current_thread['thread_title']);
$interbreadcrumb[]=array("url" => "#","name" => get_lang('Reply'));
$interbreadcrumb[]=array("url" => "javascript: void(0);","name" => get_lang('Reply'));
}
/*
-----------------------------------------------------------

@ -254,7 +254,7 @@ if ($my_action == 'liststd' AND isset($_GET['content']) AND isset($_GET['id']) A
} else {
$class_stdlist="row_even";
}
$name_user_theme = $row_student_list['firstname'].' '.$row_student_list['lastname'];
$name_user_theme = api_get_person_name($row_student_list['firstname'], $row_student_list['lastname']);
$table_list.= '<tr class="$class_stdlist"><td><a href="../user/userInfo.php?uInfo='.$row_student_list['user_id'].'&tipo=sdtlist&'.api_get_cidreq().'&forum='.Security::remove_XSS($my_forum).$origin_string.'">'.$name_user_theme.'</a></td>';
if ($_GET['list']=='qualify') {
$table_list.= '<td>'.$row_student_list['qualify'].'/'.$max_qualify.'</td>';
@ -410,19 +410,19 @@ if(is_array($threads)) {
if ($row['user_id']=='0') {
$name=prepare4display($row['thread_poster_name']);
} else {
$name=$row['firstname'].' '.$row['lastname'];
$name=api_get_person_name($row['firstname'], $row['lastname']);
}
echo "\t\t<td>".$row['thread_views']."</td>\n";
if ($row['last_poster_user_id']=='0') {
$name=$row['poster_name'];
} else {
$name=$row['last_poster_firstname'].' '.$row['last_poster_lastname'];
$name=api_get_person_name($row['last_poster_firstname'], $row['last_poster_lastname']);
}
if($origin != 'learnpath') {
echo "\t\t<td>".display_user_link($row['user_id'], $row['firstname'].' '.$row['lastname'])."</td>\n";
echo "\t\t<td>".display_user_link($row['user_id'], api_get_person_name($row['firstname'], $row['lastname']))."</td>\n";
} else {
echo "\t\t<td>".$row['firstname'].' '.$row['lastname']."</td>\n";
echo "\t\t<td>".api_get_person_name($row['firstname'], $row['lastname'])."</td>\n";
}
// if the last post is invisible and it is not the teacher who is looking then we have to find the last visible post of the thread
@ -432,13 +432,13 @@ if(is_array($threads)) {
$last_post_sql="SELECT post.*, user.firstname, user.lastname FROM $table_posts post, $table_users user WHERE post.poster_id=user.user_id AND visible='1' AND thread_id='".$row['thread_id']."' ORDER BY post_id DESC";
$last_post_result=api_sql_query($last_post_sql, __FILE__, __LINE__);
$last_post_row=Database::fetch_array($last_post_result);
$name=$last_post_row['firstname'].' '.$last_post_row['lastname'];
$name=api_get_person_name($last_post_row['firstname'], $last_post_row['lastname']);
$last_post=$last_post_row['post_date']." ".get_lang('By').' '.display_user_link($last_post_row['poster_id'], $name);
} else {
$last_post_sql="SELECT post.*, user.firstname, user.lastname FROM $table_posts post, $table_users user WHERE post.poster_id=user.user_id AND visible='1' AND thread_id='".$row['thread_id']."' ORDER BY post_id DESC";
$last_post_result=api_sql_query($last_post_sql, __FILE__, __LINE__);
$last_post_row=Database::fetch_array($last_post_result);
$name=$last_post_row['firstname'].' '.$last_post_row['lastname'];
$name=api_get_person_name($last_post_row['firstname'], $last_post_row['lastname']);
$last_post=$last_post_row['post_date']." ".get_lang('By').' '.$name;
}
echo "\t\t<td>".$last_post."</td>\n";

@ -364,7 +364,7 @@ if ($action_forums!='add') {
$name=$forum['last_poster_name'];
$poster_id=0;
} else {
$name=$forum['last_poster_firstname'].' '.$forum['last_poster_lastname'];
$name=api_get_person_name($forum['last_poster_firstname'], $forum['last_poster_lastname']);
$poster_id=$forum['last_poster_id'];
}
echo "\t\t<td>";

@ -41,7 +41,7 @@ if(isset($rows)){
if ($row['user_id']=='0') {
$name=prepare4display($row['poster_name']);
} else {
$name=$row['firstname'].' '.$row['lastname'];
$name=api_get_person_name($row['firstname'], $row['lastname']);
}
if($sw === true) {
echo "<div style=\"border: 1px solid #000000; padding: 4px 0px 0px 4px; margin-top:5px;\" > <h3> $name </h3> </div>";

@ -50,7 +50,7 @@ foreach ($rows as $row) {
if ($row['user_id']=='0') {
$name=prepare4display($row['poster_name']);
} else {
$name=$row['firstname'].' '.$row['lastname'];
$name=api_get_person_name($row['firstname'], $row['lastname']);
}
if($origin!='learnpath') {
if (api_get_course_setting('allow_user_image_forum')) {

@ -63,7 +63,7 @@ foreach ($rows as $post) {
if ($post['user_id']=='0') {
$name=$post['poster_name'];
} else {
$name=$post['firstname'].' '.$post['lastname'];
$name=api_get_person_name($post['firstname'], $post['lastname']);
}
if (api_get_course_setting('allow_user_image_forum')) {
echo '<br />'.display_user_image($post['user_id'],$name,$origin).'<br />';

@ -212,7 +212,7 @@ if ($rows[$display_post_id]['user_id']=='0')
}
else
{
$name=$rows[$display_post_id]['firstname'].' '.$rows[$display_post_id]['lastname'];
$name=api_get_person_name($rows[$display_post_id]['firstname'], $rows[$display_post_id]['lastname']);
}
if (api_get_course_setting('allow_user_image_forum')) {echo '<br />'.display_user_image($rows[$display_post_id]['user_id'],$name, $origin).'<br />'; }
echo display_user_link($rows[$display_post_id]['user_id'], $name, $origin).'<br />';

Loading…
Cancel
Save