$mform->setDefault('evaluate', 1);
        $mform->addElement('selectyesno', 'evaluateonsubmission', get_string('evaluateonsubmission', VPL));
        $mform->setDefault('evaluateonsubmission', 1);
        $mform->disabledIf('evaluateonsubmission', 'evaluate', 'eq', 0);
        $mform->addElement('selectyesno', 'automaticgrading', get_string('automaticgrading', VPL));
        $mform->setDefault('automaticgrading', 1);
        $mform->disabledIf('automaticgrading', 'evaluate', 'eq', 0);
        $mform->addElement('submit', 'saveoptions', get_string('saveoptions', VPL));
    }
}
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;
 * @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.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);
Example #3
0
//
// You should have received a copy of the GNU General Public License
// along with VPL for Moodle.  If not, see <http://www.gnu.org/licenses/>.
/**
 * Show URL to web service with token
 *
 * @package mod_vpl
 * @copyright 2014 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__) . '/../vpl.class.php';
require_login();
$id = required_param('id', PARAM_INT);
$vpl = new mod_vpl($id);
$vpl->prepare_page('views/show_webservice.php', array('id' => $id));
$vpl->require_capability(VPL_VIEW_CAPABILITY);
$log_url = vpl_rel_url('views/show_webservice.php', 'id', $id);
if (!$vpl->is_visible()) {
    notice(get_string('notavailable'));
}
$vpl->print_header(get_string('createtokenforuser', 'core_webservice'));
$vpl->print_view_tabs('view.php');
echo '<h1>' . get_string('webservice', 'core_webservice') . '</h1>';
echo '<h3>' . get_string('createtokenforuserdescription', 'core_webservice') . '</h3>';
$service_url = vpl_get_webservice_urlbase($vpl);
echo $OUTPUT->box('<div style="white-space: pre-wrap">' . s($service_url) . '</div>');
\mod_vpl\event\vpl_webservice_token_viewed::log($vpl);
notice('', vpl_mod_href('view.php', 'id', $id));
$vpl->print_footer();
        $names[$ret]++;
        $ret .= $names[$ret];
    } else {
        $names[$ret] = 0;
    }
    return $ret;
}
require_login();
$id = required_param('id', PARAM_INT);
$group = optional_param('group', -1, PARAM_INT);
//Undocumented feature, add &CE=1 to the query string
$includeCE = optional_param('CE', 0, PARAM_INT);
$subselection = vpl_get_set_session_var('subselection', 'allsubmissions', 'selection');
$vpl = new mod_vpl($id);
$cm = $vpl->get_course_module();
$vpl->require_capability(VPL_SIMILARITY_CAPABILITY);
\mod_vpl\event\vpl_all_submissions_downloaded::log($vpl);
//get students
$currentgroup = groups_get_activity_group($cm);
if (!$currentgroup) {
    $currentgroup = '';
}
$list = $vpl->get_students($currentgroup);
$submissions = $vpl->all_last_user_submission();
//Get all information
$all_data = array();
foreach ($list as $userinfo) {
    if ($vpl->is_group_activity() && $userinfo->id != $vpl->get_group_leaderid($userinfo->id)) {
        continue;
    }
    $submission = null;
 static function vpl_get_similfile($f, $vpl, &$HTMLheader, &$filename, &$data)
 {
     global $DB;
     $HTMLheader = '';
     $filename = '';
     $data = '';
     $type = required_param('type' . $f, PARAM_INT);
     if ($type == 1) {
         $subid = required_param('subid' . $f, PARAM_INT);
         $filename = required_param('filename' . $f, PARAM_TEXT);
         $subinstance = $DB->get_record('vpl_submissions', array('id' => $subid));
         if ($subinstance !== false) {
             $vpl = new mod_vpl(false, $subinstance->vpl);
             $vpl->require_capability(VPL_SIMILARITY_CAPABILITY);
             $submission = new mod_vpl_submission($vpl, $subinstance);
             $user = $DB->get_record('user', array('id' => $subinstance->userid));
             if ($user) {
                 $HTMLheader .= '<a href="' . vpl_mod_href('/forms/submissionview.php', 'id', $vpl->get_course_module()->id, 'userid', $subinstance->userid) . '">';
             }
             $HTMLheader .= s($filename) . ' ';
             if ($user) {
                 $HTMLheader .= '</a>';
                 $HTMLheader .= $vpl->user_fullname_picture($user);
             }
             $fg = $submission->get_submitted_fgm();
             $data = $fg->getFileData($filename);
             \mod_vpl\event\vpl_diff_viewed::log($submission);
         }
     } elseif ($type == 2) {
         //FIXME adapt to moodle 2.x
         /*
         global $CFG;
         $dirname = required_param('dirname'.$f,PARAM_RAW);
         $filename = required_param('filename'.$f,PARAM_RAW);
         $base=$CFG->dataroot.'/'.$vpl->get_course()->id.'/';
         $data = file_get_contents($base.$dirname.'/'.$filename);
         $HTMLheader .= $filename.' '.optional_param('username'.$f,'',PARAM_TEXT);
         */
     } elseif ($type == 3) {
         global $CFG;
         $data = '';
         $zipname = required_param('zipfile' . $f, PARAM_RAW);
         $filename = required_param('filename' . $f, PARAM_RAW);
         $HTMLheader .= $filename . ' ' . optional_param('username' . $f, '', PARAM_TEXT);
         $ext = strtoupper(pathinfo($zipfile, PATHINFO_EXTENSION));
         if ($ext != 'ZIP') {
             print_error('nozipfile');
         }
         $zip = new ZipArchive();
         $zipfilename = self::get_zip_filepath($zipname);
         if ($zip->open($zipfilename)) {
             $data = $zip->getFromName($filename);
             $zip->close();
         }
     } else {
         print_error('type error');
     }
 }
    {
        $mform =& $this->_form;
        $mform->addElement('header', 'headersetjails', get_string('local_jail_servers', VPL));
        $mform->addElement('hidden', 'id', required_param('id', PARAM_INT));
        $mform->setType('id', PARAM_INT);
        $mform->addElement('textarea', 'jailservers', get_string('jail_servers_description', VPL), array('cols' => 45, 'rows' => 10, 'wrap' => 'off'));
        $mform->setType('jailservers', PARAM_RAW);
        $this->add_action_buttons();
    }
}
require_login();
$id = required_param('id', PARAM_INT);
$vpl = new mod_vpl($id);
$vpl->prepare_page('forms/local_jail_servers.php', array('id' => $id));
vpl_include_jsfile('hideshow.js');
$vpl->require_capability(VPL_SETJAILS_CAPABILITY);
$vpl->print_header(get_string('local_jail_servers', VPL));
$vpl->print_heading_with_help('local_jail_servers');
$vpl->print_configure_tabs(basename(__FILE__));
$mform = new mod_vpl_setjails_form('local_jail_servers.php');
//Display page
$course = $vpl->get_course();
if (!$mform->is_cancelled() && ($fromform = $mform->get_data())) {
    if (isset($fromform->jailservers)) {
        \mod_vpl\event\vpl_execution_localjails_updated::log($vpl);
        $instance = $vpl->get_instance();
        $instance->jailservers = s($fromform->jailservers);
        if ($DB->update_record(VPL, $instance)) {
            vpl_notice(get_string('saved', VPL));
        } else {
            vpl_error(get_string('notsaved', VPL));