require_login(); $id = required_param('id', PARAM_INT); $vpl = new mod_vpl($id); $vpl->prepare_page('forms/executionoptions.php', array('id' => $id)); vpl_include_jsfile('hideshow.js'); $vpl->require_capability(VPL_MANAGE_CAPABILITY); //Display page $vpl->print_header(get_string('execution', VPL)); $vpl->print_heading_with_help('executionoptions'); $vpl->print_configure_tabs(basename(__FILE__)); $course = $vpl->get_course(); $fgp = $vpl->get_execution_fgm(); $mform = new mod_vpl_executionoptions_form('executionoptions.php', $vpl); if ($fromform = $mform->get_data()) { if (isset($fromform->saveoptions)) { $instance = $vpl->get_instance(); \mod_vpl\event\vpl_execution_options_updated::log($vpl); $instance->basedon = $fromform->basedon; $instance->run = $fromform->run; $instance->debug = $fromform->debug; $instance->evaluate = $fromform->evaluate; $instance->evaluateonsubmission = $fromform->evaluate && $fromform->evaluateonsubmission; $instance->automaticgrading = $fromform->evaluate && $fromform->automaticgrading; if ($DB->update_record(VPL, $instance)) { vpl_notice(get_string('optionssaved', VPL)); } else { vpl_error(get_string('optionsnotsaved', VPL)); } } } \mod_vpl\event\vpl_execution_options_viewed::log($vpl);
/** * This function is used by the reset_course_userdata function in moodlelib. * This function will remove all posts from the specified vpl instance * and clean up any related data. * @param $data the data submitted from the reset course. * @return array status array */ function vpl_reset_userdata($data) { global $CFG, $DB; $status = array(); if ($data->reset_vpl_submissions) { $componentstr = get_string('modulenameplural', VPL); if ($cms = get_coursemodules_in_course(VPL, $data->courseid)) { foreach ($cms as $cmid => $cm) { //For each vpl instance in course $vpl = new mod_vpl($cmid); $instance = $vpl->get_instance(); //Delete submissions records $DB->delete_records(VPL_SUBMISSIONS, array('vpl' => $instance->id)); //Delete variations assigned $DB->delete_records(VPL_ASSIGNED_VARIATIONS, array('vpl' => $instance->id)); //Delete submission files fulldelete($CFG->dataroot . '/vpl_data/' . $data->courseid . '/' . $instance->id . '/usersdata'); $status[] = array('component' => $componentstr, 'item' => get_string('resetvpl', VPL, $instance->name), 'error' => false); } } } return $status; }
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @author Juan Carlos Rodríguez-del-Pino <*****@*****.**> */ require_once dirname(__FILE__) . '/../../../config.php'; require_once dirname(__FILE__) . '/../locallib.php'; require_once dirname(__FILE__) . '/../vpl.class.php'; require_once dirname(__FILE__) . '/../vpl_submission.class.php'; require_login(); $id = required_param('id', PARAM_INT); $userid = required_param('userid', PARAM_INT); $detailed = abs(optional_param('detailed', 0, PARAM_INT)) % 2; $vpl = new mod_vpl($id); $vpl->prepare_page('views/previoussubmissionslist.php', array('id' => $id, 'userid' => $userid)); $course = $vpl->get_course(); $vpl->require_capability(VPL_GRADE_CAPABILITY); \mod_vpl\event\submission_previous_upload_viewed::log(array('objectid' => $vpl->get_instance()->id, 'context' => context_module::instance($id), 'relateduserid' => $userid)); //Load strings $strdatesubmitted = get_string('datesubmitted', VPL); $strdescription = get_string('description', VPL); if ($detailed) { $PAGE->requires->css(new moodle_url('/mod/vpl/css/sh.css')); $PAGE->requires->css(new moodle_url('/mod/vpl/editor/VPLIDE.css')); } //Print header $vpl->print_header(get_string('previoussubmissionslist', VPL)); $vpl->print_view_tabs(basename(__FILE__)); $table = new html_table(); $table->head = array('#', $strdatesubmitted, $strdescription); $table->align = array('right', 'left', 'right'); $table->nowrap = array(true, true, true); $submissionslist = $vpl->user_submissions($userid);
require_login(); $id = required_param('id', PARAM_INT); $userid = optional_param('userid', FALSE, PARAM_INT); $vpl = new mod_vpl($id); if ($userid) { $vpl->prepare_page('forms/submission.php', array('id' => $id, 'userid' => $userid)); } else { $vpl->prepare_page('forms/submission.php', array('id' => $id)); } if (!$vpl->is_submit_able()) { notice(get_string('notavailable')); } if (!$userid || $userid == $USER->id) { //Make own submission $userid = $USER->id; if ($vpl->get_instance()->restrictededitor) { $vpl->require_capability(VPL_MANAGE_CAPABILITY); } $vpl->require_capability(VPL_SUBMIT_CAPABILITY); $vpl->network_check(); $vpl->password_check(); } else { //Make other user submission $vpl->require_capability(VPL_MANAGE_CAPABILITY); } $instance = $vpl->get_instance(); $vpl->print_header(get_string('submission', VPL)); $vpl->print_view_tabs(basename(__FILE__)); $mform = new mod_vpl_submission_form('submission.php', $vpl); if ($mform->is_cancelled()) { vpl_inmediate_redirect(vpl_mod_href('view.php', 'id', $id));
//Download own submission $vpl->require_capability(VPL_VIEW_CAPABILITY); $userid = $USER->id; $grader = FALSE; if ($submissionid && $vpl->has_capability(VPL_GRADE_CAPABILITY)) { $subinstance = $DB->get_record('vpl_submissions', array('id' => $submissionid)); } else { $subinstance = $vpl->last_user_submission($userid); } $vpl->password_check(); } //Check consistence if (!$subinstance) { throw new Exception(get_string('nosubmission', VPL)); } if ($subinstance->vpl != $vpl->get_instance()->id) { throw new Exception(get_string('invalidcourseid')); } $submissionid = $subinstance->id; if ($vpl->is_inconsistent_user($subinstance->userid, $userid)) { throw new Exception('vpl submission user inconsistence'); } if ($vpl->get_instance()->id != $subinstance->vpl) { throw new Exception('vpl submission vpl inconsistence'); } $submission = new mod_vpl_submission($vpl, $subinstance); $fgm = $submission->get_submitted_fgm(); $fgm->download_files($vpl->get_printable_name()); } catch (Exception $e) { $vpl->prepare_page('views/downloadsubmission.php', array('id' => $id)); $vpl->print_header(get_string('download', VPL));
require_once dirname(__FILE__) . '/../vpl_submission.class.php'; try { require_login(); $id = required_param('id', PARAM_INT); $userid = optional_param('userid', FALSE, PARAM_INT); $vpl = new mod_vpl($id); if ($userid) { $vpl->prepare_page('forms/submissionview.php', array('id' => $id, 'userid' => $userid)); } else { $vpl->prepare_page('forms/submissionview.php', array('id' => $id)); } if (!$vpl->is_visible()) { notice(get_string('notavailable')); } $course = $vpl->get_course(); $instance = $vpl->get_instance(); $submissionid = optional_param('submissionid', FALSE, PARAM_INT); //Read records if ($userid && $userid != $USER->id) { //Grader $vpl->require_capability(VPL_GRADE_CAPABILITY); $grader = TRUE; if ($submissionid) { $subinstance = $DB->get_record('vpl_submissions', array('id' => $submissionid)); } else { $subinstance = $vpl->last_user_submission($userid); } } else { //view own submission $vpl->require_capability(VPL_VIEW_CAPABILITY); $userid = $USER->id;
* @copyright 2012 Juan Carlos Rodríguez-del-Pino * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @author Juan Carlos Rodríguez-del-Pino <*****@*****.**> */ require_once dirname(__FILE__) . '/../../../config.php'; require_once dirname(__FILE__) . '/../locallib.php'; require_once dirname(__FILE__) . '/../vpl.class.php'; require_once dirname(__FILE__) . '/../vpl_submission_CE.class.php'; require_once dirname(__FILE__) . '/../editor/editor_utility.php'; require_login(); vpl_editor_util::generate_requires_evaluation(); $id = required_param('id', PARAM_INT); $vpl = new mod_vpl($id); $vpl->prepare_page('forms/evaluation.php', array('id' => $id)); $userid = optional_param('userid', FALSE, PARAM_INT); if ((!$userid || $userid == $USER->id) && $vpl->get_instance()->evaluate) { //Evaluate own submission $userid = $USER->id; $vpl->require_capability(VPL_SUBMIT_CAPABILITY); } else { //Evaluate other user submission $vpl->prepare_page('forms/evaluation.php', array('id' => $id, 'userid' => $userid)); $vpl->require_capability(VPL_GRADE_CAPABILITY); } if ($USER->id == $userid) { $vpl->network_check(); $vpl->password_check(); } //Display page $vpl->print_header(get_string('evaluation', VPL)); flush();
function display() { $id = optional_param('update', FALSE, PARAM_INT); if ($id) { $vpl = new mod_vpl($id); $vpl->print_configure_tabs('edit'); if ($vpl->get_grade_info() !== false) { $vpl->get_instance()->visiblegrade = $vpl->get_grade_info()->hidden ? 0 : 1; } else { $vpl->get_instance()->visiblegrade = false; } $this->set_data($vpl->get_instance()); } parent::display(); }
require_once dirname(__FILE__) . '/../vpl.class.php'; require_once dirname(__FILE__) . '/../vpl_submission.class.php'; require_once dirname(__FILE__) . '/similarity_factory.class.php'; require_once dirname(__FILE__) . '/similarity_base.class.php'; require_once dirname(__FILE__) . '/similarity_form.class.php'; require_once dirname(__FILE__) . '/clusters.class.php'; require_once dirname(__FILE__) . '/../views/status_box.class.php'; ini_set('memory_limit', '256M'); $id = required_param('id', PARAM_INT); $userid = required_param('userid', PARAM_INT); $time_limit = 600; // 10 minutes $vpl = new mod_vpl($id); $vpl->prepare_page('similarity/user_similarity.php', array('id' => $id, 'userid' => $userid)); $vpl->require_capability(VPL_SIMILARITY_CAPABILITY); \mod_vpl\event\vpl_user_similarity_report_viewed::log(array('objectid' => $vpl->get_instance()->id, 'context' => context_module::instance($id), 'relateduserid' => $userid)); //Print header $PAGE->requires->css(new moodle_url('/mod/vpl/css/similarity.css')); $vpl->print_header(get_string('listsimilarity', VPL)); $subinstance = $vpl->last_user_submission($userid); if ($subinstance === false) { //No user submission $vpl->print_footer(); die; } $submission = new mod_vpl_submission($vpl, $subinstance); //Get required filenames $filelist = $vpl->get_required_fgm()->getFileList(); foreach ($filelist as $filename) { $filesselected[$filename] = true; }
$buttongroup[] = $mform->createElement('submit', 'save', get_string('save', VPL)); $buttongroup[] = $mform->createElement('submit', 'cancel', get_string('cancel')); if ($this->number >= 0) { $menssage = addslashes(get_string('delete')); $onclick = 'onclick="return confirm(\'' . $menssage . '\')"'; $buttongroup[] = $mform->createElement('submit', 'delete', get_string('delete'), $onclick); } $mform->addGroup($buttongroup); } } require_login(); $id = required_param('id', PARAM_INT); $vpl = new mod_vpl($id); $vpl->prepare_page('forms/variations.php', array('id' => $id)); vpl_include_jsfile('hideshow.js'); $vplid = $vpl->get_instance()->id; $vpl->require_capability(VPL_MANAGE_CAPABILITY); $href = vpl_mod_href('forms/variations.php', 'id', $id); $vpl->print_header(get_string('variations', VPL)); $vpl->print_heading_with_help('variations'); //Generate default form and check for action if (optional_param('varid', -13, PARAM_INT) == -13) { //No variation saved $oform = new mod_vpl_variation_option_form($href, $vpl); if ($oform->is_cancelled()) { vpl_inmediate_redirect($href); //Reload page } elseif ($fromform = $oform->get_data()) { $fromform->id = $vplid; vpl_truncate_string($fromform->variationtitle, 255); \mod_vpl\event\vpl_variation_updated::log($vpl);