Beispiel #1
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;
 }
Beispiel #2
0
        $feeds = array();
    }
    unset($feeds[$id]);
    $user->set_attribute("USER_RSS_FEEDS", $feeds);
    $_SESSION["confirmation"] = str_replace("%NAME", h($weblog->get_name()), gettext("subscription of '%NAME' canceled."));
    header("Location: " . PATH_URL . "weblog/" . $date->get_id() . "/");
    exit;
}
$weblog_html_handler->set_menu("entry");
$weblog_html_handler->set_widget_categories();
$weblog_html_handler->set_widget_archive(5);
$entry = $date->get_attributes(array("DATE_TITLE", "DATE_DESCRIPTION", "DATE_START_DATE", "DATE_CATEGORY", "OBJ_KEYWORDS"));
$creator = $date->get_creator();
$html_entry->setVariable("VALUE_ARTICLE_TEXT", get_formatted_output(h($date->get_attribute("DATE_DESCRIPTION"))));
$html_entry->setVariable("VALUE_POSTED_BY", str_replace("%NAME", "<a href=\"" . PATH_URL . "user/" . $creator->get_name() . "/\">" . h($creator->get_attribute("USER_FIRSTNAME")) . " " . h($creator->get_attribute("USER_FULLNAME")) . "</a>", gettext("Posted by %NAME")));
$html_entry->setVariable("VALUE_DATE_TIME", strftime("%x %X", h($entry["DATE_START_DATE"])));
$category = $entry["DATE_CATEGORY"];
if (!empty($category)) {
    $html_entry->setVariable("LABEL_IN", gettext("in"));
    $html_entry->setVariable("VALUE_CATEGORY", "<a href=\"" . PATH_URL . "weblog/" . $category->get_id() . "/\">" . h($category->get_name()) . "</a>");
} else {
    $html_entry->setVariable("VALUE_CATEGORY", gettext("no category"));
}
$html_entry->setVariable("POST_PERMALINK", PATH_URL . "weblog/" . $weblog->get_id() . "/#comment" . $date->get_id());
$html_entry->setVariable("POST_PERMALINK_LABEL", gettext("permalink"));
$weblog_html_handler->set_main_html($html_entry->get() . get_comment_html($date, PATH_URL . "weblog/" . $date->get_id()));
$portal->set_rss_feed(PATH_URL . "services/feeds/weblog_public.php?id=" . OBJ_ID, gettext("Feed"), str_replace("%l", isset($login) ? $login : '', gettext("Subscribe to this forum's Newsfeed")));
$rootlink = lms_steam::get_link_to_root($weblog);
$headline = array($rootlink[0], $rootlink[1], array("link" => $rootlink[1]["link"] . "communication/", "name" => gettext("Communication")), array("name" => h($weblog->get_name()), "link" => PATH_URL . "weblog/" . $weblog->get_id() . "/"), array("link" => "", "name" => h($date->get_attribute("DATE_TITLE"))));
$portal->set_page_main($headline, $weblog_html_handler->get_html());
$portal->show_html();
Beispiel #3
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;
 }
Beispiel #4
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;
 }
Beispiel #5
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;
 }