Пример #1
0
            break;
    }
}
$current_user = lms_steam::get_current_user();
$cache = get_cache_function($login, 3600);
$portal->set_page_title($login);
$user_profile = $cache->call("lms_steam::user_get_profile", $login);
$html_handler_profile = new koala_html_profile($user);
$html_handler_profile->set_context("profile");
$GENERAL_displayed = false;
$CONTACTS_AND_GROUPS_displayed = false;
$CONTACT_DATA_displayed = false;
$content = new HTML_TEMPLATE_IT();
$content->loadTemplateFile(PATH_TEMPLATES . "profile_display.template.html");
if (!empty($user_profile["USER_PROFILE_DSC"])) {
    $content->setVariable("HTML_CODE_DESCRIPTION", "<p>" . get_formatted_output($user_profile["USER_PROFILE_DSC"]) . "</p>");
}
if (!empty($user_profile["USER_PROFILE_WEBSITE_URI"])) {
    $website_name = h(empty($user_profile["USER_PROFILE_WEBSITE_NAME"]) ? $user_profile["USER_PROFILE_WEBSITE_URI"] : $user_profile["USER_PROFILE_WEBSITE_NAME"]);
    $content->setVariable("HTML_CODE_PERSONAL_WEBSITE", "<br/><b>" . gettext("Website") . ":</b> <a href=\"" . h($user_profile["USER_PROFILE_WEBSITE_URI"]) . "\" target=\"_blank\">{$website_name}</a>");
}
//get Buddys from user and put them into the $globals-Array for authorization-query
$confirmed = $user->get_id() != $current_user->get_id() ? TRUE : FALSE;
$contacts = $cache->call("lms_steam::user_get_buddies", $login, $confirmed);
$tmp = array();
foreach ($contacts as $contact) {
    $tmp[] = $contact["OBJ_ID"];
}
$GLOBALS["contact_ids"] = $tmp;
//get Viewer-Authorization and put them into the $globals-Array for authorization-query
$user_privacy = $cache->call("lms_steam::user_get_profile_privacy", $user->get_name());
Пример #2
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;
 }
Пример #3
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;
 }
Пример #4
0
 public function frameResponse(\FrameResponseObject $frameResponseObject)
 {
     $path = $this->params;
     $user = \lms_steam::get_current_user();
     $public = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), STEAM_PUBLIC_GROUP, CLASS_GROUP);
     $id = $path[0];
     try {
         $steam_group = !empty($id) ? \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $id) : FALSE;
     } catch (\Exception $ex) {
         include "bad_link.php";
         exit;
     }
     $group_is_private = FALSE;
     if ($steam_group && is_object($steam_group)) {
         switch ((string) $steam_group->get_attribute("OBJ_TYPE")) {
             case "course":
                 $group = new \koala_group_course($steam_group);
                 // TODO: Passt der backlink?
                 $backlink = PATH_URL . SEMESTER_URL . "/" . $group->get_semester()->get_name() . "/" . h($group->get_name()) . "/";
                 break;
             default:
                 $group = new \koala_group_default($steam_group);
                 // TODO: Passt der backlink?
                 $backlink = PATH_URL . "groups/" . $group->get_id() . "/";
                 // Determine if group is public or private
                 $parent = $group->get_parent_group();
                 if ($parent->get_id() == STEAM_PRIVATE_GROUP) {
                     $group_is_private = TRUE;
                 }
                 break;
         }
     }
     if ($group_is_private) {
         if (!$steam_group->is_member($user) && !\lms_steam::is_koala_admin($user)) {
             throw new \Exception(gettext("You have no rights to access this group"), E_USER_RIGHTS);
         }
     }
     if (!$group instanceof \koala_group) {
         throw new \Exception("Is not a koala_group: " . $group_id, E_PARAMETER);
     }
     switch (get_class($group)) {
         case "koala_group_course":
             $html_handler_group = new \koala_html_course($group);
             $html_handler_group->set_context("communication");
             break;
         default:
             $html_handler_group = new \koala_html_group($group);
             $html_handler_group->set_context("communication");
             break;
     }
     $content = \Group::getInstance()->loadTemplate("groups_communication.template.html");
     $workroom = $group->get_workroom();
     $read_access = $workroom->check_access_read($user);
     if (!$read_access) {
         throw new \Exception("No read access on container: id=" . $workroom->get_id(), E_USER_RIGHTS);
     }
     $cache = get_cache_function(\lms_steam::get_current_user()->get_name(), 600);
     $communication_objects = $cache->call("lms_steam::get_group_communication_objects", $workroom->get_id(), CLASS_MESSAGEBOARD | CLASS_CALENDAR | CLASS_CONTAINER | CLASS_ROOM);
     $forums = array();
     $weblogs = array();
     $wikis = array();
     foreach ($communication_objects as $object) {
         if ($object["OBJ_CLASS"] === "steam_messageboard") {
             $forums[] = $object;
         } else {
             if ($object["OBJ_CLASS"] === "steam_calendar") {
                 $weblogs[] = $object;
             } else {
                 if (($object["OBJ_CLASS"] === "steam_container" || $object["OBJ_CLASS"] === "steam_room") && ($object["OBJ_TYPE"] != null && ($object["OBJ_TYPE"] == "KOALA_WIKI" || $object["OBJ_TYPE"] == "container_wiki_koala"))) {
                     $wikis[] = $object;
                 }
             }
         }
     }
     $content->setVariable("LABEL_FORUMS", gettext("Discussion Boards"));
     if (count($forums) > 0) {
         $content->setCurrentBlock("BLOCK_FORUMS");
         $content->setVariable("LABEL_FORUM_DESCRIPTION", gettext("Forum / description"));
         $content->setVariable("LABEL_ARTICLES", gettext("Articles"));
         $content->setVariable("LABEL_ACCESS", gettext("Access"));
         $content->setVariable("LABEL_LAST_COMMENT", gettext("Last comment"));
         $access_descriptions = \lms_forum::get_access_descriptions($group);
         foreach ($forums as $forum) {
             $cache = get_cache_function($forum["OBJ_ID"], 600);
             $discussions = $cache->call("lms_forum::get_discussions", $forum["OBJ_ID"]);
             $latest_post = isset($discussions[0]) ? $discussions[0] : FALSE;
             $content->setCurrentBlock("BLOCK_FORUM");
             $content->setVariable("NAME_FORUM", h($forum["OBJ_NAME"]));
             $content->setVariable("LINK_FORUM", PATH_URL . "messageboard/index/" . $forum["OBJ_ID"]);
             $content->setVariable("OBJ_DESC", get_formatted_output($forum["OBJ_DESC"]));
             $language = !empty($forum["FORUM_LANGUAGE"]) ? $forum["FORUM_LANGUAGE"] : "German";
             $content->setVariable("VALUE_LANGUAGE", $language);
             $access = "<span title=\"" . $access_descriptions[$forum["KOALA_ACCESS"]]["label"] . "\">" . $access_descriptions[$forum["KOALA_ACCESS"]]["summary_short"] . "</span>";
             $content->setVariable("VALUE_ACCESS", $access);
             $content->setVariable("VALUE_ARTICLES", count($discussions));
             if ($latest_post) {
                 $content->setVariable("SUBJECT_LAST_COMMENT", h($latest_post["LATEST_POST_TITLE"]));
                 $content->setVariable("LINK_LAST_COMMENT", PATH_URL . "forums/" . $latest_post["OBJ_ID"] . "/");
                 $content->setVariable("POSTED_BY_LABEL", "(" . h($latest_post["LATEST_POST_AUTHOR"]) . ", " . how_long_ago($latest_post["LATEST_POST_TS"]) . ")");
             } else {
                 $content->setVariable("POSTED_BY_LABEL", gettext("-"));
             }
             $content->parse("BLOCK_FORUM");
         }
         $content->parse("BLOCK_FORUMS");
     } else {
         $content->setVariable("LABEL_NO_FORUMS_FOUND", "<b>" . gettext("No forums available. Either no forums are created in this context, or you have no rights to read them.") . "</b>");
     }
     $content->setVariable("LABEL_WEBLOGS", gettext("Weblogs"));
     if (count($weblogs) > 0) {
         $content->setCurrentBlock("BLOCK_WEBLOGS");
         $content->setVariable("LABEL_WEBLOG_DESCRIPTION", gettext("Weblog / description"));
         $content->setVariable("LABEL_WEBLOG_ENTRIES", gettext("Entries"));
         $content->setVariable("LABEL_WEBLOG_ACCESS", gettext("Access"));
         $content->setVariable("LABEL_WEBLOG_LAST_ENTRY", gettext("Last entry"));
         $access_descriptions = \lms_weblog::get_access_descriptions($group);
         foreach ($weblogs as $weblog) {
             $cache = get_cache_function($weblog["OBJ_ID"], 600);
             $entries = $cache->call("lms_weblog::get_items", $weblog["OBJ_ID"]);
             $last_entry = isset($entries[0]) ? $entries[0] : FALSE;
             $content->setCurrentBlock("BLOCK_WEBLOG");
             $content->setVariable("NAME_WEBLOG", h($weblog["OBJ_NAME"]));
             $content->setVariable("LINK_WEBLOG", PATH_URL . "weblog/" . $weblog["OBJ_ID"] . "/");
             $content->setVariable("WEBLOG_OBJ_DESC", get_formatted_output($weblog["OBJ_DESC"]));
             $title = $access_descriptions[$weblog["KOALA_ACCESS"]]["label"];
             if ($weblog["KOALA_ACCESS"] == PERMISSION_PRIVATE_READONLY && !$group instanceof \koala_html_course) {
                 $obj = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $weblog["OBJ_ID"], CLASS_CALENDAR);
                 $creator = $obj->get_creator();
                 if ($creator->get_id() != \lms_steam::get_current_user()->get_id()) {
                     $title = str_replace("%NAME", $creator->get_name(), $title);
                 } else {
                     $title = str_replace("%NAME", "you", $title);
                 }
             }
             $content->setVariable("VALUE_WEBLOG_LANGUAGE", "German");
             $access = "<span title=\"" . $title . "\">" . $access_descriptions[$weblog["KOALA_ACCESS"]]["summary_short"] . "</span>";
             $content->setVariable("VALUE_WEBLOG_ACCESS", $access);
             $content->setVariable("VALUE_WEBLOG_ARTICLES", count($entries));
             $content->setVariable("LINK_WEBLOG_LAST_ENTRY", PATH_URL . "weblog/" . $last_entry["OBJ_ID"] . "/");
             if ($last_entry) {
                 $content->setVariable("SUBJECT_WEBLOG_LAST_ENTRY", h($last_entry["DATE_TITLE"]));
                 $content->setVariable("WEBLOG_POSTED_BY_LABEL", "(" . h($last_entry["AUTHOR"]) . ", " . how_long_ago($last_entry["DATE_START_DATE"]) . ")");
             } else {
                 $content->setVariable("WEBLOG_POSTED_BY_LABEL", gettext("-"));
             }
             $content->parse("BLOCK_WEBLOG");
         }
         $content->parse("BLOCK_WEBLOGS");
     } else {
         $content->setVariable("LABEL_NO_WEBLOGS_FOUND", "<b>" . gettext("No weblogs available. Either no weblogs are created in this context, or you have no rights to read them.") . "</b>");
     }
     $content->setVariable("LABEL_WIKIS", gettext("Wikis"));
     if (count($wikis) > 0) {
         $content->setCurrentBlock("BLOCK_WIKIS");
         $content->setVariable("LABEL_WIKI_DESCRIPTION", gettext("Wiki / description"));
         $content->setVariable("LABEL_WIKI_ENTRIES", gettext("Entries"));
         $content->setVariable("LABEL_WIKI_ACCESS", gettext("Access"));
         $content->setVariable("LABEL_WIKI_LAST_ENTRY", gettext("Last entry"));
         $access_descriptions = \lms_wiki::get_access_descriptions($group);
         foreach ($wikis as $wiki) {
             $cache = get_cache_function($wiki["OBJ_ID"], 600);
             $entries = $cache->call("lms_wiki::get_items", $wiki["OBJ_ID"]);
             $last_entry = isset($entries[0]) ? $entries[0] : FALSE;
             $content->setCurrentBlock("BLOCK_WIKI");
             $content->setVariable("NAME_WIKI", h($wiki["OBJ_NAME"]));
             $content->setVariable("LINK_WIKI", PATH_URL . "wiki/index/" . $wiki["OBJ_ID"] . "/");
             $content->setVariable("WIKI_OBJ_DESC", get_formatted_output($wiki["OBJ_DESC"]));
             $title = $access_descriptions[$wiki["KOALA_ACCESS"]]["label"];
             if ($wiki["KOALA_ACCESS"] == PERMISSION_PRIVATE_READONLY && !$group instanceof \koala_html_course) {
                 $obj = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $wiki["OBJ_ID"], CLASS_CONTAINER);
                 $creator = $obj->get_creator();
                 if ($creator->get_id() != \lms_steam::get_current_user()->get_id()) {
                     $title = str_replace("%NAME", $creator->get_name(), $title);
                 } else {
                     $title = str_replace("%NAME", "you", $title);
                 }
             }
             $access = "<span title=\"" . $title . "\">" . $access_descriptions[$wiki["KOALA_ACCESS"]]["summary_short"] . "</span>";
             $content->setVariable("VALUE_WIKI_ACCESS", $access);
             $content->setVariable("VALUE_WIKI_ARTICLES", count($entries));
             $content->setVariable("LINK_WIKI_LAST_ENTRY", PATH_URL . "wiki/" . $last_entry["OBJ_ID"] . "/");
             $content->setVariable("SUBJECT_WIKI_LAST_ENTRY", str_replace(".wiki", "", h($last_entry["OBJ_NAME"])));
             $content->setVariable("WIKI_POSTED_BY_LABEL", $last_entry["DOC_LAST_MODIFIED"] != null ? "(" . h($last_entry["DOC_USER_MODIFIED"]) . ", " . how_long_ago($last_entry["DOC_LAST_MODIFIED"]) . ")" : "-");
             $content->parse("BLOCK_WIKI");
         }
         $content->parse("BLOCK_WIKIS");
     } else {
         $content->setVariable("LABEL_NO_WIKIS_FOUND", "<b>" . gettext("No wikis available. Either no wikis are created in this context, or you have no rights to read them.") . "</b>");
     }
     $html_handler_group->set_html_left($content->get());
     $frameResponseObject->setTitle("Group");
     $rawHtml = new \Widgets\RawHtml();
     $rawHtml->setHtml($html_handler_group->get_html());
     $frameResponseObject->addWidget($rawHtml);
     return $frameResponseObject;
 }
Пример #5
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;
    }
Пример #6
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();
     $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);
     if (!$group instanceof \koala_group) {
         throw new \Exception("Is not a koala_group: " . $group_id, E_PARAMETER);
     }
     switch (get_class($group)) {
         case "koala_group_course":
             $html_handler_group = new \koala_html_course($group);
             $html_handler_group->set_context("communication");
             break;
         default:
             $html_handler_group = new \koala_html_group($group);
             $html_handler_group->set_context("communication");
             break;
     }
     $content = \Course::getInstance()->loadTemplate("groups_communication.template.html");
     //$content = new HTML_TEMPLATE_IT();
     //$content->loadTemplateFile( PATH_TEMPLATES . "groups_communication.template.html" );
     $workroom = $group->get_workroom();
     $read_access = $workroom->check_access_read($user);
     if (!$read_access) {
         throw new Exception("No read access on container: id=" . $workroom->get_id(), E_USER_RIGHTS);
     }
     $cache = get_cache_function(\lms_steam::get_current_user()->get_name(), 600);
     $communication_objects = $cache->call("lms_steam::get_group_communication_objects", $workroom->get_id(), CLASS_MESSAGEBOARD | CLASS_CALENDAR | CLASS_CONTAINER | CLASS_ROOM);
     $forums = array();
     $weblogs = array();
     $wikis = array();
     foreach ($communication_objects as $object) {
         if ($object["OBJ_CLASS"] === "steam_messageboard") {
             $forums[] = $object;
         } else {
             if ($object["OBJ_CLASS"] === "steam_calendar") {
                 $weblogs[] = $object;
             } else {
                 if (($object["OBJ_CLASS"] === "steam_container" || $object["OBJ_CLASS"] === "steam_room") && ($object["OBJ_TYPE"] != null && ($object["OBJ_TYPE"] == "KOALA_WIKI" || $object["OBJ_TYPE"] == "container_wiki_koala"))) {
                     $wikis[] = $object;
                 }
             }
         }
     }
     $content->setVariable("LABEL_FORUMS", gettext("Discussion Boards"));
     if (count($forums) > 0) {
         $content->setCurrentBlock("BLOCK_FORUMS");
         $content->setVariable("LABEL_FORUM_DESCRIPTION", gettext("Forum / description"));
         $content->setVariable("LABEL_ARTICLES", gettext("Articles"));
         $content->setVariable("LABEL_ACCESS", gettext("Access"));
         $content->setVariable("LABEL_LAST_COMMENT", gettext("Last comment"));
         $access_descriptions = \lms_forum::get_access_descriptions($group);
         foreach ($forums as $forum) {
             $cache = get_cache_function($forum["OBJ_ID"], 600);
             $discussions = $cache->call("lms_forum::get_discussions", $forum["OBJ_ID"]);
             $latest_post = isset($discussions[0]) ? $discussions[0] : FALSE;
             $content->setCurrentBlock("BLOCK_FORUM");
             $content->setVariable("NAME_FORUM", h($forum["OBJ_NAME"]));
             $content->setVariable("LINK_FORUM", PATH_URL . "forums/" . $forum["OBJ_ID"] . "/");
             $content->setVariable("OBJ_DESC", get_formatted_output($forum["OBJ_DESC"]));
             $language = !empty($forum["FORUM_LANGUAGE"]) ? $forum["FORUM_LANGUAGE"] : "German";
             $content->setVariable("VALUE_LANGUAGE", $language);
             $access = "<span title=\"" . $access_descriptions[$forum["KOALA_ACCESS"]]["label"] . "\">" . $access_descriptions[$forum["KOALA_ACCESS"]]["summary_short"] . "</span>";
             $content->setVariable("VALUE_ACCESS", $access);
             $content->setVariable("VALUE_ARTICLES", count($discussions));
             if ($latest_post) {
                 $content->setVariable("SUBJECT_LAST_COMMENT", h($latest_post["LATEST_POST_TITLE"]));
                 $content->setVariable("LINK_LAST_COMMENT", PATH_URL . "forums/" . $latest_post["OBJ_ID"] . "/");
                 $content->setVariable("POSTED_BY_LABEL", "(" . h($latest_post["LATEST_POST_AUTHOR"]) . ", " . how_long_ago($latest_post["LATEST_POST_TS"]) . ")");
             } else {
                 $content->setVariable("POSTED_BY_LABEL", gettext("-"));
             }
             $content->parse("BLOCK_FORUM");
         }
         $content->parse("BLOCK_FORUMS");
     } else {
         $content->setVariable("LABEL_NO_FORUMS_FOUND", "<b>" . gettext("No forums available. Either no forums are created in this context, or you have no rights to read them.") . "</b>");
     }
     $content->setVariable("LABEL_WEBLOGS", gettext("Weblogs"));
     if (count($weblogs) > 0) {
         $content->setCurrentBlock("BLOCK_WEBLOGS");
         $content->setVariable("LABEL_WEBLOG_DESCRIPTION", gettext("Weblog / description"));
         $content->setVariable("LABEL_WEBLOG_ENTRIES", gettext("Entries"));
         $content->setVariable("LABEL_WEBLOG_ACCESS", gettext("Access"));
         $content->setVariable("LABEL_WEBLOG_LAST_ENTRY", gettext("Last entry"));
         $access_descriptions = \lms_weblog::get_access_descriptions($group);
         foreach ($weblogs as $weblog) {
             $cache = get_cache_function($weblog["OBJ_ID"], 600);
             $entries = $cache->call("lms_weblog::get_items", $weblog["OBJ_ID"]);
             $last_entry = isset($entries[0]) ? $entries[0] : FALSE;
             $content->setCurrentBlock("BLOCK_WEBLOG");
             $content->setVariable("NAME_WEBLOG", h($weblog["OBJ_NAME"]));
             $content->setVariable("LINK_WEBLOG", PATH_URL . "weblog/" . $weblog["OBJ_ID"] . "/");
             $content->setVariable("WEBLOG_OBJ_DESC", get_formatted_output($weblog["OBJ_DESC"]));
             $title = $access_descriptions[$weblog["KOALA_ACCESS"]]["label"];
             if ($weblog["KOALA_ACCESS"] == PERMISSION_PRIVATE_READONLY && !$group instanceof koala_html_course) {
                 $obj = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $weblog["OBJ_ID"], CLASS_CALENDAR);
                 $creator = $obj->get_creator();
                 if ($creator->get_id() != \lms_steam::get_current_user()->get_id()) {
                     $title = str_replace("%NAME", $creator->get_name(), $title);
                 } else {
                     $title = str_replace("%NAME", "you", $title);
                 }
             }
             $content->setVariable("VALUE_WEBLOG_LANGUAGE", "German");
             $access = "<span title=\"" . $title . "\">" . $access_descriptions[$weblog["KOALA_ACCESS"]]["summary_short"] . "</span>";
             $content->setVariable("VALUE_WEBLOG_ACCESS", $access);
             $content->setVariable("VALUE_WEBLOG_ARTICLES", count($entries));
             $content->setVariable("LINK_WEBLOG_LAST_ENTRY", PATH_URL . "weblog/" . $last_entry["OBJ_ID"] . "/");
             if ($last_entry) {
                 $content->setVariable("SUBJECT_WEBLOG_LAST_ENTRY", h($last_entry["DATE_TITLE"]));
                 $content->setVariable("WEBLOG_POSTED_BY_LABEL", "(" . h($last_entry["AUTHOR"]) . ", " . how_long_ago($last_entry["DATE_START_DATE"]) . ")");
             } else {
                 $content->setVariable("WEBLOG_POSTED_BY_LABEL", gettext("-"));
             }
             $content->parse("BLOCK_WEBLOG");
         }
         $content->parse("BLOCK_WEBLOGS");
     } else {
         $content->setVariable("LABEL_NO_WEBLOGS_FOUND", "<b>" . gettext("No weblogs available. Either no weblogs are created in this context, or you have no rights to read them.") . "</b>");
     }
     $content->setVariable("LABEL_WIKIS", gettext("Wikis"));
     if (count($wikis) > 0) {
         $content->setCurrentBlock("BLOCK_WIKIS");
         $content->setVariable("LABEL_WIKI_DESCRIPTION", gettext("Wiki / description"));
         $content->setVariable("LABEL_WIKI_ENTRIES", gettext("Entries"));
         $content->setVariable("LABEL_WIKI_ACCESS", gettext("Access"));
         $content->setVariable("LABEL_WIKI_LAST_ENTRY", gettext("Last entry"));
         $access_descriptions = lms_wiki::get_access_descriptions($group);
         foreach ($wikis as $wiki) {
             $cache = get_cache_function($wiki["OBJ_ID"], 600);
             $entries = $cache->call("lms_wiki::get_items", $wiki["OBJ_ID"]);
             $last_entry = isset($entries[0]) ? $entries[0] : FALSE;
             $content->setCurrentBlock("BLOCK_WIKI");
             $content->setVariable("NAME_WIKI", h($wiki["OBJ_NAME"]));
             $content->setVariable("LINK_WIKI", PATH_URL . "wiki/" . $wiki["OBJ_ID"] . "/");
             $content->setVariable("WIKI_OBJ_DESC", get_formatted_output($wiki["OBJ_DESC"]));
             $title = $access_descriptions[$wiki["KOALA_ACCESS"]]["label"];
             if ($wiki["KOALA_ACCESS"] == PERMISSION_PRIVATE_READONLY && !$group instanceof koala_html_course) {
                 $obj = steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $wiki["OBJ_ID"], CLASS_CONTAINER);
                 $creator = $obj->get_creator();
                 if ($creator->get_id() != lms_steam::get_current_user()->get_id()) {
                     $title = str_replace("%NAME", $creator->get_name(), $title);
                 } else {
                     $title = str_replace("%NAME", "you", $title);
                 }
             }
             $access = "<span title=\"" . $title . "\">" . $access_descriptions[$wiki["KOALA_ACCESS"]]["summary_short"] . "</span>";
             $content->setVariable("VALUE_WIKI_ACCESS", $access);
             $content->setVariable("VALUE_WIKI_ARTICLES", count($entries));
             $content->setVariable("LINK_WIKI_LAST_ENTRY", PATH_URL . "wiki/" . $last_entry["OBJ_ID"] . "/");
             $content->setVariable("SUBJECT_WIKI_LAST_ENTRY", str_replace(".wiki", "", h($last_entry["OBJ_NAME"])));
             $content->setVariable("WIKI_POSTED_BY_LABEL", $last_entry["DOC_LAST_MODIFIED"] != null ? "(" . h($last_entry["DOC_USER_MODIFIED"]) . ", " . how_long_ago($last_entry["DOC_LAST_MODIFIED"]) . ")" : "-");
             $content->parse("BLOCK_WIKI");
         }
         $content->parse("BLOCK_WIKIS");
     } else {
         $content->setVariable("LABEL_NO_WIKIS_FOUND", "<b>" . gettext("No wikis available. Either no wikis are created in this context, or you have no rights to read them.") . "</b>");
     }
     $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;
 }
Пример #7
0
 public function execute(\FrameResponseObject $frameResponseObject)
 {
     //var_dump($GLOBALS[ "STEAM" ]->get_id());
     //		$portal = \lms_portal::get_instance();
     //		$portal->initialize( GUEST_NOT_ALLOWED );
     $user = \lms_steam::get_current_user();
     //		$path = $request->getPath();
     $STEAM = $GLOBALS["STEAM"];
     $weblogId = $this->id;
     $weblog = \steam_factory::get_object($STEAM->get_id(), $weblogId);
     //if ( ! $weblog = steam_factory::get_object( $STEAM->get_id(), $_GET[ "id" ] ) )
     //{
     //	include( "bad_link.php" );
     //	exit;
     //}
     if (!$weblog instanceof \steam_calendar) {
         if ($weblog instanceof \steam_container) {
             $category = $weblog;
             $categories = $category->get_environment();
             $weblog = new \steam_weblog($GLOBALS["STEAM"]->get_id(), $categories->get_environment()->get_id());
         } elseif ($weblog instanceof \steam_date) {
             $date = $weblog;
             $weblog = new \steam_weblog($GLOBALS["STEAM"]->get_id(), $date->get_environment()->get_id());
         } else {
             include "bad_link.php";
             exit;
         }
     } else {
         $weblog = new \steam_weblog($GLOBALS["STEAM"]->get_id(), $weblogId);
         define("OBJ_ID", $weblogId);
         if (!$weblog->check_access_read($user)) {
             throw new \Exception("No rights to view this.", E_USER_RIGHTS);
         }
     }
     $content = \Weblog::getInstance()->loadTemplate("weblog_entry_edit.template.html");
     //$content = new HTML_TEMPLATE_IT();
     //$content->loadTemplateFile( PATH_TEMPLATES . "weblog_entry_edit.template.html" );
     if ($_SERVER["REQUEST_METHOD"] == "GET") {
         $content->setVariable("BACK_LINK", $_SERVER["HTTP_REFERER"]);
     }
     if ($_SERVER["REQUEST_METHOD"] == "POST" && $date->check_access_write($user)) {
         $values = $_POST["values"];
         if (!empty($values["save"])) {
             $problem = "";
             $hint = "";
             if (empty($values["title"])) {
                 $problem .= gettext("The title is missing.") . "&nbsp;";
                 $hint .= gettext("Please add the missing values.");
             }
             if (empty($values["body"])) {
                 $problem .= gettext("There is no message for your readers.") . "&nbsp;";
                 $hint .= gettext("Please write your post into the text area.");
             }
             if (!empty($values["category"]) && $values["category"] != 0) {
                 $category = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $values["category"]);
                 if (!$category instanceof \steam_container) {
                     throw new \Exception("Not a valid category: " . $values["category"]);
                 }
             } else {
                 $category = "";
             }
             if (!($timestamp = strtotime($values["date"] . ":00"))) {
                 $problem .= gettext("I cannot parse the date and time.");
                 $hint .= gettext("Please verify your date and time format") . ": YYYY-MM-DD HH:MM";
             }
             if (empty($problem)) {
                 require_once "Cache/Lite.php";
                 $cache = new \Cache_Lite(array("cacheDir" => PATH_CACHE));
                 $cache->clean($weblog->get_id());
                 $cache->clean($date->get_id());
                 $attributes = array("DATE_START_DATE" => $timestamp, "DATE_TITLE" => $values["title"], "DATE_DESCRIPTION" => $values["body"]);
                 $date->set_attributes($attributes);
                 $weblog->categorize_entry($date, $category);
                 header("Location: " . $values["return_to"]);
                 exit;
             } else {
                 //TODO: PROBLEMDESCRIPTION
                 //$portal->set_problem_description( $problem, $hint );
             }
         }
         if ($values["preview"]) {
             $content->setCurrentBlock("BLOCK_PREVIEW");
             $content->setVariable("LABEL_PREVIEW_EDIT", gettext("Preview the edit"));
             $content->setVariable("PREVIEW_EDIT", get_formatted_output($values["body"]));
             $content->parse("BLOCK_PREVIEW");
         }
     }
     $content->setVariable("LABEL_HERE_IT_IS", "");
     $content->setVariable("LABEL_DATE", gettext("Date"));
     $content->setVariable("LABEL_SUBJECT", gettext("Subject"));
     $content->setVariable("LABEL_CATEGORY", gettext("Category"));
     $content->setVariable("CAT_NO_SELECTION", gettext("nothing selected"));
     $content->setVariable("LABEL_YOUR_POST", gettext("Your post"));
     $content->setVariable("LABEL_PREVIEW", gettext("Preview"));
     $content->setVariable("LABEL_SAVE_CHANGES", gettext("Save changes"));
     $content->setVariable("LABEL_RETURN", gettext("back"));
     $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"));
     if (isset($values) && count($values)) {
         // FORMULAR WURDE SCHON EINMAL ABGESCHICKT
         $date_value = empty($values["date"]) ? strftime("%Y-%m-%d %H:%M") : $values["date"];
         $content->setVariable("DATE_COMMENT", h($date_value));
         $content->setVariable("TEXT_COMMENT", h($values["body"]));
         $content->setVariable("TITLE_COMMENT", h($values["title"]));
         $cat = $values["category"];
         $content->setVariable("BACK_LINK", $values["return_to"]);
     } else {
         $attribs = $date->get_attributes(array("DATE_START_DATE", "DATE_TITLE", "DATE_DESCRIPTION", "DATE_CATEGORY"));
         $content->setVariable("DATE_COMMENT", strftime("%Y-%m-%d %H:%M", $attribs["DATE_START_DATE"]));
         $content->setVariable("TITLE_COMMENT", h($attribs["DATE_TITLE"]));
         $content->setVariable("TEXT_COMMENT", h($attribs["DATE_DESCRIPTION"]));
         $content->setVariable("TITLE_COMMENT", h($attribs["DATE_TITLE"]));
         $cat = is_object($attribs["DATE_CATEGORY"]) ? $attribs["DATE_CATEGORY"]->get_id() : 0;
     }
     $categories = $weblog->get_categories();
     foreach ($categories as $category) {
         $content->setCurrentBlock("BLOCK_SELECT_CAT");
         $content->setVariable("VALUE_CAT", $category->get_id());
         $content->setVariable("LABEL_CAT", h($category->get_name()));
         if ($category->get_id() == $cat) {
             $content->setVariable("CAT_SELECTED", 'selected="selected"');
         }
         $content->parse("BLOCK_SELECT_CAT");
     }
     $rootlink = \lms_steam::get_link_to_root($weblog);
     $headline = array($rootlink[0], $rootlink[1], array("link" => $rootlink[1]["link"] . "communication/", "name" => gettext("Communication")), array("link" => "", "name" => h($weblog->get_name()), "link" => PATH_URL . "weblog/" . $weblog->get_id() . "/"), array("name" => str_replace("%NAME", h($date->get_attribute("DATE_TITLE")), gettext("Edit '%NAME'?"))));
     /*$portal->set_page_main(
     		$headline,
     		$content->get(),
     		""
     		);
     		return $portal->get_html();*/
     $frameResponseObject->setHeadline($headline);
     $widget = new \Widgets\RawHtml();
     $widget->setHtml($content->get());
     $frameResponseObject->addWidget($widget);
     return $frameResponseObject;
 }
Пример #8
0
 public function execute(\FrameResponseObject $frameResponseObject)
 {
     //$portal = \lms_portal::get_instance();
     //$portal->initialize( GUEST_NOT_ALLOWED );
     $user = \lms_steam::get_current_user();
     //$path = $request->getPath();
     $STEAM = $GLOBALS["STEAM"];
     $weblogId = $this->id;
     $weblog = \steam_factory::get_object($STEAM->get_id(), $weblogId);
     //if ( ! $weblog = steam_factory::get_object( $STEAM->get_id(), $_GET[ "id" ] ) )
     //{
     //	include( "bad_link.php" );
     //	exit;
     //}
     if (!$weblog instanceof \steam_calendar) {
         if ($weblog instanceof \steam_container) {
             $category = $weblog;
             $categories = $category->get_environment();
             $weblog = new \steam_weblog($GLOBALS["STEAM"]->get_id(), $categories->get_environment()->get_id());
         } elseif ($weblog instanceof \steam_date) {
             $date = $weblog;
             $weblog = new \steam_weblog($GLOBALS["STEAM"]->get_id(), $date->get_environment()->get_id());
         } else {
             include "bad_link.php";
             exit;
         }
     } else {
         $weblog = new \steam_weblog($GLOBALS["STEAM"]->get_id(), $weblogId);
         define("OBJ_ID", $weblogId);
         if (!$weblog->check_access_read($user)) {
             throw new \Exception("No rights to view this.", E_USER_RIGHTS);
         }
     }
     if (!isset($date)) {
         throw new \Exception("variable date is not set.");
     }
     //$date = $weblog;
     if ($_SERVER["REQUEST_METHOD"] == "POST" && $date->check_access_write($user)) {
         $values = $_POST["values"];
         if ($values["delete"]) {
             require_once "Cache/Lite.php";
             $cache = new \Cache_Lite(array("cacheDir" => PATH_CACHE));
             $cache->clean($weblog->get_id());
             $cache->clean($date->get_id());
             $trashbin = $GLOBALS["STEAM"]->get_current_steam_user();
             if (is_object($trashbin)) {
                 $date->move($trashbin);
             } else {
                 $date->delete();
             }
         }
         header("Location: " . $values["return_to"]);
         exit;
     }
     $content = \Weblog::getInstance()->loadTemplate("weblog_entry_delete.template.html");
     //$content = new HTML_TEMPLATE_IT();
     //$content->loadTemplateFile( PATH_TEMPLATES . "weblog_entry_delete.template.html" );
     $content->setVariable("LABEL_ARE_YOU_SURE", gettext("Are you sure you want to delete this entry?"));
     $content->setVariable("TEXT_COMMENT", get_formatted_output($date->get_attribute("DATE_DESCRIPTION")));
     $creator = $date->get_creator();
     $creator_data = $creator->get_attributes(array("USER_FULLNAME", "USER_FIRSTNAME", "OBJ_ICON"));
     $content->setVariable("LABEL_FROM_AND_AGO", str_replace("%N", "<a href=\"" . PATH_URL . "/user/index/" . $creator->get_name() . "/\">" . h($creator_data["USER_FIRSTNAME"]) . " " . h($creator_data["USER_FULLNAME"]) . "</a>", gettext("by %N")) . "," . how_long_ago($date->get_attribute("OBJ_CREATION_TIME")));
     $content->setVariable("LABEL_DELETE_IT", gettext("yes, delete it"));
     $content->setVariable("BACK_LINK", $_SERVER["HTTP_REFERER"]);
     $content->setVariable("LABEL_RETURN", gettext("back"));
     $content->setVariable("ICON_SRC", PATH_URL . "get_document.php?id=" . $creator_data["OBJ_ICON"]->get_id());
     $rootlink = \lms_steam::get_link_to_root($weblog);
     $headline = array($rootlink[0], $rootlink[1], array("link" => $rootlink[1]["link"] . "communication/", "name" => gettext("Communication")), array("link" => "", "name" => h($weblog->get_name()), "link" => PATH_URL . "weblog/index/" . $weblog->get_id() . "/"), array("name" => str_replace("%NAME", h($date->get_attribute("DATE_TITLE")), gettext("Delete '%NAME'?"))));
     /*$portal->set_page_main(
     	 $headline,
     	 $content->get(),
     	 ""
     	 );
     	 return $portal->get_html();*/
     $frameResponseObject->setHeadline($headline);
     $widget = new \Widgets\RawHtml();
     $widget->setHtml($content->get());
     $frameResponseObject->addWidget($widget);
     return $frameResponseObject;
 }
Пример #9
0
$content->loadTemplateFile("event_details.template.html");
$content->setVariable("LABEL_TITLE", gettext("Title"));
$content->setVariable("LABEL_LOCATION", gettext("Location"));
$content->setVariable("LABEL_BEGIN", gettext("Begin"));
$content->setVariable("LABEL_END", gettext("End"));
$content->setVariable("LABEL_DATE_FORMAT", gettext("YYYY-MM-DD"));
$content->setVariable("LONG_DSC_LABEL", gettext("Description"));
$content->setVariable("LABEL_URL", gettext("Website"));
if (isset($group) && is_object($group) && $group instanceof koala_group_default) {
    $content->setVariable("LABEL_GOTO_CALENDAR", " <a href=\"" . $backlink["link"] . "calendar/\">" . gettext("back to your calendar") . "</a>");
} else {
    $content->setVariable("LABEL_GOTO_CALENDAR", " <a href=\"" . $backlink["link"] . "\">" . gettext("back to your calendar") . "</a>");
}
setting_variable("content", "VALUE_TITLE", h($values["DATE_TITLE"]));
setting_variable("content", "VALUE_LOCATION", h($values["DATE_LOCATION"]));
setting_variable("content", "VALUE_BEGIN", strftime("%A, %d.%m.%Y ", $values["DATE_START_DATE"]));
setting_variable("content", "VALUE_END", strftime("%A, %d.%m.%Y ", $values["DATE_END_DATE"]));
$values["begin_time"] = strftime("%H:%M", $values["DATE_START_DATE"]);
$values["end_time"] = strftime("%H:%M", $values["DATE_END_DATE"]);
setting_variable("content", "VALUE_BEGIN_TIME", $values["begin_time"]);
setting_variable("content", "VALUE_END_TIME", $values["end_time"]);
setting_variable("content", "VALUE_DESC", get_formatted_output($values["DATE_DESCRIPTION"], ENT_QUOTES, "UTF-8"));
//setting_variable( "content", "VALUE_URL", h($values[ "DATE_URL" ]) );
if (!empty($values["DATE_URL"])) {
    $content->setVariable("VALUE_URL", "<a target=\"new\" href=\"" . $values["DATE_URL"] . "\">" . htmlentities($values["DATE_URL"], ENT_QUOTES, "UTF-8") . "</a>");
} else {
    $content->setVariable("VALUE_URL", "- - -");
}
$headline = array("link" => "", "name" => gettext("Event details"));
$portal->set_page_main(array($backlink, $headline), $content->get());
$portal->show_html();
Пример #10
0
<?php

$content = new HTML_TEMPLATE_IT();
$content->loadTemplateFile(PATH_TEMPLATES . "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);
Пример #11
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");
     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_discussion.template.html");
     $content->setVariable("REPLY_LABEL", gettext("Reply to this topic?"));
     if ($_SERVER["REQUEST_METHOD"] == "POST" && $thread->check_access_annotate(\lms_steam::get_current_user())) {
         $values = $_POST["values"];
         if (empty($values["body"])) {
             $portal->set_problem_description(gettext("Please enter your message."));
         }
         if (!empty($values["save"]) && !empty($values["body"])) {
             $new_comment = \steam_factory::create_textdoc($GLOBALS["STEAM"]->get_id(), "Re: " . $thread->get_name(), $values["body"]);
             //		$all_user = steam_factory::groupname_to_object( $GLOBALS[ "STEAM" ]->get_id(), STEAM_ALL_USER );
             //		$new_comment->set_acquire( FALSE );
             //		$new_comment->set_read_access( $all_user, TRUE );
             //		$new_comment->set_write_access( $all_user, FALSE );
             //		$new_comment->set_annotate_access( $all_user, TRUE );
             $thread->add_annotation($new_comment);
             $new_comment->set_acquire($thread);
             $mbid = $messageboard->get_id();
             // Handle Related Cache-Data
             require_once "Cache/Lite.php";
             $cache = new \Cache_Lite(array("cacheDir" => PATH_CACHE));
             $cache->clean($mbid);
             // clean forumcache
             $fcache = get_cache_function($forum_id, 600);
             $fcache->drop("lms_forum::get_discussions", $forum_id);
             // clean forumcache
             $fcache = get_cache_function($mbid, 600);
             $fcache->drop("lms_forum::get_discussions", $mbid);
             // clean rsscache of the forum
             // TODO: Passt der link?
             $feedlink = PATH_URL . "services/feeds/forum_public.php?id=" . OBJ_ID;
             $rcache = get_cache_function("rss", 600);
             $rcache->drop("lms_rss::get_items", $feedlink);
         } else {
             if (empty($values["save"]) && !empty($values["body"])) {
                 // PREVIEW
                 $content->setCurrentBlock("BLOCK_PREVIEW_COMMENT");
                 $content->setVariable("LABEL_PREVIEW_COMMENT", gettext("Preview the edit"));
                 $content->setVariable("VALUE_PREVIEW_COMMENT", get_formatted_output($values["body"]));
                 $content->setVariable("TEXT_COMMENT", h($values["body"]));
                 $content->parse("BLOCK_PREVIEW_COMMENT");
                 $content->setVariable("REPLY_LABEL", gettext("Change it?"));
             }
         }
     }
     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/" . $thread->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/" . $thread->get_id() . "/");
         exit;
     }
     $content->setVariable("CURRENT_DISCUSSIONS_LABEL", gettext("Current Thread"));
     $cache = get_cache_function($messageboard->get_id(), 600);
     $discussions = $cache->call("lms_forum::get_discussions", $messageboard->get_id());
     $max_discussions = 12;
     foreach ($discussions as $discussion) {
         $max_discussions--;
         if ($max_discussions == 0) {
             $content->setCurrentBlock("BLOCK_TOPIC_INFO");
             $content->setVariable("TOPIC_LINK", PATH_URL . "forums/" . $messageboard->get_id() . "/");
             $content->setVariable("TOPIC_TITLE", gettext("More..."));
             $content->parse("BLOCK_TOPIC_INFO");
             break;
         }
         $content->setCurrentBlock("BLOCK_TOPIC_INFO");
         if (time() - $discussion["LATEST_POST_TS"] > $_SESSION["last_login"]) {
             $content->setCurrentBlock("BLOCK_TOPIC_NEW");
             $content->setVariable("NEW_LABEL", gettext("New"));
             $content->parse("BLOCK_TOPIC_NEW");
         }
         $content->setVariable("TOPIC_LINK", PATH_URL . "messageboard/viewDiscussion/" . $discussion["OBJ_ID"] . "/");
         $content->setVariable("TOPIC_TITLE", h($discussion["OBJ_NAME"]));
         $content->setVariable("TOPIC_LAST_ENTRY", gettext("Latest:") . how_long_ago($discussion["LATEST_POST_TS"]));
         $content->parse("BLOCK_TOPIC_INFO");
     }
     $content->setVariable("LABEL_TOPICS_POSTED", gettext("Topics you've posted in"));
     $content->setVariable("LINK_AUTHOR", PATH_URL . "forums/" . $messageboard->get_id() . "/?author=" . \lms_steam::get_current_user()->get_name());
     $content->setVariable("LABEL_POST_NEW", gettext("Post a new topic"));
     $content->setVariable("LINK_POST_NEW", PATH_URL . "messageboard/newDiscussion/" . $messageboard->get_id());
     $content->setCurrentBlock("BLOCK_WATCH");
     if ($is_watching) {
         $content->setVariable("LABEL_BOOKMARK", gettext("End watching"));
         $content->setVariable("LINK_BOOKMARK", PATH_URL . "forums/" . $thread->get_id() . "/?action=delete_bookmark&unsubscribe=" . $messageboard->get_id());
     } else {
         $content->setVariable("LABEL_BOOKMARK", gettext("Watch this forum"));
         $content->setVariable("LINK_BOOKMARK", PATH_URL . "forums/" . $thread->get_id() . "/?action=bookmark_rss");
     }
     $content->parse("BLOCK_WATCH");
     $content->setVariable("DISCUSSION_SUBJECT", h($thread->get_name()));
     $author = $thread->get_creator();
     $author_data = $author->get_attributes(array("OBJ_NAME", "USER_FIRSTNAME", "USER_FULLNAME", "OBJ_ICON"));
     $content->setVariable("AUTHOR_LINK", PATH_URL . "user/" . $author_data["OBJ_NAME"] . "/");
     $icon = $author_data["OBJ_ICON"];
     if ($icon instanceof \steam_object) {
         $icon_id = $icon->get_id();
     } else {
         $icon_id = 0;
     }
     $content->setVariable("AUTHOR_IMAGE", PATH_URL . "cached/get_document.php?id=" . $icon_id . "&type=usericon&width=60&height=70");
     $content->setVariable("NAME_SAYS_LABEL", str_replace("%n", "<a href=\"" . PATH_URL . "user/" . $author_data["OBJ_NAME"] . "/\">" . h($author_data["USER_FIRSTNAME"]) . " " . h($author_data["USER_FULLNAME"]) . "</a>", gettext("%n says:")));
     $content->setVariable("DISCUSSION_TEXT", get_formatted_output($thread->get_content(), 65, "\n"));
     $ts = $thread->get_attribute("OBJ_CREATION_TIME");
     $content->setVariable("DISCUSSION_STARTED_TS", gettext("Posted at") . " " . strftime("%H:%M", $ts) . " | " . strftime("%d. %B %Y", $ts));
     $content->setVariable("DISCUSSION_PERMALINK", PATH_URL . 'forums/' . $discussion['OBJ_ID'] . '/');
     $content->setVariable("DISCUSSION_PERMALINK_TEXT", gettext("permalink"));
     $steam_user = \lms_steam::get_current_user();
     if ($thread->check_access_write($steam_user)) {
         $content->setCurrentBlock("BLOCK_OWN_DISCUSSION");
         $content->setVariable("DISCUSSION_LINK_DELETE", PATH_URL . "messageboard/deleteComment/" . $messageboard->get_id() . "/" . $thread->get_id());
         $content->setVariable("DISCUSSION_LABEL_DELETE", gettext("delete"));
         $content->setVariable("DISCUSSION_LINK_EDIT", PATH_URL . "messageboard/editComment/" . $thread->get_id() . "/" . $thread->get_id());
         $content->setVariable("DISCUSSION_LABEL_EDIT", gettext("edit"));
         $content->parse("BLOCK_OWN_DISCUSSION");
     }
     $annotations = \lms_steam::get_annotations($thread->get_id());
     $annotations = array_reverse($annotations);
     $access_tnr = array();
     foreach ($annotations as $annotation) {
         $steam_obj = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $annotation["OBJ_ID"], CLASS_OBJECT);
         $access_tnr[$steam_obj->get_id()] = $steam_obj->check_access_write($steam_user, TRUE);
     }
     $access_result = $GLOBALS["STEAM"]->buffer_flush();
     foreach ($annotations as $annotation) {
         $content->setCurrentBlock("REPLY");
         $content->setVariable('REPLY_ID', $annotation['OBJ_ID']);
         $content->setVariable("REPLYER_LINK", PATH_URL . "user/" . $annotation["OBJ_CREATOR_LOGIN"] . "/");
         $content->setVariable("REPLYER_IMAGE", PATH_URL . "cached/get_document.php?id=" . $annotation["OBJ_ICON"] . "&type=usericon&width=60&height=70");
         $content->setVariable("REPLYER_SAYS_LABEL", str_replace("%n", "<a href=\"" . PATH_URL . "user/" . $annotation["OBJ_CREATOR_LOGIN"] . "/\">" . h($annotation["OBJ_CREATOR"]) . "</a>", gettext("%n says:")));
         //$content->setVariable( "REPLYERS_SAYS_LABEL", str_replace );
         $content->setVariable("REPLY_CONTENT", get_formatted_output($annotation["CONTENT"], 60, "\n"));
         $content->setVariable("REPLY_TS", how_long_ago($annotation["OBJ_CREATION_TIME"]));
         $content->setVariable("REPLY_PERMALINK", PATH_URL . 'forums/' . $thread->get_id() . '/#comment' . $annotation['OBJ_ID']);
         $content->setVariable("REPLY_PERMALINK_TEXT", gettext("permalink"));
         $steam_obj = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $annotation["OBJ_ID"], CLASS_OBJECT);
         if ($access_result[$access_tnr[$steam_obj->get_id()]]) {
             $content->setCurrentBlock("BLOCK_OWN_REPLY");
             $content->setVariable("REPLY_LINK_DELETE", PATH_URL . "messageboard/deleteComment/" . $thread->get_id() . "/" . $annotation["OBJ_ID"] . "/");
             $content->setVariable("REPLY_LABEL_DELETE", gettext("delete"));
             $content->setVariable("REPLY_LABEL_EDIT", gettext("edit"));
             $content->setVariable("REPLY_LINK_EDIT", PATH_URL . "messageboard/editComment/" . $thread->get_id() . "/" . $annotation["OBJ_ID"] . "/");
             $content->parse("BLOCK_OWN_REPLY");
         }
         $content->parse("REPLY");
     }
     $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_OR", gettext("or"));
     $content->setVariable("LABEL_POST_NOW", gettext("Post now"));
     $portal->set_rss_feed(PATH_URL . "services/feeds/discussion_public.php?id=" . OBJ_ID, gettext("Feed"), 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" => PATH_URL . "forums/" . $messageboard->get_id() . "/", "name" => $messageboard->get_name()), array("link" => "", "name" => gettext("Discussion")));
     $frameResponseObject->setTitle("Messageboard");
     $rawHtml = new \Widgets\RawHtml();
     $rawHtml->setHtml($content->get());
     $frameResponseObject->addWidget($rawHtml);
     return $frameResponseObject;
 }
Пример #12
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");
     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_post.template.html");
     $headline = gettext("Post a new topic");
     // TODO: Passt der link?
     $backlink = empty($_POST["values"]["backlink"]) ? $_SERVER["HTTP_REFERER"] : $_POST["values"]["backlink"];
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         $values = $_POST["values"];
         $problems = "";
         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 (get_magic_quotes_gpc()) {
             if (!empty($values['title'])) {
                 $values['title'] = stripslashes($values['title']);
             }
             if (!empty($values['body'])) {
                 $values['body'] = stripslashes($values['body']);
             }
         }
         if (!empty($problems)) {
             $portal->set_problem_description($problems);
         }
         if (!empty($values["preview_comment"])) {
             $content->setCurrentBlock("BLOCK_PREVIEW_COMMENT");
             $content->setVariable("TEXT_COMMENT", get_formatted_output($values["body"]));
             $content->setVariable("LABEL_PREVIEW_YOUR_COMMENT", gettext("Preview your comment"));
             $template->parse("BLOCK_PREVIEW_COMMENT");
             $headline = gettext("Change it?");
         }
         if (!empty($values["save"]) && empty($problems)) {
             if (!strpos($values["title"], "/")) {
                 $new_thread = $messageboard->add_thread($values["title"], $values["body"]);
                 //      		$all_user = steam_factory::groupname_to_object( $GLOBALS[ "STEAM" ]->get_id(), STEAM_ALL_USER );
                 //      		$new_thread->set_acquire( FALSE );
                 //      		$new_thread->set_read_access( $all_user, TRUE );
                 //      		$new_thread->set_write_access( $all_user, FALSE );
                 //      		$new_thread->set_annotate_access( $all_user, TRUE );
                 // Handle Related Cache-Data
                 require_once "Cache/Lite.php";
                 $cache = new \Cache_Lite(array("cacheDir" => PATH_CACHE));
                 $cache->clean(OBJ_ID);
                 // clean forumcache
                 $fcache = get_cache_function($forum_id, 600);
                 $fcache->drop("lms_forum::get_discussions", $forum_id);
                 // clean rsscache of the forum
                 // TODO: Passt der link?
                 $feedlink = PATH_URL . "services/feeds/forum_public.php?id=" . $forum_id;
                 $rcache = get_cache_function("rss", 600);
                 $rcache->drop("lms_rss::get_items", $feedlink);
                 header("Location: " . PATH_URL . "messageboard/viewDiscussion/" . $new_thread->get_id() . "/");
                 exit;
             } else {
                 $portal->set_problem_description(gettext("Please don't use the \"/\"-char in the title."));
             }
         }
         if (!empty($values["preview"]) && !empty($values['body'])) {
             // PREVIEW
             $content->setCurrentBlock("BLOCK_PREVIEW");
             $content->setVariable("LABEL_PREVIEW_EDIT", gettext("Preview the edit"));
             $content->setVariable("PREVIEW_EDIT", get_formatted_output($values["body"]));
             $content->parse("BLOCK_PREVIEW");
             $headline = gettext("Change it?");
         }
     }
     $subject = isset($values["title"]) ? htmlentities($values["title"], ENT_NOQUOTES, "utf-8") : "";
     $text = isset($values["body"]) ? htmlentities($values["body"], ENT_NOQUOTES, "utf-8") : "";
     $content->setVariable("INFO_TEXT", $headline);
     $content->setVariable("LABEL_TOPIC", gettext("Topic"));
     $content->setVariable("LABEL_YOUR_POST", gettext("Your Post"));
     $content->setVariable("TEXT_COMMENT", $text);
     $content->setVariable("TITLE_COMMENT", $subject);
     $content->setVariable("LABEL_PREVIEW", gettext("Preview"));
     $content->setVariable("LABEL_SAVE_CHANGES", gettext("Create entry"));
     $content->setVariable("VALUE_BACKLINK", $backlink);
     $content->setVariable("BACKLINK", "<a href=\"{$backlink}\">" . gettext("back") . "</a>");
     $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"));
     $portal->set_rss_feed(PATH_URL . "services/feeds/forum_public.php?id={$forum_id}", gettext("Feed"), str_replace("%l", $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" => PATH_URL . "forums/" . $messageboard->get_id() . "/", "name" => $messageboard->get_name()), array("link" => "", "name" => gettext("New Thread")));
     $frameResponseObject->setTitle("Messageboard");
     $rawHtml = new \Widgets\RawHtml();
     $rawHtml->setHtml($content->get());
     $frameResponseObject->addWidget($rawHtml);
     return $frameResponseObject;
 }
Пример #13
0
}
$content->setVariable("VALUE_WEEK", str_replace("%CW", $cw, gettext("Week %CW")));
$content->setVariable("LINK_PREV_WEEK", "?date=" . strtotime("-1 week", $date));
$content->setVariable("LINK_NEXT_WEEK", "?date=" . strtotime("+1 week", $date));
$content->setVariable("LABEL_PREV", gettext("Previous week"));
$content->setVariable("LABEL_NEXT", gettext("Next week"));
for ($weekday = 0; $weekday <= 6; $weekday++) {
    $content->setCurrentBlock("BLOCK_WEEKDAY");
    $content->setVariable("LABEL_WEEKDAY", strftime("%A, %d. %B", $d));
    if (count($events[$weekday]) > 0) {
        $date_objects = $events[$weekday];
        while (list($id, $date_obj) = each($date_objects)) {
            $content->setCurrentBlock("BLOCK_EVENT");
            $content->setVariable("VALUE_EVENT_TIME", strftime("%H:%M", $date_obj->get_attribute("DATE_START_DATE")) . " - " . strftime("%H:%M", $date_obj->get_attribute("DATE_END_DATE")));
            $content->setVariable("VALUE_EVENT_NAME", htmlentities($date_obj->get_attribute("DATE_TITLE"), ENT_QUOTES, "UTF-8"));
            $content->setVariable("VALUE_EVENT_LOCATION", $date_obj->get_attribute("DATE_LOCATION") ? '(' . htmlentities($date_obj->get_attribute("DATE_LOCATION"), ENT_QUOTES, "UTF-8") . ')' : '');
            $content->setVariable("VALUE_EVENT_DSC", get_formatted_output($date_obj->get_attribute("DATE_DESCRIPTION"), ENT_QUOTES, "UTF-8"));
            $content->setVariable("VALUE_EVENT_URL", $date_obj->get_attribute("DATE_URL") ? '(<a href="' . $date_obj->get_attribute("DATE_URL") . '">' . htmlentities($date_obj->get_attribute("DATE_URL"), ENT_QUOTES, "UTF-8") . '</a>)' : '');
            if ($date_obj->check_access_write($user)) {
                $content->setVariable("DETAILS_LINK", "<a href=\"" . $date_obj->get_id() . "/details/\">" . gettext("Details") . "</a> |");
                $content->setVariable("EDIT_LINK", "<a href=\"" . $date_obj->get_id() . "/edit/\">" . gettext("Edit") . "</a> |");
                $content->setVariable("DELETE_LINK", "<a onclick=\"return window.confirm('" . gettext("Are you sure you want to delete this event?") . "');\" href=\"" . $date_obj->get_id() . "/delete/\">" . gettext("Delete") . "</a>");
            }
            $content->parse("BLOCK_EVENT");
        }
    }
    $content->parse("BLOCK_WEEKDAY");
    $d = strtotime("+1 day", $d);
}
$portal->set_page_main(array(array("link" => "", "name" => str_replace("%YEAR", strftime("%G", $date), gettext("Calendar %YEAR")) . " / " . str_replace("%CW", $cw, gettext("Week %CW")))), $content->get(), "");
$portal->show_html();
Пример #14
0
 public function print_entries($date_objects = array(), $show_dates = TRUE)
 {
     $t = Weblog::getInstance()->loadTemplate("weblog_entries.template.html");
     //$t = new HTML_TEMPLATE_IT();
     //$t->loadTemplateFile( PATH_EXTENSIONS . "weblog/ui/html/weblog_entries.template.html" );
     $user = lms_steam::get_current_user();
     if (count($date_objects) == 0) {
         $date_objects = $this->get_date_objects();
         usort($date_objects, "sort_dates_ascending");
     }
     if (count($date_objects) == 0) {
         $t->setVariable("LABEL_NO_ENTRY_FOUND", "<h3>" . gettext("No posts yet.") . "</h3>");
         $this->set_main_html($t->get());
         return NULL;
     }
     $ld = 0;
     // TODO FIX IT !!!
     $data_tnr = array();
     foreach ($date_objects as $date_object) {
         $data_tnr[$date_object->get_id()] = array();
         $data_tnr[$date_object->get_id()]["comments"] = $date_object->get_annotations(FALSE, TRUE);
         $data_tnr[$date_object->get_id()]["creator"] = $date_object->get_creator(TRUE);
         $data_tnr[$date_object->get_id()]["is_writer"] = $date_object->check_access_write($user, TRUE);
         $data_tnr[$date_object->get_id()]["attributes"] = $date_object->get_attributes(array("DATE_TITLE", "DATE_DESCRIPTION", "DATE_START_DATE", "DATE_CATEGORY", "DATE_PODCAST", "OBJ_KEYWORDS"), TRUE);
     }
     $data_result = $GLOBALS["STEAM"]->buffer_flush();
     $creator = FALSE;
     $category = FALSE;
     $creators = array();
     $categories = array();
     foreach ($date_objects as $date_object) {
         $creator = $data_result[$data_tnr[$date_object->get_id()]["creator"]];
         $creators[$creator->get_id()] = $creator;
         $category = $data_result[$data_tnr[$date_object->get_id()]["attributes"]]["DATE_CATEGORY"];
         if (is_object($category)) {
             $categories[$category->get_id()] = $category;
         }
     }
     $creator_data = steam_factory::get_attributes($GLOBALS["STEAM"]->get_id(), array_values($creators), array(OBJ_NAME, USER_FIRSTNAME, USER_FULLNAME));
     $category_data = steam_factory::get_attributes($GLOBALS["STEAM"]->get_id(), array_values($categories), array(OBJ_NAME));
     foreach ($date_objects as $date_object) {
         $t->setCurrentBlock("BLOCK_ARTICLE");
         $entry = $data_result[$data_tnr[$date_object->get_id()]["attributes"]];
         $comments = $data_result[$data_tnr[$date_object->get_id()]["comments"]];
         $cd = strftime("%G%m%d", $entry["DATE_START_DATE"]);
         if (($cd != $ld || $ld == 0) && $show_dates) {
             $t->setCurrentBlock("BLOCK_DATE");
             $t->setVariable("VALUE_DATE", strftime("%d. %B %G", $entry["DATE_START_DATE"]));
             $t->parse("BLOCK_DATE");
         }
         $t->setVariable("VALUE_ARTICLE_SUBJECT", h($entry["DATE_TITLE"]));
         $t->setVariable("VALUE_ARTICLE_TEXT", get_formatted_output($entry["DATE_DESCRIPTION"]));
         $creator = $data_result[$data_tnr[$date_object->get_id()]["creator"]];
         $t->setVariable("VALUE_POSTED_BY", str_replace("%NAME", "<a href=\"" . PATH_URL . "user/" . $creator_data[$creator->get_id()][OBJ_NAME] . "/\">" . h($creator_data[$creator->get_id()][USER_FIRSTNAME]) . " " . h($creator_data[$creator->get_id()][USER_FULLNAME]) . "</a>", gettext("Posted by %NAME")));
         if ($show_dates) {
             $date_or_time = strftime("%R", $entry["DATE_START_DATE"]);
         } else {
             $date_or_time = strftime("%x %R", $entry["DATE_START_DATE"]);
         }
         $t->setVariable("VALUE_DATE_TIME", $date_or_time);
         $t->setVariable('POST_ID', $date_object->get_id());
         $t->setVariable('POST_PERMALINK', PATH_URL . 'weblog/' . $this->steam_weblog->get_id() . '/#comment' . $date_object->get_id());
         $t->setVariable("POST_PERMALINK_LABEL", gettext("permalink"));
         if ($data_result[$data_tnr[$date_object->get_id()]["is_writer"]]) {
             $t->setCurrentBlock("BLOCK_OWN_POST");
             $t->setVariable("POST_LINK_DELETE", PATH_URL . "weblog/entrydelete/" . $date_object->get_id() . "/");
             $t->setVariable("POST_LABEL_DELETE", gettext("delete"));
             $t->setVariable("POST_LINK_EDIT", PATH_URL . "weblog/entryedit/" . $date_object->get_id() . "/");
             $t->setVariable("POST_LABEL_EDIT", gettext("edit"));
             $t->parse("BLOCK_OWN_POST");
         }
         $category = $entry["DATE_CATEGORY"];
         if (is_object($category)) {
             $t->setVariable("LABEL_IN", gettext("in"));
             $t->setVariable("VALUE_CATEGORY", "<a href=\"" . PATH_URL . "weblog/" . $category->get_id() . "/\">" . h($category_data[$category->get_id()][OBJ_NAME]) . "</a>");
         } else {
             $t->setVariable("VALUE_CATEGORY", gettext("no category"));
         }
         $t->setVariable("LINK_COMMENTS", PATH_URL . "weblog/comments/" . $date_object->get_id() . "/");
         $t->setVariable("LABEL_COMMENTS", count($comments) . " " . (count($comments) == 1 ? gettext("comment") : gettext("comments")));
         $t->parse("BLOCK_ARTICLE");
         $ld = $cd;
     }
     $this->set_main_html($t->get());
 }
Пример #15
0
$content->setVariable("LABEL_WIKIS", gettext("Wikis"));
if (count($wikis) > 0) {
    $content->setCurrentBlock("BLOCK_WIKIS");
    $content->setVariable("LABEL_WIKI_DESCRIPTION", gettext("Wiki / description"));
    $content->setVariable("LABEL_WIKI_ENTRIES", gettext("Entries"));
    $content->setVariable("LABEL_WIKI_ACCESS", gettext("Access"));
    $content->setVariable("LABEL_WIKI_LAST_ENTRY", gettext("Last entry"));
    $access_descriptions = lms_wiki::get_access_descriptions($group);
    foreach ($wikis as $wiki) {
        $cache = get_cache_function($wiki["OBJ_ID"], 600);
        $entries = $cache->call("lms_wiki::get_items", $wiki["OBJ_ID"]);
        $last_entry = isset($entries[0]) ? $entries[0] : FALSE;
        $content->setCurrentBlock("BLOCK_WIKI");
        $content->setVariable("NAME_WIKI", h($wiki["OBJ_NAME"]));
        $content->setVariable("LINK_WIKI", PATH_URL . "wiki/" . $wiki["OBJ_ID"] . "/");
        $content->setVariable("WIKI_OBJ_DESC", get_formatted_output($wiki["OBJ_DESC"]));
        $title = $access_descriptions[$wiki["KOALA_ACCESS"]]["label"];
        if ($wiki["KOALA_ACCESS"] == PERMISSION_PRIVATE_READONLY && !$group instanceof koala_html_course) {
            $obj = steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $wiki["OBJ_ID"], CLASS_CONTAINER);
            $creator = $obj->get_creator();
            if ($creator->get_id() != lms_steam::get_current_user()->get_id()) {
                $title = str_replace("%NAME", $creator->get_name(), $title);
            } else {
                $title = str_replace("%NAME", "you", $title);
            }
        }
        $access = "<span title=\"" . $title . "\">" . $access_descriptions[$wiki["KOALA_ACCESS"]]["summary_short"] . "</span>";
        $content->setVariable("VALUE_WIKI_ACCESS", $access);
        $content->setVariable("VALUE_WIKI_ARTICLES", count($entries));
        $content->setVariable("LINK_WIKI_LAST_ENTRY", PATH_URL . "wiki/" . $last_entry["OBJ_ID"] . "/");
        $content->setVariable("SUBJECT_WIKI_LAST_ENTRY", str_replace(".wiki", "", h($last_entry["OBJ_NAME"])));
Пример #16
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;
             }
         }
     }
     // no direct call
     /* TODO: Soll das rein?
     		if (!defined('_VALID_KOALA')) {
     			header("location:/");
     			exit;
     		}
     		*/
     $comment = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $comment_id);
     $user = \lms_steam::get_current_user();
     if ($_SERVER["REQUEST_METHOD"] == "POST" && $comment->check_access_write($user)) {
         $values = $_POST["values"];
         if ($values["delete"]) {
             $_SESSION["confirmation"] = str_replace("%NAME", h($comment->get_name()), gettext("The comment '%NAME' has been deleted."));
             $annotating = $comment->get_annotating();
             $annotating->remove_annotation($comment);
             \lms_steam::delete($comment);
             require_once "Cache/Lite.php";
             $cache = new \Cache_Lite(array("cacheDir" => PATH_CACHE));
             $cache = get_cache_function(OBJ_ID, 600);
             $cache->drop("lms_steam::get_annotations", OBJ_ID);
             // Handle Related Cache-Data
             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
             $fcache->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: " . PATH_URL . "messageboard/viewDiscussion/" . $forum_id);
             exit;
         }
     }
     $content = \Messageboard::getInstance()->loadTemplate("comment_delete.template.html");
     if ($comment->check_access_write($user)) {
         $content->setVariable("LABEL_ARE_YOU_SURE", gettext("Are you sure you want to delete this comment?"));
         if (isset($document)) {
             // TODO: Passt der link?
             $content->setVariable("DELETE_BACK_LINK", PATH_URL . "doc/" . OBJ_ID . "/");
         } else {
             if (isset($weblog)) {
                 // TODO: Passt der link?
                 $content->setVariable("DELETE_BACK_LINK", PATH_URL . "weblog/" . OBJ_ID . "/");
             } else {
                 // TODO: Passt der link?
                 $content->setVariable("DELETE_BACK_LINK", PATH_URL . "forums/" . OBJ_ID . "/");
             }
         }
         $content->setCurrentBlock("BLOCK_DELETE");
         $content->setVariable("FORM_ACTION", $_SERVER["REQUEST_URI"]);
         $content->setVariable("LABEL_DELETE_IT", gettext("yes, delete it"));
         $content->setVariable("BACK_LINK", $_SERVER["HTTP_REFERER"]);
         $content->setVariable("LABEL_RETURN", gettext("back"));
         $content->parse("BLOCK_DELETE");
     } else {
         $content->setVariable("LABEL_ARE_YOU_SURE", gettext("You have no rights to delete this comment!"));
     }
     $content->setVariable("TEXT_COMMENT", get_formatted_output($comment->get_content()));
     $creator = $comment->get_creator();
     $creator_data = $creator->get_attributes(array("USER_FULLNAME", "USER_FIRSTNAME", "OBJ_ICON"));
     $content->setVariable("LABEL_FROM_AND_AGO", str_replace("%N", "<a href=\"" . PATH_URL . "/user/" . $creator->get_name() . "/\">" . h($creator_data["USER_FIRSTNAME"]) . " " . h($creator_data["USER_FULLNAME"]) . "</a>", gettext("by %N")) . "," . how_long_ago($comment->get_attribute("OBJ_CREATION_TIME")));
     $icon = $creator_data["OBJ_ICON"];
     if ($icon instanceof \steam_object) {
         $icon_id = $icon->get_id();
     } else {
         $icon_id = 0;
     }
     $content->setVariable("ICON_SRC", PATH_URL . "get_document.php?id=" . $icon_id);
     // 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("Delete comment")));
     $frameResponseObject->setTitle("Messageboard");
     $rawHtml = new \Widgets\RawHtml();
     $rawHtml->setHtml($content->get());
     $frameResponseObject->addWidget($rawHtml);
     return $frameResponseObject;
 }
Пример #17
0
$html_handler_group = new koala_html_group($group);
$html_handler_group->set_context("start");
$content = new HTML_TEMPLATE_IT();
$content->loadTemplateFile(PATH_TEMPLATES . "group_start.template.html");
$content->setVariable("LABEL_DESCRIPTION", gettext("Description"));
$desc = $group->get_attribute("OBJ_DESC");
if (empty($desc)) {
    $content->setVariable("OBJ_DESC", gettext("No description available."));
} else {
    $content->setVariable("OBJ_DESC", get_formatted_output($desc));
}
$about = $group->get_attribute("OBJ_LONG_DSC");
if (!empty($about)) {
    $content->setCurrentBlock("BLOCK_ABOUT");
    $content->setVariable("VALUE_ABOUT", get_formatted_output($about));
    $content->parse("BLOCK_ABOUT");
}
$content->setVariable("LABEL_ADMINS", gettext("Moderated by"));
if ($group->get_maxsize() > 0) {
    $content->setCurrentBlock("BLOCK_GROUPSIZE");
    $content->setVariable("LABEL_MAXSIZE_HEADER", gettext("The number of participants of this group is limited."));
    $content->setVariable("LABEL_MAXSIZE_DESCRIPTION", str_replace("%MAX", $group->get_maxsize(), str_replace("%ACTUAL", $group->count_members(), gettext("The actual participant count is %ACTUAL of %MAX."))));
    $content->parse("BLOCK_GROUPSIZE");
}
$admins = $group->get_admins();
if (count($admins) > 0) {
    foreach ($admins as $admin) {
        $content->setCurrentBlock("BLOCK_ADMIN");
        $admin_attributes = $admin->get_attributes(array("USER_FIRSTNAME", "USER_FULLNAME", "OBJ_ICON", "OBJ_DESC", "OBJ_NAME"));
        if ($admin instanceof steam_user) {
Пример #18
0
    $values = $_POST["values"];
    if ($values["delete"]) {
        require_once "Cache/Lite.php";
        $cache = new Cache_Lite(array("cacheDir" => PATH_CACHE));
        $cache->clean($weblog->get_id());
        $cache->clean($date->get_id());
        $trashbin = $GLOBALS["STEAM"]->get_current_steam_user();
        if (is_object($trashbin)) {
            $date->move($trashbin);
        } else {
            $date->delete();
        }
    }
    header("Location: " . $values["return_to"]);
    exit;
}
$content = new HTML_TEMPLATE_IT();
$content->loadTemplateFile(PATH_TEMPLATES . "weblog_entry_delete.template.html");
$content->setVariable("LABEL_ARE_YOU_SURE", gettext("Are you sure you want to delete this entry?"));
$content->setVariable("TEXT_COMMENT", get_formatted_output($date->get_attribute("DATE_DESCRIPTION")));
$creator = $date->get_creator();
$creator_data = $creator->get_attributes(array("USER_FULLNAME", "USER_FIRSTNAME", "OBJ_ICON"));
$content->setVariable("LABEL_FROM_AND_AGO", str_replace("%N", "<a href=\"" . PATH_URL . "/user/" . $creator->get_name() . "/\">" . h($creator_data["USER_FIRSTNAME"]) . " " . h($creator_data["USER_FULLNAME"]) . "</a>", gettext("by %N")) . "," . how_long_ago($date->get_attribute("OBJ_CREATION_TIME")));
$content->setVariable("LABEL_DELETE_IT", gettext("yes, delete it"));
$content->setVariable("BACK_LINK", $_SERVER["HTTP_REFERER"]);
$content->setVariable("LABEL_RETURN", gettext("back"));
$content->setVariable("ICON_SRC", PATH_URL . "get_document.php?id=" . $creator_data["OBJ_ICON"]->get_id());
$rootlink = lms_steam::get_link_to_root($weblog);
$headline = array($rootlink[0], $rootlink[1], array("link" => $rootlink[1]["link"] . "communication/", "name" => gettext("Communication")), array("link" => "", "name" => h($weblog->get_name()), "link" => PATH_URL . "weblog/" . $weblog->get_id() . "/"), array("name" => str_replace("%NAME", h($date->get_attribute("DATE_TITLE")), gettext("Delete '%NAME'?"))));
$portal->set_page_main($headline, $content->get(), "");
$portal->show_html();
Пример #19
0
    } else {
        if (isset($weblog)) {
            $content->setVariable("DELETE_BACK_LINK", PATH_URL . "weblog/" . OBJ_ID . "/");
        } else {
            $content->setVariable("DELETE_BACK_LINK", PATH_URL . "forums/" . OBJ_ID . "/");
        }
    }
    $content->setCurrentBlock("BLOCK_DELETE");
    $content->setVariable("FORM_ACTION", $_SERVER["REQUEST_URI"]);
    $content->setVariable("LABEL_DELETE_IT", gettext("yes, delete it"));
    $content->setVariable("BACK_LINK", $_SERVER["HTTP_REFERER"]);
    $content->setVariable("LABEL_RETURN", gettext("back"));
    $content->parse("BLOCK_DELETE");
} else {
    $content->setVariable("LABEL_ARE_YOU_SURE", gettext("You have no rights to delete this comment!"));
}
$content->setVariable("TEXT_COMMENT", get_formatted_output($comment->get_content()));
$creator = $comment->get_creator();
$creator_data = $creator->get_attributes(array("USER_FULLNAME", "USER_FIRSTNAME", "OBJ_ICON"));
$content->setVariable("LABEL_FROM_AND_AGO", str_replace("%N", "<a href=\"" . PATH_URL . "/user/" . $creator->get_name() . "/\">" . h($creator_data["USER_FIRSTNAME"]) . " " . h($creator_data["USER_FULLNAME"]) . "</a>", gettext("by %N")) . "," . how_long_ago($comment->get_attribute("OBJ_CREATION_TIME")));
$icon = $creator_data["OBJ_ICON"];
if ($icon instanceof steam_object) {
    $icon_id = $icon->get_id();
} else {
    $icon_id = 0;
}
$content->setVariable("ICON_SRC", PATH_URL . "get_document.php?id=" . $icon_id);
$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("Delete comment")));
$portal->set_page_main($headline, $content->get(), "");
$portal->show_html();
Пример #20
0
 public function frameResponse(\FrameResponseObject $frameResponseObject)
 {
     $path = $this->params;
     $user = \lms_steam::get_current_user();
     $public = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), STEAM_PUBLIC_GROUP, CLASS_GROUP);
     $id = $path[0];
     try {
         $steam_group = !empty($id) ? \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $id) : FALSE;
     } catch (Exception $ex) {
         include "bad_link.php";
         exit;
     }
     $html_handler_group = new \koala_html_group($steam_group);
     $html_handler_group->set_context("start");
     $group_is_private = FALSE;
     if ($steam_group && is_object($steam_group)) {
         switch ((string) $steam_group->get_attribute("OBJ_TYPE")) {
             case "course":
                 $group = new \koala_group_course($steam_group);
                 // TODO: Passt der backlink?
                 $backlink = PATH_URL . SEMESTER_URL . "/" . $group->get_semester()->get_name() . "/" . h($group->get_name()) . "/";
                 break;
             default:
                 $group = new \koala_group_default($steam_group);
                 // TODO: Passt der backlink?
                 $backlink = PATH_URL . "groups/" . $group->get_id() . "/";
                 // Determine if group is public or private
                 $parent = $group->get_parent_group();
                 if ($parent->get_id() == STEAM_PRIVATE_GROUP) {
                     $group_is_private = TRUE;
                 }
                 break;
         }
     }
     if ($group_is_private) {
         if (!$steam_group->is_member($user) && !\lms_steam::is_koala_admin($user)) {
             throw new Exception(gettext("You have no rights to access this group"), E_USER_RIGHTS);
         }
     }
     if ($id != STEAM_PUBLIC_GROUP) {
         //TODO: Somethings wrong here... again a 404 error while loading koala_html_group
         /*
          $html_handler_group = new \koala_html_group( $group );
         $html_handler_group->set_context( "start" );
         */
         $content = \Group::getInstance()->loadTemplate("group_start.template.html");
         $content->setVariable("LABEL_DESCRIPTION", gettext("Description"));
         $desc = $group->get_attribute("OBJ_DESC");
         if (empty($desc)) {
             $content->setVariable("OBJ_DESC", gettext("No description available."));
         } else {
             $content->setVariable("OBJ_DESC", get_formatted_output($desc));
         }
         $about = $group->get_attribute("OBJ_LONG_DSC");
         if (!empty($about)) {
             $content->setCurrentBlock("BLOCK_ABOUT");
             $content->setVariable("VALUE_ABOUT", get_formatted_output($about));
             $content->parse("BLOCK_ABOUT");
         }
         $content->setVariable("LABEL_ADMINS", gettext("Moderated by"));
         if ($group->get_maxsize() > 0) {
             $content->setCurrentBlock("BLOCK_GROUPSIZE");
             $content->setVariable("LABEL_MAXSIZE_HEADER", gettext("The number of participants of this group is limited."));
             $content->setVariable("LABEL_MAXSIZE_DESCRIPTION", str_replace("%MAX", $group->get_maxsize(), str_replace("%ACTUAL", $group->count_members(), gettext("The actual participant count is %ACTUAL of %MAX."))));
             $content->parse("BLOCK_GROUPSIZE");
         }
         $admins = $group->get_admins();
         if (count($admins) > 0) {
             foreach ($admins as $admin) {
                 $content->setCurrentBlock("BLOCK_ADMIN");
                 $admin_attributes = $admin->get_attributes(array("USER_FIRSTNAME", "USER_FULLNAME", "OBJ_ICON", "OBJ_DESC", "OBJ_NAME"));
                 if ($admin instanceof \steam_user) {
                     $content->setVariable("ADMIN_NAME", h($admin_attributes["USER_FIRSTNAME"]) . " " . h($admin_attributes["USER_FULLNAME"]));
                     $content->setVariable("ADMIN_LINK", PATH_URL . "user/" . h($admin->get_name()) . "/");
                 } else {
                     $content->setVariable("ADMIN_NAME", h($admin_attributes["OBJ_NAME"]));
                     $content->setVariable("ADMIN_LINK", PATH_URL . "groups/" . $admin->get_id() . "/");
                 }
                 $content->setVariable("ADMIN_ICON", PATH_URL . "cached/get_document.php?id=" . $admin_attributes["OBJ_ICON"]->get_id() . "&type=usericon&width=40&height=47");
                 $admin_desc = empty($admin_attributes["OBJ_DESC"]) ? "student" : $admin_attributes["OBJ_DESC"];
                 $content->setVariable("ADMIN_DESC", secure_gettext($admin_desc));
                 $content->parse("BLOCK_ADMIN");
             }
         } else {
             $content->setVariable("LABEL_UNMODERATED", gettext("Group is unmoderated."));
         }
         //TODO: Somethings wrong here... again a 404 error while loading koala_html_group
         //$html_handler_group->set_html_left( $content->get() );
         // TODO: Portal...!
         //$portal->set_page_main( $html_handler_group->get_headline(), $html_handler_group->get_html() , "" );
         //$portal->show_html();
     } else {
         //TODO: Wann wird das hier aufgerufen??
         $public = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), STEAM_PUBLIC_GROUP, CLASS_GROUP);
         $user = \lms_steam::get_current_user();
         $content = \Group::getInstance()->loadTemplate("groups_public.template.html");
         if (MANAGE_GROUPS_MEMBERSHIP || CREATE_GROUPS) {
             $content->setCurrentBlock("BLOCK_ACTION_BAR_GROUPS");
             if (MANAGE_GROUPS_MEMBERSHIP) {
                 $content->setCurrentBlock("BLOCK_MANAGE_GROUPS_MEMBERSHIP");
                 $content->setVariable("LINK_MANAGE_SUBSCRIPTIONS", PATH_URL . "user/" . $user->get_name() . "/groups/");
                 $content->setVariable("LABEL_MANAGE_SUBSCRIPTIONS", gettext("Manage subscriptions"));
                 $content->parse("BLOCK_MANAGE_GROUPS_MEMBERSHIP");
             }
             if (CREATE_GROUPS) {
                 $content->setCurrentBlock("BLOCK_CREATE_GROUPS");
                 $content->setVariable("LINK_CREATE_NEW_GROUP", PATH_URL . "groups_create_dsc.php?parent=" . (isset($_GET["cat"]) ? $_GET["cat"] : $public->get_id()));
                 $content->setVariable("LABEL_CREATE_NEW_GROUP", gettext("Create new group"));
                 $content->parse("BLOCK_CREATE_GROUPS");
             }
             $content->parse("BLOCK_ACTION_BAR_GROUPS");
         }
         $content->setVariable("LABEL_NAME", gettext("Name"));
         $content->setVariable("LABEL_DESC", gettext("Description"));
         if (!empty($_GET["cat"])) {
             // EINE KATEGORIE ANZEIGEN
             if (!($category = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $_GET["cat"]))) {
                 include "bad_link.php";
                 exit;
             }
             if (!$category instanceof \steam_container) {
                 include "bad_link.php";
                 exit;
             }
             $subgroups = $category->get_inventory(CLASS_GROUP);
             $content->setVariable("LABEL_ALL_CATEGORIES", str_replace(array("%i", "%NAME"), array(count($subgroups), $category->get_name()), gettext("%i groups in %NAME")));
             $content->setVariable("LABEL_SUBGROUPS_MEMBERS", gettext("Members"));
             $tnr = array();
             $attributes = array(OBJ_NAME, OBJ_DESC);
             $tnr = array();
             $attributes = array(OBJ_NAME, OBJ_DESC);
             foreach ($subgroups as $subgroup) {
                 $tnr[$subgroup->get_id()] = array();
                 $tnr[$subgroup->get_id()][OBJ_NAME] = $subgroup->get_attribute(OBJ_NAME, TRUE);
                 $tnr[$subgroup->get_id()][OBJ_DESC] = $subgroup->get_attribute(OBJ_DESC, TRUE);
                 $tnr[$subgroup->get_id()]["membercount"] = $subgroup->count_members(TRUE);
             }
             $result = $GLOBALS["STEAM"]->buffer_flush();
             foreach ($subgroups as $subgroup) {
                 $subgroup->set_value(OBJ_NAME, $result[$tnr[$subgroup->get_id()][OBJ_NAME]]);
                 $subgroup->set_value(OBJ_DESC, $result[$tnr[$subgroup->get_id()][OBJ_DESC]]);
             }
             usort($subgroups, "sort_objects_new");
             foreach ($subgroups as $subgroup) {
                 $content->setCurrentBlock("BLOCK_CATEGORY_GROUP");
                 $content->setVariable("VALUE_LINK", PATH_URL . "groups/" . $subgroup->get_id() . "/");
                 $content->setVariable("VALUE_NAME", h($subgroup->get_name()));
                 $content->setVariable("VALUE_SUBGROUPS_MEMBERS", $result[$subgroup->get_id()]["membercount"]);
                 $content->setVariable("VALUE_DESC", h($subgroup->get_attribute("OBJ_DESC")));
                 $content->parse("BLOCK_CATEGORY_GROUP");
             }
             $headline = array(array("link" => PATH_URL . "groups/", "name" => gettext("Public Groups")), array("link" => "", "name" => h($category->get_name())));
         } else {
             // KATEGORIEN ANZEIGEN
             $categories = $public->get_workroom()->get_inventory(CLASS_ROOM | CLASS_CONTAINER);
             $content->setVariable("LABEL_ALL_CATEGORIES", str_replace("%i", count($categories), gettext("%i categories in Public Groups")));
             $content->setVariable("LABEL_SUBGROUPS_MEMBERS", gettext("Groups"));
             if (count($categories) > 0) {
                 $tnr = array();
                 $attributes = array(OBJ_NAME, OBJ_DESC);
                 foreach ($categories as $category) {
                     $tnr[$category->get_id()] = array();
                     $tnr[$category->get_id()]["attributes"] = $category->get_attributes($attributes, TRUE);
                     $tnr[$category->get_id()]["inventory"] = $category->get_inventory_raw(CLASS_GROUP, TRUE);
                 }
                 $result = $GLOBALS["STEAM"]->buffer_flush();
                 foreach ($categories as $category) {
                     $category->set_value(OBJ_NAME, $result[$tnr[$category->get_id()]["attributes"]][OBJ_NAME]);
                     $category->set_value(OBJ_DESC, $result[$tnr[$category->get_id()]["attributes"]][OBJ_DESC]);
                 }
                 usort($categories, "sort_objects_new");
                 foreach ($categories as $category) {
                     $content->setCurrentBlock("BLOCK_CATEGORY_GROUP");
                     $content->setVariable("VALUE_LINK", PATH_URL . "groups/?cat=" . $category->get_id());
                     $content->setVariable("VALUE_NAME", h($category->get_name()));
                     $content->setVariable("VALUE_DESC", h($category->get_attribute(OBJ_DESC)));
                     $subgroups = $result[$tnr[$category->get_id()]["inventory"]];
                     $no_subgroups = count($subgroups);
                     if ($no_subgroups == 0) {
                         $content->setVariable("VALUE_SUBGROUPS_MEMBERS", "-");
                     } else {
                         $content->setVariable("VALUE_SUBGROUPS_MEMBERS", $no_subgroups);
                     }
                     $content->parse("BLOCK_CATEGORY_GROUP");
                 }
             }
             $headline = gettext("Public Groups");
         }
         $portal->set_page_main($headline, $content->get(), "");
         $portal->show_html();
     }
     $html_handler_group->set_html_left($content->get());
     $frameResponseObject->setTitle("Group");
     $rawHtml = new \Widgets\RawHtml();
     $rawHtml->setHtml($html_handler_group->get_html());
     $frameResponseObject->addWidget($rawHtml);
     return $frameResponseObject;
 }
Пример #21
0
    $participant_mgmnt = gettext("password protected tutorial");
} else {
    if ($lms_tutorial->is_moderated() && !$lms_tutorial->is_password_protected()) {
        $participant_mgmnt = gettext("moderated tutorial");
    } else {
        if ($lms_tutorial->is_private() && !$lms_tutorial->is_password_protected()) {
            $participant_mgmnt = gettext("private tutorial");
        } else {
            $participant_mgmnt = gettext("public tutorial");
        }
    }
}
$content = new HTML_TEMPLATE_IT();
$content->loadTemplateFile(PATH_EXTENSIONS . "tutorials/templates/tutorial.template.html");
$content->setVariable("VALUE_CONTAINER_DESC", h($tutorial->get_attribute("OBJ_DESC")) . " (" . $participant_mgmnt . ")");
$content->setVariable("VALUE_CONTAINER_LONG_DESC", get_formatted_output($tutorial->get_attribute("TUTORIAL_LONG_DESC")));
$content->setVariable("VALUE_TUTOR", h($tutorial->get_attribute("TUTORIAL_TUTOR")));
if ($tutorial->get_attribute("TUTORIAL_MAX_LEARNERS") != "" && $tutorial->get_attribute("TUTORIAL_MAX_LEARNERS") != 0) {
    $content->setVariable("VALUE_MAX_LEARNERS", $tutorial->get_attribute("TUTORIAL_MAX_LEARNERS"));
    $content->setVariable("VALUE_FREE", "(" . ($tutorial->get_attribute("TUTORIAL_MAX_LEARNERS") - $tutorial->count_members()) . " " . gettext("free slots") . ")");
} else {
    $content->setVariable("VALUE_MAX_LEARNERS", gettext("unlimited"));
}
$content->setVariable("LABEL_MAX_LEARNERS", gettext("Max learners:"));
$content->setVariable("LABEL_MATERIAL", gettext("Learning Material"));
$content->setVariable("LABEL_LEARNERS", gettext("Learners"));
//TODO: workaround unit Group.pike -> get_admin() is fixed
//$is_admin = $tutorial->check_access( SANCTION_ALL, $user );
$is_admin = $lms_tutorial->is_admin($user);
// Pointlist
/*
Пример #22
0
 public function execute(\FrameResponseObject $frameResponseObject)
 {
     //$portal = \lms_portal::get_instance();
     //$portal->initialize( GUEST_NOT_ALLOWED );
     //$portal->set_confirmation();
     $user = \lms_steam::get_current_user();
     //$path = $request->getPath();
     $STEAM = $GLOBALS["STEAM"];
     $weblogId = $this->id;
     $weblog = \steam_factory::get_object($STEAM->get_id(), $weblogId);
     //if ( ! $weblog = steam_factory::get_object( $STEAM->get_id(), $_GET[ "id" ] ) )
     //{
     //	include( "bad_link.php" );
     //	exit;
     //}
     if (!$weblog instanceof \steam_calendar) {
         if ($weblog instanceof \steam_container) {
             $category = $weblog;
             $categories = $category->get_environment();
             $weblog = new \steam_weblog((string) $GLOBALS["STEAM"]->get_id(), $categories->get_environment()->get_id());
         } elseif ($weblog instanceof \steam_date) {
             $date = $weblog;
             $weblog = new \steam_weblog((string) $GLOBALS["STEAM"]->get_id(), $date->get_environment()->get_id());
         } else {
             include "bad_link.php";
             exit;
         }
     } else {
         $weblog = new \steam_weblog((string) $GLOBALS["STEAM"]->get_id(), $weblogId);
         define("OBJ_ID", $weblogId);
         if (!$weblog->check_access_read($user)) {
             throw new \Exception("No rights to view this.", E_USER_RIGHTS);
         }
     }
     $content = \Weblog::getInstance()->loadTemplate("weblog_post.template.html");
     //$content = new HTML_TEMPLATE_IT();
     //$content->loadTemplateFile( PATH_TEMPLATES . "weblog_post.template.html" );
     $headline = gettext("Post a new entry");
     if ($_SERVER["REQUEST_METHOD"] == "GET") {
         $content->setVariable("VALUE_BACK_LINK", $_SERVER["HTTP_REFERER"]);
     } else {
         $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["save"])) {
             $problem = "";
             $hint = "";
             if (empty($values["title"])) {
                 $problem .= gettext("The title is missing.") . "&nbsp;";
                 $hint .= gettext("Please add the missing values.");
             }
             if (empty($values["body"])) {
                 $problem .= gettext("There is no message for your readers.") . "&nbsp;";
                 $hint .= gettext("Please write your post into the text area.");
             }
             if (!empty($values["category"]) && $values["category"] != 0) {
                 $category = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $values["category"]);
                 if (!$category instanceof \steam_container) {
                     throw new \Exception("Not a valid category: " . $values["category"]);
                 }
             } else {
                 $category = "";
             }
             if (!($timestamp = strtotime($values["date"] . ":00"))) {
                 $problem .= gettext("I cannot parse the date and time.");
                 $hint .= gettext("Please verify your date and time format") . ": YYYY-MM-DD HH:MM";
             }
             if (strpos($values["title"], "/")) {
                 if (!isset($problem)) {
                     $problem = "";
                 }
                 $problem .= gettext("Please don't use the \"/\"-char in the subject of your post.");
             }
             if (empty($problem)) {
                 $new_entry = $weblog->create_entry($values["title"], $values["body"], $category, array(), $timestamp);
                 if ($values["podcast"] != 0) {
                     $new_entry->set_attribute("DATE_PODCAST", $values["podcast"]);
                 }
                 // Handle Related Cache-Data
                 require_once "Cache/Lite.php";
                 $cache = new \Cache_Lite(array("cacheDir" => PATH_CACHE));
                 $cache->clean(OBJ_ID);
                 // clean weblogcache
                 $bcache = get_cache_function($_GET["id"], 600);
                 $bcache->drop("lms_weblog::get_items", $_GET["id"]);
                 // clean rsscache of the weblog
                 $feedlink = PATH_URL . "services/feeds/weblog_public.php?id=" . $_GET["id"];
                 $rcache = get_cache_function("rss", 600);
                 $rcache->drop("lms_rss::get_items", $feedlink);
                 header("Location: " . PATH_URL . "weblog/index/" . $weblog->get_id() . "/");
                 exit;
             } else {
                 // TODO:THERE IS A PROBLEM
                 //$portal->set_problem_description( $problem, $hint );
                 $content->setVariable("TEXT_COMMENT", h($values["body"]));
                 $content->setVariable("TITLE_COMMENT", h($values["title"]));
             }
         } else {
             // PREVIEW
             $content->setCurrentBlock("BLOCK_PREVIEW");
             $content->setVariable("LABEL_PREVIEW_EDIT", gettext("Preview the edit"));
             $content->setVariable("PREVIEW_EDIT", get_formatted_output($values["body"]));
             $content->parse("BLOCK_PREVIEW");
             $headline = gettext("Change it?");
             $content->setVariable("TEXT_COMMENT", h($values["body"]));
             $content->setVariable("TITLE_COMMENT", h($values["title"]));
         }
     }
     $backlink = empty($_POST["values"]["return_to"]) ? $_SERVER["HTTP_REFERER"] : $_POST["values"]["return_to"];
     $content->setVariable("VALUE_BACK_LINK", $backlink);
     $content->setVariable("POST_NEW_ENTRY_TEXT", $headline);
     $content->setVariable("INFO_TEXT", "some hints about blogging");
     $content->setVariable("LABEL_DATE", gettext("Date"));
     $content->setVariable("INFO_FORMAT", gettext("Format: YYYY-MM-DD HH:MM"));
     $date = empty($values["date"]) ? strftime("%Y-%m-%d %H:%M") : $values["date"];
     $content->setVariable("DATE_COMMENT", h($date));
     $content->setVariable("LABEL_SUBJECT", gettext("Subject"));
     $content->setVariable("LABEL_YOUR_POST", gettext("Your Post"));
     $content->setVariable("LABEL_CATEGORY", gettext("Category"));
     $content->setVariable("LINK_NEW_CATEGORY", PATH_URL . "weblog/categorycreate/" . $weblog->get_id());
     $content->setVariable("LABEL_NEW_CATEGORY", gettext("Want to add a new category?"));
     $content->setVariable("CAT_NO_SELECTION", gettext("nothing selected"));
     $categories = $weblog->get_categories();
     $selection = empty($values["category"]) ? isset($_GET["category"]) ? $_GET["category"] : '' : $values["category"];
     foreach ($categories as $category) {
         $content->setCurrentBlock("BLOCK_SELECT_CAT");
         $content->setVariable("VALUE_CAT", $category->get_id());
         $content->setVariable("LABEL_CAT", h($category->get_name()));
         if ($category->get_id() == $selection) {
             $content->setVariable("CAT_SELECTED", 'selected="selected"');
         }
         $content->parse("BLOCK_SELECT_CAT");
     }
     /*
     $content->setVariable( "LABEL_PODCAST", gettext( "Podcast") );
     $content->setVariable( "PODCAST_NO_SELECTION", gettext( "nothing selected" ) );
     $content->setVariable( "LINK_UPLOAD_MULTIMEDIA", PATH_URL . "weblog/" . $weblog->get_id() . "/podcast/" );
     $content->setVariable( "LABEL_UPLOAD_MULTIMEDIA", gettext( "Want to upload an audio or video file?" ) );
     $files_in_podspace = $weblog->get_podspace()->get_inventory( CLASS_DOCUMENT );
     foreach( $files_in_podspace as $file )
     {
     $content->setCurrentBlock( "BLOCK_MULTIMEDIA" );
     $content->setVariable( "VALUE_MULTIMEDIA", $file->get_id() );
     if ( ( $file->get_id() == $_GET[ "podcast" ] ) || ( $file->get_id() == $values[ "podcast" ] ) )
     {
     $content->setVariable( "MULTIMEDIA_SELECTED", 'selected="selected"' );
     }
     $content->setVariable( "LABEL_MULTIMEDIA", h($file->get_name()) );
     $content->parse( "BLOCK_MULTIMEDIA" );
     }
     */
     $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:RSS-FEED
     //$portal->set_rss_feed( PATH_URL . "services/feeds/weblog_public.php?id=" . $weblog->get_id(), gettext( "Feed" ), str_replace( "%l", (isset($login))?$login:'', gettext( "Subscribe to this forum's Newsfeed" ) ) );
     $rootlink = \lms_steam::get_link_to_root($weblog);
     $headline = array($rootlink[0], $rootlink[1], array("link" => $rootlink[1]["link"] . "communication/", "name" => gettext("Communication")), array("name" => h($weblog->get_name()), "link" => PATH_URL . "weblog/" . $weblog->get_id() . "/"), array("link" => "", "name" => gettext("New Post")));
     /*$portal->set_page_main(
     			$headline,
     			$content->get()
     		);
     		return $portal->get_html();*/
     $frameResponseObject->setHeadline($headline);
     $widget = new \Widgets\RawHtml();
     $widget->setHtml($content->get());
     $frameResponseObject->addWidget($widget);
     return $frameResponseObject;
 }
Пример #23
0
<?php

if (!defined("PATH_TEMPLATES_UNITS_PYRAMID")) {
    define("PATH_TEMPLATES_UNITS_PYRAMID", PATH_EXTENSIONS . "units_pyramiddiscussion/templates/");
}
//$portal = lms_portal::get_instance();
//$portal->initialize( GUEST_ALLOWED );
$html_handler_course = new koala_html_course($course);
$html_handler_course->set_context("units", array("subcontext" => "unit"));
$content = new HTML_TEMPLATE_IT();
$content->loadTemplateFile(PATH_TEMPLATES_UNITS_PYRAMID . "units_pyramiddiscussion.template.html");
$content->setVariable("VALUE_DESC", $unit->get_attribute("OBJ_DESC"));
$content->setVariable("VALUE_LONG_DESC", get_formatted_output($unit->get_attribute("OBJ_LONG_DESC")));
$appearance = $unit->get_attribute("UNIT_PYRAMIDDISCUSSION_APPEARANCE");
if ($appearance === 0 || $appearance === "") {
    $appearance = "direct";
}
$unit_url = "https://" . $GLOBALS["STEAM"]->get_config_value("web_server") . ($GLOBALS["STEAM"]->get_config_value("web_port_http") != "443" ? ":" . $GLOBALS["STEAM"]->get_config_value("web_port_http") : "") . $unit->get_steam_object()->get_path() . "/";
$unit_url = str_replace("?", "%3f", $unit_url);
if ($appearance === "direct") {
    header("Location: " . $unit_url);
    exit;
} else {
    if ($appearance == "2") {
        $content->setCurrentBlock("BLOCK_IFRAME");
        $content->setVariable("VALUE_IFRAME_URL", $unit_url);
        $content->parse("BLOCK_IFRAME");
    } else {
        $content->setCurrentBlock("BLOCK_LINK");
        $content->setVariable("VALUE_LINK_URL", $unit_url);
        $content->setVariable("VALUE_LINK_TEXT", gettext("Show pyramiddiscussion"));
Пример #24
0
        require_once "Cache/Lite.php";
        $cache = new Cache_Lite(array("cacheDir" => PATH_CACHE));
        $cache->clean($weblog->get_id());
        $link_objects = $category->get_inventory(CLASS_LINK);
        foreach ($link_objects as $link_object) {
            $date_object = $link_object->get_source_object();
            $link_object->delete();
            if ($values["delete_all_dates"]) {
                $date_object->delete();
            } else {
                $date_object->set_attribute("DATE_CATEGORY", "0");
            }
        }
        $category->delete();
    }
    header("Location: " . PATH_URL . "weblog/" . $weblog->get_id() . "/");
    exit;
}
$content = new HTML_TEMPLATE_IT();
$content->loadTemplateFile(PATH_TEMPLATES . "weblog_category_delete.template.html");
$content->setVariable("LABEL_ARE_YOU_SURE", gettext("Are you sure you want to delete this category?"));
$content->setVariable("NAME_CATEGORY", h($category->get_name()));
$content->setVariable("TEXT_CATEGORY", get_formatted_output($category->get_attribute("OBJ_DESC")));
$content->setVariable("LABEL_DELETE_ALL_DATES", str_replace("%NO", count($category->get_inventory(CLASS_LINK)), gettext("Should all %NO entries in this category be deleted, too?")));
$content->setVariable("LABEL_DELETE_IT", gettext("yes, delete it"));
$content->setVariable("BACK_LINK", $_SERVER["HTTP_REFERER"]);
$content->setVariable("LABEL_RETURN", gettext("back"));
$rootlink = lms_steam::get_link_to_root($weblog);
$headline = array($rootlink[0], $rootlink[1], array("link" => $rootlink[1]["link"] . "communication/", "name" => gettext("Communication")), array("name" => h($weblog->get_name()), "link" => PATH_URL . "weblog/" . $weblog->get_id() . "/"), array("link" => PATH_URL . "weblog/" . $category->get_id() . "/", "name" => h($category->get_name())), array("link" => "", "name" => str_replace("%NAME", h($category->get_name()), gettext("Delete '%NAME'?"))));
$portal->set_page_main($headline, $content->get(), "");
$portal->show_html();
Пример #25
0
                $wiki_doc = steam_factory::create_document($GLOBALS["STEAM"]->get_id(), $values["title"] . ".wiki", $values["body"], "text/wiki", $wiki_container, "");
            } else {
                // PRUEFEN, OB ALLES OK, DANN NEUE WERTE SPEICHERN
                $wiki_doc->set_name($values['title'] . ".wiki");
                $wiki_doc->set_content($values['body']);
            }
            // Clean cache for wiki_entries
            $cache = get_cache_function($wiki_container->get_id(), 600);
            $cache->clean($wiki_container->get_id());
            header("Location: " . PATH_URL . "wiki/" . $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 {
        $portal->set_problem_description($problems);
    }
}
if (empty($values)) {
    $wikicontent = "";
    $wikiname = "";
    if (!$create) {
        $wikicontent = $wiki_doc->get_content();
        $wikiname = $wiki_doc->get_name();
Пример #26
0
 public function execute(\FrameResponseObject $frameResponseObject)
 {
     //var_dump($request);
     $current_user = \lms_steam::get_current_user();
     //var_dump($current_user);die;
     $name = $this->id;
     if ($name != "") {
         //$userName = $path[2];
         $user = \steam_factory::get_user($GLOBALS["STEAM"]->get_id(), $name);
     } else {
         $user = $current_user;
     }
     $login = $user->get_name();
     $cache = get_cache_function($login, 3600);
     //$portal = \lms_portal::get_instance();
     //$portal->set_page_title( $login );
     $user_profile = $cache->call("lms_steam::user_get_profile", $login);
     $html_handler_profile = new \koala_html_profile($user);
     $html_handler_profile->set_context("profile");
     $GLOBALS["content"] = \Profile::getInstance()->loadTemplate("profile_display.template.html");
     //$content = new HTML_TEMPLATE_IT();
     //$content->loadTemplateFile( PATH_TEMPLATES . "profile_display.template.html" );
     if (!empty($user_profile["USER_PROFILE_DSC"])) {
         $GLOBALS["content"]->setVariable("HTML_CODE_DESCRIPTION", "<p>" . get_formatted_output($user_profile["USER_PROFILE_DSC"]) . "</p>");
     }
     if (!empty($user_profile["USER_PROFILE_WEBSITE_URI"])) {
         $website_name = h(empty($user_profile["USER_PROFILE_WEBSITE_NAME"]) ? $user_profile["USER_PROFILE_WEBSITE_URI"] : $user_profile["USER_PROFILE_WEBSITE_NAME"]);
         $GLOBALS["content"]->setVariable("HTML_CODE_PERSONAL_WEBSITE", "<br/><b>" . gettext("Website") . ":</b> <a href=\"" . h($user_profile["USER_PROFILE_WEBSITE_URI"]) . "\" target=\"_blank\">{$website_name}</a>");
     }
     //get Buddys from user and put them into the $globals-Array for authorization-query
     $confirmed = $user->get_id() != $current_user->get_id() ? TRUE : FALSE;
     $contacts = $cache->call("lms_steam::user_get_buddies", $login, $confirmed);
     $tmp = array();
     foreach ($contacts as $contact) {
         $tmp[] = $contact["OBJ_ID"];
     }
     $GLOBALS["contact_ids"] = $tmp;
     //get Viewer-Authorization and put them into the $globals-Array for authorization-query
     $user_privacy = $cache->call("lms_steam::user_get_profile_privacy", $user->get_name());
     $GLOBALS["authorizations"] = $user_privacy;
     $GLOBALS["current user"] = $current_user;
     //$GLOBALS["content"] = $content;
     ///////////////////////////////////////////////////
     //////////////  GENERAL INFORMATION  //////////////
     ///////////////////////////////////////////////////
     // Status
     if (ENABLED_BID_DESCIPTION) {
         $user_profile_desc = $user_profile["OBJ_DESC"];
         $status = secure_gettext($user_profile_desc);
         if ($status != "" && !is_integer($status)) {
             $this->display("GENERAL", "Beschreibung", $status);
         }
     }
     if (ENABLED_STATUS) {
         $user_profile_desc = empty($user_profile["OBJ_DESC"]) ? "student" : $user_profile["OBJ_DESC"];
         $status = secure_gettext($user_profile_desc);
         $this->display("GENERAL", "Status", $status);
     }
     if (ENABLED_EMAIL) {
         $user_email = empty($user_profile["USER_EMAIL"]) ? "keine E-Mail-Adresse gesetzt" : $user_profile["USER_EMAIL"];
         $this->display("GENERAL", "E-Mail-Adresse", h($user_email));
     }
     if (ENABLED_BID_EMAIL) {
         $helper = empty($user_profile["USER_EMAIL"]) ? true : false;
         $user_email = empty($user_profile["USER_EMAIL"]) ? "keine E-Mail-Adresse gesetzt" : $user_profile["USER_EMAIL"];
         if ($helper) {
             $this->display("GENERAL", "E-Mail", h($user_email));
         } else {
             $mail = h($user_profile["USER_EMAIL"]);
             $mail1 = '<a href="mailto:' . $mail . '">' . $mail . '</a>';
             //var_dump($mail1);die;
             $this->display("GENERAL", "E-Mail", $mail1);
         }
     }
     // Gender
     if (ENABLED_GENDER) {
         switch (is_string($user_profile["USER_PROFILE_GENDER"]) ? $user_profile["USER_PROFILE_GENDER"] : "X") {
             case "F":
                 $gender = gettext("female");
                 break;
             case "M":
                 $gender = gettext("male");
                 break;
             default:
                 $gender = gettext("rather not say");
                 break;
         }
         $this->display("GENERAL", "Gender", $gender);
     }
     // Origin - Faculty
     if (ENABLED_FACULTY) {
         $faculty = \lms_steam::get_faculty_name($user_profile["USER_PROFILE_FACULTY"]);
         $this->display("GENERAL", "Origin", $faculty);
     }
     if (ENABLED_WANTS) {
         $this->display("GENERAL", "Wants", h($user_profile["USER_PROFILE_WANTS"]));
     }
     if (ENABLED_HAVES) {
         $this->display("GENERAL", "Haves", h($user_profile["USER_PROFILE_HAVES"]));
     }
     if (ENABLED_ORGANIZATIONS) {
         $this->display("GENERAL", "Organizations", h($user_profile["USER_PROFILE_ORGANIZATIONS"]));
     }
     if (ENABLED_HOMETOWN) {
         $this->display("GENERAL", "Hometown", h($user_profile["USER_PROFILE_HOMETOWN"]));
     }
     if (ENABLED_MAIN_FOCUS) {
         $this->display("GENERAL", "Main focus", h($user_profile["USER_PROFILE_FOCUS"]));
     }
     if (ENABLED_OTHER_INTERESTS) {
         $this->display("GENERAL", "Other interests", h($user_profile["USER_PROFILE_OTHER_INTERESTS"]));
     }
     // LANGUAGE
     if (ENABLED_BID_LANGUAGE) {
         $this->display("GENERAL", "Language", $user_profile["USER_LANGUAGE"]);
     }
     if (ENABLED_LANGUAGES) {
         $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"));
         $ulang = $user_profile["USER_LANGUAGE"];
         if (!is_string($ulang) || $ulang === "0") {
             $ulang = LANGUAGE_DEFAULT_STEAM;
         }
         if (!array_key_exists($ulang, $languages)) {
             $ulang = LANGUAGE_DEFAULT_STEAM;
         }
         $language_string = "";
         foreach ($languages as $key => $language) {
             if ($ulang == $key) {
                 $language_string .= "<img class=\"flag\" src=\"" . PATH_EXTENSIONS . "/profile/asset/icons/images/" . $language["icon"] . "\" title=\"" . $language["name"] . "\" />";
             }
         }
         $this->display("GENERAL", "Language", $language_string);
     }
     if ($this->GENERAL_displayed) {
         $GLOBALS["content"]->setVariable("HEADER_GENERAL_INFORMATION", gettext("General Information"));
     }
     ///////////////////////////////////////////////////
     ///////////////  CONTACTS & GROUPS  ///////////////
     ///////////////////////////////////////////////////
     // CONTACTS
     if (ENABLED_CONTACTS) {
         $html_code_contacts = "";
         $max_contacts = $counter = 25;
         if (count($contacts) > 0) {
             foreach ($contacts as $id => $contact) {
                 if ($counter > 0) {
                     $title = !empty($contact["USER_ACADEMIC_TITLE"]) ? $contact["USER_ACADEMIC_TITLE"] . " " : "";
                     $html_code_contacts .= "<a href=\"" . PATH_URL . "profile/" . $contact["OBJ_NAME"] . "/\">" . $title . $contact["USER_FIRSTNAME"] . " " . $contact["USER_FULLNAME"] . "</a>";
                     $html_code_contacts .= $id == count($contacts) - 1 || $counter == 1 ? "" : ", ";
                     $counter--;
                 } else {
                     $html_code_contacts .= " <a href=\"" . PATH_URL . "profile/{$login}/contacts/\">(" . gettext("more") . "...)</a>";
                     break;
                 }
             }
         } else {
             $html_code_contacts = gettext("No contacts yet.");
         }
         $this->display("CONTACTS_AND_GROUPS", "Contacts", $html_code_contacts);
     }
     if (ENABLED_GROUPS) {
         // GROUPS
         $public = $user->get_id() != $current_user->get_id() ? TRUE : FALSE;
         $groups = $cache->call("lms_steam::user_get_groups", $login, $public);
         $html_code_groups = "";
         $max_groups = $counter = 25;
         if (count($groups) > 0) {
             usort($groups, "sort_objects");
             foreach ($groups as $id => $group) {
                 if ($counter > 0) {
                     $html_code_groups .= "<a href=\"" . PATH_URL . "groups/" . $group["OBJ_ID"] . "/\">" . h($group["OBJ_NAME"]) . "</a>";
                     $html_code_groups .= $id == count($groups) - 1 || $counter == 1 ? "" : ", ";
                     $counter--;
                 } else {
                     $html_code_groups .= " <a href=\"" . PATH_URL . "profile/{$login}/groups/\">(" . gettext("more") . "...)</a>";
                     break;
                 }
             }
         } else {
             $html_code_groups = gettext("No memberships yet.");
         }
         $this->display("CONTACTS_AND_GROUPS", "Groups", $html_code_groups);
     }
     if ($this->CONTACTS_AND_GROUPS_displayed) {
         $GLOBALS["content"]->setVariable("HEADER_CONTACTS_AND_GROUPS", gettext("Contacts and Groups"));
     }
     /////////////////////////////////////////////////////
     ///////////////  CONTACT INFORMATION  ///////////////
     /////////////////////////////////////////////////////
     $is_buddy = $user->is_buddy($current_user) || $user->get_id() == $current_user->get_id() ? TRUE : FALSE;
     if (ENABLED_EMAIL) {
         $mail = h($user_profile["USER_EMAIL"]);
         $mail1 = '<a href="mailto:"' . $mail . '">' . $mail . '</a>';
         $this->display("CONTACT_DATA", "E-mail", $mail1, $is_buddy);
     }
     if (ENABLED_ADDRESS) {
         $adress = h($user_profile["USER_PROFILE_ADDRESS"]);
         $this->display("CONTACT_DATA", "Address", $adress, $is_buddy);
     }
     if (ENABLED_BID_ADRESS) {
         $adress = h($user_profile["USER_PROFILE_ADDRESS"]);
         if (isset($adress) && !is_integer($adress) && trim($adress) != "") {
             $this->display("GENERAL", "Address", h($user_profile["USER_ADRESS"]), $is_buddy);
         }
     }
     if (ENABLED_TELEPHONE) {
         $this->display("CONTACT_DATA", "Telephone", h($user_profile["USER_PROFILE_TELEPHONE"]), $is_buddy);
     }
     if (ENABLED_BID_PHONE) {
         $phone = h($user_profile["bid:user_callto"]);
         if (isset($phone) && $phone != 0 && $phone != "") {
             $phone1 = '<a href="callto:' . $phone . '">' . $phone . '</a>';
             $this->display("GENERAL", "Telefon", $phone1, $is_buddy);
         }
     }
     if (ENABLED_PHONE_MOBILE) {
         $this->display("CONTACT_DATA", "Phone, mobile", h($user_profile["USER_PROFILE_PHONE_MOBILE"]), $is_buddy);
     }
     // Website
     $website_name = $user_profile["USER_PROFILE_WEBSITE_NAME"];
     $website_uri = $user_profile["USER_PROFILE_WEBSITE_URI"];
     if (empty($website_name)) {
         $website_name = $website_uri;
     }
     $website_link = empty($website_name) ? '' : '<a target="_blank" href="' . h($website_uri) . '">' . h($website_name) . '</a>';
     if (ENABLED_WEBSITE) {
         $this->display("CONTACT_DATA", gettext("Website"), $website_link);
     }
     if (ENABLED_ICQ_NUMBER || ENABLED_BID_IM) {
         $icq = h($user_profile["USER_PROFILE_IM_ICQ"]);
         if (isset($icq) && $icq !== 0 && $icq != "") {
             $icq1 = '<a href="http://www.icq.com/whitepages/cmd.php?uin=' . $icq . '&amp;action=add">' . $icq . '</a>';
             $this->display("CONTACT_DATA", "ICQ number", $icq1);
         }
     }
     if (ENABLED_MSN_IDENTIFICATION || ENABLED_BID_IM) {
         $msn = h($user_profile["USER_PROFILE_IM_MSN"]);
         if (isset($msn) && $msn !== 0 && $msn != "") {
             $msn1 = '<a href="http://members.msn.com/' . $msn . '">' . $msn . '</a>';
             $this->display("CONTACT_DATA", "MSN identification", $msn1);
         }
     }
     // AIM
     if (ENABLED_AIM_ALIAS || ENABLED_BID_IM) {
         if (!empty($user_profile["USER_PROFILE_IM_AIM"])) {
             $aim_alias = h($user_profile["USER_PROFILE_IM_AIM"]);
             if (isset($aim_alias) && $aim_alias !== 0 && $aim_alias != "") {
                 $aim = "<a href=\"aim:" . $aim_alias . "\">" . $aim_alias . "</a>";
                 $this->display("CONTACT_DATA", "AIM-alias", $aim);
             }
             //$aim = "<span id=\"USER_PROFILE_IM_AIM\"><a href=\"{VALUE_AIM_LINK}\">{VALUE_AIM_ALIAS}</a></span>";
         }
     }
     if (ENABLED_YAHOO_ID || ENABLED_BID_IM) {
         $yahoo = h($user_profile["USER_PROFILE_IM_YAHOO"]) !== 0 ? h($user_profile["USER_PROFILE_IM_YAHOO"]) : "";
         if (isset($yahoo) && $yahoo !== 0 && $yahoo != "") {
             $this->display("CONTACT_DATA", "Yahoo-ID", $yahoo);
         }
     }
     // Skype
     if (ENABLED_SKYPE_NAME || ENABLED_BID_IM) {
         if (!empty($user_profile["USER_PROFILE_IM_SKYPE"])) {
             $skype_alias = h($user_profile["USER_PROFILE_IM_SKYPE"]);
             if (isset($skype_alias) && $skype_alias !== 0 && $skype_alias != "") {
                 $skype = "<a href=\"skype:" . $skype_alias . "\">" . $skype_alias . "</a>";
             }
             $this->display("CONTACT_DATA", "Skype name", $skype);
         }
     }
     $GLOBALS["content"] = $GLOBALS["content"];
     if ($this->CONTACT_DATA_displayed) {
         $GLOBALS["content"]->setVariable("HEADER_CONTACT_DATA", gettext("Contact Data"));
     }
     $GLOBALS["content"]->setVariable("PATH_JAVASCRIPT", PATH_JAVASCRIPT);
     $GLOBALS["content"]->setVariable("KOALA_VERSION", KOALA_VERSION);
     $GLOBALS["content"]->setVariable("USER_LOGIN", $login);
     $html_handler_profile->set_html_left($GLOBALS["content"]->get());
     $frameResponseObject->setHeadline($html_handler_profile->get_headline());
     $rawHtml = new \Widgets\RawHtml();
     $rawHtml->setHtml($html_handler_profile->get_html());
     $frameResponseObject->addWidget($rawHtml);
     return $frameResponseObject;
 }
Пример #27
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();
}
Пример #28
0
    $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($weblog->get_name()), gettext("subscription of '%NAME' canceled."));
    header("Location: " . PATH_URL . "weblog/" . $date->get_id() . "/");
    exit;
}
$weblog_html_handler->set_menu("entry");
$weblog_html_handler->set_widget_categories();
$weblog_html_handler->set_widget_archive(5);
$entry = $date->get_attributes(array("DATE_TITLE", "DATE_DESCRIPTION", "DATE_START_DATE", "DATE_CATEGORY", "OBJ_KEYWORDS"));
$creator = $date->get_creator();
$html_entry->setVariable("VALUE_ARTICLE_TEXT", get_formatted_output(h($date->get_attribute("DATE_DESCRIPTION"))));
$html_entry->setVariable("VALUE_POSTED_BY", str_replace("%NAME", "<a href=\"" . PATH_URL . "user/" . $creator->get_name() . "/\">" . h($creator->get_attribute("USER_FIRSTNAME")) . " " . h($creator->get_attribute("USER_FULLNAME")) . "</a>", gettext("Posted by %NAME")));
$html_entry->setVariable("VALUE_DATE_TIME", strftime("%x %X", h($entry["DATE_START_DATE"])));
$category = $entry["DATE_CATEGORY"];
if (!empty($category)) {
    $html_entry->setVariable("LABEL_IN", gettext("in"));
    $html_entry->setVariable("VALUE_CATEGORY", "<a href=\"" . PATH_URL . "weblog/" . $category->get_id() . "/\">" . h($category->get_name()) . "</a>");
} else {
    $html_entry->setVariable("VALUE_CATEGORY", gettext("no category"));
}
$html_entry->setVariable("POST_PERMALINK", PATH_URL . "weblog/" . $weblog->get_id() . "/#comment" . $date->get_id());
$html_entry->setVariable("POST_PERMALINK_LABEL", gettext("permalink"));
$weblog_html_handler->set_main_html($html_entry->get() . get_comment_html($date, PATH_URL . "weblog/" . $date->get_id()));
$portal->set_rss_feed(PATH_URL . "services/feeds/weblog_public.php?id=" . OBJ_ID, gettext("Feed"), str_replace("%l", isset($login) ? $login : '', gettext("Subscribe to this forum's Newsfeed")));
$rootlink = lms_steam::get_link_to_root($weblog);
$headline = array($rootlink[0], $rootlink[1], array("link" => $rootlink[1]["link"] . "communication/", "name" => gettext("Communication")), array("name" => h($weblog->get_name()), "link" => PATH_URL . "weblog/" . $weblog->get_id() . "/"), array("link" => "", "name" => h($date->get_attribute("DATE_TITLE"))));
Пример #29
0
$main_tnr["can_write"] = $container->check_access_write($user, TRUE);
$main_tnr["inventory"] = $koala_container->get_inventory_paginated($start, $nr_show, $sort, TRUE);
$main_result = $GLOBALS["STEAM"]->buffer_flush();
$pagination_info = $main_result[$main_tnr["inventory"]];
$inventory = $pagination_info['objects'];
$desc = $main_result[$main_tnr[OBJ_DESC]];
// don't show description for user clipboards (which would be the user description) or workrooms:
if (is_string($desc) && ($container instanceof steam_user || is_object($creator = $main_result[$main_tnr["creator"]]) && $creator->get_name() . "s workroom" == $desc)) {
    $desc = FALSE;
}
if (is_string($desc)) {
    $content->setVariable("VALUE_CONTAINER_DESC", h($desc));
}
$long_desc = $main_result[$main_tnr["OBJ_LONG_DESC"]];
if (is_string($long_desc)) {
    $content->setVariable("VALUE_CONTAINER_LONG_DESC", get_formatted_output($long_desc));
}
$can_write = $main_result[$main_tnr["can_write"]];
// don't show clipboard when viewing clipboard contents as a folder:
if (!$container->get_root_environment() instanceof steam_user) {
    //clipboard:
    $koala_user = new koala_html_user($user);
    $clipboard_menu = $koala_user->get_clipboard_menu($koala_container);
    if (CLIPBOARD) {
        $content->setCurrentBlock("BLOCK_CLIPBOARD");
        $content->setVariable("CLIPBOARD_HTML", $clipboard_menu->get_html());
        $content->parse("BLOCK_CLIPBOARD");
    }
}
if (!is_array($inventory) || count($inventory) == 0) {
    $content->setCurrentBlock("BLOCK_EMPTY_INVENTORY");
Пример #30
0
$annotations = lms_steam::get_annotations($thread->get_id());
$annotations = array_reverse($annotations);
$access_tnr = array();
foreach ($annotations as $annotation) {
    $steam_obj = steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $annotation["OBJ_ID"], CLASS_OBJECT);
    $access_tnr[$steam_obj->get_id()] = $steam_obj->check_access_write($steam_user, TRUE);
}
$access_result = $GLOBALS["STEAM"]->buffer_flush();
foreach ($annotations as $annotation) {
    $content->setCurrentBlock("REPLY");
    $content->setVariable('REPLY_ID', $annotation['OBJ_ID']);
    $content->setVariable("REPLYER_LINK", PATH_URL . "user/" . $annotation["OBJ_CREATOR_LOGIN"] . "/");
    $content->setVariable("REPLYER_IMAGE", PATH_URL . "cached/get_document.php?id=" . $annotation["OBJ_ICON"] . "&type=usericon&width=60&height=70");
    $content->setVariable("REPLYER_SAYS_LABEL", str_replace("%n", "<a href=\"" . PATH_URL . "user/" . $annotation["OBJ_CREATOR_LOGIN"] . "/\">" . h($annotation["OBJ_CREATOR"]) . "</a>", gettext("%n says:")));
    //$content->setVariable( "REPLYERS_SAYS_LABEL", str_replace );
    $content->setVariable("REPLY_CONTENT", get_formatted_output($annotation["CONTENT"], 60, "\n"));
    $content->setVariable("REPLY_TS", how_long_ago($annotation["OBJ_CREATION_TIME"]));
    $content->setVariable("REPLY_PERMALINK", PATH_URL . 'forums/' . $thread->get_id() . '/#comment' . $annotation['OBJ_ID']);
    $content->setVariable("REPLY_PERMALINK_TEXT", gettext("permalink"));
    $steam_obj = steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $annotation["OBJ_ID"], CLASS_OBJECT);
    if ($access_result[$access_tnr[$steam_obj->get_id()]]) {
        $content->setCurrentBlock("BLOCK_OWN_REPLY");
        $content->setVariable("REPLY_LINK_DELETE", PATH_URL . "forums/" . $thread->get_id() . "/deletecomment" . $annotation["OBJ_ID"] . "/");
        $content->setVariable("REPLY_LABEL_DELETE", gettext("delete"));
        $content->setVariable("REPLY_LABEL_EDIT", gettext("edit"));
        $content->setVariable("REPLY_LINK_EDIT", PATH_URL . "forums/" . $thread->get_id() . "/editcomment" . $annotation["OBJ_ID"] . "/");
        $content->parse("BLOCK_OWN_REPLY");
    }
    $content->parse("REPLY");
}
$content->setVariable("LABEL_BB_BOLD", gettext("B"));