示例#1
0
文件: a.php 项目: hansnok/emarking
        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!');
}