Example #1
0
<body>';
$subselection = vpl_get_set_session_var('subselection','allsubmissions','selection');
$options = array('height' => 550, 'width' => 780, 'directories' =>0, 'location' =>0, 'menubar'=>0,
    'personalbar'=>0,'status'=>0,'toolbar'=>0);
$group = optional_param('group', -1, PARAM_INT);
$sort = 'dategraded';
$sortdir = 'up';

//print_r($secname);

//$loggedinusers=get_loggedin_users_by_section($secname);
    $loggedinstudents=0;
//print_r($acivitystatus);

$vpl = new mod_vpl($id);
$vpl->prepare_page('views/submissionslist.php',array('id' => $id));

$course = $vpl->get_course();
$cm = $vpl->get_course_module();
$context_module = $vpl->get_context();

//get students
$currentgroup = groups_get_activity_group($cm, true);
if(!$currentgroup){
    $currentgroup='';
}
$list = $vpl->get_students($currentgroup);
   // var_dump (count($list));
$submissions = $vpl->all_last_user_submission();
$submissions_number = $vpl->get_submissions_number();
Example #2
0
//Browser must reload page
vpl_editor_util::generate_requires();
require_login();
$id = required_param('id', PARAM_INT);
$userid = optional_param('userid', FALSE, PARAM_INT);
$copy = optional_param('privatecopy', false, PARAM_INT);
$subid = optional_param('submissionid', false, PARAM_INT);
$vpl = new mod_vpl($id);
$page_parms = array('id' => $id);
if ($userid && !$copy) {
    $page_parms['userid'] = $userid;
}
if ($copy) {
    $page_parms['privatecopy'] = 1;
}
$vpl->prepare_page('forms/edit.php', $page_parms);
if (!$vpl->is_visible()) {
    notice(get_string('notavailable'));
}
if (!$vpl->is_submit_able()) {
    print_error('notavailable');
}
if (!$userid || $userid == $USER->id) {
    //Edit own submission
    $userid = $USER->id;
    $vpl->require_capability(VPL_SUBMIT_CAPABILITY);
} else {
    //Edit other user submission
    $vpl->require_capability(VPL_MANAGE_CAPABILITY);
}
$vpl->network_check();
        return $error;
    } else {
        curl_close($ch);
        return json_decode($raw_response);
    }
}
function vpl_call_print($res)
{
    echo '<pre>';
    s(print_r($res, false));
    echo '</pre>';
}
$id = required_param('id', PARAM_INT);
$vpl = new mod_vpl($id);
$vpl->require_capability(VPL_MANAGE_CAPABILITY);
$vpl->prepare_page('tests/webservice_client.php', array('id' => $id));
$vpl->print_header('Web service test client');
echo '<h1>Web service test client</h1>';
echo '<h3>Session token generated (or reused)</h3>';
echo s(vpl_get_webservice_token($vpl));
$service_url = vpl_get_webservice_urlbase($vpl);
echo '<h3>Base URL for web service</h3>';
echo s($service_url);
echo '<h3>Get info from activity</h3>';
$res = vpl_call_service($service_url, 'mod_vpl_info');
vpl_call_print($res);
echo '<h3>Get last submission</h3>';
$res = vpl_call_service($service_url, 'mod_vpl_open');
vpl_call_print($res);
echo '<h3>Modify and save last submission</h3>';
if (isset($res->files)) {
Example #4
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/>.
/**
 * Check jail servers
 * @package mod_vpl
 * @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__) . '/../vpl.class.php';
require_once dirname(__FILE__) . '/../jail/jailserver_manager.class.php';
require_login();
$id = required_param('id', PARAM_INT);
$vpl = new mod_vpl($id);
$vpl->prepare_page('views/checkjailservers.php', array('id' => $id));
$vpl->require_capability(VPL_MANAGE_CAPABILITY);
//Display page
$PAGE->requires->css(new moodle_url('/mod/vpl/css/checkjailservers.css'));
$course = $vpl->get_course();
$vpl->print_header(get_string('check_jail_servers', VPL));
$vpl->print_heading_with_help('check_jail_servers');
$vpl->print_configure_tabs(basename(__FILE__));
\mod_vpl\event\vpl_jail_servers_tested::log($vpl);
$servers = vpl_jailserver_manager::check_servers($vpl->get_instance()->jailservers);
$table = new html_table();
$table->head = array('#', get_string('server', VPL), get_string('currentstatus', VPL), get_string('lasterror', VPL), get_string('lasterrordate', VPL), get_string('totalnumberoferrors', VPL));
$table->align = array('right', 'left', 'left', 'left', 'left', 'right');
$table->data = array();
$num = 0;
$clean_url = !$vpl->has_capability(VPL_SETJAILS_CAPABILITY) || !$vpl->has_capability(VPL_MANAGE_CAPABILITY);
Example #5
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();
 *
 * @package mod_vpl
 * @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);
Example #7
0
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_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) {
 * @package mod_vpl. Process submission form
 * @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__) . '/submission_form.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 = 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();
Example #9
0
 * List water marks in vpl submission
 *
 * @package mod_vpl
 * @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_once dirname(__FILE__) . '/watermark.php';
require_login();
$id = required_param('id', PARAM_INT);
$vpl = new mod_vpl($id);
$vpl->prepare_page('similarity/listwatermark.php', array('id' => $id));
$course = $vpl->get_course();
$vpl->require_capability(VPL_SIMILARITY_CAPABILITY);
\mod_vpl\event\vpl_watermark_report_viewed::log($vpl);
//Print header
$vpl->print_header(get_string('listwatermarks', VPL));
$vpl->print_view_tabs(basename(__FILE__));
$list = $vpl->get_students();
$firstname = get_string('firstname');
$lastname = get_string('lastname');
if ($CFG->fullnamedisplay == 'lastname firstname') {
    // for better view (dlnsk)
    $name = $lastname . ' / ' . $firstname;
} else {
    $name = $firstname . ' / ' . $lastname;
}
Example #10
0
        $mform->setDefault('description', '');
        $buttongroup = array();
        $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;
Example #11
0
 * @version        $Id: testcasesfile.php,v 1.3 2013-06-10 08:15:42 juanca Exp $
 * @package mod_vpl. Edit test cases' file
 * @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__) . '/../editor/editor_utility.php';
vpl_editor_util::generate_requires();
require_login();
$id = required_param('id', PARAM_INT);
$vpl = new mod_vpl($id);
$instance = $vpl->get_instance();
$vpl->prepare_page('forms/testcasesfile.php', array('id' => $id));
$vpl->require_capability(VPL_MANAGE_CAPABILITY);
$fgp = $vpl->get_required_fgm();
$vpl->print_header(get_string('testcases', VPL));
$vpl->print_heading_with_help('testcases');
$vpl->print_configure_tabs(basename(__FILE__));
$options = array();
$options['restrictededitor'] = false;
$options['save'] = true;
$options['run'] = false;
$options['debug'] = false;
$options['evaluate'] = false;
$options['ajaxurl'] = "testcasesfile.json.php?id={$id}&action=";
$options['download'] = "../views/downloadexecutionfiles.php?id={$id}";
$options['resetfiles'] = false;
$options['minfiles'] = 1;
Example #12
0
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// 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/>.
/**
 * Similarity form
 *
 * @package mod_vpl
 * @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_once dirname(__FILE__) . '/watermark.php';
require_once $CFG->libdir . '/formslib.php';
require_once dirname(__FILE__) . '/similarity_form.class.php';
$id = required_param('id', PARAM_INT);
$vpl = new mod_vpl($id);
$vpl->prepare_page('similarity/similarity_form.php', array('id' => $id));
$vpl->require_capability(VPL_SIMILARITY_CAPABILITY);
\mod_vpl\event\vpl_similarity_form_viewed::log($vpl);
//Print header
$vpl->print_header(get_string('similarity', VPL));
$vpl->print_view_tabs(basename(__FILE__));
$form = new vpl_similarity_form('listsimilarity.php', $vpl);
$form->display();
$vpl->print_footer();
    }
    function definition()
    {
        $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));
Example #14
0
 * Atomatic evaluation from link
 * @package mod_vpl
 * @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
Example #15
0
require_once dirname(__FILE__) . '/../../config.php';
require_once dirname(__FILE__) . '/locallib.php';
require_once dirname(__FILE__) . '/vpl.class.php';
global $CFG, $PGAE;
/******************* BY ANUSHA ************************
FOR HIDING LEFT SIDE NAVIGATION *********************/
$context = context_course::instance($COURSE->id);
if (user_has_role_assignment($USER->id, 5)) {
    $PAGE->requires->css('/student/custom.css');
}
require_login();
$id = optional_param('id', null, PARAM_INT);
// Course Module ID, or
//$a  = optional_param('a', null, PARAM_INT);  // vpl ID
$vpl = new mod_vpl($id);
$vpl->prepare_page('view.php', array('id' => $id));
$vpl->require_capability(VPL_VIEW_CAPABILITY);
$id = $vpl->get_course_module()->id;
$log_url = vpl_rel_url('view.php', 'id', $id);
if (!$vpl->is_visible()) {
    notice(get_string('notavailable'));
}
if (!$vpl->has_capability(VPL_MANAGE_CAPABILITY) && !$vpl->has_capability(VPL_GRADE_CAPABILITY)) {
    $vpl->network_check();
    $vpl->password_check();
    $userid = $USER->id;
} else {
    $userid = optional_param('userid', $USER->id, PARAM_INT);
}
\mod_vpl\event\vpl_description_viewed::log($vpl);
// Print the page header
Example #16
0
 * @version        $Id: requiredfiles.php,v 1.2 2013-06-10 08:15:42 juanca Exp $
 * @package mod_vpl
 * @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__) . '/../editor/editor_utility.php';
vpl_editor_util::generate_requires();
require_login();
$id = required_param('id', PARAM_INT);
$vpl = new mod_vpl($id);
$instance = $vpl->get_instance();
$vpl->prepare_page('forms/requiredfiles.php', array('id' => $id));
$vpl->require_capability(VPL_MANAGE_CAPABILITY);
$fgp = $vpl->get_required_fgm();
$vpl->print_header(get_string('requestedfiles', VPL));
$vpl->print_heading_with_help('requestedfiles');
$vpl->print_configure_tabs(basename(__FILE__));
//TODO download in zip file
$options = array();
$options['restrictededitor'] = false;
$options['save'] = true;
$options['run'] = false;
$options['debug'] = false;
$options['evaluate'] = false;
$options['ajaxurl'] = "requiredfiles.json.php?id={$id}&action=";
$options['download'] = "../views/downloadrequiredfiles.php?id={$id}";
$options['resetfiles'] = false;
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_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');
require_login();
$id = required_param('id', PARAM_INT);
$time_limit = 600;
// 10 minutes
$vpl = new mod_vpl($id);
$vpl->prepare_page('similarity/listsimilarity.php', array('id' => $id));
$vpl->require_capability(VPL_SIMILARITY_CAPABILITY);
\mod_vpl\event\vpl_similarity_report_viewed::log($vpl);
//Print header
$PAGE->requires->css(new moodle_url('/mod/vpl/css/similarity.css'));
$vpl->print_header(get_string('listsimilarity', VPL));
$vpl->print_view_tabs(basename(__FILE__));
$form = new vpl_similarity_form('listsimilarity.php', $vpl);
if (!($fromform = $form->get_data())) {
    print_error('readingdata', VPL);
}
//Get filelist names to scan
$filesselected = array();
$filelist = $vpl->get_required_fgm()->getFileList();
$num = 0;
foreach ($filelist as $filename) {
        $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));
    echo $OUTPUT->box($e->getMessage());
    $vpl->print_footer();
}
        $mform->addElement('header', 'header_keepfiles', get_string('keepfiles', VPL));
        $list = $this->fgp->getFileList();
        $keeplist = $this->fgp->getFileKeepList();
        $num = 0;
        foreach ($list as $filename) {
            $mform->addElement('checkbox', 'keepfile' . $num, $filename);
            $mform->setDefault('keepfile' . $num, in_array($filename, $keeplist));
            $num++;
        }
        $mform->addElement('submit', 'savekeepfiles', get_string('saveoptions', VPL));
    }
}
require_login();
$id = required_param('id', PARAM_INT);
$vpl = new mod_vpl($id);
$vpl->prepare_page('forms/executionkeepfiles.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('keepfiles');
$vpl->print_configure_tabs(basename(__FILE__));
$course = $vpl->get_course();
$fgp = $vpl->get_execution_fgm();
$mform = new mod_vpl_executionkeepfiles_form('executionkeepfiles.php', $fgp);
if ($fromform = $mform->get_data()) {
    if (isset($fromform->savekeepfiles)) {
        $list = $fgp->getFileList();
        $nlist = count($list);
        $keeplist = array();
        for ($i = 0; $i < $nlist; $i++) {
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// 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 a graph that represent for an antivity the time dedicated by student
 *
 * @package mod_vpl
 * @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_login();
$id = required_param('id', PARAM_INT);
$vpl = new mod_vpl($id);
$vpl->prepare_page('views/activityworkinggraph.php', array('id' => $id));
$course = $vpl->get_course();
$instance = $vpl->get_instance();
$vpl->require_capability(VPL_GRADE_CAPABILITY);
//Print header
$vpl->print_header_simple();
echo '<div class="clearer"> </div>';
echo '<div style="text-align: center">';
echo '<img src="' . vpl_rel_url('workinggraph.php', 'id', $id, 'userid', -1) . '" alt="Working periods" />';
echo '</div>';
$vpl->print_footer_simple();
Example #21
0
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// 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/>.
/**
 * Redirect grade.php
 *
 * @package mod_vpl
 * @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__) . '/lib.php';
require_once dirname(__FILE__) . '/vpl.class.php';
require_login();
$id = required_param('id', PARAM_INT);
$vpl = new mod_vpl($id);
$vpl->prepare_page('grade.php', array('id' => $id));
$vpl->print_header();
if ($vpl->has_capability(VPL_GRADE_CAPABILITY)) {
    $userid = optional_param('userid', false, PARAM_INT);
    if ($userid) {
        vpl_inmediate_redirect(vpl_mod_href('forms/gradesubmission.php', 'id', $id, 'userid', $userid));
    } else {
        vpl_inmediate_redirect(vpl_mod_href('views/submissionslist.php', 'id', $id));
    }
} else {
    vpl_inmediate_redirect(vpl_mod_href('view.php', 'id', $id));
}
        $mform->setDefault('debug', $instance->debug);
        $mform->addElement('selectyesno', 'evaluate', get_string('evaluate', VPL));
        $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;
Example #23
0
// GNU General Public License for more details.
//
// 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 two files diff
 *
 * @package mod_vpl
 * @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__) . '/diff.class.php';
require_login();
$id = required_param('id', PARAM_INT);
$vpl = new mod_vpl($id);
$vpl->prepare_page('similarity/diff.php', array('id' => $id));
//Print header
$PAGE->requires->css(new moodle_url('/mod/vpl/css/sh.css'));
$vpl->print_header_simple(get_string('diff', VPL));
//$vpl->print_view_tabs(basename(__FILE__));
//Get left file
vpl_diff::vpl_get_similfile('1', $vpl, $HTMLheader1, $filename1, $data1);
//Get right file
vpl_diff::vpl_get_similfile('2', $vpl, $HTMLheader2, $filename2, $data2);
//Show files
vpl_diff::show($filename1, $data1, $HTMLheader1, $filename2, $data2, $HTMLheader2);
$vpl->print_footer();