Пример #1
0
    $conn = connect();
    insert('course', array('code', 'title', 'unit', 'req', 'des'), array(array($content[0], $content[1], $content[2], $content[3], $content[4])));
}
function add_section($content)
{
    $conn = connect();
    $tname = substr($content[0], 0, 4);
    //check_table($tname);
    for ($i = 0; $i < count($content[5]); $i++) {
        for ($j = 0; $j < count($content[5][$i][0]); $j++) {
            if ($content[5][$i][0][$j][0] == '') {
                break;
            }
            insert('schedule', array('code', 'subcode', 'place', 'session', 'person'), array(array($content[0], $content[5][$i][0][$j][0], $content[5][$i][0][$j][1], $content[5][$i][0][$j][2], $content[5][$i][0][$j][3])));
        }
        for ($j = 0; $j < count($content[5][$i][1]); $j++) {
            if ($content[5][$i][1][$j][0] == '') {
                break;
            }
            insert('schedule', array('code', 'subcode', 'place', 'session', 'person'), array(array($content[0], $content[5][$i][1][$j][0], $content[5][$i][1][$j][1], $content[5][$i][1][$j][2], $content[5][$i][1][$j][3])));
        }
        $num++;
    }
}
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    //$file = fopen("data/".time().".txt","w+");
    $temp1 = file_get_contents('php://input');
    $temp = json_decode($temp1, true);
    add_course($temp);
    add_section($temp);
}
<?php

require_once "../includes/functions/sessions.php";
require_once "../includes/functions/functions.php";
require_once "../includes/functions/db_connection.php";
if (!isset($_SESSION['username'])) {
    $_SESSION['unauth_user'] = 1;
    redirect("login.php");
}
if (isset($_POST['submit'])) {
    if (isset($_POST['course_title']) && isset($_POST['course_category']) && isset($_POST['author']) && isset($_POST['MRP']) && isset($_POST['SP'])) {
        $valid = validate($_POST['course_title'], $_POST['course_category'], $_POST['author'], $_POST['MRP'], $_POST['SP']);
        if ($valid) {
            $result = add_course($_POST['course_title'], $_POST['course_category'], $_POST['author'], $_POST['MRP'], $_POST['SP']);
            if ($result) {
                $course_added = true;
                $_POST = array();
            } else {
                $course_added = false;
            }
        } else {
            $validity = false;
        }
    }
}
?>

<?php 
include "../includes/layouts/header.php";
?>
Пример #3
0
         if (empty($course_name)) {
             $error_msg .= "Course Name is required.<BR>";
         }
         if (empty($teacher_id)) {
             $error_msg .= "Teacher is required.<BR>";
         }
         if (empty($course_type)) {
             $error_msg .= "Course Type is required.<BR>";
         }
         if ($error_msg != "") {
             $teachers = get_teachers();
             $course_types = get_course_types();
             include 'course_add.php';
             exit;
         } else {
             add_course($course_name, $course_short_name, $course_desc, $teacher_id, $course_nbr, $room, $course_type);
         }
     }
     $courseList = get_course_list();
     include 'course_list.php';
     exit;
     break;
 case 'show_modify_course':
     $course_id = filter_input(INPUT_GET, 'course_id');
     $course = get_course($course_id);
     $error_msg = '';
     $course_nbr = $course['course_nbr'];
     $course_name = $course['course_name'];
     $course_short_name = $course['course_short_name'];
     $course_desc = $course['course_desc'];
     $teacher_id = $course['teacher_id'];
Пример #4
0
if (isset($_POST['remove'])) {
    //set this course to 'deleted'
    set_course('deleted', $_POST['course'], $_SESSION['dept']);
}
if (isset($_POST['add'])) {
    //set this course to 'added'
    set_course('added', $_POST['course'], $_SESSION['dept']);
}
if (isset($_POST['modify'])) {
    //change units, weight of this course
    mod_course($_POST['weight'], $_POST['units'], $_POST['course'], $_SESSION['dept']);
    force_checks($_SESSION['dept'], $_SESSION['year'], $_SESSION['season']);
}
if (isset($_POST['newcourse'])) {
    //add this course
    add_course($_POST['course'], $_SESSION['dept']);
}
staffheader($_SESSION['name'], "mancourse.php", $_SESSION['year'], $_SESSION['season_name'], $_SESSION['season']);
?>

        <p style="text-align:center;">
        <fieldset class="scheduler-border" style="border-color:#3BA4C7">
        <legend class="scheduler-border"><b>Course & Section Management:</b></legend>
        <p>This page can be used to manage the courses and sections offered this quarter.</p>
        </p>
        <form action="mancourse.php" method="post">
         <input name="course" type="text"/> 
         <input type="submit" value="Add Course" name="newcourse"/>
        </form>

<?php 
Пример #5
0
function add_remove()
{
    ?>
		<form name = "infoform"
			action = "Assignment2.php"
			method = "POST">
		<br/><input type = "submit" name = "add" value = "Add User">
		<br/><input type = "submit" name = "remove" value = "Remove User">
		</form>
	<?php 
    add_course();
}
Пример #6
0
<?php

/**
 * Created by PhpStorm.
 * User: macbook
 * Date: 12/14/15
 * Time: 1:04 PM
 */
/* These messages are used to customize the login page. */
require_once __DIR__ . "/../../util/main.php";
require_once __DIR__ . "/../../model/teacher_db.php";
require_once __DIR__ . "/../../model/times_db.php";
$action = strtolower(filter_input(INPUT_POST, 'action'));
if ($action == NULL) {
    $action = strtolower(filter_input(INPUT_GET, 'action'));
    if ($action == NULL) {
        $action = 'default';
    }
}
$usr_id = get_usr_id($user->usr_first_name, $user->usr_last_name);
switch ($action) {
    case 'add_course':
        $course_name = $_POST['course_name'];
        $course_desc = $_POST['course_desc'];
        add_course($course_name, $course_desc, $usr_id);
        header("Location: ../index.php");
        break;
    case 'default':
        include "./view.php";
}
Пример #7
0
<?php

/**
 * Created by PhpStorm.
 * User: matth
 * Date: 7/28/2016
 * Time: 10:50 AM
 */
require_once "../../../util/main.php";
require_once "../../../model/admin_db.php";
require_once "../../../model/teacher_db.php";
$action = strtolower(filter_input(INPUT_POST, 'action'));
if ($action == NULL) {
    $action = strtolower(filter_input(INPUT_GET, 'action'));
    if ($action == NULL) {
        $action = 'default';
    }
}
switch ($action) {
    case "add_course":
        $course_name = $_POST['course_name'];
        $course_desc = $_POST['course_desc'];
        $teacher = $_POST['teacher'];
        add_course($course_name, $course_desc, $teacher);
        header("Location: ../index.php");
        break;
    default:
        $teacher_list = admin_get_teachers();
        include "./view.php";
        break;
}