Exemple #1
0
<?php

require "./navigation.php";
$course_id = safeget("course_id");
$courseTbl = new CourseTbl($course_id);
if (!$courseTbl->Get()) {
    error("Course not found");
}
$course = $courseTbl->detail;
if ($course['require_cinfo'] && !is_info_complete()) {
    MsgAndRedirect("profile_edit.php", "Your information is not complete.");
}
if ($course['require_bound'] && !is_authorized()) {
    MsgAndRedirect("netid_bind.php", "You need to bind your netid with your account first.");
}
if (is_course_registered($course_id)) {
    MsgAndRedirect("course_detail.php?course_id={$course_id}");
}
$now = time();
?>

<table class="ui-widget tblcontainer ui-widget-content ui-corner-all" width="100%">
    <caption> Course Detail </caption>

    <thead>
        <tr  class="ui-widget-header">
            <th width="50">ID</th>
            <th width="200">Name</th>
            <th width="200">Teacher</th>
            <th>Statistics</th>
        </tr>
Exemple #2
0
function DeleteCourse(&$arg)
{
    $course = new CourseTbl($arg['course_id']);
    if (!$course->Get()) {
        error("No such course.");
    }
    if (!is_course_modifiable($arg['course_id'])) {
        error("No permission");
    }
    $course->update['avail'] = 0;
    $course->Update();
    MsgAndRedirect("courses.php");
}
Exemple #3
0
<?php

require "./navigation.php";
include_once "./FCKeditor/fckeditor.php";
$course_id = tryget('course_id', '');
$courseTbl = new CourseTbl($course_id);
if ($course_id && !$courseTbl->Get()) {
    error("Course not found");
}
$course = $courseTbl->detail;
$rs = new RecordSet($conn);
$rs->Query("SELECT max(cid) FROM contests");
$rs->MoveNext();
$cid = $rs->Fields[0];
$rs->Query("SELECT * FROM contests");
?>

<script type="text/javascript">
    function pad0(num) {
        if (num < 10) return "0" + num;
        return num;
    }
    
    function calc_during() {
        if ($("#starttime").val().length == 0) {
            alert("Please set start time first!!");
            return;
        }
        var during = Date.parse($("#endtime").val()) - Date.parse($("#starttime").val());
        during = during / 1000;
        var s = during % 60;
Exemple #4
0
/**
 * Check whether the course is registerd
 * @global type $logged
 * @global type $login_uid
 * @param type $course_id
 * @return type 
 */
function is_course_registered($course_id)
{
    $course = new CourseTbl($course_id);
    $course->Get() or error("Course not found");
    global $logged;
    global $login_uid;
    if (!$logged) {
        error("Please login first");
    }
    $couresReg = new CourseRegTbl();
    $courseReg = new CourseRegTbl();
    $arr = array("course_id" => $course_id, "uid" => $login_uid);
    return $courseReg->GetByFields($arr);
}
Exemple #5
0
<?php

require "./navigation.php";
include_once "./FCKeditor/fckeditor.php";
$course_id = safeget("course_id");
$course = new CourseTbl($course_id);
if (!$course->Get()) {
    error("Course Not Found");
}
if (!is_course_modifiable($course_id)) {
    error("No permission");
}
?>
  

<form action="process.php?act=EditCourse" method="post" enctype="multipart/form-data">
    <input type="hidden" name="course_id" value="<?php 
echo $course->detail['course_id'];
?>
"/>
    <input type="hidden" name="avail" value="1"/>
    <table class="ui-widget tblcontainer ui-widget-content ui-corner-all" width="100%">
        <caption>Edit Course</caption>
        <thead >
            <tr class="ui-widget-header">
                <th width="100">Option</th>
                <th>Content</th>
                <th width="150">Example</th>
            </tr>
        </thead>
        <tbody>