if (!isset($form->name)) {
    $form->name = '';
}
$cssfile = $CFG->wwwroot;
$cssfile .= "/mod/sclipowebclass/css/";
$scimg = $CFG->wwwroot . "/mod/sclipowebclass/scimg/";
// Check security
if (!sclipo_checkLogin("notusedanymore", $USER->username)) {
    echo "Error: Need to be logged in to Sclipo";
    exit;
}
// Get user timezone information
$timezone = sclipo_gettimezone($_SESSION["sclipo_id"], $USER->username);
$date = date("Y-m-d h:iA e");
$cur_time = date("h:iA");
$confirmed = sclipo_isTimezoneConfirmed($_SESSION["sclipo_id"], $USER->username);
if (isset($_POST['submitted'])) {
    // Check permissions
    if (!($cm = get_record("course_modules", "id", $_POST["update"]))) {
        error("This course module doesn't exist");
    }
    if (!($course = get_record("course", "id", $cm->course))) {
        error("This course doesn't exist");
    }
    require_login($course->id);
    // needed to setup proper $COURSE
    $context = get_context_instance(CONTEXT_COURSE, $course->id);
    require_capability('moodle/course:manageactivities', $context);
    if (!($module = get_record("modules", "id", $cm->module))) {
        error("This module doesn't exist");
    }
if (!isset($form->name)) {
    $form->name = '';
}
$cssfile = $CFG->wwwroot;
$cssfile .= "/mod/sclipowebclass/css/";
$scimg = $CFG->wwwroot . "/mod/sclipowebclass/scimg/";
// Check security
if (!sclipo_checkLogin("notusedanymore", $USER->username)) {
    echo "Error: Need to be logged in to Sclipo";
    exit;
}
// Get user timezone information
$timezone = sclipo_gettimezone("notused", $USER->username);
$date = date("Y-m-d h:iA e");
$cur_time = date("h:iA");
$confirmed = sclipo_isTimezoneConfirmed("notused", $USER->username);
// Check if user just created a new webclass
if (isset($_POST['submitted'])) {
    // This is for the sclipo table
    class SclipoWebClass
    {
        var $teacherid;
        var $title;
        var $description;
        var $tags;
        var $class_date;
        var $time;
        var $duration;
        var $max_students;
    }
    // This is for the event table (used by calendar)