// TODO, check block disabled or instance not visible? $PAGE->blocks->show_only_fake_blocks(); $renderer = $PAGE->get_renderer('block_jmail'); $strheading = !empty($mailbox->config->title) ? format_string($mailbox->config->title) : get_string('pluginname', 'block_jmail'); $PAGE->navbar->add($strheading); $PAGE->set_title($strheading); $PAGE->set_heading($course->fullname . ': ' . $strheading); $module = array('name' => 'block_jmail', 'fullpath' => '/blocks/jmail/module.js', 'requires' => array('io', 'event-custom', 'json-parse', 'base', 'node', 'tabview', 'datasource-get', 'datasource-jsonschema', 'datatable-base', 'datatable-datasource', 'datatable-sort', 'panel', 'autocomplete', 'autocomplete-highlighters'), 'strings' => array(array('from', 'block_jmail'), array('subject', 'block_jmail'), array('date', 'block_jmail'), array('messagesent', 'block_jmail'), array('reply', 'block_jmail'), array('forward', 'block_jmail'), array('print', 'block_jmail'), array('messagesaved', 'block_jmail'), array('addlabel', 'block_jmail'), array('cc', 'block_jmail'), array('bcc', 'block_jmail'), array('messagedeleted', 'block_jmail'), array('messagesdeleted', 'block_jmail'), array('errortorequired', 'block_jmail'), array('errorsubjectrequired', 'block_jmail'), array('to', 'block_jmail'), array('confirmdelete', 'block_jmail'), array('label', 'block_jmail'), array('labels', 'block_jmail'), array('nomessagesfound', 'block_jmail'), array('re', 'block_jmail'), array('fw', 'block_jmail'), array('attachments', 'block_jmail'), array('preferences', 'block_jmail'), array('approvalpending', 'block_jmail'), array('messagehastobeapproved', 'block_jmail'), array('first', 'block_jmail'), array('last', 'block_jmail'), array('next', 'block_jmail'), array('previous', 'block_jmail'), array('delete', 'block_jmail'), array('save', 'block_jmail'), array('download', 'block_jmail'), array('savetomyprivatefiles', 'block_jmail'), array('filesaved', 'block_jmail'), array('mailbox', 'block_jmail'), array('delivertodifferentcourse', 'block_jmail'), array('delivertoglobalinbox', 'block_jmail'), array('inbox', 'block_jmail'), array('add', 'moodle'), array('deletem', 'block_jmail'), array('rename', 'moodle'), array('edit', 'moodle'), array('ok', 'moodle'), array('cancel', 'moodle'))); $usertoid = 0; $usertoname = ''; if ($userto = $DB->get_record('user', array('id' => $to, 'deleted' => 0))) { $d = new stdClass(); $d->type = 'to'; $d->userid = $userto->id; $destinataries[] = $d; if ($mailbox->check_destinataries($destinataries)) { $usertoid = $userto->id; $usertoname = fullname($userto); } } $editor = ''; if ($CFG->version >= 2014051200) { if ($USER->preference) { if (!empty($USER->preference['htmleditor'])) { $editor = $USER->preference['htmleditor']; } } } if (!$editor) { require_once $CFG->libdir . '/editorlib.php'; $editors = array_keys(editors_get_enabled());