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; }
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; }
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; }
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); $_SESSION["confirmation"] = str_replace("%NAME", h($weblog->get_name()), gettext("subscription of '%NAME' canceled.")); header("Location: " . PATH_URL . "weblog/" . $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); $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()); $portal->show_html();
<?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();