Ejemplo n.º 1
0
        break;
    case 'rotatepage':
        if (!$issupervisor) {
            emarking_json_error('Invalid access');
        }
        list($imageurl, $anonymousurl, $imgwidth, $imgheight) = emarking_rotate_image($pageno, $submission, $context);
        if (strlen($imageurl) == 0) {
            emarking_json_error('Image is empty');
        }
        $output = array('imageurl' => $imageurl, 'anonymousimageurl' => $anonymousurl, 'width' => $imgwidth, 'height' => $imgheight);
        emarking_json_array($output);
        break;
    case 'sortpages':
        $neworder = required_param('neworder', PARAM_SEQUENCE);
        $neworderarr = explode(',', $neworder);
        if (!emarking_sort_submission_pages($submission, $neworderarr)) {
            emarking_json_error('Error trying to resort pages!');
        }
        $output = array('neworder' => $neworder);
        emarking_json_array($output);
        break;
    case 'updcomment':
        emarking_check_grade_permission($readonly, $draft, $context);
        // Add to Moodle log so some auditing can be done.
        \mod_emarking\event\emarking_graded::create_from_draft($draft, $submission, $context)->trigger();
        $newgrade = emarking_update_comment($submission, $draft, $emarking, $context);
        emarking_json_array(array('message' => 'Success!', 'newgrade' => $newgrade, 'timemodified' => time()));
        break;
    default:
        emarking_json_error('Invalid action!');
}
Ejemplo n.º 2
0
            // This is definitely a hacking attempt
            $item = array('context' => context_module::instance($cm->id), 'objectid' => $cm->id);
            // Add to Moodle log so some auditing can be done
            \mod_emarking\event\unauthorized_granted::create($item)->trigger();
            emarking_json_error('Unauthorized access!');
        }
    }
} else {
    $readonly = false;
}
// Switch according to action
switch ($action) {
    case 'emarking':
        $item = array('context' => context_module::instance($cm->id), 'objectid' => $cm->id);
        // Add to Moodle log so some auditing can be done
        \mod_emarking\event\emarking_graded::create($item)->trigger();
        $module = new stdClass();
        include "../version.php";
        include "view/emarking.php";
        break;
    case 'getsubmission':
        include "qry/getSubmissionGrade.php";
        $output = $results;
        emarking_json_array($output);
        break;
    case 'getcomments':
        include "qry/getCommentsSubmission.php";
        emarking_json_resultset($results);
        break;
    case 'getstudents':
        include "qry/getStudentsInMarking.php";