Esempio n. 1
0
 echo "<tr>";
 echo "<td rowspan=\"3\" class=\"{$leftclass}\">";
 echo '<br /><b>' . api_convert_and_format_date($row['post_date'], DATE_TIME_FORMAT_LONG) . '</b><br />';
 if (api_is_allowed_to_edit(null, true)) {
     echo $url_post;
 }
 echo "</td>";
 // The post title
 echo "<td class=\"{$titleclass}\">" . prepare4display($row['post_title']) . "</td>";
 echo "</tr>";
 // The post message
 echo "<tr >";
 echo "<td class=\"{$messageclass}\">" . prepare4display($row['post_text']) . "</td>";
 echo "</tr>";
 // The check if there is an attachment
 $attachment_list = getAllAttachment($row['post_id']);
 if (!empty($attachment_list)) {
     foreach ($attachment_list as $attachment) {
         echo '<tr ><td height="50%">';
         $realname = $attachment['path'];
         $user_filename = $attachment['filename'];
         echo Display::return_icon('attachment.gif', get_lang('Attachment'));
         echo '<a href="download.php?file=';
         echo $realname;
         echo ' "> ' . $user_filename . ' </a>';
         echo '<span class="forum_attach_comment" >' . $attachment['comment'] . '</span><br />';
         echo '</td></tr>';
     }
 }
 // The post has been displayed => it can be removed from the what's new array
 unset($whatsnew_post_info[$current_forum['forum_id']][$current_thread['thread_id']][$row['post_id']]);
    $post_image = Display::return_icon('forumpostnew.gif');
} else {
    $post_image = Display::return_icon('forumpost.gif');
}
if ($rows[$display_post_id]['post_notification'] == '1' and $rows[$display_post_id]['poster_id'] == $_user['user_id']) {
    $post_image .= Display::return_icon('forumnotification.gif', get_lang('YouWillBeNotified'));
}
// The post title
echo "<td class=\"{$titleclass}\">" . prepare4display($rows[$display_post_id]['post_title']) . "</td>";
echo "</tr>";
// The post message
echo "<tr>";
echo "<td class=\"{$messageclass}\">" . prepare4display($rows[$display_post_id]['post_text']) . "</td>";
echo "</tr>";
// The check if there is an attachment
$attachment_list = getAllAttachment($display_post_id);
if (!empty($attachment_list) && is_array($attachment_list)) {
    foreach ($attachment_list as $attachment) {
        echo '<tr><td height="50%">';
        $realname = $attachment['path'];
        $user_filename = $attachment['filename'];
        echo Display::return_icon('attachment.gif', get_lang('Attachment'));
        echo '<a href="download.php?file=';
        echo $realname;
        echo ' "> ' . $user_filename . ' </a>';
        echo '<span class="forum_attach_comment">' . Security::remove_XSS($attachment['comment'], STUDENT) . '</span>';
        if ($current_forum['allow_edit'] == 1 and $rows[$display_post_id]['user_id'] == $_user['user_id'] or api_is_allowed_to_edit(false, true) && !(api_is_course_coach() && $current_forum['session_id'] != $_SESSION['id_session'])) {
            echo '&nbsp;&nbsp;<a href="' . api_get_self() . '?' . api_get_cidreq() . '&origin=' . Security::remove_XSS($_GET['origin']) . '&action=delete_attach&id_attach=' . $attachment['id'] . '&forum=' . $forumId . '&thread=' . $threadId . '" onclick="javascript:if(!confirm(\'' . addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTESt)) . '\')) return false;">' . Display::return_icon('delete.gif', get_lang('Delete')) . '</a><br />';
        }
        echo '</td></tr>';
    }