public function frameResponse(\FrameResponseObject $frameResponseObject) { $path = $this->params; $portal = \lms_portal::get_instance(); $user = \lms_steam::get_current_user(); if (isset($path[0])) { if (\steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), "courses." . $path[0]) instanceof \steam_group) { $current_semester = \steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), "courses." . $path[0]); } else { header("Location: " . PATH_URL . "404/"); die; } } else { $current_semester = \lms_steam::get_current_semester(); } $current_semester_name = $current_semester->get_name(); if (\lms_steam::is_steam_admin($user)) { if (!$portal->get_user()->is_logged_in()) { throw new Exception("Access denied. Please login.", E_USER_AUTHORIZATION); } $semester_admins = \steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), $current_semester->get_groupname() . ".admins"); $admin_group = new \koala_group_default($semester_admins); if ($_SERVER["REQUEST_METHOD"] == "POST") { $delete = $_POST["delete"]; if (count($delete) == 1) { $login = key($delete); $admin = \steam_factory::username_to_object($GLOBALS["STEAM"]->get_id(), $login); $admin_group->remove_member($admin); } } $content = \Semester::getInstance()->loadTemplate("semester_admins.template.html"); $content->setVariable("INFORMATION_ADMINS", str_replace("%SEMESTER", h($current_semester->get_attribute("OBJ_DESC")), gettext("These people are allowed to create courses for %SEMESTER.")) . " " . gettext("They can appoint other users as staff members/moderators for their own courses.")); $content->setVariable("LINK_ADD_ADMIN", PATH_URL . "semester/addAdmin/" . $current_semester_name . "/" . $admin_group->get_id()); $content->setVariable("LABEL_ADD_ADMIN", gettext("Add another admin")); //TODO: Messages extension schreiben // TODO: Passt der Link? $content->setVariable("LINK_MESSAGE", PATH_URL . "mail/write/" . $admin_group->get_id()); $content->setVariable("LABEL_MESSAGE_ADMINS", gettext("Mail to admins")); $admins = $admin_group->get_members(); $no_admins = count($admins); if ($no_admins > 0) { $content->setVariable("LABEL_ADMINS", gettext("Course admins")); $content->setCurrentBlock("BLOCK_CONTACT_LIST"); $content->setVariable("LABEL_NAME_POSITION", gettext("Name") . "/" . gettext("Position")); $content->setVariable("LABEL_SUBJECT_AREA", gettext("Subject area")); $content->setVariable("LABEL_COMMUNICATION", gettext("Communication")); $content->setVariable("LABEL_REMOVE_ADMIN", gettext("Action")); foreach ($admins as $admin) { $adm_attributes = $admin->get_attributes(array("USER_FIRSTNAME", "USER_FULLNAME", "OBJ_DESC", "OBJ_ICON")); $content->setCurrentBlock("BLOCK_CONTACT"); $content->setVariable("CONTACT_NAME", h($adm_attributes["USER_FIRSTNAME"]) . " " . h($adm_attributes["USER_FULLNAME"])); // TODO: Profile Image einfügen // TODO: Passt der Link? $icon_link = \lms_user::get_user_image_url(30, 40); $content->setVariable("CONTACT_IMAGE", $icon_link); // TODO: Passt der Link? $content->setVariable("CONTACT_LINK", PATH_URL . "user/" . $admin->get_name() . "/"); $content->setVariable("OBJ_DESC", h($adm_attributes["OBJ_DESC"])); $content->setVariable("LABEL_MESSAGE", gettext("Message")); // TODO: Passt der Link? $content->setVariable("LINK_SEND_MESSAGE", PATH_URL . "mail/write/" . $admin->get_name()); $content->setVariable("LABEL_SEND", gettext("Send")); $content->setVariable("LABEL_REMOVE", gettext("Remove")); $content->setVariable("CONTACT_ID", $admin->get_name()); $content->parse("BLOCK_CONTACT"); } $content->parse("BLOCK_CONTACT_LIST"); } else { $content->setVariable("LABEL_ADMINS", gettext("No admins found.")); } /* TODO: Portal anpassen $portal->set_page_title( h($current_semester->get_name()) . " Admins" ); $portal->set_page_main( array( array( "link" => PATH_URL . SEMESTER_URL . "/" . h($current_semester->get_name()) . "/", "name" => h($current_semester->get_attribute( "OBJ_DESC" ))), array( "link" => "", "name" => gettext( "Admins" ) ) ), $content->get(), "" ); $portal->show_html( ); */ } else { header("Location: " . PATH_URL . "404/"); die; } $frameResponseObject->setTitle("Semester " . $current_semester_name); $rawHtml = new \Widgets\RawHtml(); $rawHtml->setHtml($content->get()); $frameResponseObject->addWidget($rawHtml); return $frameResponseObject; }
<?php include_once "../../etc/koala.conf.php"; $portal = lms_portal::get_instance(); $portal->initialize(GUEST_NOT_ALLOWED); $user = lms_steam::get_current_user(); if (!lms_steam::is_koala_admin($user)) { header("location:/"); exit; } $search_extension = "exam_organization"; $result = array(); $courses = lms_steam::semester_get_courses(lms_steam::get_current_semester()->get_id()); foreach ($courses as $course) { $koala_course = new koala_group_course(steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $course["OBJ_ID"])); $extensions = $koala_course->get_extensions(); foreach ($extensions as $extension) { if ($extension->get_name() == $search_extension) { $result[] = $course; } } } //var_dump($result); $html = <<<END <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>koaLA Admin - find big files</title> <style type="text/css"> * {margin:0; padding:0; outline:0}
public function frameResponse(\FrameResponseObject $frameResponseObject) { $path = $this->params; $user = \lms_steam::get_current_user(); $content = \Semester::getInstance()->loadTemplate("courses_overview.template.html"); $content->setVariable("HELP_TEXT", "<b>" . gettext('Notice') . ':</b> ' . gettext('You can easily find courses by using the filter. Just type in a part of the course\'s title, it\'s ID or the name of the tutor.')); $content->setVariable('LABEL_FILTER', gettext('Filter')); /** * Action Bar */ $content->setCurrentBlock("BLOCK_ACTIONBAR"); $isFiltered = false; $isEditMode = false; if (isset($path[0])) { if (\steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), "courses." . $path[0]) instanceof \steam_group) { $current_semester = \steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), "courses." . $path[0]); } else { ExtensionMaster::getInstance()->send404Error(); } } else { $current_semester = \lms_steam::get_current_semester(); } $current_semester_name = $current_semester->get_name(); if (isset($path[1]) && $path[1] == "booked") { $isFiltered = true; } if (isset($path[2]) && $path[2] == "edit") { $isEditMode = true; } if ($isFiltered) { if (ALL_COURSES) { $content->setCurrentBlock("BLOCK_ALL_COURSES"); $content->setVariable("LABEL_MY_COURSES", gettext("All courses")); $content->setVariable("LINK_MY_COURSES", PATH_URL . "semester/index/" . $current_semester_name . "/all" . ($isEditMode ? "/edit" : "")); $content->parse("BLOCK_ALL_COURSES"); } } else { if (YOUR_COURSES) { $content->setCurrentBlock("BLOCK_YOUR_COURSES"); $content->setVariable("LABEL_MY_COURSES", gettext("My courses")); $content->setVariable("LINK_MY_COURSES", PATH_URL . "semester/index/" . $current_semester_name . "/booked" . ($isEditMode ? "/edit" : "")); $content->parse("BLOCK_YOUR_COURSES"); } } if ($isEditMode) { $content->setCurrentBlock("BLOCK_EDIT_MODE"); $content->setVariable("LABEL_EDIT_MODE", gettext("Disable edit mode")); $content->setVariable("LINK_EDIT_MODE", PATH_URL . "semester/index/" . $current_semester_name . ($isFiltered ? "/booked" : "/all")); $content->parse("BLOCK_EDIT_MODE"); } else { $content->setCurrentBlock("BLOCK_EDIT_MODE"); $content->setVariable("LABEL_EDIT_MODE", gettext("Enable edit mode")); $content->setVariable("LINK_EDIT_MODE", PATH_URL . "semester/index/" . $current_semester_name . ($isFiltered ? "/booked" : "/all") . "/edit"); $content->parse("BLOCK_EDIT_MODE"); } $is_steam_admin = \lms_steam::is_steam_admin($user); if ($is_steam_admin || \lms_steam::is_semester_admin($current_semester, $user)) { $content->setCurrentBlock("BLOCK_SEMESTER_ADMIN"); if (ADD_COURSE) { $content->setCurrentBlock("BLOCK_ADD_COURSE"); $content->setVariable("LINK_CREATE_COURSE", PATH_URL . "semester/addCourse" . "/" . $current_semester_name); $content->setVariable("LABEL_CREATE_COURSE", gettext("Create new course")); $content->parse("BLOCK_ADD_COURSE"); } if (IMPORT_COURSE_FROM_PAUL) { $content->setCurrentBlock("BLOCK_IMPORT_COURSE_FROM_PAUL"); $content->setVariable("LINK_CREATE_PAUL_COURSE", PATH_URL . "semester/importCourse" . "/" . $current_semester_name); $content->setVariable("LABEL_CREATE_PAUL_COURSE", gettext("Create new course via PAUL")); $content->parse("BLOCK_IMPORT_COURSE_FROM_PAUL"); } if ($is_steam_admin) { $content->setCurrentBlock("BLOCK_SERVER_ADMIN"); if (MANAGE_SEMESTER) { $content->setCurrentBlock("BLOCK_MANAGE_SEMESTER"); $content->setVariable("LINK_MANAGE_SEMESTER", PATH_URL . "semester/manageSemester" . "/" . $current_semester_name); $content->setVariable("LABEL_MANAGE_SEMESTER", gettext("Manage this semester")); $content->parse("BLOCK_MANAGE_SEMESTER"); } if (ADD_SEMESTER) { $content->setCurrentBlock("BLOCK_ADD_SEMESTER"); $content->setVariable("LINK_CREATE_SEMESTER", PATH_URL . "semester/addSemester"); $content->setVariable("LABEL_CREATE_SEMESTER", gettext("Create new semester")); $content->parse("BLOCK_ADD_SEMESTER"); } $content->parse("BLOCK_SERVER_ADMIN"); } $content->parse("BLOCK_SEMESTER_ADMIN"); } $content->parse("BLOCK_ACTIONBAR"); // AUS DEM SYSTEM AUSLESEN $cache = get_cache_function("ORGANIZATION", 600); $semesters = $cache->call("lms_steam::get_semesters"); foreach ($semesters as $s) { $content->setCurrentBlock("BLOCK_TABS"); if ($s["OBJ_NAME"] == $current_semester_name) { $content->setVariable("TAB_STATE", "tabOut"); $content->setVariable("LINK_SEMESTER", $s["OBJ_NAME"]); } else { $content->setVariable("TAB_STATE", "tabIn"); $filter_part = ""; $content->setVariable("LINK_SEMESTER", "<a href=\"" . PATH_URL . "semester/index" . "/" . $s["OBJ_NAME"] . "/" . ($isFiltered ? "booked" : "all") . "\">" . $s["OBJ_NAME"] . "</a>"); } $content->parse("BLOCK_TABS"); } $courses = $isFiltered ? $cache->call("lms_steam::semester_get_courses", $current_semester->get_id(), $user->get_name()) : $cache->call("lms_steam::semester_get_courses", $current_semester->get_id()); $no_courses = count($courses); if ($no_courses > 0) { $content->setCurrentBlock("BLOCK_COURSES_AVAILABLE"); $content->setVariable("LABEL_ID", gettext("Course ID")); $content->setVariable("LABEL_NAME", gettext("Course Name")); $content->setVariable("LABEL_DESC", gettext("Information")); $content->setVariable("LABEL_TUTORS", gettext("Staff members")); $content->setVariable("LABEL_STUDENTS", gettext("Students")); $content->setVariable("LABEL_ACTION", gettext("Action")); $memberships = \lms_steam::semester_get_user_coursememberships($current_semester->get_id(), \lms_steam::get_current_user()); foreach ($courses as $course) { $course_found = TRUE; /* THIS WAS ALREADY COMMENTED OUT! //Cannot be determined after performance optimization, so deleted courses remain in course list for CACHE_LIFETIME_STATIC (1 Hour) if ( !isset( $memberships[ $course["OBJ_ID"] ] ) ) { error_log("courses_overview.php: Found deleted course in cache-data of semester=" . $current_semester->get_name() . " courseid=" . $course["OBJ_NAME"] ." description=" . $course["OBJ_DESC"] . " objectid=" . $course[ "OBJ_ID" ]); $course_found = FALSE; } */ if ($course_found) { $is_subscribed = isset($memberships[$course["OBJ_ID"]]); $content->setCurrentBlock("BLOCK_COURSE"); if (\koala_group_course::is_paul_course($course["COURSE_NUMBER"])) { $label_course_id = $course["COURSE_NUMBER"]; } else { $label_course_id = \koala_group_course::convert_course_id($course["OBJ_NAME"]); } $actions = ""; if ($isEditMode) { $actions .= "<br><a href=\"" . PATH_URL . "course_delete.php?course=" . $course["OBJ_ID"] . "\">" . gettext("Delete course") . "</a>"; $actions .= "<br><a href=\"" . PATH_URL . "copy_weblog_wiki.php?course=" . $course["OBJ_ID"] . "\">" . gettext("Copy Weblog/Wiki") . "</a>"; } $content->setVariable("VALUE_ID", h($label_course_id)); // TODO: Passt der Link? $content->setVariable("COURSE_LINK", PATH_URL . SEMESTER_URL . "/" . h($current_semester->get_name()) . "/" . h($course["OBJ_NAME"]) . "/"); $content->setVariable("COURSE_NAME", h($course["OBJ_DESC"])); $content->setVariable("COURSE_TUTORS", h($course["COURSE_TUTORS"])); $content->setVariable("VALUE_STUDENTS", $course["COURSE_NO_PARTICIPANTS"] . (isset($course["COURSE_MAX_PARTICIPANTS"]) && $course["COURSE_MAX_PARTICIPANTS"] > 0 ? " / " . $course["COURSE_MAX_PARTICIPANTS"] : "")); $content->setVariable("VALUE_COURSE_DESC", h($course["COURSE_SHORT_DSC"])); if ($is_subscribed) { if ($course["COURSE_HISLSF_ID"] > 0) { $content->setVariable("COURSE_ACTION", "Kursabmeldung erfolgt ausschließüber <b><a href=\"https://lsf.uni-paderborn.de/qisserver/rds?state=wsearchv&search=2&veranstaltung.veranstid=" . trim($course["COURSE_HISLSF_ID"]) . "\" target=\"_blank\">HIS-LSF</a></b>. Die Synchronisation mit koaLA kann bis zu einer Stunde dauern."); } elseif ($course[KOALA_GROUP_ACCESS] == PERMISSION_COURSE_PAUL_SYNC) { $content->setVariable("COURSE_ACTION", gettext("You are member.") . "<br />" . gettext("The participants for this course will be imported from the PAUL system as of 30.04.2009")); $noop = gettext("The participant management for this course is imported from PAUL. To unsubscribe this course unsubscribe this course in PAUL. Your unsubscription will be synchronized with koaLA within one hour."); } else { $content->setVariable("COURSE_ACTION", "<a href=\"" . PATH_URL . "group_cancel.php?group=" . $course["OBJ_ID"] . "\">" . gettext("Resign") . "</a>" . $actions); } } else { if ($course["COURSE_HISLSF_ID"] > 0) { $content->setVariable("COURSE_ACTION", "Kursbuchung erfolgt ausschließlich über <b><a href=\"https://lsf.uni-paderborn.de/qisserver/rds?state=wsearchv&search=2&veranstaltung.veranstid=" . trim($course["COURSE_HISLSF_ID"]) . "\" target=\"_blank\">HIS-LSF</a></b>. Die Synchronisation mit koaLA kann bis zu einer Stunde dauern."); } elseif ($course[KOALA_GROUP_ACCESS] == PERMISSION_COURSE_PAUL_SYNC) { $content->setVariable("COURSE_ACTION", gettext("You are not member.") . "<br />" . gettext("The participants for this course will be imported from the PAUL system as of 30.04.2009")); $noop = gettext("The participant management for this course is imported from PAUL. To subscribe this course subscribe this course in PAUL. Your subscription will be synchronized with koaLA within one hour."); } elseif (isset($course["COURSE_MAX_PARTICIPANTS"]) && (int) $course["COURSE_MAX_PARTICIPANTS"] > 0 && (int) $course["COURSE_MAX_PARTICIPANTS"] <= (int) $course["COURSE_NO_PARTICIPANTS"]) { $content->setVariable("COURSE_ACTION", gettext("Group is full")); } else { $content->setVariable("COURSE_ACTION", "<a href=\"" . PATH_URL . "group_subscribe.php?group=" . $course["OBJ_ID"] . "\">" . gettext("Sign on") . "</a>"); } } $content->parse("BLOCK_COURSE"); } } $content->parse("BLOCK_COURSES_AVAILABLE"); } else { $content->setCurrentBlock("BLOCK_NO_COURSE"); $content->setVariable("NO_COURSE_TEXT", gettext("No courses available yet.")); $content->parse("BLOCK_NO_COURSE"); } //$headline = ( isset($_GET[ "filter" ]) && $_GET[ "filter" ] == "booked" ) ? gettext( "My courses in %SEMESTER" ) : gettext( "All courses in %SEMESTER" ); //$portal->set_page_title( $current_semester->get_attribute( "OBJ_DESC" )); //$portal->set_page_main( str_replace( "%SEMESTER", $current_semester->get_attribute( "OBJ_DESC" ), $headline), $content->get(), "" ); //$portal->show_html(); $frameResponseObject->setTitle("Semester - " . $current_semester_name); $rawHtml = new \Widgets\RawHtml(); $rawHtml->setHtml($content->get()); $frameResponseObject->addWidget($rawHtml); return $frameResponseObject; }