function handle_path($path, $owner = FALSE, $portal = FALSE) { if (is_string($path)) { $path = url_parse_rewrite_path($path); } if (!isset($portal) || !is_object($portal)) { $portal = lms_portal::get_instance(); $portal->initialize(GUEST_NOT_ALLOWED); } 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_pyramiddiscussion") { return; } $koala_container = new koala_container_pyramiddiscussion($steam_unit, new units_pyramiddiscussion($owner->get_steam_object())); $unit = $koala_container; } $portal_user = $portal->get_user(); $user = lms_steam::get_current_user(); $scg = steam_factory::get_object($GLOBALS["STEAM"]->get_id(), STEAM_COURSES_GROUP, CLASS_GROUP); //$current_semester = steam_factory::groupname_to_object( $GLOBALS[ "STEAM" ]->get_id(), $scg->get_name() . "." . $path[0]); $current_semester = $owner->get_semester(); //$backlink = PATH_URL . "extensions/units/" . $path[0] ."/" . $path[1] . "/units/"; $backlink = $owner->get_url() . $this->get_path_name() . "/"; $html_handler = new koala_html_course($owner); $html_handler->set_context("units", array("subcontext" => "unit", "owner" => $owner, "unit" => $unit)); $course = $owner; include PATH_EXTENSIONS . "units_pyramiddiscussion/modules/units_pyramiddiscussion.php"; }
function handle_path($path, $owner = FALSE, $portal = FALSE) { $r = ""; foreach ($path as $s) { $r .= $s; } error_log("Path: " . $r); if (is_string($path)) { $path = url_parse_rewrite_path($path); } if (!isset($portal) || !is_object($portal)) { $portal = lms_portal::get_instance(); $portal->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_mediathing") { 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 = $portal->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; $backlink = $owner->get_url() . $this->get_path_name() . "/"; $html_handler = new koala_html_course($owner); if (count($path) > 1 && $path[1] == "create_exit") { // sinnvolle aktionen hier $action = "create_exit"; include PATH_EXTENSIONS . 'units_mediathing/modules/units_mediathing.php'; } else { $action = "index"; include PATH_EXTENSIONS . 'units_mediathing/modules/units_mediathing.php'; } }
function handle_path($path, $owner = FALSE, $portal = FALSE) { if (is_string($path)) { $path = url_parse_rewrite_path($path); } if (!isset($portal) || !is_object($portal)) { $portal = lms_portal::get_instance(); $portal->initialize(GUEST_NOT_ALLOWED); } $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_extern") { return; } $unit = new units_extern($owner->get_steam_object()); $docextern = new koala_object_docextern($steam_unit, $unit); if (isset($path[1])) { $action = $path[1]; } } $portal_user = $portal->get_user(); $user = lms_steam::get_current_user(); $scg = steam_factory::get_object($GLOBALS["STEAM"]->get_id(), STEAM_COURSES_GROUP, CLASS_GROUP); //$current_semester = steam_factory::groupname_to_object( $GLOBALS[ "STEAM" ]->get_id(), $scg->get_name() . "." . $path[0]); $current_semester = $owner->get_semester(); $course = $owner; //$backlink = PATH_URL . "extensions/units/" . $path[0] ."/" . $path[1] . "/units/"; $backlink = $owner->get_url() . $this->get_path_name() . "/"; $html_handler = new koala_html_course($owner); $html_handler->set_context("units", array('subcontext' => 'unit', 'owner' => $owner, 'unit' => $docextern)); switch ($action) { case 'edit': include self::$PATH . 'modules/units_extern_edit.php'; exit; break; case 'delete': include self::$PATH . 'modules/units_extern_delete.php'; exit; break; } include PATH_EXTENSIONS . 'units_extern/modules/units_extern.php'; }
<?php include_once "../etc/koala.conf.php"; include_once PATH_LIB . "url_handling.inc.php"; include_once PATH_LIB . "format_handling.inc.php"; $portal = lms_portal::get_instance(); $portal->initialize(GUEST_NOT_ALLOWED); $login = $_GET["id"]; if (!($user = steam_factory::username_to_object($STEAM->get_id(), $login))) { include "bad_link.php"; exit; } $backlink = PATH_URL . "user/" . $login . "/"; $path = url_parse_rewrite_path($_GET["path"]); switch (TRUE) { case $path[0] == "contacts": if (YOUR_CONTACTS) { $backlink .= "contacts/"; include "user_contacts.php"; } else { include "bad_link.php"; } exit; break; case $path[0] == "groups": if (YOUR_GROUPS) { $backlink .= "groups/"; include "user_groups.php"; } else { include "bad_link.php"; }
function handle_path($path, $owner = FALSE, $portal = FALSE) { if (!isset($portal) || !is_object($portal)) { $portal = lms_portal::get_instance(); $portal->initialize(GUEST_NOT_ALLOWED); } 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_pointlist") { return; } $koala_container = new koala_container_pointlist($steam_unit, new units_pointlist($owner->get_steam_object())); $unit = $koala_container; } $backlink = $owner->get_url() . $this->get_path_name() . "/"; $html_handler = new koala_html_course($owner); $html_handler->set_context("units", array("subcontext" => "unit", "owner" => $owner, "unit" => $unit)); $user = lms_steam::get_current_user(); $course = $owner; if (is_string($path)) { $path = url_parse_rewrite_path($path); } if (!is_object($owner) || !$owner instanceof koala_group_course) { throw new Exception("No owner (course) provided.", E_PARAMETER); } switch (TRUE) { case isset($path[1]) && $path[1] == "sheets_edit": include PATH_EXTENSIONS . "units_pointlist/modules/units_pointlist_sheets_edit.php"; break; case isset($path[1]) && $path[1] == "export_excel": include PATH_EXTENSIONS . "units_pointlist/modules/units_pointlist_excel.php"; break; default: include PATH_EXTENSIONS . "units_pointlist/modules/units_pointlist.php"; break; } }
function handle_path($path, $owner = FALSE, $portal = FALSE) { if (is_string($path)) { $path = url_parse_rewrite_path($path); } if (!isset($portal) || !is_object($portal)) { $portal = lms_portal::get_instance(); $portal->initialize(GUEST_NOT_ALLOWED); } $portal_user = $portal->get_user(); $user = lms_steam::get_current_user(); $scg = steam_factory::get_object($GLOBALS["STEAM"]->get_id(), STEAM_COURSES_GROUP, CLASS_GROUP); //$current_semester = steam_factory::groupname_to_object( $GLOBALS[ "STEAM" ]->get_id(), $scg->get_name() . "." . $path[0]); $current_semester = $owner->get_semester(); //$backlink = PATH_URL . "extensions/units/" . $path[0] ."/" . $path[1] . "/units/"; $backlink = $owner->get_url() . $this->get_path_name() . "/"; $action = ""; if (isset($path[0]) && is_numeric($path[0])) { if (isset($path[1]) && is_numeric($path[1])) { $backlink .= $path[0] . "/"; $container = steam_factory::get_object($GLOBALS["STEAM"]->get_id(), (int) $path[1], CLASS_CONTAINER); $koala_container = new koala_container($container, $backlink); $backlink .= $path[1] . "/"; $unit = steam_factory::get_object($GLOBALS["STEAM"]->get_id(), (int) $path[0]); if (isset($path[2])) { $action = $path[2]; } } else { $backlink .= $path[0] . "/"; $container = steam_factory::get_object($GLOBALS["STEAM"]->get_id(), (int) $path[0], CLASS_CONTAINER); $koala_container = new koala_container_homework($container, new units_homework($owner->get_steam_object())); $unit = $koala_container; if (isset($path[1])) { $action = $path[1]; } } } else { $container = $owner->get_workroom(); $koala_container = new koala_container_workroom($container, $backlink); $unit = $koala_container; if (isset($path[0])) { $action = $path[0]; } } if (is_object($unit) && $unit->get_attribute("UNIT_TYPE") !== "container_homework_unit_koala" && $unit->get_attribute("UNIT_TYPE") !== "units_homework") { if (!$unit instanceof koala_container_homework && !$this->get_koala_object_for($unit->get_steam_object(), $unit->get_steam_object()->get_type(), $unit->get_attribute(OBJ_TYPE)) instanceof koala_container_homework) { return FALSE; } } $koala_container->set_obj_types_invisible(array("container_wiki_koala", "room_wiki_koala", "KOALA_WIKI")); $html_handler = new koala_html_course($owner); $html_handler->set_context("units", array("subcontext" => "unit", "owner" => $owner, "unit" => $unit, "container" => $container)); switch ($action) { case "new-folder": $environment = $container; unset($container); unset($koala_container); include "container_new.php"; exit; break; case "edit": if ($container->get_id() == $unit->get_id()) { include self::$PATH . "modules/units_homework_edit.php"; } else { include "container_edit.php"; } exit; break; case "delete": include "container_delete.php"; exit; break; case "new_homework": include self::$PATH . "modules/units_homework_upload.php"; exit; break; case "feedback": include self::$PATH . "modules/units_homework_feedback.php"; exit; break; case "points_tab": include self::$PATH . "modules/units_homework_pointslist.php"; exit; break; } include self::$PATH . "modules/units_homework.php"; return TRUE; }
function handle_path($path, $owner = FALSE, $portal = FALSE) { $course = $owner; //the course was given by the owner parameter $isAdmin = $course->is_admin(lms_steam::get_current_user()); //parse the url path into an array if (is_string($path)) { $path = url_parse_rewrite_path($path); } if (!is_object($owner) || !$owner instanceof koala_group_course) { throw new Exception("No owner (course) provided.", E_PARAMETER); } //choose and save last exam term if (isset($path[0])) { switch ($path[0]) { case "exam1": $course->set_attribute("EXAM_ORGANIZATION_LAST_TERM_SELECTED", 1); break; case "exam2": $course->set_attribute("EXAM_ORGANIZATION_LAST_TERM_SELECTED", 2); break; case "exam3": $course->set_attribute("EXAM_ORGANIZATION_LAST_TERM_SELECTED", 3); break; default: //do nothing } } $examTerm = $course->get_attribute("EXAM_ORGANIZATION_LAST_TERM_SELECTED"); if ($examTerm != 1 && $examTerm != 2 && $examTerm != 3) { $course->set_attribute("EXAM_ORGANIZATION_LAST_TERM_SELECTED", 1); $examTerm = 1; } /* //test case if (isset($path[0]) && $path[0]=="test"){include( self::$PATH . "test.php" );die();} if (isset($path[0]) && $path[0]=="setup"){include( self::$PATH . "setup_exam.php" );die();} if (isset($path[0]) && $path[0]=="cleanup"){include( self::$PATH . "cleanup_database.php" );die();} */ //security check - do no advanced functions if not admin if (!$isAdmin) { include self::$PATH . "exam_organization.php"; exit; } //check if password is set $examObject = exam_organization_exam_object_data::getInstance($course); if ($examObject->isSetMasterPassword()) { if (isset($_SESSION["password"]) && $examObject->checkMasterPassword($_SESSION["password"])) { //correct pw entered } else { //enter password dialog include_once self::$PATH . "initialize_portal.php"; include self::$PATH . "enter_password.php"; } } else { //no password set for this course } if ($path[0] == "newexam") { include_once self::$PATH . "initialize_portal.php"; include self::$PATH . "new_term.php"; } if ($path[0] == "removeexam") { include_once self::$PATH . "initialize_portal.php"; include self::$PATH . "remove_last_term.php"; } if ($path[0] == "geticon") { include_once self::$PATH . "initialize_portal.php"; include self::$PATH . "get_icon.php"; exit(0); } if ($path[0] == "directaccess") { include_once self::$PATH . "initialize_portal.php"; include self::$PATH . "ajax_update_data.php"; exit(0); } if ($path[0] == "password") { include_once self::$PATH . "initialize_portal.php"; include self::$PATH . "setup_password.php"; } if (isset($path[1])) { switch ($path[1]) { case "show_and_import_participants": include_once self::$PATH . "initialize_portal.php"; include self::$PATH . "show_and_import_participants.php"; die; case "show_participants_and_points": include_once self::$PATH . "initialize_portal.php"; include self::$PATH . "show_participants_and_points.php"; die; case "setplaces": include_once self::$PATH . "initialize_portal.php"; include self::$PATH . "set_places_for_participants.php"; break; case "resetplaces": include_once self::$PATH . "initialize_portal.php"; include self::$PATH . "reset_places_for_participants.php"; break; case "createplaceslist": include_once self::$PATH . "initialize_portal.php"; include self::$PATH . "create_places_list.php"; die; case "createparticipantslist": include_once self::$PATH . "initialize_portal.php"; include self::$PATH . "create_participants_list_by_name.php"; die; case "createparticipantslistbyname": include_once self::$PATH . "initialize_portal.php"; include self::$PATH . "create_participants_list_by_name.php"; die; case "createparticipantslistbyplace": include_once self::$PATH . "initialize_portal.php"; include self::$PATH . "create_participants_list_by_place.php"; die; case "createlabels": include_once self::$PATH . "initialize_portal.php"; include self::$PATH . "create_exam_labels.php"; die; case "importbonus": include_once self::$PATH . "initialize_portal.php"; include self::$PATH . "import_bonus_points.php"; break; case "examkey": include_once self::$PATH . "initialize_portal.php"; include self::$PATH . "setup_exam_examkey.php"; die; case "assignments": include_once self::$PATH . "initialize_portal.php"; include self::$PATH . "setup_exam_assignments.php"; die; case "time": include_once self::$PATH . "initialize_portal.php"; include self::$PATH . "setup_exam_date_time.php"; die; case "date": include_once self::$PATH . "initialize_portal.php"; include self::$PATH . "setup_exam_date_time.php"; die; case "room": include_once self::$PATH . "initialize_portal.php"; include self::$PATH . "setup_exam_room.php"; die; case "enterpoints": include_once self::$PATH . "initialize_portal.php"; include self::$PATH . "input_exam_results.php"; die; case "excelexamoffice": include_once self::$PATH . "initialize_portal.php"; include self::$PATH . "export_results_examoffice_excel.php"; die; case "excelexamoffice_hislsf": include_once self::$PATH . "initialize_portal.php"; include self::$PATH . "export_results_examoffice_excel_hislsf.php"; die; case "excelstatistics": include_once self::$PATH . "initialize_portal.php"; include self::$PATH . "export_results_and_statistics_excel.php"; die; case "pdfstatistics": include_once self::$PATH . "initialize_portal.php"; include self::$PATH . "export_results_and_statistics_pdf.php"; die; case "freetext": include_once self::$PATH . "initialize_portal.php"; include self::$PATH . "setup_exam_freetext.php"; break; case "deletedata": include_once self::$PATH . "initialize_portal.php"; include self::$PATH . "delete_term_data.php"; break; case "deleteterm": include_once self::$PATH . "initialize_portal.php"; include self::$PATH . "delete_term.php"; break; case "mail": include_once self::$PATH . "initialize_portal.php"; include self::$PATH . "mail.php"; break; default: //do nothing } } include self::$PATH . "exam_organization.php"; return TRUE; }
<?php include_once "../etc/koala.conf.php"; include_once PATH_LIB . "url_handling.inc.php"; include_once PATH_LIB . "format_handling.inc.php"; $portal = lms_portal::get_instance(); $portal->initialize(GUEST_NOT_ALLOWED); $user = lms_steam::get_current_user(); $portal_user = $portal->get_user(); $path = url_parse_rewrite_path(isset($_GET["path"]) ? $_GET["path"] : ""); try { $steam_group = !empty($_GET["id"]) ? steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $_GET["id"]) : FALSE; } catch (Exception $ex) { include "bad_link.php"; exit; } $group_is_private = FALSE; if ($steam_group && is_object($steam_group)) { switch ((string) $steam_group->get_attribute("OBJ_TYPE")) { case "course": $group = new koala_group_course($steam_group); $backlink = PATH_URL . SEMESTER_URL . "/" . $group->get_semester()->get_name() . "/" . h($group->get_name()) . "/"; break; default: $group = new koala_group_default($steam_group); $backlink = PATH_URL . "groups/" . $group->get_id() . "/"; // Determine if group is public or private $parent = $group->get_parent_group(); if ($parent->get_id() == STEAM_PRIVATE_GROUP) { $group_is_private = TRUE; }
function handle_path($path, $owner = FALSE, $portal = FALSE) { if (is_string($path)) { $path = url_parse_rewrite_path($path); } if (!is_object($owner)) { throw new Exception("No owner provided.", E_PARAMETER); } if (!isset($portal) || !is_object($portal)) { $portal = lms_portal::get_instance(); $portal->initialize(GUEST_NOT_ALLOWED); } $portal_user = $portal->get_user(); $user = lms_steam::get_current_user(); $scg = steam_factory::get_object($GLOBALS["STEAM"]->get_id(), STEAM_COURSES_GROUP, CLASS_GROUP); //$current_semester = steam_factory::groupname_to_object( $GLOBALS[ "STEAM" ]->get_id(), $scg->get_name() . "." . $path[0]); $current_semester = $owner->get_semester(); $backlink = $owner->get_url() . $this->get_path_name() . "/"; //$backlink = PATH_URL . "extensions/units/" . $path[0] ."/" . $path[1] . "/units/"; switch (TRUE) { case isset($path[0]) && $path[0] == "new": if (!$portal_user->is_logged_in()) { throw new Exception("Access denied. Please login.", E_USER_AUTHORIZATION); } $course = $owner; include self::$PATH . "unit_new.php"; exit; break; case isset($path[0]) && is_numeric($path[0]) && isset($path[1]) && $path[1] == "edit": if (!$portal_user->is_logged_in()) { throw new Exception("Access denied. Please login.", E_USER_AUTHORIZATION); } $course = $owner; $steam_unit = steam_factory::get_object($GLOBALS["STEAM"]->get_id(), (int) $path[0]); if (!is_object($steam_unit)) { include PATH_PUBLIC . "bad_link.php"; exit; } global $unit; $unit = koala_object::get_koala_object($steam_unit); if (!is_object($unit)) { include PATH_PUBLIC . "bad_link.php"; exit; } if (!$steam_unit->check_access_write($user)) { throw new Exception(gettext("You have no write access for this unit"), E_USER_RIGHTS); } $backlink = $backlink . $path[0] . "/"; include self::$PATH . "unit_edit.php"; exit; break; case isset($path[0]) && is_numeric($path[0]) && isset($path[1]) && $path[1] == "delete": if (!$portal_user->is_logged_in()) { throw new Exception("Access denied. Please login.", E_USER_AUTHORIZATION); } $course = $owner; $steam_unit = steam_factory::get_object($GLOBALS["STEAM"]->get_id(), (int) $path[0]); if (!is_object($steam_unit)) { include PATH_PUBLIC . "bad_link.php"; exit; } global $unit; $unit = koala_object::get_koala_object($steam_unit); if (!is_object($unit)) { include PATH_PUBLIC . "bad_link.php"; exit; } if (!$steam_unit->check_access_write($user)) { throw new Exception(gettext("You have no write access for this unit"), E_USER_RIGHTS); } $backlink = $backlink . $path[0] . "/"; include self::$PATH . "unit_delete.php"; exit; break; case isset($path[0]) && !empty($path[0]): if (!$portal_user->is_logged_in()) { throw new Exception("Access denied. Please login.", E_USER_AUTHORIZATION); } if (!is_numeric($path[0])) { return FALSE; } // not a unit id $steam_unit = steam_factory::get_object($GLOBALS["STEAM"]->get_id(), (int) $path[0]); if (!is_object($steam_unit)) { return FALSE; } // not a unit $unit_type = $steam_unit->get_attribute('UNIT_TYPE'); if (!is_string($unit_type) || empty($unit_type)) { return FALSE; } // not a valid unit $unit_extension = unitmanager::create_unitmanager($owner)->get_unittype($unit_type); if (!is_object($unit_extension)) { return FALSE; } // no matching unit extension if ($unit_extension->handle_path($path, $owner, $portal)) { exit; } else { return FALSE; } break; default: if (!$portal_user->is_logged_in()) { throw new Exception("Access denied. Please login.", E_USER_AUTHORIZATION); } $course = $owner; include self::$PATH . "units.php"; exit; break; } return FALSE; }
function handle_path($path, $owner = FALSE, $portal = FALSE) { if (is_string($path)) { $path = url_parse_rewrite_path($path); } if (!is_object($owner)) { throw new Exception("No 'owner' provided.", E_PARAMETER); } if (!isset($portal) || !is_object($portal)) { $portal = lms_portal::get_instance(); $portal->initialize(GUEST_NOT_ALLOWED); } $portal_user = $portal->get_user(); $user = lms_steam::get_current_user(); $backlink = $owner->get_url() . $this->get_path_name() . "/"; $action = ""; if (isset($path[0]) && is_numeric($path[0])) { $backlink .= $path[0] . "/"; $container = steam_factory::get_object($GLOBALS["STEAM"]->get_id(), (int) $path[0], CLASS_CONTAINER); $koala_container = new koala_container($container); if (isset($path[1])) { $action = $path[1]; } } else { $container = $this->get_documents_folder($owner, TRUE); if (!is_object($container)) { return; } $koala_container = new koala_container_documents($container, $backlink); if (isset($path[0])) { $action = $path[0]; } } $koala_container->set_types_invisible(CLASS_USER | CLASS_CALENDAR); $koala_container->set_obj_types_invisible(array("container_wiki_koala", "KOALA_WIKI")); $html_handler = $owner->get_html_handler(); $html_handler->set_context("documents", array("koala_container" => $koala_container)); switch ($action) { case "new-folder": $environment = $container; unset($container); unset($koala_container); include "container_new.php"; exit; break; case "edit": include "container_edit.php"; exit; break; case "delete": include "container_delete.php"; exit; break; } include "container_inventory.php"; exit; }
function handle_path($path, $owner = FALSE, $portal = FALSE) { if (is_string($path)) { $path = url_parse_rewrite_path($path); } if (!is_object($owner) || !$owner instanceof koala_group_course) { throw new Exception("No owner (course) provided.", E_PARAMETER); } $portal_user = $portal->get_user(); $user = lms_steam::get_current_user(); $scg = steam_factory::get_object($GLOBALS["STEAM"]->get_id(), STEAM_COURSES_GROUP, CLASS_GROUP); //$current_semester = steam_factory::groupname_to_object( $GLOBALS[ "STEAM" ]->get_id(), $scg->get_name() . "." . $path[0]); $current_semester = $owner->get_semester(); $backlink = $owner->get_url() . $this->get_path_name() . "/"; //$backlink = PATH_URL . "extensions/" . $this->get_name() . "/" . $path[0] ."/" . $path[1] . "/" . $this->get_name() . "/"; switch (TRUE) { case isset($path[0]) && $path[0] == "enable": case isset($path[0]) && $path[0] == "disable": if (!$portal_user->is_logged_in()) { throw new Exception("Access denied. Please login.", E_USER_AUTHORIZATION); } $course = $owner; $switch = $path[0]; include self::$PATH . "switch_tutorials.php"; exit; break; case isset($path[0]) && $path[0] == "prefs": if (!$portal_user->is_logged_in()) { throw new Exception("Access denied. Please login.", E_USER_AUTHORIZATION); } $course = $owner; include self::$PATH . "tutorials_prefs.php"; exit; break; case isset($path[0]) && $path[0] == "new": if (!$portal_user->is_logged_in()) { throw new Exception("Access denied. Please login.", E_USER_AUTHORIZATION); } $course = $owner; include self::$PATH . "tutorial_new.php"; exit; break; case isset($path[0]) && !empty($path[0]) && isset($path[1]) && $path[1] == "delete": if (!$portal_user->is_logged_in()) { throw new Exception("Access denied. Please login.", E_USER_AUTHORIZATION); } $course = $owner; global $tutorial; if ($tutorial = steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $path[0])) { if (!$tutorial->check_access_write($user)) { include "no_access.php"; exit; } include self::$PATH . "tutorial_delete.php"; exit; } else { include PATH_PUBLIC . "bad_link.php"; exit; } break; case isset($path[0]) && !empty($path[0]) && isset($path[1]) && $path[1] == "edit": if (!$portal_user->is_logged_in()) { throw new Exception("Access denied. Please login.", E_USER_AUTHORIZATION); } $course = $owner; if ($tutorial_steam_group = steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $path[0])) { if (!$tutorial_steam_group->check_access_write($user)) { include "no_access.php"; exit; } $tutorial = new koala_group_tutorial($tutorial_steam_group); $backlink = $backlink . $path[0]; include self::$PATH . "tutorial_edit.php"; exit; } else { include PATH_PUBLIC . "bad_link.php"; exit; } break; case isset($path[0]) && !empty($path[0]) && isset($path[1]) && $path[1] == "requests": if (!$portal_user->is_logged_in()) { throw new Exception("Access denied. Please login.", E_USER_AUTHORIZATION); } $course = $owner; if ($group = steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $path[0])) { if (!$group->check_access_write($user)) { throw new Exception(gettext("You have no write access for this tutorial"), E_USER_RIGHTS); } $backlink = $backlink . $path[0]; include PATH_PUBLIC . "group_membership_requests.php"; exit; } else { include "bad_link.php"; exit; } break; case isset($path[0]) && !empty($path[0]): if (!$portal_user->is_logged_in()) { throw new Exception("Access denied. Please login.", E_USER_AUTHORIZATION); } $course = $owner; global $tutorial; if (is_object($tutorial = steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $path[0]))) { if (!$tutorial->check_access_read($user)) { throw new Exception(gettext("You have no read access for this tutorial"), E_USER_RIGHTS); } include self::$PATH . "tutorial.php"; exit; } else { include PATH_PUBLIC . "bad_link.php"; exit; } break; default: if (!$portal_user->is_logged_in()) { throw new Exception("Access denied. Please login.", E_USER_AUTHORIZATION); } $course = $owner; include self::$PATH . "tutorials.php"; break; } }
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; }