本文整理汇总了PHP中steam_factory::create_textdoc方法的典型用法代码示例。如果您正苦于以下问题:PHP steam_factory::create_textdoc方法的具体用法?PHP steam_factory::create_textdoc怎么用?PHP steam_factory::create_textdoc使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类steam_factory
的用法示例。
在下文中一共展示了steam_factory::create_textdoc方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create_entry
/**
* function create_entry:
*
* @param $pEntryName
* @param $pDescription
*
* @return
*/
protected function create_entry($pEntryName, $pDescription)
{
$new_annotation = steam_factory::create_textdoc($this->steam_connectorID, $pEntryName, $pDescription);
$this->add_annotation($new_annotation);
// set acquiring
$new_annotation->set_acquire($this);
return $new_annotation;
}
示例2: processData
public function processData(\IRequestObject $requestObject)
{
//TODO: NUR FILES GENERIEREN, WELCHE MAN AUCHS EHEN DARF
$this->params = $requestObject->getParams();
isset($this->params[0]) ? $this->id = $this->params[0] : "";
$objId = $this->id;
$steam = $GLOBALS["STEAM"];
$steamId = $steam->get_id();
if ($objId == "") {
throw new \Exception("id not set");
}
$obj = \steam_factory::get_object($steamId, $objId);
$icsFile = "BEGIN:VCALENDAR\n";
$icsFile .= "VERSION:2.0\n";
$icsFile .= "PRODID:koaLA 3.0 / " . $obj->get_name() . " \n";
$icsFile .= "METHOD:PUBLISH\n";
$objCalendar = $obj->get_attribute("USER_CALENDAR");
$objCalendarSubscriptions = $obj->get_attribute("CALENDAR_SUBSCRIPTIONS");
if ($objCalendar === 0 && $objCalendarSubscriptions === 0) {
throw new \Exception("there is no calendar");
}
if ($objCalendar !== 0 && $objCalendar instanceof \steam_calendar) {
$dates = $objCalendar->get_date_objects();
foreach ($dates as $date) {
if ($date instanceof \steam_date) {
$icsFile .= self::getEventData($date);
}
}
}
if ($objCalendarSubscriptions !== 0 && !empty($objCalendarSubscriptions)) {
foreach ($objCalendarSubscriptions as $calendar) {
if ($calendar instanceof \steam_calendar) {
$dates = $objCalendar->get_date_objects();
foreach ($dates as $date) {
if ($date instanceof \steam_date) {
$icsFile .= self::getEventData($date);
}
}
}
}
}
$icsFile .= "END:VCALENDAR";
$existingIcsFile = $obj->get_attribute("CALENDAR_ICS_FILE_OUT");
if ($existingIcsFile === 0) {
$icsFileObj = \steam_factory::create_textdoc($GLOBALS["STEAM"]->get_id(), $obj->get_name() . ".ics", $icsFile, $obj);
$obj->set_attribute("CALENDAR_ICS_FILE_OUT", $icsFileObj);
} else {
$existingIcsFile->set_content($icsFile);
}
return $requestObject;
}
示例3: ajaxResponse
public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject)
{
$title = $this->params["title"];
$content = $this->params["content"];
$objectId = $this->id;
$forumId = $this->params["forum"];
$steam = $GLOBALS["STEAM"];
$steamId = $steam->get_id();
$object = \steam_factory::get_object($steamId, $objectId);
$forum = \steam_factory::get_object($steamId, $forumId);
if (trim($title) != "") {
$new_annotation = \steam_factory::create_textdoc($steamId, rawurlencode($title), stripslashes($content));
$new_annotation->set_attribute("OBJ_DESC", $title);
$object->add_annotation($new_annotation);
// set acquiring
$new_annotation->set_acquire($object);
$subscription = $forum->get_attribute("bid:forum_subscription");
if ($subscription) {
foreach ($subscription as $key => $user) {
$user->get_attributes(array("USER_EMAIL"), 1);
}
$result = $steam->buffer_flush();
foreach ($subscription as $key => $user) {
$recipient = $user->get_attribute("USER_EMAIL");
$steam->send_mail_from($recipient, "New message in forum " . $forum->get_name . ", thread: " . $object->get_name(), "", "postmaster", 1, "text/plain");
}
$steam->buffer_flush();
}
} else {
echo "Ihre Antwort hat keinen Inhalt!";
}
$ajaxResponseObject->setStatus("ok");
$widget = new \Widgets\JSWrapper();
$widget->setJs("location.reload();");
$ajaxResponseObject->addWidget($widget);
return $ajaxResponseObject;
}
示例4: frameResponse
public function frameResponse(\FrameResponseObject $frameResponseObject)
{
if (!empty($_FILES)) {
$array = file($_FILES["uploadedfile"]["tmp_name"]);
$string = "";
foreach ($array as $row) {
$string .= $row . " \n";
}
$obj = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id);
$icsFile = \steam_factory::create_textdoc($GLOBALS["STEAM"]->get_id(), "ics file " . $this->id, $string);
$obj->set_attribute("CALENDAR_ICS_FILE_IN", $icsFile);
} else {
$rawHtml = new \Widgets\RawHtml();
// HTML CODE FROM http://www.tizag.com/phpT/fileupload.php
$rawHtml->setHtml('<form enctype="multipart/form-data" action="#" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="100000" />
Choose a file to upload: <input name="uploadedfile" type="file" /><br />
<input type="submit" value="Upload File" />
</form>
');
$frameResponseObject->addWidget($rawHtml);
}
return $frameResponseObject;
}
示例5: get_comment_html
function get_comment_html($document, $url)
{
$cache = get_cache_function($document->get_id(), 600);
$user = lms_steam::get_current_user();
$write_access = $document->check_access(SANCTION_ANNOTATE, $user);
$template = new HTML_TEMPLATE_IT();
$template->loadTemplateFile(PATH_TEMPLATES . "comments.template.html");
$headline = gettext("Add your comment");
if ($_SERVER["REQUEST_METHOD"] == "POST" && $write_access) {
$values = $_POST["values"];
if (!empty($values["preview_comment"])) {
$template->setCurrentBlock("BLOCK_PREVIEW_COMMENT");
$template->setVariable("TEXT_COMMENT", $values["comment"]);
$template->setVariable("PREVIEW", gettext("Preview"));
$template->setVariable("POST_COMMENT", gettext("Post comment"));
$template->setVariable("LABEL_PREVIEW_YOUR_COMMENT", gettext("Preview your comment"));
$template->setVariable("VALUE_PREVIEW_COMMENT", get_formatted_output($values["comment"]));
$template->parse("BLOCK_PREVIEW_COMMENT");
$headline = gettext("Change it?");
}
if (!empty($values["submit_comment"]) && !empty($values["comment"])) {
$new_comment = steam_factory::create_textdoc($GLOBALS["STEAM"]->get_id(), $user->get_name() . "-" . time(), $values["comment"]);
$all_user = steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), STEAM_ALL_USER);
$new_comment->set_acquire($document);
$new_comment->set_read_access($all_user);
$document->add_annotation($new_comment);
$cache->drop("lms_steam::get_annotations", $document->get_id());
}
}
$comments = $cache->call("lms_steam::get_annotations", $document->get_id());
if (count($comments) > 0) {
$template->setVariable("LABEL_COMMENTS", gettext("comments"));
}
$comments = array_reverse($comments);
//reverse comment order (oldest first)
foreach ($comments as $comment) {
$obj_comment = steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $comment["OBJ_ID"]);
$template->setCurrentBlock("BLOCK_ANNOTATION");
$template->setVariable("COMMENT_ID", $comment["OBJ_ID"]);
$template->setVariable("AUTHOR_LINK", PATH_URL . "user/" . $comment["OBJ_CREATOR_LOGIN"] . "/");
$template->setVariable("AUTHOR_NAME", $comment["OBJ_CREATOR"]);
$template->setVariable("IMAGE_LINK", PATH_URL . "get_document.php?id=" . $comment["OBJ_ICON"]);
$template->setVariable("LABEL_SAYS", gettext("says"));
$template->setVariable("ANNOTATION_COMMENT", get_formatted_output($comment["CONTENT"], 80, "\n"));
$template->setVariable("HOW_LONG_AGO", how_long_ago($comment["OBJ_CREATION_TIME"]));
$template->setVariable('LINK_PERMALINK', $url . '/#comment' . $comment['OBJ_ID']);
$template->setVariable("LABEL_PERMALINK", gettext("permalink"));
if ($obj_comment->check_access_write($user)) {
$template->setCurrentBlock("BLOCK_OWN_COMMENT");
$template->setVariable("LINK_DELETE", $url . "/deletecomment" . $comment["OBJ_ID"] . "/");
$template->setVariable("LABEL_DELETE", gettext("delete"));
$template->setVariable("LINK_EDIT", $url . "/editcomment" . $comment["OBJ_ID"] . "/");
$template->setVariable("LABEL_EDIT", gettext("edit"));
$template->parse("BLOCK_OWN_COMMENT");
}
$template->parse("BLOCK_ANNOTATION");
}
if ($write_access) {
$template->setCurrentBlock("BLOCK_ADD_COMMENT");
$template->setVariable("LABEL_ADD_YOUR_COMMENT", $headline);
$template->setVariable("LABEL_PREVIEW", gettext("Preview"));
$template->setVariable("LABEL_OR", gettext("or"));
$template->setVariable("LABEL_COMMENT", gettext("Add comment"));
$template->setVariable("LABEL_BB_BOLD", gettext("B"));
$template->setVariable("HINT_BB_BOLD", gettext("boldface"));
$template->setVariable("LABEL_BB_ITALIC", gettext("I"));
$template->setVariable("HINT_BB_ITALIC", gettext("italic"));
$template->setVariable("LABEL_BB_UNDERLINE", gettext("U"));
$template->setVariable("HINT_BB_UNDERLINE", gettext("underline"));
$template->setVariable("LABEL_BB_STRIKETHROUGH", gettext("S"));
$template->setVariable("HINT_BB_STRIKETHROUGH", gettext("strikethrough"));
$template->setVariable("LABEL_BB_IMAGE", gettext("IMG"));
$template->setVariable("HINT_BB_IMAGE", gettext("image"));
$template->setVariable("LABEL_BB_URL", gettext("URL"));
$template->setVariable("HINT_BB_URL", gettext("web link"));
$template->setVariable("LABEL_BB_MAIL", gettext("MAIL"));
$template->setVariable("HINT_BB_MAIL", gettext("email link"));
$template->parse("BLOCK_ADD_COMMENT");
}
return $template->get();
}
示例6: frameResponse
public function frameResponse(\FrameResponseObject $frameResponseObject)
{
$workplanExtension = \Workplan::getInstance();
$workplanExtension->addJS();
$workplanExtension->addJS($fileName = 'jsgantt.js');
$workplanExtension->addCSS($fileName = 'jsgantt.css');
$user = $GLOBALS["STEAM"]->get_current_steam_user();
$portal = \lms_portal::get_instance();
$objectID = $this->params[0];
$workplanContainer = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $objectID);
if (is_object($workplanContainer) && $workplanContainer instanceof \steam_room) {
$tabBar = new \Widgets\TabBar();
$tabBar->setTabs(array(array("name" => "Überblick", "link" => $this->getExtension()->getExtensionUrl() . "overview/" . $objectID), array("name" => "Tabelle", "link" => $this->getExtension()->getExtensionUrl() . "listView/" . $objectID), array("name" => "Gantt-Diagramm", "link" => $this->getExtension()->getExtensionUrl() . "ganttView/" . $objectID), array("name" => "Mitarbeiter", "link" => $this->getExtension()->getExtensionUrl() . "users/" . $objectID), array("name" => "Snapshots", "link" => $this->getExtension()->getExtensionUrl() . "snapshots/" . $objectID)));
$tabBar->setActiveTab(4);
$frameResponseObject->addWidget($tabBar);
$xmlfile = $workplanContainer->get_inventory_filtered(array(array("+", "class", CLASS_DOCUMENT)));
// if user submitted new snapshot dialog add a now annotation/snapshot
if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST["new_snapshot"])) {
$values = $_POST["values"];
$newannotation = \steam_factory::create_textdoc($GLOBALS["STEAM"]->get_id(), $values["snapshotname"], strval($xmlfile[0]->get_version()), $workplanContainer);
$xmlfile[0]->add_annotation($newannotation);
$portal->set_confirmation("Snapshot " . $values["snapshotname"] . " erfolgreich erstellt.");
}
// display snapshot list
$content = $workplanExtension->loadTemplate("workplan_snapshots.template.html");
$snapshots = $xmlfile[0]->get_annotations();
$howmany = count($snapshots);
if ($howmany > 0) {
$content->setCurrentBlock("BLOCK_SNAPSHOTS_LIST");
$content->setVariable("NAME_LABEL", "Name");
$content->setVariable("DATE_LABEL", "Datum");
$content->setVariable("VIEW_LABEL", "Ansicht");
for ($count = count($snapshots) - 1; $count >= 0; $count--) {
$content->setCurrentBlock("BLOCK_SNAPSHOTS_LIST_ELEMENT");
$content->setVariable("ELEMENT_NAME", $snapshots[$count]->get_name());
$timestamp = $snapshots[$count]->get_attribute("OBJ_CREATION_TIME");
$content->setVariable("ELEMENT_DATE", strftime("%x %X", $timestamp));
$content->setVariable("ELEMENT_LIST", "Tabelle");
$content->setVariable("ELEMENT_GANTT", "Gantt-Diagramm");
$content->setVariable("WORKPLAN_VERSION", $snapshots[$count]->get_content());
$content->setVariable("WORKPLAN_ID", $objectID);
$content->setVariable("ANNOTATION_ID", $count);
$version = $snapshots[$count]->get_content();
if ($version == $xmlfile[0]->get_version()) {
$viewversion = $xmlfile[0];
} else {
$previousversions = $xmlfile[0]->get_previous_versions();
$viewversion = $previousversions[count($previousversions) - $version];
}
// change information of every snapshot to a form which is used to create the gantt view
$xml = simplexml_load_string($viewversion->get_content());
$helpToArray = $xml->children();
$list = array();
for ($counter = 0; $counter < count($helpToArray); $counter++) {
array_push($list, $helpToArray[$counter]);
}
usort($list, 'sort_xmllist');
$oids = "";
$names = "";
$start = "";
$end = "";
$depends = "";
$milestones = "";
for ($count2 = 0; $count2 < count($list); $count2++) {
$oids = $oids . $list[$count2]->oid . ",";
$names = $names . $list[$count2]->name . ",";
$start = $start . $list[$count2]->start . ",";
$end = $end . $list[$count2]->end . ",";
$depends = $depends . $list[$count2]->depends . ",";
if ($list[$count2]->getName() == 'milestone') {
$milestones = $milestones . "1,";
} else {
$milestones = $milestones . "0,";
}
}
$oids = "[" . substr($oids, 0, strlen($oids) - 1) . "]";
$names = "[" . substr($names, 0, strlen($names) - 1) . "]";
$start = "[" . substr($start, 0, strlen($start) - 1) . "]";
$end = "[" . substr($end, 0, strlen($end) - 1) . "]";
$depends = "[" . substr($depends, 0, strlen($depends) - 1) . "]";
$milestones = "[" . substr($milestones, 0, strlen($milestones) - 1) . "]";
$content->setVariable("WORKPLAN_OIDS", $oids);
$content->setVariable("WORKPLAN_NAMES", $names);
$content->setVariable("WORKPLAN_STARTS", $start);
$content->setVariable("WORKPLAN_ENDS", $end);
$content->setVariable("WORKPLAN_DEPENDS", $depends);
$content->setVariable("WORKPLAN_MILESTONES", $milestones);
$content->parse("BLOCK_SNAPSHOTS_LIST_ELEMENT");
}
$content->parse("BLOCK_SNAPSHOTS_LIST");
} else {
$content->setCurrentBlock("BLOCK_SNAPSHOTS_NO_LIST");
$content->setVariable("NO_SNAPSHOTS", "Keine Snapshots zu diesem Projektplan vorhanden.");
$content->parse("BLOCK_SNAPSHOTS_NO_LIST");
}
// if current user has the required rights display create snapshot dialog
$content->setCurrentBlock("BLOCK_NEW_SNAPSHOT");
$content->setVariable("WORKPLAN_ID", $objectID);
$content->setVariable("LABEL_NEW_SNAPSHOT", "Neuen Snapshot erstellen");
$content->setVariable("LABEL_NAME", "Name:*");
//.........这里部分代码省略.........
示例7: rawurlencode
if (!$allowed_annotate) {
if ($steamUser->get_name() === "guest") {
$do_login = True;
$error[] = "error_not_logged_in";
} else {
$error[] = "no_access";
}
}
if (trim($_POST["title"]) == "" || stripslashes($_POST["title"]) == "") {
$error[] = "error_title";
}
if (isset($_POST['content']) && trim($_POST["content"]) == "") {
$error[] = "error_content";
}
if (count($error) == 0) {
$new_annotation = steam_factory::create_textdoc($steam, rawurlencode($_POST["title"]), stripslashes($_POST["content"]));
$new_annotation->set_attributes(array(OBJ_DESC => norm_post($_POST["title"])));
$object->add_annotation($new_annotation);
// set acquiring
$new_annotation->set_acquire($object);
$subscription = $forum->get_attribute("bid:forum_subscription");
if ($subscription) {
foreach ($subscription as $key => $user) {
$user->get_attributes(array("USER_EMAIL"), 1);
}
$result = $steam->buffer_flush();
foreach ($subscription as $key => $user) {
$recipient = $user->get_attribute("USER_EMAIL");
$steam->send_mail_from($recipient, "New message in forum " . $forum->get_name . ", thread: " . $object->get_name(), "", "postmaster", 1, "text/plain");
}
$steam->buffer_flush();
示例8: 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);
//.........这里部分代码省略.........
示例9: frameResponse
public function frameResponse(\FrameResponseObject $frameResponseObject)
{
$element = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id);
$user = $GLOBALS["STEAM"]->get_current_steam_user();
$path = $element->get_path();
$path = substr($path, 0, strrpos($path, "/"));
$type = substr($path, strrpos($path, "/") + 1, strlen($path));
$TCR = \steam_factory::get_object_by_name($GLOBALS["STEAM"]->get_id(), substr($path, 0, strrpos($path, "/")));
$TCRExtension = \TCR::getInstance();
$TCRExtension->addCSS();
$TCRExtension->addJS();
$content = $TCRExtension->loadTemplate("tcr_release.template.html");
$members = $TCR->get_attribute("TCR_USERS");
sort($members);
$critics = $element->get_attribute("TCR_REVIEWS");
$group = $TCR->get_attribute("TCR_GROUP");
$private = 1;
// determine where the user is coming from
$referer = getenv("HTTP_REFERER");
if (strpos($referer, "Index") !== false) {
$backurl = $TCRExtension->getExtensionUrl() . "Index/" . $TCR->get_id();
$referer = 1;
} else {
if (strpos($referer, "documents") !== false) {
$backurl = $TCRExtension->getExtensionUrl() . "documents/" . $TCR->get_id();
$referer = 2;
} else {
if (strpos($referer, "privateDocuments") !== false) {
$backurl = $TCRExtension->getExtensionUrl() . "privateDocuments/" . $TCR->get_id();
$referer = 3;
}
}
}
if ($_SERVER["REQUEST_METHOD"] == "POST") {
// if a new comment was submitted
if (isset($_POST["add_comment"])) {
$new_comment = \steam_factory::create_textdoc($GLOBALS["STEAM"]->get_id(), $_POST["title"], stripslashes($_POST["content"]));
$new_comment->set_read_access($group);
$new_comment->set_write_access($group);
$element->add_annotation($new_comment);
}
// if a comment edit got submitted
if (isset($_POST["edit_comment"])) {
$comment = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $_POST["edit_id"]);
$comment->set_content($_POST["content"]);
$comment->set_name($_POST["title"]);
}
// determine where the user is coming from
$referer = $_POST["referer"];
if ($referer == 1) {
$backurl = $TCRExtension->getExtensionUrl() . "Index/" . $TCR->get_id();
} else {
if ($referer == 2) {
$backurl = $TCRExtension->getExtensionUrl() . "documents/" . $TCR->get_id();
} else {
if ($referer == 3) {
$backurl = $TCRExtension->getExtensionUrl() . "privateDocuments/" . $TCR->get_id();
}
}
}
}
// display dialog
$content->setCurrentBlock("BLOCK_RELEASE_ELEMENT");
if ($type == "theses") {
if (is_array($critics) && count($critics) > 0) {
// display already released thesis
$release_label = "These anzeigen";
$content->setVariable("SHOW_CRITICS", "none");
$content->setVariable("SHOW_RELEASE", "none");
$private = 0;
$released = 1;
} else {
// release dialog
$release_label = "These veröffentlichen";
$released = 0;
}
$kind = 0;
$kindWord = "These";
} else {
if ($type == "reviews") {
$released = $element->get_attribute("TCR_RELEASED");
if ($released != 0) {
// display already released review
$release_label = "Kritik anzeigen";
$content->setVariable("SHOW_RELEASE", "none");
$private = 0;
} else {
// release dialog
$release_label = "Kritik veröffentlichen";
}
$content->setVariable("SHOW_CRITICS", "none");
$kind = 1;
$kindWord = "Kritik";
} else {
$released = $element->get_attribute("TCR_RELEASED");
if ($released != 0) {
// display already released response
$release_label = "Replik anzeigen";
$content->setVariable("SHOW_RELEASE", "none");
$private = 0;
//.........这里部分代码省略.........
示例10: HTML_TEMPLATE_IT
<?php
require_once PATH_LIB . "format_handling.inc.php";
$content = new HTML_TEMPLATE_IT();
$content->loadTemplateFile(PATH_TEMPLATES . "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($_GET["id"], 600);
$fcache->drop("lms_forum::get_discussions", $_GET["id"]);
// clean forumcache
$fcache = get_cache_function($mbid, 600);
$fcache->drop("lms_forum::get_discussions", $mbid);
示例11: ajaxResponse
public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject)
{
$workplanExtension = \Workplan::getInstance();
$objectID = $this->params["id"];
$workplanContainer = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $objectID);
$user = $GLOBALS["STEAM"]->get_current_steam_user();
$xmlfile = $workplanContainer->get_inventory_filtered(array(array("+", "class", CLASS_DOCUMENT)));
$version = $this->params["version"];
// if user submitted create snapshot dialog create the new annotation/snapshot
$newsnapshot = 0;
if (isset($this->params["newsnapshot"])) {
$newsnapshot = $this->params["newsnapshot"];
}
if ($user->get_id() != $workplanContainer->get_creator()->get_id() && !in_array("WORKPLAN_" . $user->get_id() . "_LEADER", $workplanContainer->get_attribute_names())) {
$newsnapshot = 0;
}
if ($newsnapshot == 1) {
$newannotation = \steam_factory::create_textdoc($GLOBALS["STEAM"]->get_id(), $this->params["name"], strval($xmlfile[0]->get_version()), $workplanContainer);
$xmlfile[0]->add_annotation($newannotation);
$rawWidget = new \Widgets\RawHtml();
$ajaxResponseObject->setStatus("ok");
$ajaxResponseObject->addWidget($rawWidget);
return $ajaxResponseObject;
}
// load the right version
$previousversions = $xmlfile[0]->get_previous_versions();
if ($version == 0 || $version == count($previousversions) + 1 || $version == 1) {
$xml = simplexml_load_string($xmlfile[0]->get_content());
} else {
$thisversion = $previousversions[count($previousversions) - $version];
$xml = simplexml_load_string($thisversion->get_content());
}
$annotations = $xmlfile[0]->get_annotations();
// display general informations of a workplan (if version == 0 its the current one)
$content = $workplanExtension->loadTemplate("workplan_snapshots.template.html");
$content->setCurrentBlock("BEGIN BLOCK_SNAPSHOT_VIEW");
if ($version != 0) {
$annotation = $annotations[$this->params["annotationid"]];
$timestamp = $annotation->get_attribute("OBJ_CREATION_TIME");
$content->setVariable("SNAPSHOT_VERSION", "Snapshot " . $annotation->get_name() . " vom " . strftime("%x", (int) $timestamp));
} else {
$content->setVariable("SNAPSHOT_VERSION", "Aktueller Projektplan");
}
$content->setVariable("SNAPSHOT_VERSION_NAME", "Name");
$content->setVariable("SNAPSHOT_VERSION_NAME_VALUE", $xml["name"]);
$content->setVariable("SNAPSHOT_VERSION_START", "Beginn");
$content->setVariable("SNAPSHOT_VERSION_START_VALUE", strftime("%x", (int) $xml["start"]));
$content->setVariable("SNAPSHOT_VERSION_END", "Ende");
if ($xml["end"] != -1) {
$content->setVariable("SNAPSHOT_VERSION_END_VALUE", strftime("%x", (int) $xml["end"]));
} else {
$content->setVariable("SNAPSHOT_VERSION_END_VALUE", "-");
}
$content->setVariable("SNAPSHOT_VERSION_DESCRIPTION", "Beschreibung");
if (strlen($xml["description"]) > 0) {
$content->setVariable("SNAPSHOT_VERSION_DESCRIPTION_VALUE", nl2br($xml["description"]));
} else {
$content->setVariable("SNAPSHOT_VERSION_DESCRIPTION_VALUE", "-");
}
$content->parse("BEGIN BLOCK_SNAPSHOT_VIEW");
$rawWidget = new \Widgets\RawHtml();
$rawWidget->setHtml($content->get());
$ajaxResponseObject->setStatus("ok");
$ajaxResponseObject->addWidget($rawWidget);
return $ajaxResponseObject;
}
示例12: frameResponse
public function frameResponse(\FrameResponseObject $frameResponseObject)
{
$user = $GLOBALS["STEAM"]->get_current_steam_user();
$pyramidPosition = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id);
$positionGroup = $pyramidPosition->get_attribute("PYRAMIDDISCUSSION_RELGROUP");
$pyramidRoom = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->pyramiddiscussion);
$phase = $pyramidRoom->get_attribute("PYRAMIDDISCUSSION_ACTCOL");
$basegroup = $pyramidRoom->get_attribute("PYRAMIDDISCUSSION_BASEGROUP");
$admingroup = $pyramidRoom->get_attribute("PYRAMIDDISCUSSION_ADMINGROUP");
$adminconfig = $pyramidRoom->get_attribute("PYRAMIDDISCUSSION_ADMINCONFIG");
$pyramiddiscussionExtension = \Pyramiddiscussion::getInstance();
$pyramiddiscussionExtension->addCSS();
$pyramiddiscussionExtension->addJS();
$content = $pyramiddiscussionExtension->loadTemplate("pyramiddiscussion_viewposition.template.html");
// if a new comment was submitted
if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST["add_comment"])) {
$new_comment = \steam_factory::create_textdoc($GLOBALS["STEAM"]->get_id(), $_POST["title"], stripslashes($_POST["content"]));
$new_comment->set_read_access($basegroup);
$new_comment->set_read_access($admingroup);
$new_comment->set_write_access($basegroup);
$new_comment->set_write_access($admingroup);
$read_states = array();
$read_states[$user->get_id()] = 1;
$new_comment->set_attribute("PYRAMIDDISCUSSION_COMMENT_READ_STATES", $read_states);
$pyramidPosition->add_annotation($new_comment);
}
// if a comment edit got submitted
if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST["edit_comment"])) {
$comment = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $_POST["edit_id"]);
$comment->set_content($_POST["content"]);
$comment->set_name($_POST["title"]);
$read_states = array();
$read_states[$user->get_id()] = 1;
$comment->set_attribute("PYRAMIDDISCUSSION_COMMENT_READ_STATES", $read_states);
}
// check if user is admin and if adminoptions are shown
$showadmin = 1;
if ($admingroup->is_member($user)) {
if (array_key_exists($user->get_id(), $adminconfig)) {
$options = $adminconfig[$user->get_id()];
if (isset($options["show_adminoptions"]) && $options["show_adminoptions"] == "false") {
$showadmin = 0;
}
}
} else {
$showadmin = 0;
}
// get names of the users participating in this position
$participants = $pyramidRoom->get_attribute("PYRAMIDDISCUSSION_PARTICIPANT_MANAGEMENT");
$positionMembers = $positionGroup->get_members();
$names = "";
$users = array();
while (count($positionMembers) > 0) {
$currentMember = array_pop($positionMembers);
if ($currentMember instanceof \steam_user) {
if (!isset($participants[$currentMember->get_id()])) {
$participants[$currentMember->get_id()] = 0;
$pyramidRoom->set_attribute("PYRAMIDDISCUSSION_PARTICIPANT_MANAGEMENT", $participants);
}
if ($participants[$currentMember->get_id()] >= $pyramidPosition->get_attribute("PYRAMIDDISCUSSION_COLUMN") || $participants[$currentMember->get_id()] == 0) {
array_push($users, $currentMember->get_id());
}
} else {
$groupMembers = $currentMember->get_members();
for ($count = 0; $count < count($groupMembers); $count++) {
array_push($positionMembers, $groupMembers[$count]);
}
}
}
// determine if current user already read this position
$read_position = 0;
$read_position_states = $pyramidPosition->get_attribute("PYRAMIDDISCUSSION_POS_READ_STATES");
if (is_array($read_position_states)) {
if (array_key_exists($user->get_id(), $read_position_states)) {
$read_position = $read_position_states[$user->get_id()];
}
}
if ($pyramidPosition->get_content() == "0" || $pyramidPosition->get_content() == "") {
$read_position = 1;
}
// display current position
$content->setCurrentBlock("BLOCK_PYRAMID_POSITION");
if ($pyramidPosition->get_attribute("PYRAMIDDISCUSSION_POS_TITLE") != "0" && $pyramidPosition->get_attribute("PYRAMIDDISCUSSION_POS_TITLE") != "") {
$content->setVariable("PYRAMID_POSITION", $pyramidPosition->get_attribute("PYRAMIDDISCUSSION_POS_TITLE"));
} else {
$content->setVariable("PYRAMID_POSITION", "Position_" . $pyramidPosition->get_attribute("PYRAMIDDISCUSSION_COLUMN") . "_" . $pyramidPosition->get_attribute("PYRAMIDDISCUSSION_ROW"));
}
$positionPhase = $pyramidPosition->get_attribute("PYRAMIDDISCUSSION_COLUMN");
$positionRow = $pyramidPosition->get_attribute("PYRAMIDDISCUSSION_ROW");
if ($positionPhase != 1) {
$previous1 = \steam_factory::get_object_by_name($GLOBALS["STEAM"]->get_id(), $pyramidRoom->get_path() . "/Position_" . ($positionPhase - 1) . "_" . ($positionRow * 2 - 1));
$previous2 = \steam_factory::get_object_by_name($GLOBALS["STEAM"]->get_id(), $pyramidRoom->get_path() . "/Position_" . ($positionPhase - 1) . "_" . $positionRow * 2);
$content->setVariable("PREVIOUS1_SHOW", "Position " . ($positionPhase - 1) . "-" . ($positionRow * 2 - 1) . " anzeigen");
$content->setVariable("PREVIOUS2_SHOW", "Position " . ($positionPhase - 1) . "-" . $positionRow * 2 . " anzeigen");
$content->setVariable("PREVIOUS1_HIDE", "Position " . ($positionPhase - 1) . "-" . ($positionRow * 2 - 1) . " ausblenden");
$content->setVariable("PREVIOUS2_HIDE", "Position " . ($positionPhase - 1) . "-" . $positionRow * 2 . " ausblenden");
$content->setVariable("PREVIOUS1_CONTENT", $previous1->get_content());
$content->setVariable("PREVIOUS2_CONTENT", $previous2->get_content());
} else {
$content->setVariable("DISPLAY_PREVIOUS", "none");
//.........这里部分代码省略.........