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); // construct a login element $courseSelect = Template::WithTemplateFile('include/CourseSelect/CourseSelect.template.html'); $courseSelect->bind($pageData); // wrap all the elements in some HTML and show them on the page $w = new HTMLWrapper($h, $courseSelect); $w->set_config_file('include/configs/config_default.json'); $w->show();
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 */ $t = Template::WithTemplateFile('include/Upload/Upload.template.html'); $t->bind($upload_data); $w = new HTMLWrapper($h, $t); $w->set_config_file('include/configs/config_upload_exercise.json'); $w->show();
$revokeRights = Template::WithTemplateFile('include/CourseManagement/RevokeRights.template.html'); $revokeRights->bind($courseManagement_data); if (isset($revokeRightsNotifications)) { $revokeRights->bind(array("RevokeRightsNotificationElements" => $revokeRightsNotifications)); } $editExternalId = Template::WithTemplateFile('include/CourseManagement/EditExternalId.template.html'); $editExternalId->bind($externalid_data); if (isset($editExternalIdNotifications)) { $editExternalId->bind(array("EditExternalIdNotificationElements" => $editExternalIdNotifications)); } $addExternalId = Template::WithTemplateFile('include/CourseManagement/AddExternalId.template.html'); if (isset($addExternalIdNotifications)) { $addExternalId->bind(array("AddExternalIdNotificationElements" => $addExternalIdNotifications)); } // construct a content element for adding users $addUser = Template::WithTemplateFile('include/CourseManagement/AddUser.template.html'); if (isset($addUserNotifications)) { $addUser->bind(array("AddUserNotificationElements" => $addUserNotifications)); } /** * @todo combine the templates into a single file */ // wrap all the elements in some HTML and show them on the page $w = new HTMLWrapper($h, $courseSettings, $plugins, $addExerciseType, $editExerciseType, $grantRights, $revokeRights, $addUser, $editExternalId, $addExternalId); $w->defineForm(basename(__FILE__) . "?cid=" . $cid, false, $courseSettings); $w->defineForm(basename(__FILE__) . "?cid=" . $cid, false, $plugins); $w->defineForm(basename(__FILE__) . "?cid=" . $cid, false, $addExerciseType); $w->defineForm(basename(__FILE__) . "?cid=" . $cid, false, $editExerciseType); $w->defineForm(basename(__FILE__) . "?cid=" . $cid, false, $grantRights); $w->defineForm(basename(__FILE__) . "?cid=" . $cid, false, $revokeRights); $w->defineForm(basename(__FILE__) . "?cid=" . $cid, false, $addUser);
$file = File::encodeFile($file); } elseif (isset($_GET['downloadConditionCsv'])) { $csv = Csv::createCsv($rows); $file = http_post_data($filesystemURI . '/csv', Csv::encodeCsv($csv), true); $file = File::decodeFile($file); $file->setDisplayName('conditions.csv'); $file = File::encodeFile($file); } echo $file; exit(0); } if (isset($_GET['sortby'])) { $condition_data['sortby'] = $_GET['sortby']; } if (isset($_GET['sortId'])) { $condition_data['sortId'] = $_GET['sortId']; } // 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'], "notificationElements" => $notifications, "navigationElement" => $menu)); // construct a content element for setting exam paper conditions $setCondition = Template::WithTemplateFile('include/Condition/SetCondition.template.html'); $setCondition->bind($condition_data); $userList = Template::WithTemplateFile('include/Condition/UserList.template.html'); $userList->bind($condition_data); // wrap all the elements in some HTML and show them on the page $w = new HTMLWrapper($h, $setCondition, $userList); $w->defineForm(basename(__FILE__) . "?cid=" . $cid, false, $setCondition); $w->set_config_file('include/configs/config_condition.json'); $w->show();
// construct a content element for group information $groupMembers = Template::WithTemplateFile('include/Group/GroupMembers.template.html'); $groupMembers->bind($group_data); // construct a content element for managing groups if ($isInGroup) { $groupManagement = Template::WithTemplateFile('include/Group/GroupManagement.template.html'); $groupManagement->bind($group_data); } // construct a content element for creating groups if ($isLeader) { $invitationsFromGroup = Template::WithTemplateFile('include/Group/InvitationsFromGroup.template.html'); $invitationsFromGroup->bind($group_data); } // construct a content element for joining groups if ($hasInvitations) { $invitationsToGroup = Template::WithTemplateFile('include/Group/InvitationsToGroup.template.html'); $invitationsToGroup->bind($group_data); } // wrap all the elements in some HTML and show them on the page $w = new HTMLWrapper($h, $groupMembers, isset($invitationsToGroup) ? $invitationsToGroup : null, isset($groupManagement) ? $groupManagement : null, isset($invitationsFromGroup) ? $invitationsFromGroup : null); $w->defineForm(basename(__FILE__) . "?cid=" . $cid . "&sid=" . $sid, false, $groupMembers); if (isset($groupManagement)) { $w->defineForm(basename(__FILE__) . "?cid=" . $cid . "&sid=" . $sid, false, $groupManagement); } if (isset($invitationsFromGroup)) { $w->defineForm(basename(__FILE__) . "?cid=" . $cid . "&sid=" . $sid, false, $invitationsFromGroup); } if (isset($invitationsToGroup)) { $w->defineForm(basename(__FILE__) . "?cid=" . $cid . "&sid=" . $sid, false, $invitationsToGroup); } $w->set_config_file('include/configs/config_group.json');
?> :</label> <!--ckeditor--><textarea name="exercises[0][subexercises][0][task]" class="reset form-field task-field" rows="5" style="width:100%;" maxlength="2500"> <?php echo isset($form['task']) ? $form['task'] : ''; ?> </textarea> <?php if (isset($form['choices'])) { foreach ($form['choices'] as $choice) { $radio = Template::WithTemplateFile('include/CreateSheet/Form/FormAddRadio.template.php'); if (isset($cid)) { $radio->bind(array('cid' => $cid)); } if (isset($uid)) { $radio->bind(array('uid' => $uid)); } if (isset($sid)) { $radio->bind(array('sid' => $sid)); } $radio->bind(array('choice' => $choice)); $radio->show(); } } ?>
if ($signed !== false) { $notifications[] = $signed; } else { $notifications[] = MakeNotification("error", Language::Get('main', 'errorLogin', $langTemplate)); } } } else { $notifications = array(); } // check if already logged in if (Authentication::checkLogin()) { header('Location: index.php'); exit; } // construct a new header $h = Template::WithTemplateFile('include/Header/Header.template.html'); $h->bind(array("backTitle" => Language::Get('main', 'changeCourse', $langTemplate), "name" => Language::Get('main', 'title', $langTemplate), "hideBackLink" => "true", "hideLogoutLink" => "true", "notificationElements" => $notifications)); // construct a login element $userLogin = Template::WithTemplateFile('include/Login/Login.template.html'); // if back Parameter is given bind it to the userLogin to create hidden input if (isset($_GET['back'])) { $backparameter = cleanInput($_GET['back']); $backdata = array("backURL" => $backparameter); } else { $backdata = array(); } $userLogin->bind($backdata); // wrap all the elements in some HTML and show them on the page $w = new HTMLWrapper($h, $userLogin); $w->set_config_file('include/configs/config_default.json'); $w->show();
* Constructs the page that is displayed to a tutor. * * @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::TUTOR, $cid, $uid, $globalUserData); $langTemplate = 'Tutor_Controller'; Language::loadLanguageFile('de', $langTemplate, 'json', dirname(__FILE__) . '/'); // load tutor data from GetSite $URI = $getSiteURI . "/tutor/user/{$uid}/course/{$cid}"; $tutor_data = http_get($URI, true); $tutor_data = json_decode($tutor_data, true); $tutor_data['filesystemURI'] = $filesystemURI; $tutor_data['cid'] = $cid; // check userrights for course $user_course_data = $tutor_data['user']; $menu = MakeNavigationElement($user_course_data, PRIVILEGE_LEVEL::TUTOR); // 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/ExerciseSheetTutor.template.html'); $t->bind($tutor_data); $w = new HTMLWrapper($h, $t); $w->defineForm(basename(__FILE__) . "?cid=" . $cid, false, $t); $w->set_config_file('include/configs/config_student_tutor.json'); $w->show();
$markingElement = Template::WithTemplateFile('include/MarkingTool/MarkingTool.template.html'); $markingElement->bind($markingTool_data); $markingElement->bind(array('selectedSheet' => $selectedSheet)); $markingElement->bind(array('group' => $group)); if (isset($GroupNotificationElements[$group['leader']['id']])) { $markingElement->bind(array('GroupNotificationElements' => $GroupNotificationElements[$group['leader']['id']])); unset($GroupNotificationElements[$group['leader']['id']]); } $w->insert($markingElement); $w->defineForm(basename(__FILE__) . "?cid=" . $cid . "&sid=" . $sid, false, $markingElement); } if ($allOutputs == 0) { $markingElement = Template::WithTemplateFile('include/MarkingTool/MarkingToolEmpty.template.html'); $markingElement->bind($markingTool_data); $w->insert($markingElement); } } else { $markingElement = Template::WithTemplateFile('include/MarkingTool/MarkingToolEmpty.template.html'); $markingElement->bind($markingTool_data); $w->insert($markingElement); } if (!empty($GroupNotificationElements)) { foreach ($GroupNotificationElements as $key => $notifs) { $notifications = array_merge($notifications, $notifs); } } $h->bind(array("notificationElements" => $notifications)); $searchSettings->bind(array('allOutputs' => $allOutputs)); $w->defineForm(basename(__FILE__) . "?cid=" . $cid . "&sid=" . $sid, false, $searchSettings); $w->set_config_file('include/configs/config_marking_tool.json'); $w->show();
// construct a content element for assigning tutors automatically $assignAutomatically = Template::WithTemplateFile('include/TutorAssign/AssignAutomatically.template.html'); $assignAutomatically->bind($tutorAssign_data); if (isset($assignAutomaticallyNotifications)) { $assignAutomatically->bind(array("AssignAutomaticallyNotificationElements" => $assignAutomaticallyNotifications)); } // construct a content element for assigning tutors manually $assignManually = Template::WithTemplateFile('include/TutorAssign/AssignManually.template.html'); $assignManually->bind($tutorAssign_data); if (isset($assignManuallyNotifications)) { $assignManually->bind(array("AssignManuallyNotificationElements" => $assignManuallyNotifications)); } // construct a content element for removing assignments from tutors $assignRemove = Template::WithTemplateFile('include/TutorAssign/AssignRemove.template.html'); if (isset($assignRemoveNotifications)) { $assignRemove->bind(array("AssignRemoveNotificationElements" => $assignRemoveNotifications)); } // construct a content element for creating submissions for unsubmitted users $assignMake = Template::WithTemplateFile('include/TutorAssign/AssignMake.template.html'); if (isset($assignMakeNotifications)) { $assignMake->bind(array("AssignMakeNotificationElements" => $assignMakeNotifications)); } // wrap all the elements in some HTML and show them on the page $w = new HTMLWrapper($h, $assignAutomatically, $assignManually, $assignMake, $assignRemove); $w->defineForm(basename(__FILE__) . "?cid=" . $cid . "&sid=" . $sid, false, $assignAutomatically); $w->defineForm(basename(__FILE__) . "?cid=" . $cid . "&sid=" . $sid, false, $assignManually); $w->defineForm(basename(__FILE__) . "?cid=" . $cid . "&sid=" . $sid, false, $assignMake); $w->defineForm(basename(__FILE__) . "?cid=" . $cid . "&sid=" . $sid, false, $assignRemove); $w->set_config_file('include/configs/config_tutor_assign.json'); //$w->set_config_file('include/configs/config_default.json'); $w->show();
http_put_data($URI, Submission::encodeSubmission($submissionUpdate), true, $message2); if ($message == "201" && $message2 == 201) { $notifications[] = MakeNotification("success", Language::Get('main', 'successDeleteSubmission', $langTemplate)); } else { $notifications[] = MakeNotification("error", Language::Get('main', 'errorDeleteSubmission', $langTemplate)); } } } elseif (isset($_POST['downloadMarkings'])) { downloadMarkingsForSheet($uid, $_POST['downloadMarkings']); } // load tutor data from GetSite $URI = $getSiteURI . "/student/user/{$uid}/course/{$cid}"; $student_data = http_get($URI, true); $student_data = json_decode($student_data, true); $student_data['filesystemURI'] = $filesystemURI; $student_data['cid'] = $cid; $student_data['uid'] = $uid; $user_course_data = $student_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', 'changeCourse', $langTemplate), "backURL" => "index.php", "notificationElements" => $notifications, "navigationElement" => $menu)); $h->bind($student_data); $t = Template::WithTemplateFile('include/ExerciseSheet/ExerciseSheetStudent.template.html'); $t->bind($student_data); $t->bind(array('uid' => $uid)); $w = new HTMLWrapper($h, $t); $w->defineForm(basename(__FILE__) . "?cid=" . $cid, false, $t); $w->set_config_file('include/configs/config_student_tutor.json'); $w->show();
} 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)); // if (!isset($_POST['action']) || $_POST['action']=='new'){ $result = http_get($serverURI . "/DB/DBForm/form/exercisesheet/{$sid}", true); $forms = json_decode($result, true); $result = http_get($serverURI . "/DB/DBProcess/process/exercisesheet/{$sid}", true); $processes = json_decode($result, true); // }
><?php echo $link->getName(); ?> </option> <?php if ($selectedComponent === NULL || isset($process['target']['id']) && $process['target']['id'] == $link->getId()) { $selectedComponent = $link; } } ?> </select> <br><br> <?php if (isset($process) && isset($selectedComponent)) { $pro = Template::WithTemplateFile('include/CreateSheet/Processor/' . $selectedComponent->getName() . '.template.php'); if (isset($cid)) { $pro->bind(array('cid' => $cid)); } if (isset($uid)) { $pro->bind(array('uid' => $uid)); } if (isset($sid)) { $pro->bind(array('sid' => $sid)); } $pro->bind(array('process' => $process)); $pro->bind(array('component' => $selectedComponent)); $pro->show(); } ?> <div class="form-field processor-parameter-area" style="width:100%"></div>
// construct a new header $h = Template::WithTemplateFile('include/Header/Header.template.html'); $h->bind($user_course_data); $h->bind(array("name" => Language::Get('main', 'settings', $langTemplate), "backTitle" => Language::Get('main', 'courses', $langTemplate), "backURL" => "index.php", "notificationElements" => $notifications, "navigationElement" => $menu)); // construct a content element for creating new courses $createCourse = Template::WithTemplateFile('include/MainSettings/CreateCourse.template.html'); $createCourse->bind($mainSettings_data); if (count($notifications) != 0) { $createCourse->bind($_POST); } // construct a content element for setting admins $setAdmin = Template::WithTemplateFile('include/MainSettings/SetAdmin.template.html'); $setAdmin->bind($mainSettings_data); // construct a content element for creating new users $createUser = Template::WithTemplateFile('include/MainSettings/CreateUser.template.html'); if (count($notifications) != 0) { $createUser->bind($_POST); } // construct a content element for deleting users $deleteUser = Template::WithTemplateFile('include/MainSettings/DeleteUser.template.html'); /** * @todo combine the templates into a single file */ // wrap all the elements in some HTML and show them on the page $w = new HTMLWrapper($h, $createCourse, $setAdmin, $createUser, $deleteUser); $w->defineForm(basename(__FILE__), false, $createCourse); $w->defineForm(basename(__FILE__), false, $setAdmin); $w->defineForm(basename(__FILE__), false, $createUser); $w->defineForm(basename(__FILE__), false, $deleteUser); $w->set_config_file('include/configs/config_default.json'); $w->show();
} } else { $errormsg = Language::Get('main', 'unknownError', $langTemplate); $notifications[] = MakeNotification('error', $errormsg); } } } else { $errormsg = Language::Get('main', 'invalidFileType', $langTemplate); $notifications[] = MakeNotification('error', $errormsg); } } } } // load tutorUpload data from GetSite $URL = $getSiteURI . "/tutorupload/user/{$uid}/course/{$cid}"; $tutorUpload_data = http_get($URL, true); $tutorUpload_data = json_decode($tutorUpload_data, true); $tutorUpload_data['filesystemURI'] = $filesystemURI; $tutorUpload_data['cid'] = $cid; $user_course_data = $tutorUpload_data['user']; $menu = MakeNavigationElement($user_course_data, PRIVILEGE_LEVEL::TUTOR, true); // construct a new header $h = Template::WithTemplateFile('include/Header/Header.template.html'); $h->bind($user_course_data); $h->bind(array("name" => isset($user_course_data['courses'][0]['course']['name']) ? $user_course_data['courses'][0]['course']['name'] : null, "notificationElements" => $notifications, "navigationElement" => $menu)); // construct a content element for uploading markings $tutorUpload = Template::WithTemplateFile('include/TutorUpload/TutorUpload.template.html'); $tutorUpload->bind($tutorUpload_data); $w = new HTMLWrapper($h, $tutorUpload); $w->set_config_file('include/configs/config_upload_exercise.json'); $w->show();
$form->show(); } } ?> </td></tr> <?php } ?> <?php if ($processesAllowed) { ?> <?php if (isset($processes)) { foreach ($processes as $process) { $pro = Template::WithTemplateFile('include/CreateSheet/Processor/Processor.template.php'); if (isset($cid)) { $pro->bind(array('cid' => $cid)); } if (isset($uid)) { $pro->bind(array('uid' => $uid)); } if (isset($sid)) { $pro->bind(array('sid' => $sid)); } $pro->bind(array('process' => $process)); $pro->bind(array('processors' => $processors)); $pro->show(); } } ?>
?> :</label> <!--ckeditor--><textarea name="exercises[0][subexercises][0][task]" class="form-field task-field" rows="5" style="width:100%" maxlength="2500"> <?php echo isset($form['task']) ? $form['task'] : ''; ?> </textarea> <?php if (isset($form['choices'])) { foreach ($form['choices'] as $choice) { $checkbox = Template::WithTemplateFile('include/CreateSheet/Form/FormAddCheckbox.template.php'); if (isset($cid)) { $checkbox->bind(array('cid' => $cid)); } if (isset($uid)) { $checkbox->bind(array('uid' => $uid)); } if (isset($sid)) { $checkbox->bind(array('sid' => $sid)); } $checkbox->bind(array('choice' => $choice)); $checkbox->show(); } } ?>
</div> <div class="content-body-wrapper"> <div class="content-body left"> <ol class="full-width-list lower-alpha"> <?php if (isset($exercises)) { foreach ($exercises as $key => $exercise) { if (!isset($exercise['id'])) { $exercises[$key]['id'] = null; } } $exercises = LArraySorter::orderBy($exercises, 'linkName', SORT_ASC); foreach ($exercises as $key => $exercise) { $subtask = Template::WithTemplateFile('include/CreateSheet/Subtask.template.php'); $subtask->bind($exercise); if (isset($forms)) { $exerciseForms = array(); foreach ($forms as $form) { if (!isset($form['exerciseId'])) { continue; } if ($form['exerciseId'] == $exercise['id']) { $exerciseForms[] = $form; } } if (!empty($exerciseForms)) { $subtask->bind(array('forms' => $exerciseForms)); } }
<?php /** * @file Error.php * * @author Ralf Busch */ include_once 'include/Boilerplate.php'; include_once dirname(__FILE__) . '/../Assistants/Language.php'; if (isset($_GET['msg'])) { $msg = cleanInput($_GET['msg']); } if (isset($msg) && $msg == "403") { header("HTTP/1.0 403 Access Forbidden"); $notifications[] = MakeNotification("error", "403: Access Forbidden"); } elseif (isset($msg) && $msg == "404") { header("HTTP/1.0 404 Not Found"); $notifications[] = MakeNotification("error", "404: Not Found!"); } elseif (isset($msg) && $msg == "409") { header("HTTP/1.0 404 Not Found"); $notifications[] = MakeNotification("error", "409: Conflict!"); } else { header("HTTP/1.0 403 Not Found"); $notifications[] = MakeNotification("error", "403: " . $msg); } $h = Template::WithTemplateFile('include/Header/Header.template.html'); $h->bind(array("name" => "Übungsplattform", "backTitle" => "Startseite", "backURL" => "index.php", "hideLogoutLink" => "true", "notificationElements" => $notifications)); // wrap all the elements in some HTML and show them on the page $w = new HTMLWrapper($h); $w->set_config_file('include/configs/config_default.json'); $w->show();
} } // construct a content element for the ability to look at the upload history of a student if ($courseStatus >= 1) { $uploadHistorySettings = Template::WithTemplateFile('include/UploadHistory/UploadHistorySettings.template.html'); $uploadHistorySettings->bind($uploadHistoryOptions_data); } $uploadHistory = Template::WithTemplateFile('include/UploadHistory/UploadHistory.template.html'); if (isset($uploadHistory_data)) { $uploadHistory->bind($uploadHistory_data); } if (isset($uploadHistoryNotifications)) { $uploadHistory->bind(array("UploadHistoryNotificationElements" => $uploadHistoryNotifications)); } if ($courseStatus >= 1) { $uploadHistoryGroup = Template::WithTemplateFile('include/UploadHistory/UploadHistoryGroup.template.html'); if (isset($uploadHistory_data)) { $uploadHistoryGroup->bind($uploadHistory_data); } if (isset($uploadHistoryGroupNotifications)) { $uploadHistoryGroup->bind(array("UploadHistoryNotificationElements" => $uploadHistoryGroupNotifications)); } } // wrap all the elements in some HTML and show them on the page $w = new HTMLWrapper($h, isset($uploadHistorySettings) ? $uploadHistorySettings : null, isset($uploadHistoryGroup) ? $uploadHistoryGroup : null, isset($uploadHistory) ? $uploadHistory : null); if (isset($uploadHistorySettings)) { $w->defineForm(basename(__FILE__) . "?cid=" . $cid, false, $uploadHistorySettings); } if (isset($uploadHistory)) { $w->defineForm(basename(__FILE__) . "?cid=" . $cid, false, $uploadHistory); }
} 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', 'successDeleteSubmission', $langTemplate)); } else { $sheetNotifications[$_POST['deleteSheet']][] = MakeNotification('error', Language::Get('main', 'errorDeleteSubmission', $langTemplate)); } } } // load GetSite data for Admin.php $URL = $getSiteURI . "/admin/user/{$uid}/course/{$cid}"; $admin_data = http_get($URL, true); $admin_data = json_decode($admin_data, true); $admin_data['filesystemURI'] = $filesystemURI; $admin_data['cid'] = $cid; $user_course_data = $admin_data['user']; $menu = MakeNavigationElement($user_course_data, PRIVILEGE_LEVEL::ADMIN); // 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($admin_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();
<?php } ?> <?php if (isset($forms)) { foreach ($forms as $form) { $input = null; switch ($form['type']) { case 0: $input = Template::WithTemplateFile('include/CreateSheet/Form/FormInput.template.php'); break; case 1: $input = Template::WithTemplateFile('include/CreateSheet/Form/FormRadio.template.php'); break; case 2: $input = Template::WithTemplateFile('include/CreateSheet/Form/FormCheckbox.template.php'); break; default: break; } if ($input !== null) { if (isset($cid)) { $input->bind(array('cid' => $cid)); } if (isset($uid)) { $input->bind(array('uid' => $uid)); } if (isset($sid)) { $input->bind(array('sid' => $sid)); } if (isset($form)) {
$URI = $databaseURI . "/user/" . $uid; http_put_data($URI, $newUserSettings, true, $message); if ($message == "201") { $notifications[] = MakeNotification("success", Language::Get('main', 'languageChanged', $langTemplate)); } } else { $notifications = $notifications + $f->notifications; } } } } // load user data from the database $databaseURI = $getSiteURI . "/accountsettings/user/{$uid}"; $accountSettings_data = http_get($databaseURI, true); $accountSettings_data = json_decode($accountSettings_data, true); // construct a new header $h = Template::WithTemplateFile('include/Header/Header.template.html'); $h->bind($accountSettings_data); $h->bind(array("name" => Language::Get('main', 'accountSettings', $langTemplate), "backTitle" => Language::Get('main', 'course', $langTemplate), "backURL" => "index.php", "notificationElements" => $notifications)); // construct a content element for account information $accountInfo = Template::WithTemplateFile('include/AccountSettings/AccountInfo.template.html'); $accountInfo->bind($accountSettings_data); // construct a content element for changing password $changePassword = Template::WithTemplateFile('include/AccountSettings/ChangePassword.template.html'); $changePassword->bind($accountSettings_data); // wrap all the elements in some HTML and show them on the page $w = new HTMLWrapper($h, $accountInfo, $changePassword); $w->defineForm(basename(__FILE__), false, $changePassword); $w->defineForm(basename(__FILE__), false, $accountInfo); $w->set_config_file('include/configs/config_default.json'); $w->show();
function MakeNavigationElement($user, $requiredPrivilege, $switchDisabled = false, $forIndex = false) { $courses = isset($user['courses']) ? $user['courses'] : null; $isSuperAdmin = isset($user['isSuperAdmin']) ? $user['isSuperAdmin'] == 1 : null; /*if ($forIndex == true && $isSuperAdmin == false) { return ""; }*/ $courseStatus = null; if (isset($courses[0]) && isset($courses[0]['status'])) { $courseStatus = $courses[0]['status']; } $course = null; if (isset($courses[0]) && isset($courses[0]['course'])) { $course = $courses[0]['course']; } $file = 'include/Navigation/Navigation.template.html'; $navigationElement = Template::WithTemplateFile($file); $navigationElement->bind(array('cid' => isset($course['id']) ? $course['id'] : null, 'requiredPrivilege' => $requiredPrivilege, 'courseStatus' => $courseStatus, 'switchDisabled' => $switchDisabled, 'sites' => PRIVILEGE_LEVEL::$SITES, 'isSuperAdmin' => $isSuperAdmin, 'forIndex' => $forIndex)); return $navigationElement; }