Esempio n. 1
0
 public function frameResponse(\FrameResponseObject $frameResponseObject)
 {
     $path = $this->params;
     $portal = \lms_portal::get_instance();
     $user = \lms_steam::get_current_user();
     if (!\lms_steam::is_steam_admin($user)) {
         //TODO: REDIRECT!!
     }
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         $values = $_POST["values"];
         $start_date = iso_to_unix($values["start"]);
         $end_date = iso_to_unix($values["end"]);
         // TODO PROBLEM CHECKING MISSING
         $courses = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), STEAM_COURSES_GROUP, CLASS_GROUP);
         $all_user = \steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), STEAM_ALL_USER);
         $new_semester = \steam_factory::create_group($GLOBALS["STEAM"]->get_id(), $values["name"], $courses, FALSE, $values["desc"]);
         $new_semester_admins = \steam_factory::create_group($GLOBALS["STEAM"]->get_id(), "admins", $new_semester, FALSE, "admin group for " . $values["desc"]);
         $new_semester_admins->set_attribute("OBJ_TYPE", "semester_admins");
         $new_semester_admins->add_member($user);
         $new_semester->set_insert_access($new_semester_admins, TRUE);
         $new_semester->set_read_access($all_user, TRUE);
         $new_semester->set_attributes(array("SEMESTER_START_DATE" => $start_date, "SEMESTER_END_DATE" => $end_date));
         // CACHE ZURÜCKSETZEN
         $cache = get_cache_function("ORGANIZATION");
         $cache->drop("lms_steam::get_semesters");
         header("Location: " . PATH_URL . "semester/index/" . $values["name"] . "/all");
     }
     $content = \Semester::getInstance()->loadTemplate("semester_create.template.html");
     $content->setVariable("INFO_TEXT", gettext("So, you want to start a new semester?") . " " . gettext("Please fill out the requested values on the right.") . "<br/><br/>" . str_replace("%SEMESTER", STEAM_CURRENT_SEMESTER, gettext("And don't forget to reset the current semester in the etc/koala.def.php, which is <b>%SEMESTER</b> at the moment.")));
     $content->setVariable("LABEL_NAME", gettext("Shortname"));
     $content->setVariable("INFO_NAME", gettext("IMPORTANT: Don't use any slashes, commas or dots in this name. Keep it short, like 'WS0607' or 'SS06'."));
     $content->setVariable("LABEL_DESC", gettext("Name"));
     $content->setVariable("INFO_DESC", gettext("Examples: 'Wintersemester 06/07', or 'Sommersemester 2006'"));
     $content->setVariable("LABEL_START_DATE", gettext("Starting date of semester"));
     $content->setVariable("LABEL_END_DATE", gettext("Ending date of semester"));
     $content->setVariable("INFO_DATE_FORMAT", gettext("Please type in the date in the following format: YYYY-MM-DD"));
     $content->setVariable("LABEL_CREATE", gettext("Create Semester"));
     /* TODO: Portal anpassen
     		$portal->set_page_main(
     			array(array("link" => PATH_URL.SEMESTER_URL."/", "name" => gettext("Semester")), array("link" => "", "name" => gettext("Create new"))),
     			$content->get(),
     			""
     		);
     		*/
     $rawHtml = new \Widgets\RawHtml();
     $rawHtml->setHtml($content->get());
     $frameResponseObject->addWidget($rawHtml);
     return $frameResponseObject;
 }
Esempio n. 2
0
 public function frameResponse(\FrameResponseObject $frameResponseObject)
 {
     $path = $this->params;
     $portal = \lms_portal::get_instance();
     $user = \lms_steam::get_current_user();
     $group_id = $path[1];
     $content = \Semester::getInstance()->loadTemplate("search_persons.template.html");
     if (!($steam_group = \steam_factory::get_object($GLOBALS['STEAM']->get_id(), $group_id))) {
         throw new \Exception('Group not found: ' . $group_id);
     }
     if (!$steam_group instanceof \steam_group) {
         throw new \Exception('Is not a group: ' . $group_id);
     }
     // always try to use the correct specialized group:
     if (!isset($group)) {
         $group = \koala_object::get_koala_object($steam_group);
     } else {
         if ($group instanceof \koala_object) {
             $group = \koala_object::get_koala_object($group->get_steam_object());
         } else {
             throw new \Exception("No 'group' param provided");
         }
     }
     // TODO: Passt der Link?
     $backlink = $group->get_url();
     if (!$group->is_admin($user)) {
         throw new \Exception("No admin of " . $group->get_groupname() . ": " . $user->get_name());
     }
     if (!empty($_REQUEST["add"]) && count($_REQUEST["add"]) > 0) {
         $login = key($_REQUEST["add"]);
         $new_member = \steam_factory::username_to_object($GLOBALS["STEAM"]->get_id(), $login);
         if ($group instanceof \koala_group_tutorial) {
             if ($group->get_course_group()->get_attribute("EXCLUSIVE_TUTORIAL_MEMBERSHIP") === "TRUE") {
                 $course_learners_group = $group->steam_group_course_learners;
                 $subgroups = $course_learners_group->get_subgroups();
                 foreach ($subgroups as $sg) {
                     if (($sg->get_attribute("OBJ_TYPE") === "course_tutorial" || $sg->get_attribute("OBJ_TYPE") === "group_tutorial_koala") && $sg->is_member($new_member) && $sg != $steam_group) {
                         $already_member_and_exclusive = true;
                         $in_group = $sg;
                     }
                 }
             }
         }
         if (isset($already_member_and_exclusive) && $already_member_and_exclusive) {
             if (!isset($_POST['confirmed']) || $_POST['confirmed'] != "true") {
                 $content->setVariable("WARNING_TEXT", "<p/>" . gettext("Attention! The user you want to add already became member in another tutorial in the meantime."));
             }
             if (isset($_POST['confirmed']) && $_POST['confirmed'] === "true") {
                 if ($group->add_member($new_member)) {
                     // PROCEDURE FOR COURSE ADMINS
                     if ($group->get_attribute("OBJ_TYPE") === "course_staff") {
                         // TODO: fct to add an admin? set_sanction_all does not seem to work... :(
                         $steam_group->set_sanction_all($new_member);
                     }
                     if ($group->get_attribute("OBJ_TYPE") == "course_tutorial" || $group->get_attribute("OBJ_TYPE") == "group_tutorial_koala") {
                         $no_of_learners = (int) $group->get_attribute("GROUP_NO_MEMBERS");
                         $group->set_attribute("GROUP_NO_MEMBERS", $no_of_learners + count($_REQUEST["add"]));
                     }
                     $group_name = \koala_object::get_koala_object($group)->get_display_name();
                     $message = str_replace("%NAME", $new_member->get_full_name(), gettext("Dear %NAME,")) . "\n\n";
                     $message .= str_replace("%GROUP", $group_name, gettext("You were added to '%GROUP' as a new member.")) . "\n\n";
                     $message .= gettext("This is an automatically generated message.") . " " . gettext("If you haven't been informed about this membership in advance, please contact the sender of this message.") . "\n\n" . str_replace("%GROUP", "<a href=\"" . $backlink . "\">" . $group_name . "</a>", gettext("See '%GROUP' for further information."));
                     \lms_steam::mail($new_member, $user, PLATFORM_NAME . ": " . str_replace("%GROUP", h($group_name), gettext("You were added to '%GROUP' as a new member")), $message);
                     $cache = get_cache_function($new_member->get_name());
                     $cache->drop("lms_steam::user_get_groups", $new_member->get_name(), TRUE);
                     $cache->drop("lms_steam::user_get_groups", $new_member->get_name(), FALSE);
                     $cache->drop("lms_steam::user_get_groups", $new_member->get_name());
                     $cache->drop("lms_steam::user_get_profile", $new_member->get_name());
                     $cache->drop("lms_portal::get_menu_html", $new_member->get_name(), TRUE);
                     $cache = get_cache_function($group->get_id());
                     $cache->drop("lms_steam::group_get_members", $group->get_id());
                     $portal->set_confirmation(str_replace("%NAME", $new_member->get_full_name(), gettext("%NAME successfully added to group.")));
                 }
             }
         } else {
             if ($group->add_member($new_member)) {
                 // PROCEDURE FOR COURSE ADMINS
                 if ($group->get_attribute("OBJ_TYPE") === "course_staff") {
                     // TODO: fct to add an admin? set_sanction_all does not seem to work... :(
                     $steam_group->set_sanction_all($new_member);
                 }
                 if ($group->get_attribute("OBJ_TYPE") == "course_tutorial" || $group->get_attribute("OBJ_TYPE") == "group_tutorial_koala") {
                     $no_of_learners = (int) $group->get_attribute("GROUP_NO_MEMBERS");
                     $group->set_attribute("GROUP_NO_MEMBERS", $no_of_learners + count($_REQUEST["add"]));
                 }
                 $group_name = \koala_object::get_koala_object($group)->get_display_name();
                 $message = str_replace("%NAME", $new_member->get_full_name(), gettext("Dear %NAME,")) . "\n\n";
                 $message .= str_replace("%GROUP", $group_name, gettext("You were added to '%GROUP' as a new member.")) . "\n\n";
                 $message .= gettext("This is an automatically generated message.") . " " . gettext("If you haven't been informed about this membership in advance, please contact the sender of this message.") . "\n\n" . str_replace("%GROUP", "<a href=\"" . $backlink . "\">" . $group_name . "</a>", gettext("See '%GROUP' for further information."));
                 \lms_steam::mail($new_member, $user, PLATFORM_NAME . ": " . str_replace("%GROUP", h($group_name), gettext("You were added to '%GROUP' as a new member")), $message);
                 $cache = get_cache_function($new_member->get_name());
                 $cache->drop("lms_steam::user_get_groups", $new_member->get_name(), TRUE);
                 $cache->drop("lms_steam::user_get_groups", $new_member->get_name(), FALSE);
                 $cache->drop("lms_steam::user_get_groups", $new_member->get_name());
                 $cache->drop("lms_steam::user_get_profile", $new_member->get_name());
                 $cache->drop("lms_portal::get_menu_html", $new_member->get_name(), TRUE);
                 $cache = get_cache_function($group->get_id());
                 $cache->drop("lms_steam::group_get_members", $group->get_id());
                 $portal->set_confirmation(str_replace("%NAME", $new_member->get_full_name(), gettext("%NAME successfully added to group.")));
             }
         }
     }
     if ($group->get_maxsize() > 0 && $group->get_maxsize() <= $group->count_members()) {
         $html_content = "<div class=\"infoBar\">" . gettext("The group is full! You can not add any further members, because the maximum size of the group has been reached. Please increase this value to add more members.") . "</div>";
     } else {
         $content->setVariable("HEAD_SEARCH", gettext("Search"));
         $content->setVariable("INFO_TEXT", gettext("Here you can lookup some people.") . " " . str_replace("%GROUP", $group->get_display_name(), gettext("You can add a search result as member to '<b>%GROUP</b>'.")));
         if (!empty($_REQUEST["pattern"])) {
             $content->setVariable("VALUE_PATTERN", $_REQUEST["pattern"]);
         }
         $content->setVariable("LABEL_CHECK_NAME", gettext("Name"));
         $content->setVariable("LABEL_CHECK_LOGIN", gettext("Email address or login"));
         $content->setVariable("LABEL_SEARCH", gettext("Search"));
         $content->setVariable("GROUP_ID", $group->get_id());
         $content->setVariable("BACKLINK", "<a href=\"{$backlink}\">" . gettext("back") . "</a>");
         // SEARCH RESULTS
         if (!empty($_REQUEST["pattern"])) {
             $cache = get_cache_function($user->get_name(), 60);
             $result = $cache->call("lms_steam::search_user", $_REQUEST["pattern"], $_REQUEST["lookin"]);
             if ($_REQUEST["lookin"] == "name") {
                 $content->setVariable("CHECKED_NAME", 'checked="checked"');
             } else {
                 $content->setVariable("CHECKED_LOGIN", 'checked="checked"');
             }
             // PROCEED RESULT SET
             $html_people = \Semester::getInstance()->loadTemplate("list_users.template.html");
             $no_people = count($result);
             if ($no_people > 0) {
                 if (isset($_REQUEST["backlink"])) {
                     $tmp_backlink = $_REQUEST["backlink"];
                 } else {
                     if (isset($backlink)) {
                         $tmp_backlink = $backlink;
                     }
                 }
                 //$start = $portal->set_paginator( 10, $no_people, "(" . gettext( "%TOTAL people in result set" ) . ")", "?pattern=" . $_REQUEST[ "pattern" ] . "&lookin=" . $_REQUEST[ "lookin" ] . "&group=" . $_REQUEST["group"] . "&backlink=" . $tmp_backlink );
                 $paginator = \lms_portal::get_paginator(10, $no_people, "(" . gettext("%TOTAL people in result set") . ")", "?pattern=" . $_REQUEST["pattern"] . "&lookin=" . $_REQUEST["lookin"] . "&group=" . $_REQUEST["group"] . "&backlink=" . $tmp_backlink);
                 $start = $paginator["startIndex"];
                 $end = $start + 10 > $no_people ? $no_people : $start + 10;
                 $html_people->setVariable("PAGINATOR", $paginator["html"]);
                 $html_people->setVariable("LABEL_CONTACTS", gettext("Results") . " (" . str_replace(array("%a", "%z", "%s"), array($start + 1, $end, $no_people), gettext("%a-%z out of %s")) . ")");
                 $html_people->setCurrentBlock("BLOCK_CONTACT_LIST");
                 $html_people->setVariable("LABEL_NAME_POSITION", gettext("Name, position"));
                 $html_people->setVariable("LABEL_SUBJECT_AREA", gettext("Subject area"));
                 $html_people->setVariable("LABEL_COMMUNICATION", gettext("Communication"));
                 $html_people->setVariable("TH_MANAGE_CONTACT", gettext("Action"));
                 for ($i = $start; $i < $end; $i++) {
                     $person = $result[$i];
                     $html_people->setCurrentBlock("BLOCK_CONTACT");
                     // TODO: Passt der Link?
                     $html_people->setVariable("CONTACT_LINK", PATH_URL . "user/" . $person["OBJ_NAME"] . "/");
                     // TODO: Passt der Link?
                     $icon_link = PATH_URL . "download/" . $person["OBJ_ICON"] . "/usericon/30/40";
                     $html_people->setVariable("CONTACT_IMAGE", $icon_link);
                     $html_people->setVariable("CONTACT_NAME", h($person["USER_FIRSTNAME"]) . " " . h($person["USER_FULLNAME"]));
                     $html_people->setVariable("LINK_SEND_MESSAGE", PATH_URL . "messages_write.php?to=" . $person["OBJ_NAME"]);
                     $html_people->setVariable("LABEL_MESSAGE", gettext("Message"));
                     $html_people->setVariable("LABEL_SEND", gettext("Send"));
                     $html_people->setVariable("OBJ_DESC", h($person["OBJ_DESC"]));
                     $p = new \steam_object($GLOBALS["STEAM"]->get_id(), $person["OBJ_ID"]);
                     //if the group is a tutorial and the course has exclusive subgroups for tutorials set, we have to
                     //see if our person is already member in one of the other tutorials.
                     $already_member_and_exclusive = false;
                     if ($group instanceof \koala_group_tutorial) {
                         if ($group->get_course_group()->get_attribute("EXCLUSIVE_TUTORIAL_MEMBERSHIP") === "TRUE") {
                             $course_learners_group = $steam_group->get_parent_group();
                             $subgroups = $course_learners_group->get_subgroups();
                             foreach ($subgroups as $sg) {
                                 if (($sg->get_attribute("OBJ_TYPE") === "course_tutorial" || $sg->get_attribute("OBJ_TYPE") === "group_tutorial_koala") && $sg->is_member($p) && $sg != $steam_group) {
                                     $already_member_and_exclusive = true;
                                     $in_group = $sg;
                                 }
                             }
                         }
                     }
                     if (!$group->is_member($p)) {
                         if ($already_member_and_exclusive) {
                             $html_people->setVariable("TD_MANAGE_CONTACT", "<td align=\"center\"><small><b>" . gettext("Attention: User already in tutorial") . " " . $in_group->get_name() . "<p /></b></small><input type=\"hidden\" name=\"confirmed\" value=\"true\"/><input type=\"submit\"  name=\"add[" . h($person["OBJ_NAME"]) . "]\" value=\"" . gettext("Add anyhow") . "\"/></td>");
                         } else {
                             $html_people->setVariable("TD_MANAGE_CONTACT", "<td align=\"center\"><input type=\"submit\"  name=\"add[" . h($person["OBJ_NAME"]) . "]\" value=\"" . gettext("Add") . "\"/></td>");
                         }
                     } else {
                         $html_people->setVariable("TD_MANAGE_CONTACT", "<td align=\"center\">" . gettext("Already a member.") . "</td>");
                     }
                     $html_people->parse("BLOCK_CONTACT");
                 }
                 $html_people->parse("BLOCK_CONTACT_LIST");
             } else {
                 $html_people->setVariable("LABEL_CONTACTS", gettext("No results."));
             }
             $content->setVariable("HTML_USER_LIST", $html_people->get());
         } else {
             $content->setVariable("CHECKED_NAME", 'checked="checked"');
         }
     }
     /*
     $portal->set_page_title( gettext( "Add member" ) );
     
     // give input focus to search field:
     $portal->add_javascript_onload("group_add_member", "document.getElementById('pattern').focus();");
     
     if(!isset($html_content))
     {
     	$portal->set_page_main(
     		array( $group->get_link(), array( "name" => gettext( "Add member" ) ) ),
     		$content->get(),
     		""
     		);
     } 
     else
     {
     	$portal->set_page_main(
     		array( $group->get_link(), array( "name" => gettext( "Add member" ) ) ),
     		$html_content,
     		""
     		);
     }
     $portal->show_html();
     */
     $rawHtml = new \Widgets\RawHtml();
     $rawHtml->setHtml($content->get());
     $frameResponseObject->addWidget($rawHtml);
     return $frameResponseObject;
 }
Esempio n. 3
0
 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;
 }
Esempio n. 4
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&szlig;&uuml;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&szlig;lich &uuml;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;
 }