本文整理汇总了PHP中FrameResponseObject::setProblemSolution方法的典型用法代码示例。如果您正苦于以下问题:PHP FrameResponseObject::setProblemSolution方法的具体用法?PHP FrameResponseObject::setProblemSolution怎么用?PHP FrameResponseObject::setProblemSolution使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FrameResponseObject
的用法示例。
在下文中一共展示了FrameResponseObject::setProblemSolution方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
//.........这里部分代码省略.........
} else {
$workroom = $grp->get_workroom();
}
if (!isset($wiki_container) || !is_object($wiki_container)) {
$new_wiki = \steam_factory::create_room($GLOBALS["STEAM"]->get_id(), $values["name"], $env, $values["dsc"]);
$new_wiki->set_attribute("OBJ_TYPE", "container_wiki_koala");
$_SESSION["confirmation"] = str_replace("%NAME", $values["name"], gettext("New wiki '%NAME' created."));
} else {
$wiki_container->set_attribute(OBJ_NAME, $values["name"]);
if ($values["wiki_startpage"] == gettext("Glossary")) {
$values["wiki_startpage"] = "glossary";
}
$wiki_container->set_attribute("OBJ_WIKI_STARTPAGE", $values["wiki_startpage"]);
$wiki_container->set_attribute(OBJ_DESC, $values["dsc"]);
//$portal->set_confirmation(gettext( "The changes have been saved." ));
$new_wiki = $wiki_container;
}
$koala_wiki = new \lms_wiki($new_wiki);
$access = (int) $values["access"];
$access_descriptions = \lms_wiki::get_access_descriptions($grp);
if (!$accessmergel) {
$koala_wiki->set_access($access, $access_descriptions[$access]["members"], $access_descriptions[$access]["steam"], $group_members, $group_staff, $group_admins);
}
$GLOBALS["STEAM"]->buffer_flush();
$cache = get_cache_function(\lms_steam::get_current_user()->get_name());
$cache->drop("lms_steam::get_inventory_recursive", $workroom->get_id(), CLASS_CONTAINER, array("OBJ_TYPE", "WIKI_LANGUAGE"));
$cache->drop("lms_steam::get_group_communication_objects", $workroom->get_id(), CLASS_MESSAGEBOARD | CLASS_CALENDAR | CLASS_CONTAINER | CLASS_ROOM);
if (!isset($wiki_container) || !is_object($wiki_container)) {
header("Location: " . $backlink);
exit;
}
} else {
$frameResponseObject->setProblemDescription($problems);
$frameResponseObject->setProblemSolution(isset($hints) ? $hints : "");
}
}
$content = \Wiki::getInstance()->loadTemplate("object_new.template.html");
//$content = new HTML_TEMPLATE_IT( PATH_TEMPLATES );
//$content->loadTemplateFile( "object_new.template.html" );
if (isset($wiki_container) && is_object($wiki_container)) {
$content->setVariable("INFO_TEXT", str_replace("%NAME", h($wiki_container->get_name()), gettext("You are going to edit the wiki '<b>%NAME</b>'.")));
$content->setVariable("LABEL_CREATE", gettext("Save changes"));
$pagetitle = gettext("Preferences");
if (empty($values)) {
$values = array();
$values["name"] = $wiki_container->get_name();
$values["dsc"] = $wiki_container->get_attribute(OBJ_DESC);
$values["wiki_startpage"] = $wiki_container->get_attribute("OBJ_WIKI_STARTPAGE");
$values["access"] = $wiki_container->get_attribute(KOALA_ACCESS);
}
$breadcrumbheader = gettext("Preferences");
$content->setVariable("OPTION_WIKI_GLOSSARY", gettext("Glossary"));
$wiki_entries = $wiki_container->get_inventory(CLASS_DOCUMENT);
$wiki_entries_sorted = array();
foreach ($wiki_entries as $wiki_entry) {
if ($wiki_entry->get_attribute(DOC_MIME_TYPE) === "text/wiki") {
$wiki_entries_sorted[] = str_replace(".wiki", "", $wiki_entry->get_name());
}
}
sort($wiki_entries_sorted);
$startpageFound = false;
foreach ($wiki_entries_sorted as $wiki_entry) {
$content->setCurrentBlock("BLOCK_WIKI_STARTPAGE_OPTION");
$content->setVariable("OPTION_WIKI_STARTPAGE", $wiki_entry);
if ($values["wiki_startpage"] == $wiki_entry) {
$content->setVariable("WIKI_STARTPAGE_SELECTED", "selected");
示例2: execute
public function execute(\FrameResponseObject $frameResponseObject)
{
if (!($env = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $_GET["env"]))) {
throw new \Exception("Environment unknown.");
}
$koala_env = \koala_object::get_koala_object($env);
if (isset($_SERVER["HTTP_REFERER"])) {
$http_referer = $_SERVER["HTTP_REFERER"];
} else {
$http_referer = "";
}
$backlink = empty($_POST["values"]["backlink"]) ? $http_referer : $_POST["values"]["backlink"];
$max_file_size = parse_filesize(ini_get('upload_max_filesize'));
$max_post_size = parse_filesize(ini_get('post_max_size'));
if ($max_post_size > 0 && $max_post_size < $max_file_size) {
$max_file_size = $max_post_size;
}
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$values = isset($_POST["values"]) ? $_POST["values"] : array();
$problems = "";
$hints = "";
if (empty($_FILES) || !empty($_FILES["material"]["error"]) && $_FILES["material"]["error"] > 0) {
if (!empty($_FILES) && empty($_FILES["material"]["name"])) {
$problems = gettext("No file chosen.") . " ";
$hints = gettext("Please choose a local file to upload.") . " ";
} else {
$problems = gettext("Could not upload document.") . " ";
$hints = str_replace(array("%SIZE", "%TIME"), array(readable_filesize($max_file_size), (string) ini_get('max_execution_time')), gettext("Maybe your document exceeded the allowed file size (max. %SIZE) or the upload might have taken too long (max. %TIME seconds).")) . " ";
}
}
if (empty($problems)) {
$content = file_get_contents($_FILES["material"]["tmp_name"]);
/*
ob_start();
readfile( $_FILES["material"]["tmp_name"] );
$content = ob_get_contents();
ob_end_clean();
*/
if (defined("LOG_DEBUGLOG")) {
$time1 = microtime(TRUE);
\logging::write_log(LOG_DEBUGLOG, "upload" . " \t" . $GLOBALS["STEAM"]->get_login_user_name() . " \t" . $_FILES["material"]["name"] . " \t" . filesize($_FILES["material"]["tmp_name"]) . " Bytes \t... ");
}
$filename = str_replace(array("\\", "'"), array("", ""), $_FILES["material"]["name"]);
$new_material = \steam_factory::create_document($GLOBALS["STEAM"]->get_id(), $filename, $content, $_FILES["material"]["type"], FALSE);
if (defined("LOG_DEBUGLOG")) {
\logging::append_log(LOG_DEBUGLOG, " \t" . round((microtime(TRUE) - $time1) * 1000) . " ms");
}
// Disabled for Testing issues
// upload($new_material->get_content_id(), $content);
if (isset($values["dsc"])) {
$new_material->set_attribute("OBJ_DESC", $values["dsc"]);
}
$new_material->move($env);
$_SESSION["confirmation"] = str_replace("%DOCUMENT", h($filename), gettext("'%DOCUMENT' has been uploaded."));
header("Location: " . $backlink);
exit;
} else {
$frameResponseObject->setProblemDescription($problems);
$frameResponseObject->setProblemSolution($hints);
//$portal->set_problem_description( $problems, $hints );
}
}
$content = \Wiki::getInstance()->loadTemplate("upload.template.html");
//$content = new HTML_TEMPLATE_IT( PATH_TEMPLATES );
//$content->loadTemplateFile( "upload.template.html" );
$content->setVariable("LABEL_UPLOAD", gettext("Upload"));
$content->setVariable("LABEL_FILE", gettext("Local file"));
$content->setVariable("LABEL_DSC", gettext("Description"));
$content->setVariable("BACKLINK", "<a href=\"{$backlink}\">" . gettext("back") . "</a>");
$content->setVariable("BACK_LINK", $backlink);
$content->setVariable("FORM_ACTION", PATH_URL . "wiki/upload/" . (isset($_GET["env"]) ? "?env=" . $_GET["env"] : ""));
if ($max_file_size > 0) {
$content->setVariable("MAX_FILE_SIZE_INPUT", "<input type='hidden' name='MAX_FILE_SIZE' value='" . (string) $max_file_size . "'/>");
$content->setVariable("MAX_FILE_SIZE_INFO", "<br />" . str_replace("%SIZE", readable_filesize($max_file_size), gettext("The maximum allowed file size is %SIZE.")));
}
$link_path = $koala_env->get_link_path();
if (!is_array($link_path)) {
$link_path = array();
}
$link_path[] = array("name" => gettext("Upload document"));
if (!WIKI_FULL_HEADLINE) {
$tmp_array = array();
$elem_last = array_pop($link_path);
$elem_first = array_pop($link_path);
$tmp_array[] = $elem_first;
$tmp_array[] = $elem_last;
$link_path = $tmp_array;
}
//$portal->set_page_main( $link_path, $content->get() );
//$portal->set_page_main( str_replace( "%ENV", $env->get_name(), gettext( "New upload in '%ENV'" ) ), $content->get() );
//$portal->set_page_title( gettext( "Upload document" ) );
//$portal->show_html();
$frameResponseObject->setHeadline($link_path);
$widget = new \Widgets\RawHtml();
$widget->setHtml($content->get());
$frameResponseObject->addWidget($widget);
return $frameResponseObject;
}
示例3: frameResponse
//.........这里部分代码省略.........
}
if ($_POST["kind"] == 0) {
$container = \steam_factory::get_object_by_name($GLOBALS["STEAM"]->get_id(), $TCR->get_path() . "/theses");
} else {
if ($_POST["kind"] == 1) {
$container = \steam_factory::get_object_by_name($GLOBALS["STEAM"]->get_id(), $TCR->get_path() . "/reviews");
} else {
$container = \steam_factory::get_object_by_name($GLOBALS["STEAM"]->get_id(), $TCR->get_path() . "/responses");
}
}
$title = $_POST["title"];
$desc = $_POST["desc"];
if (empty($problems)) {
$new_element = \steam_factory::create_document($GLOBALS["STEAM"]->get_id(), $title, $content, $type, $container, $desc);
if ($_POST["kind"] == 0) {
$new_element->set_attribute("TCR_ROUND", $_POST["round"]);
$new_element->set_attribute("TCR_REVIEWS", array());
$new_element->set_attribute("TCR_RELEASED", 0);
} else {
if ($_POST["kind"] == 1) {
$new_element->set_attribute("TCR_RELEASED", 0);
$correspondingThesis = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $_POST["elementID"]);
$critics_thesis = $correspondingThesis->get_attribute("TCR_REVIEWS");
$critics_thesis[$user->get_id()] = $new_element->get_id();
$correspondingThesis->set_attribute("TCR_REVIEWS", $critics_thesis);
} else {
$new_element->set_attribute("TCR_RELEASED", 0);
$correspondingReview = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $_POST["elementID"]);
$correspondingReview->set_attribute("TCR_RESPONSE", $new_element->get_id());
}
}
} else {
$frameResponseObject->setProblemDescription($problems);
$frameResponseObject->setProblemSolution($hints);
}
}
// display actionbar
$actionbar = new \Widgets\Actionbar();
$admins = $TCR->get_attribute("TCR_ADMINS");
if (in_array($user->get_id(), $admins)) {
$actions = array(array("name" => "Konfiguration", "link" => $TCRExtension->getExtensionUrl() . "configuration/" . $this->id), array("name" => "Private Dokumente", "link" => $TCRExtension->getExtensionUrl() . "privateDocuments/" . $this->id), array("name" => "Übersicht", "link" => $TCRExtension->getExtensionUrl() . "Index/" . $this->id), array("name" => "Alle Dokumente", "link" => $TCRExtension->getExtensionUrl() . "documents/" . $this->id));
} else {
$actions = array(array("name" => "Private Dokumente", "link" => $TCRExtension->getExtensionUrl() . "privateDocuments/" . $this->id), array("name" => "Übersicht", "link" => $TCRExtension->getExtensionUrl() . "Index/" . $this->id), array("name" => "Alle Dokumente", "link" => $TCRExtension->getExtensionUrl() . "documents/" . $this->id));
}
$actionbar->setActions($actions);
$frameResponseObject->addWidget($actionbar);
$group = $TCR->get_attribute("TCR_GROUP");
if ($group->get_name() == "learners") {
$parent = $group->get_parent_group();
$courseOrGroup = "Kurs: " . $parent->get_attribute("OBJ_DESC") . " (" . $parent->get_name() . ")";
$courseOrGroupUrl = PATH_URL . "semester/" . $parent->get_id();
} else {
$courseOrGroup = "Gruppe: " . $group->get_name();
$courseOrGroupUrl = PATH_URL . "groups/" . $group->get_id();
}
$content = $TCRExtension->loadTemplate("tcr_privatedocuments.template.html");
// display a message if current user is not a user of this tcr
$members = $TCR->get_attribute("TCR_USERS");
if (!in_array($user->get_id(), $members)) {
$content->setCurrentBlock("BLOCK_DOCUMENTS_TABLE");
$content->setVariable("DISPLAY_TABLE", "none");
$content->setVariable("NOT_USER", "Sie sind nicht als Teilnehmer dieses Thesen-Kritik-Replik-Verfahrens eingetragen. Wenden Sie sich an einen Administrator.");
$content->parse("BLOCK_DOCUMENTS_TABLE");
$rawWidget = new \Widgets\RawHtml();
$rawWidget->setHtml($content->get());
$frameResponseObject->addWidget($rawWidget);
示例4: frameResponse
public function frameResponse(\FrameResponseObject $frameResponseObject)
{
if (isset($this->id)) {
$object = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id);
if ($object instanceof \steam_exit) {
$object = $object->get_exit();
$this->id = $object->get_id();
}
} else {
$currentUser = $GLOBALS["STEAM"]->get_current_steam_user();
$object = $currentUser->get_workroom();
$this->id = $object->get_id();
}
if (!$object instanceof \steam_object) {
\ExtensionMaster::getInstance()->send404Error();
die;
}
$objectModel = \AbstractObjectModel::getObjectModel($object);
if ($object && $object instanceof \steam_container) {
$count = $object->count_inventory();
if ($count > 150) {
die("Es befinden sich {$count} Objekte im diesem Ordner. Das Laden ist nicht möglich.");
}
$objects = $object->get_inventory();
} else {
$objects = array();
}
$objectType = getObjectType($object);
switch ($objectType) {
case "document":
header("location: " . PATH_URL . "explorer/ViewDocument/" . $this->id . "/");
die;
break;
case "forum":
header("location: " . PATH_URL . "forum/Index/" . $this->id . "/");
die;
break;
case "referenceFolder":
$exitObject = $object->get_exit();
header("location: " . PATH_URL . "explorer/Index/" . $exitObject->get_id() . "/");
die;
break;
case "referenceFile":
$linkObject = $object->get_link_object();
header("location: " . PATH_URL . "explorer/Index/" . $linkObject->get_id() . "/");
die;
break;
case "user":
header("location: " . PATH_URL . "user/Index/" . $object->get_name() . "/");
die;
break;
case "group":
\ExtensionMaster::getInstance()->send404Error();
die;
break;
case "trashbin":
\ExtensionMaster::getInstance()->send404Error();
die;
break;
case "portal_old":
$rawHtml = new \Widgets\RawHtml();
//$rawHtml->setHtml("Dies ist ein \"altes\" Portal und kann nicht mehr angezeigt werden. Bitte umwandeln.");
$frameResponseObject->addWidget($rawHtml);
$frameResponseObject->setProblemDescription("Dies ist ein \"altes\" Portal und kann nicht mehr angezeigt werden.");
$frameResponseObject->setProblemSolution("Bitte umwandeln.");
return $frameResponseObject;
break;
case "gallery":
header("location: " . PATH_URL . "gallery/Index/" . $this->id . "/");
die;
break;
case "portal":
header("location: " . PATH_URL . "portal/Index/" . $this->id . "/");
die;
break;
case "portalColumn":
\ExtensionMaster::getInstance()->send404Error();
die;
break;
case "portalPortlet":
\ExtensionMaster::getInstance()->send404Error();
die;
break;
case "userHome":
//ok
break;
case "groupWorkroom":
//ok
break;
case "room":
//ok
break;
case "container":
//ok
break;
case "unknown":
\ExtensionMaster::getInstance()->send404Error();
die;
break;
}
//.........这里部分代码省略.........