Beispiel #1
0
function classEventMain()
{
    $res = "";
    $out =& $GLOBALS["page"];
    $out->setWorkingZone("content");
    $lang =& DoceboLanguage::createInstance("classevent", "lms");
    $back_ui_url = "index.php?modname=classevent&op=main";
    $title_arr = array();
    $title_arr[$back_ui_url] = $lang->def("_CLASS_EVENT");
    $res .= getTitleArea($title_arr, "classevent");
    $res .= "<div class=\"std_block\">\n";
    require_once $GLOBALS["where_framework"] . "/lib/resources/lib.timetable.php";
    $tt = new TimeTable();
    $permissions = 2;
    $size = isset($_GET["size"]) ? $_GET["size"] : "max";
    addCss('windows');
    addCss('calendar_' . $size, "lms");
    //addAjaxJs();
    //addScriptaculousJs();
    YuiLib::load(array('my_window' => 'windows.js'));
    $GLOBALS['page']->add("\n" . '<script type="text/javascript" src="' . $GLOBALS['where_lms_relative'] . '/modules/calendar/calendar.js"></script>' . "\n", 'page_head');
    $GLOBALS['page']->add("\n" . '<script type="text/javascript" src="' . $GLOBALS['where_lms_relative'] . '/modules/calendar/calendar_helper.js"></script>' . "\n", 'page_head');
    require_once $GLOBALS["where_lms"] . "/lib/lib.classroom.php";
    $cm = new ClassroomManager();
    $class_arr = $cm->getClassroomArray();
    $GLOBALS['page']->add('<script type="text/javascript">' . ' setup_url(\'' . $GLOBALS['where_lms_relative'] . '/ajax.server.php?mn=calendar&\',\'lms_classroom\',\'lms_classroom\'); ' . ' setup_mode("edit",' . $permissions . ',"' . Docebo::user()->getUserId() . '"); ' . '</script>', 'page_head');
    $width = "90%";
    if ($size == "min") {
        $width = "200px";
    }
    $res .= "\n";
    $res .= "<div class=\"std_block\" style=\"margin:auto;width:" . $width . ";\">\n";
    $res .= "<p>" . $lang->def("_SELECT_CLASSROOM") . ": <select name=\"classroom_selected\" id=\"classroom_selected\"  onChange=\"updateCalendar(cal.date);\"><option value=\"\">(" . $lang->def("_SELECT_ALL") . ")</option>";
    while (list($key, $value) = each($class_arr)) {
        $res .= "<option value=\"" . htmlentities($key) . "\">" . htmlentities($value) . "</option>";
    }
    $res .= "</select></p>";
    $res .= "</div>\n";
    $res .= "\n" . '<div id="displayCalendar" style="margin: auto; clear: both; width:' . $width . '"></div>';
    $res .= "</div>\n";
    $out->add($res);
    require_once _base_ . '/lib/lib.dialog.php';
    setupHrefDialogBox('a[href*=del]');
}
    function getForm()
    {
        require_once $GLOBALS["where_lms"] . "/lib/lib.classroom.php";
        $cm = new ClassroomManager();
        $class_arr = $cm->getClassroomArray();
        $class_list = "[" . implode(",", addSurroundingQuotes($class_arr, '"')) . "]";
        $class_keys = "[" . implode(",", addSurroundingQuotes(array_keys($class_arr), '"')) . "]";
        $form_obj = '{
		"form":[
			{"type":"structure","value":"row"},
			{"type":"structure","value":"cell","field_class":"label"},
			{"type":"label","value":"_START"},
			{"type":"structure","value":"/cell"},
			{"type":"structure","value":"cell","field_class":"field"},
			{"type":"day","id":"start_day"},
			{"type":"string","value":"/"},
			{"type":"month","id":"start_month"},
			{"type":"string","value":"/"},
			{"type":"year","id":"start_year"},
			{"type":"string","value":"&nbsp;"},
			{"type":"hour","id":"start_hour"},
			{"type":"string","value":":"},
			{"type":"min","id":"start_min"},
			{"type":"string","value":":"},
			{"type":"sec","id":"start_sec"},
			{"type":"structure","value":"/cell"},
			{"type":"structure","value":"/row"},
			{"type":"structure","value":"row"},
			{"type":"structure","value":"cell","field_class":"label"},
			{"type":"label","value":"_END"},
			{"type":"structure","value":"/cell"},
			{"type":"structure","value":"cell","field_class":"field"},
			{"type":"day","id":"end_day"},
			{"type":"string","value":"/"},
			{"type":"month","id":"end_month"},
			{"type":"string","value":"/"},
			{"type":"year","id":"end_year"},
			{"type":"string","value":"&nbsp;"},
			{"type":"hour","id":"end_hour"},
			{"type":"string","value":":"},
			{"type":"min","id":"end_min"},
			{"type":"string","value":":"},
			{"type":"sec","id":"end_sec"},
			{"type":"structure","value":"/cell"},
			{"type":"structure","value":"/row"},
			{"type":"structure","value":"row"},
			{"type":"structure","value":"cell","field_class":"label"},
			{"type":"label","value":"_SUBJECT"},
			{"type":"structure","value":"/cell"},
			{"type":"structure","value":"cell","field_class":"field"},
			{"type":"text","id":"title","style":"width:300px"},
			{"type":"structure","value":"/cell"},
			{"type":"structure","value":"/row"},
			{"type":"structure","value":"row"},
			{"type":"structure","value":"cell","field_class":"label"},
			{"type":"label","value":"' . Lang::t("_CLASSROOM", "admin_classroom", "lms") . '","translatevalue":"0"},
			{"type":"structure","value":"/cell"},
			{"type":"structure","value":"cell","field_class":"field"},	{"type":"select","id":"classroom","value":' . $class_list . ',"key":' . $class_keys . ',"translatevalue":"0"},
			{"type":"structure","value":"/cell"},
			{"type":"structure","value":"/row"},
			{"type":"structure","value":"row"},
			{"type":"structure","value":"cell","field_class":"label"},
			{"type":"label","value":"_DESCR"},
			{"type":"structure","value":"/cell"},
			{"type":"structure","value":"cell","field_class":"field"},
			{"type":"textarea","id":"description"},
			{"type":"structure","value":"/cell"},
			{"type":"structure","value":"/row"}
		]

		}';
        return $form_obj;
    }