本文整理汇总了PHP中lms_steam::get_link_to_root方法的典型用法代码示例。如果您正苦于以下问题:PHP lms_steam::get_link_to_root方法的具体用法?PHP lms_steam::get_link_to_root怎么用?PHP lms_steam::get_link_to_root使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lms_steam
的用法示例。
在下文中一共展示了lms_steam::get_link_to_root方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
public function execute(\FrameResponseObject $frameResponseObject)
{
//CODE FOR ALL COMMANDS OF THIS PAKAGE END
$user = \lms_steam::get_current_user();
// Disable caching
// TODO: Work on cache handling. An enabled cache leads to bugs
// if used with the wiki.
\CacheSettings::disable_caching();
if (!($wiki_container = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id))) {
include "bad_link.php";
exit;
}
if (!$wiki_container instanceof \steam_container) {
$wiki_doc = $wiki_container;
$wiki_container = $wiki_doc->get_environment();
if ($wiki_doc->get_attribute(DOC_MIME_TYPE) != "text/wiki") {
include "bad_link.php";
exit;
}
}
//CODE FOR ALL COMMANDS OF THIS PAKAGE END
$compare = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->params[1]);
$to = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->params[2]);
$wiki_html_handler = new \lms_wiki($wiki_container);
//$wiki_html_handler->set_admin_menu( "versions", $wiki_doc );
$content = \Wiki::getInstance()->loadTemplate("wiki_version_compare.template.html");
//$content = new HTML_TEMPLATE_IT();
//$content->loadTemplateFile( PATH_TEMPLATES . "wiki_version_compare.template.html" );
$difftext = wiki_diff_html($to, $compare);
$content->setVariable("DIFF_TEXT", $difftext);
$wiki_html_handler->set_main_html($content->get());
$rootlink = \lms_steam::get_link_to_root($wiki_container);
WIKI_FULL_HEADLINE ? $headline = array($rootlink[0], $rootlink[1], array("link" => $rootlink[1]["link"] . "communication/", "name" => gettext("Communication")), array("name" => h($wiki_container->get_name()), "link" => PATH_URL . "wiki/index/" . $wiki_container->get_id() . "/"), array("link" => PATH_URL . "wiki/viewentry/" . $wiki_doc->get_id() . "/", "name" => str_replace(".wiki", "", h($wiki_doc->get_name()))), array("link" => PATH_URL . "wiki/versionoverview/" . $wiki_doc->get_id(), "name" => gettext("Version management")), array("link" => "", "name" => gettext("Version compare") . " (" . $compare->get_version() . " " . gettext("to") . " " . $to->get_version() . ")")) : ($headline = array(array("name" => h($wiki_container->get_name()), "link" => PATH_URL . "wiki/index/" . $wiki_container->get_id() . "/"), array("link" => PATH_URL . "wiki/viewentry/" . $wiki_doc->get_id() . "/", "name" => str_replace(".wiki", "", h($wiki_doc->get_name()))), array("link" => PATH_URL . "wiki/versionoverview/" . $wiki_doc->get_id() . "/versions/", "name" => gettext("Version management")), array("link" => "", "name" => gettext("Version compare") . " (" . $compare->get_version() . " " . gettext("to") . " " . $to->get_version() . ")")));
/*$portal->set_page_main(
$headline,
$wiki_html_handler->get_html()
);
$portal->show_html();
*/
$frameResponseObject->setHeadline($headline);
$widget = new \Widgets\RawHtml();
$widget->setHtml($wiki_html_handler->get_html());
$frameResponseObject->addWidget($widget);
return $frameResponseObject;
}
示例2: execute
//.........这里部分代码省略.........
if (!$wiki_container instanceof \steam_container) {
$wiki_doc = $wiki_container;
$wiki_container = $wiki_doc->get_environment();
if ($wiki_doc->get_attribute(DOC_MIME_TYPE) != "text/wiki") {
include "bad_link.php";
exit;
}
}
//CODE FOR ALL COMMANDS OF THIS PAKAGE END
defined("OBJ_ID") or define("OBJ_ID", $wiki_container->get_id());
$wiki_html_handler = new \lms_wiki($wiki_container);
$wiki_html_handler->set_admin_menu("index", $wiki_container);
$grp = $wiki_container->get_environment()->get_creator();
if ($grp->get_name() == "learners" && $grp->get_attribute(OBJ_TYPE) == "course_learners") {
$grp = $grp->get_parent_group();
}
$content = \Wiki::getInstance()->loadTemplate("wiki_entries.template.html");
//$content = new HTML_TEMPLATE_IT();
//$content->loadTemplateFile( PATH_TEMPLATES . "wiki_entries.template.html" );
$cache = get_cache_function($wiki_container->get_id(), 600);
$wiki_entries = $cache->call("lms_wiki::get_items", $wiki_container->get_id());
$recently_changed = new \LinkedList(5);
$most_discussed = new \LinkedList(5);
$latest_comments = new \LinkedList(5);
$no_wiki_entries = count($wiki_entries);
if ($no_wiki_entries > 0) {
$first_char = "";
for ($i = 0; $i < $no_wiki_entries; $i++) {
$this_char = substr(strtoupper($wiki_entries[$i]["OBJ_NAME"]), 0, 1);
if ($this_char > $first_char) {
$first_char = $this_char;
if ($i > 1) {
$content->parse("BLOCK_CHARACTER");
}
$content->setCurrentBlock("BLOCK_CHARACTER");
$content->setVariable("FIRST_CHAR", h($this_char));
}
$char_articles = array();
while ($i < $no_wiki_entries && $this_char == substr(strtoupper($wiki_entries[$i]["OBJ_NAME"]), 0, 1)) {
$char_articles[] = $wiki_entries[$i];
if ($recently_changed->can_be_added($wiki_entries[$i]["DOC_LAST_MODIFIED"])) {
$recently_changed->add_element($wiki_entries[$i]["DOC_LAST_MODIFIED"], $wiki_entries[$i]);
}
if (isset($wiki_entries[$i]["COMMENTS_NO"]) && $most_discussed->can_be_added($wiki_entries[$i]["COMMENTS_NO"]) && $wiki_entries[$i]["COMMENTS_NO"] > 1) {
$most_discussed->add_element($wiki_entries[$i]["COMMENTS_NO"], $wiki_entries[$i]);
}
if (isset($wiki_entries[$i]["COMMENTS_LAST"]) && $latest_comments->can_be_added($wiki_entries[$i]["COMMENTS_LAST"]) && $wiki_entries[$i]["COMMENTS_LAST"] > 0) {
$latest_comments->add_element($wiki_entries[$i]["COMMENTS_LAST"], $wiki_entries[$i]);
}
$i++;
}
$i--;
$no_articles_in_first_row = ceil(count($char_articles) / 2);
$content->setCurrentBlock("BLOCK_COLUMN");
for ($c = 0; $c < $no_articles_in_first_row; $c++) {
$content->setCurrentBlock("BLOCK_ARTICLE");
$content->setVariable("ARTICLE_LINK", PATH_URL . "wiki/viewentry/" . $char_articles[$c]["OBJ_ID"] . "/");
$content->setVariable("ARTICLE_NAME", str_replace(".wiki", "", h($char_articles[$c]["OBJ_NAME"])));
$content->parse("BLOCK_ARTICLE");
}
$content->parse("BLOCK_COLUMN");
$content->setCurrentBlock("BLOCK_COLUMN");
for ($c = $no_articles_in_first_row; $c < count($char_articles); $c++) {
$content->setCurrentBlock("BLOCK_ARTICLE");
$content->setVariable("ARTICLE_LINK", PATH_URL . "wiki/viewentry/" . $char_articles[$c]["OBJ_ID"] . "/");
$content->setVariable("ARTICLE_NAME", str_replace(".wiki", "", h($char_articles[$c]["OBJ_NAME"])));
$content->parse("BLOCK_ARTICLE");
}
$content->parse("BLOCK_COLUMN");
$content->parse("BLOCK_CHARACTER");
}
foreach ($wiki_entries as $entry) {
$content->setCurrentBlock("BLOCK_ARTICLE");
$content->setVariable("VALUE_WIKI_ENTRY", h($entry["OBJ_NAME"]));
$content->setVariable("LINK_WIKI_ENTRY", PATH_URL . "wiki/viewentry/" . $wiki_container->get_id() . "/" . h($entry["OBJ_NAME"]));
$content->setVariable("LABEL_LAST_MODIFICATION", gettext("last edited"));
$content->setVariable("VALUE_POSTED_BY", $entry["DOC_USER_MODIFIED"]);
$content->setVariable("POST_PERMALINK", PATH_URL . "wiki/viewentry/" . $entry["OBJ_ID"] . "/");
$content->setVariable("VALUE_DATE_TIME", strftime("%x %X", $entry["OBJ_CREATION_TIME"]));
$content->setVariable("POST_PERMALINK_LABEL", gettext("permalink"));
$content->parse("BLOCK_ARTICLE");
}
}
/* TODO: check if these functions can be deleted
$wiki_html_handler->set_widget_latest_comments( $latest_comments );
$wiki_html_handler->set_widget_last_changed( $recently_changed );
$wiki_html_handler->set_widget_most_discussed( $most_discussed );
$wiki_html_handler->set_widget_access( $grp );
*/
//TODO: SET RSS_FEEDS
WIKI_RSS ? $portal->set_rss_feed(PATH_URL . "services/feeds/wiki_public.php?id=" . OBJ_ID, gettext("Feed"), gettext("Subscribe to this forum's Newsfeed")) : "";
$wiki_html_handler->set_main_html($content->get());
$rootlink = \lms_steam::get_link_to_root($wiki_container);
WIKI_FULL_HEADLINE ? $headline = array($rootlink[0], $rootlink[1], array("link" => $rootlink[1]["link"] . "communication/", "name" => gettext("Communication")), array("link" => "", "name" => h($wiki_container->get_name()))) : ($headline = array(array("link" => "", "name" => h($wiki_container->get_name()))));
$frameResponseObject->setHeadline($headline);
$widget = new \Widgets\RawHtml();
$widget->setHtml($wiki_html_handler->get_html());
$frameResponseObject->addWidget($widget);
return $frameResponseObject;
}
示例3: gettext
if ($width > 160) {
$newHeight = (int) ($height * 160 / $width);
$newWidth = 160;
}
if ($newHeight > 80) {
$newWidth = (int) ($newWidth * 80 / $newHeight);
$newHeight = 80;
}
$content->setCurrentBlock("BLOCK_IMAGE");
$content->setVariable("IMAGE_NAME", $image->get_name());
$content->setVariable("IMAGE_ID", $image->get_id());
$content->setVariable("IMAGE_DESCRIPTION", $image->get_attribute('OBJ_DESC'));
$content->setVariable("IMAGE_LINK", PATH_URL . "get_document.php?id=" . $image->get_id() . "&width=" . $newWidth . "&height=" . $newHeight);
$content->setVariable("PREVIEW_LINK", "javascript:showBox(" . $image->get_id() . "," . $width . "," . $height . ");");
$content->setVariable("IMAGE_ACTIONS", $actions);
$content->parse("BLOCK_IMAGE");
}
}
$question = gettext("Do you really want to delete this image?");
$note = gettext("NOTE: All wiki-entries containing this image have to be updated manually!");
$content->setVariable("QUESTION", $question);
$content->setVariable("NOTE", $note);
$content->setVariable("LABEL_CLOSE", gettext("close"));
$content->setVariable("BACK_LINK", PATH_URL . "wiki/" . $wiki_container->get_id() . "/");
$content->setVariable("BACK_LABEL", gettext("back"));
$wiki_html_handler->set_main_html($content->get());
// breadcrumbs
$rootlink = lms_steam::get_link_to_root($wiki_container);
WIKI_FULL_HEADLINE ? $headline = array($rootlink[0], $rootlink[1], array("link" => $rootlink[1]["link"] . "communication/", "name" => gettext("Communication")), array("name" => h($wiki_container->get_name()), "link" => PATH_URL . "wiki/" . $wiki_container->get_id() . "/"), array("link" => "", "name" => gettext("Mediathek"))) : ($headline = array(array("name" => h($wiki_container->get_name()), "link" => PATH_URL . "wiki/" . $wiki_container->get_id() . "/"), array("link" => "", "name" => gettext("Mediathek"))));
$portal->set_page_main($headline, $wiki_html_handler->get_html());
$portal->show_html();
示例4: frameResponse
public function frameResponse(\FrameResponseObject $frameResponseObject)
{
$forum_id = $this->params[0];
$portal = \lms_portal::get_instance();
$user = \lms_steam::get_current_user();
$rss_feeds = $user->get_attribute("USER_RSS_FEEDS");
$author_id = isset($this->params[1]) ? $this->params[1] : null;
if (!($messageboard = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $forum_id))) {
include "bad_link.php";
exit;
}
if ($messageboard instanceof \steam_document) {
$thread = $messageboard;
$messageboard = $thread->get_annotating();
define("OBJ_ID", $thread->get_id());
if (!$thread->check_access_read($user)) {
throw new \Exception("No rights to view this.", E_USER_RIGHTS);
}
} else {
define("OBJ_ID", $messageboard->get_id());
if (!$messageboard->check_access_read($user)) {
throw new \Exception("No rights to view this.", E_USER_RIGHTS);
}
}
if (!$messageboard instanceof \steam_messageboard) {
include "bad_link.php";
exit;
}
$is_watching = FALSE;
if (is_array($rss_feeds)) {
foreach (array_keys($rss_feeds) as $item) {
if ($item == $messageboard->get_id()) {
$is_watching = TRUE;
}
}
}
$content = \Messageboard::getInstance()->loadTemplate("forum_all_topics.template.html");
$dsc = $messageboard->get_attribute("OBJ_DESC");
if (!empty($dsc)) {
$content->setCurrentBlock("BLOCK_DESCRIPTION");
$content->setVariable("FORUM_DESCRIPTION", get_formatted_output($dsc));
$content->parse("BLOCK_DESCRIPTION");
}
$grp = $messageboard->get_environment()->get_creator();
if ($grp->get_name() == "learners" && $grp->get_attribute(OBJ_TYPE) == "course_learners") {
$grp = $grp->get_parent_group();
}
$content->setVariable("CURRENT_DISCUSSIONS_LABEL", gettext("Current Thread"));
$content->setVariable("LABEL_SEARCH", gettext("Search"));
if (isset($_GET["action"]) && $_GET["action"] == "bookmark_rss") {
\lms_steam::user_add_rssfeed($messageboard->get_id(), PATH_URL . "services/feeds/forum_public.php?id=" . $messageboard->get_id(), "discussion board", \lms_steam::get_link_to_root($messageboard));
$_SESSION["confirmation"] = str_replace("%NAME", h($messageboard->get_name()), gettext("You are keeping an eye on '%NAME' from now on."));
header("Location: " . PATH_URL . "forums/" . $messageboard->get_id() . "/");
exit;
}
if (isset($_GET["action"]) && $_GET["action"] == "delete_bookmark") {
$user = \lms_steam::get_current_user();
$id = (int) $_GET["unsubscribe"];
$feeds = $user->get_attribute("USER_RSS_FEEDS");
if (!is_array($feeds)) {
$feeds = array();
}
unset($feeds[$id]);
$user->set_attribute("USER_RSS_FEEDS", $feeds);
$_SESSION["confirmation"] = str_replace("%NAME", h($messageboard->get_name()), gettext("subscription of '%NAME' canceled."));
header("Location: " . PATH_URL . "forums/" . $messageboard->get_id() . "/");
exit;
}
if (empty($_GET["pattern"]) && !isset($author_id)) {
$cache = get_cache_function(OBJ_ID, 300);
$discussions = $cache->call("lms_forum::get_discussions", OBJ_ID);
} elseif (isset($author_id)) {
$cache = get_cache_function(\lms_steam::get_current_user()->get_name(), 300);
$discussions = $cache->call("lms_forum::search_user_posts", $messageboard->get_id(), $author_id);
} else {
$cache = get_cache_function(\lms_steam::get_current_user()->get_name(), 300);
$discussions = $cache->call("lms_forum::search_pattern", $messageboard->get_id(), $_GET["pattern"]);
}
$content->setVariable("LABEL_ALL_TOPICS", gettext("All Threads"));
if ($messageboard->check_access_annotate(\lms_steam::get_current_user())) {
$content->setCurrentBlock("BLOCK_WRITE_ACCESS");
if (isset($author_id)) {
$content->setVariable("LABEL_THREADS_POSTED_IN", gettext("All Threads"));
// TODO: Passt der link?
$content->setVariable("LINK_AUTHOR", PATH_URL . "forums/" . $messageboard->get_id() . "/");
} else {
$content->setVariable("LABEL_THREADS_POSTED_IN", gettext("Threads you've posted in"));
// TODO: Passt der link?
$content->setVariable("LINK_AUTHOR", PATH_URL . "forums/" . $messageboard->get_id() . "/?author=" . \lms_steam::get_current_user()->get_name());
}
// TODO: Passt der link?
$content->setVariable("LINK_POST_NEW", PATH_URL . "messageboard/newDiscussion/" . $messageboard->get_id());
$content->setVariable("LABEL_POST_NEW_THREAD", gettext("Post a new thread"));
$content->parse("BLOCK_WRITE_ACCESS");
}
if ($messageboard->check_access_write(\lms_steam::get_current_user())) {
$content->setCurrentBlock("BLOCK_ADMIN");
$content->setVariable("LINK_EDIT", PATH_URL . "messageboard/editMessageboard/" . $messageboard->get_id());
$content->setVariable("LABEL_EDIT", gettext("Preferences"));
$content->setVariable("LINK_DELETE", PATH_URL . "messageboard/deleteMessageboard/" . $messageboard->get_id());
//.........这里部分代码省略.........
示例5: execute
public function execute(\FrameResponseObject $frameResponseObject)
{
//CODE FOR ALL COMMANDS OF THIS PAKAGE END
$user = \lms_steam::get_current_user();
// Disable caching
// TODO: Work on cache handling. An enabled cache leads to bugs
// if used with the wiki.
\CacheSettings::disable_caching();
if (!($wiki_container = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id))) {
include "bad_link.php";
exit;
}
if (!$wiki_container instanceof \steam_container) {
$wiki_doc = $wiki_container;
$wiki_container = $wiki_doc->get_environment();
if ($wiki_doc->get_attribute(DOC_MIME_TYPE) != "text/wiki") {
include "bad_link.php";
exit;
}
}
//CODE FOR ALL COMMANDS OF THIS PAKAGE END
$version_doc = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->params[1]);
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$problems = "";
try {
$new_content = $version_doc->get_content();
$wiki_doc->set_content($new_content);
} catch (Exception $ex) {
$problems = $ex->get_message();
}
if (empty($problems)) {
$_SESSION["confirmation"] = str_replace("%VERSION", $version_doc->get_version(), gettext("Version %VERSION recovered."));
header("Location: " . PATH_URL . "wiki/viewentry/" . $wiki_doc->get_id() . "/");
exit;
} else {
$frameResponseObject->setProblemDescription($problems);
//$portal->set_problem_description( $problems, $hints );
}
}
$backlink = PATH_URL . "wiki/viewentry/" . $wiki_doc->get_id() . "/";
$content = \Wiki::getInstance()->loadTemplate("wiki_recover_version.template.html");
//$content = new HTML_TEMPLATE_IT();
//$content->loadTemplateFile( PATH_TEMPLATES . "wiki_recover_version.template.html" );
$content->setVariable("BACK_LINK", $backlink);
$content->setVariable("INFO_TEXT", gettext("A new version will be created from the one you are recovering. The actual version will not be lost. Is that what you want?"));
$content->setVariable("LABEL_OK", gettext("Yes, Recover version"));
$content->setVariable("BACKLINK", "<a href=\"{$backlink}\">" . gettext("back") . "</a>");
$rootlink = \lms_steam::get_link_to_root($wiki_container);
WIKI_FULL_HEADLINE ? $headline = array($rootlink[0], $rootlink[1], array("link" => $rootlink[1]["link"] . "communication/", "name" => gettext("Communication")), array("name" => h($wiki_container->get_name()), "link" => PATH_URL . "wiki/" . $wiki_container->get_id() . "/"), array("link" => PATH_URL . "wiki/" . $wiki_doc->get_id() . "/", "name" => str_replace(".wiki", "", h($wiki_doc->get_name()))), array("link" => "", "name" => str_replace("%VERSION", $version_doc->get_version(), gettext("Recover version %VERSION")))) : ($headline = array(array("name" => h($wiki_container->get_name()), "link" => PATH_URL . "wiki/" . $wiki_container->get_id() . "/"), array("link" => PATH_URL . "wiki/" . $wiki_doc->get_id() . "/", "name" => str_replace(".wiki", "", h($wiki_doc->get_name()))), array("link" => "", "name" => str_replace("%VERSION", $version_doc->get_version(), gettext("Recover version %VERSION")))));
$frameResponseObject->setHeadline($headline);
$widget = new \Widgets\RawHtml();
$widget->setHtml($content->get());
$frameResponseObject->addWidget($widget);
return $frameResponseObject;
/*$portal->set_page_main(
$headline,
$content->get()
);
$portal->show_html();
*/
}
示例6: frameResponse
//.........这里部分代码省略.........
$cache->drop("lms_steam::get_inventory_recursive", $workroom->get_id(), CLASS_MESSAGEBOARD, array("FORUM_LANGUAGE"));
$cache->drop("lms_steam::get_group_communication_objects", $workroom->get_id(), CLASS_MESSAGEBOARD | CLASS_CALENDAR | CLASS_CONTAINER | CLASS_ROOM);
if (!isset($messageboard) || !is_object($messageboard)) {
header("Location: " . $backlink);
exit;
}
} else {
$portal->set_problem_description($problems, isset($hints) ? $hints : "");
}
}
$content = \Messageboard::getInstance()->loadTemplate("object_new.template.html");
if (isset($messageboard) && is_object($messageboard)) {
$content->setVariable("INFO_TEXT", str_replace("%NAME", h($messageboard->get_name()), gettext("You are going to edit the forum '<b>%NAME</b>'.")));
$content->setVariable("LABEL_CREATE", gettext("Save changes"));
$pagetitle = gettext("Preferences");
if (empty($values)) {
$values = array();
$values["name"] = $messageboard->get_name();
$values["dsc"] = $messageboard->get_attribute(OBJ_DESC);
$values["access"] = $messageboard->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 forum in '<b>%ENV</b>'.")));
$content->setVariable("LABEL_CREATE", gettext("Create forum"));
$pagetitle = gettext("Create forum");
$breadcrumbheader = gettext("Add new forum");
}
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("BACKLINK", "<a href=\"{$backlink}\">" . gettext("back") . "</a>");
$content->setVariable("LABEL_NAME", gettext("Name"));
$content->setVariable("LABEL_DSC", gettext("Description"));
$content->setVariable("LABEL_BB_BOLD", gettext("B"));
$content->setVariable("HINT_BB_BOLD", gettext("boldface"));
$content->setVariable("LABEL_BB_ITALIC", gettext("I"));
$content->setVariable("HINT_BB_ITALIC", gettext("italic"));
$content->setVariable("LABEL_BB_UNDERLINE", gettext("U"));
$content->setVariable("HINT_BB_UNDERLINE", gettext("underline"));
$content->setVariable("LABEL_BB_STRIKETHROUGH", gettext("S"));
$content->setVariable("HINT_BB_STRIKETHROUGH", gettext("strikethrough"));
$content->setVariable("LABEL_BB_IMAGE", gettext("IMG"));
$content->setVariable("HINT_BB_IMAGE", gettext("image"));
$content->setVariable("LABEL_BB_URL", gettext("URL"));
$content->setVariable("HINT_BB_URL", gettext("web link"));
$content->setVariable("LABEL_BB_MAIL", gettext("MAIL"));
$content->setVariable("HINT_BB_MAIL", gettext("email link"));
$content->setVariable("LABEL_ACCESS", gettext("Access"));
if ((string) $grp->get_attribute("OBJ_TYPE") == "course") {
$access_default = PERMISSION_PUBLIC;
} else {
$access_default = PERMISSION_PUBLIC;
}
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_forum::get_access_descriptions($grp);
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");
}
}
// TODO: Passt der link?
$rootlink = \lms_steam::get_link_to_root($grp);
$headline = array($rootlink[0], $rootlink[1], array("link" => $rootlink[1]["link"] . "communication/", "name" => gettext("Communication")));
if (isset($messageboard) && is_object($messageboard)) {
$headline[] = array("link" => PATH_URL . "forums/" . $messageboard->get_id() . "/", "name" => $messageboard->get_name());
}
$headline[] = array("link" => "", "name" => $breadcrumbheader);
$frameResponseObject->setTitle("Messageboard");
$rawHtml = new \Widgets\RawHtml();
$rawHtml->setHtml($content->get());
$frameResponseObject->addWidget($rawHtml);
return $frameResponseObject;
}
示例7: execute
//.........这里部分代码省略.........
$content->setVariable("WIKI_STARTPAGE_SELECTED", "selected");
$startpageFound = true;
}
$content->parse("BLOCK_WIKI_STARTPAGE_OPTION");
}
if (!$startpageFound) {
$content->setVariable("OPTION_WIKI_GLOSSARY_SELECTED", "selected");
}
} else {
$grpname = $grp->get_attribute(OBJ_NAME);
if ($grp->get_attribute(OBJ_TYPE) == "course") {
$grpname = $grp->get_attribute(OBJ_DESC);
}
$content->setVariable("OPTION_WIKI_GLOSSARY", gettext("Glossary"));
$content->setVariable("OPTION_WIKI_GLOSSARY_SELECTED", "selected");
$content->setVariable("INFO_TEXT", str_replace("%ENV", h($grpname), gettext("You are going to create a new wiki in '<b>%ENV</b>'.")));
$content->setVariable("LABEL_CREATE", gettext("Create wiki"));
$pagetitle = gettext("Create wiki");
$breadcrumbheader = gettext("Add new wiki");
}
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"]));
}
if (!empty($values["wiki_startpage"])) {
$content->setVariable("VALUE_WIKI_STARTPAGE", h($values["wiki_startpage"]));
}
}
$content->setVariable("VALUE_BACKLINK", $backlink);
$content->setVariable("LABEL_NAME", gettext("Name"));
$content->setVariable("LABEL_DSC", gettext("Description"));
$content->setVariable("LABEL_WIKI_STARTPAGE", gettext("Startpage"));
$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_wiki::get_access_descriptions($grp);
if ((string) $grp->get_attribute("OBJ_TYPE") == "course") {
$access_default = PERMISSION_PUBLIC;
} else {
$access_default = PERMISSION_PUBLIC_READONLY;
if (isset($wiki_container) && is_object($wiki_container) && $creator->get_id() != \lms_steam::get_current_user()->get_id()) {
$access[PERMISSION_PRIVATE_READONLY] = str_replace("%NAME", $creator->get_name(), $access[PERMISSION_PRIVATE_READONLY]);
} else {
$access[PERMISSION_PRIVATE_READONLY] = str_replace("%NAME", "you", $access[PERMISSION_PRIVATE_READONLY]);
}
}
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);
WIKI_FULL_HEADLINE ? $headline = array($rootlink[0], $rootlink[1], array("link" => $rootlink[1]["link"] . "communication/", "name" => gettext("Communication"))) : "";
if (isset($wiki_container) && is_object($wiki_container)) {
$headline[] = array("link" => PATH_URL . "wiki/index/" . $wiki_container->get_id() . "/", "name" => h($wiki_container->get_name()));
}
$headline[] = array("link" => "", "name" => $breadcrumbheader);
$frameResponseObject->setTitle($pagetitle);
$frameResponseObject->setHeadline($headline);
$widget = new \Widgets\RawHtml();
$widget->setHtml($content->get());
$frameResponseObject->addWidget($widget);
return $frameResponseObject;
/*$portal->set_page_main( $headline, $content->get() );
$portal->set_page_title( $pagetitle );
$portal->show_html();*/
}
示例8: execute
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;
}
示例9: frameResponse
//.........这里部分代码省略.........
throw new \Exception("No rights to view this.", E_USER_RIGHTS);
}
}
if (!$messageboard instanceof \steam_messageboard) {
include "bad_link.php";
exit;
}
$is_watching = FALSE;
if (is_array($rss_feeds)) {
foreach (array_keys($rss_feeds) as $item) {
if ($item == $messageboard->get_id()) {
$is_watching = TRUE;
}
}
}
// no direct call
/* TODO: Soll das rein?
if (!defined('_VALID_KOALA')) {
header("location:/");
exit;
}
*/
$comment = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $comment_id);
$user = \lms_steam::get_current_user();
if ($_SERVER["REQUEST_METHOD"] == "POST" && $comment->check_access_write($user)) {
$values = $_POST["values"];
if ($values["delete"]) {
$_SESSION["confirmation"] = str_replace("%NAME", h($comment->get_name()), gettext("The comment '%NAME' has been deleted."));
$annotating = $comment->get_annotating();
$annotating->remove_annotation($comment);
\lms_steam::delete($comment);
require_once "Cache/Lite.php";
$cache = new \Cache_Lite(array("cacheDir" => PATH_CACHE));
$cache = get_cache_function(OBJ_ID, 600);
$cache->drop("lms_steam::get_annotations", OBJ_ID);
// Handle Related Cache-Data
require_once "Cache/Lite.php";
$cache = new \Cache_Lite(array("cacheDir" => PATH_CACHE));
$cache->clean(OBJ_ID);
// clean forumcache
$fcache = get_cache_function(OBJ_ID, 600);
$fcache->drop("lms_forum::get_discussions", OBJ_ID);
// clean cache for Weblog RSS Feed for the Comments
$fcache->drop("lms_steam::get_annotations", OBJ_ID);
// clean rsscache
$rcache = get_cache_function("rss", 600);
// TODO: Passt der link?
$feedlink = PATH_URL . "services/feeds/forum_public.php?id=" . OBJ_ID;
$rcache->drop("lms_rss::get_items", $feedlink);
// TODO: Passt der link?
$feedlink = PATH_URL . "services/feeds/weblog_public.php?id=" . OBJ_ID;
$rcache->drop("lms_rss::get_items", $feedlink);
header("Location: " . PATH_URL . "messageboard/viewDiscussion/" . $forum_id);
exit;
}
}
$content = \Messageboard::getInstance()->loadTemplate("comment_delete.template.html");
if ($comment->check_access_write($user)) {
$content->setVariable("LABEL_ARE_YOU_SURE", gettext("Are you sure you want to delete this comment?"));
if (isset($document)) {
// TODO: Passt der link?
$content->setVariable("DELETE_BACK_LINK", PATH_URL . "doc/" . OBJ_ID . "/");
} else {
if (isset($weblog)) {
// TODO: Passt der link?
$content->setVariable("DELETE_BACK_LINK", PATH_URL . "weblog/" . OBJ_ID . "/");
} else {
// TODO: Passt der link?
$content->setVariable("DELETE_BACK_LINK", PATH_URL . "forums/" . OBJ_ID . "/");
}
}
$content->setCurrentBlock("BLOCK_DELETE");
$content->setVariable("FORM_ACTION", $_SERVER["REQUEST_URI"]);
$content->setVariable("LABEL_DELETE_IT", gettext("yes, delete it"));
$content->setVariable("BACK_LINK", $_SERVER["HTTP_REFERER"]);
$content->setVariable("LABEL_RETURN", gettext("back"));
$content->parse("BLOCK_DELETE");
} else {
$content->setVariable("LABEL_ARE_YOU_SURE", gettext("You have no rights to delete this comment!"));
}
$content->setVariable("TEXT_COMMENT", get_formatted_output($comment->get_content()));
$creator = $comment->get_creator();
$creator_data = $creator->get_attributes(array("USER_FULLNAME", "USER_FIRSTNAME", "OBJ_ICON"));
$content->setVariable("LABEL_FROM_AND_AGO", str_replace("%N", "<a href=\"" . PATH_URL . "/user/" . $creator->get_name() . "/\">" . h($creator_data["USER_FIRSTNAME"]) . " " . h($creator_data["USER_FULLNAME"]) . "</a>", gettext("by %N")) . "," . how_long_ago($comment->get_attribute("OBJ_CREATION_TIME")));
$icon = $creator_data["OBJ_ICON"];
if ($icon instanceof \steam_object) {
$icon_id = $icon->get_id();
} else {
$icon_id = 0;
}
$content->setVariable("ICON_SRC", PATH_URL . "get_document.php?id=" . $icon_id);
// TODO: Passt der link?
$rootlink = \lms_steam::get_link_to_root($messageboard);
$headline = array($rootlink[0], $rootlink[1], array("link" => $rootlink[1]["link"] . "communication/", "name" => gettext("Communication")), array("link" => PATH_URL . "forums/" . $messageboard->get_id() . "/", "name" => $messageboard->get_name()), array("link" => "", "name" => gettext("Delete comment")));
$frameResponseObject->setTitle("Messageboard");
$rawHtml = new \Widgets\RawHtml();
$rawHtml->setHtml($content->get());
$frameResponseObject->addWidget($rawHtml);
return $frameResponseObject;
}
示例10: execute
public function execute(\FrameResponseObject $frameResponseObject)
{
//$portal = \lms_portal::get_instance();
//$portal->initialize( GUEST_NOT_ALLOWED );
$user = \lms_steam::get_current_user();
//$path = $request->getPath();
$STEAM = $GLOBALS["STEAM"];
$weblogId = $this->id;
$weblog = \steam_factory::get_object($STEAM->get_id(), $weblogId);
//if ( ! $weblog = steam_factory::get_object( $STEAM->get_id(), $_GET[ "id" ] ) )
//{
// include( "bad_link.php" );
// exit;
//}
if (!$weblog instanceof \steam_calendar) {
if ($weblog instanceof \steam_container) {
$category = $weblog;
$categories = $category->get_environment();
$weblog = new \steam_weblog($GLOBALS["STEAM"]->get_id(), $categories->get_environment()->get_id());
} elseif ($weblog instanceof \steam_date) {
$date = $weblog;
$weblog = new \steam_weblog($GLOBALS["STEAM"]->get_id(), $date->get_environment()->get_id());
} else {
include "bad_link.php";
exit;
}
} else {
$weblog = new \steam_weblog($GLOBALS["STEAM"]->get_id(), $weblogId);
define("OBJ_ID", $weblogId);
if (!$weblog->check_access_read($user)) {
throw new \Exception("No rights to view this.", E_USER_RIGHTS);
}
}
if (!isset($date)) {
throw new \Exception("variable date is not set.");
}
//$date = $weblog;
if ($_SERVER["REQUEST_METHOD"] == "POST" && $date->check_access_write($user)) {
$values = $_POST["values"];
if ($values["delete"]) {
require_once "Cache/Lite.php";
$cache = new \Cache_Lite(array("cacheDir" => PATH_CACHE));
$cache->clean($weblog->get_id());
$cache->clean($date->get_id());
$trashbin = $GLOBALS["STEAM"]->get_current_steam_user();
if (is_object($trashbin)) {
$date->move($trashbin);
} else {
$date->delete();
}
}
header("Location: " . $values["return_to"]);
exit;
}
$content = \Weblog::getInstance()->loadTemplate("weblog_entry_delete.template.html");
//$content = new HTML_TEMPLATE_IT();
//$content->loadTemplateFile( PATH_TEMPLATES . "weblog_entry_delete.template.html" );
$content->setVariable("LABEL_ARE_YOU_SURE", gettext("Are you sure you want to delete this entry?"));
$content->setVariable("TEXT_COMMENT", get_formatted_output($date->get_attribute("DATE_DESCRIPTION")));
$creator = $date->get_creator();
$creator_data = $creator->get_attributes(array("USER_FULLNAME", "USER_FIRSTNAME", "OBJ_ICON"));
$content->setVariable("LABEL_FROM_AND_AGO", str_replace("%N", "<a href=\"" . PATH_URL . "/user/index/" . $creator->get_name() . "/\">" . h($creator_data["USER_FIRSTNAME"]) . " " . h($creator_data["USER_FULLNAME"]) . "</a>", gettext("by %N")) . "," . how_long_ago($date->get_attribute("OBJ_CREATION_TIME")));
$content->setVariable("LABEL_DELETE_IT", gettext("yes, delete it"));
$content->setVariable("BACK_LINK", $_SERVER["HTTP_REFERER"]);
$content->setVariable("LABEL_RETURN", gettext("back"));
$content->setVariable("ICON_SRC", PATH_URL . "get_document.php?id=" . $creator_data["OBJ_ICON"]->get_id());
$rootlink = \lms_steam::get_link_to_root($weblog);
$headline = array($rootlink[0], $rootlink[1], array("link" => $rootlink[1]["link"] . "communication/", "name" => gettext("Communication")), array("link" => "", "name" => h($weblog->get_name()), "link" => PATH_URL . "weblog/index/" . $weblog->get_id() . "/"), array("name" => str_replace("%NAME", h($date->get_attribute("DATE_TITLE")), gettext("Delete '%NAME'?"))));
/*$portal->set_page_main(
$headline,
$content->get(),
""
);
return $portal->get_html();*/
$frameResponseObject->setHeadline($headline);
$widget = new \Widgets\RawHtml();
$widget->setHtml($content->get());
$frameResponseObject->addWidget($widget);
return $frameResponseObject;
}
示例11: frameResponse
public function frameResponse(\FrameResponseObject $frameResponseObject)
{
$forum_id = $this->params[0];
$portal = \lms_portal::get_instance();
$user = \lms_steam::get_current_user();
$rss_feeds = $user->get_attribute("USER_RSS_FEEDS");
if (!($messageboard = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $forum_id))) {
include "bad_link.php";
exit;
}
if ($messageboard instanceof \steam_document) {
$thread = $messageboard;
$messageboard = $thread->get_annotating();
define("OBJ_ID", $thread->get_id());
if (!$thread->check_access_read($user)) {
throw new \Exception("No rights to view this.", E_USER_RIGHTS);
}
} else {
define("OBJ_ID", $messageboard->get_id());
if (!$messageboard->check_access_read($user)) {
throw new \Exception("No rights to view this.", E_USER_RIGHTS);
}
}
if (!$messageboard instanceof \steam_messageboard) {
include "bad_link.php";
exit;
}
$is_watching = FALSE;
if (is_array($rss_feeds)) {
foreach (array_keys($rss_feeds) as $item) {
if ($item == $messageboard->get_id()) {
$is_watching = TRUE;
}
}
}
$content = \Messageboard::getInstance()->loadTemplate("forum_discussion.template.html");
$content->setVariable("REPLY_LABEL", gettext("Reply to this topic?"));
if ($_SERVER["REQUEST_METHOD"] == "POST" && $thread->check_access_annotate(\lms_steam::get_current_user())) {
$values = $_POST["values"];
if (empty($values["body"])) {
$portal->set_problem_description(gettext("Please enter your message."));
}
if (!empty($values["save"]) && !empty($values["body"])) {
$new_comment = \steam_factory::create_textdoc($GLOBALS["STEAM"]->get_id(), "Re: " . $thread->get_name(), $values["body"]);
// $all_user = steam_factory::groupname_to_object( $GLOBALS[ "STEAM" ]->get_id(), STEAM_ALL_USER );
// $new_comment->set_acquire( FALSE );
// $new_comment->set_read_access( $all_user, TRUE );
// $new_comment->set_write_access( $all_user, FALSE );
// $new_comment->set_annotate_access( $all_user, TRUE );
$thread->add_annotation($new_comment);
$new_comment->set_acquire($thread);
$mbid = $messageboard->get_id();
// Handle Related Cache-Data
require_once "Cache/Lite.php";
$cache = new \Cache_Lite(array("cacheDir" => PATH_CACHE));
$cache->clean($mbid);
// clean forumcache
$fcache = get_cache_function($forum_id, 600);
$fcache->drop("lms_forum::get_discussions", $forum_id);
// clean forumcache
$fcache = get_cache_function($mbid, 600);
$fcache->drop("lms_forum::get_discussions", $mbid);
// clean rsscache of the forum
// TODO: Passt der link?
$feedlink = PATH_URL . "services/feeds/forum_public.php?id=" . OBJ_ID;
$rcache = get_cache_function("rss", 600);
$rcache->drop("lms_rss::get_items", $feedlink);
} else {
if (empty($values["save"]) && !empty($values["body"])) {
// PREVIEW
$content->setCurrentBlock("BLOCK_PREVIEW_COMMENT");
$content->setVariable("LABEL_PREVIEW_COMMENT", gettext("Preview the edit"));
$content->setVariable("VALUE_PREVIEW_COMMENT", get_formatted_output($values["body"]));
$content->setVariable("TEXT_COMMENT", h($values["body"]));
$content->parse("BLOCK_PREVIEW_COMMENT");
$content->setVariable("REPLY_LABEL", gettext("Change it?"));
}
}
}
if (isset($_GET["action"]) && $_GET["action"] == "bookmark_rss") {
\lms_steam::user_add_rssfeed($messageboard->get_id(), PATH_URL . "services/feeds/forum_public.php?id=" . $messageboard->get_id(), "discussion board", \lms_steam::get_link_to_root($messageboard));
$_SESSION["confirmation"] = str_replace("%NAME", h($messageboard->get_name()), gettext("You are keeping an eye on '%NAME' from now on."));
header("Location: " . PATH_URL . "forums/" . $thread->get_id() . "/");
exit;
}
if (isset($_GET["action"]) && $_GET["action"] == "delete_bookmark") {
$user = \lms_steam::get_current_user();
$id = (int) $_GET["unsubscribe"];
$feeds = $user->get_attribute("USER_RSS_FEEDS");
if (!is_array($feeds)) {
$feeds = array();
}
unset($feeds[$id]);
$user->set_attribute("USER_RSS_FEEDS", $feeds);
$_SESSION["confirmation"] = str_replace("%NAME", h($messageboard->get_name()), gettext("subscription of '%NAME' canceled."));
header("Location: " . PATH_URL . "forums/" . $thread->get_id() . "/");
exit;
}
$content->setVariable("CURRENT_DISCUSSIONS_LABEL", gettext("Current Thread"));
$cache = get_cache_function($messageboard->get_id(), 600);
//.........这里部分代码省略.........
示例12: execute
//.........这里部分代码省略.........
//$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;
}
示例13: frameResponse
//.........这里部分代码省略.........
$headline = gettext("Post a new topic");
// TODO: Passt der link?
$backlink = empty($_POST["values"]["backlink"]) ? $_SERVER["HTTP_REFERER"] : $_POST["values"]["backlink"];
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$values = $_POST["values"];
$problems = "";
if (empty($values["title"])) {
$problems = gettext("Please enter a subject for your message.");
}
if (empty($values["body"])) {
$problems .= empty($problems) ? gettext("Please enter your message.") : "<br>" . gettext("Please enter your message.");
}
if (get_magic_quotes_gpc()) {
if (!empty($values['title'])) {
$values['title'] = stripslashes($values['title']);
}
if (!empty($values['body'])) {
$values['body'] = stripslashes($values['body']);
}
}
if (!empty($problems)) {
$portal->set_problem_description($problems);
}
if (!empty($values["preview_comment"])) {
$content->setCurrentBlock("BLOCK_PREVIEW_COMMENT");
$content->setVariable("TEXT_COMMENT", get_formatted_output($values["body"]));
$content->setVariable("LABEL_PREVIEW_YOUR_COMMENT", gettext("Preview your comment"));
$template->parse("BLOCK_PREVIEW_COMMENT");
$headline = gettext("Change it?");
}
if (!empty($values["save"]) && empty($problems)) {
if (!strpos($values["title"], "/")) {
$new_thread = $messageboard->add_thread($values["title"], $values["body"]);
// $all_user = steam_factory::groupname_to_object( $GLOBALS[ "STEAM" ]->get_id(), STEAM_ALL_USER );
// $new_thread->set_acquire( FALSE );
// $new_thread->set_read_access( $all_user, TRUE );
// $new_thread->set_write_access( $all_user, FALSE );
// $new_thread->set_annotate_access( $all_user, TRUE );
// Handle Related Cache-Data
require_once "Cache/Lite.php";
$cache = new \Cache_Lite(array("cacheDir" => PATH_CACHE));
$cache->clean(OBJ_ID);
// clean forumcache
$fcache = get_cache_function($forum_id, 600);
$fcache->drop("lms_forum::get_discussions", $forum_id);
// clean rsscache of the forum
// TODO: Passt der link?
$feedlink = PATH_URL . "services/feeds/forum_public.php?id=" . $forum_id;
$rcache = get_cache_function("rss", 600);
$rcache->drop("lms_rss::get_items", $feedlink);
header("Location: " . PATH_URL . "messageboard/viewDiscussion/" . $new_thread->get_id() . "/");
exit;
} else {
$portal->set_problem_description(gettext("Please don't use the \"/\"-char in the title."));
}
}
if (!empty($values["preview"]) && !empty($values['body'])) {
// PREVIEW
$content->setCurrentBlock("BLOCK_PREVIEW");
$content->setVariable("LABEL_PREVIEW_EDIT", gettext("Preview the edit"));
$content->setVariable("PREVIEW_EDIT", get_formatted_output($values["body"]));
$content->parse("BLOCK_PREVIEW");
$headline = gettext("Change it?");
}
}
$subject = isset($values["title"]) ? htmlentities($values["title"], ENT_NOQUOTES, "utf-8") : "";
$text = isset($values["body"]) ? htmlentities($values["body"], ENT_NOQUOTES, "utf-8") : "";
$content->setVariable("INFO_TEXT", $headline);
$content->setVariable("LABEL_TOPIC", gettext("Topic"));
$content->setVariable("LABEL_YOUR_POST", gettext("Your Post"));
$content->setVariable("TEXT_COMMENT", $text);
$content->setVariable("TITLE_COMMENT", $subject);
$content->setVariable("LABEL_PREVIEW", gettext("Preview"));
$content->setVariable("LABEL_SAVE_CHANGES", gettext("Create entry"));
$content->setVariable("VALUE_BACKLINK", $backlink);
$content->setVariable("BACKLINK", "<a href=\"{$backlink}\">" . gettext("back") . "</a>");
$content->setVariable("LABEL_BB_BOLD", gettext("B"));
$content->setVariable("HINT_BB_BOLD", gettext("boldface"));
$content->setVariable("LABEL_BB_ITALIC", gettext("I"));
$content->setVariable("HINT_BB_ITALIC", gettext("italic"));
$content->setVariable("LABEL_BB_UNDERLINE", gettext("U"));
$content->setVariable("HINT_BB_UNDERLINE", gettext("underline"));
$content->setVariable("LABEL_BB_STRIKETHROUGH", gettext("S"));
$content->setVariable("HINT_BB_STRIKETHROUGH", gettext("strikethrough"));
$content->setVariable("LABEL_BB_IMAGE", gettext("IMG"));
$content->setVariable("HINT_BB_IMAGE", gettext("image"));
$content->setVariable("LABEL_BB_URL", gettext("URL"));
$content->setVariable("HINT_BB_URL", gettext("web link"));
$content->setVariable("LABEL_BB_MAIL", gettext("MAIL"));
$content->setVariable("HINT_BB_MAIL", gettext("email link"));
$portal->set_rss_feed(PATH_URL . "services/feeds/forum_public.php?id={$forum_id}", gettext("Feed"), str_replace("%l", $login, gettext("Subscribe to this forum's Newsfeed")));
// TODO: Passt der link?
$rootlink = \lms_steam::get_link_to_root($messageboard);
$headline = array($rootlink[0], $rootlink[1], array("link" => $rootlink[1]["link"] . "communication/", "name" => gettext("Communication")), array("link" => PATH_URL . "forums/" . $messageboard->get_id() . "/", "name" => $messageboard->get_name()), array("link" => "", "name" => gettext("New Thread")));
$frameResponseObject->setTitle("Messageboard");
$rawHtml = new \Widgets\RawHtml();
$rawHtml->setHtml($content->get());
$frameResponseObject->addWidget($rawHtml);
return $frameResponseObject;
}
示例14: execute
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;
}
示例15: gettext
} else {
if (isset($weblog)) {
$content->setVariable("DELETE_BACK_LINK", PATH_URL . "weblog/" . OBJ_ID . "/");
} else {
$content->setVariable("DELETE_BACK_LINK", PATH_URL . "forums/" . OBJ_ID . "/");
}
}
$content->setCurrentBlock("BLOCK_DELETE");
$content->setVariable("FORM_ACTION", $_SERVER["REQUEST_URI"]);
$content->setVariable("LABEL_DELETE_IT", gettext("yes, delete it"));
$content->setVariable("BACK_LINK", $_SERVER["HTTP_REFERER"]);
$content->setVariable("LABEL_RETURN", gettext("back"));
$content->parse("BLOCK_DELETE");
} else {
$content->setVariable("LABEL_ARE_YOU_SURE", gettext("You have no rights to delete this comment!"));
}
$content->setVariable("TEXT_COMMENT", get_formatted_output($comment->get_content()));
$creator = $comment->get_creator();
$creator_data = $creator->get_attributes(array("USER_FULLNAME", "USER_FIRSTNAME", "OBJ_ICON"));
$content->setVariable("LABEL_FROM_AND_AGO", str_replace("%N", "<a href=\"" . PATH_URL . "/user/" . $creator->get_name() . "/\">" . h($creator_data["USER_FIRSTNAME"]) . " " . h($creator_data["USER_FULLNAME"]) . "</a>", gettext("by %N")) . "," . how_long_ago($comment->get_attribute("OBJ_CREATION_TIME")));
$icon = $creator_data["OBJ_ICON"];
if ($icon instanceof steam_object) {
$icon_id = $icon->get_id();
} else {
$icon_id = 0;
}
$content->setVariable("ICON_SRC", PATH_URL . "get_document.php?id=" . $icon_id);
$rootlink = lms_steam::get_link_to_root($messageboard);
$headline = array($rootlink[0], $rootlink[1], array("link" => $rootlink[1]["link"] . "communication/", "name" => gettext("Communication")), array("link" => PATH_URL . "forums/" . $messageboard->get_id() . "/", "name" => $messageboard->get_name()), array("link" => "", "name" => gettext("Delete comment")));
$portal->set_page_main($headline, $content->get(), "");
$portal->show_html();