Ejemplo n.º 1
0
function checkPermission($permission)
{
    global $getSiteURI;
    global $cid;
    global $uid;
    $URL = $getSiteURI . "/index/user/{$uid}";
    $data = http_get($URL, true);
    $data = json_decode($data, true);
    $found = false;
    foreach ($data['courses'] as $key => $course) {
        if ($course['course']['id'] == $cid) {
            $data['courses'] = array($course);
            $found = true;
            break;
        }
    }
    if (!$found) {
        $data['courses'] = array();
    }
    $user_course_data = $data;
    Authentication::checkRights($permission, $cid, $uid, $user_course_data);
}
Ejemplo n.º 2
0
<?php

/**
 * @file Condition.php
 * Constructs the page that is displayed when managing exam conditions.
 *
 * @author Felix Schmidt
 * @author Florian Lücke
 * @author Ralf Busch
 */
include_once dirname(__FILE__) . '/include/Boilerplate.php';
include_once dirname(__FILE__) . '/../Assistants/Structures.php';
global $globalUserData;
Authentication::checkRights(PRIVILEGE_LEVEL::ADMIN, $cid, $uid, $globalUserData);
$langTemplate = 'Condition_Controller';
Language::loadLanguageFile('de', $langTemplate, 'json', dirname(__FILE__) . '/');
$notifications = array();
if (isset($_POST['action'])) {
    // creates a new course
    if ($_POST['action'] == "SetCondition") {
        // bool which is true if any error occured
        $RequestError = false;
        foreach ($_POST as $key => $value) {
            // skips the first POST which includes the 'action' type
            if ($key == "action") {
                continue;
            }
            // changes the percentage for each exercise type
            $approvalConditionId = $key;
            $percentage = cleanInput($value);
            if (is_numeric($percentage) && $percentage >= 0 && $percentage <= 100) {
Ejemplo n.º 3
0
<?php

/**
 * @file Lecturer.php
 * Constructs the page that is displayed to a lecturer.
 *
 * @author Felix Schmidt
 * @author Florian Lücke
 * @author Ralf Busch
 */
include_once dirname(__FILE__) . '/include/Boilerplate.php';
include_once dirname(__FILE__) . '/../Assistants/Structures.php';
include_once dirname(__FILE__) . '/../Assistants/LArraySorter.php';
global $globalUserData;
Authentication::checkRights(PRIVILEGE_LEVEL::LECTURER, $cid, $uid, $globalUserData);
$langTemplate = 'Lecturer_Controller';
Language::loadLanguageFile('de', $langTemplate, 'json', dirname(__FILE__) . '/');
$sheetNotifications = array();
if (isset($_POST['action'])) {
    if ($_POST['action'] == "ExerciseSheetLecturer" && isset($_POST['deleteSheetWarning'])) {
        $sheetNotifications[$_POST['deleteSheetWarning']][] = MakeNotification("warning", Language::Get('main', 'askDeleteSheet', $langTemplate));
    } elseif ($_POST['action'] == "ExerciseSheetLecturer" && isset($_POST['deleteSheet'])) {
        $URL = $logicURI . "/exercisesheet/exercisesheet/{$_POST['deleteSheet']}";
        $result = http_delete($URL, true, $message);
        if ($message == 201) {
            $sheetNotifications[$_POST['deleteSheet']][] = MakeNotification('success', Language::Get('main', 'successDeleteSheet', $langTemplate));
        } else {
            $sheetNotifications[$_POST['deleteSheet']][] = MakeNotification('error', Language::Get('main', 'errorDeleteSheet', $langTemplate));
        }
    }
}
Ejemplo n.º 4
0
 * to create new courses.
 *
 * @author Felix Schmidt
 * @author Florian Lücke
 * @author Ralf Busch
 *
 * @todo POST Request to logic instead of DB
 * @todo check rights for whole page
 * @todo create a navigation bar for super admins
 * @todo unset $_POST on success
 */
include_once dirname(__FILE__) . '/include/Boilerplate.php';
include_once dirname(__FILE__) . '/../Assistants/Structures.php';
include_once dirname(__FILE__) . '/include/FormEvaluator.php';
global $globalUserData;
Authentication::checkRights(PRIVILEGE_LEVEL::SUPER_ADMIN, null, $uid, $globalUserData);
$langTemplate = 'MainSettings_Controller';
Language::loadLanguageFile('de', $langTemplate, 'json', dirname(__FILE__) . '/');
// load Plugins data from LogicController
$URI = $serverURI . "/logic/LExtension/link/extension";
$temp = http_get($URI, true);
$plugins_data = json_decode($temp, true);
if (isset($_POST['action'])) {
    // creates a new course
    if ($_POST['action'] == "CreateCourse") {
        $f = new FormEvaluator($_POST);
        $f->checkStringForKey('courseName', FormEvaluator::REQUIRED, 'warning', Language::Get('main', 'invalidCourseName', $langTemplate), array('min' => 1));
        $f->checkStringForKey('semester', FormEvaluator::REQUIRED, array('min' => 1), 'warning', Language::Get('main', 'invalidSemester', $langTemplate));
        $f->checkIntegerForKey('defaultGroupSize', FormEvaluator::REQUIRED, 'warning', Language::Get('main', 'invalidGroupSize', $langTemplate), array('min' => 0));
        $f->checkArrayOfIntegersForKey('exerciseTypes', FormEvaluator::OPTIONAL, 'warning', Language::Get('main', 'invalidExerciseType', $langTemplate));
        $f->checkArrayOfIntegersForKey('plugins', FormEvaluator::OPTIONAL, 'warning', Language::Get('main', 'noSelectedExtensions', $langTemplate));