/** * Displays a flagged item. * @param mod_forumng_post $post * @param bool $last * @return string HTML code for table row */ public function render_flagged_list_item($post, $last) { global $CFG; // Classes for Moodle table styles static $rownum = 0; $classes = ' r' . $rownum; $rownum = 1 - $rownum; if ($last) { $classes .= ' lastrow'; } $result = '<tr class="' . $classes . '">'; // Post cell $result .= '<td class="cell c0">'; // Show flag icon. (Note: I tried to use before this so the // icon never ends up on a line of its own, but it does not work.) $result .= ' <form class="forumng-flag" action="flagpost.php" method="post"><div>' . '<input type="hidden" name="p" value="' . $post->get_id() . '" />' . '<input type="hidden" name="back" value="view" />' . '<input type="hidden" name="flag" value="0" />' . '<input type="image" title="' . get_string('clearflag', 'forumng') . '" src="' . $this->pix_url('flag.on', 'mod_forumng') . '" alt="' . get_string('flagon', 'forumng') . '" /></div></form> '; // Get post URL $discussion = $post->get_discussion(); $link = '<a href="discuss.php?' . $discussion->get_link_params(mod_forumng::PARAM_HTML) . '#p' . $post->get_id() . '">'; // Get post summary $summary = self::get_post_summary($post->get_subject(), $post->get_formatted_message()); $result .= $link . $summary . '</a>'; $result .= '<small> ' . get_string('postby', 'forumng', $post->get_forum()->display_user_link($post->get_user())) . '</small></td>'; // Discussion cell. $result .= '<td class="cell c1"><a href="discuss.php?' . $discussion->get_link_params(mod_forumng::PARAM_HTML) . '">' . format_string($discussion->get_subject()) . '</a></td>'; // Date cell. $result .= '<td class="cell c2 lastcol">' . mod_forumng_utils::display_date($post->get_created()) . '</td></tr>'; return $result; }