当前位置: 首页>>代码示例>>PHP>>正文


PHP get_formatted_output函数代码示例

本文整理汇总了PHP中get_formatted_output函数的典型用法代码示例。如果您正苦于以下问题:PHP get_formatted_output函数的具体用法?PHP get_formatted_output怎么用?PHP get_formatted_output使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了get_formatted_output函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get_cache_function

            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());
开发者ID:rolwi,项目名称:koala,代码行数:31,代码来源:user_profile.php

示例2: frameResponse

 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());
//.........这里部分代码省略.........
开发者ID:rolwi,项目名称:koala,代码行数:101,代码来源:Index.class.php

示例3: frameResponse

 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();
//.........这里部分代码省略.........
开发者ID:rolwi,项目名称:koala,代码行数:101,代码来源:EditComment.class.php

示例4: frameResponse

 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 {
//.........这里部分代码省略.........
开发者ID:rolwi,项目名称:koala,代码行数:101,代码来源:Communication.class.php

示例5: execute

    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);
//.........这里部分代码省略.........
开发者ID:rolwi,项目名称:koala,代码行数:101,代码来源:Editentry.class.php

示例6: execute

 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"];
//.........这里部分代码省略.........
开发者ID:rolwi,项目名称:koala,代码行数:101,代码来源:Communication.class.php

示例7: execute

 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"));
//.........这里部分代码省略.........
开发者ID:rolwi,项目名称:koala,代码行数:101,代码来源:Entryedit.class.php

示例8: execute

 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;
 }
开发者ID:rolwi,项目名称:koala,代码行数:80,代码来源:Entrydelete.class.php

示例9: gettext

$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();
开发者ID:rolwi,项目名称:koala,代码行数:31,代码来源:event_details.php

示例10: HTML_TEMPLATE_IT

<?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);
开发者ID:rolwi,项目名称:koala,代码行数:31,代码来源:forum_all_topics.php

示例11: frameResponse

 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);
//.........这里部分代码省略.........
开发者ID:rolwi,项目名称:koala,代码行数:101,代码来源:ViewDiscussion.class.php

示例12: frameResponse

 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?");
         }
//.........这里部分代码省略.........
开发者ID:rolwi,项目名称:koala,代码行数:101,代码来源:NewDiscussion.class.php

示例13: str_replace

}
$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();
开发者ID:rolwi,项目名称:koala,代码行数:31,代码来源:calendar.php

示例14: print_entries

 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());
 }
开发者ID:rolwi,项目名称:koala,代码行数:85,代码来源:lms_weblog.class.php

示例15: gettext

$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"])));
开发者ID:rolwi,项目名称:koala,代码行数:31,代码来源:groups_communication.php


注:本文中的get_formatted_output函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。