$notifications[] = MakeNotification("success", Language::Get('main', 'successSetConditions', $langTemplate)); } } } if (isset($_GET['downloadConditionCsv'])) { $cid = cleanInput($_GET['downloadConditionCsv']); } if (isset($_GET['downloadConditionPdf'])) { $cid = cleanInput($_GET['downloadConditionPdf']); } // load user data from the database $URL = $getSiteURI . "/condition/user/{$uid}/course/{$cid}"; $condition_data = http_get($URL, true); $condition_data = json_decode($condition_data, true); $user_course_data = $condition_data['user']; $menu = MakeNavigationElement($user_course_data, PRIVILEGE_LEVEL::ADMIN, true); if (isset($condition_data['users'])) { function compare_lastName($a, $b) { return strnatcmp(strtolower($a['lastName']), strtolower($b['lastName'])); } usort($condition_data['users'], 'compare_lastName'); // manages table sort if (isset($_GET['sortby'])) { $sortBy = cleanInput($_GET['sortby']); switch ($sortBy) { case "firstName": $condition_data['users'] = array_reverse($condition_data['users']); function compare_firstName($a, $b) { return strnatcmp(strtolower($a['firstName']), strtolower($b['firstName']));
* @author Felix Schmidt * @author Florian Lücke * @author Ralf Busch */ include_once dirname(__FILE__) . '/include/Boilerplate.php'; include_once dirname(__FILE__) . '/../Assistants/LArraySorter.php'; $langTemplate = 'index_Controller'; Language::loadLanguageFile('de', $langTemplate, 'json', dirname(__FILE__) . '/'); // load user data from the database $databaseURI = $databaseURI . "/user/user/{$uid}"; $user = http_get($databaseURI, false); $user = json_decode($user, true); if (is_null($user)) { $user = array(); } $menu = MakeNavigationElement($user, PRIVILEGE_LEVEL::STUDENT, true, true); // construct a new header $h = Template::WithTemplateFile('include/Header/Header.template.html'); $h->bind($user); $h->bind(array("name" => Language::Get('main', 'title', $langTemplate), "hideBackLink" => "true", "notificationElements" => $notifications, "navigationElement" => $menu)); // sort courses by semester if (isset($user['courses']) && is_array($user['courses'])) { foreach ($user['courses'] as &$course) { $course['semesterInt'] = substr($course['course']['semester'], -4) * 2; if (substr($course['course']['semester'], 0, 2) == 'WS') { $course['semesterInt']--; } } $user['courses'] = LArraySorter::orderBy($user['courses'], 'semesterInt', SORT_DESC, 'name', SORT_ASC); } $pageData = array('uid' => isset($user['id']) ? $user['id'] : null, 'courses' => isset($user['courses']) ? $user['courses'] : null, 'sites' => PRIVILEGE_LEVEL::$SITES, 'statusName' => PRIVILEGE_LEVEL::$NAMES);
if ($message == 201) { $sheetNotifications[$_POST['deleteSheet']][] = MakeNotification('success', Language::Get('main', 'successDeleteSheet', $langTemplate)); } else { $sheetNotifications[$_POST['deleteSheet']][] = MakeNotification('error', Language::Get('main', 'errorDeleteSheet', $langTemplate)); } } } // load GetSite data for Lecturer.php $URL = $getSiteURI . "/lecturer/user/{$uid}/course/{$cid}"; $lecturer_data = http_get($URL, true); $lecturer_data = json_decode($lecturer_data, true); $lecturer_data['filesystemURI'] = $filesystemURI; $lecturer_data['cid'] = $cid; $user_course_data = $lecturer_data['user']; if (is_null($user_course_data)) { $user_course_data = array(); } $menu = MakeNavigationElement($user_course_data, PRIVILEGE_LEVEL::LECTURER); // construct a new header $h = Template::WithTemplateFile('include/Header/Header.template.html'); $h->bind($user_course_data); $h->bind(array("name" => $user_course_data['courses'][0]['course']['name'], "backTitle" => Language::Get('main', 'changeCourse', $langTemplate), "backURL" => "index.php", "notificationElements" => $notifications, "navigationElement" => $menu)); $t = Template::WithTemplateFile('include/ExerciseSheet/ExerciseSheetLecturer.template.html'); $t->bind($lecturer_data); if (isset($sheetNotifications)) { $t->bind(array("SheetNotificationElements" => $sheetNotifications)); } $w = new HTMLWrapper($h, $t); $w->defineForm(basename(__FILE__) . "?cid=" . $cid, false, $t); $w->set_config_file('include/configs/config_admin_lecturer.json'); $w->show();
$formdata = Form::decodeForm($formdata); if (!is_array($formdata)) { $formdata = array($formdata); } foreach ($formdata as $value) { foreach ($upload_data['exercises'] as &$key) { if ($value->getExerciseId() == $key['id']) { $key['form'] = $value; break; } } } $upload_data['hasStarted'] = $hasStarted; $upload_data['isExpired'] = $isExpired; $user_course_data = $upload_data['user']; $menu = MakeNavigationElement($user_course_data, PRIVILEGE_LEVEL::STUDENT); // construct a new header $h = Template::WithTemplateFile('include/Header/Header.template.html'); $h->bind($user_course_data); $h->bind(array("name" => $user_course_data['courses'][0]['course']['name'], "backTitle" => Language::Get('main', 'backToCourse', $langTemplate), "backURL" => "Student.php?cid={$cid}", "notificationElements" => $notifications, "navigationElement" => $menu)); /** * @todo detect when the form was changed by the user, this could be done by * hashing the form elements before handing them to the user: * - hash the form (simple hash/hmac?) * - save the calculated has in a hidden form input * - when the form is posted recalculate the hash and compare to the previous one * - log the user id? * * @see http://www.php.net/manual/de/function.hash-hmac.php * @see http://php.net/manual/de/function.hash.php */
$errormsg = Language::Get('main', 'errorEditSheet', $langTemplate); } else { $errormsg = Language::Get('main', 'errorCreateSheet', $langTemplate); } array_push($notifications, MakeNotification('error', $errormsg)); } } else { $notifications = array_merge($notifications, $f->notifications); } } if (isset($sid)) { $URL = $databaseURI . "/exercisesheet/exercisesheet/{$sid}/exercise"; $sheet_data = http_get($URL, true); $sheet_data = json_decode($sheet_data, true); } $menu = MakeNavigationElement($createsheetData['user'], PRIVILEGE_LEVEL::LECTURER, true); // construct a new header $h = Template::WithTemplateFile('include/Header/Header.template.html'); $h->bind($createsheetData['user']); $h->bind(array("name" => $createsheetData['user']['courses'][0]['course']['name'], "notificationElements" => $notifications, "navigationElement" => $menu)); $sheetSettings = Template::WithTemplateFile('include/CreateSheet/SheetSettings.template.html'); $createExercise = Template::WithTemplateFile('include/CreateSheet/CreateExercise.template.html'); $sheetSettings->bind($createsheetData['user']); if (isset($cid)) { $sheetSettings->bind(array('cid' => $cid)); } if (isset($uid)) { $sheetSettings->bind(array('uid' => $uid)); } if (isset($sid)) { $sheetSettings->bind(array('sid' => $sid));