Example #1
0
require_once PATH_LIB . "format_handling.inc.php";
//lms_steam::connect(); //http_auth function is used instead
require_once PATH_LIB . "http_auth_handling.inc.php";
if (http_auth()) {
    if (!($object = steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $_GET["id"]))) {
        include PATH_PUBLIC . "bad_link.php";
        exit;
    }
    $forum = $object;
    if (is_object($object) && !$object instanceof steam_container) {
        // Generate the RSS from an entry of a weblog
        $rss_channel = new RssChannel($forum->get_attribute("DATE_TITLE"), PATH_URL . "weblog/" . $_GET["id"] . "/", "");
        $rss_channel->generate_http_header();
        print $rss_channel->generate_xml_header();
        $max_items = 20;
        $discussion = lms_weblog::get_item_data($object);
        print $rss_channel->generate_item($discussion["OBJ_NAME"] . " " . gettext("by") . " " . $discussion["AUTHOR"], "", BBCode($discussion["CONTENT"]), $discussion["AUTHOR"], $discussion["DATE_START_DATE"], "", PATH_URL . "weblog/" . $_GET["id"] . "/#comment" . $discussion["OBJ_ID"]);
        $cache = get_cache_function($_GET["id"], 600);
        $discussions = $cache->call("lms_steam::get_annotations", $_GET["id"]);
        while ((list($id, $discussion) = each($discussions)) && $max_items > 0) {
            print $rss_channel->generate_item(gettext("Comment by ") . $discussion["OBJ_CREATOR"], "", BBCode($discussion["CONTENT"]), $discussion["OBJ_CREATOR"], $discussion["OBJ_CREATION_TIME"], "", PATH_URL . "weblog/" . $_GET["id"] . "/#comment" . $forum->get_id());
            $max_items--;
        }
        print $rss_channel->generate_xml_footer();
    } else {
        // Generate RSS for the Weblog container
        $rss_channel = new RssChannel($forum->get_name(), PATH_URL . "weblog/" . $_GET["id"] . "/", "");
        $rss_channel->generate_http_header();
        print $rss_channel->generate_xml_header();
        $cache = get_cache_function($_GET["id"], 600);
        $discussions = $cache->call("lms_weblog::get_items", $_GET["id"]);
Example #2
0
 public function execute(\FrameResponseObject $frameResponseObject)
 {
     $timestamp = $this->params[1];
     //$portal = \lms_portal::get_instance();
     //$portal->initialize( GUEST_NOT_ALLOWED );
     $user = \lms_steam::get_current_user();
     //$path = $request->getPath();
     $STEAM = $GLOBALS["STEAM"];
     $weblogId = $this->params[0];
     $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"], $categories->get_environment()->get_id());
         } elseif ($weblog instanceof \steam_date) {
             $date = $weblog;
             $weblog = new \steam_weblog($GLOBALS["STEAM"], $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);
         }
     }
     $weblog_html_handler = new \lms_weblog($weblog);
     $weblog_html_handler->set_widget_categories();
     $weblog_html_handler->set_widget_archive();
     $first_of_month = $timestamp;
     $last_of_month = strtotime("-1 day", strtotime("+1 month", $first_of_month));
     $date_objects = $weblog->get_date_objects((int) $first_of_month, (int) $last_of_month);
     // $date_objects = $weblog->get_date_objects( );
     $no_entries = count($date_objects);
     //TODO: PAGINATOR REINKNALLEN
     $pageIterator = \lms_portal::get_paginator(5, $no_entries, gettext("%TOTAL entries in this archive."));
     //$content->setVariable("PAGEITERATOR", $pageIterator["html"]);
     $start = $pageIterator["startIndex"];
     //$start = $portal->set_paginator( 5, $no_entries, gettext( "%TOTAL entries in this archive." ) );
     $end = $start + 5 > $no_entries ? $no_entries : $start + 5;
     $weblog_html_handler->print_entries($date_objects, TRUE);
     //$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" => strftime("%B %G", $timestamp)));
     //$portal->set_page_main(
     //	$headline,
     //	$weblog_html_handler->get_html()
     //);
     $frameResponseObject->setHeadline($headline);
     $widget = new \Widgets\RawHtml();
     $widget->setHtml($weblog_html_handler->get_html());
     $frameResponseObject->addWidget($widget);
     return $frameResponseObject;
 }
Example #3
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;
 }
Example #4
0
            $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 {
Example #5
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;
 }
Example #6
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;
     //}
     $category = $weblog;
     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);
         defined("OBJ_ID") or define("OBJ_ID", $weblogId);
         if (!$weblog->check_access_read($user)) {
             throw new \Exception("No rights to view this.", E_USER_RIGHTS);
         }
     }
     $weblog_html_handler = new \lms_weblog($weblog);
     $weblog_html_handler->set_menu("category");
     $weblog_html_handler->set_widget_categories();
     $weblog_html_handler->set_widget_archive(5);
     $link_objects = $category->get_inventory(CLASS_LINK);
     $no_entries = count($link_objects);
     $end = $no_entries;
     $start = 0;
     $date_objects = array();
     for ($i = $start; $i < $end; $i++) {
         $date_objects[] = $link_objects[$i]->get_source_object();
     }
     usort($date_objects, "sort_dates");
     //sort_dates defined in steam_calendar.class
     $weblog_html_handler->print_entries($date_objects);
     //TODO: Login korrekt ersetzen
     $login = "";
     //	$portal->set_rss_feed( PATH_URL . "services/feeds/weblog_public.php?id=" . OBJ_ID , gettext( "Feed" ), str_replace( "%l", $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($category->get_name())));
     /*$portal->set_page_main(
     		$headline,
     		$weblog_html_handler->get_html()
     		);
     		return $portal->get_html();
     	*/
     $frameResponseObject->setHeadline($headline);
     $widget = new \Widgets\RawHtml();
     $widget->setHtml($weblog_html_handler->get_html());
     $frameResponseObject->addWidget($widget);
     return $frameResponseObject;
 }
Example #7
0
<?php

require_once PATH_LIB . "format_handling.inc.php";
require_once PATH_LIB . "comments_handling.inc.php";
$html_entry = new HTML_TEMPLATE_IT();
$html_entry->loadTemplateFile(PATH_TEMPLATES . "weblog_entry.template.html");
$weblog_html_handler = new lms_weblog($weblog);
if (isset($_GET["action"]) && $_GET["action"] == "bookmark_rss") {
    lms_steam::user_add_rssfeed($weblog->get_id(), PATH_URL . "services/feeds/weblog_public.php?id=" . $weblog->get_id(), "weblog", lms_steam::get_link_to_root($weblog));
    $_SESSION["confirmation"] = str_replace("%NAME", h($weblog->get_name()), gettext("You are keeping an eye on '%NAME' from now on."));
    header("Location: " . PATH_URL . "weblog/" . $date->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($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();
Example #8
0
 public function execute(\FrameResponseObject $frameResponseObject)
 {
     //if (!defined("OBJ_ID")) define( "OBJ_ID", $weblog->get_id() );
     $weblogId = $this->id;
     $weblog = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $weblogId);
     if (!defined("OBJ_ID")) {
         define("OBJ_ID", $weblog->get_id());
     }
     $env = $weblog->get_environment();
     $grp = $env->get_creator();
     if ($grp->get_name() == "learners" && $grp->get_attribute(OBJ_TYPE) == "course_learners") {
         $grp = $grp->get_parent_group();
     }
     $accessmergel = FALSE;
     if (isset($weblog) && is_object($weblog)) {
         $creator = $weblog->get_creator();
         if ($weblog->get_attribute(KOALA_ACCESS) == PERMISSION_UNDEFINED && \lms_steam::get_current_user()->get_id() != $creator->get_id() && !\lms_steam::is_koala_admin(lms_steam::get_current_user())) {
             $accessmergel = TRUE;
         }
     }
     $backlink = empty($_POST["values"]["backlink"]) ? $_SERVER["HTTP_REFERER"] : $_POST["values"]["backlink"];
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         $values = $_POST["values"];
         if (get_magic_quotes_gpc()) {
             if (!empty($values['name'])) {
                 $values['name'] = stripslashes($values['name']);
             }
             if (!empty($values['dsc'])) {
                 $values['dsc'] = stripslashes($values['dsc']);
             }
         }
         if (empty($values["name"])) {
             $problems = gettext("The name of the weblog is missing.");
             $hints = gettext("Please type in a name.");
         }
         if (strpos($values["name"], "/")) {
             if (!isset($problems)) {
                 $problems = "";
             }
             $problems .= gettext("Please don't use the \"/\"-char in the name of the weblog.");
         }
         if (empty($problems)) {
             $group_members = $grp;
             $group_admins = 0;
             $group_staff = 0;
             // check if group is a course
             $grouptype = (string) $grp->get_attribute("OBJ_TYPE");
             if ($grouptype == "course") {
                 $group_staff = \steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), $grp->get_groupname() . ".staff");
                 $group_admins = \steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), $grp->get_groupname() . ".admins");
                 $group_members = \steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), $grp->get_groupname() . ".learners");
                 $workroom = $group_members->get_workroom();
             } else {
                 $workroom = $grp->get_workroom();
             }
             if (!isset($weblog) || !is_object($weblog)) {
                 $weblog_new = \steam_weblog::create_steam_structure($GLOBALS["STEAM"], $values["name"], $values["dsc"], $env);
                 $_SESSION["confirmation"] = str_replace("%NAME", h($values["name"]), gettext("New weblog '%NAME' created."));
             } else {
                 $weblog->set_attribute(OBJ_NAME, $values["name"]);
                 $weblog->set_attribute(OBJ_DESC, $values["dsc"]);
                 $frameResponseObject->setConfirmText(gettext("The changes have been saved."));
                 //$portal->set_confirmation( gettext( "The changes have been saved." ));
                 $weblog_new = $weblog;
             }
             //var_dump($weblog_new);die;
             $koala_weblog = new \lms_weblog($weblog_new);
             $access = (int) $values["access"];
             //var_dump($access);
             $access_descriptions = \lms_weblog::get_access_descriptions($grp);
             //var_dump(!$accessmergel);die;
             //if (!$accessmergel) $koala_weblog->set_access( $access, $access_descriptions[$access]["members"] , $access_descriptions[$access]["steam"], $group_members, $group_staff, $group_admins );
             // HIER DER NEUE CODE::ENDE
             $GLOBALS["STEAM"]->buffer_flush();
             $cache = get_cache_function(\lms_steam::get_current_user()->get_name(), 600);
             $cache->drop("lms_steam::get_inventory_recursive", $workroom->get_id(), CLASS_CALENDAR, array("WEBLOG_LANGUAGE"));
             $cache->drop("lms_steam::get_group_communication_objects", $workroom->get_id(), CLASS_MESSAGEBOARD | CLASS_CALENDAR | CLASS_CONTAINER | CLASS_ROOM);
             if (!isset($weblog) || !is_object($weblog)) {
                 header("Location: " . $backlink);
                 exit;
             }
         } else {
             //TODO:PROBLEMDESCRIPTION
             //$portal->set_problem_description( $problems, isset($hints)?$hints:"" );
         }
     }
     $content = \Weblog::getInstance()->loadTemplate("object_new.template.html");
     //$content = new HTML_TEMPLATE_IT( PATH_TEMPLATES );
     //$content->loadTemplateFile( "object_new.template.html" );
     if (isset($weblog) && is_object($weblog)) {
         $content->setVariable("INFO_TEXT", str_replace("%NAME", h($weblog->get_name()), gettext("You are going to edit the weblog '<b>%NAME</b>'.")));
         $content->setVariable("LABEL_CREATE", gettext("Save changes"));
         $pagetitle = gettext("Preferences");
         if (empty($values)) {
             $values = array();
             $values["name"] = $weblog->get_name();
             $values["dsc"] = $weblog->get_attribute(OBJ_DESC);
             $values["access"] = $weblog->get_attribute(KOALA_ACCESS);
         }
         $breadcrumbheader = gettext("Preferences");
     } else {
         $grpname = $grp->get_attribute(OBJ_NAME);
         if ($grp->get_attribute(OBJ_TYPE) == "course") {
             $grpname = $grp->get_attribute(OBJ_DESC);
         }
         $content->setVariable("INFO_TEXT", str_replace("%ENV", h($grpname), gettext("You are going to create a new weblog in '<b>%ENV</b>'.")));
         $content->setVariable("LABEL_CREATE", gettext("Create weblog"));
         $pagetitle = gettext("Create weblog");
         $breadcrumbheader = gettext("Add new weblog");
     }
     if (!empty($values)) {
         if (!empty($values["name"])) {
             $content->setVariable("VALUE_NAME", h($values["name"]));
         }
         if (!empty($values["dsc"])) {
             $content->setVariable("VALUE_DSC", h($values["dsc"]));
         }
     }
     $content->setVariable("VALUE_BACKLINK", $backlink);
     $content->setVariable("LABEL_NAME", gettext("Name"));
     $content->setVariable("LABEL_DSC", gettext("Description"));
     $content->setVariable("LABEL_ACCESS", gettext("Access"));
     $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 ($accessmergel) {
         $mailto = "mailto:'.SUPPORT_EMAIL.'?subject=KoaLA:%20Invalid%20Access%20Rights&body=" . rawurlencode("\nLink: " . get_current_URL() . "\nCreator: " . $creator->get_identifier() . "\n");
         $content->setCurrentBlock("BLOCK_ACCESSMERGEL");
         $content->setVariable("LABEL_ACCESSMERGEL", str_replace("%MAILTO", $mailto, gettext("There is a problem with the access settings. Please <a href=\"%MAILTO\">contact the support team</a> to fix it by setting the access rights again.")));
         $content->parse("BLOCK_ACCESSMERGEL");
     } else {
         $access = \lms_weblog::get_access_descriptions($grp);
         if ((string) $grp->get_attribute("OBJ_TYPE") == "course") {
             $access_default = PERMISSION_PUBLIC;
         } else {
             $access_default = PERMISSION_PUBLIC_READONLY;
             if (is_object($weblog) && $creator->get_id() != \lms_steam::get_current_user()->get_id()) {
                 $access[PERMISSION_PRIVATE_READONLY]["label"] = str_replace("%NAME", $creator->get_name(), $access[PERMISSION_PRIVATE_READONLY]["label"]);
             } else {
                 $access[PERMISSION_PRIVATE_READONLY]["label"] = gettext("Only members can read and comment. Only you can post.");
             }
         }
         if (is_array($access)) {
             $content->setCurrentBlock("BLOCK_ACCESS");
             foreach ($access as $key => $array) {
                 if ($key != PERMISSION_UNDEFINED || isset($values) && (int) $values["access"] == PERMISSION_UNDEFINED) {
                     $content->setCurrentBlock("ACCESS");
                     $content->setVariable("LABEL", $array["summary_short"] . ": " . $array["label"]);
                     $content->setVariable("VALUE", $key);
                     if (isset($values) && $key == (int) $values["access"] || empty($values) && $key == $access_default) {
                         $content->setVariable("CHECK", "checked=\"checked\"");
                     }
                     $content->parse("ACCESS");
                 }
             }
             $content->parse("BLOCK_ACCESS");
         }
     }
     $content->setVariable("BACKLINK", "<a href=\"{$backlink}\">" . gettext("back") . "</a>");
     $rootlink = \lms_steam::get_link_to_root($grp);
     //var_dump($rootlink);die;
     $headline = array($rootlink[0], $rootlink[1], array("link" => $rootlink[1]["link"] . "communication/", "name" => gettext("Communication")));
     if (isset($weblog) && is_object($weblog)) {
         $headline[] = array("link" => PATH_URL . "weblog/index/" . $weblog->get_id() . "/", "name" => $weblog->get_name());
     }
     $headline[] = array("link" => "", "name" => $breadcrumbheader);
     //$portal->set_page_main( $headline, $content->get() );
     //$portal->set_page_title( $pagetitle );
     //return $portal->get_html();
     $frameResponseObject->setHeadline($headline);
     $frameResponseObject->setTitle($pagetitle);
     $widget = new \Widgets\RawHtml();
     $widget->setHtml($content->get());
     $frameResponseObject->addWidget($widget);
     return $frameResponseObject;
 }
Example #9
0
         $group_admins = steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), $grp->get_groupname() . ".admins");
         $group_members = steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), $grp->get_groupname() . ".learners");
         $workroom = $group_members->get_workroom();
     } else {
         $workroom = $grp->get_workroom();
     }
     if (!isset($weblog) || !is_object($weblog)) {
         $weblog_new = steam_weblog::create_steam_structure($GLOBALS["STEAM"], $values["name"], $values["dsc"], $env);
         $_SESSION["confirmation"] = str_replace("%NAME", h($values["name"]), gettext("New weblog '%NAME' created."));
     } else {
         $weblog->set_attribute(OBJ_NAME, $values["name"]);
         $weblog->set_attribute(OBJ_DESC, $values["dsc"]);
         $portal->set_confirmation(gettext("The changes have been saved."));
         $weblog_new = $weblog;
     }
     $koala_weblog = new lms_weblog($weblog_new);
     $access = (int) $values["access"];
     $access_descriptions = lms_weblog::get_access_descriptions($grp);
     if (!$accessmergel) {
         $koala_weblog->set_access($access, $access_descriptions[$access]["members"], $access_descriptions[$access]["steam"], $group_members, $group_staff, $group_admins);
     }
     // HIER DER NEUE CODE::ENDE
     $GLOBALS["STEAM"]->buffer_flush();
     $cache = get_cache_function(lms_steam::get_current_user()->get_name(), 600);
     $cache->drop("lms_steam::get_inventory_recursive", $workroom->get_id(), CLASS_CALENDAR, array("WEBLOG_LANGUAGE"));
     $cache->drop("lms_steam::get_group_communication_objects", $workroom->get_id(), CLASS_MESSAGEBOARD | CLASS_CALENDAR | CLASS_CONTAINER | CLASS_ROOM);
     if (!isset($weblog) || !is_object($weblog)) {
         header("Location: " . $backlink);
         exit;
     }
 } else {
Example #10
0
<?php

$weblog_html_handler = new lms_weblog($weblog);
$weblog_html_handler->set_menu("entries");
$grp = $weblog->get_environment()->get_creator();
steam_factory::load_attributes($GLOBALS["STEAM"]->get_id(), array($grp), array(OBJ_NAME, OBJ_TYPE));
if ($grp->get_name() == "learners" && $grp->get_attribute(OBJ_TYPE) == "course_learners") {
    $grp = $grp->get_parent_group();
}
$weblog_html_handler->set_widget_categories();
$all_date_objects = $weblog->get_date_objects();
usort($all_date_objects, "sort_dates");
//sort_dates defined in steam_calendar.class
$weblog_html_handler->set_widget_archive(5);
$weblog_html_handler->set_widget_blogroll();
$weblog_html_handler->set_widget_access($grp);
if (isset($_GET["action"]) && $_GET["action"] == "bookmark_rss") {
    lms_steam::user_add_rssfeed($weblog->get_id(), PATH_URL . "services/feeds/weblog_public.php?id=" . $weblog->get_id(), "weblog", lms_steam::get_link_to_root($weblog));
    $_SESSION["confirmation"] = str_replace("%NAME", h($weblog->get_name()), gettext("You are keeping an eye on '%NAME' from now on."));
    header("Location: " . PATH_URL . "weblog/" . $weblog->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);
Example #11
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;
     //}
     defined("OBJ_ID") or define("OBJ_ID", $weblogId);
     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);
         }
     }
     $html_entry = \Weblog::getInstance()->loadTemplate("weblog_entry.template.html");
     //$html_entry = new HTML_TEMPLATE_IT();
     //$html_entry->loadTemplateFile( PATH_TEMPLATES . "weblog_entry.template.html" );
     $weblog_html_handler = new \lms_weblog($weblog);
     if (isset($_GET["action"]) && $_GET["action"] == "bookmark_rss") {
         \lms_steam::user_add_rssfeed($weblog->get_id(), PATH_URL . "services/feeds/weblog_public.php?id=" . $weblog->get_id(), "weblog", \lms_steam::get_link_to_root($weblog));
         $_SESSION["confirmation"] = str_replace("%NAME", h($weblog->get_name()), gettext("You are keeping an eye on '%NAME' from now on."));
         header("Location: " . PATH_URL . "weblog/" . $date->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($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);
     $date = $weblog;
     $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() . self::get_comment_html($date, PATH_URL . "weblog/" . $date->get_id()));
     //TODO:RSS_FEED
     //$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"))));
     /*$portal->set_page_main(
     	 $headline,
     	 $weblog_html_handler->get_html()
     	 );
     	 $portal->show_html();*/
     $frameResponseObject->setHeadline($headline);
     $widget = new \Widgets\RawHtml();
     $widget->setHtml($weblog_html_handler->get_html());
     $frameResponseObject->addWidget($widget);
     return $frameResponseObject;
 }
Example #12
0
 public function set_widget_access($grp)
 {
     $access_descriptions = lms_weblog::get_access_descriptions($grp);
     $act_access = $this->steam_weblog->get_attribute(KOALA_ACCESS);
     $access_descriptions = $access_descriptions[$act_access];
     $access = $access_descriptions["summary_short"] . ": " . $access_descriptions["label"];
     if ($act_access == PERMISSION_PRIVATE_READONLY) {
         $creator = $this->steam_weblog->get_creator();
         if ($creator->get_id() != lms_steam::get_current_user()->get_id()) {
             $access = str_replace("%NAME", $creator->get_name(), $access);
         } else {
             $access = gettext("Only members can read and comment. Only you can post.");
         }
     }
     $t = Weblog::getInstance()->loadTemplate("widget_weblog_access.template.html");
     //$t = new HTML_TEMPLATE_IT();
     //$t->loadTemplateFile( PATH_EXTENSIONS . "weblog/ui/html/widget_weblog_access.template.html" );
     $t->setCurrentBlock("BLOCK_ACCESS");
     $t->setVariable("LABEL_ACCESS", $access);
     $t->parse("BLOCK_ACCESS");
     $this->set_widget_html(gettext("Access"), $t->get());
 }
Example #13
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->params[0];
     if (!defined("OBJ_ID")) {
         define("OBJ_ID", $weblogId);
     }
     $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 {
             header("location: /404/");
             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);
         }
     }
     $weblog_html_handler = new \lms_weblog($weblog);
     //var_dump($weblog_html_handler);die;
     $weblog_html_handler->set_menu("entries");
     $grp = $weblog->get_environment()->get_creator();
     \steam_factory::load_attributes($GLOBALS["STEAM"]->get_id(), array($grp), array(OBJ_NAME, OBJ_TYPE));
     if ($grp->get_name() == "learners" && $grp->get_attribute(OBJ_TYPE) == "course_learners") {
         $grp = $grp->get_parent_group();
     }
     $weblog_html_handler->set_widget_categories();
     $all_date_objects = $weblog->get_date_objects();
     usort($all_date_objects, "sort_dates");
     //sort_dates defined in steam_calendar.class
     $weblog_html_handler->set_widget_archive(5);
     $weblog_html_handler->set_widget_blogroll();
     $weblog_html_handler->set_widget_access($grp);
     if (isset($_GET["action"]) && $_GET["action"] == "bookmark_rss") {
         \lms_steam::user_add_rssfeed($weblog->get_id(), PATH_URL . "services/feeds/weblog_public.php?id=" . $weblog->get_id(), "weblog", lms_steam::get_link_to_root($weblog));
         $_SESSION["confirmation"] = str_replace("%NAME", h($weblog->get_name()), gettext("You are keeping an eye on '%NAME' from now on."));
         header("Location: " . PATH_URL . "weblog/index/" . $weblog->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($weblog->get_name()), gettext("subscription of '%NAME' canceled."));
         header("Location: " . PATH_URL . "weblog/index/" . $weblog->get_id() . "/");
         exit;
     }
     //TODO what is the reason for this structure?
     switch (TRUE) {
         case isset($date) && $date:
             $weblog_html_handler->print_entries(array($date), FALSE);
             break;
         default:
             $weblog_html_handler->print_entries($all_date_objects);
             break;
     }
     $weblog_html_handler->set_podcast_link();
     //$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);
     //var_dump($rootlink);die;
     //var_dump($rootlink);die;
     $headline = array($rootlink[0], $rootlink[1], array("link" => $rootlink[1]["link"] . "communication/", "name" => gettext("Communication")), array("link" => "", "name" => h($weblog->get_name())));
     //$portal->set_page_main(
     //$headline,
     //$weblog_html_handler->get_html()
     //);
     //var_dump($portal);die;
     //return $portal->get_html();
     $frameResponseObject->setHeadline($headline);
     $widget = new \Widgets\RawHtml();
     $widget->setHtml($weblog_html_handler->get_html());
     $frameResponseObject->addWidget($widget);
     return $frameResponseObject;
 }
Example #14
0
<?php

require_once PATH_LIB . "format_handling.inc.php";
$weblog_html_handler = new lms_weblog($weblog);
$weblog_html_handler->set_menu("category");
$weblog_html_handler->set_widget_categories();
$weblog_html_handler->set_widget_archive(5);
$link_objects = $category->get_inventory(CLASS_LINK);
$no_entries = count($link_objects);
$end = $no_entries;
$start = 0;
$date_objects = array();
for ($i = $start; $i < $end; $i++) {
    $date_objects[] = $link_objects[$i]->get_source_object();
}
usort($date_objects, "sort_dates");
//sort_dates defined in steam_calendar.class
$weblog_html_handler->print_entries($date_objects);
$portal->set_rss_feed(PATH_URL . "services/feeds/weblog_public.php?id=" . OBJ_ID, gettext("Feed"), str_replace("%l", $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($category->get_name())));
$portal->set_page_main($headline, $weblog_html_handler->get_html());
$portal->show_html();