Пример #1
0
                $initialvalues->message['itemid'] = $messagedraftitemid;
            }
            if ($edit || $draft) {
                $mform->set_data($initialvalues);
            } else {
                $draftitemid = file_get_submitted_draft_itemid('attachments');
                file_prepare_draft_area($draftitemid, $filecontext->id, 'mod_forumng', 'attachment', null, $fileoptions);
                $initialvalues->attachments = $draftitemid;
                $messagedraftitemid = file_get_submitted_draft_itemid('message');
                file_prepare_draft_area($messagedraftitemid, $filecontext->id, 'mod_forumng', 'message', 0, $fileoptions);
                $initialvalues->message = array('text' => '', 'format' => editors_get_preferred_format(), 'itemid' => $messagedraftitemid);
                $mform->set_data($initialvalues);
            }
            // Require JavaScript (form.js).
            $forum->print_form_js();
            // Print form
            $mform->display();
            // In iframe mode, inform parent that iframe has loaded.
            if ($iframe) {
                $PAGE->requires->js_init_code('window.parent.iframe_has_loaded(window);', true);
            }
            // Display footer
            print $out->footer();
        }
    }
} catch (Exception $e) {
    // Add special entry to log
    mod_forumng_utils::log_exception($e);
    // Let default exception handler cope with it
    throw $e;
}