/** * http://stackoverflow.com/a/4128377/2790481 * * @param $needle * @param $courses * @param bool $strict * @return bool */ function getCourse($needle, $courses, $strict = false) { foreach ($courses as $course) { if (($strict ? $course === $needle : $course == $needle) || is_array($course) && getCourse($needle, $course, $strict)) { return $course; } } return false; }
$_SESSION['userID'] = $canvasUserID; $_SESSION['userFullName'] = $_POST["lis_person_name_full"]; $_SESSION['courseID'] = $_POST["custom_canvas_course_id"]; $_SESSION['apiDomain'] = $_POST["custom_canvas_api_domain"]; $_SESSION['canvasURL'] = 'https://' . $_SESSION['apiDomain']; $domain = $_SESSION['apiDomain']; /* query DB to see if user has token, if yes, go to LTI*/ $userCheck = DB::query("SELECT canvas_user_id FROM tokens WHERE canvas_user_id = {$canvasUserID} AND domain = '{$domain}'"); if (!$userCheck) { $generateToken = true; } else { $_SESSION['allowed'] = true; // Include API Calls require_once 'resources/wizardAPI.php'; // test token $course = getCourse($_SESSION['courseID']); if (isset($course->errors[0]->message)) { $sql = DB::query("DELETE FROM tokens WHERE canvas_user_id = {$canvasUserID} AND domain = '{$domain}'"); $generateToken = true; } if (isset($course->name)) { $generateToken = false; } } if ($generateToken == true) { echo 'Generate Token'; // if not, redirect to canvas permission page header('Location: ' . $_SESSION['canvasURL'] . '/login/oauth2/auth?client_id=' . $client_id . '&response_type=code&redirect_uri=' . $_SESSION["template_wizard_url"] . '/oauth2response.php'); } else { header('Location: ' . $_SESSION["template_wizard_url"] . '/index.php'); }
$typefee = mysql_real_escape_string(trim($_POST['spon'])); } else { $typefee = 0; } } elseif (isset($_POST['endo'])) { if (!empty($_POST['endo']) && $_POST['endo'] != '') { $typefee = mysql_real_escape_string(trim($_POST['endo'])); } else { $typefee = 0; } } elseif (isset($_POST['lat'])) { if (!empty($_POST['lat']) && $_POST['lat'] != '') { $typefee = mysql_real_escape_string(trim($_POST['lat'])); } else { $typefee = 0; } } else { $typefee = 0; } $grandtotal = $fadmission + $fcourse + $flibrary + $funioun + $fstudentaidfund + $fdevelopment + $finternet + $flaboratory + $fsafetyip + $fsportsfee + $typefee; $ftotal = trim($_POST['ftotal']); $update = "UPDATE fee_structure SET admission_fee={$fadmission},course_fee_year_sem={$fcourse}, type_fee='{$typefee}', course_fee_parameter='{$param}', library_fee={$flibrary},\n\tunion_magazine={$funioun},saf_fee={$fstudentaidfund},development_fee={$fdevelopment},interent_fee={$finternet},\n\tlaboratory_fee={$flaboratory},student_safety={$fsafetyip},sports_fee={$fsportsfee},total_fee={$grandtotal}, status='{$status}' WHERE fee_id={$feeid}"; $result = mysql_query($update) or die("ERROR: {$update}. " . mysql_error()); if ($result) { $coursename = getCourse($course, $btype); $msg = base64_encode("Success! Fee Structure Slab has been modified successfully for " . $coursename); // $msg=base64_encode("Success! Fee Structure Slab "); } else { $msg = base64_encode("ERROR: on Page"); } header("Location:" . $base . "feeManageGetStarted.php?response={$msg}");
<?php ob_start(); session_start(); include 'db_constant.php'; include 'functions.php'; $date = $_POST['date']; $time = $_POST['time']; $course_id = $_POST['course_id']; $syllabus = $_POST['syllabus']; $year = $_POST['year']; $teacher_name = $_POST['teacher_name']; if ($_SESSION['category'] == 'CR' && $year != $_SESSION['year']) { header('Location:../ct_schedule.php?permission=no'); die; } $course_no = getCourse($course_id); $sql = "INSERT INTO ct (date, time, syllabus, course_no,teacher_id) VALUES ('{$date}', '{$time}', '{$syllabus}','{$course_no}','{$teacher_name}')"; mysql_query($sql); header('Location:../ct_schedule.php?ct=yes');
<?php session_start(); require_once '../core/init.php'; //prevents unautenticated users if (!isset($_SESSION['admin_id'])) { redirect('index'); } $departments = getDepartment(); $courses = getCourse(); ?> <!DOCTYPE html> <html lang="eng"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1" <title>Add questions</title> <link rel="stylesheet" type="text/css" href="css/bootstrap.css"> <script type="text/javascript" src = "js/jquery-2.1.4.min.js"></script> <script type="text/javascript" src="js/bootstrap.min.js"></script> <link rel="stylesheet" type="text/css" href="css/summernote.css"> <script type="text/javascript" src= "js/summernote.js"></script> <link rel="stylesheet" type="text/css" href="css/addquestions.css"> <link rel="stylesheet" type="text/css" href="font-awesome/css/font-awesome.css"> </head> <body> <a href="admin-dashboard.php" class="btn btn-defauld">Dashboard</a> <br> <div class="wrapper">
$index = 0; $counter = 1; if (isset($_POST['go'])) { if ($_POST['course_id'] == "") { } $_SESSION['edit_course_id'] = $_POST['course_id']; } if (isset($_SESSION['edit_course_id'])) { if (isset($_GET['question']) && ($_GET['question'] > 0 && $_GET['question'] < $numQ)) { $index = (int) $_GET['question']; $counter += $index; $questionId = editQuestionId($_SESSION['edit_course_id'], $index); } else { $questionId = editQuestionId($_SESSION['edit_course_id'], $index); } $currentCourse = getCourse($_SESSION['edit_course_id'])[0]['name']; $questions = getEditQuestion($questionId); $options = getQuestionOptions($questionId); $solution = getSolutions($questionId); //print_array( $solution); } ?> <!DOCTYPE html> <html lang="eng"> <head> <title>Edit questions</title> <link rel="stylesheet" type="text/css" href="css/bootstrap.css"> <script type="text/javascript" src = "js/jquery-2.1.4.min.js"></script> <script type="text/javascript" src="js/bootstrap.min.js"></script> <link rel="stylesheet" type="text/css" href="css/summernote.css">
function execute_purchase() { include_once "view/purchase.php"; //echo "executing purchase"; //guarda el id del course $course = $_POST['course']; echo $course; //guarda el usuario $username = $_POST['username']; echo $username; $result = isRepeated($course, $username); //echo $result; if (!$result) { getCourse($course, $username); } $data = array(); //guardo en la variable data todos los enrolments del usuario indicado $data["Enrollment"] = enrollments_getAll($username); //guarda todos los enrollments del estudiante concreto view($data); if ($result) { p("<b>You are already registered in this course!!!</b>"); } }
if (isset($_POST['course'], $_POST['deptId'])) { // initialise variables for the page $courseId = $_POST['course']; $_SESSION['deptId'] = $_POST['deptId']; $_SESSION['courseId'] = $courseId; //fetch department for display $department = getDepartment($_SESSION['deptId'])[0]; // } elseif (isset($_GET['courseid'])) { // initialize variables for the page $courseId = numDecrypt($_GET['courseid']); $_SESSION['courseId'] = $courseId; } //$_SESSION['start'] = "started"; // fetch course for display $course = getCourse($_SESSION['courseId'])[0]; //print_array($_SESSION); die(); ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags --> <title>Select course</title> <!-- Bootstrap -->
<?php include_once $_SERVER['DOCUMENT_ROOT'] . '/MasterPages/required.php'; $course_info = getCourse($pdo, GET('id')); if (empty($course_info)) { header('Location: index.php'); } $course_rating = getCourseRating($pdo, GET('id')); //updateRatings($pdo, GET('id'), "course"); $rating_comments = getComments($pdo, GET('id'), "course"); $course_teachers = getCourseTeachers($pdo, GET('id')); //print_r($course_teachers); ?> <!DOCTYPE html> <html> <head> <title>Project Ocena</title> <?php ev_include('/MasterPages/head.php'); ?> <link rel="stylesheet" href="/includes/css/progress.css" type="text/css" > </head> <body> <header> <div class="h-container" id="top"> <?php ev_include('/MasterPages/header.php'); ?> <div class="h-content container-fluid">
// GET MATCHING SCHEDULES case "getMatchingSchedules": // Process the list of courses that were selected $couseSet = array(); for ($i = 1; $i <= $_POST['courseCount']; $i++) { // It's 1-indexed... :[ // Iterate over the courses in that course slot if (!isset($_POST["courses{$i}Opt"])) { continue; } $courseSubSet = array(); foreach ($_POST["courses{$i}Opt"] as $course) { // Split it by the -'s to get dept-course-sect $courseSplit = explode('-', $course); // Do a query to get the course specified $courseSubSet[] = getCourse($_POST['quarter'], $courseSplit[0], $courseSplit[1], $courseSplit[2]); } $courseSet[] = $courseSubSet; } // Process the list of nonCourse Items $nonCourseSet = array(); for ($i = 1; $i <= $_POST['nonCourseCount']; $i++) { // If there are no days set for the item, ignore it if (empty($_POST["nonCourseDays{$i}"])) { continue; } // Create a new nonCourse Item $nonCourse = array(); $nonCourse['title'] = $_POST["nonCourseTitle{$i}"]; $nonCourse['courseNum'] = "non"; $nonCourse['times'] = array();