Ejemplo n.º 1
0
    $summative_lock = false;
}
$properties = PaperProperties::get_paper_properties_by_id($paperID, $mysqli, $string);
// Redirect students to their page.
if ($userObject->has_role('Student') and !$userObject->has_role(array('Staff', 'Admin', 'SysAdmin'))) {
    if ($properties->get_paper_type() == '2') {
        // Display 'Page not Found' for summative exams. For these go to the proper summative exam homepage.
        $msg = sprintf($string['furtherassistance'], $configObject->get('support_email'), $configObject->get('support_email'));
        $notice->display_notice_and_exit($mysqli, $string['pagenotfound'], $msg, $string['accessdenied'], '/artwork/page_not_found.png', '#C00000', true, true);
    } else {
        header("location: user_index.php?id=" . $properties->get_crypt_name());
        exit;
    }
}
// Can the user acsess the paper?
$paper_ownerID = Paper_utils::get_ownerID($paperID, $mysqli);
$on_staff_module = false;
if ($userObject->has_role('SysAdmin') or $paper_ownerID == $userObject->get_user_ID()) {
    $on_staff_module = true;
} else {
    $paper_modules = Paper_utils::get_modules($paperID, $mysqli);
    foreach ($paper_modules as $paper_moduleID => $paper_module) {
        if ($userObject->is_staff_user_on_module($paper_moduleID)) {
            $on_staff_module = true;
        }
    }
}
if ($on_staff_module == false and !in_array('SYSTEM', array_values($paper_modules))) {
    $msg = sprintf($string['furtherassistance'], $configObject->get('support_email'), $configObject->get('support_email'));
    $notice->display_notice_and_exit($mysqli, $string['pagenotfound'], $msg, $string['accessdenied'], '/artwork/page_not_found.png', '#C00000', true, true);
}