Add username as tooltip in forum - ref #4226

skala
Hubert Borderiou 14 years ago
parent f822e12f70
commit 7c85080985
  1. 5
      main/forum/forumfunction.inc.php
  2. 4
      main/forum/iframe_thread.php
  3. 6
      main/forum/index.php
  4. 18
      main/forum/viewforum.php
  5. 6
      main/forum/viewthread_flat.inc.php
  6. 4
      main/forum/viewthread_nested.inc.php
  7. 4
      main/forum/viewthread_threaded.inc.php

@ -2678,14 +2678,15 @@ function store_edit_post($values) {
* This function displays the firstname and lastname of the user as a link to the user tool.
*
* @param string names
* @ in_title : title tootip
* @return string HTML
*
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
* @version february 2006, dokeos 1.8
*/
function display_user_link($user_id, $name, $origin = '') {
function display_user_link($user_id, $name, $origin = '', $in_title = '') {
if ($user_id != 0) {
return '<a href="../user/userInfo.php?uInfo='.$user_id.'" '. (!empty($origin)? 'target="_self"': '') .'>'.$name.'</a>';
return '<a title="'.api_htmlentities($in_title, ENT_QUOTES).'" href="../user/userInfo.php?uInfo='.$user_id.'" '. (!empty($origin)? 'target="_self"': '') .'>'.$name.'</a>';
} else {
return $name.' ('.get_lang('Anonymous').')';
}

@ -105,13 +105,13 @@ echo "<table width=\"100%\" cellspacing=\"5\" border=\"0\">";
while ($row = Database::fetch_array($result)) {
echo "<tr>";
echo "<td rowspan=\"2\" class=\"forum_message_left\">";
$username = $row['username'];
$username = api_htmlentities(sprintf(get_lang('LoginX'), $row['username']), ENT_QUOTES);
if ($row['user_id']=='0') {
$name = $row['poster_name'];
} else {
$name = api_get_person_name($row['firstname'], $row['lastname']);
}
echo $name." ($username)<br />";
echo Display::tag('span', $name, array('title'=>$username)).'<br />";
echo api_convert_and_format_date($row['post_date']).'<br /><br />';
echo "</td>";

@ -401,13 +401,13 @@ if (is_array($forum_categories_list)) {
} else {
$name = api_get_person_name($forum['last_poster_firstname'], $forum['last_poster_lastname']);
$poster_id = $forum['last_poster_id'];
$userinfo = api_get_user_info($poster_id); //
$username = " (".$userinfo['username'].")"; //
$userinfo = api_get_user_info($poster_id);
$username = sprintf(get_lang('LoginX'), $userinfo['username']);
}
echo '<td nowrap="nowrap">';
if (!empty($forum['last_post_id'])) {
echo api_convert_and_format_date($forum['last_post_date']).'<br /> '.get_lang('By').' '.display_user_link($poster_id, $name.$username); //
echo api_convert_and_format_date($forum['last_post_date']).'<br /> '.get_lang('By').' '.display_user_link($poster_id, $name, '', $username);
}
echo '</td>';
echo '<td nowrap="nowrap" align="center">';

@ -377,11 +377,11 @@ if (is_array($threads)) {
echo '<td>'.$row['thread_views'].'</td>';
// display the author name
$tab_poster_info = api_get_user_info($row['user_id']);
$poster_username = " (".$tab_poster_info['username'].")";
$poster_username = sprintf(get_lang('LoginX'), $tab_poster_info['username']);
if ($origin != 'learnpath') {
echo '<td>'.display_user_link($row['user_id'], api_get_person_name($row['firstname'], $row['lastname']).$poster_username).'</td>';
echo '<td>'.display_user_link($row['user_id'], api_get_person_name($row['firstname'], $row['lastname']), '', $poster_username).'</td>';
} else {
echo '<td>'.api_get_person_name($row['firstname'], $row['lastname']).'$poster_username</td>';
echo '<td>'.Display::tag('span', api_get_person_name($row['firstname'], $row['lastname']), array("title"=>api_htmlentities($poster_username, ENT_QUOTES))).'</td>';
}
// display the last post name
// if ($row['user_id'] == '0') {
@ -396,25 +396,25 @@ if (is_array($threads)) {
} else {
$name = api_get_person_name($row['last_poster_firstname'], $row['last_poster_lastname']);
$tab_last_poster_info = api_get_user_info($row['last_poster_user_id']);
$last_poster_username = " (".$tab_last_poster_info['username'].")";
$last_poster_username = sprintf(get_lang('LoginX'), $tab_last_poster_info['username']);
}
// 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.
if (($row['visible'] == '1' OR api_is_allowed_to_edit(false, true)) && $origin != 'learnpath') {
$last_post = api_convert_and_format_date($row['thread_date']).' '.get_lang('By').' '.display_user_link($row['last_poster_user_id'], $name.$last_poster_username);
$last_post = api_convert_and_format_date($row['thread_date']).' '.get_lang('By').' '.display_user_link($row['last_poster_user_id'], $name, '', $last_poster_username);
} elseif ($origin != 'learnpath') {
$last_post_sql = "SELECT post.*, user.firstname, user.lastname, user.username FROM $table_posts post, $table_users user WHERE post.poster_id=user.user_id AND visible='1' AND thread_id='".$row['thread_id']."' AND post.c_id=".api_get_course_int_id()." ORDER BY post_id DESC";
$last_post_result = Database::query($last_post_sql);
$last_post_row = Database::fetch_array($last_post_result);
$name = api_get_person_name($last_post_row['firstname'], $last_post_row['lastname']);
$last_post_info_username = " (".$last_post_row['username'].")";
$last_post = api_convert_and_format_date($last_post_row['post_date']).' '.get_lang('By').' '.display_user_link($last_post_row['poster_id'], $name.$last_post_info_username);
$last_post_info_username = sprintf(get_lang('LoginX'), $last_post_row['username']);
$last_post = api_convert_and_format_date($last_post_row['post_date']).' '.get_lang('By').' '.display_user_link($last_post_row['poster_id'], $name, '', $last_post_info_username);
} else {
$last_post_sql = "SELECT post.*, user.firstname, user.lastname, user.username FROM $table_posts post, $table_users user WHERE post.poster_id=user.user_id AND visible='1' AND thread_id='".$row['thread_id']."' AND post.c_id=".api_get_course_int_id()." ORDER BY post_id DESC";
$last_post_result = Database::query($last_post_sql);
$last_post_row = Database::fetch_array($last_post_result);
$last_post_info_username = " (".$last_post_row['username'].")";
$last_post_info_username = sprintf(get_lang('LoginX'), $last_post_row['username']);
$name = api_get_person_name($last_post_row['firstname'], $last_post_row['lastname']);
$last_post = api_convert_and_format_date($last_post_row['post_date']).' '.get_lang('By').' '.$name.$last_post_info_username;
$last_post = api_convert_and_format_date($last_post_row['post_date']).' '.get_lang('By').' '.Display::tag('span', $name, array("title"=>api_htmlentities($last_post_info_username, ENT_QUOTES)));
}
echo '<td>'.$last_post.'</td>';

@ -38,15 +38,15 @@ if (isset($current_thread['thread_id'])){
} else {
$name = api_get_person_name($row['firstname'], $row['lastname']);
}
$username = $row['username']; //
$username = sprintf(get_lang('LoginX'), $row['username']);
if ($origin!='learnpath') {
if (api_get_course_setting('allow_user_image_forum')) {
echo '<br />'.display_user_image($row['user_id'],$name).'<br />';
}
echo display_user_link($row['user_id'], $name." ($username)").'<br />';
echo display_user_link($row['user_id'], $name, '', $username).'<br />';
} else {
echo $name. ' ('.$username.')<br />';
echo Display::tag('span', $name, array('title'=>api_htmlentities($username, ENT_QUOTES))).'<br />';
}
$group_id = api_get_group_id();

@ -48,7 +48,7 @@ foreach ($rows as $post) {
echo "<tr>";
echo "<td rowspan=\"3\" class=\"$leftclass\">";
$username = $post['username']; //
$username = sprintf(get_lang('LoginX'), $post['username']);
if ($post['user_id']=='0') {
$name=$post['poster_name'];
} else {
@ -57,7 +57,7 @@ foreach ($rows as $post) {
if (api_get_course_setting('allow_user_image_forum')) {
echo '<br />'.display_user_image($post['user_id'],$name,$origin).'<br />';
}
echo display_user_link($post['user_id'], $name." ($username)", $origin)."<br />";
echo display_user_link($post['user_id'], $name, $origin, $username)."<br />";
echo api_convert_and_format_date($post['post_date']).'<br /><br />';
// get attach id
$attachment_list=get_attachment($post['post_id']);

@ -158,7 +158,7 @@ unset($whatsnew_post_info[$current_forum['forum_id']][$current_thread['thread_id
echo "<table width=\"100%\" class=\"forum_table\" cellspacing=\"5\" border=\"0\">";
echo "<tr>";
echo "<td rowspan=\"3\" class=\"$leftclass\">";
$username = $rows[$display_post_id]['username'];
$username = sprintf(get_lang('LoginX'), $rows[$display_post_id]['username']);
if ($rows[$display_post_id]['user_id']=='0') {
$name=prepare4display($rows[$display_post_id]['poster_name']);
} else {
@ -166,7 +166,7 @@ if ($rows[$display_post_id]['user_id']=='0') {
}
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." ($username)", $origin)."<br />";
echo display_user_link($rows[$display_post_id]['user_id'], $name, $origin, $username)."<br />";
echo api_convert_and_format_date($rows[$display_post_id]['post_date']).'<br /><br />';
// get attach id
$attachment_list=get_attachment($display_post_id);

Loading…
Cancel
Save