Exemplo n.º 1
0
function checkInsertCourse($subject_name, $course_number, $course_title)
{
    $subject_name = fixSubjectName($subject_name);
    $course_number = fixSubjectName($course_number);
    $course_title = fixTitleCase($course_title);
    if (!subjectExists($subject_name)) {
        return "Invalid SubjectName; does not exist.";
    }
    insertCourse($subject_name, $course_number, $course_title);
    return true;
    # could use some more work
}
Exemplo n.º 2
0
// If there is no current logged in user, redirect to the log in page
if (!isset($_SESSION['schedule'])) {
    header('Location: index.html');
}
// Choose which semester's timetable to get
$schedule = $_SESSION['schedule'];
if ($_GET['sem'] == "") {
    $sem = "fall";
} else {
    $sem = $_GET['sem'];
}
// get all POST variables
extract($_POST);
switch ($action) {
    case "Add":
        insertCourse($schedule, $sem, $crs, $lec, $tut, $pra);
        break;
    case "Edit":
        editCourse($schedule, $sem, $crs, $lec, $tut, $pra);
        break;
    case "Remove":
        removeCourse($schedule, $crs);
        break;
    case "AddNew":
        addNewCourse($schedule, $dept, $code, $type, $section, $day, $start, $end);
        break;
    case "Purge":
        purge($schedule, $sem);
        break;
    case "QuickAdd":
        quickAdd($schedule, $sem, $toadd);
Exemplo n.º 3
0
if (!isset($_SESSION['user_id']) || strcmp($_SESSION['type'], 'department_manager') != 0) {
    // redirect unauthorized user at once to homepage
    header('Location: http://localhost/qa/index.php');
    die;
}
require '../database/models.php';
$loggedin_user_info = getUserInfoByUserID($_SESSION['user_id']);
$logged_in_name = "Welcome " . $loggedin_user_info['name'];
// check if form submitted
if (isset($_POST['code']) && isset($_POST['name']) && isset($_POST['semester']) && isset($_POST['year']) && isset($_POST['instructor'])) {
    $department = getDepartmentByManagerID($_SESSION['user_id']);
    if ($department == false) {
        die('D\'oh!');
    }
    if (!checkCourseCodeExists($_POST['code'], $_POST['semester'], substr($_POST['year'], 0, 4))) {
        if (insertCourse($_POST['code'], $_POST['name'], $_POST['semester'], substr($_POST['year'], 0, 4), $_POST['instructor'], $department['ID'])) {
            // create directory for course uploads
            if (!file_exists('../uploads/' . $_POST['code'] . '_' . $_POST['semester'] . '_' . substr($_POST['year'], 0, 4))) {
                mkdir('../uploads/' . $_POST['code'] . '_' . $_POST['semester'] . '_' . substr($_POST['year'], 0, 4), 0777, true);
            }
        } else {
            echo "Failed to Add new Course, contact Technical support";
        }
    } else {
        echo "Course Already Exists!";
    }
    unset($_POST['code']);
    unset($_POST['name']);
    unset($_POST['semester']);
    unset($_POST['year']);
    unset($_POST['instructor']);
Exemplo n.º 4
0
function editCourse($sched, $sem, $crs, $lec, $tut, $pra)
{
    // easiest way - just delete the whole course to purge the old sections
    removeCourse($sched, $crs);
    // then reinsert the course with the new sections
    insertCourse($sched, $sem, $crs, $lec, $tut, $pra);
}
Exemplo n.º 5
0
<?php

require_once 'functions/functions.php';
require_once 'functions/header.php';
insertCourse();
if ($loggedin) {
    if ($_SESSION['grid'] === '3' || $_SESSION['grid'] === '7') {
        echo <<<_END
<div class="container">
    <div id="left">
_END;
        echo '<br><div id="datepicker" style="font-size:0.7em;"></div>';
        echo '<br><br>Important Guidelines<br><br>' . $checkmark . ' See University Syllabus copy for course id.<br><br>' . $checkmark . ' For departments with <y>Two Shifts</y> a course has to be created <y>Two times</y> one for each shift.<br><br>' . 'Example: for CIVIL department Cousre- ID: CE-C301 Title: Applied Mathematics-III should be entered as <br>' . '<br>For <y>SHIFT-I</y>:-<br><br>Course ID: <y>CE-C301-S1</y> <br>Title: <y>Applied Mathematics-III-S1</y>' . '<br><br>For <y>SHIFT-II</y>:-<br><br>Course ID: <y>CE-C301-S2</y> <br>Title: <y>Applied Mathematics-III-S2</y>' . 'Abbreviation could be same<br><br>' . $checkmark . 'Revision indicates the year in which the syllabus is revised.<br><br>';
        echo <<<_END
   </div>
    <div id="right">    
        
        <form method="post" action="createcourse.php" onsubmit="return validateCourse(this)">
         <center>
            <table  cellspacing="10" cellpadding="4" border="0" bgcolor="#00eeee">
                <th colspan="2" align="center">Create Course</th>
                <tr>
                    <td>Course ID</td>
                    <td align="right"><input type="text" placeholder="Unique Course ID" maxlength=10 name="cid" required></td>
                </tr>
                <tr>
                    <td>Title</td>
                    <td align="right"><input type="text" placeholder="Name of Subject" name="ctitle" required></td>
                </tr>
                <tr>
                    <td>Abbreviation</td>