echo html($thisDir); ?> ">Upload</a> <a href="?action=eval&s=<?php echo html($thisDir); ?> ">Eval</a> </div> <br /> <?php // determine action switch ($action) { case 'del': ob_clean(); deleteSubject($subject); break; case 'dl': ob_clean(); downloadFile($subject); break; case 'edit': case 'new': editFile($subject, $action == 'new'); break; case 'rn': ob_clean(); renameSubject($subject, $value); break; case 'save': ob_clean();
session_destroy(); } else { if ($_POST['toDo'] == "displayRooms") { displayRooms(); } elseif ($_POST['toDo'] == "deleteRoom") { deleteRoom($_POST['roomId']); } elseif ($_POST['toDo'] == "updateRoom") { updateRoom(); } elseif ($_POST['toDo'] == "addRoom") { addRoom(); } elseif ($_POST['toDo'] == "displaySubjects") { displaySubjects(); } elseif ($_POST['toDo'] == "updateSubject") { updateSubject(); } elseif ($_POST['toDo'] == "deleteSubject") { deleteSubject($_POST['subId']); } elseif ($_POST['toDo'] == "addSubject") { addSubject(); } elseif ($_POST['toDo'] == "displayBatches") { displayBatches(); } elseif ($_POST['toDo'] == "addBatch") { addBatch(); } elseif ($_POST['toDo'] == "updateBatch") { updateBatch(); } elseif ($_POST['toDo'] == "deleteBatch") { deleteBatch($_POST['id']); } elseif ($_POST['toDo'] == "deleteBatchSubject") { deleteBatchSubject($_POST['bid'], $_POST['sid']); } elseif ($_POST['toDo'] == "addBatchSubject") { addBatchSubject($_POST['bid'], $_POST['sid'], $_POST['subType'], $_POST['subCode']); } elseif ($_POST['toDo'] == "displayBacklogs") {
function checkDeleteSubject($subject_name) { $subject_name = fixSubjectName($subject_name); deleteSubject($subject_name); return true; }
$app->get('/logout', function () { $_SESSION['user_access'] = 0; $returnObj['status'] = 1; echo json_encode($returnObj); // 0 false > 0 true }); $app->post('/subject', function () use($app) { $allPostVars = $app->request->post(); echo createSubject($allPostVars); //in manager.php }); $app->post('/subject/update', function () use($app) { $allPostVars = $app->request->post(); $updateObj = $allPostVars['update']; $constraints = $allPostVars['constraint']; echo update($updateObj, $constraints); //in manager.php }); $app->post('/login', function () use($app) { $allPostVars = $app->request->post(); $_SESSION['user_access'] = login($allPostVars['username'], $allPostVars['password']); $returnObj['status'] = $_SESSION['user_access']; // 0 false, > 0 true echo json_encode($returnObj); }); $app->get('/subject/delete/:id', function ($id) { if ($_SESSION['user_access'] == 1) { echo deleteSubject($id); } }); $app->run();