Esempio n. 1
0
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 
course_table($_SESSION['dept'], $_SESSION['year'], $_SESSION['season']);
?>

function processing_submit()
{
    global $wpdb;
    $cls_query = 'select * from ' . $wpdb->get_blog_prefix() . 'cls_course_data where cls_id = %d';
    $cls_data = $wpdb->get_row($wpdb->prepare($cls_query, $_GET['id']), ARRAY_A);
    if (!$cls_data) {
        return 'There is no course with that id';
    }
    $output = "<p>This is your class information</p>\n";
    $output .= course_table($cls_data);
    $output .= "<p>This is your student informaiton</p>\n";
    $adultStudent = $cls_data['cls_level'] == 4 ? true : false;
    $output .= student_information_for_mail($adultStudent);
    if ($adultStudent) {
        $to = $_POST['stu_email'];
    } else {
        if (isset($_POST['parent2_email'])) {
            $to = array($_POST['parent1_email'], $_POST['parent2_email']);
        } else {
            $to = $_POST['parent1_email'];
        }
    }
    $subject = "Vermont Chinese School 2015-2016 Class Registration";
    $content = "<html><header>" . $subject . "</header>\n<body>" . $output . "</body></html>";
    //$status = wp_mail($to, $subject, $content);
    return $output;
}