Use api_get_user_info()

pull/2487/head
jmontoyaa 9 years ago
parent e56398e404
commit 5b0bc80cce
  1. 52
      main/template/default/work/comments.tpl
  2. 2
      main/work/view.php
  3. 11
      main/work/work.lib.php

@ -6,35 +6,35 @@
</h3>
<hr>
<ul>
{% for comment in comments %}
<li>
<div class="page-header">
<a href="{{ _p.web_code }}">
<img height="24" src="{{ comment.picture }}"/> {{ comment.username }}
</a>- {{ comment.sent_at | api_get_local_time }}
</div>
{% for comment in comments %}
<li>
<div class="page-header">
<a href="{{ _p.web_code }}">
<img height="24" src="{{ comment.picture }}"/> {{ comment.complete_name }}
</a>- {{ comment.sent_at | api_get_local_time }}
</div>
<p>
{% if comment.comment is not empty %}
{{ comment.comment }}
{% else %}
{{ 'HereIsYourFeedback' | get_lang }}
{% endif %}
</p>
{% if comment.file_url is not empty %}
<p>
{% if comment.comment is not empty %}
{{ comment.comment }}
{% else %}
{{ 'HereIsYourFeedback' | get_lang }}
<a href="{{ comment.file_url }}">
<img src="{{ "attachment.gif"|icon(32) }}" width="32" height="32">
{{ comment.file_name_to_show }}
</a>
{% if is_allowed_to_edit %}
<a href="{{ comment.delete_file_url }}">
<img src="{{ "delete.png"|icon(22) }}" width="22" height="22">
</a>
{% endif %}
</p>
{% if comment.file_url is not empty %}
<p>
<a href="{{ comment.file_url }}">
<img src="{{ "attachment.gif"|icon(32) }}" width="32" height="32">
{{ comment.file_name_to_show }}
</a>
{% if is_allowed_to_edit %}
<a href="{{ comment.delete_file_url }}">
<img src="{{ "delete.png"|icon(22) }}" width="22" height="22">
</a>
{% endif %}
</p>
{% endif %}
</li>
{% endfor %}
{% endif %}
</li>
{% endfor %}
</ul>
<br />
<hr>

@ -144,7 +144,7 @@ if ((user_is_author($id) || $isDrhOfCourse || (api_is_allowed_to_edit() || api_i
$tpl->assign('is_allowed_to_edit', api_is_allowed_to_edit());
$template = $tpl->get_template('work/view.tpl');
$content = $tpl->fetch($template);
$content = $tpl->fetch($template);
$tpl->assign('content', $content);
$tpl->display_one_col_template();
} else {

@ -2876,9 +2876,11 @@ function getWorkComments($work)
}
$sql = "SELECT
c.id, c.user_id, u.firstname, u.lastname, u.username, u.picture_uri
c.id,
c.user_id
FROM $commentTable c
INNER JOIN $userTable u ON (u.user_id = c.user_id)
INNER JOIN $userTable u
ON (u.id = c.user_id)
WHERE c_id = $courseId AND work_id = $workId
ORDER BY sent_at
";
@ -2886,9 +2888,10 @@ function getWorkComments($work)
$comments = Database::store_result($result, 'ASSOC');
if (!empty($comments)) {
foreach ($comments as &$comment) {
$comment['picture'] = UserManager::getUserPicture($comment['user_id']);
$userInfo = api_get_user_info($comment['user_id']);
$comment['picture'] = $userInfo['avatar'];
$comment['complete_name'] = $userInfo['complete_name_with_username'];
$commentInfo = getWorkComment($comment['id']);
if (!empty($commentInfo)) {
$comment = array_merge($comment, $commentInfo);
}

Loading…
Cancel
Save