Example #1
0
     $DB->delete_records('block_email_list_foldermail', array('folderid' => $trash->id));
     // Get all trash mails
     if ($mails) {
         foreach ($mails as $mail) {
             // if mailid exist, continue ...
             if ($DB->get_records('block_email_list_foldermail', array('mailid' => $mail->id))) {
                 continue;
             } else {
                 // Mail is not reference by never folder (not possibility readed)
                 if (email_delete_attachments($mail->id) and $DB->delete_records('block_email_list_mail', array('id' => $mail->id))) {
                     $success = true;
                 }
             }
         }
     }
     $url = email_build_url($options);
     // Notify
     if ($success) {
         echo $OUTPUT->notification(get_string('cleantrashok', 'block_email_list'), '');
     } else {
         echo $OUTPUT->notification(get_string('cleantrashfail', 'block_email_list'), '');
     }
     $options->folderid = $id;
     $options->folderoldid = 0;
     email_showmails($USER->id, '', 0, 10, $options);
     break;
 case md5('edit'):
     // Can create subfolders?
     if (!has_capability('block/email_list:createfolder', $context)) {
         print_error('forbiddencreatefolder', 'block_email_list', $CFG->wwwroot . '/blocks/email_list/email/index.php?id=' . $course->id);
     }
/**
 * This functions print select form, who it's options to have mails
 *
 * @uses $CFG, $USER
 * @param object $options Options for redirect this form
 * @return boolean Success/Fail
 * @todo Finish documenting this function
 * */
function email_print_select_options($options, $perpage)
{
    global $CFG, $USER;
    $baseurl = $CFG->wwwroot . '/blocks/email_list/email/index.php?' . email_build_url($options);
    echo '<br />';
    echo '<div class="content emailfloatcontent">';
    if ($options->id != SITEID) {
        echo '<div class="emailfloat emailleft">';
        if (!email_isfolder_type(email_get_folder($options->folderid), EMAIL_SENDBOX)) {
            echo '<select name="action" onchange="this.form.submit()">
		                	<option value="" selected="selected">' . get_string('markas', 'block_email_list') . ':</option>
		        			<option value="toread">' . get_string('toread', 'block_email_list') . '</option>
		               	<option value="tounread">' . get_string('tounread', 'block_email_list') . '</option>
		    		</select>';
            print_spacer(1, 20, false);
        }
        echo '</div>';
        echo '<div class="emailleft">';
        email_print_movefolder_button($options);
        // Idaho State University & MoodleRooms contrib - Thanks!
        email_print_preview_button($options->id);
        echo '</div>';
        echo '<div id="move2folder"></div>';
        echo '</div>';
    }
    // ALERT!: Now, I'm printing end start form, for choose number mail per page
    $url = '';
    // Build url part options
    if ($options) {
        $url = email_build_url($options);
    }
    echo '</form>';
    echo '<form id="mailsperpage" name="mailsperpage" action="' . $CFG->wwwroot . '/blocks/email_list/email/index.php?' . $url . '" method="post">';
    // Choose number mails perpage
    echo '<div id="sizepage" class="emailright">' . get_string('mailsperpage', 'block_email_list') . ': ';
    // Define default separator
    $spaces = '&#160;&#160;&#160;';
    echo '<select name="perpage" onchange="javascript:this.form.submit();">';
    for ($i = 5; $i < 80; $i = $i + 5) {
        if ($perpage == $i) {
            echo '<option value="' . $i . '" selected="selected">' . $i . '</option>';
        } else {
            echo '<option value="' . $i . '">' . $i . '</option>';
        }
    }
    echo '</select>';
    echo '</div>';
    return true;
}
Example #3
0
    $next = email_get_nextprevmail($mailid, $mails, true);
    if ($next) {
        $action = PHP_VERSION < 5 ? $options : clone $options;
        // Thanks Ann
        $action->id = $next;
        $urlnextmail = email_build_url($action);
        $urlnextmail .= '&amp;mails=' . $mails;
        $urlnextmail .= '&amp;action=' . EMAIL_VIEWMAIL;
    }
    $urlpreviousmail = '';
    $prev = email_get_nextprevmail($mailid, $mails, false);
    if ($prev) {
        $action = PHP_VERSION < 5 ? $options : clone $options;
        // Thanks Ann
        $action->id = $prev;
        $urlpreviousmail = email_build_url($action);
        $urlpreviousmail .= '&amp;mails=' . $mails;
        $urlpreviousmail .= '&amp;action=' . EMAIL_VIEWMAIL;
    }
}
$email->display($courseid, $folderid, $urlpreviousmail, $urlnextmail, $baseurl, $user, has_capability('moodle/site:viewfullnames', $coursecontext));
// Close principal column
echo '</td>';
// Close table
echo '</tr> </table>';
/// Finish the page
if (isset($course)) {
    echo $OUTPUT->footer($course);
} else {
    echo $OUTPUT->footer($SITE);
}