Ejemplo n.º 1
0
    $config = turnitintooltwo_admin_config();
    if ($config->inboxlayout == 1) {
        $PAGE->set_cm($cm);
        $PAGE->set_pagelayout('incourse');
    }
}
// Don't show messages popup if we are in submission modal.
$forbiddenmsgscreens = array('submission_success', 'submitpaper');
if (in_array($do, $forbiddenmsgscreens)) {
    $PAGE->set_popup_notification_allowed(false);
}
// Configure URL correctly.
$urlparams = array('id' => $id, 'a' => $a, 'part' => $part, 'user' => $user, 'do' => $do, 'action' => $action, 'view_context' => $viewcontext);
$url = new moodle_url('/mod/turnitintooltwo/view.php', $urlparams);
// Load Javascript and CSS.
$turnitintooltwoview->load_page_components();
$turnitintooltwoassignment = new turnitintooltwo_assignment($turnitintooltwo->id, $turnitintooltwo);
// Define file upload options.
$maxbytessite = $CFG->maxbytes == 0 || $CFG->maxbytes > TURNITINTOOLTWO_MAX_FILE_UPLOAD_SIZE ? TURNITINTOOLTWO_MAX_FILE_UPLOAD_SIZE : $CFG->maxbytes;
$maxbytescourse = $COURSE->maxbytes == 0 || $COURSE->maxbytes > TURNITINTOOLTWO_MAX_FILE_UPLOAD_SIZE ? TURNITINTOOLTWO_MAX_FILE_UPLOAD_SIZE : $COURSE->maxbytes;
$maxfilesize = get_user_max_upload_file_size(context_module::instance($cm->id), $maxbytessite, $maxbytescourse, $turnitintooltwoassignment->turnitintooltwo->maxfilesize);
$maxfilesize = $maxfilesize <= 0 ? TURNITINTOOLTWO_MAX_FILE_UPLOAD_SIZE : $maxfilesize;
$turnitintooltwofileuploadoptions = array('maxbytes' => $maxfilesize, 'subdirs' => false, 'maxfiles' => 1, 'accepted_types' => '*');
if (!($parts = $turnitintooltwoassignment->get_parts())) {
    turnitintooltwo_print_error('partgeterror', 'turnitintooltwo', null, null, __FILE__, __LINE__);
}
// Get whether user is a tutor/student.
$istutor = has_capability('mod/turnitintooltwo:grade', context_module::instance($cm->id));
$userrole = $istutor ? 'Instructor' : 'Learner';
// Deal with actions here.
if (!empty($action)) {
Ejemplo n.º 2
0
    }
    if (!($course = $DB->get_record("course", array("id" => $cm->course)))) {
        turnitintooltwo_print_error('coursemisconfigured', 'turnitintooltwo');
    }
    if (!($turnitintooltwo = $DB->get_record("turnitintooltwo", array("id" => $cm->instance)))) {
        turnitintooltwo_print_error('coursemodincorrect', 'turnitintooltwo');
    }
    $PAGE->set_context(context_module::instance($cm->id));
    $PAGE->set_pagelayout('base');
    require_login($course->id, true, $cm);
} else {
    $PAGE->set_context(context_system::instance());
    require_login();
}
// Load Javascript and CSS.
$turnitintooltwoview->load_page_components($hidebg);
// Configure URL correctly.
$urlparams = array('cmd' => $cmd, 'view_context' => $viewcontext);
if ($id != 0) {
    $urlparams['id'] = $id;
}
$url = new moodle_url('/mod/turnitintooltwo/extras.php', $urlparams);
$title = "";
switch ($cmd) {
    case "supportwizard":
        $PAGE->requires->jquery_plugin('turnitintooltwo-turnitin_helpdesk', 'mod_turnitintooltwo');
        $title = get_string('turnitinhelpdesk', 'turnitintooltwo');
        include "classes/helpdeskwizard/helpdeskwizard.php";
        $helpdeskwizard = new helpdeskwizard();
        $output = $helpdeskwizard->output_wizard($id);
        break;