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); } $mform = new folder_form('folder.php', array('id' => $id, 'action' => $action, 'course' => $courseid)); $folder = email_get_folder($id); $folder->foldercourse = $folder->course; unset($folder->course); $mform->set_data($folder); if ($data = $mform->get_data()) { $updatefolder = new stdClass(); // Clean name $updatefolder->name = strip_tags($data->name);
// Get foldermail reference $foldermail = email_get_reference2foldermail($mail, $folderoldid); // Move this mail into folder if (!email_move2folder($mail, $foldermail->id, $folderid)) { $success = false; } } // Show if (!$success) { notify(get_string('movefail', 'block_email_list')); } else { notify(get_string('moveok', 'block_email_list')); } } // Show folders $options->folderid = $folderoldid; break; } } //Show list all mails email_showmails($USER->id, '', $page, $perpage, $options); // Close principal column echo '</td>'; // Close table echo '</tr> </table>'; /// Finish the page if (isset($course)) { print_footer($course); } else { print_footer($SITE); }
if (!empty($sqlsubject)) { $sqlsubjectbody = ' AND ' . $sqlsubject; } else { $sqlsubjectbody = ''; } } $sqlcourse = " AND s.course = m.course AND m.course = {$courseid} AND s.course = {$courseid} "; // README: If you can search by to, this simple search mode don't get this results, you use advanced search. // Only search by: Folder and ( Subject or Body or From). $sql = ''; $sql .= $select . $from . ' WHERE fm.mailid = m.id ' . ' AND m.userid = u.id ' . ' AND s.mailid = m.id ' . $wherefolders . $sqlcourse . $sqlsubjectbody . $searchfrom . ' AND ( m.userid = ' . $USER->id . ' OR ( s.userid = ' . $USER->id . ' AND s.mailid = m.id) ) ' . $groupby; if (!($searchmails = $DB->get_records_sql($sql))) { debugging('Empty simple search for next SQL stament: ' . $sql, DEBUG_DEVELOPER); } $advancedsearch->display(); echo $OUTPUT->notification(get_string('searchword', 'block_email_list'), 'notifysuccess'); // Show mails searched email_showmails($USER->id, '', $page, $perpage, $options, true, $searchmails); } } } // 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); }