}
//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);
$submissions = array();
$nsub = count($submissionslist);
foreach ($submissionslist as $submission) {
    if ($detailed) {
        $link = '#f' . $nsub;
    } else {
        $link = vpl_mod_href('forms/submissionview.php', 'id', $id, 'userid', $userid, 'submissionid', $submission->id);
    }
    $date = '<a href="' . $link . '">' . userdate($submission->datesubmitted) . '</a>';
    $sub = new mod_vpl_submission($vpl, $submission);
    $submissions[] = $sub;
    $table->data[] = array($nsub--, $date, s($sub->get_detail()));
}
echo '<div class="clearer"> </div>';
echo '<div style="text-align: center">';
echo '<img src="' . vpl_rel_url('submissionsgraph.php', 'id', $id, 'userid', $userid) . '" alt="files size evolution" />';
echo '</div>';
echo '<div class="clearer"> </div>';
echo '<div class="clearer"> </div>';
echo '<div style="text-align: center">';
echo '<img src="' . vpl_rel_url('workinggraph.php', 'id', $id, 'userid', $userid) . '" alt="workingperiods" />';
echo '</div>';
Ejemplo n.º 2
0
function vpl_print_recent_mod_activity($activity, $courseid, $detail, $modnames, $viewfullnames)
{
    //TODO improve
    global $CFG, $OUTPUT;
    echo '<table border="0" cellpadding="3" cellspacing="0" class="forum-recent">';
    echo "<tr><td class=\"userpicture\" valign=\"top\">";
    echo $OUTPUT->user_picture($activity->user);
    echo '</td><td>';
    echo '<div class="user">';
    $fullname = fullname($activity->user, $viewfullnames);
    echo "<a href=\"{$CFG->wwwroot}/user/view.php?id={$activity->user->id}&amp;course={$courseid}\">" . "{$fullname}</a> - ";
    $link = vpl_mod_href('forms/submissionview.php', 'id', $activity->cmid, 'userid', $activity->user->id, 'inpopup', 1);
    echo '<a href="' . $link . '">' . userdate($activity->timestamp) . '</a>';
    echo '</div>';
    echo "</td></tr></table>";
    return;
}
Ejemplo n.º 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();
Ejemplo n.º 4
0
                //If code detected
                $data = iconv($encode, 'UTF-8', $data);
            }
            $files[] = array('name' => $name, 'data' => $data);
        } else {
            if ($i < $minfiles) {
                //add empty file if required
                $files[] = array('name' => '', 'data' => '');
            }
        }
    }
    $error_message = '';
    if ($subid = $vpl->add_submission($userid, $files, $fromform->comments, $error_message)) {
        \mod_vpl\event\submission_uploaded::log(array('objectid' => $subid, 'context' => $vpl->get_context(), 'relateduserid' => $USER->id != $userid ? $userid : null));
        //if evaluate on submission
        if ($instance->evaluate && $instance->evaluateonsubmission) {
            notice(get_string('saved', VPL), vpl_mod_href('forms/evaluation.php', 'id', $id, 'userid', $userid));
        }
        notice(get_string('saved', VPL), vpl_mod_href('forms/submissionview.php', 'id', $id, 'userid', $userid));
    } else {
        echo $OUTPUT->box(get_string('notsaved', VPL));
        notice($error_message, vpl_mod_href('forms/submission.php', 'id', $id, 'userid', $userid), $vpl->get_course());
    }
}
//Display page
$data = new stdClass();
$data->id = $id;
$data->userid = $userid;
$mform->set_data($data);
$mform->display();
$vpl->print_footer();
Ejemplo n.º 5
0
 function definition()
 {
     global $CFG, $OUTPUT;
     $id = required_param('id', PARAM_INT);
     $userid = optional_param('userid', null, PARAM_INT);
     $inpopup = optional_param('inpopup', 0, PARAM_INT);
     $this->addHidden('id', $id);
     $this->addHidden('userid', $userid);
     $submissionid = optional_param('submissionid', 0, PARAM_INT);
     if ($submissionid > 0) {
         $this->addHidden('submissionid', $submissionid);
     }
     $this->addHidden('inpopup', $inpopup);
     $vpl_instance = $this->vpl->get_instance();
     //TODO Improve grade form (recalculate grade)
     //Show assesment criteria
     //Show others evaluation
     //Type value => introduce value
     $grade = $this->vpl->get_grade();
     if ($grade != 0) {
         $this->addHTML(s(get_string('grade') . ' '));
         if ($grade > 0) {
             $this->addText('grade', '', 6);
         } else {
             $this->addSelect('grade', $this->get_scale_selection());
         }
         $this->addHTML(' &nbsp;');
     }
     $this->addSubmitButton('save', get_string('grade'));
     if ($inpopup) {
         $this->addSubmitButton('savenext', get_string('gradeandnext', VPL));
     }
     $this->addSubmitButton('removegrade', get_string('removegrade', VPL));
     //tranfer files to teacher's work area
     $url = vpl_mod_href('forms/edit.php', 'id', $id, 'userid', $userid, 'privatecopy', 1);
     $options = array('height' => 550, 'width' => 780, 'directories' => 0, 'location' => 0, 'menubar' => 0, 'personalbar' => 0, 'status' => 0, 'toolbar' => 0);
     $action = new popup_action('click', $url, 'privatecopy' . $vpl_instance->id, $options);
     $this->addHTML($OUTPUT->action_link($url, get_string('copy', VPL), $action));
     if ($vpl_instance->evaluate) {
         //Link to recalculate numeric grade from comments
         $url = vpl_mod_href('forms/evaluation.php', 'id', $id, 'userid', $userid, 'grading', 1, 'inpopup', $inpopup);
         $html = ' <a href="' . $url . '">' . s(get_string('evaluate', VPL)) . '</a>';
         $this->addHTML($html);
     }
     //Numeric grade
     if ($grade > 0) {
         //Link to recalculate numeric grade from comments
         $jscript = 'VPL.calculateGrade(' . $grade . ')';
         $html = ' <a href="javascript:void(0);" onclick="' . $jscript . '">' . s(get_string('calculate', VPL)) . '</a>';
         $this->addHTML($html);
     }
     //TODO user similarity
     /*        $url=vpl_mod_href('similarity/user_similarity.php','id',$id,'userid',$userid);
             $html=link_to_popup_window($url,'similarity'.$id.'-'.$userid,get_string('similarity',VPL),800,900,null,null,true);
             $this->addHTML(' '.$html);*/
     $this->addHTML('<br />');
     if ($grade != 0) {
         $this->addHTML(s(get_string('comments', VPL)) . '<br />');
         $this->addTextArea('comments', '', 8, 70);
         $this->addHTML('<br />');
     }
     if (!empty($CFG->enableoutcomes)) {
         $grading_info = grade_get_grades($this->vpl->get_course()->id, 'mod', 'vpl', $vpl_instance->id, $userid);
         if (!empty($grading_info->outcomes)) {
             $this->addHTML('<table border="0">');
             foreach ($grading_info->outcomes as $oid => $outcome) {
                 $this->addHTML('<tr><td align="right">');
                 $options = make_grades_menu(-$outcome->scaleid);
                 $options[0] = get_string('nooutcome', 'grades');
                 $this->addHTML(s($outcome->name));
                 $this->addHTML('</td><td>');
                 $this->addSelect('outcome_grade_' . $oid, $options, $outcome->grades[$userid]->grade);
                 $this->addHTML('</td></tr>');
             }
             $this->addHTML('</table>');
         }
     }
 }
Ejemplo n.º 6
0
 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');
     }
 }
Ejemplo n.º 7
0
 if ($subinstance != null && $subinstance->vpl != $vpl->get_instance()->id) {
     print_error('invalidcourseid');
 }
 if ($USER->id == $userid) {
     $vpl->network_check();
     $vpl->password_check();
 }
 //Print header
 $PAGE->requires->css(new moodle_url('/mod/vpl/css/sh.css'));
 $PAGE->requires->css(new moodle_url('/mod/vpl/editor/VPLIDE.css'));
 $vpl->print_header(get_string('submissionview', VPL));
 $vpl->print_view_tabs(basename(__FILE__));
 //Display submission
 //Check consistence
 if (!$subinstance) {
     notice(get_string('nosubmission', VPL), vpl_mod_href('view.php', 'id', $id, 'userid', $userid));
 }
 $submissionid = $subinstance->id;
 if ($vpl->is_inconsistent_user($subinstance->userid, $userid)) {
     print_error('vpl submission user inconsistence');
 }
 if ($vpl->get_instance()->id != $subinstance->vpl) {
     print_error('vpl submission vpl inconsistence');
 }
 $submission = new mod_vpl_submission($vpl, $subinstance);
 if ($vpl->get_visiblegrade() || $vpl->has_capability(VPL_GRADE_CAPABILITY)) {
     if ($submission->is_graded()) {
         echo '<h2>' . get_string('grade') . '</h2>';
         $submission->print_grade(true);
     }
 }
Ejemplo n.º 8
0
 /**
  * Show vpl submission restriction
  **/
 function print_submission_restriction()
 {
     global $CFG, $USER;
     //TODO print_submission_restriction
     $filegroup = $this->get_required_fgm();
     $files = $filegroup->getFileList();
     if (count($files)) {
         $text = '';
         $need_comma = false;
         foreach ($files as $file) {
             if ($need_comma) {
                 $text .= ', ';
             }
             $text .= s($file);
             $need_comma = true;
         }
         $link = ' (<a href="';
         $link .= vpl_mod_href('views/downloadrequiredfiles.php', 'id', $this->get_course_module()->id);
         $link .= '">';
         $link .= get_string('download', VPL);
         $link .= '</a>)';
         $this->print_restriction('requestedfiles', $text . $link);
     }
     if (count($files) != $this->instance->maxfiles) {
         $this->print_restriction('maxfiles');
     }
     if ($this->instance->maxfilesize) {
         $mfs = $this->get_maxfilesize();
         $this->print_restriction('maxfilesize', vpl_conv_size_to_string($mfs));
     }
     $worktype = $this->instance->worktype;
     $values = array(0 => get_string('individualwork', VPL), 1 => get_string('groupwork', VPL));
     if ($worktype) {
         $this->print_restriction('worktype', $values[$worktype] . ' ' . $this->fullname($USER));
     } else {
         $this->print_restriction('worktype', $values[$worktype]);
     }
     if ($this->has_capability(VPL_GRADE_CAPABILITY)) {
         $str_yes = get_string('yes');
         $str_no = get_string('no');
         require_once $CFG->libdir . '/gradelib.php';
         if ($gie = $this->get_grade_info()) {
             if ($gie->scaleid == 0) {
                 $info = get_string('grademax', 'core_grades') . ': ' . vpl_rtzeros($gie->grademax);
                 $info .= $gie->hidden ? ' <b>' . get_string('hidden', 'core_grades') . '</b>' : '';
                 $info .= $gie->locked ? ' <b>' . get_string('locked', 'core_grades') . '</b>' : '';
             } else {
                 $info = get_string('typescale', 'core_grades');
             }
             $this->print_restriction(get_String('gradessettings', 'core_grades'), $info, true);
         } else {
             $this->print_restriction(get_String('gradessettings', 'core_grades'), get_string('nograde'), true);
         }
         if (trim($this->instance->password) > '') {
             $this->print_restriction(get_string('password'), $str_yes, true);
         }
         if (trim($this->instance->requirednet) > '') {
             $this->print_restriction('requirednet', s($this->instance->requirednet));
         }
         if ($this->instance->restrictededitor) {
             $this->print_restriction('restrictededitor', $str_yes);
         }
         if ($this->instance->example) {
             $this->print_restriction('isexample', $str_yes);
         }
         if (!$this->get_course_module()->visible) {
             $this->print_restriction(get_string('visible'), $str_no, true);
         }
         if ($this->instance->basedon) {
             $basedon = new mod_vpl(null, $this->instance->basedon);
             $link = '<a href="';
             $link .= vpl_mod_href('view.php', 'id', $basedon->cm->id);
             $link .= '">';
             $link .= $basedon->get_printable_name();
             $link .= '</a>';
             $this->print_restriction('basedon', $link);
         }
         $noyes = array($str_no, $str_yes);
         $this->print_restriction('run', $noyes[$this->instance->run], false, false);
         if ($this->instance->debug) {
             $this->print_restriction('debug', $noyes[1], false, false);
         }
         $this->print_restriction('evaluate', $noyes[$this->instance->evaluate], false, !($this->instance->evaluate && $this->instance->evaluateonsubmission));
         if ($this->instance->evaluate && $this->instance->evaluateonsubmission) {
             $this->print_restriction('evaluateonsubmission', $noyes[1]);
         }
         if ($this->instance->automaticgrading) {
             $this->print_restriction('automaticgrading', $noyes[1], false, false);
         }
         if ($this->instance->maxexetime) {
             $this->print_restriction('maxexetime', $this->instance->maxexetime . ' s', false, false);
         }
         if ($this->instance->maxexememory) {
             $this->print_restriction('maxexememory', vpl_conv_size_to_string($this->instance->maxexememory), false, false);
         }
         if ($this->instance->maxexefilesize) {
             $this->print_restriction('maxexefilesize', vpl_conv_size_to_string($this->instance->maxexefilesize), false, false);
         }
         if ($this->instance->maxexeprocesses) {
             $this->print_restriction('maxexeprocesses', null, false, false);
         }
     }
 }
Ejemplo n.º 9
0
 /**
  * Print sudmission info
  *
  */
 function print_info($autolink = false)
 {
     //TODO improve show submission info
     global $OUTPUT;
     $id = $this->vpl->get_course_module()->id;
     $userid = $this->instance->userid;
     $submissionid = $this->instance->id;
     if ($autolink) {
         $url = vpl_mod_href('forms/submissionview.php', 'id', $id, 'userid', $userid, 'submissionid', $submissionid);
         echo '<a href="' . $url . '">';
     }
     $subdate = userdate($this->instance->datesubmitted);
     p(get_string('submittedonp', VPL, $subdate));
     if ($autolink) {
         echo '</a>';
     }
     $url = vpl_mod_href('views/downloadsubmission.php', 'id', $id, 'userid', $userid, 'submissionid', $submissionid);
     echo ' (<a href="' . $url . '">' . get_string('download', VPL);
     echo '</a>)';
     //Show evaluation link
     $ce = $this->getCE();
     if ($this->vpl->get_instance()->evaluate && !$this->is_graded()) {
         $url = vpl_mod_href('forms/evaluation.php', 'id', $id, 'userid', $userid);
         echo ' (<a href="' . $url . '">' . get_string('evaluate', VPL);
         echo '</a>)';
     }
     echo '<br />';
     $commmets = $this->instance->comments;
     if ($commmets > '') {
         echo '<br />';
         echo get_string('comments', VPL);
         echo $OUTPUT->box($commmets);
     }
 }
Ejemplo n.º 10
0
                }
            }
            $grade_form->set_data($data);
            echo '<div id="vpl_grade_view" style="height:220px">';
            echo '<div id="vpl_grade_form" style="float:left">';
            $grade_form->display();
            echo '</div>';
            echo '<div id="vpl_grade_comments" style="float:left;width:40%;overflow:auto">';
            $comments = $vpl->get_grading_help();
            if ($comments > '') {
                echo $OUTPUT->box_start();
                echo '<b>' . get_string('listofcomments', VPL) . '</b><hr />';
                echo $comments;
                echo $OUTPUT->box_end();
            }
            echo '</div>';
            echo '</div>';
            echo '<div id="vpl_submission_view" style="clear:both;overflow:auto;" >';
            echo '<hr />';
            $vpl->print_variation($subinstance->userid);
            $submission->print_submission();
            echo '</div>';
            $jscript .= 'VPL.hlrow(' . $submissionid . ');';
            $jscript .= 'window.onunload= function(){VPL.unhlrow(' . $submissionid . ');};';
        }
    }
} else {
    vpl_inmediate_redirect(vpl_mod_href('forms/submissionview.php', 'id', $id, 'userid', $userid));
}
$vpl->print_footer_simple();
echo vpl_include_js($jscript);
Ejemplo n.º 11
0
 /**
  * Print student sudmission info
  *
  */
 function student_print_info($autolink = false)
 {
     //TODO improve show submission info
     global $OUTPUT, $CFG;
     $id = $this->vpl->get_course_module()->id;
     $userid = $this->instance->userid;
     $submissionid = $this->instance->id;
     if ($autolink) {
         $url = $CFG->wwwroot . '/teacher/studentsubmissionview.php?id=' . $id . '&userid=' . $userid . '&submissionid=' . $submissionid;
         //$url=vpl_mod_href('forms/studentsubmissionview.php','id',$id,
         //'userid',$userid,'submissionid',$submissionid);
         echo '<a target="_blank" href="' . $url . '">';
     }
     $subdate = userdate($this->instance->datesubmitted);
     p(get_string('submittedonp', VPL, $subdate));
     if ($autolink) {
         echo '</a>';
     }
     $url = vpl_mod_href('views/downloadsubmission.php', 'id', $id, 'userid', $userid, 'submissionid', $submissionid);
     echo ' (<a href="' . $url . '">' . get_string('download', VPL);
     echo '</a>)';
     /*$commmets = $this->instance->comments;
       if($commmets>''){
           echo '<br />';
           echo get_string('comments',VPL);
           echo $OUTPUT->box($commmets);
       }*/
 }
Ejemplo n.º 12
0
        $statusNum=0;
    }
    else{
	if($display_flag){
        if($loginstatus){
            $subCount++;
        }

	}
        $submission = $data->submission;
        $subinstance = $submission->get_instance();
        $hrefview=vpl_mod_href('forms/submissionview.php','id',$id,
            'userid',$subinstance->userid,'inpopup',1);
        $hrefprev=vpl_mod_href('views/previoussubmissionslist.php','id',$id,
            'userid',$subinstance->userid,'inpopup',1);
        $hrefgrade=vpl_mod_href('forms/gradesubmission.php','id',$id,
            'userid',$subinstance->userid,'inpopup',1);
        $subtime=userdate($subinstance->datesubmitted);
        if($subinstance->nsubmissions>0){
            $prev = $OUTPUT->action_link($hrefprev,
                $subinstance->nsubmissions);
	        $nsub=$subinstance->nsubmissions;
        }else{
            $prev='';
        }
        if($subinstance->dategraded>0){
            $text = $submission->print_grade_core();

            //Add propossed grade diff
            $result=$submission->getCE();
            if($result['executed']!==0){
                $prograde=$submission->proposedGrade($result['execution']);
Ejemplo n.º 13
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));
}
 public function get_link()
 {
     global $OUTPUT;
     $text = '<spam class="vpl_sim' . (int) $this->get_level1() . '">';
     $text .= (int) $this->s1;
     $text .= '</spam>';
     $text .= '|';
     $text .= '<spam class="vpl_sim' . (int) $this->get_level2() . '">';
     $text .= (int) $this->s2;
     $text .= '</spam>';
     $text .= '|';
     $text .= '<spam class="vpl_sim' . (int) $this->get_level3() . '">';
     $text .= (int) $this->s3;
     $text .= '</spam>';
     if ($this->first->can_access() && $this->second->can_access()) {
         $url = vpl_mod_href('similarity/diff.php', 'id', required_param('id', PARAM_INT));
         foreach ($this->first->link_parms('1') as $parm => $value) {
             $url = vpl_url_add_param($url, $parm, $value);
         }
         foreach ($this->second->link_parms('2') as $parm => $value) {
             $url = vpl_url_add_param($url, $parm, $value);
         }
         $options = array('height' => 800, 'width' => 900, 'directories' => 0, 'location' => 0, 'menubar' => 0, 'personalbar' => 0, 'status' => 0, 'toolbar' => 0);
         $action = new popup_action('click', $url, 'viewdiff' . $this->id, $options);
         $HTML = $OUTPUT->action_link($url, $text, $action);
     } else {
         $HTML = $text;
     }
     $HTML .= $this->s1 >= self::$min_s1 ? '*' : '';
     $HTML .= $this->s2 >= self::$min_s2 ? '*' : '';
     $HTML .= $this->s3 >= self::$min_s3 ? '*' : '';
     $HTML = '<div class="vpl_sim' . (int) $this->get_level() . '">' . $HTML . '</div>';
     return $HTML;
 }
Ejemplo n.º 15
0
        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);
        $DB->update_record(VPL, $fromform);
        vpl_inmediate_redirect($href);
Ejemplo n.º 16
0
$nwm = 0;
foreach ($list as $userinfo) {
    if (isset($submissions[$userinfo->id])) {
        $origin = '';
        $subinstance = $submissions[$userinfo->id];
        $submission = new mod_vpl_submission($vpl, $subinstance);
        $subf = $submission->get_submitted_fgm();
        $filelist = $subf->getFileList();
        foreach ($filelist as $filename) {
            $data = $subf->getFileData($filename);
            $wm = vpl_watermark::getwm($data);
            if ($wm) {
                if ($wm != $userinfo->id) {
                    $user_origin = $DB->get_record('user', array('id' => $wm));
                    if ($user_origin) {
                        $origin .= '<a href="' . vpl_mod_href('/forms/submissionview.php', 'id', $id, 'userid', $wm) . '">';
                        $origin .= s($filename) . ' ';
                        $origin .= '</a>';
                        $origin .= ' <a href="' . vpl_abs_href('/user/view.php', 'id', $wm, 'course', $course->id) . '">';
                        $origin .= $vpl->fullname($user_origin) . '</a>';
                    }
                } else {
                    $nwm++;
                }
            }
        }
        if ($origin == '') {
            continue;
        }
        $usernumber++;
        $table->data[] = array($usernumber, $vpl->user_fullname_picture($userinfo), $origin);