/** * Prints the print emails button * * Idaho State University & MoodleRooms contrib - Thanks! * * @param int $courseid Course Id * * @return void **/ function email_print_preview_button($courseid) { // Action is handled weird, put in a dummy hidden element // and then change its name to action when our button has // been clicked /*echo '<span id="print_preview" class="print_preview"> <input type="submit" value="'.get_string('printemails', 'block_email_list').'" name="action" onclick="return print_multiple_emails(document.sendmail.mail);" /> <input type="hidden" value="print" name="disabled" id="printactionid" /> </span>'; */ echo '<span id="print_preview" class="print_preview">'; email_print_to_popup_window('button', '/blocks/email_list/email/print.php?courseid=' . $courseid . '&mailids=', get_string('printemails', 'block_email_list'), get_string('printemails', 'block_email_list')); echo '</span>'; }
/** * This function return an HTML code for display this eMail */ function get_html($courseid, $folderid, $urlpreviousmail, $urlnextmail, $baseurl, $override = false) { global $USER, $CFG; $html = ''; $html .= '<table class="sitetopic" border="0" cellpadding="5" cellspacing="0" width="100%">'; $html .= '<tr class="headermail">'; $html .= '<td style="border-left: 1px solid black; border-top:1px solid black" width="7%" align="center">'; // Get user picture $user = get_record('user', 'id', $this->userid); $html .= print_user_picture($this->userid, $this->course, $user->picture, 0, true, false); $html .= '</td>'; $html .= '<td style="border-right: 1px solid black; border-top:1px solid black" align="left" colspan="2">'; $html .= $this->subject; $html .= '</td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td style="border-left: 1px solid black; border-right: 1px solid black; border-top:1px solid black" align="left" colspan="3">'; $html .= ' '; $html .= '<b> ' . get_string('from', 'block_email_list') . ':</b> '; $html .= $this->get_fullname_writer($override); $html .= '</td>'; $html .= '</tr>'; $html .= '<tr>'; $userstosendto = $this->get_users_send('to'); $html .= '<td style="border-left: 1px solid black;" width="80%" align="left" colspan="2">'; $html .= ' '; if ($userstosendto != '') { $html .= '<b> ' . get_string('for', 'block_email_list') . ':</b> '; $html .= $this->get_users_send('to'); } $html .= '</td>'; $html .= '<td style="border-right: 1px solid black;" width="20%">'; if ($urlnextmail or $urlpreviousmail) { $html .= " || "; } if ($urlpreviousmail) { $html .= '<a href="view.php?' . $urlpreviousmail . '">' . get_string('previous', 'block_email_list') . '</a>'; } if ($urlnextmail) { if ($urlpreviousmail) { $html .= ' | '; } $html .= '<a href="view.php?' . $urlnextmail . '">' . get_string('next', 'block_email_list') . '</a>'; } $html .= ' '; $html .= '</td>'; $html .= '</tr>'; $userstosendcc = $this->get_users_send('cc'); if ($userstosendcc != '') { $html .= '<tr> <td style="border-left: 1px solid black; border-right: 1px solid black;" align="left" colspan="3"> <b> ' . get_string('cc', 'block_email_list') . ':</b> ' . $userstosendcc . ' </td> </tr>'; } // Drop users sending by bcc if user isn't writer if ($userstosendbcc = $this->get_users_send('bcc') != '' and $USER->id != $this->userid) { $html .= '<tr> <td style="border-left: 1px solid black; border-right: 1px solid black;" align="left" colspan="3"> <b> ' . get_string('bcc', 'block_email_list') . ':</b> ' . $userstosendbcc . ' </td> </tr>'; } $html .= '<tr>'; $html .= '<td style="border-left: thin solid black; border-right: 1px solid black" width="60%" align="left" colspan="3">'; $html .= ' '; $html .= '<b> ' . get_string('date', 'block_email_list') . ':</b> '; $html .= userdate($this->timecreated); $html .= '</td>'; $html .= '</tr>'; $html .= '<tr>'; $html .= '<td style="border: 1px solid black" colspan="3" align="left">'; $html .= '<br />'; // Options for display body $options = new object(); $options->filter = true; $html .= format_text($this->body, FORMAT_HTML, $options); if ($this->has_attachments()) { $html .= $this->_get_format_attachments(); } $html .= '<br />'; $html .= '<br />'; $html .= '</td>'; $html .= '</tr>'; $html .= '<tr class="messagelinks">'; $html .= '<td align="right" colspan="3">'; $html .= '<a href="sendmail.php?' . $baseurl . '&action=' . EMAIL_REPLY . '"><b>' . get_string('reply', 'block_email_list') . '</b></a>'; $html .= ' | '; $html .= '<a href="sendmail.php?' . $baseurl . '&action=' . EMAIL_REPLYALL . '"><b>' . get_string('replyall', 'block_email_list') . '</b></a>'; $html .= ' | '; $html .= '<a href="sendmail.php?' . $baseurl . '&action=' . EMAIL_FORWARD . '"><b>' . get_string('forward', 'block_email_list') . '</b></a>'; $html .= ' | '; $html .= '<a href="index.php?id=' . $courseid . '&mailid=' . $this->id . '&folderid=' . $folderid . '&action=removemail"><b>' . get_string('removemail', 'block_email_list') . '</b></a>'; $html .= ' | '; $icon = '<img src="' . $CFG->wwwroot . '/blocks/email_list/email/images/printer.png" height="16" width="16" alt="' . get_string('print', 'block_email_list') . '" />'; $html .= email_print_to_popup_window('link', '/blocks/email_list/email/print.php?courseid=' . $courseid . '&mailids=' . $this->id, '<b>' . get_string('print', 'block_email_list') . '</b>' . print_spacer(1, 3, false, true) . $icon, get_string('print', 'block_email_list'), true); $html .= '</td>'; $html .= '</tr>'; $html .= '</table>'; return $html; }