HEX
Server: Apache
System: Linux webm010.cluster103.gra.hosting.ovh.net 6.18.42-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Wed Aug 5 15:59:48 CEST 2026 x86_64
User: iestorre (46869)
PHP: 8.0.30
Disabled: _dyuweyrj4,_dyuweyrj4r,dl
Upload Files
File: /home/i/e/s/iestorre/moodleAW/moodle310/mod/assignment/view.php
<?php

require_once("../../config.php");

$id = optional_param('id', 0, PARAM_INT);  // Course Module ID.
$a  = optional_param('a', 0, PARAM_INT);   // Assignment ID.

require_login();
$PAGE->set_context(context_system::instance());

if (!$id && !$a) {
    print_error('invalidcoursemodule');
}

$mapping = null;
if ($id) {
    $mapping = $DB->get_record('assignment_upgrade', array('oldcmid' => $id), '*', IGNORE_MISSING);
} else {
    $mapping = $DB->get_record('assignment_upgrade', array('oldinstance' => $a), '*', IGNORE_MISSING);
}

if (!$mapping) {
    $url = '';
    if (has_capability('moodle/site:config', context_system::instance())) {
        $url = new moodle_url('/admin/tool/assignmentupgrade/listnotupgraded.php');
    }
    print_error('assignmentneedsupgrade', 'assignment', $url);
}

$url = new moodle_url('/mod/assign/view.php', array('id' => $mapping->newcmid));
redirect($url);