Esempio n. 1
0
     }
 }
 $data = file_postupdate_standard_editor($data, 'message', $editor_options, $context, 'block_quickmail', $table, $data->id);
 $DB->update_record('block_quickmail_' . $table, $data);
 $prepender = $config['prepend_class'];
 if (!empty($prepender) and !empty($course->{$prepender})) {
     $subject = "[{$course->{$prepender}}] {$data->subject}";
 } else {
     $subject = $data->subject;
 }
 // An instance id is needed before storing the file repository /////////
 file_save_draft_area_files($data->attachments, $context->id, 'block_quickmail', 'attachment_' . $table, $data->id, $editor_options);
 // Send emails /////////////////////////////////////////////////////////
 if (isset($data->send)) {
     if ($type == 'drafts') {
         quickmail::draft_cleanup($context->id, $typeid);
     }
     // deal with possible signature, will be appended to message in a little bit.
     if (!empty($sigs) and $data->sigid > -1) {
         $sig = $sigs[$data->sigid];
         $signaturetext = file_rewrite_pluginfile_urls($sig->signature, 'pluginfile.php', $context->id, 'block_quickmail', 'signature', $sig->id, $editor_options);
     }
     // Prepare html content of message /////////////////////////////////
     //$data->message = file_rewrite_pluginfile_urls($data->message, 'pluginfile.php', $context->id, 'block_quickmail', $table, $data->id, $editor_options);
     if (empty($signaturetext)) {
         $data->messageWithSigAndAttach = $data->message;
     } else {
         if ($data->format == 0 || $data->format == 2) {
             $data->messageWithSigAndAttach = $data->message . "\n\n" . $signaturetext;
         } else {
             $data->messageWithSigAndAttach = $data->message . "<br /> <br /> <p></p>" . $signaturetext;
Esempio n. 2
0
     }
 }
 $data = file_postupdate_standard_editor($data, 'message', $editor_options, $context, 'block_quickmail', $table, $data->id);
 $DB->update_record('block_quickmail_' . $table, $data);
 $prepender = $config['prepend_class'];
 if (!empty($prepender) and !empty($course->{$prepender})) {
     $subject = "[{$course->{$prepender}}] {$data->subject}";
 } else {
     $subject = $data->subject;
 }
 // An instance id is needed before storing the file repository
 file_save_draft_area_files($data->attachments, $context->id, 'block_quickmail', 'attachment_' . $table, $data->id, $editor_options);
 // Send emails
 if (isset($data->send)) {
     if ($type == 'drafts') {
         quickmail::draft_cleanup($typeid);
     }
     if (!empty($sigs) and $data->sigid > -1) {
         $sig = $sigs[$data->sigid];
         $signaturetext = file_rewrite_pluginfile_urls($sig->signature, 'pluginfile.php', $context->id, 'block_quickmail', 'signature', $sig->id, $editor_options);
         $data->message .= $signaturetext;
     }
     // Append links to attachments, if any
     $data->message .= quickmail::process_attachments($context, $data, $table, $data->id);
     // Prepare html content of message
     $data->message = file_rewrite_pluginfile_urls($data->message, 'pluginfile.php', $context->id, 'block_quickmail', $table, $data->id, $editor_options);
     // Same user, alternate email
     if (!empty($data->alternateid)) {
         $user = clone $USER;
         $user->email = $alternates[$data->alternateid];
     } else {