public static function is_exam_global_enabled($courseid) { $cache = get_cache_function("unit_elearning", 3600); $steamgroup = $cache->call("steam_factory::get_object", $GLOBALS["STEAM"]->get_id(), $courseid); $course = new koala_group_course($steamgroup); $unit = self::get_elearning_unit($courseid); if (is_object($unit)) { $exam = new exam($unit, $cache->call(array($unit, "get_attribute"), "ELEARNING_UNIT_ID"), $course); return $exam->get_exam()->is_global_enabled(); } return false; }
function handle_path($path, $owner = FALSE, $portal = FALSE) { $r = ""; foreach ($path as $s) { $r .= $s; } if (is_string($path)) { $path = url_parse_rewrite_path($path); } //lms_portal::get_instance()->initialize(GUEST_NOT_ALLOWED); $steam_unit = ""; $action = ""; if (isset($path[0]) && is_numeric($path[0])) { $steam_unit = steam_factory::get_object($GLOBALS["STEAM"]->get_id(), (int) $path[0]); if (is_object($steam_unit) && $steam_unit->get_attribute("UNIT_TYPE") !== "units_elearning") { return; } //TODO: cool. neues object von sich in sich ? Häh, geil! $unit = new units_elearning($owner->get_steam_object()); $docextern = new koala_object_elearning($steam_unit, $unit); if (isset($path[1])) { $action = $path[1]; } } $portal_user = lms_portal::get_instance()->get_user(); $user = lms_steam::get_current_user(); $scg = steam_factory::get_object($GLOBALS["STEAM"]->get_id(), STEAM_COURSES_GROUP, CLASS_GROUP); $current_semester = $owner->get_semester(); $course = $owner; $this->set_course($course); $backlink = $owner->get_url() . $this->get_path_name() . "/"; $html_handler = new koala_html_course($owner); if (count($path) > 0 && $path[0] == "reporting") { $first_unit = $this->get_elearning_unit(); $exam = new exam($first_unit, $this->cache->call(array($first_unit, "get_attribute"), "ELEARNING_UNIT_ID"), $owner); if ($course->is_admin($user)) { $exam->render_reporting_html(); } else { header("location:../../"); exit; } } else { if (count($path) > 0 && $path[0] == "") { $first_unit = $this->get_elearning_unit(); $exam = new exam($first_unit, $this->cache->call(array($first_unit, "get_attribute"), "ELEARNING_UNIT_ID"), $owner); if ($exam->get_exam()->is_global_enabled() && elearning_user::get_instance($user->get_name(), $course->get_id())->has_exam_enabled()) { $exam->render_html(); } else { header("location:../"); exit; } } else { if (count($path) > 1 && $path[0] == "report") { $first_unit = $this->get_elearning_unit(); $exam = new exam($first_unit, $this->cache->call(array($first_unit, "get_attribute"), "ELEARNING_UNIT_ID"), $owner); $steam_user = $this->cache->call("steam_factory::get_user", $GLOBALS["STEAM"]->get_id(), $path[1]); if ($exam->get_exam()->is_global_enabled() && $course->is_staff($user) && $steam_user instanceof steam_user) { $exam->render_report_html($steam_user); } else { header("location:../"); exit; } } else { if (count($path) > 1 && $path[0] == "chart") { $first_unit = $this->get_elearning_unit(); $exam = new exam($first_unit, $this->cache->call(array($first_unit, "get_attribute"), "ELEARNING_UNIT_ID"), $owner); if ($exam->get_exam()->is_global_enabled() && $course->is_staff($user)) { $exam->render_chart_html(); } else { header("location:../"); exit; } } else { if (count($path) == 1 || count($path) == 2 && $path[1] == "") { $action = "index"; include PATH_EXTENSIONS . 'units_elearning/modules/units_elearning.php'; } else { if (count($path) > 2 && $path[1] == "elearning") { $action = "chapter"; $chapter = $path[2]; if (count($path) > 4 && $path[3] == "media") { $action = "media"; $media = $path[4]; } include PATH_EXTENSIONS . 'units_elearning/modules/units_elearning.php'; } else { if (count($path) > 2 && $path[1] == "scripts") { $action = "scripts"; $scripts = ""; for ($i = 1; $i < count($path); $i++) { $scripts .= "/" . $path[$i]; } include PATH_EXTENSIONS . 'units_elearning/modules/units_elearning.php'; } else { if (count($path) > 1 && $path[1] == "directaccess") { $mediathek = elearning_mediathek::get_instance(); $elearning_course = elearning_mediathek::get_elearning_course_for_unit($steam_unit); $da = new directaccess($elearning_course->get_id(), $course); $da->callfunction($_POST["case"]); } else { $url = ""; $first = TRUE; foreach ($path as $s) { if ($first) { $first = FALSE; } else { $url .= "/" . $s; } } $url = "/packages/elearning_stahl_verkauf" . "/chapters/" . $_SESSION["chapter"] . $url; $steam_doc = $this->cache->call("steam_factory::get_object_by_name", $GLOBALS["STEAM"]->get_id(), $url); if ($steam_doc instanceof steam_document) { echo $this->cache->call(array($steam_doc, "download")); exit; } else { error_log("Could not find: " . $url); } } } } } } } } } return true; }