Example #1
0
 function __construct($parent_tmp, $steamObject_tmp, $xml)
 {
     $this->parent = $parent_tmp;
     $this->steamObject = $steamObject_tmp;
     $this->xml = $xml;
     $this->cache = get_cache_function("unit_elearning", 3600);
 }
Example #2
0
 public function get_headline()
 {
     $cache = get_cache_function($this->koala_group->get_id());
     $headline = array();
     $group_url = PATH_URL . "groups/" . $this->koala_group->get_id() . "/";
     if (($category = $this->koala_group->get_steam_object()->get_environment()) && $cache->call("lms_steam::group_is_public", $this->koala_group->get_id())) {
         $headline[] = array("name" => h($category->get_name()), "link" => PATH_URL . "groups/?cat=" . $category->get_id());
         $headline[] = array("name" => $this->koala_group->get_display_name(), "link" => $group_url);
     } else {
         $headline[] = array("name" => h($this->koala_group->get_name()));
     }
     if (is_string($context = $this->get_context())) {
         switch ($context) {
             case "documents":
                 //TODO: move this into documents extension somehow?
                 $headline[] = array("name" => gettext("Documents"), "link" => "");
                 break;
             case "communication":
                 $headline[] = array("name" => gettext("Communication"), "link" => "");
                 break;
             case "members":
                 $headline[] = array("name" => gettext("Members"), "link" => "");
                 break;
         }
         // try extensions:
         foreach ($this->koala_group->get_extensions() as $extension) {
             $tmp_headline = $extension->get_headline($headline, $this->get_context(), $this->get_context_params());
             if (is_array($tmp_headline)) {
                 return $tmp_headline;
             }
         }
     }
     return $headline;
 }
Example #3
0
 /**
  * function get_merged items:
  * this function returns the rss_feed items from multiple url's sorted by
  * Date/Time (latest first)
  * 
  * @param array $urls array with the url's of the rss_feeds
  * 
  * @return array the array with the rss-feed items sorted by Date/Time (latest first)
  */
 public function get_merged_items($feeds = array())
 {
     if (!is_array($feeds)) {
         return array();
     }
     $all_items = array();
     foreach ($feeds as $feed) {
         $cache = get_cache_function("rss", 600);
         $items = $cache->call("lms_rss::get_items", $feed["link"]);
         for ($j = 0; $j < count($items); $j++) {
             $items[$j]["lms:type"] = $feed["type"];
             $items[$j]["lms:source"] = $feed["name"];
             $items[$j]["lms:rsslink"] = $feed["link"];
             $items[$j]["lms:context_name"] = $feed["context_name"];
             $items[$j]["lms:context_link"] = $feed["context_link"];
             array_push($all_items, $items[$j]);
         }
     }
     function compare($a, $b)
     {
         return strtotime($a["dc:date"]) < strtotime($b["dc:date"]) ? 1 : -1;
     }
     usort($all_items, "compare");
     return $all_items;
 }
Example #4
0
 function remove_role()
 {
     $course_group_id = $this->get_context()->get_context_object();
     $course_group = steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $course_group_id);
     $course_group_staff = steam_factory::get_group($GLOBALS["STEAM"]->get_id(), $course_group->get_groupname() . ".staff");
     $GLOBALS["USERMANAGEMENT_DATA_ACCESS"]->removeUserFromGroup($this->get_userID(), $course_group_staff->get_id());
     $cache = get_cache_function($course_group_staff->get_id());
     $cache->drop("lms_steam::group_get_members", $course_group_staff->get_id());
 }
Example #5
0
 function __construct($parent_tmp, $steamObject_tmp)
 {
     $this->parent = $parent_tmp;
     $this->steamObject = $steamObject_tmp;
     //get meta data
     $this->cache = get_cache_function("unit_elearning", 3600);
     $this->steam_object_path = $this->cache->call(array($this->steamObject, "get_path"));
     $doc = $this->cache->call("steam_factory::get_object_by_name", $GLOBALS["STEAM"]->get_id(), $this->steam_object_path . "/chapter.xml");
     $this->xml = simplexml_load_string($this->cache->call(array($doc, "get_content")));
 }
 function __construct($steam_object = FALSE)
 {
     self::$PATH = PATH_EXTENSIONS . "units_elearning/";
     self::$DISPLAY_NAME = gettext("elearning course material");
     self::$DISPLAY_DESCRIPTION = gettext("Here you can add elearning material");
     parent::__construct(PATH_EXTENSIONS . "units_elearning.xml", $steam_object);
     if (!defined("PATH_TEMPLATES_UNITS_ELEARNING")) {
         define("PATH_TEMPLATES_UNITS_ELEARNING", PATH_EXTENSIONS . "units_elearning/templates/");
     }
     $this->cache = get_cache_function("unit_elearning", 3600);
 }
Example #7
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;
 }
Example #8
0
 public function group_get_members($pGroup)
 {
     if (!$pGroup instanceof koala_group) {
         throw new Exception("parameter is not an instance of koala_group", E_PARAM);
     }
     if (!$pGroup->is_admin(lms_steam::get_current_user())) {
         throw new Exception("no admin rights.operation canceled.");
     }
     $cache = get_cache_function($pGroup->get_id(), CACHE_LIFETIME_STATIC);
     switch (get_class($pGroup)) {
         case "koala_group_course":
             $group_name = $pGroup->get_course_id() . " - " . $pGroup;
             $members = $cache->call("lms_steam::group_get_members", $pGroup->steam_group_learners->get_id());
             break;
         default:
             $members = $cache->call("lms_steam::group_get_members", $pGroup->get_id());
             break;
     }
     // INITIALIZATION
     $course_id = $pLmsGroupCourse->get_course_id();
     $course_name = $pLmsGroupCourse->get_course_dsc_short();
     $semester = $pLmsGroupCourse->get_semester();
     $excel = new Spreadsheet_Excel_Writer();
     $excel->send($course_id . "_" . $semester->get_name());
     $sheet =& $excel->addWorksheet(gettext("participants"));
     // WRITE EXCEL SHEET
     $sheet->writeString(0, 0, $course_id . " - " . $course_name());
     $sheet->writeSting(1, 0, $semester->get_name());
     $sheet->writeString(3, 0, gettext("student id"));
     $sheet->writeString(3, 1, gettext("forename"));
     $sheet->writeString(3, 2, gettext("surname"));
     $no_members = count($members);
     if ($no_members > 0) {
         $row = 5;
         for ($i = $start; $i < $end; $i++) {
             $member = $members[$i];
             $sheet->writeString($row, 1, $member["USER_FIRSTNAME"]);
             $sheet->writeString($row, 2, $member["USER_FULLNAME"]);
             $sheet->writeString($row, 3, $member["USER_EMAIL"]);
             $sheet->writeString($row, 4, $member["USER_PROFILE_FACULTY"]);
             $row++;
         }
     }
     $excel->close();
 }
Example #9
0
function clean_usericoncache($user)
{
    if ($user instanceof steam_user) {
        $user->delete_value("OBJ_ICON");
        $icon = $user->get_attribute("OBJ_ICON");
        clean_iconcache($icon);
        // Clean Icon data from cache
        require_once "Cache/Lite.php";
        $cache = new Cache_Lite(array("cacheDir" => PATH_CACHE));
        $cache->clean($user->get_name());
        // Clean profile data from cache
        $cache = get_cache_function($user->get_name(), 86400);
        $cache->drop("lms_steam::user_get_profile", $user->get_name());
        // TODO: In Menu "Your Desktop" some Icon data comes from lms_user
        // stored in session => delete/refresh this value in session here
        $portal = $GLOBALS["portal"];
        $steam_user = $portal->get_user();
        $steam_user->init_attributes();
    }
}
Example #10
0
function viewer_authorized($login, $user)
{
    $cache = get_cache_function($user->get_name(), 3600);
    $user_privacy = $cache->call("lms_steam::user_get_profile_privacy", $user->get_name());
    isset($user_privacy["PRIVACY_GROUPS"]) ? $group_authorization = $user_privacy["PRIVACY_GROUPS"] : ($group_authorization = "");
    $confirmed = $user->get_id() != $login->get_id() ? TRUE : FALSE;
    $contacts = $cache->call("lms_steam::user_get_buddies", $user->get_name(), $confirmed);
    $contact_ids = array();
    foreach ($contacts as $contact) {
        $contact_ids[] = $contact["OBJ_ID"];
    }
    $is_contact = in_array($login->get_id(), $contact_ids);
    if (!($group_authorization & PROFILE_DENY_ALLUSERS)) {
        return true;
    }
    if ($is_contact && !($group_authorization & PROFILE_DENY_CONTACTS)) {
        return true;
    }
    return false;
}
Example #11
0
 public function frameResponse(\FrameResponseObject $frameResponseObject)
 {
     $portal = \lms_portal::get_instance();
     $user = \lms_steam::get_current_user();
     $frameResponseObject->setTitle(gettext("Your Desktop"));
     // Cache for 7 Minutes
     $cache = get_cache_function($user->get_name(), 420);
     $feeds = $cache->call("koala_user::get_news_feeds_static", 0, 10, FALSE, $user);
     $home = \Home::getInstance();
     //$home->addJS();
     $content = $home->loadTemplate("home.template.html");
     $infobar = new \Widgets\InfoBar();
     $infobar->setHeadline(gettext("Hallo") . " " . $portal->get_user()->get_forename() . " " . $portal->get_user()->get_surname() . "!");
     $content->setVariable("INFOBAR", $infobar->getHtml());
     $captionImage = new \Widgets\CaptionImage();
     $captionImage->setLink(PATH_URL . "user/index/" . $user->get_name() . "/");
     $captionImage->setLinkText(gettext("To your profile"));
     $captionImage->setImageSrc(\lms_user::get_user_image_url(140, 185));
     $captionImage->setImageAlt(gettext("Profile Image"));
     $captionImage->setImageTitle(gettext("Complete your Profile"));
     $content->setVariable("PROFILEIMAGE", $captionImage->getHtml());
     $rawHtml = new \Widgets\RawHtml();
     $rawHtml->addWidget($infobar);
     $rawHtml->addWidget($captionImage);
     $homeExtensions = \ExtensionMaster::getInstance()->getExtensionByType("IHomeExtension");
     foreach ($homeExtensions as $homeExtension) {
         $content->setCurrentBlock("HOME_EXTENSION");
         $widget = $homeExtension->getWidget();
         $rawHtml->addWidget($widget);
         $content->setVariable("HOME_EXTENSION_CONTENT", $widget->getHtml());
         $content->parse("HOME_EXTENSION");
     }
     $rawHtml->setHtml($content->get());
     $frameResponseObject->addWidget($rawHtml);
     return $frameResponseObject;
 }
Example #12
0
                lms_steam::delete($object);
            } catch (Exception $ex3) {
                logging::write_log(LOG_DEBUGLOG, "groups_delete:error deleting object from group workroom\t" . $login . " \t" . $group->get_display_name() . " \t" . $steam_group->get_id() . " \t" . $object->get_id());
            }
        }
    }
    if ($steam_group->delete()) {
        $user->get_attributes(array(OBJ_NAME, USER_FIRSTNAME, USER_FULLNAME));
        foreach ($members as $member) {
            $cache = get_cache_function($member->get_name());
            $cache->drop("lms_steam::user_get_groups", $member->get_name(), TRUE);
            $cache->drop("lms_steam::user_get_groups", $member->get_name(), FALSE);
            $cache->drop("lms_steam::user_get_profile", $member->get_name());
            $cache->drop("lms_portal::get_menu_html", $member->get_name(), TRUE);
        }
        $cache = get_cache_function($steam_group->get_id());
        $cache->drop("lms_steam::group_get_members", $steam_group->get_id());
        foreach ($members as $member) {
            lms_steam::mail($member, $user, PLATFORM_NAME . ": " . str_replace("%NAME", h($group_name), gettext("Group %NAME has been deleted.")), str_replace("%USER", $user->get_name() . " (" . $user->get_attribute(USER_FIRSTNAME) . " " . $user->get_attribute(USER_FULLNAME) . ")", str_replace("%NAME", h($group_name), gettext("The group '%NAME' has been deleted from he koaLA System by %USER."))) . "\n\n-- \n" . str_replace("%NAME", h($group_name), gettext("This system generated notification message was sent to you as a former member of the deleted group \"%NAME\"")));
        }
        $_SESSION["confirmation"] = str_replace("%NAME", h($group_name), gettext("The group '%NAME' has been deleted. A notification has been sent to former members."));
        header("Location: " . $upper_link);
        exit;
    } else {
        throw new Exception("Deletion of group failed");
    }
}
$content = new HTML_TEMPLATE_IT();
$content->loadTemplateFile(PATH_TEMPLATES . "group_delete.template.html");
$content->setVariable("FORM_ACTION", "");
$content->setVariable("LABEL_ARE_YOU_SURE", gettext("Are you sure?"));
Example #13
0
 public function execute(\FrameResponseObject $frameResponseObject)
 {
     $user = \lms_steam::get_current_user();
     $cache = get_cache_function($user->get_name(), 86400);
     $user_profile = $cache->call("lms_steam::user_get_profile", $user->get_name());
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         $values = $_POST["values"];
         foreach ($values as $i => $val) {
             $values[$i] = htmlspecialchars($val);
         }
         if (!empty($values["USER_PROFILE_WEBSITE_URI"]) && substr($values["USER_PROFILE_WEBSITE_URI"], 0, 7) != "http://") {
             $values["USER_PROFILE_WEBSITE_URI"] = "http://" . $values["USER_PROFILE_WEBSITE_URI"];
         }
         $user->set_attributes($values);
         if (!empty($values["USER_PROFILE_FACULTY"])) {
             $old_fac_id = $user_profile["USER_PROFILE_FACULTY"];
             $new_fac_id = $values["USER_PROFILE_FACULTY"];
             if ($new_fac_id != $old_fac_id) {
                 if ($old_fac_id > 0) {
                     $old_faculty = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $old_fac_id, CLASS_GROUP);
                     $old_faculty->remove_member($user);
                 }
                 if ($new_fac_id > 0) {
                     $new_faculty = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $new_fac_id, CLASS_GROUP);
                     $new_faculty->add_member($user);
                 }
             }
         }
         /*
         			 require_once( "Cache/Lite.php" );
         			 $cache = new Cache_Lite( array( "cacheDir" => PATH_CACHE ) );
         			 $cache->clean( $user->get_name() );
         			 $cache->clean( $user->get_id() );*/
         if (!empty($values["USER_LANGUAGE"])) {
             //var_dump($values["USER_LANGUAGE"]);die;
             $lang_index = \language_support::get_language_index();
             \language_support::choose_language($lang_index[$values["USER_LANGUAGE"]]);
         }
         $cache = get_cache_function(\lms_steam::get_current_user()->get_name());
         $cache->drop("lms_portal::get_menu_html", \lms_steam::get_current_user()->get_name(), TRUE);
         $cache = get_cache_function($user->get_name());
         $cache->drop("lms_steam::user_get_profile", $user->get_name());
         $_SESSION["confirmation"] = gettext("Your profile data has been saved.");
         header("Location: " . PATH_URL . "profile/edit");
     }
     $content = \Profile::getInstance()->loadTemplate("profile_edit.template.html");
     //$content = new \HTML_TEMPLATE_IT();
     //$content->loadTemplateFile( PATH_TEMPLATES . "profile_edit.template.html" );
     if (PLATFORM_ID == "bid") {
         $content->setVariable("LABEL_INFO", "Hier kÜnnen Sie Ihre persÜnlichen Kontaktdaten einrichten. Bis auf Ihren Namen sind alle Angaben freiwillig und kÜnnen von Ihnen geändert werden. Klicken Sie auf den Button <b><i>Profil-Privatsphäre</i></b> um festzulegen, wem welche Informationen angezeigt werden sollen.");
     } else {
         $content->setVariable("LABEL_INFO", gettext("Please complete your profile. None of the fields are mandatory. Some of the fields can not be changed due to central identity management at the IMT.<br/><b>Note: With the button <i>Profile Privacy</i> you can control which information can be seen by other users.</b>"));
     }
     if (ENABLED_PROFILE_TITLE) {
         $content->setVariable("LABEL_PROFILE", gettext("General Information"));
     }
     $content->setVariable("LABEL_LOOKING", gettext("Your buddy icon"));
     $content->setVariable("LABEL_MAIL_PREFS", gettext("Your mail preferences"));
     $content->setVariable("LABEL_PROFILE_PRIVACY", gettext("Profile Privacy"));
     $content->setVariable("LINK_BUDDY_ICON", PATH_URL . "profile/image");
     $content->setVariable("LINK_MAIL_PREFS", PATH_URL . "messages_prefs.php");
     $content->setVariable("LINK_PROFILE_PRIVACY", PATH_URL . "profile/privacy");
     if (ENABLED_FIRST_NAME) {
         $content->setVariable("LABEL_FIRST_NAME", gettext("First name"));
     }
     if (ENABLED_FULL_NAME) {
         $content->setVariable("LABEL_LAST_NAME", gettext("Last name"));
     }
     if (ENABLED_DEGREE) {
         $content->setVariable("LABEL_TITLE", gettext("Academic title"));
         $content->setVariable("LABEL_DEGREE", gettext("Academic degree"));
         $content->setVariable("LABEL_IF_AVAILABLE", gettext("only if available"));
         $academicTitle = (string) $user_profile["USER_ACADEMIC_TITLE"];
         switch ($academicTitle) {
             case "Dr.":
                 $content->setVariable("TITLE_DR_SELECTED", 'selected="selected"');
                 break;
             case "PD Dr.":
                 $content->setVariable("TITLE_PRIVDOZDR_SELECTED", 'selected="selected"');
                 break;
             case "Prof.":
                 $content->setVariable("TITLE_PROF_SELECTED", 'selected="selected"');
                 break;
             case "Prof. Dr.":
                 $content->setVariable("TITLE_PROFDR_SELECTED", 'selected="selected"');
                 break;
             default:
                 $content->setVariable("TITLE_NULL_SELECTED", 'selected="selected"');
                 break;
         }
         $content->setVariable("VALUE_ACADEMIC_DEGREE", $this->safe_string($user_profile["USER_ACADEMIC_DEGREE"]));
     }
     if (ENABLED_BID_DESCIPTION) {
         $content->setVariable("LABEL_STATUS_BID", gettext("Description"));
     }
     if (ENABLED_STATUS) {
         $content->setVariable("LABEL_STATUS", gettext("Status"));
     }
     if (ENABLED_GENDER) {
         $content->setVariable("LABEL_GENDER", gettext("Gender"));
         $content->setVariable("LABEL_FEMALE", gettext("female"));
         $content->setVariable("LABEL_MALE", gettext("male"));
         $content->setVariable("LABEL_NOT_SAY", gettext("rather not say"));
     }
     if (ENABLED_FACULTY) {
         $content->setVariable("LABEL_FACULTY", gettext("Origin"));
     }
     if (ENABLED_MAIN_FOCUS) {
         $content->setVariable("LABEL_MAIN_FOCUS", gettext("Main focus"));
     }
     if (ENABLED_HOMETOWN) {
         $content->setVariable("LABEL_HOMETOWN", gettext("Hometown"));
     }
     if (ENABLED_WANTS) {
         $content->setVariable("LABEL_WANTS", gettext("Wants"));
     }
     if (ENABLED_HAVES) {
         $content->setVariable("LABEL_HAVES", gettext("Haves"));
     }
     if (ENABLED_OTHER_INTERESTS) {
         $content->setVariable("LABEL_OTHER_INTERESTS", gettext("Other interests"));
     }
     if (ENABLED_ORGANIZATIONS) {
         $content->setVariable("LABEL_ORGANIZATIONS", gettext("Organizations"));
     }
     if (ENABLED_USER_DESC) {
         $content->setVariable("LABEL_DESCRIBE_YOURSELF", gettext("Describe yourself"));
     }
     if (ENABLED_CONTACTS_TITLE) {
         $content->setVariable("LABEL_CONTACT_DATA", gettext("Contact Data"));
     }
     if (ENABLED_EMAIL) {
         $content->setVariable("LABEL_EMAIL", gettext("E-mail"));
         $content->setVariable("LABEL_EMAIL_PREFERENCES", gettext("Looking for your e-mail preferences?"));
         //$content->setVariable( "LINK_EMAIL_PREFERENCES", PATH_URL . "messages_prefs.php" );
     }
     if (ENABLED_TELEPHONE) {
         //$content->setVariable( "LABEL_TELEPHONE", gettext( "Phone" ) );
         $content->setVariable("LABEL_TELEPHONE", "Telefon");
     }
     $content->setVariable("LABEL_MOBILE", gettext("Phone, mobile"));
     if (ENABLED_ADDRESS) {
         $content->setVariable("LABEL_ADDRESS", gettext("Address"));
     }
     if (ENABLED_PHONE_MOBILE) {
         $content->setVariable("LABEL_PHONE_MOBILE", gettext("Phone, mobile"));
     }
     if (ENABLED_WEBSITE) {
         $content->setVariable("LABEL_WEBSITE", gettext("Website"));
         $content->setVariable("LABEL_WEBSITE_NAME", gettext("Website name"));
     }
     //TODO: IM-Speichern dementsprechend anpassen
     if (ENABLED_ICQ_NUMBER || ENABLED_BID_IM) {
         $content->setVariable("LABEL_ICQ_NUMBER", gettext("ICQ number"));
     }
     if (ENABLED_MSN_IDENTIFICATION || ENABLED_BID_IM) {
         $content->setVariable("LABEL_MSN_IDENTIFICATION", gettext("MSN identification"));
     }
     if (ENABLED_AIM_ALIAS || ENABLED_BID_IM) {
         $content->setVariable("LABEL_AIM_ALIAS", gettext("AIM-alias"));
     }
     if (ENABLED_YAHOO_ID || ENABLED_BID_IM) {
         $content->setVariable("LABEL_YAHOO_ID", gettext("Yahoo-ID"));
     }
     if (ENABLED_SKYPE_NAME || ENABLED_BID_IM) {
         $content->setVariable("LABEL_SKYPE_NAME", gettext("Skype name"));
     }
     $content->setVariable("INFO_INCLUDE_HTTP", gettext("Please include the 'http://'"));
     $content->setVariable("LABEL_SAVE_IT", gettext("Save changes"));
     $content->setVariable("BACK_LINK", PATH_URL . "profile/index/" . $user->get_name() . "/");
     $content->setVariable("LABEL_GOTO_HOMEPAGE", "<a href=\"" . PATH_URL . "profile/index/" . $user->get_name() . "/\">" . gettext("back") . "</a>");
     if (ENABLED_USER_DESC) {
         $content->setVariable("LABEL_BB_BOLD", gettext("B"));
         $content->setVariable("HINT_BB_BOLD", gettext("boldface"));
         $content->setVariable("LABEL_BB_ITALIC", gettext("I"));
         $content->setVariable("HINT_BB_ITALIC", gettext("italic"));
         $content->setVariable("LABEL_BB_UNDERLINE", gettext("U"));
         $content->setVariable("HINT_BB_UNDERLINE", gettext("underline"));
         $content->setVariable("LABEL_BB_STRIKETHROUGH", gettext("S"));
         $content->setVariable("HINT_BB_STRIKETHROUGH", gettext("strikethrough"));
         $content->setVariable("LABEL_BB_IMAGE", gettext("IMG"));
         $content->setVariable("HINT_BB_IMAGE", gettext("image"));
         $content->setVariable("LABEL_BB_URL", gettext("URL"));
         $content->setVariable("HINT_BB_URL", gettext("web link"));
         $content->setVariable("LABEL_BB_MAIL", gettext("MAIL"));
         $content->setVariable("HINT_BB_MAIL", gettext("email link"));
     }
     // PROFILE VALUES
     if (ENABLED_FIRST_NAME) {
         $content->setVariable("VALUE_USER_FIRSTNAME", $this->safe_string($user_profile["USER_FIRSTNAME"]));
     }
     if (ENABLED_FULL_NAME) {
         $content->setVariable("VALUE_USER_FULLNAME", $this->safe_string($user_profile["USER_FULLNAME"]));
     }
     /*
      *  Assure translations for statuses are available via gettext
      */
     //var_dump($user_profile);die;
     gettext("student");
     gettext("staff member");
     gettext("guest");
     gettext("alumni");
     if (ENABLED_BID_DESCIPTION) {
         $content->setVariable("VALUE_STATUS_BID", $this->safe_string($user_profile["OBJ_DESC"]));
     }
     if (ENABLED_STATUS) {
         $stati = array("student", "staff member", "guest", "alumni");
         foreach ($stati as $status) {
             $content->setCurrentBlock("BLOCK_STATUS");
             $content->setVariable("VALUE_STATUS", $status);
             if ($status === $user_profile["OBJ_DESC"]) {
                 $content->setVariable("STATUS_SELECTED", 'selected="selected"');
             }
             $content->setVariable("VALUE_STATUS_TRANSLATED", secure_gettext($status));
             $content->parse("BLOCK_STATUS");
         }
     }
     //TODO: TEMPLATE EDITIEREN
     if (ENABLED_GENDER) {
         $content->setVariable("GENDER_" . $this->safe_string($user_profile["USER_PROFILE_GENDER"], "X") . "_CHECKED", 'checked="checked"');
     }
     $cache = get_cache_function("ORGANIZATION", 86400);
     if (ENABLED_FACULTY) {
         $faculties = $cache->call("lms_steam::get_faculties_asc");
         $content->setVariable("LABEL_MISCELLANEOUS", gettext("miscellaneous"));
         foreach ($faculties as $faculty) {
             $content->setCurrentBlock("BLOCK_FACULTY");
             $content->setVariable("FACULTY_ID", $faculty["OBJ_ID"]);
             if ($user_profile["USER_PROFILE_FACULTY"] == $faculty["OBJ_ID"]) {
                 $content->setVariable("FACULTY_SELECTED", 'selected="selected"');
             }
             $content->setVariable("FACULTY_NAME", $faculty["OBJ_NAME"]);
             $content->parse("BLOCK_FACULTY");
         }
     }
     if (ENABLED_MAIN_FOCUS) {
         $content->setVariable("VALUE_FOCUS", $this->safe_string($user_profile["USER_PROFILE_FOCUS"]));
     }
     if (ENABLED_HOMETOWN) {
         $content->setVariable("VALUE_HOMETOWN", $this->safe_string($user_profile["USER_PROFILE_HOMETOWN"]));
     }
     if (ENABLED_WANTS) {
         $content->setVariable("VALUE_WANTS", $this->safe_string($user_profile["USER_PROFILE_WANTS"]));
     }
     if (ENABLED_HAVES) {
         $content->setVariable("VALUE_HAVES", $this->safe_string($user_profile["USER_PROFILE_HAVES"]));
     }
     if (ENABLED_OTHER_INTERESTS) {
         $content->setVariable("VALUE_OTHER_INTERESTS", $this->safe_string($user_profile["USER_PROFILE_OTHER_INTERESTS"]));
     }
     if (ENABLED_ORGANIZATIONS) {
         $content->setVariable("VALUE_ORGANIZATIONS", $this->safe_string($user_profile["USER_PROFILE_ORGANIZATIONS"]));
     }
     if (ENABLED_USER_DESC) {
         $content->setVariable("VALUE_USER_PROFILE_DSC", $this->safe_string($user_profile["USER_PROFILE_DSC"]));
     }
     if (ENABLED_EMAIL) {
         $content->setVariable("VALUE_EMAIL", $this->safe_string($user_profile["USER_EMAIL"]));
     }
     if (ENABLED_ADDRESS) {
         $content->setVariable("VALUE_ADDRESS", $this->safe_string($user_profile["USER_PROFILE_ADDRESS"]));
     }
     if (ENABLED_TELEPHONE) {
         $content->setVariable("VALUE_TELEPHONE", $this->safe_string($user_profile["USER_PROFILE_TELEPHONE"]));
     }
     if (ENABLED_PHONE_MOBILE) {
         $content->setVariable("VALUE_PHONE_MOBILE", $this->safe_string($user_profile["USER_PROFILE_PHONE_MOBILE"]));
     }
     if (ENABLED_WEBSITE) {
         $content->setVariable("VALUE_WEBSITE", $this->safe_string($user_profile["USER_PROFILE_WEBSITE_URI"]));
         $content->setVariable("VALUE_WEBSITE_NAME", $this->safe_string($user_profile["USER_PROFILE_WEBSITE_NAME"]));
     }
     if (ENABLED_ICQ_NUMBER || ENABLED_BID_IM) {
         $content->setVariable("VALUE_IM_ICQ", $this->safe_string($user_profile["USER_PROFILE_IM_ICQ"]));
     }
     if (ENABLED_SKYPE_NAME || ENABLED_BID_IM) {
         $content->setVariable("VALUE_IM_SKYPE", $this->safe_string($user_profile["USER_PROFILE_IM_SKYPE"]));
     }
     if (ENABLED_AIM_ALIAS || ENABLED_BID_IM) {
         $content->setVariable("VALUE_IM_AIM", $this->safe_string($user_profile["USER_PROFILE_IM_AIM"]));
     }
     if (ENABLED_MSN_IDENTIFICATION || ENABLED_BID_IM) {
         $content->setVariable("VALUE_IM_MSN", $this->safe_string($user_profile["USER_PROFILE_IM_MSN"]));
     }
     if (ENABLED_YAHOO_ID || ENABLED_BID_IM) {
         $content->setVariable("VALUE_IM_YAHOO", $this->safe_string($user_profile["USER_PROFILE_IM_YAHOO"]));
     }
     if (ENABLED_LANGUAGES) {
         // LANGUAGE
         if (TRUE) {
             // && !empty($user_profile["USER_LANGUAGE"]) ) {
             $ulang = $user_profile["USER_LANGUAGE"];
             if (!is_string($ulang) || $ulang === "0") {
                 $ulang = LANGUAGE_DEFAULT_STEAM;
             }
             $languages = array("english" => array("name" => gettext("English"), "icon" => "flag_gb.gif", "lang_key" => "en_US"), "german" => array("name" => gettext("German"), "icon" => "flag_de.gif", "lang_key" => "de_DE"));
             if (!array_key_exists($ulang, $languages)) {
                 $ulang = LANGUAGE_DEFAULT_STEAM;
             }
             $content->setCurrentBlock("USER_LANGUAGE");
             $content->setVariable("LABEL_LANGUAGES", gettext("Language"));
             foreach ($languages as $key => $language) {
                 $content->setCurrentBlock("LANGUAGE");
                 $content->setVariable("LABEL_LANGUAGE_LABEL", "profile_language_" . $key);
                 $content->setVariable("LANGUAGE_ICON", PATH_STYLE . "/images/" . $language["icon"]);
                 $content->setVariable("LABEL_LANGUAGE", $language["name"]);
                 $content->setVariable("LANGUAGE_VALUE", $key);
                 if ($ulang == $key) {
                     $content->setVariable("LANGUAGE_CHECKED", "checked=\"checked\"");
                 }
                 $content->parse("LANGUAGE");
             }
             $content->parse("USER_LANGUAGE");
         }
     }
     if (ENABLED_BID_LANGUAGE) {
         $content->setVariable("LABEL_LANGUAGES", gettext("Language"));
         if (trim($user_profile["USER_LANGUAGE"]) == trim("german")) {
             $content->setVariable("LANG1", "Deutsch");
             $content->setVariable("LANG2", "English");
             $content->setVariable("LANG3", "german");
             $content->setVariable("LANG4", "english");
         } else {
             $content->setVariable("LANG1", "English");
             $content->setVariable("LANG2", "Deutsch");
             $content->setVariable("LANG3", "english");
             $content->setVariable("LANG4", "german");
         }
     }
     if (ENABLED_BID_NAME) {
         $content->setVariable("LABEL_BID_NAME", gettext("name"));
         $completeName = $user_profile["USER_FIRSTNAME"] . " " . $user_profile["USER_FULLNAME"];
         $content->setVariable("VALUE_USER_NAME_BID", $completeName);
     }
     if (ENABLED_BID_ADRESS) {
         $content->setVariable("LABEL_BID_ADDRESS", gettext("Address"));
         $content->setVariable("VALUE_BID_ADDRESS", $user->get_attribute("USER_ADRESS"));
     }
     if (ENABLED_BID_EMAIL) {
         $content->setVariable("LABEL_EMAIL_BID", gettext("E-Mail"));
         $content->setVariable("VALUE_EMAIL_BID", $user->get_attribute("USER_EMAIL"));
     }
     if (ENABLED_BID_PHONE) {
         $content->setVariable("LABEL_TELEPHONE_BID", "Telefon");
         $content->setVariable("VALUE_TELEPHONE_BID", $user->get_attribute("bid:user_callto"));
     }
     //var_dump($user_profile);die;
     if (PLATFORM_ID == "bid") {
         $frameResponseObject->setHeadline(array(array("link" => PATH_URL . "home/", "name" => $user->get_attribute("USER_FIRSTNAME") . " " . $user->get_attribute("USER_FULLNAME")), array("link" => PATH_URL . "profile/", "name" => gettext("Profile")), array("link" => "", "name" => "Profil ändern")));
     } else {
         $frameResponseObject->setHeadline(array(array("link" => PATH_URL . "profile/index/" . $user->get_name() . "/", "name" => $user->get_attribute("USER_FIRSTNAME") . " " . $user->get_attribute("USER_FULLNAME")), array("link" => "", "name" => gettext("Profile"))));
     }
     $rawHtml = new \Widgets\RawHtml();
     $rawHtml->setHtml($content->get());
     $frameResponseObject->addWidget($rawHtml);
     /*$portal->set_page_main(
     	 array(
     	 array( "link" => PATH_URL . "profile/index/" . $user->get_name() . "/",
     		"name" => $user->get_attribute( "USER_FIRSTNAME" ) . " " . $user->get_attribute( "USER_FULLNAME" )
     		),
     		array( "link" => "",
     		"name" => gettext( "Profile" )
     		)
     		),
     		$content->get(),
     		""
     		);*/
     return $frameResponseObject;
 }
Example #14
0
 public function frameResponse(\FrameResponseObject $frameResponseObject)
 {
     $forum_id = $this->params[0];
     $portal = \lms_portal::get_instance();
     $user = \lms_steam::get_current_user();
     $rss_feeds = $user->get_attribute("USER_RSS_FEEDS");
     $author_id = isset($this->params[1]) ? $this->params[1] : null;
     if (!($messageboard = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $forum_id))) {
         include "bad_link.php";
         exit;
     }
     if ($messageboard instanceof \steam_document) {
         $thread = $messageboard;
         $messageboard = $thread->get_annotating();
         define("OBJ_ID", $thread->get_id());
         if (!$thread->check_access_read($user)) {
             throw new \Exception("No rights to view this.", E_USER_RIGHTS);
         }
     } else {
         define("OBJ_ID", $messageboard->get_id());
         if (!$messageboard->check_access_read($user)) {
             throw new \Exception("No rights to view this.", E_USER_RIGHTS);
         }
     }
     if (!$messageboard instanceof \steam_messageboard) {
         include "bad_link.php";
         exit;
     }
     $is_watching = FALSE;
     if (is_array($rss_feeds)) {
         foreach (array_keys($rss_feeds) as $item) {
             if ($item == $messageboard->get_id()) {
                 $is_watching = TRUE;
             }
         }
     }
     $content = \Messageboard::getInstance()->loadTemplate("forum_all_topics.template.html");
     $dsc = $messageboard->get_attribute("OBJ_DESC");
     if (!empty($dsc)) {
         $content->setCurrentBlock("BLOCK_DESCRIPTION");
         $content->setVariable("FORUM_DESCRIPTION", get_formatted_output($dsc));
         $content->parse("BLOCK_DESCRIPTION");
     }
     $grp = $messageboard->get_environment()->get_creator();
     if ($grp->get_name() == "learners" && $grp->get_attribute(OBJ_TYPE) == "course_learners") {
         $grp = $grp->get_parent_group();
     }
     $content->setVariable("CURRENT_DISCUSSIONS_LABEL", gettext("Current Thread"));
     $content->setVariable("LABEL_SEARCH", gettext("Search"));
     if (isset($_GET["action"]) && $_GET["action"] == "bookmark_rss") {
         \lms_steam::user_add_rssfeed($messageboard->get_id(), PATH_URL . "services/feeds/forum_public.php?id=" . $messageboard->get_id(), "discussion board", \lms_steam::get_link_to_root($messageboard));
         $_SESSION["confirmation"] = str_replace("%NAME", h($messageboard->get_name()), gettext("You are keeping an eye on '%NAME' from now on."));
         header("Location: " . PATH_URL . "forums/" . $messageboard->get_id() . "/");
         exit;
     }
     if (isset($_GET["action"]) && $_GET["action"] == "delete_bookmark") {
         $user = \lms_steam::get_current_user();
         $id = (int) $_GET["unsubscribe"];
         $feeds = $user->get_attribute("USER_RSS_FEEDS");
         if (!is_array($feeds)) {
             $feeds = array();
         }
         unset($feeds[$id]);
         $user->set_attribute("USER_RSS_FEEDS", $feeds);
         $_SESSION["confirmation"] = str_replace("%NAME", h($messageboard->get_name()), gettext("subscription of '%NAME' canceled."));
         header("Location: " . PATH_URL . "forums/" . $messageboard->get_id() . "/");
         exit;
     }
     if (empty($_GET["pattern"]) && !isset($author_id)) {
         $cache = get_cache_function(OBJ_ID, 300);
         $discussions = $cache->call("lms_forum::get_discussions", OBJ_ID);
     } elseif (isset($author_id)) {
         $cache = get_cache_function(\lms_steam::get_current_user()->get_name(), 300);
         $discussions = $cache->call("lms_forum::search_user_posts", $messageboard->get_id(), $author_id);
     } else {
         $cache = get_cache_function(\lms_steam::get_current_user()->get_name(), 300);
         $discussions = $cache->call("lms_forum::search_pattern", $messageboard->get_id(), $_GET["pattern"]);
     }
     $content->setVariable("LABEL_ALL_TOPICS", gettext("All Threads"));
     if ($messageboard->check_access_annotate(\lms_steam::get_current_user())) {
         $content->setCurrentBlock("BLOCK_WRITE_ACCESS");
         if (isset($author_id)) {
             $content->setVariable("LABEL_THREADS_POSTED_IN", gettext("All Threads"));
             // TODO: Passt der link?
             $content->setVariable("LINK_AUTHOR", PATH_URL . "forums/" . $messageboard->get_id() . "/");
         } else {
             $content->setVariable("LABEL_THREADS_POSTED_IN", gettext("Threads you've posted in"));
             // TODO: Passt der link?
             $content->setVariable("LINK_AUTHOR", PATH_URL . "forums/" . $messageboard->get_id() . "/?author=" . \lms_steam::get_current_user()->get_name());
         }
         // TODO: Passt der link?
         $content->setVariable("LINK_POST_NEW", PATH_URL . "messageboard/newDiscussion/" . $messageboard->get_id());
         $content->setVariable("LABEL_POST_NEW_THREAD", gettext("Post a new thread"));
         $content->parse("BLOCK_WRITE_ACCESS");
     }
     if ($messageboard->check_access_write(\lms_steam::get_current_user())) {
         $content->setCurrentBlock("BLOCK_ADMIN");
         $content->setVariable("LINK_EDIT", PATH_URL . "messageboard/editMessageboard/" . $messageboard->get_id());
         $content->setVariable("LABEL_EDIT", gettext("Preferences"));
         $content->setVariable("LINK_DELETE", PATH_URL . "messageboard/deleteMessageboard/" . $messageboard->get_id());
         $content->setVariable("LABEL_DELETE", gettext("Delete forum"));
         $content->parse("BLOCK_ADMIN");
     }
     $content->setCurrentBlock("BLOCK_WATCH");
     if ($is_watching) {
         $content->setVariable("LABEL_BOOKMARK", gettext("End watching"));
         // TODO: Passt der link?
         $content->setVariable("LINK_BOOKMARK", PATH_URL . "forums/" . $messageboard->get_id() . "/?action=delete_bookmark&unsubscribe=" . $messageboard->get_id());
     } else {
         $content->setVariable("LABEL_BOOKMARK", gettext("Watch this forum"));
         // TODO: Passt der link?
         $content->setVariable("LINK_BOOKMARK", PATH_URL . "forums/" . $messageboard->get_id() . "/?action=bookmark_rss");
     }
     $content->parse("BLOCK_WATCH");
     // ACCESS
     $access_descriptions = \lms_forum::get_access_descriptions($grp);
     $access_descriptions = $access_descriptions[$messageboard->get_attribute(KOALA_ACCESS)];
     $access = $access_descriptions["summary_short"] . ": " . $access_descriptions["label"];
     $content->setCurrentBlock("BLOCK_ACCESS");
     $content->setVariable("TITLE_ACCESS", gettext("Access"));
     $content->setVariable("LABEL_ACCESS", $access);
     $content->parse("BLOCK_ACCESS");
     $content->setVariable("LABEL_TITLE", gettext("Title"));
     $content->setVariable("LABEL_AUTHOR", gettext("Author"));
     $content->setVariable("LABEL_REPLIES", gettext("Replies"));
     $content->setVariable("LABEL_LATEST_POST", gettext("Latest Post"));
     // PAGE SETZEN
     $no_discussions = count($discussions);
     $paginator = \lms_portal::get_paginator(20, $no_discussions, gettext("(%TOTAL discussions in forum)"));
     $start = $paginator["startIndex"];
     //$start = $portal->set_paginator( $content, 20, $no_discussions, gettext( "(%TOTAL discussions in forum)" ) );
     $end = $start + 20 > $no_discussions ? $no_discussions : $start + 20;
     for ($i = $start; $i < $end; $i++) {
         $discussion = $discussions[$i];
         $content->setVariable("PAGINATOR", $paginator["html"]);
         $content->setCurrentBlock("BLOCK_THREAD");
         if (time() - $discussion["LATEST_POST_TS"] > $_SESSION["last_login"]) {
             $content->setCurrentBlock("BLOCK_THREAD_NEW");
             $content->setVariable("NEW_LABEL", gettext("New"));
             $content->parse("BLOCK_THREAD_NEW");
         }
         $content->setVariable("THREAD_LINK", PATH_URL . "messageboard/viewDiscussion/" . $discussion["OBJ_ID"] . "/");
         $content->setVariable("THREAD_SUBJECT", h($discussion["OBJ_NAME"]));
         $content->setVariable("THREAD_LAST_ENTRY", how_long_ago($discussion["LATEST_POST_TS"]));
         // TODO: Passt der link?
         $content->setVariable("AUTHOR_LINK", PATH_URL . "user/" . $discussion["AUTHOR_LOGIN"] . "/");
         $content->setVariable("AUTHOR_IMAGE", PATH_URL . "cached/get_document.php?id=" . $discussion["OBJ_ICON"] . "&type=usericon&width=30&height=40");
         $title = !empty($discussion["USER_ACADEMIC_TITLE"]) ? $discussion["USER_ACADEMIC_TITLE"] . " " : "";
         $content->setVariable("AUTHOR_NAME", h($title . $discussion["USER_FIRSTNAME"] . " " . $discussion["USER_FULLNAME"]));
         $content->setVariable("THREAD_REPLIES", h($discussion["REPLIES"]));
         $content->parse("BLOCK_THREAD");
     }
     $portal->set_rss_feed(PATH_URL . "services/feeds/forum_public.php?id=" . OBJ_ID, gettext("Feed"), str_replace("%l", isset($login) ? $login : "", gettext("Subscribe to this forum's Newsfeed")));
     // TODO: Passt der link?
     $rootlink = \lms_steam::get_link_to_root($messageboard);
     $headline = array($rootlink[0], $rootlink[1], array("link" => $rootlink[1]["link"] . "communication/", "name" => gettext("Communication")), array("link" => "", "name" => h($messageboard->get_name())));
     $frameResponseObject->setTitle("Messageboard");
     $rawHtml = new \Widgets\RawHtml();
     $rawHtml->setHtml($content->get());
     $frameResponseObject->addWidget($rawHtml);
     return $frameResponseObject;
 }
Example #15
0
        $wid = $object->get_id();
        // Clean Cache for the deleted wiki
        require_once "Cache/Lite.php";
        $cache = new Cache_Lite(array("cacheDir" => PATH_CACHE));
        $cache = get_cache_function($wid, 600);
        $cache->drop("lms_steam::get_items", $wid);
        // Handle Related Cache-Data
        require_once "Cache/Lite.php";
        $cache = new Cache_Lite(array("cacheDir" => PATH_CACHE));
        $cache->clean($wid);
        // clean wiki cache (not used by wiki)
        $fcache = get_cache_function($object->get_id(), 600);
        $fcache->drop("lms_wiki::get_items", $object->get_id());
        // Clean communication summary cache fĂźr the group/course
        if (is_object($workroom)) {
            $cache = get_cache_function(lms_steam::get_current_user()->get_name(), 600);
            $cache->drop("lms_steam::get_inventory_recursive", $workroom->get_id(), CLASS_CONTAINER | CLASS_ROOM, array("OBJ_TYPE", "WIKI_LANGUAGE"));
            $cache->drop("lms_steam::get_group_communication_objects", $workroom->get_id(), CLASS_MESSAGEBOARD | CLASS_CALENDAR | CLASS_CONTAINER | CLASS_ROOM);
        }
        header("Location: " . $values["return_to"]);
        exit;
    }
}
$content = new HTML_TEMPLATE_IT();
$content->loadTemplateFile(PATH_TEMPLATES . "object_delete.template.html");
if ($object->check_access_write($user)) {
    $content->setVariable("LABEL_ARE_YOU_SURE", str_replace("%NAME", h($object->get_name()), gettext("Are you sure you want to delete the wiki '%NAME' ?")));
    $rootlink = lms_steam::get_link_to_root($object);
    $content->setVariable("DELETE_BACK_LINK", $rootlink[1]["link"] . "communication/");
    $content->setCurrentBlock("BLOCK_DELETE");
    $content->setVariable("FORM_ACTION", $_SERVER["REQUEST_URI"]);
Example #16
0
 public function get_context_menu($context, $params = array())
 {
     $current_user = lms_steam::get_current_user();
     // own profile:
     if ($current_user->get_id() == $this->steam_user->get_id()) {
         switch ($context) {
             case "profile":
                 if (CHANGE_PROFILE_DATA | CHANGE_PROFILE_PICTURE | CHANGE_PROFILE_PRIVACY | PROFILE_VISITORS) {
                     return array(CHANGE_PROFILE_DATA && PROFILE_EDIT ? array("link" => PATH_URL . "profile/edit/", "name" => gettext("Edit profile")) : "", CHANGE_PROFILE_PICTURE && PROFILE_PICTURE ? array("link" => PATH_URL . "profile/image/", "name" => gettext("Change buddy icon")) : "", CHANGE_PROFILE_PRIVACY && PROFILE_PRIVACY ? array("link" => PATH_URL . "profile/privacy/", "name" => gettext("Profile Privacy")) : "", USERMANAGEMENT && CHANGE_PASSWORD ? array("link" => PATH_URL . "usermanagement", "name" => "Passwort ändern") : "", PROFILE_VISITORS ? array("link" => PATH_URL . "profile_visitors.php", "name" => gettext("Visitors of your profile")) : "");
                 }
                 break;
             case "groups":
                 if (SHOW_ALL_PUBLIC_GROUPS | CREATE_GROUPS) {
                     return array(SHOW_ALL_PUBLIC_GROUPS ? array("link" => PATH_URL . "groups/", "name" => gettext("Show public groups")) : "", CREATE_GROUPS ? array("link" => PATH_URL . "groups_create.php?parent=" . STEAM_PUBLIC_GROUP, "name" => gettext("Create group")) : "");
                 }
                 break;
             case "contacts":
                 if (USER_SEARCH) {
                     return array(array("link" => PATH_URL . "search/people/", "name" => gettext("Search a person")));
                 }
                 break;
             default:
                 return array();
         }
     } else {
         $context_menu = array();
         $current_users_cache = get_cache_function($current_user->get_id(), 8640);
         $current_users_buddies = $current_users_cache->call("lms_steam::user_get_buddies", $current_user->get_name(), FALSE);
         $is_buddy = FALSE;
         foreach ($current_users_buddies as $buddy) {
             if ($buddy["OBJ_ID"] == $this->steam_user->get_id()) {
                 $is_buddy = TRUE;
                 break;
             }
         }
         $contact_confirmed = $this->steam_user->contact_is_confirmed($current_user);
         if (!$is_buddy) {
             $toconfirm = $current_user->get_attribute("USER_CONTACTS_TOCONFIRM");
             if (!is_array($toconfirm)) {
                 $toconfirm = array();
             }
             $confirm_necessary = FALSE;
             foreach ($toconfirm as $tc) {
                 if (is_object($tc) && $tc->get_id() == $current_user->get_id()) {
                     $confirm_necessary = TRUE;
                     break;
                 }
             }
             if (!$confirm_necessary) {
                 PROFILE_MANAGE_CONTACT ? $context_menu[] = array("link" => PATH_URL . "contact_add.php?id=" . $this->steam_user->get_id(), "name" => gettext("Add this person as a contact")) : "";
             } else {
                 PROFILE_MANAGE_CONTACT ? $context_menu[] = array("link" => PATH_URL . "contact_confirm.php?id=" . $this->steam_user->get_id(), "name" => gettext("Confirm this contact")) : "";
             }
             PROFILE_SEND_MAIL ? $context_menu[] = array("link" => PATH_URL . "messages_write.php?to=" . $this->steam_user->get_name(), "name" => gettext("Send this person a message")) : "";
         } else {
             PROFILE_SEND_MAIL ? $context_menu[] = array("link" => PATH_URL . "messages_write.php?to=" . $this->steam_user->get_name(), "name" => gettext("Send this person a message")) : "";
             PROFILE_INTRODUCE_PERSON ? $context_menu[] = array("link" => PATH_URL . "contact_introduction.php?type=introduction&id=" . $this->steam_user->get_id(), "name" => gettext("Introduce this person")) : "";
             PROFILE_MANAGE_CONTACT ? $context_menu[] = array("link" => PATH_URL . "contact_delete.php?id=" . $this->steam_user->get_id(), "name" => gettext("Delete contact to this person")) : "";
         }
         return $context_menu;
     }
 }
Example #17
0
 public function frameResponse(\FrameResponseObject $frameResponseObject)
 {
     $forum_id = $this->params[0];
     $comment_id = $this->params[1];
     $portal = \lms_portal::get_instance();
     $user = \lms_steam::get_current_user();
     $rss_feeds = $user->get_attribute("USER_RSS_FEEDS");
     if (!($messageboard = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $forum_id))) {
         include "bad_link.php";
         exit;
     }
     if ($messageboard instanceof \steam_document) {
         $thread = $messageboard;
         $messageboard = $thread->get_annotating();
         define("OBJ_ID", $thread->get_id());
         if (!$thread->check_access_read($user)) {
             throw new \Exception("No rights to view this.", E_USER_RIGHTS);
         }
     } else {
         define("OBJ_ID", $messageboard->get_id());
         if (!$messageboard->check_access_read($user)) {
             throw new \Exception("No rights to view this.", E_USER_RIGHTS);
         }
     }
     if (!$messageboard instanceof \steam_messageboard) {
         include "bad_link.php";
         exit;
     }
     $is_watching = FALSE;
     if (is_array($rss_feeds)) {
         foreach (array_keys($rss_feeds) as $item) {
             if ($item == $messageboard->get_id()) {
                 $is_watching = TRUE;
             }
         }
     }
     $comment = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $comment_id);
     $content = \Messageboard::getInstance()->loadTemplate("comment_edit.template.html");
     if ($_SERVER["REQUEST_METHOD"] == "GET") {
         $content->setVariable("LABEL_HERE_IT_IS", "");
         $content->setVariable("TEXT_COMMENT", h($comment->get_content()));
         $content->setVariable("BACK_LINK", $_SERVER["HTTP_REFERER"]);
     } else {
         $values = $_POST["values"];
         if (!empty($values["save"])) {
             $comment->set_content($values["message"]);
             require_once "Cache/Lite.php";
             // Handle Related Cache-Data (for the case that the subject may be editable in the future)
             require_once "Cache/Lite.php";
             $cache = new \Cache_Lite(array("cacheDir" => PATH_CACHE));
             $cache->clean(OBJ_ID);
             // clean forumcache
             $fcache = get_cache_function(OBJ_ID, 600);
             $fcache->drop("lms_forum::get_discussions", OBJ_ID);
             // clean cache for Weblog RSS Feed for the Comments
             $cache = get_cache_function(OBJ_ID, 600);
             $discussions = $cache->drop("lms_steam::get_annotations", OBJ_ID);
             // clean rsscache
             $rcache = get_cache_function("rss", 600);
             // TODO: Passt der link?
             $feedlink = PATH_URL . "services/feeds/forum_public.php?id=" . OBJ_ID;
             $rcache->drop("lms_rss::get_items", $feedlink);
             // TODO: Passt der link?
             $feedlink = PATH_URL . "services/feeds/weblog_public.php?id=" . OBJ_ID;
             $rcache->drop("lms_rss::get_items", $feedlink);
             header("Location: " . $values["return_to"]);
             exit;
         } else {
             // PREVIEW
             $content->setCurrentBlock("BLOCK_PREVIEW");
             $content->setVariable("LABEL_PREVIEW_EDIT", gettext("Preview the edit"));
             $content->setVariable("PREVIEW_EDIT", get_formatted_output($values["message"]));
             $content->parse("BLOCK_PREVIEW");
             $content->setVariable("LABEL_HERE_IT_IS", gettext("Change it?"));
             $content->setVariable("TEXT_COMMENT", h($values["message"]));
             $content->setVariable("BACK_LINK", $values["return_to"]);
         }
     }
     $content->setVariable("LABEL_BB_BOLD", gettext("B"));
     $content->setVariable("HINT_BB_BOLD", gettext("boldface"));
     $content->setVariable("LABEL_BB_ITALIC", gettext("I"));
     $content->setVariable("HINT_BB_ITALIC", gettext("italic"));
     $content->setVariable("LABEL_BB_UNDERLINE", gettext("U"));
     $content->setVariable("HINT_BB_UNDERLINE", gettext("underline"));
     $content->setVariable("LABEL_BB_STRIKETHROUGH", gettext("S"));
     $content->setVariable("HINT_BB_STRIKETHROUGH", gettext("strikethrough"));
     $content->setVariable("LABEL_BB_IMAGE", gettext("IMG"));
     $content->setVariable("HINT_BB_IMAGE", gettext("image"));
     $content->setVariable("LABEL_BB_URL", gettext("URL"));
     $content->setVariable("HINT_BB_URL", gettext("web link"));
     $content->setVariable("LABEL_BB_MAIL", gettext("MAIL"));
     $content->setVariable("HINT_BB_MAIL", gettext("email link"));
     $content->setVariable("LABEL_PREVIEW", gettext("Preview"));
     $content->setVariable("LABEL_SAVE_CHANGES", gettext("Save changes"));
     $content->setVariable("LABEL_RETURN", gettext("back"));
     // TODO: Passt der link?
     $rootlink = \lms_steam::get_link_to_root($messageboard);
     $headline = array($rootlink[0], $rootlink[1], array("link" => $rootlink[1]["link"] . "communication/", "name" => gettext("Communication")), array("link" => PATH_URL . "forums/" . $messageboard->get_id() . "/", "name" => $messageboard->get_name()), array("link" => "", "name" => gettext("Edit a comment")));
     $frameResponseObject->setTitle("Messageboard");
     $rawHtml = new \Widgets\RawHtml();
     $rawHtml->setHtml($content->get());
     $frameResponseObject->addWidget($rawHtml);
     return $frameResponseObject;
 }
Example #18
0
 function __destruct()
 {
     $cache = get_cache_function($this->user->get_name());
     $cache->drop("lms_steam::user_get_profile", $this->user->get_name());
 }
Example #19
0
<?php

require_once PATH_LIB . "comments_handling.inc.php";
require_once PATH_LIB . "wiki_handling.inc.php";
$wiki_html_handler = new lms_wiki($wiki_container);
$wiki_html_handler->set_admin_menu("index", $wiki_container);
$grp = $wiki_container->get_environment()->get_creator();
if ($grp->get_name() == "learners" && $grp->get_attribute(OBJ_TYPE) == "course_learners") {
    $grp = $grp->get_parent_group();
}
$content = new HTML_TEMPLATE_IT();
$content->loadTemplateFile(PATH_TEMPLATES . "wiki_entries.template.html");
$cache = get_cache_function($wiki_container->get_id(), 600);
$wiki_entries = $cache->call("lms_wiki::get_items", $wiki_container->get_id());
$recently_changed = new LinkedList(5);
$most_discussed = new LinkedList(5);
$latest_comments = new LinkedList(5);
$no_wiki_entries = count($wiki_entries);
if ($no_wiki_entries > 0) {
    $first_char = "";
    for ($i = 0; $i < $no_wiki_entries; $i++) {
        $this_char = substr(strtoupper($wiki_entries[$i]["OBJ_NAME"]), 0, 1);
        if ($this_char > $first_char) {
            $first_char = $this_char;
            if ($i > 1) {
                $content->parse("BLOCK_CHARACTER");
            }
            $content->setCurrentBlock("BLOCK_CHARACTER");
            $content->setVariable("FIRST_CHAR", h($this_char));
        }
        $char_articles = array();
Example #20
0
    if (is_array($_POST["remove"])) {
        $id = key($_POST["remove"]);
        $member_to_kick = steam_factory::username_to_object($GLOBALS["STEAM"]->get_id(), $id);
        $group->remove_member($member_to_kick);
        $portal->set_confirmation(str_replace("%NAME", h($member_to_kick->get_attribute("USER_FIRSTNAME")) . " " . h($member_to_kick->get_attribute("USER_FULLNAME")), gettext("User %NAME successfully removed from group members.")));
        // clear caches:
        $cache = get_cache_function($member_to_kick->get_name());
        $cache->drop("lms_steam::user_get_groups", $member_to_kick->get_name(), TRUE);
        $cache->drop("lms_steam::user_get_groups", $member_to_kick->get_name(), FALSE);
        $cache->drop("lms_steam::user_get_profile", $member_to_kick->get_name());
        $cache->drop("lms_portal::get_menu_html", $member_to_kick->get_name(), TRUE);
        $cache = get_cache_function($group->get_id());
        $cache->drop("lms_steam::group_get_members", $group->get_id());
    }
}
$cache = get_cache_function($group->get_id(), CACHE_LIFETIME_STATIC);
switch (get_class($group)) {
    case "koala_group_course":
        $html_handler_group = new koala_html_course($group);
        $html_handler_group->set_context("members");
        $members = $cache->call("lms_steam::group_get_members", $group->steam_group_learners->get_id());
        break;
    default:
        $html_handler_group = new koala_html_group($group);
        $html_handler_group->set_context("members");
        $members = $cache->call("lms_steam::group_get_members", $group->get_id());
        break;
}
$is_admin = $group->is_admin($user);
$content = new HTML_TEMPLATE_IT();
$content->loadTemplateFile(PATH_TEMPLATES . "list_users.template.html");
Example #21
0
 public function show_html()
 {
     // GENERATE HTML FOR MENU
     if ($this->offline_status) {
         $html_menu = $this->get_menu_html("guest", FALSE);
         $this->template->setVariable("MENU_HTML", $html_menu);
     } else {
         $cache = get_cache_function($this->lms_user->get_login(), 600);
         $html_menu = $cache->call("lms_portal::get_menu_html", $this->lms_user->get_login(), $this->lms_user->is_logged_in());
         $this->template->setVariable("MENU_HTML", $html_menu);
         $html_icon_bar = lms_portal::$instance->get_icon_bar_html($this->lms_user->is_logged_in());
         $this->template->setVariable("ICON_BAR_HTML", $html_icon_bar);
     }
     if ($this->prototype_enabled) {
         $this->template->setCurrentBlock('HEAD_JAVASCRIPT_PROTOTYPE');
         $this->template->setVariable("PATH_JAVASCRIPT_2", PATH_JAVASCRIPT);
         $this->template->setVariable("KOALA_VERSION_2", KOALA_VERSION);
         $this->template->parse('HEAD_JAVASCRIPT_PROTOTYPE');
     }
     try {
         while (ob_get_level() > 0) {
             ob_end_flush();
         }
     } catch (Exception $e) {
     }
     if ($_SESSION["STATISTICS_LEVEL"] > 0) {
         // output number of open-sTeam requests:
         $this->template->setVariable("STATISTICS_REQUESTS", " | " . (isset($GLOBALS["STEAM"]) ? $GLOBALS["STEAM"]->get_request_count() : "nc") . " " . gettext("server requests"));
         // output time taken to produce page:
         if ($_SESSION["STATISTICS_LEVEL"] > 1 && isset($GLOBALS["page_time_start"])) {
             $this->template->setVariable("STATISTICS_PAGETIME", " | " . gettext("page took") . " " . round((microtime(TRUE) - $GLOBALS["page_time_start"]) * 1000) . " ms");
         }
     }
     if (JAVASCRIPT_SECURITY) {
         define("SHOW_SECURITY_PROBLEMS", FALSE);
         //find body
         preg_match_all("/(<body.*?<\\/body>)/is", $this->template->get(), $b_result);
         //logging script
         preg_match_all("/(<script.{0,100})/is", $b_result[1][0], $r_script);
         $scripts = $r_script[1];
         foreach ($scripts as $script) {
             logging::write_log(LOG_SECURITY, "found script in " . $_SERVER["SCRIPT_NAME"] . " user:"******"\n\t\t" . $script . "...");
             if (SHOW_SECURITY_PROBLEMS) {
                 echo "<pre style=\"color:red;\">" . "found script " . htmlspecialchars($script) . "</pre>";
             }
         }
         //loggin link
         preg_match_all("/(<link.{0,100})/is", $b_result[1][0], $r_link);
         $links = $r_link[1];
         foreach ($links as $link) {
             logging::write_log(LOG_SECURITY, "found link in " . $_SERVER["SCRIPT_NAME"] . " user:"******"\n\t\t" . $link . "...");
             if (SHOW_SECURITY_PROBLEMS) {
                 echo "<pre style=\"color:red;\">" . "found link " . htmlspecialchars($link) . "</pre>";
             }
         }
         //remove <script
         $clean_body = str_replace("<script", "", $b_result[1][0]);
         //remove <link
         $clean_body = str_replace("<link", "", $clean_body);
         $clean_html = preg_replace("/(<body.*?<\\/body>)/is", $clean_body, $this->template->get());
         //remove <... on...="..." onload, onclick, etc.
         preg_match_all("/<body[^>]*>(.*)<\\/body>/is", $clean_html, $b_result);
         $body_content = $b_result[1][0];
         preg_match_all("/<[^>]*(\\s(on\\w*=((\"[^\"]*\")|('[^']*'))))+/is", $body_content, $on_result);
         $ons = $on_result[1];
         foreach ($ons as $on) {
             logging::write_log(LOG_SECURITY, "found on*** in " . $_SERVER["SCRIPT_NAME"] . " user:"******"\n\t\t" . $on);
             if (SHOW_SECURITY_PROBLEMS) {
                 echo "<pre style=\"color:red;\">" . "found on*** " . htmlspecialchars($on) . "</pre>";
             }
         }
         $body_content = preg_replace("/<[^>]*\\s(on\\w*=((\"[^\"]*\")|('[^']*')))/is", "", $body_content);
         preg_match_all("/(<body[^>]*>)/is", $clean_html, $r);
         $body_start = $r[1][0];
         $clean_html = preg_replace("/<body[^>]*>.*<\\/body>/is", $body_start . $body_content . "</body>", $clean_html);
         return print $clean_html;
     } else {
         return $this->template->show();
     }
 }
Example #22
0
 public function remove_member($user)
 {
     $ret = $this->steam_object->remove_member($user);
     if ($ret) {
         $cache = get_cache_function($user->get_name());
         $cache->drop("lms_steam::user_get_groups", $user->get_name(), TRUE);
         $cache->drop("lms_steam::user_get_groups", $user->get_name(), FALSE);
         $cache = get_cache_function($this->get_id());
         $cache->drop("lms_steam::group_get_members", $this->get_id());
         try {
             $this->steam_object->sanction(ACCESS_DENIED, $user);
             //$this->steam_object->sanction_meta( ACCESS_DENIED, $user );
             $workroom = $this->get_workroom();
             if (is_object($workroom)) {
                 $workroom->sanction(ACCESS_DENIED, $user);
                 //$workroom->sanction_meta( ACCESS_DENIED, $user );
             }
             $cache = get_cache_function($user->get_name());
         } catch (Exception $ex) {
             throw new Exception("cannot reject access rights removing member", E_PARAMETER);
         }
     }
     return $ret;
 }
Example #23
0
 public function execute(\FrameResponseObject $frameResponseObject)
 {
     //$portal = \lms_portal::get_instance();
     //$portal->initialize( GUEST_NOT_ALLOWED );
     //$portal->set_guest_allowed( GUEST_NOT_ALLOWED );
     $user = \lms_steam::get_current_user();
     //$portal_user = $portal->get_user();
     //$path = $request->getPath();
     $current_semester = $this->params[1];
     $group_course = \steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), "Courses." . $this->params[0] . "." . $this->params[1]);
     $group = new \koala_group_course($group_course);
     //$html_handler_course = new \koala_html_course($course);
     if (!$group instanceof \koala_group) {
         throw new \Exception("Variable group not set.");
     }
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         if (isset($_POST["remove"]) && is_array($_POST["remove"])) {
             $id = key($_POST["remove"]);
             $member_to_kick = \steam_factory::username_to_object($GLOBALS["STEAM"]->get_id(), $id);
             $group->remove_member($member_to_kick);
             $frameResponseObject->setConfirmText(str_replace("%NAME", h($member_to_kick->get_attribute("USER_FIRSTNAME")) . " " . h($member_to_kick->get_attribute("USER_FULLNAME")), gettext("User %NAME successfully removed from group members.")));
             //$portal->set_confirmation( str_replace( "%NAME", h($member_to_kick->get_attribute( "USER_FIRSTNAME" ))." " . h($member_to_kick->get_attribute( "USER_FULLNAME" )), gettext( "User %NAME successfully removed from group members." ) ) );
             // clear caches:
             $cache = get_cache_function($member_to_kick->get_name());
             $cache->drop("lms_steam::user_get_groups", $member_to_kick->get_name(), TRUE);
             $cache->drop("lms_steam::user_get_groups", $member_to_kick->get_name(), FALSE);
             $cache->drop("lms_steam::user_get_profile", $member_to_kick->get_name());
             $cache->drop("lms_portal::get_menu_html", $member_to_kick->get_name(), TRUE);
             $cache = get_cache_function($group->get_id());
             $cache->drop("lms_steam::group_get_members", $group->get_id());
         } else {
             if (isset($_POST["hide"]) && is_array($_POST["hide"])) {
                 $hidden_members = $group->get_steam_group()->get_attribute("COURSE_HIDDEN_STAFF");
                 if (!is_array($hidden_members)) {
                     $hidden_members = array();
                 }
                 $users_to_hide = array_keys($_POST["hide"]);
                 $displayed_staff_members = array();
                 $displayed_staff_members = array_keys($_POST["displayed_staff_member"]);
                 $tmp1_users_to_hide = array_unique(array_merge($hidden_members, $users_to_hide));
                 $tmp2_users_to_hide = array_diff($tmp1_users_to_hide, $displayed_staff_members);
                 $final_users_to_hide = array_unique(array_merge($tmp2_users_to_hide, $users_to_hide));
                 $group->get_steam_group()->set_attribute("COURSE_HIDDEN_STAFF", $final_users_to_hide);
             } else {
                 $hidden_members = $group->get_steam_group()->get_attribute("COURSE_HIDDEN_STAFF");
                 if (!is_array($hidden_members)) {
                     $hidden_members = array();
                 }
                 $displayed_staff_members = array();
                 $displayed_staff_members = array_keys($_POST["displayed_staff_member"]);
                 $users_to_hide = array();
                 $users_to_hide = array_diff($hidden_members, $displayed_staff_members);
                 $group->get_steam_group()->set_attribute("COURSE_HIDDEN_STAFF", $users_to_hide);
             }
             $frameResponseObject->setConfirmText("Sucessfully updated the visibility of course staff");
             //$portal->set_confirmation( "Sucessfully updated the visibility of course staff" );
         }
     }
     $cache = get_cache_function($group->get_id(), CACHE_LIFETIME_STATIC);
     switch (get_class($group)) {
         case "koala_group_course":
             $html_handler_group = new \koala_html_course($group);
             $html_handler_group->set_context("staff");
             //$members = $cache->call( "lms_steam::group_get_members", $group->steam_group_staff->get_id() );
             $members = \lms_steam::group_get_members($group->steam_group_staff->get_id());
             break;
         default:
             $html_handler_group = new \koala_html_group($group);
             $html_handler_group->set_context("staff");
             //$members = $cache->call( "lms_steam::group_get_members", $group->get_id() );
             $members = \lms_steam::group_get_members($group->get_id());
             break;
     }
     $is_admin = $group->is_admin($user);
     $content = \Course::getInstance()->loadTemplate("list_staff.template.html");
     //$content = new HTML_TEMPLATE_IT();
     //$content->loadTemplateFile( PATH_TEMPLATES . "list_staff.template.html" );
     $no_members = count($members);
     //DONE
     if ($no_members > 0) {
         $pageIterator = \lms_portal::get_paginator(10, $no_members, "(" . str_replace("%NAME", h($group->get_name()), gettext("%TOTAL members in %NAME")) . ")");
         $content->setVariable("PAGEITERATOR", $pageIterator["html"]);
         $start = $pageIterator["startIndex"];
         //$start = $portal->set_paginator( $content, 10, $no_members, "(" . str_replace( "%NAME", h($group->get_name()), gettext( "%TOTAL members in %NAME" ) ) . ")" );
         $end = $start + 10 > $no_members ? $no_members : $start + 10;
         $content->setVariable("LABEL_CONTACTS", gettext("staff member") . " (" . str_replace(array("%a", "%z", "%s"), array($start + 1, $end, $no_members), gettext("%a-%z out of %s")) . ")");
         $content->setCurrentBlock("BLOCK_CONTACT_LIST");
         $content->setVariable("LABEL_NAME_POSITION", gettext("Name, position"));
         !COURSE_STAFF_FACULTY_AND_FOCUS or $content->setVariable("LABEL_SUBJECT_AREA", gettext("Origin/Focus"));
         $content->setVariable("LABEL_COMMUNICATION", gettext("Communication"));
         if (\lms_steam::is_koala_admin($user) || !COURSE_KOALAADMIN_ONLY && $is_admin) {
             !COURSE_STAFFLIST_MANAGE or $content->setVariable("TH_MANAGE_CONTACT", gettext("Action"));
             !COURSE_STAFFLIST_HIDE or $content->setVariable("TH_STAFF_MEMBER_VISIBILITY", gettext("hidden"));
             !COURSE_STAFFLIST_HIDE or $content->setVariable("STAFF_MEMBER_VISIBILITY_TITLE", gettext("Selected staff members will not be visible on the course start page."));
         }
         !COURSE_STAFF_EXTENSIONS or $content->setVariable("TH_MANAGE_EXTENSIONS", "Status");
         $content->setVariable("BEGIN_HTML_FORM", "<form method=\"POST\" action=\"\">");
         $content->setVariable("END_HTML_FORM", "</form>");
         $hidden_members = $group->get_steam_group()->get_attribute("COURSE_HIDDEN_STAFF");
         if (!is_array($hidden_members)) {
             $hidden_members = array();
         }
         for ($i = $start; $i < $end; $i++) {
             $member = $members[$i];
             if ($member["USER_TRASHED"] === 1) {
                 continue;
             }
             $content->setCurrentBlock("BLOCK_CONTACT");
             $content->setVariable("CONTACT_LINK", PATH_URL . "user/" . h($member["OBJ_NAME"]) . "/");
             $icon_link = $member["OBJ_ICON"] == 0 ? PATH_STYLE . "images/anonymous.jpg" : PATH_URL . "download/image/" . h($member["OBJ_ICON"]) . "/26/35";
             $content->setVariable("CONTACT_IMAGE", $icon_link);
             $title = !empty($member["USER_ACADEMIC_TITLE"]) ? h($member["USER_ACADEMIC_TITLE"]) . " " : "";
             $content->setVariable("CONTACT_NAME", $title . h($member["USER_FIRSTNAME"]) . " " . h($member["USER_FULLNAME"]));
             if (!COURSE_SHOW_ONLY_EXTERN_MAIL || COURSE_SHOW_ONLY_EXTERN_MAIL && is_string(\steam_factory::get_user($GLOBALS['STEAM']->get_id(), $member["OBJ_NAME"])->get_attribute("USER_EMAIL")) && steam_factory::get_user($GLOBALS['STEAM']->get_id(), $member["OBJ_NAME"])->get_attribute("USER_EMAIL") != "" && steam_factory::get_user($GLOBALS['STEAM']->get_id(), $member["OBJ_NAME"])->get_attribute("USER_FORWARD_MSG") === 1) {
                 $content->setVariable("LINK_SEND_MESSAGE", PATH_URL . "messages_write.php?to=" . h($member["OBJ_NAME"]));
                 $content->setVariable("LABEL_MESSAGE", gettext("Message"));
                 $content->setVariable("LABEL_SEND", gettext("Send"));
             }
             !COURSE_STAFF_FACULTY_AND_FOCUS or $content->setVariable("FACULTY_AND_FOCUS", h($member["USER_PROFILE_FACULTY"]));
             if (\lms_steam::is_koala_admin($user) || !COURSE_KOALAADMIN_ONLY && $is_admin) {
                 !COURSE_STAFFLIST_MANAGE or $content->setVariable("TD_MANAGE_CONTACT", "<td align=\"center\"><input type=\"submit\"  name=\"remove[" . h($member["OBJ_NAME"]) . "]\" value=\"" . gettext("Remove") . "\"/></td>");
                 if (in_array($member["OBJ_ID"], $hidden_members)) {
                     !COURSE_STAFFLIST_HIDE or $content->setVariable("TD_STAFF_MEMBER_VISIBILITY", "<td align=\"center\"><input type=\"checkbox\" name=\"hide[" . $member["OBJ_ID"] . "]\" checked=\"checked\"/>" . "\n\t\t\t<input type=\"hidden\" name=\"displayed_staff_member[" . $member["OBJ_ID"] . "]\" />" . "</td>");
                 } else {
                     !COURSE_STAFFLIST_HIDE or $content->setVariable("TD_STAFF_MEMBER_VISIBILITY", "<td align=\"center\"><input type=\"checkbox\" name=\"hide[" . $member["OBJ_ID"] . "]\" />" . "\n\t\t\t<input type=\"hidden\" name=\"displayed_staff_member[" . $member["OBJ_ID"] . "]\" />" . "</td>");
                 }
             }
             $member_desc = empty($member["OBJ_DESC"]) ? "student" : $member["OBJ_DESC"];
             $status = secure_gettext($member_desc);
             $content->setVariable("OBJ_DESC", h($status));
             if (COURSE_STAFF_EXTENSIONS) {
                 $extensions = $group->get_extensions();
                 $result = "";
                 foreach ($extensions as $extension) {
                     $result .= $extension->get_member_info(\steam_factory::get_user($GLOBALS["STEAM"]->get_id(), $member["OBJ_NAME"]), $group);
                 }
                 $content->setVariable("EXTENSIONS_DATA", $result);
             }
             $content->parse("BLOCK_CONTACT");
         }
         if (\lms_steam::is_koala_admin($user) || !COURSE_KOALAADMIN_ONLY && $is_admin) {
             !COURSE_STAFFLIST_HIDE or $content->setVariable("LABEL_SUBMIT_BUTTON", gettext("Save"));
         }
         $content->parse("BLOCK_CONTACT_LIST");
     } else {
         $content->setVariable("LABEL_NO_MEMBERS", gettext("No staff found."));
     }
     $html_handler_group->set_html_left($content->get());
     //$portal->set_page_main( $html_handler_group->get_headline(), $html_handler_group->get_html() , "" );
     $frameResponseObject->setHeadline($html_handler_group->get_headline());
     $widget = new \Widgets\RawHtml();
     $widget->setHtml($html_handler_group->get_html());
     $frameResponseObject->addWidget($widget);
     return $frameResponseObject;
 }
Example #24
0
        print $rss_channel->generate_xml_header();
        $max_items = 20;
        $discussion = lms_weblog::get_item_data($object);
        print $rss_channel->generate_item($discussion["OBJ_NAME"] . " " . gettext("by") . " " . $discussion["AUTHOR"], "", BBCode($discussion["CONTENT"]), $discussion["AUTHOR"], $discussion["DATE_START_DATE"], "", PATH_URL . "weblog/" . $_GET["id"] . "/#comment" . $discussion["OBJ_ID"]);
        $cache = get_cache_function($_GET["id"], 600);
        $discussions = $cache->call("lms_steam::get_annotations", $_GET["id"]);
        while ((list($id, $discussion) = each($discussions)) && $max_items > 0) {
            print $rss_channel->generate_item(gettext("Comment by ") . $discussion["OBJ_CREATOR"], "", BBCode($discussion["CONTENT"]), $discussion["OBJ_CREATOR"], $discussion["OBJ_CREATION_TIME"], "", PATH_URL . "weblog/" . $_GET["id"] . "/#comment" . $forum->get_id());
            $max_items--;
        }
        print $rss_channel->generate_xml_footer();
    } else {
        // Generate RSS for the Weblog container
        $rss_channel = new RssChannel($forum->get_name(), PATH_URL . "weblog/" . $_GET["id"] . "/", "");
        $rss_channel->generate_http_header();
        print $rss_channel->generate_xml_header();
        $cache = get_cache_function($_GET["id"], 600);
        $discussions = $cache->call("lms_weblog::get_items", $_GET["id"]);
        $max_items = 20;
        while ((list($id, $discussion) = each($discussions)) && $max_items > 0) {
            print $rss_channel->generate_item($discussion["OBJ_NAME"], "", BBCode($discussion["CONTENT"]), $discussion["AUTHOR"], $discussion["DATE_START_DATE"], "", PATH_URL . "weblog/" . $discussion["OBJ_ID"] . "/");
            $max_items--;
        }
        print $rss_channel->generate_xml_footer();
    }
} else {
    $rss_channel = new PodcastRSS("Access denied", PATH_SERVER . $_SERVER["REQUEST_URI"], "You are not allowed to access this RSS Feed. Please check your username and password");
    $rss_channel->generate_http_header();
    $rss_channel->generate_xml_header(TRUE);
    exit;
}
Example #25
0
function get_comment_html($document, $url)
{
    $cache = get_cache_function($document->get_id(), 600);
    $user = lms_steam::get_current_user();
    $write_access = $document->check_access(SANCTION_ANNOTATE, $user);
    $template = new HTML_TEMPLATE_IT();
    $template->loadTemplateFile(PATH_TEMPLATES . "comments.template.html");
    $headline = gettext("Add your comment");
    if ($_SERVER["REQUEST_METHOD"] == "POST" && $write_access) {
        $values = $_POST["values"];
        if (!empty($values["preview_comment"])) {
            $template->setCurrentBlock("BLOCK_PREVIEW_COMMENT");
            $template->setVariable("TEXT_COMMENT", $values["comment"]);
            $template->setVariable("PREVIEW", gettext("Preview"));
            $template->setVariable("POST_COMMENT", gettext("Post comment"));
            $template->setVariable("LABEL_PREVIEW_YOUR_COMMENT", gettext("Preview your comment"));
            $template->setVariable("VALUE_PREVIEW_COMMENT", get_formatted_output($values["comment"]));
            $template->parse("BLOCK_PREVIEW_COMMENT");
            $headline = gettext("Change it?");
        }
        if (!empty($values["submit_comment"]) && !empty($values["comment"])) {
            $new_comment = steam_factory::create_textdoc($GLOBALS["STEAM"]->get_id(), $user->get_name() . "-" . time(), $values["comment"]);
            $all_user = steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), STEAM_ALL_USER);
            $new_comment->set_acquire($document);
            $new_comment->set_read_access($all_user);
            $document->add_annotation($new_comment);
            $cache->drop("lms_steam::get_annotations", $document->get_id());
        }
    }
    $comments = $cache->call("lms_steam::get_annotations", $document->get_id());
    if (count($comments) > 0) {
        $template->setVariable("LABEL_COMMENTS", gettext("comments"));
    }
    $comments = array_reverse($comments);
    //reverse comment order (oldest first)
    foreach ($comments as $comment) {
        $obj_comment = steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $comment["OBJ_ID"]);
        $template->setCurrentBlock("BLOCK_ANNOTATION");
        $template->setVariable("COMMENT_ID", $comment["OBJ_ID"]);
        $template->setVariable("AUTHOR_LINK", PATH_URL . "user/" . $comment["OBJ_CREATOR_LOGIN"] . "/");
        $template->setVariable("AUTHOR_NAME", $comment["OBJ_CREATOR"]);
        $template->setVariable("IMAGE_LINK", PATH_URL . "get_document.php?id=" . $comment["OBJ_ICON"]);
        $template->setVariable("LABEL_SAYS", gettext("says"));
        $template->setVariable("ANNOTATION_COMMENT", get_formatted_output($comment["CONTENT"], 80, "\n"));
        $template->setVariable("HOW_LONG_AGO", how_long_ago($comment["OBJ_CREATION_TIME"]));
        $template->setVariable('LINK_PERMALINK', $url . '/#comment' . $comment['OBJ_ID']);
        $template->setVariable("LABEL_PERMALINK", gettext("permalink"));
        if ($obj_comment->check_access_write($user)) {
            $template->setCurrentBlock("BLOCK_OWN_COMMENT");
            $template->setVariable("LINK_DELETE", $url . "/deletecomment" . $comment["OBJ_ID"] . "/");
            $template->setVariable("LABEL_DELETE", gettext("delete"));
            $template->setVariable("LINK_EDIT", $url . "/editcomment" . $comment["OBJ_ID"] . "/");
            $template->setVariable("LABEL_EDIT", gettext("edit"));
            $template->parse("BLOCK_OWN_COMMENT");
        }
        $template->parse("BLOCK_ANNOTATION");
    }
    if ($write_access) {
        $template->setCurrentBlock("BLOCK_ADD_COMMENT");
        $template->setVariable("LABEL_ADD_YOUR_COMMENT", $headline);
        $template->setVariable("LABEL_PREVIEW", gettext("Preview"));
        $template->setVariable("LABEL_OR", gettext("or"));
        $template->setVariable("LABEL_COMMENT", gettext("Add comment"));
        $template->setVariable("LABEL_BB_BOLD", gettext("B"));
        $template->setVariable("HINT_BB_BOLD", gettext("boldface"));
        $template->setVariable("LABEL_BB_ITALIC", gettext("I"));
        $template->setVariable("HINT_BB_ITALIC", gettext("italic"));
        $template->setVariable("LABEL_BB_UNDERLINE", gettext("U"));
        $template->setVariable("HINT_BB_UNDERLINE", gettext("underline"));
        $template->setVariable("LABEL_BB_STRIKETHROUGH", gettext("S"));
        $template->setVariable("HINT_BB_STRIKETHROUGH", gettext("strikethrough"));
        $template->setVariable("LABEL_BB_IMAGE", gettext("IMG"));
        $template->setVariable("HINT_BB_IMAGE", gettext("image"));
        $template->setVariable("LABEL_BB_URL", gettext("URL"));
        $template->setVariable("HINT_BB_URL", gettext("web link"));
        $template->setVariable("LABEL_BB_MAIL", gettext("MAIL"));
        $template->setVariable("HINT_BB_MAIL", gettext("email link"));
        $template->parse("BLOCK_ADD_COMMENT");
    }
    return $template->get();
}
Example #26
0
 * The following variables *must* be set before including this file:
 * * $user : steam_user whose clipboard shall be displayed
 * * $documents_path : rest of the path that is relevant for the clipboard
 *     (e.g. everything after /user/root/clipboard/) as an array of path
 *     elements.
 * * $documents_root : steam_container that is the root of the document path
 *     hierarchy, e.g. $user (for the clipboard)
 * * $portal : a valid lms_portal instance
 * 
 * The following variables *may* be set before including this file:
 * * $container_icons : if set to FALSE, then no icons will be displayed for
 *      the inventory objects, otherwise the icons from the open-sTeam backend
 *      will be displayed.
 */
$current_user = lms_steam::get_current_user();
$cache = get_cache_function($user->get_name(), 86400);
$action = "";
if (isset($documents_path[0]) && is_numeric($documents_path[0])) {
    $backlink .= $documents_path[0] . "/";
    $container = steam_factory::get_object($GLOBALS["STEAM"]->get_id(), (int) $documents_path[0], CLASS_CONTAINER);
    $koala_container = koala_object::get_koala_object($container);
    if (isset($documents_path[1])) {
        $action = $documents_path[1];
    }
} else {
    $container = $documents_root;
    $koala_container = new koala_container_clipboard($user);
    if (isset($documents_path[0])) {
        $action = $documents_path[0];
    }
}
Example #27
0
    } else {
        $message = "";
    }
    if (!$already_member_and_exclusive) {
        if (defined("LOG_DEBUGLOG")) {
            logging::write_log(LOG_DEBUGLOG, "group_subscribe\t" . $user->get_name() . " joins " . $steam_group->get_identifier());
        }
        logging::start_timer("join_group");
        $result = $group->subscribe($password, $message);
        if (defined("LOG_DEBUGLOG")) {
            logging::append_log(LOG_DEBUGLOG, " runtime=" . logging::print_timer("join_group"));
        }
        if ($result["succeeds"]) {
            $_SESSION['confirmation'] = $result['confirmation'];
            // uncache menu so that course/group appears:
            $cache = get_cache_function($user->get_name());
            $cache->drop("lms_steam::user_get_profile", $user->get_name());
            $cache->drop("lms_portal::get_menu_html", $user->get_name(), TRUE);
            if (!$group->is_member($user)) {
                $backlink = PATH_URL . 'desktop/';
            }
            header('Location: ' . $backlink);
        } else {
            $portal->set_problem_description($result["problem"], $result["hint"]);
        }
    } else {
        $portal->set_problem_description(gettext("You are already member of tutorial") . " " . $in_group->get_name() . ".", gettext("Resign from the tutorial to become member here."));
    }
}
// GET
$content = new HTML_TEMPLATE_IT();
Example #28
0
    public function execute(\FrameResponseObject $frameResponseObject)
    {
        //CODE FOR ALL COMMANDS OF THIS PAKAGE END
        $user = \lms_steam::get_current_user();
        // Disable caching
        // TODO: Work on cache handling. An enabled cache leads to bugs
        // if used with the wiki.
        \CacheSettings::disable_caching();
        if (!($wiki_container = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id))) {
            include "bad_link.php";
            exit;
        }
        if (!$wiki_container instanceof \steam_container) {
            $wiki_doc = $wiki_container;
            $wiki_container = $wiki_doc->get_environment();
            if ($wiki_doc->get_attribute(DOC_MIME_TYPE) != "text/wiki") {
                include "bad_link.php";
                exit;
            }
        }
        //CODE FOR ALL COMMANDS OF THIS PAKAGE END
        defined("OBJ_ID") or define("OBJ_ID", $wiki_container->get_id());
        $content = \Wiki::getInstance()->loadTemplate("wiki_edit.template.html");
        //$content = new HTML_TEMPLATE_IT();
        //$content->loadTemplateFile( PATH_TEMPLATES . "wiki_edit.template.html" );
        $wiki_entries = $wiki_container->get_inventory(CLASS_DOCUMENT);
        foreach ($wiki_entries as $wiki_entry) {
            if ($wiki_entry->get_attribute(DOC_MIME_TYPE) === "text/wiki") {
                $name = $wiki_entry->get_name();
                $content->setCurrentBlock("BLOCK_WIKI_ENTRY_OPTION");
                $content->setVariable("WIKI_ENTRY_OPTION", "<option value=\"{$name}\">{$name}</option>");
                $content->parse("BLOCK_WIKI_ENTRY_OPTION");
            }
        }
        $problems = "";
        if (!isset($create)) {
            $create = FALSE;
        }
        if ($_SERVER["REQUEST_METHOD"] == "POST") {
            $values = $_POST["values"];
            if (get_magic_quotes_gpc()) {
                if (!empty($values['title'])) {
                    $values['title'] = stripslashes($values['title']);
                }
                if (!empty($values['body'])) {
                    $values['body'] = stripslashes($values['body']);
                }
            }
            if (empty($values["title"])) {
                $problems = gettext("Please enter a subject for your message.");
            }
            if (empty($values["body"])) {
                $problems .= empty($problems) ? gettext("Please enter your message.") : "<br>" . gettext("Please enter your message.");
            }
            if (strpos($values["title"], "/")) {
                if (!isset($problems)) {
                    $problems = "";
                }
                $problems .= gettext("Please don't use the \"/\"-char in the subject of your post.");
            }
            if (empty($problems)) {
                $wiki_content = str_replace("@", "&#64;", $values["body"]);
                if (!empty($values['save'])) {
                    if ($create) {
                        $wiki_doc = \steam_factory::create_document($GLOBALS["STEAM"]->get_id(), $values["title"] . ".wiki", $wiki_content, "text/wiki", $wiki_container, "");
                    } else {
                        // PRUEFEN, OB ALLES OK, DANN NEUE WERTE SPEICHERN
                        $wiki_doc->set_name($values['title'] . ".wiki");
                        $wiki_doc->set_content($wiki_content);
                    }
                    // Clean cache for wiki_entries
                    $cache = get_cache_function($wiki_container->get_id(), 600);
                    $cache->clean($wiki_container->get_id());
                    // clean rsscache
                    $rcache = get_cache_function("rss", 600);
                    $feedlink = PATH_URL . "services/feeds/wiki_public.php?id=" . $wiki_container->get_id();
                    $rcache->drop("lms_rss::get_items", $feedlink);
                    header("Location: " . PATH_URL . "wiki/editentry/" . $wiki_doc->get_id() . "/");
                    exit;
                } else {
                    // PREVIEW
                    $content->setCurrentBlock("BLOCK_PREVIEW");
                    $content->setVariable("LABEL_PREVIEW_EDIT", gettext("Preview the description"));
                    $content->setVariable("PREVIEW_EDIT", get_formatted_output($values["desc"]));
                    $content->parse("BLOCK_PREVIEW");
                    $headline = gettext("Change it?");
                    $content->setVariable("TEXT_DSC", h($values["desc"]));
                    $content->setVariable("TITLE_COMMENT", h($values["title"]));
                }
            } else {
                $frameResponseObject->setProblemDescription($problems);
                //$portal->set_problem_description( $problems );
            }
        }
        if (empty($values)) {
            $wikicontent = "";
            $wikiname = "";
            if (!$create) {
                $wikicontent = $wiki_doc->get_content();
                $wikicontent = str_replace("&#64;", "@", $wikicontent);
                $wikiname = $wiki_doc->get_name();
            }
            if (WIKI_WYSIWYG) {
                //TODO
                $content->setVariable("TEXT_DSC", h($wikicontent));
                //$content->setVariable( "TEXT_DSC", wikitext_to_html( h($wikicontent), $wiki_container->get_id() ) );
                //$content->setVariable( "NIC_SCRIPT", PATH_JAVASCRIPT . "niceditor/nicEdit.js");
            } else {
                $content->setVariable("TEXT_DSC", h($wikicontent));
            }
            $content->setVariable("TITLE_COMMENT", str_replace(".wiki", "", h($wikiname)));
            $content->setVariable("BACK_LINK", $_SERVER["HTTP_REFERER"]);
        } else {
            $content->setVariable("TITLE_COMMENT", h($values["title"]));
            if (isset($values["body"])) {
                $content->setVariable("TEXT_DSC", h($values["body"]));
            }
        }
        $content->setVariable("LABEL_HERE_IT_IS", "");
        $content->setVariable("LABEL_TITLE", gettext("Title"));
        $content->setVariable("LABEL_BODY", gettext("Body"));
        //$content->setVariable( "LABEL_WIKI_H2", gettext( "H2" ) );
        //$content->setVariable( "HINT_WIKI_H2", gettext( "heading (level 2)" ) );
        //$content->setVariable( "LABEL_WIKI_H3", gettext( "H3" ) );
        //$content->setVariable( "HINT_WIKI_H3", gettext( "heading (level 3)" ) );
        //$content->setVariable( "LABEL_WIKI_BOLD", gettext( "'''B'''" ) );
        //$content->setVariable( "HINT_WIKI_BOLD", gettext( "boldface" ) );
        //$content->setVariable( "LABEL_WIKI_ITALIC", gettext( "''I''" ) );
        //$content->setVariable( "HINT_WIKI_ITALIC", gettext( "italic" ) );
        //$content->setVariable( "LABEL_WIKI_BULLET_LIST", gettext( "* list" ) );
        //$content->setVariable( "HINT_WIKI_BULLET_LIST", gettext( "bullet list" ) );
        //$content->setVariable( "LABEL_WIKI_NUMBERED_LIST", gettext( "# list" ) );
        //$content->setVariable( "HINT_WIKI_NUMBERED_LIST", gettext( "numbered list" ) );
        //$content->setVariable( "LABEL_WIKI_LINE", gettext( "-----" ) );
        //$content->setVariable( "HINT_WIKI_LINE", gettext( "horizontal line" ) );
        //$content->setVariable( "LABEL_WIKI_LINK", gettext( "[[wiki]]" ) );
        //$content->setVariable( "HINT_WIKI_LINK", gettext( "wiki link" ) );
        //$content->setVariable( "LABEL_WIKI_URL", gettext( "[URL]" ) );
        //$content->setVariable( "HINT_WIKI_URL", gettext( "web link" ) );
        //$content->setVariable( "LABEL_WIKI_IMAGE", gettext( "IMG" ) );
        //$content->setVariable( "HINT_WIKI_IMAGE", gettext( "image" ) );
        $content->setVariable("LABEL_PREVIEW", gettext("Preview"));
        $content->setVariable("LABEL_SAVE_CHANGES", gettext("Save changes"));
        $content->setVariable("LABEL_RETURN", gettext("back"));
        $content->setVariable("JS_NOTICE", '"' . gettext("Warning!\\nYou have edited your entry!\\nIf you proceed, all changes will be lost!\\nDo you really want to proceed?") . '"');
        // widget: Images
        //$widget = new HTML_TEMPLATE_IT();
        //$widget->loadTemplateFile( PATH_TEMPLATES . "widget_wiki_images.template.html" );
        $inventory = $wiki_container->get_inventory();
        if (!is_array($inventory)) {
            $inventory = array();
        }
        if (sizeof($inventory) > 0) {
            \steam_factory::load_attributes($GLOBALS["STEAM"]->get_id(), $inventory, array(OBJ_NAME, OBJ_DESC, DOC_MIME_TYPE));
            $images = array();
            foreach ($inventory as $object) {
                $mime = strtolower($object->get_attribute(DOC_MIME_TYPE));
                if ($mime === "image/jpg" || $mime === "image/jpeg" || $mime === "image/gif" || $mime === "image/png") {
                    $images[] = $object;
                }
            }
            if (empty($images)) {
                $content->setCurrentBlock("BLOCK_WIKI_ENTRY_NOIMAGE");
                $content->setVariable("WIKI_ENTRY_NOIMAGE", "Es befinden sich keine Bilder in der Mediathek.");
                $content->parse("BLOCK_WIKI_ENTRY_NOIMAGE");
            } else {
                $i = 0;
                foreach ($images as $image) {
                    $path = PATH_URL . "download/image/" . $image->get_id() . "/40/80/";
                    $content->setCurrentBlock("BLOCK_WIKI_ENTRY_IMAGE");
                    $content->setVariable("WIKI_ENTRY_IMAGE", <<<END
<table style="float:left">
\t<tr>
\t\t<td>
\t\t\t<input id="image{$i}" type="radio" name="images" value="{$image->get_name()}"/>
\t\t</td>
\t\t<td>
\t\t\t<img src="{$path}" title="{$image->get_name()}">
\t\t</td>
\t</tr>
</table>  \t
END
);
                    $content->parse("BLOCK_WIKI_ENTRY_IMAGE");
                    $i++;
                    //$widget->setCurrentBlock("BLOCK_IMAGE");
                    //$widget->setVariable("WIKI_IMAGE_NAME", $image->get_name());
                    //$widget->setVariable("WIKI_IMAGE_ADD_LINK", "javascript:insert('[[Image:" . $image->get_identifier() . "]]', '', 'formular', 'values[body]')");
                    //$widget->setVariable("WIKI_IMAGE_LINK", PATH_URL . "get_document.php?id=" . $image->get_id() . "&width=40&height=80");
                    //$widget->setVariable("WIKI_IMAGE_VIEW_LINK", PATH_URL . "doc/" . $image->get_id() . "/");
                    //$widget->setVariable("WIKI_IMAGE_TITLE", $image->get_name());
                    //$widget->setVariable("WIKI_IMAGE_ADD", gettext("Insert"));
                    //$widget->setVariable("WIKI_IMAGE_VIEW", gettext("View"));
                    //$widget->parse("BLOCK_IMAGE");
                }
            }
        }
        //$widget->setVariable("UPLOAD_TEXT", gettext("Upload an image"));
        //$widget->setVariable("UPLOAD_LINK", PATH_URL . "upload/?env=" . $wiki_container->get_id());
        //$widget->setVariable("WIKI_IMAGE_EXTERNAL", gettext("External image"));
        //$widget->setVariable("WIKI_IMAGE_EXTERNAL_LINK", "javascript:insert('[[Image:http://', ']]', 'formular', 'values[body]')");
        //$content->setCurrentBlock("BLOCK_WIDGET");
        //$content->setVariable("WIDGET_TITLE", gettext("Images"));
        //$content->setVariable("WIDGET_HTML_CODE", $widget->get());
        //$content->parse("BLOCK_WIDGET");
        if ($create) {
            $pagetitle = gettext("New Article");
        } else {
            $pagetitle = str_replace("%NAME", h(substr($wiki_doc->get_name(), 0, -5)), gettext("Edit '%NAME'?"));
        }
        $rootlink = \lms_steam::get_link_to_root($wiki_container);
        WIKI_FULL_HEADLINE ? $headline = array($rootlink[0], $rootlink[1], array("link" => $rootlink[1]["link"] . "communication/", "name" => gettext("Communication")), array("name" => h($wiki_container->get_name()), "link" => PATH_URL . "wiki/index/" . $wiki_container->get_id() . "/"), array("link" => "", "name" => $pagetitle)) : ($headline = array(array("name" => h($wiki_container->get_name()), "link" => PATH_URL . "wiki/index/" . $wiki_container->get_id() . "/"), array("link" => "", "name" => $pagetitle)));
        /*$portal->set_page_main(
        		$headline,
        		$content->get()
        		);
        		$portal->show_html();
        		*/
        $frameResponseObject->setHeadline($headline);
        $rawHtml = new \Widgets\RawHtml();
        $rawHtml->setHtml($content->get());
        $frameResponseObject->addWidget($rawHtml);
        return $frameResponseObject;
    }
Example #29
0
 public function execute(\FrameResponseObject $frameResponseObject)
 {
     //echo SEMESTER_URL;die;
     //$portal = \lms_portal::get_instance();
     //$portal->initialize( GUEST_NOT_ALLOWED );
     $user = \lms_steam::get_current_user();
     $all_users = \steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), STEAM_ALL_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_groupname() . "." . STEAM_CURRENT_SEMESTER);
     if (!\lms_steam::is_steam_admin($user) && !lms_steam::is_semester_admin($current_semester, $user)) {
         include "bad_link.php";
         exit;
     }
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         $values = $_POST["values"];
         $problems = "";
         $hints = "";
         if (empty($values["semester"])) {
             throw new Exception("Semester is not given.");
         }
         if (empty($values["id"])) {
             $problems .= gettext("The course ID is missing.") . " ";
             $hints .= gettext("The ID is necessary for unique identification, ordering and finding the course. Please fill this out.") . " ";
         }
         if (!empty($values["access"]) && $values["access"] == PERMISSION_COURSE_PASSWORD && empty($values["password"])) {
             $problems .= gettext("The course password is missing.") . " ";
             $hints .= gettext("You chose to password protect your course. Please provide a password.") . " ";
         }
         if (empty($problems) && !empty($values["get_lsf_infos"])) {
             // INFOS UEBER LSF HOLEN
             $lsf_client = new \hislsf_soap();
             unset($_SESSION["LSF_COURSE_INFO"]);
             // TODO: SEMESTER DYNAMISCH SETZEN
             $result = $lsf_client->get_available_courses(SYNC_HISLSF_SEMESTER, $values["id"]);
             if (isset($result->veranstaltung)) {
                 if (count($result->veranstaltung) == 1) {
                     header("Location: " . PATH_URL . "course/create" . "/" . $current_semester->get_name() . "/?lsf_course_id=" . $result->veranstaltung->Veranstaltungsschluessel);
                     exit;
                 } else {
                     header("Location: " . PATH_URL . "course" . "/" . $current_semester->get_name() . "/hislsf/" . $values["id"] . "/");
                     exit;
                 }
             } else {
                 $problems = "Keine Veranstaltungen im LSF unter dieser Nummer gefunden.";
             }
         }
         if (empty($problems)) {
             if (empty($values["name"])) {
                 $problems .= gettext("The course name is missing.") . " ";
                 $hints .= gettext("A name is necessary for identification.") . " ";
             }
             if (strpos($values['id'], '.')) {
                 $problems .= gettext("Please don't use the \".\"-char in the course ID.") . ' ';
             }
             if (empty($values["tutors"])) {
                 $values["tutors"] = "NN";
             }
             if (empty($problems)) {
                 if (!isset($values["hislsf"]) || !$values["hislsf"]) {
                     $values["lsf_id"] = "";
                 }
                 $max_members = -1;
                 if ($values["lsf_id"] === "") {
                     if (!empty($values["maxsize"]) && trim($values["maxsize"]) != "" && preg_match('/[^-.0-9]/', trim($values["maxsize"]))) {
                         $problems .= gettext("Invalid max number of participants.") . " ";
                         $hints .= gettext("Please enter a valid number for the max number of participants.") . " " . gettext("Please note that the input of a '0' or to leave the field blank means no limitation.") . " ";
                     } else {
                         if (!empty($values["maxsize"]) && trim($values["maxsize"]) != "" && trim($values["maxsize"]) < 0) {
                             $problems .= gettext("Invalid max number of participants.") . " ";
                             $hints .= gettext("Please enter a number equal or greater than '0' for the max number of participants.") . " " . gettext("Please note that the input of a '0' or to leave the field blank means no limitation.") . " ";
                         } else {
                             if (isset($values["maxsize"])) {
                                 if (trim($values["maxsize"]) === "") {
                                     $max_members = 0;
                                 } else {
                                     $max_members = (int) trim($values["maxsize"]);
                                 }
                             }
                         }
                     }
                 }
                 if (empty($problems)) {
                     try {
                         $new_course = \steam_factory::create_group($GLOBALS["STEAM"]->get_id(), $values["id"], $current_semester, FALSE, $values["name"]);
                     } catch (Exception $e) {
                         $problems .= gettext("The course ID already exists.") . " ";
                         $hints .= gettext("The ID is necessary for unique identification, ordering and finding the course. This ID already exists.") . " ";
                     }
                     if (empty($problems)) {
                         $new_course->set_attributes(array("OBJ_TYPE" => "course", "COURSE_PARTICIPANT_MNGMNT" => $obj_type, "COURSE_SEMESTER" => $values["semester"], "COURSE_TUTORS" => $values["tutors"], "COURSE_SHORT_DSC" => $values["short_dsc"], "COURSE_LONG_DSC" => $values["long_dsc"], "COURSE_HISLSF_ID" => $values["lsf_id"]));
                         $learners = \steam_factory::create_group($GLOBALS["STEAM"]->get_id(), "learners", $new_course, FALSE, "Participants of course '" . $values["name"] . "'");
                         $learners->set_attribute("OBJ_TYPE", "course_learners");
                         $staff = \steam_factory::create_group($GLOBALS["STEAM"]->get_id(), "staff", $new_course, FALSE, "Tutors of course '" . $values["name"] . "'");
                         $staff->set_attribute("OBJ_TYPE", "course_staff");
                         $staff->add_member($user);
                         $admins = \steam_factory::create_group($GLOBALS["STEAM"]->get_id(), "admins", $new_course, FALSE, "Admins of course '" . $values["name"] . "'");
                         $admins->set_attribute("OBJ_TYPE", "course_admins");
                         // uncomment below if koala can handle admins vs tutors
                         //$admins->add_member( $user );
                         // RIGHTS MANAGEMENT =======================================
                         $course_calendar = $new_course->get_calendar();
                         $learners_workroom = $learners->get_workroom();
                         $course_workroom = $new_course->get_workroom();
                         $staff->set_sanction_all($staff);
                         $staff->sanction_meta(SANCTION_ALL, $staff);
                         $learners->set_sanction_all($staff);
                         $learners->sanction_meta(SANCTION_ALL, $staff);
                         $new_course->set_sanction_all($staff);
                         $new_course->sanction_meta(SANCTION_ALL, $staff);
                         $admins->set_sanction_all($admins);
                         $admins->sanction_meta(SANCTION_ALL, $admins);
                         $staff->set_sanction_all($admins);
                         $staff->sanction_meta(SANCTION_ALL, $admins);
                         $learners->set_sanction_all($admins);
                         $learners->sanction_meta(SANCTION_ALL, $admins);
                         $new_course->set_sanction_all($admins);
                         $new_course->sanction_meta(SANCTION_ALL, $admins);
                         $course_calendar->set_acquire(FALSE);
                         $course_calendar->set_sanction_all($staff);
                         $course_calendar->sanction_meta(SANCTION_ALL, $staff);
                         $course_calendar->set_sanction_all($admins);
                         $course_calendar->sanction_meta(SANCTION_ALL, $admins);
                         $course_calendar->set_read_access($learners, TRUE);
                         $course_calendar->set_write_access($new_course, FALSE);
                         $course_calendar->set_insert_access($new_course, FALSE);
                         $course_calendar->set_insert_access($all_users, FALSE);
                         // Course workroom
                         $course_workroom->set_sanction($new_course, SANCTION_READ | SANCTION_EXECUTE | SANCTION_ANNOTATE);
                         $course_workroom->set_sanction_all($staff);
                         $course_workroom->set_sanction_all($admins);
                         $course_workroom->sanction_meta(SANCTION_ALL, $staff);
                         $course_workroom->sanction_meta(SANCTION_ALL, $admins);
                         // Learners workroom
                         $learners_workroom->set_read_access($all_users, TRUE);
                         $learners_workroom->set_sanction($learners, SANCTION_READ | SANCTION_EXECUTE | SANCTION_ANNOTATE);
                         $learners_workroom->set_sanction_all($staff);
                         $learners_workroom->set_sanction_all($admins);
                         $learners_workroom->sanction_meta(SANCTION_ALL, $staff);
                         $learners_workroom->sanction_meta(SANCTION_ALL, $admins);
                         $koala_course = new \koala_group_course($new_course);
                         if (!isset($values["hislsf"]) || !$values["hislsf"]) {
                             $access = $values["access"];
                             $koala_course->set_access($access, $learners, $staff, $admins, KOALA_GROUP_ACCESS);
                             if (isset($values["password"]) && $access == PERMISSION_COURSE_PASSWORD) {
                                 $koala_course->get_group_learners()->set_password($values["password"]);
                             } else {
                                 $koala_course->get_group_learners()->set_password("");
                             }
                         } else {
                             $koala_course->set_access(PERMISSION_COURSE_HISLSF, $learners, $staff, $admins, KOALA_GROUP_ACCESS);
                         }
                         if ($max_members > -1) {
                             $learners->set_attribute(GROUP_MAXSIZE, $max_members);
                         }
                         // RIGHTS MANAGEMENT =======================================
                         // extensions:
                         if (isset($_POST["extensions_available"]) && !empty($_POST["extensions_available"])) {
                             $extensions_available = explode("/", $_POST["extensions_available"]);
                             if (isset($_POST["extensions_enabled"])) {
                                 $extensions_enabled = $_POST["extensions_enabled"];
                             } else {
                                 $extensions_enabled = array();
                             }
                             if (isset($_POST["extensions_enabled_add"])) {
                                 $extensions_enabled = array_merge($extensions_enabled, explode("/", $_POST["extensions_enabled_add"]));
                             }
                             if (is_array($extensions_available)) {
                                 foreach ($extensions_available as $extension_name) {
                                     $extension = \lms_steam::get_extensionmanager()->get_extension($extension_name);
                                     if (!is_object($extension)) {
                                         continue;
                                     }
                                     if (array_search($extension_name, $extensions_enabled) === FALSE) {
                                         $extension->disable_for($koala_course);
                                     } else {
                                         $extension->enable_for($koala_course);
                                     }
                                 }
                             }
                         }
                         $cache = get_cache_function("ORGANIZATION");
                         $cache->drop("lms_steam::semester_get_courses", $current_semester->get_id());
                         header("Location: " . PATH_URL . "semester/index" . "/" . $current_semester->get_name() . "/" . $new_course->get_name() . "/");
                         exit;
                     }
                 }
             }
         }
         if (!empty($problems)) {
             $frameResponseObject->setConfirmText($problems, $hints);
             //$portal->set_problem_description( $problems, $hints );
         }
     }
     if (!empty($_GET["lsf_course_id"])) {
         $lsf_client = new hislsf_soap();
         $course_infos = $lsf_client->get_course_information(SYNC_HISLSF_SEMESTER, $_GET["lsf_course_id"]);
         if (empty($course_infos) && empty($problems)) {
             $frameResponseObject->setConfirmText(gettext("Error getting course data from HIS/LSF."));
             //$portal->set_problem_description(gettext("Error getting course data from HIS/LSF.") );
         } else {
             if (empty($course_infos["course_dsc"])) {
                 $course_infos["course_dsc"] = "keine Beschreibung vorhanden.";
             } else {
                 $course_infos["course_dsc"] = unhtmlentities($course_infos["course_dsc"]);
             }
             $values = array("lsf_id" => $course_infos["course_lsf_id"], "id" => $course_infos["course_id"], "name" => $course_infos["course_name"], "tutors" => $course_infos["course_tutors"], "short_dsc" => $course_infos["course_type"], "long_dsc" => $course_infos["course_dsc"]);
         }
         $_SESSION["LSF_COURSE_INFO"] = "";
     }
     $content = \Course::getInstance()->loadTemplate("courses_create.template.html");
     //$content = new HTML_TEMPLATE_IT();
     //$content->loadTemplateFile( PATH_TEMPLATES . "courses_create.template.html" );
     $content->setVariable("FORM_ACTION", PATH_URL . "course/create" . "/" . $current_semester->get_name() . "/");
     $content->setVariable("VALUE_SEMESTER", h($current_semester->get_name()));
     //$content->setVariable( "INFO_TEXT", gettext( "Creating a course means..." ) );
     $content->setVariable("CONFIRMATION_TEXT", str_replace("%SEMESTER", h($current_semester->get_attribute("OBJ_DESC")), gettext("You are going to create a new course in <b>%SEMESTER</b>.")) . " " . gettext("Please fill out the requested meta data at first.") . " " . gettext("At the bottom, you can determine the manner of participant management.") . " " . gettext("Also you can add further course admins later on."));
     $content->setVariable("LABEL_GENERAL_INFORMATION", gettext("General Information"));
     $content->setVariable("LABEL_COURSE_ID", gettext("Course ID"));
     $content->setVariable("VALUE_COURSE_ID", isset($values) ? h($values["id"]) : '');
     $content->setVariable("LABEL_COURSE_NAME", gettext("Name"));
     $content->setVariable("VALUE_COURSE_NAME", isset($values) ? h($values["name"]) : '');
     $content->setVariable("LABEL_COURSE_SHORT_INFORMATION", gettext("Short Info"));
     $content->setVariable("VALUE_SHORT_DSC", isset($values) ? h($values["short_dsc"]) : '');
     $content->setVariable("SHORT_DSC_SHOW_UP", gettext("This value will show up in the semester's courses list beside id, name and staff members."));
     $content->setVariable("LABEL_COURSE_TUTORS", gettext("Staff members"));
     $content->setVariable("VALUE_TUTORS", isset($values) ? h($values["tutors"]) : '');
     $content->setVariable("LABEL_LONG_DSC", gettext("Long description"));
     $content->setVariable("LONG_DSC_SHOW_UP", gettext("This is for your course page. Please add information about schedule and locations at least."));
     $content->setVariable("VALUE_LONG_DSC", isset($values) ? h($values["long_dsc"]) : '');
     $content->setVariable("LABEL_BB_BOLD", gettext("B"));
     $content->setVariable("HINT_BB_BOLD", gettext("boldface"));
     $content->setVariable("LABEL_BB_ITALIC", gettext("I"));
     $content->setVariable("HINT_BB_ITALIC", gettext("italic"));
     $content->setVariable("LABEL_BB_UNDERLINE", gettext("U"));
     $content->setVariable("HINT_BB_UNDERLINE", gettext("underline"));
     $content->setVariable("LABEL_BB_STRIKETHROUGH", gettext("S"));
     $content->setVariable("HINT_BB_STRIKETHROUGH", gettext("strikethrough"));
     $content->setVariable("LABEL_BB_IMAGE", gettext("IMG"));
     $content->setVariable("HINT_BB_IMAGE", gettext("image"));
     $content->setVariable("LABEL_BB_URL", gettext("URL"));
     $content->setVariable("HINT_BB_URL", gettext("web link"));
     $content->setVariable("LABEL_BB_MAIL", gettext("MAIL"));
     $content->setVariable("HINT_BB_MAIL", gettext("email link"));
     $content->setVariable("PARTICIPANT_MANAGEMENT", gettext("Participant Management"));
     if (isset($values) && $values["lsf_id"] > 1) {
         $content->setCurrentBlock("HIS_LSF_PM");
         $content->setVariable("LSF_COURSE_ID", isset($values) ? h($values["lsf_id"]) : '');
         $content->setVariable("LSF_COURSE", isset($values) ? h($values["id"]) : '' . " " . isset($values) ? h($values["name"]) : '' . " (" . isset($values) ? h($values["short_dsc"]) : '' . ")");
         if ($values["hislsf"]) {
             $content->setVariable("HISLSF_CHECKED", "CHECKED");
         }
         $content->setVariable("LABEL_HISLSF", "Ja, es soll die Teilnehmerverwaltung des HIS LSF verwendet werden.");
         $content->setVariable("HISLSF_INFO", "Wenn gesetzt, k&ouml;nnen sich Studenten f&uuml;r diesen Kurs nur &uuml;ber das HIS LSF anmelden.");
         $content->parse("HIS_LSF_PM");
     }
     if (!isset($values) || !isset($values["hislsf"])) {
         $content->setCurrentBlock("BLOCK_MAXSIZE");
         $content->setVariable("LABEL_MAXSIZE", gettext("Max number of participants"));
         $content->setVariable("LABEL_MAXSIZE_DSC", gettext("To limit the max number of participants for your course enter a number greater than 0. Leave this field blank or enter a '0' for no limitation."));
         if (isset($values["maxsize"])) {
             $content->setVariable("VALUE_MAXSIZE", h($values["maxsize"]));
         }
         $content->parse("BLOCK_MAXSIZE");
         $content->setCurrentBlock("BLOCK_ACCESS");
         $content->setVariable("PARTICIPANT_MANAGEMENT", gettext("Participant Management"));
     }
     $access = \koala_group_course::get_access_descriptions();
     $access_default = PERMISSION_COURSE_PUBLIC;
     if (is_array($access) && (!isset($values) || !isset($values["hislsf"]))) {
         $content->setCurrentBlock("BLOCK_ACCESS");
         foreach ($access as $key => $array) {
             if ($key != PERMISSION_COURSE_PAUL_SYNC && $key != PERMISSION_UNDEFINED || isset($values) && (int) $values["access"] == PERMISSION_UNDEFINED) {
                 $content->setCurrentBlock("ACCESS");
                 $content->setVariable("LABEL", $array["summary_short"] . ": " . $array["label"]);
                 $content->setVariable("VALUE", $key);
                 if (isset($values) && $key == (int) $values["access"] || empty($values) && $key == $access_default) {
                     $content->setVariable("CHECK", "checked=\"checked\"");
                 }
                 if ($key == PERMISSION_COURSE_PASSWORD) {
                     $content->setVariable("ONCHANGE", "onchange=\"document.getElementById('passworddiv').style.display='block'\"");
                     $content->setCurrentBlock("ACCESS_PASSWORD");
                     $content->setVariable("LABEL_PASSWORD", gettext("Password"));
                     if (!empty($values["password"])) {
                         $content->setVariable("VALUE_PASSWORD", $values["password"]);
                     }
                     if (isset($values["access"]) && $values["access"] == PERMISSION_COURSE_PASSWORD) {
                         $content->setVariable("PASSWORDDIV_DISPLAY", "block");
                     } elseif (!isset($values["access"]) && $access_default == PERMISSION_COURSE_PASSWORD) {
                         $content->setVariable("PASSWORDDIV_DISPLAY", "block");
                     } else {
                         $content->setVariable("PASSWORDDIV_DISPLAY", "none");
                     }
                     $content->parse("ACCESS_PASSWORD");
                 } else {
                     $content->setVariable("ONCHANGE", "onchange=\"document.getElementById('passworddiv').style.display='none'\"");
                 }
                 $content->parse("ACCESS");
             }
         }
         $content->parse("BLOCK_ACCESS");
     }
     // extensions:
     //$extensions = \lms_steam::get_extensionmanager()->get_extensions_by_class( 'koala_group_course' );
     $extensions = 0;
     /*if ( count( $extensions ) > 0 ) {
     			$content->setCurrentBlock( "BLOCK_EXTENSIONS" );
     			$content->setVariable( "LABEL_EXTENSIONS", gettext( "Extensions" ) );
     			$extension_list = array();
     			foreach ( $extensions as $extension ) {
     				if( $extension->get_requirements() === array() )
     				{
     					$extension_name = $extension->get_name();
     					$content->setCurrentBlock( "BLOCK_EXTENSION" );
     					$content->setVariable( "EXTENSION_ID", $extension_name );
     					$content->setVariable( "EXTENSION_NAME", $extension->get_display_name() );
     					$content->setVariable( "EXTENSION_DESC", $extension->get_display_description() );
     					$subextensions = \lms_steam::get_extensionmanager()->get_dependent_extensions($extension);
     					if( count( $subextensions ) > 0 )
     					{
     						$content->setCurrentBlock( "BLOCK_SUBEXTENSIONS" );
     						$content->setVariable( "LABEL_SUBEXTENSIONS", str_replace( "%EXTENSION", h($extension->get_display_name()), gettext( "The following sub-extensions are available for %EXTENSION" ) ));
     						foreach($subextensions as $subextension)
     						{
     							$subextension_name = $subextension->get_name();
     							$content->setCurrentBlock( "BLOCK_SUBEXTENSION" );
     							$content->setVariable( "PARENT_EXTENSION_ID", $extension_name );
     							$content->setVariable( "SUBEXTENSION_ID", $subextension_name );
     							$content->setVariable( "SUBEXTENSION_NAME", $subextension->get_display_name() );
     							$content->setVariable( "SUBEXTENSION_DESC", $subextension->get_display_description() );
     							$content->setVariable( "SUBEXTENSION_DISABLED", "disabled=\"disabled\"" );
     							$content->parse( "BLOCK_SUBEXTENSION" );
     							$extension_list[] = $subextension_name;
     						}
     						$content->parse( "BLOCK_SUBEXTENSIONS" );
     					}
     					$content->parse( "BLOCK_EXTENSION" );
     					$extension_list[] = $extension_name;
     				}
     			}
     			$content->setVariable( "VALUE_EXTENSIONS", implode( "/", $extension_list ) );
     			$content->parse( "BLOCK_EXTENSIONS" );
     		}*/
     $content->setVariable("LABEL_CREATE_COURSE", gettext("Create and finish"));
     $content->setVariable("LABEL_CREATE_ADD_ADMIN", gettext("Create and add further admins"));
     //$portal->set_page_main(
     //array( array( "link" => PATH_URL . SEMESTER_URL . "/" . $current_semester->get_name(). "/", "name" => h($current_semester->get_attribute( "OBJ_DESC" )) ), array( "link" => "", "name" => gettext( "Create new course" ) ) ),
     //$content->get()
     //);
     $frameResponseObject->setHeadline(array(array("link" => PATH_URL . "semester/index" . "/" . $current_semester->get_name() . "/", "name" => h($current_semester->get_attribute("OBJ_DESC"))), array("link" => "", "name" => gettext("Create new course"))));
     $widget = new \Widgets\RawHtml();
     $widget->setHtml($content->get());
     $frameResponseObject->addWidget($widget);
     return $frameResponseObject;
 }
Example #30
0
                // uncache menu so that course/group appears:
                $cache = get_cache_function($candidate->get_name());
                $cache->drop("lms_steam::user_get_profile", $candidate->get_name());
                $cache->drop("lms_portal::get_menu_html", $candidate->get_name(), TRUE);
            }
        } else {
            $group->add_member($candidate);
            $group->remove_membership_request($candidate);
            $subject = str_replace("%GROUP", $group->get_name(), gettext("Welcome to '%GROUP'"));
            $message = gettext("Your membership was affirmed.");
            $portal->set_confirmation(str_replace("%NAME", $candidate->get_attribute("USER_FIRSTNAME") . " " . $candidate->get_attribute("USER_FULLNAME"), gettext("Membership of %NAME affirmed.")));
            // uncache group members page:
            $cache = get_cache_function($group->get_id(), CACHE_LIFETIME_STATIC);
            $cache->drop("lms_steam::group_get_members", $group->get_id());
            // uncache menu so that course/group appears:
            $cache = get_cache_function($candidate->get_name());
            $cache->drop("lms_steam::user_get_profile", $candidate->get_name());
            $cache->drop("lms_portal::get_menu_html", $candidate->get_name(), TRUE);
        }
    } elseif (isset($_POST['cancel']) && is_array($_POST['cancel'])) {
        $candidate = steam_factory::get_object($GLOBALS["STEAM"]->get_id(), key($_POST["cancel"]));
        $group->remove_membership_request($candidate);
        $subject = str_replace("%GROUP", $group->get_name(), gettext("Your membership for '%GROUP' was rejected"));
        $message = gettext("Your membership was rejected.");
        $portal->set_confirmation(str_replace("%NAME", $candidate->get_attribute("USER_FIRSTNAME") . " " . $candidate->get_attribute("USER_FULLNAME"), gettext("Membership of %NAME rejected.")));
    }
    //$candidate->mail( $subject, $message, $user->get_attribute( "USER_EMAIL" ));
    lms_steam::mail($candidate, $user, $subject, $message);
}
$result = $group->get_membership_requests();
$html_people = new HTML_TEMPLATE_IT();