public function processData(\IRequestObject $requestObject) { $params = $requestObject->getParams(); $parentObjectId = $params["portletObjectId"]; $name = "Neue Meldung"; //check diffrent types of parameter if (is_string($parentObjectId)) { $portletObject = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $parentObjectId); } else { $portletObject = $parentObjectId; } $pName = "Neue Meldung"; $pContent = "Bitte geben Sie hier den Meldungstext ein."; $pMimeType = "text/plain"; $pEnvironment = $portletObject; //default is FALSE $pDescription = ""; $messageObject = \steam_factory::create_document($GLOBALS["STEAM"]->get_id(), $pName, $pContent, $pMimeType, $pEnvironment, $pDescription); $messageObject->set_attribute("bid:doctype", "portlet:msg"); $messageObject->set_attribute("bid:portlet:msg:link_open", "checked"); $messageObject->set_attribute("bid:portlet:msg:link_url", ""); $messageObject->set_attribute("bid:portlet:msg:link_url_label", ""); $messageObject->set_attribute("bid:portlet:msg:picture_alignment", "left"); $messageObject->set_attribute("bid:portlet:msg:picture_width", ""); $this->addMessageIdToPortlet($portletObject, $messageObject); }
public static function create($name, $portfolio) { $newComment = steam_factory::create_document($GLOBALS["STEAM"]->get_id(), $name, "", $pMimeType = ""); $newComment->move($portfolio->getRoom()); $newComment->set_attribute(PORTFOLIO_PREFIX . "TYPE", "COMMENT"); $newComment->set_attribute("OBJ_TYPE", PORTFOLIO_PREFIX . "COMMENT"); $newComment = new Comment($newComment); return $newPortfolio; }
public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject) { $ajaxResponseObject->setStatus("ok"); $current_room = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id); $portal = \steam_factory::create_document($GLOBALS["STEAM"]->get_id(), strip_tags($this->params["name"]), "", "text/html", $current_room); $jswrapper = new \Widgets\JSWrapper(); $jswrapper->setJs(<<<END \t\tcloseDialog(); \t\tsendRequest("LoadContent", {"id":"{$this->id}"}, "explorerWrapper", "updater", null, null, "explorer"); END ); $ajaxResponseObject->addWidget($jswrapper); return $ajaxResponseObject; }
public function frameResponse(\FrameResponseObject $frameResponseObject) { if (!defined("FILE_PERSISTENCE") || !FILE_PERSISTENCE) { $html = "FILE_PERSISTENCE must be <b>true</b>"; } else { $html = "FILE_PERSISTENCE is enabled.<br>"; $html .= "FILE_PERSISTENCE_PATH is " . FILE_PERSISTENCE_PATH . ".<br><br>Create a new document in your home \"filePersistenceTest.txt\"."; $doc = \steam_factory::create_document($GLOBALS["STEAM"]->get_id(), "filePersistenceTest.txt", "I am a file on file system.", "text/plain"); $home = $GLOBALS["STEAM"]->get_current_steam_user()->get_workroom(); $doc->move($home); } $rawHtml = new \Widgets\RawHtml(); $rawHtml->setHtml($html); $frameResponseObject->addWidget($rawHtml); return $frameResponseObject; }
public function frameResponse(\FrameResponseObject $frameResponseObject) { $mplme = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id); $frameResponseObject->setTitle("Mplme"); if (isset($_REQUEST["xmlData"])) { $xmlDoc = \steam_factory::get_object_by_name($GLOBALS["STEAM"]->get_id(), $mplme->get_path() . "/data.xml"); if ($xmlDoc === 0 || !$xmlDoc instanceof \steam_document) { $xml = simplexml_load_string("<datasets></datasets>"); $xmlDoc = \steam_factory::create_document($GLOBALS["STEAM"]->get_id(), "data.xml", $xml->asXML(), "text/xml"); $xmlDoc->move($mplme); } else { $xmlRaw = $xmlDoc->get_content(); $xml = simplexml_load_string($xmlRaw); } $xmlRequest = simplexml_load_string($_REQUEST["xmlData"]); $xmlRequestDom = new \domDocument(); $xmlRequestDom->loadXML($xmlRequest->asXML()); $xmlDom = new \domDocument(); $xmlDom->loadXML($xml->asXML()); $xmlDom->documentElement->appendChild($xmlDom->importNode($xmlRequestDom->documentElement, true)); if ($_FILES && is_array($_FILES)) { foreach ($_FILES as $file) { $content = file_get_contents($file["tmp_name"]); $doc = \steam_factory::create_document($GLOBALS["STEAM"]->get_id(), $file["name"], $content, $file["type"]); $doc->move($mplme); } } $xmlDoc->set_content($xmlDom->saveXML()); //echo "<pre>" . htmlentities($xmlDom->saveXML()) . "</pre>"; echo "ok"; } else { echo "nix"; } die; //echo "done"; //$frameResponseObject->addWidget(new \Widgets\Blank()); //return $frameResponseObject; }
public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject) { $currentUser = $GLOBALS["STEAM"]->get_current_steam_user(); $currentUserName = $currentUser->get_name(); $dialog = new \Widgets\Dialog(); $dialog->setTitle("Eintrag diskutieren"); $dialog->setDescription("..."); $dialog->setPositionX($this->params["mouseX"]); $dialog->setPositionY($this->params["mouseY"]); // get discussion thread between portfolio owner and current user or create empty thread $threads = $this->entry->get_annotations(); $discussion = null; foreach ($threads as $thread) { if ($thread->get_name() === $currentUserName) { $discussion = $thread; } } if (!isset($discussion)) { $discussion = \steam_factory::create_document($GLOBALS["STEAM"]->get_id(), $currentUserName, "Discussing with " . $currentUserName . ".", "text/plain"); $this->entry->add_annotation($discussion); } $chat = new \Widgets\Chat(); $chat->setData($discussion); $dialog->addWidget($chat); $dialog->addWidget(new \Widgets\Clearer()); $rawHtml = new \Widgets\RawHtml(); $rawHtml->setHtml("<hr>"); $dialog->addWidget($rawHtml); $textinput = new \Widgets\TextInput(); $textinput->setData($discussion); $textinput->setContentProvider(\Widgets\DataProvider::annotationDataProvider()); $textinput->setLabel("Kommentar schreiben"); $dialog->addWidget($textinput); $ajaxResponseObject->setStatus("ok"); $ajaxResponseObject->addWidget($dialog); return $ajaxResponseObject; }
} } 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 { $portal->set_problem_description($problems, $hints); }
public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject) { $ajaxResponseObject->setStatus("ok"); if (!isset($this->params["group"])) { $rawWidget = new \Widgets\RawHtml(); $rawWidget->setHtml("Error: Kurs oder Gruppe auswählen"); $ajaxResponseObject->addWidget($rawWidget); return $ajaxResponseObject; } if ($this->params["group"] == 1) { // course if (!isset($this->params["course"])) { $rawWidget = new \Widgets\RawHtml(); $rawWidget->setHtml("Error: Kurs oder Gruppe auswählen"); $ajaxResponseObject->addWidget($rawWidget); return $ajaxResponseObject; } $course = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->params["course"]); $subgroups = $course->get_subgroups(); foreach ($subgroups as $subgroup) { if ($subgroup->get_name() == "staff") { $admingroup = $subgroup; } else { if ($subgroup->get_name() == "learners") { $basegroup = $subgroup; } } } } else { // group if (!isset($this->params["basegroup"]) || !isset($this->params["admingroup"])) { $rawWidget = new \Widgets\RawHtml(); $rawWidget->setHtml("Error: Kurs oder Gruppe auswählen"); $ajaxResponseObject->addWidget($rawWidget); return $ajaxResponseObject; } $basegroup = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->params["basegroup"]); $admingroup = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->params["admingroup"]); } $start = $this->params["startElements"]; $maxcol = intval(log($start, 2) + 1); $pyramidRoom = \steam_factory::create_room($GLOBALS["STEAM"]->get_id(), $this->params["title"], $basegroup->get_workroom(), $this->params["title"]); $pyramidRoom->set_sanction_all($admingroup); $pyramidRoom->set_sanction_all($basegroup); $pyramidRoom->set_attribute("OBJ_TYPE", "container_pyramiddiscussion"); $pyramidRoom->set_attribute("PYRAMIDDISCUSSION_ACTCOL", 0); $pyramidRoom->set_attribute("PYRAMIDDISCUSSION_ADMINGROUP", $admingroup); $pyramidRoom->set_attribute("PYRAMIDDISCUSSION_BASEGROUP", $basegroup); $pyramidRoom->set_attribute("PYRAMIDDISCUSSION_DEADLINES", array()); $pyramidRoom->set_attribute("PYRAMIDDISCUSSION_EDITOR", $this->params["editor"]); $pyramidRoom->set_attribute("PYRAMIDDISCUSSION_INITIALIZED", 1); $pyramidRoom->set_attribute("PYRAMIDDISCUSSION_MAX", $start); $pyramidRoom->set_attribute("PYRAMIDDISCUSSION_MAXCOL", $maxcol); $pyramidRoom->set_attribute("PYRAMIDDISCUSSION_OVERRIDE_DEADLINES", 0); $pyramidRoom->set_attribute("PYRAMIDDISCUSSION_USEDEADLINES", "no"); $pyramidRoom->set_attribute("PYRAMIDDISCUSSION_VERSION", "koala_3.0"); $participants = array(); $members = $basegroup->get_members(); $admins = $admingroup->get_members(); foreach ($admins as $admin) { if (!$basegroup->is_member($admin) && $admin instanceof \steam_user) { array_push($members, $admin); } } foreach ($members as $member) { if ($member instanceof \steam_user) { $participants[$member->get_id()] = 0; } } $pyramidRoom->set_attribute("PYRAMIDDISCUSSION_PARTICIPANT_MANAGEMENT", $participants); $adminconfig = array(); foreach ($admins as $admin) { if ($admin instanceof \steam_user) { $options = array(); $options["show_adminoptions"] = "true"; $adminconfig[$admin->get_id()] = $options; } } $pyramidRoom->set_attribute("PYRAMIDDISCUSSION_ADMINCONFIG", $adminconfig); $pyramidGroup = \steam_factory::create_group($GLOBALS["STEAM"]->get_id(), "pyramid_" . $pyramidRoom->get_id(), $basegroup); // create position documents and corresponding groups $groups = array(); for ($count = 1; $count <= $maxcol; $count++) { for ($count2 = 1; $count2 <= $start / pow(2, $count - 1); $count2++) { $newGroup = \steam_factory::create_group($GLOBALS["STEAM"]->get_id(), "group_" . $count . "_" . $count2, $pyramidGroup); $newGroup->set_insert_access($basegroup); $newGroup->set_insert_access($admingroup); $groups[$count . $count2] = $newGroup; $newPosition = \steam_factory::create_document($GLOBALS["STEAM"]->get_id(), "Position_" . $count . "_" . $count2, "", $this->params["editor"], $pyramidRoom, "Position " . $count . "-" . $count2); $newPosition->set_attribute("PYRAMIDDISCUSSION_COLUMN", $count); $newPosition->set_attribute("PYRAMIDDISCUSSION_ROW", $count2); $newPosition->set_attribute("PYRAMIDDISCUSSION_POS_READ_STATES", array()); $newPosition->set_attribute("PYRAMIDDISCUSSION_POS_TITLE", ""); $newPosition->set_attribute("PYRAMIDDISCUSSION_RELGROUP", $newGroup); } } // generate group structure for ($count = 2; $count <= $maxcol; $count++) { for ($count2 = 1; $count2 <= $start / pow(2, $count - 1); $count2++) { $groups[$count . $count2]->add_member($groups[$count - 1 . ($count2 * 2 - 1)]); $groups[$count . $count2]->add_member($groups[$count - 1 . $count2 * 2]); } } foreach ($groups as $group) { $pyramidGroup->add_member($group); } $path = PATH_URL; $jswrapper = new \Widgets\JSWrapper(); $jswrapper->setJs(<<<END \t\tcloseDialog(); END ); $ajaxResponseObject->addWidget($jswrapper); return $ajaxResponseObject; }
// } if (!isset($msg)) { $msg = steam_factory::get_object($steam, $message); } $action = "save return(portlets/msg/edit.php)"; //on file upload, upload picture to steam if (isset($_FILES["picture"]["size"]) && $_FILES["picture"]["size"] > 0) { //get temporary filename $filename = $_FILES["picture"]["tmp_name"]; //get picture content ob_start(); readfile($filename); $data = ob_get_contents(); ob_end_clean(); //upload picture $picture_id = steam_factory::create_document($steam, time() . $_FILES["picture"]["name"], $data, "", $portlet); # $msg->upload($portlet, $data); // Die folgende Attribtierung funktioniert seit der Umstellung auf PHP5 aus ungekl�rten // Gr�nden nicht mehr: $picture_id hat hier keinen (vern�nftigen) Wert. Bei der Umstellung // auf das neue API sollten die Attribute aber wieder gesetzt werden. // $picture = new steam_object($picture_id); // $steam->set_attribute($picture, "bid:doctype", "portlet:picture"); // $steam->set_attribute($picture, "OBJ_DESC", $_FILES["picture"]["name"]); } if ($_POST["headline"] != "") { $msg->set_attribute("OBJ_NAME", norm_post("headline")); } else { $msg->set_attribute("OBJ_NAME", $language == "ge" ? "KEINE Überschrift gesetzt" : "NO headline set"); } $msg->set_attribute("OBJ_DESC", norm_post("subheadline")); $msg->set_attribute("bid:portlet:msg:picture_alignment", isset($_POST["picture_alignment"]) ? $_POST["picture_alignment"] : "left");
public function createSurvey($old = null) { if ($old == null) { $survey_container = \steam_factory::create_container($GLOBALS["STEAM"]->get_id(), $this->name, $this->rapidfeedback, $this->name); $results_container = \steam_factory::create_container($GLOBALS["STEAM"]->get_id(), "results", $survey_container, "container for results"); } else { $survey_container = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $old); $results_container = \steam_factory::get_object_by_name($GLOBALS["STEAM"]->get_id(), $survey_container->get_path() . "/results"); } $survey_container->set_attribute("RAPIDFEEDBACK_STATE", 0); $survey_container->set_attribute("RAPIDFEEDBACK_RESULTS", 0); $survey_container->set_attribute("RAPIDFEEDBACK_PARTICIPANTS", array()); if ($this->starttype == 0) { $survey_container->set_attribute("RAPIDFEEDBACK_STARTTYPE", 0); } else { $begin = $this->begin; $end = $this->end; $begin = mktime(0, 0, 0, substr($begin, 3, 2), substr($begin, 0, 2), substr($begin, 6, 4)); $end = mktime(0, 0, 0, substr($end, 3, 2), substr($end, 0, 2), substr($end, 6, 4)); $times = array(); array_push($times, $end); array_push($times, $begin); $survey_container->set_attribute("RAPIDFEEDBACK_STARTTYPE", $times); } $survey_container->set_attribute("RAPIDFEEDBACK_QUESTIONS", count($this->questions)); $xml = new \SimpleXMLElement("<survey></survey>"); $xml->addChild("name", $this->name); $xml->addChild("begintext", $this->begintext); $xml->addChild("endtext", $this->endtext); foreach ($this->questions as $question) { $xml_question = $xml->addChild("question"); $question->saveXML($xml_question); } if ($old == null) { $xml_document = \steam_factory::create_document($GLOBALS["STEAM"]->get_id(), "survey.xml", $xml->saveXML(), "text/xml", $survey_container); } else { $xml_document = \steam_factory::get_object_by_name($GLOBALS["STEAM"]->get_id(), $survey_container->get_path() . "/survey.xml"); $xml_document->set_content($xml->saveXML()); } return $survey_container; }
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 defined("OBJ_ID") or define("OBJ_ID", $wiki_container->get_id()); $content = \Wiki::getInstance()->loadTemplate("wiki_edit.template.html"); //$content = new HTML_TEMPLATE_IT(); //$content->loadTemplateFile( PATH_TEMPLATES . "wiki_edit.template.html" ); $wiki_entries = $wiki_container->get_inventory(CLASS_DOCUMENT); foreach ($wiki_entries as $wiki_entry) { if ($wiki_entry->get_attribute(DOC_MIME_TYPE) === "text/wiki") { $name = $wiki_entry->get_name(); $content->setCurrentBlock("BLOCK_WIKI_ENTRY_OPTION"); $content->setVariable("WIKI_ENTRY_OPTION", "<option value=\"{$name}\">{$name}</option>"); $content->parse("BLOCK_WIKI_ENTRY_OPTION"); } } $problems = ""; if (!isset($create)) { $create = FALSE; } if ($_SERVER["REQUEST_METHOD"] == "POST") { $values = $_POST["values"]; 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($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 (strpos($values["title"], "/")) { if (!isset($problems)) { $problems = ""; } $problems .= gettext("Please don't use the \"/\"-char in the subject of your post."); } if (empty($problems)) { $wiki_content = str_replace("@", "@", $values["body"]); if (!empty($values['save'])) { if ($create) { $wiki_doc = \steam_factory::create_document($GLOBALS["STEAM"]->get_id(), $values["title"] . ".wiki", $wiki_content, "text/wiki", $wiki_container, ""); } else { // PRUEFEN, OB ALLES OK, DANN NEUE WERTE SPEICHERN $wiki_doc->set_name($values['title'] . ".wiki"); $wiki_doc->set_content($wiki_content); } // Clean cache for wiki_entries $cache = get_cache_function($wiki_container->get_id(), 600); $cache->clean($wiki_container->get_id()); // clean rsscache $rcache = get_cache_function("rss", 600); $feedlink = PATH_URL . "services/feeds/wiki_public.php?id=" . $wiki_container->get_id(); $rcache->drop("lms_rss::get_items", $feedlink); header("Location: " . PATH_URL . "wiki/editentry/" . $wiki_doc->get_id() . "/"); exit; } else { // PREVIEW $content->setCurrentBlock("BLOCK_PREVIEW"); $content->setVariable("LABEL_PREVIEW_EDIT", gettext("Preview the description")); $content->setVariable("PREVIEW_EDIT", get_formatted_output($values["desc"])); $content->parse("BLOCK_PREVIEW"); $headline = gettext("Change it?"); $content->setVariable("TEXT_DSC", h($values["desc"])); $content->setVariable("TITLE_COMMENT", h($values["title"])); } } else { $frameResponseObject->setProblemDescription($problems); //$portal->set_problem_description( $problems ); } } if (empty($values)) { $wikicontent = ""; $wikiname = ""; if (!$create) { $wikicontent = $wiki_doc->get_content(); $wikicontent = str_replace("@", "@", $wikicontent); $wikiname = $wiki_doc->get_name(); } if (WIKI_WYSIWYG) { //TODO $content->setVariable("TEXT_DSC", h($wikicontent)); //$content->setVariable( "TEXT_DSC", wikitext_to_html( h($wikicontent), $wiki_container->get_id() ) ); //$content->setVariable( "NIC_SCRIPT", PATH_JAVASCRIPT . "niceditor/nicEdit.js"); } else { $content->setVariable("TEXT_DSC", h($wikicontent)); } $content->setVariable("TITLE_COMMENT", str_replace(".wiki", "", h($wikiname))); $content->setVariable("BACK_LINK", $_SERVER["HTTP_REFERER"]); } else { $content->setVariable("TITLE_COMMENT", h($values["title"])); if (isset($values["body"])) { $content->setVariable("TEXT_DSC", h($values["body"])); } } $content->setVariable("LABEL_HERE_IT_IS", ""); $content->setVariable("LABEL_TITLE", gettext("Title")); $content->setVariable("LABEL_BODY", gettext("Body")); //$content->setVariable( "LABEL_WIKI_H2", gettext( "H2" ) ); //$content->setVariable( "HINT_WIKI_H2", gettext( "heading (level 2)" ) ); //$content->setVariable( "LABEL_WIKI_H3", gettext( "H3" ) ); //$content->setVariable( "HINT_WIKI_H3", gettext( "heading (level 3)" ) ); //$content->setVariable( "LABEL_WIKI_BOLD", gettext( "'''B'''" ) ); //$content->setVariable( "HINT_WIKI_BOLD", gettext( "boldface" ) ); //$content->setVariable( "LABEL_WIKI_ITALIC", gettext( "''I''" ) ); //$content->setVariable( "HINT_WIKI_ITALIC", gettext( "italic" ) ); //$content->setVariable( "LABEL_WIKI_BULLET_LIST", gettext( "* list" ) ); //$content->setVariable( "HINT_WIKI_BULLET_LIST", gettext( "bullet list" ) ); //$content->setVariable( "LABEL_WIKI_NUMBERED_LIST", gettext( "# list" ) ); //$content->setVariable( "HINT_WIKI_NUMBERED_LIST", gettext( "numbered list" ) ); //$content->setVariable( "LABEL_WIKI_LINE", gettext( "-----" ) ); //$content->setVariable( "HINT_WIKI_LINE", gettext( "horizontal line" ) ); //$content->setVariable( "LABEL_WIKI_LINK", gettext( "[[wiki]]" ) ); //$content->setVariable( "HINT_WIKI_LINK", gettext( "wiki link" ) ); //$content->setVariable( "LABEL_WIKI_URL", gettext( "[URL]" ) ); //$content->setVariable( "HINT_WIKI_URL", gettext( "web link" ) ); //$content->setVariable( "LABEL_WIKI_IMAGE", gettext( "IMG" ) ); //$content->setVariable( "HINT_WIKI_IMAGE", gettext( "image" ) ); $content->setVariable("LABEL_PREVIEW", gettext("Preview")); $content->setVariable("LABEL_SAVE_CHANGES", gettext("Save changes")); $content->setVariable("LABEL_RETURN", gettext("back")); $content->setVariable("JS_NOTICE", '"' . gettext("Warning!\\nYou have edited your entry!\\nIf you proceed, all changes will be lost!\\nDo you really want to proceed?") . '"'); // widget: Images //$widget = new HTML_TEMPLATE_IT(); //$widget->loadTemplateFile( PATH_TEMPLATES . "widget_wiki_images.template.html" ); $inventory = $wiki_container->get_inventory(); if (!is_array($inventory)) { $inventory = array(); } if (sizeof($inventory) > 0) { \steam_factory::load_attributes($GLOBALS["STEAM"]->get_id(), $inventory, array(OBJ_NAME, OBJ_DESC, DOC_MIME_TYPE)); $images = array(); foreach ($inventory as $object) { $mime = strtolower($object->get_attribute(DOC_MIME_TYPE)); if ($mime === "image/jpg" || $mime === "image/jpeg" || $mime === "image/gif" || $mime === "image/png") { $images[] = $object; } } if (empty($images)) { $content->setCurrentBlock("BLOCK_WIKI_ENTRY_NOIMAGE"); $content->setVariable("WIKI_ENTRY_NOIMAGE", "Es befinden sich keine Bilder in der Mediathek."); $content->parse("BLOCK_WIKI_ENTRY_NOIMAGE"); } else { $i = 0; foreach ($images as $image) { $path = PATH_URL . "download/image/" . $image->get_id() . "/40/80/"; $content->setCurrentBlock("BLOCK_WIKI_ENTRY_IMAGE"); $content->setVariable("WIKI_ENTRY_IMAGE", <<<END <table style="float:left"> \t<tr> \t\t<td> \t\t\t<input id="image{$i}" type="radio" name="images" value="{$image->get_name()}"/> \t\t</td> \t\t<td> \t\t\t<img src="{$path}" title="{$image->get_name()}"> \t\t</td> \t</tr> </table> \t END ); $content->parse("BLOCK_WIKI_ENTRY_IMAGE"); $i++; //$widget->setCurrentBlock("BLOCK_IMAGE"); //$widget->setVariable("WIKI_IMAGE_NAME", $image->get_name()); //$widget->setVariable("WIKI_IMAGE_ADD_LINK", "javascript:insert('[[Image:" . $image->get_identifier() . "]]', '', 'formular', 'values[body]')"); //$widget->setVariable("WIKI_IMAGE_LINK", PATH_URL . "get_document.php?id=" . $image->get_id() . "&width=40&height=80"); //$widget->setVariable("WIKI_IMAGE_VIEW_LINK", PATH_URL . "doc/" . $image->get_id() . "/"); //$widget->setVariable("WIKI_IMAGE_TITLE", $image->get_name()); //$widget->setVariable("WIKI_IMAGE_ADD", gettext("Insert")); //$widget->setVariable("WIKI_IMAGE_VIEW", gettext("View")); //$widget->parse("BLOCK_IMAGE"); } } } //$widget->setVariable("UPLOAD_TEXT", gettext("Upload an image")); //$widget->setVariable("UPLOAD_LINK", PATH_URL . "upload/?env=" . $wiki_container->get_id()); //$widget->setVariable("WIKI_IMAGE_EXTERNAL", gettext("External image")); //$widget->setVariable("WIKI_IMAGE_EXTERNAL_LINK", "javascript:insert('[[Image:http://', ']]', 'formular', 'values[body]')"); //$content->setCurrentBlock("BLOCK_WIDGET"); //$content->setVariable("WIDGET_TITLE", gettext("Images")); //$content->setVariable("WIDGET_HTML_CODE", $widget->get()); //$content->parse("BLOCK_WIDGET"); if ($create) { $pagetitle = gettext("New Article"); } else { $pagetitle = str_replace("%NAME", h(substr($wiki_doc->get_name(), 0, -5)), gettext("Edit '%NAME'?")); } $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" => "", "name" => $pagetitle)) : ($headline = array(array("name" => h($wiki_container->get_name()), "link" => PATH_URL . "wiki/index/" . $wiki_container->get_id() . "/"), array("link" => "", "name" => $pagetitle))); /*$portal->set_page_main( $headline, $content->get() ); $portal->show_html(); */ $frameResponseObject->setHeadline($headline); $rawHtml = new \Widgets\RawHtml(); $rawHtml->setHtml($content->get()); $frameResponseObject->addWidget($rawHtml); return $frameResponseObject; }
$koala_support_installed_version = "0.0"; $ask_text = "Install koala_support version "; } else { output("Found koala_support {$koala_support_installed_version}"); $ask_text = "Update koala_support to version "; } output(" (newest available version is {$koala_support_server_version}).\n"); if (strcmp($koala_support_installed_version, $koala_support_server_version) < 0) { $ask_update = new ConfigEntry("update.koala_support", "YesNo", $ask_text . $koala_support_server_version . " ?", NULL, "yes"); if ($ask_update->ask() === "yes") { $package_container = steam_factory::get_object_by_name($STEAM->get_id(), "/packages"); if (!is_object($package_container)) { output("Could not find /packages on your open-sTeam server.\n"); exit(1); } $package = steam_factory::create_document($STEAM->get_id(), $koala_support_spm->get_name(), $koala_support_spm->get_content(), $koala_support_spm->get_attribute(DOC_MIME_TYPE), $package_container); if (!is_object($package)) { output("Could not upload " . $koala_support_spm->get_name() . " to your open-sTeam server.\n"); exit(1); } try { if (!$STEAM->install_package($package)) { throw new Exception("Installation failed."); } output("Installed koala_support {$koala_support_server_version} on your open-sTeam server.\n"); } catch (Exception $ex) { output("Could not install koala_support {$koala_support_server_version}: " . $ex->getMessage() . "\n"); output($ex->getTraceAsString() . "\n"); } $package->delete(); }
/** *function create_textdoc: * * @param $pSteamConnector * @param $pName * @param $pContent * @param $pEnviroment * @param $pDescription * * @return */ public static function create_textdoc($pSteamConnectorID, $pName, $pContent, $pEnvironment = FALSE, $pDescription = "") { if (!is_string($pSteamConnectorID)) { throw new ParameterException("pSteamConnectorID", "string"); } return steam_factory::create_document($pSteamConnectorID, $pName, $pContent, "text/plain", $pEnvironment, $pDescription); }
/** * Returns array('success'=>true) or array('error'=>'error message') */ function handleUpload($uploadDirectory, $replaceOldFile = FALSE) { if (!is_writable($uploadDirectory)) { return array('error' => "Server error. Upload directory isn't writable."); } if (!$this->file) { return array('error' => 'No files were uploaded.'); } $size = $this->file->getSize(); if ($size == 0) { return array('error' => 'File is empty'); } if ($size > $this->sizeLimit) { return array('error' => 'File is too large'); } $pathinfo = pathinfo($this->file->getName()); $filename = $pathinfo['filename']; //$filename = md5(uniqid()); $ext = $pathinfo['extension']; if ($this->allowedExtensions && !in_array(strtolower($ext), $this->allowedExtensions)) { $these = implode(', ', $this->allowedExtensions); return array('error' => 'File has an invalid extension, it should be one of ' . $these . '.'); } //create empty steam_document and check write access $steam_document = \steam_factory::create_document($GLOBALS["STEAM"]->get_id(), $this->file->getName(), "", "", \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->envid)); if (!$replaceOldFile) { /// don't overwrite previous files that were uploaded while (file_exists($uploadDirectory . $filename . '.' . $ext)) { $filename .= rand(10, 99); } } if ($this->file->save($uploadDirectory . $filename . '.' . $ext)) { $steam_document->set_content(file_get_contents($uploadDirectory . $filename . '.' . $ext)); unlink($uploadDirectory . $filename . '.' . $ext); return array('success' => true, 'oid' => $steam_document->get_id()); } else { return array('error' => 'Could not save uploaded file.' . 'The upload was cancelled, or server error encountered'); } }
public function execute(\FrameResponseObject $frameResponseObject) { //$portal = \lms_portal::get_instance(); //$portal->initialize( GUEST_NOT_ALLOWED ); //$portal->set_page_title( gettext( "Buddy Icon" ) ); $user = \lms_steam::get_current_user(); $confirmText = ""; if ($_SERVER["REQUEST_METHOD"] == "POST") { $problem = ""; $hint = ""; if (isset($_POST["action"]) && $_POST["action"] == "deleteicon") { // need to set OBJ_ICON to "0" and then to icons module to avoid weird // effects in icon handling (server side fix done but not testedyet) $old_icon = $user->get_attribute("OBJ_ICON"); $user->set_acquire_attribute("OBJ_ICON", 0); $user->set_attribute("OBJ_ICON", 0); // set the default user icon by acquiring OBJ_ICON from icons module $user->set_acquire_attribute("OBJ_ICON", $GLOBALS["STEAM"]->get_module("icons")); // delete previous user icon object if ($old_icon instanceof steam_document) { if ($old_icon->get_path() != "/images/doctypes/user_unknown.jpg" && $old_icon->check_access_write($user)) { $this->clean_iconcache($old_icon); $old_icon->delete(); } } $confirmText = gettext("Your profile icon has been deleted."); $this->clean_usericoncache($user); } else { // upload new icon if (count($_FILES) == 0) { $problem = gettext("No image specified.") . " "; $hint = gettext("Please choose an image on your local disk to upload.") . " "; } if (strpos($_FILES["icon"]["type"], "image") === FALSE) { $problem .= gettext("File is not an image.") . " "; $hint .= gettext("The icon has to be an image file (JPG, GIF or PNG)."); } if ((int) $_FILES["icon"]["size"] > 256000) { $problem .= gettext("File is larger than 250 KByte."); $hint .= gettext("It is only allowed to upload profile icons with file size smaller than 250 KByte."); } if (empty($problem)) { $user->set_acquire_attribute("OBJ_ICON", 0); $user->delete_value("OBJ_ICON"); $old_icon = $user->get_attribute("OBJ_ICON"); ob_start(); readfile($_FILES["icon"]["tmp_name"]); $content = ob_get_contents(); ob_end_clean(); $filename = str_replace(array("\\", "'"), array("", ""), $_FILES["icon"]["name"]); if ($old_icon instanceof steam_document && $old_icon->check_access_write($user)) { $new_icon = $old_icon; $new_icon->set_attribute("OBJ_NAME", $filename); $new_icon->set_content($content); $new_icon->set_attribute("DOC_MIME_TYPE", $_FILES["icon"]["type"]); } else { $new_icon = \steam_factory::create_document($GLOBALS["STEAM"]->get_id(), $filename, $content, $_FILES["icon"]["type"], FALSE); $new_icon->set_attribute("OBJ_TYPE", "document_icon_usericon"); } $user->set_attribute("OBJ_ICON", $new_icon); $all_user = \steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), "sTeam"); $new_icon->set_read_access($all_user); $GLOBALS["STEAM"]->buffer_flush(); // clean cache-related data $this->clean_usericoncache($user); $confirmText = gettext("Your profile icon has been changed."); } else { $frameResponseObject->setProblemDescription($problem); } } } $content = \Profile::getInstance()->loadTemplate("profile_icon.template.html"); //$content = new \HTML_TEMPLATE_IT(); //$content->loadTemplateFile( PATH_TEMPLATES . "profile_icon.template.html" ); //$content->setVariable( "INFO_TEXT", gettext( "Your buddy icon is what we use to represent you when you're in koaLA." ) ); if (PLATFORM_ID == "bid") { $content->setVariable("INFO_TEXT", "Hier können Sie ein Benutzerbild hinterlegen. Dieses wird beispielsweise an Ihren Dokumenten und Forenbeiträgen zusammen mit Ihrem Namen angezeigt."); } else { $content->setVariable("INFO_TEXT", "Das Benutzerbild wird Sie in " . PLATFORM_NAME . " repräsentieren"); } $content->setVariable("WINDOW_CONFIRM_TEXT", gettext("Are you sure you want to delete your current buddy icon?")); $content->setVariable("LABEL_DELETE", gettext("DELETE")); $user->delete_value("OBJ_ICON"); $icon = $user->get_attribute("OBJ_ICON"); if ($icon instanceof \steam_object) { $icon_id = $icon->get_id(); // if user icon is acquired (= default icon) hide the delete button if (is_object($user->get_acquire_attribute("OBJ_ICON"))) { $content->setVariable("HIDE_BUTTON", "style='display:none;'"); } } else { $icon_id = 0; $content->setVariable("HIDE_BUTTON", "style='display:none;'"); } // use it in 140x185 standard thumb size to optimize sharing of icon cache data $icon_link = $icon_id == 0 ? PATH_URL . "styles/standard/images/anonymous.jpg" : PATH_URL . "download/image/" . $icon_id . "/140/185"; $content->setVariable("USER_IMAGE", $icon_link); $content->setVariable("LABEL_YOUR_BUDDY_ICON", gettext("This is your buddy icon at the moment.")); $content->setVariable("LABEL_REPLACE", gettext("Replace with an image")); $content->setVariable("LABEL_UPLOAD_INFO", gettext("The uploaded file has to be an image file (JPG, GIF or PNG), should have the dimensions of 140 x 185 pixels and <b>may not be larger than 250 KByte</b>. ")); $content->setVariable("LABEL_UPLOAD", gettext("Upload")); if (PLATFORM_ID == "bid") { $breadcrumb = array(array("name" => $user->get_attribute("USER_FIRSTNAME") . " " . $user->get_attribute("USER_FULLNAME"), "link" => PATH_URL . "home"), array("name" => gettext("Profile"), "link" => PATH_URL . "profile/"), array("name" => gettext("Your buddy icon"))); } else { $breadcrumb = array(array("name" => $user->get_attribute("USER_FIRSTNAME") . " " . $user->get_attribute("USER_FULLNAME"), "link" => PATH_URL . "profile/" . "index/" . $user->get_name() . "/"), array("name" => gettext("Profile"), "link" => PATH_URL . "profile/index/" . $user->get_name() . "/"), array("name" => gettext("Your buddy icon"))); } $frameResponseObject->setHeadline($breadcrumb); $frameResponseObject->setConfirmText($confirmText); $rawHtml = new \Widgets\RawHtml(); $rawHtml->setHtml($content->get()); $frameResponseObject->addWidget($rawHtml); return $frameResponseObject; //$portal->set_page_main($breadcrumb, $content->get(), ""); //return $portal->get_html(); }
function get_exam_cert_preview() { $cert_preview_path = $this->container_try[$this->current_try]->get_path() . "/zertifikat_preview.jpg"; $cert_preview = steam_factory::path_to_object($GLOBALS["STEAM"]->get_id(), $cert_preview_path); if (!is_object($cert_preview) || is_object($cert_preview) && !$cert_preview instanceof steam_document) { $cert_preview = steam_factory::create_document($GLOBALS["STEAM"]->get_id(), "zertifikat_preview.jpg", "", "image/jpeg", $this->container_try[$this->current_try]); $elearning_course = elearning_mediathek::get_elearning_course_for_course($this->course_group); $cert_preview->set_attribute("OBJ_DESC", "Zertifikat-Vorschau der Schulung \"" . $elearning_course->get_name() . "\""); $cert_preview->set_attribute("OBJ_TYPE", "elearning_course_cert_perview"); } return $cert_preview; }
break; case "plain": case "html": if (trim($_POST["title"]) != "") { $mimetype = "text/{$action}"; $inventory = $current_room->get_inventory(); for ($i = 0; $i < count($inventory); $i++) { if (rawurlencode($_POST["title"]) == $inventory[$i]->get_name()) { $result = $inventory[$i]; $result->set_content(stripslashes($_POST["text"])); $result->set_attribute("DOC_MIME_TYPE", $mimetype); break; } } if (!$result) { $result = steam_factory::create_document($steam, $title, stripslashes($_POST["text"]), $mimetype, $current_room, $desc); } } else { $error[] = "error_title"; } break; case "link": if (trim($_POST["title"]) != "" && trim($_POST["url"]) != "") { $result = steam_factory::create_docextern($steam, $title, $_POST["url"], $current_room, $desc); } else { if (trim($_POST["title"]) == "") { $error[] = "error_title"; } if (trim($_POST["url"]) == "") { $error[] = "error_url"; }
public function set_content() { // ini_set("post_max_size", "50M"); // ini_set("upload_max_filesize", "50M"); // ini_set("memory_limit", "50M" ); $user = lms_steam::get_current_user(); if ($this->path == "upload/") { /* * Artefacts Upload Content */ 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.") . " "; } else { $problems = gettext("Could not upload document.") . " "; } $_SESSION["confirmation"] = str_replace("%DOCUMENT", h($filename), $problems); } if (empty($problems)) { $content = file_get_contents($_FILES["material"]["tmp_name"]); $filename = str_replace(array("\\", "'"), array("", ""), $_FILES["material"]["name"]); $artefacts_container = $user->get_workroom()->get_object_by_name("portfolio")->get_object_by_name("artefacts"); $new_container = steam_factory::create_container($GLOBALS["STEAM"]->get_id(), $filename, $artefacts_container); $new_material = steam_factory::create_document($GLOBALS["STEAM"]->get_id(), $filename, $content, $_FILES["material"]["type"], FALSE); print $values["dsc"] . "hhhh"; $new_material->set_attribute("DESCRIPTION", $values["dsc"]); $new_container->set_attribute("DESCRIPTION", $values["dsc"]); $new_material->move($new_container); $_SESSION["confirmation"] = str_replace("%DOCUMENT", h($filename), gettext("'%DOCUMENT' has been uploaded.")); // header( "Location: " . PATH_SERVER . "/portfolio/artefacts/" ); exit; } } else { /* * Artefacts Upload Form */ $template = new HTML_TEMPLATE_IT(); $template->loadTemplateFile(PORTFOLIO_PATH_TEMPLATES . "artefacts_upload.template.html"); $template->setVariable("LABEL_UPLOAD", gettext("Upload")); $template->setVariable("LABEL_FILE", gettext("Local file")); $template->setVariable("LABEL_DSC", gettext("Description")); $template->setVariable("FORM_ACTION", PATH_SERVER . "/portfolio/artefacts/upload/"); $this->template->setVariable("HTML_CODE_LEFT", $template->get()); } } else { /* * Artefacts List */ $template = new HTML_TEMPLATE_IT(); $template->loadTemplateFile(PORTFOLIO_PATH_TEMPLATES . "artefacts.template.html"); $user = lms_steam::get_current_user(); /* * ALLE Artefakte holen */ $workroom = $user->get_workroom(); $portfolio_container = $workroom->get_object_by_name("portfolio"); $artefacts_container = $portfolio_container->get_object_by_name("artefacts"); $all_container = $artefacts_container->get_inventory(); foreach ($all_container as $artefact_container) { // $artefact_container->get_inventory(); $id = $artefact_container->get_object_by_name($artefact_container->get_name())->get_id(); $template->setCurrentBlock("BLOCK_ARTEFACT_ROW"); $template->setVariable("ARTEFACT_PATH", PATH_SERVER . "/download/" . $id . "/" . $artefact_container->get_name()); $template->setVariable("ARTEFACT_NAME", $artefact_container->get_name()); $template->setVariable("ARTEFACT_SIZE", $artefact_container->get_name()); $template->setVariable("ARTEFACT_DESCRIPTION", $artefact_container->get_attribute("DESCRIPTION") === 0 ? "" : $artefact_container->get_attribute("DESCRIPTION")); $template->parseCurrentBlock("BLOCK_ARTEFACT_ROW"); } /* * Artefakte eines Portfolios holen */ //$artefacts =) $this->portfolio->get_artefactes(); // if (count($artefacts) > 0) { // foreach ($artefacts as $artefact) { // $template->setCurrentBlock("BLOCK_ARTEFACT_ROW"); // $template->setVariable("ARTEFACT_NAME", "HUND"); // $template->parseCurrentBlock("BLOCK_ARTEFACT_ROW"); // } // } else { // //N$template->setVariable(_ARTEFACTS_TEXT // } $this->template->setVariable("HTML_CODE_LEFT", $template->get()); } }
public function addActivity($name) { $this->checkActivity(); $activitiesRoom = $this->getRoom()->get_object_by_name(PORTFOLIO_PREFIX . "ACTIVITIES"); $activity = steam_factory::create_document($GLOBALS["STEAM"]->get_id(), $name, "", "", $activitiesRoom); }
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; }
public function frameResponse(\FrameResponseObject $frameResponseObject) { $TCR = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id); $user = $GLOBALS["STEAM"]->get_current_steam_user(); $TCRExtension = \TCR::getInstance(); $TCRExtension->addCSS(); // determine kind of documents of the current user to display (0 = theses, 1 = reviews, 2 = responses) $kindOfDocument = 0; if (isset($this->params[1])) { $kindOfDocument = $this->params[1]; } // release document dialog was submitted if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST["release_element"])) { $element = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $_POST["element_id"]); if ($_POST["kind"] == 0) { $critics = array(); $critics[$_POST["critic"]] = 0; $element->set_attribute("TCR_REVIEWS", $critics); $element->set_attribute("TCR_RELEASED", time()); } else { $element->set_attribute("TCR_RELEASED", time()); } } // edit document dialog was submitted if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST["edit_element"])) { $old_element = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $_POST["old_id"]); // old element was plain text if ($old_element->get_attribute("DOC_MIME_TYPE") == "text/plain") { // new element is plain text if ($_POST["new_upload_text"] == 0) { $old_element->set_name($_POST["title"]); $old_element->set_attribute("OBJ_DESC", $_POST["desc"]); $old_element->set_content($_POST["content"]); // new element is an upload } else { $old_element->delete(); $radio = 1; } // old element was an upload } else { // new element is the same if ($_POST["new_upload"] == 0) { $old_element->set_name($_POST["title"]); $old_element->set_attribute("OBJ_DESC", $_POST["desc"]); // new element is a new upload } else { if ($_POST["new_upload"] == 1) { $old_element->delete(); $radio = 1; // new element is plain text } else { $old_element->set_attribute("DOC_MIME_TYPE", "text/plain"); $old_element->set_name($_POST["title"]); $old_element->set_attribute("OBJ_DESC", $_POST["desc"]); $old_element->set_content($_POST["new_content"]); } } } } // if a new element got created or already existing element gets a new upload if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST["create_element"]) || isset($radio)) { $problems = ""; $hints = ""; if (!isset($radio)) { $radio = $_POST["radio"]; } if ($radio == 1) { // handle upload require_once PATH_LIB . "format_handling.inc.php"; $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 (empty($_FILES) || !empty($_FILES["file"]["error"]) && $_FILES["file"]["error"] > 0) { if (!empty($_FILES) && empty($_FILES["file"]["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["file"]["tmp_name"]); $type = $_FILES["file"]["type"]; } } else { $content = $_POST["content"]; $type = "text/plain"; } 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); $frameResponseObject->setHeadline(array(array("name" => $courseOrGroup, "link" => $courseOrGroupUrl), array("name" => "Thesen-Kritik-Replik-Verfahren", "link" => $TCRExtension->getExtensionUrl() . "Index/" . $this->id), array("name" => "Private Dokumente"))); return $frameResponseObject; } // display tabbar $tabBar = new \Widgets\TabBar(); $tabBar->setTabs(array(array("name" => "Thesen", "link" => $TCRExtension->getExtensionUrl() . "privateDocuments/" . $this->id), array("name" => "Kritiken", "link" => $TCRExtension->getExtensionUrl() . "privateDocuments/" . $this->id . "/1"), array("name" => "Repliken", "link" => $TCRExtension->getExtensionUrl() . "privateDocuments/" . $this->id . "/2"))); $tabBar->setActiveTab($kindOfDocument); $frameResponseObject->addWidget($tabBar); // create array structure and add theses for their round $rounds = $TCR->get_attribute("TCR_ROUNDS"); $theses_container = \steam_factory::get_object_by_name($GLOBALS["STEAM"]->get_id(), $TCR->get_path() . "/theses"); $theses_inventory = $theses_container->get_inventory(); $theses = array(); $theses_response = array(); foreach ($theses_inventory as $thesis) { $current_round = $thesis->get_attribute("TCR_ROUND"); if ($thesis->get_creator()->get_id() == $user->get_id()) { $theses[$current_round] = $thesis; } $critics = $thesis->get_attribute("TCR_REVIEWS"); if (is_array($critics)) { if (array_key_exists($user->get_id(), $critics)) { $theses_response[$current_round] = $thesis; } } } // display private documents table $content->setCurrentBlock("BLOCK_DOCUMENTS_TABLE"); if ($kindOfDocument == 0 || $kindOfDocument == 2) { $content->setVariable("THESES_LABEL", "Erstellte Thesen"); $content->setVariable("REVIEWS_LABEL", "Erhaltene Kritiken"); $content->setVariable("RESPONSES_LABEL", "Erstellte Repliken"); if ($kindOfDocument == 0) { // thesis view for ($count = 1; $count <= $rounds; $count++) { $content->setCurrentBlock("BLOCK_DOCUMENTS_TABLE_ELEMENT"); $content->setVariable("ROUND_VALUE", "Runde " . $count); if (!array_key_exists($count, $theses)) { $content->setVariable("CREATE_THESIS", "These erstellen"); $content->setVariable("THESIS_ICON", "create_32"); $content->setVariable("THESIS_URL", $TCRExtension->getExtensionUrl() . "create/" . $this->id . "/" . $count . "/" . $kindOfDocument); $content->setVariable("DISPLAY_THESIS_SECOND", "none"); $content->setVariable("DISPLAY_REVIEW", "none"); $content->setVariable("DISPLAY_RESPONSE", "none"); } else { $current_critics = $theses[$count]->get_attribute("TCR_REVIEWS"); if (count($current_critics) > 0) { $content->setVariable("CREATE_THESIS", "Anzeigen"); $content->setVariable("THESIS_ICON", "view_32"); $content->setVariable("THESIS_URL", $TCRExtension->getExtensionUrl() . "release/" . $theses[$count]->get_id()); $content->setVariable("DISPLAY_THESIS_SECOND", "none"); foreach ($current_critics as $critic => $review) { if ($review == 0) { $content->setVariable("DISPLAY_REVIEW", "none"); $content->setVariable("DISPLAY_RESPONSE", "none"); $review_released = 0; } else { $current_review = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $review); $review_released = $current_review->get_attribute("TCR_RELEASED"); } if ($review_released != 0) { $content->setVariable("CREATE_REVIEW", "Anzeigen"); $content->setVariable("REVIEW_ICON", "view_32"); $content->setVariable("REVIEW_URL", $TCRExtension->getExtensionUrl() . "release/" . $current_review->get_id()); $content->setVariable("DISPLAY_REVIEW_SECOND", "none"); $responseID = $current_review->get_attribute("TCR_RESPONSE"); if ($responseID == 0) { $response_released = 0; } else { $response_element = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $responseID); $response_released = $response_element->get_attribute("TCR_RELEASED"); } if ($response_released == 0) { $content->setVariable("DISPLAY_RESPONSE", "none"); } else { $content->setVariable("CREATE_RESPONSE", "Anzeigen"); $content->setVariable("RESPONSE_ICON", "view_32"); $content->setVariable("RESPONSE_URL", $TCRExtension->getExtensionUrl() . "release/" . $response_element->get_id()); $content->setVariable("DISPLAY_RESPONSE_SECOND", "none"); } } else { $content->setVariable("DISPLAY_REVIEW", "none"); $content->setVariable("DISPLAY_RESPONSE", "none"); } } } else { $content->setVariable("CREATE_THESIS", "Anzeigen / Bearbeiten"); $content->setVariable("THESIS_ICON", "view_32"); $content->setVariable("THESIS_URL", $TCRExtension->getExtensionUrl() . "edit/" . $theses[$count]->get_id()); $content->setVariable("THESIS_ICON2", "release_32"); $content->setVariable("THESIS_URL2", $TCRExtension->getExtensionUrl() . "release/" . $theses[$count]->get_id()); $content->setVariable("RELEASE_THESIS", "Veröffentlichen"); $content->setVariable("DISPLAY_REVIEW", "none"); $content->setVariable("DISPLAY_RESPONSE", "none"); } } $content->setVariable("ASSETURL", $TCRExtension->getAssetUrl()); $content->parse("BLOCK_DOCUMENTS_TABLE_ELEMENT"); } // response view } else { for ($count = 1; $count <= $rounds; $count++) { $content->setCurrentBlock("BLOCK_DOCUMENTS_TABLE_ELEMENT"); $content->setVariable("ROUND_VALUE", "Runde " . $count); if (!array_key_exists($count, $theses)) { $content->setVariable("DISPLAY_THESIS", "none"); $content->setVariable("DISPLAY_REVIEW", "none"); $content->setVariable("DISPLAY_RESPONSE", "none"); } else { $current_critics = $theses[$count]->get_attribute("TCR_REVIEWS"); if (count($current_critics) > 0) { $content->setVariable("CREATE_THESIS", "Anzeigen"); $content->setVariable("THESIS_ICON", "view_32"); $content->setVariable("THESIS_URL", $TCRExtension->getExtensionUrl() . "release/" . $theses[$count]->get_id()); $content->setVariable("DISPLAY_THESIS_SECOND", "none"); foreach ($current_critics as $critic => $review) { if ($review == 0) { $review_released = 0; } else { $current_review = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $review); $review_released = $current_review->get_attribute("TCR_RELEASED"); } if ($review_released != 0) { $content->setVariable("CREATE_REVIEW", "Anzeigen"); $content->setVariable("REVIEW_ICON", "view_32"); $content->setVariable("REVIEW_URL", $TCRExtension->getExtensionUrl() . "release/" . $current_review->get_id()); $content->setVariable("DISPLAY_REVIEW_SECOND", "none"); $responseID = $current_review->get_attribute("TCR_RESPONSE"); if ($responseID == 0) { $content->setVariable("CREATE_RESPONSE", "Replik erstellen"); $content->setVariable("RESPONSE_ICON", "create_32"); $content->setVariable("RESPONSE_URL", $TCRExtension->getExtensionUrl() . "create/" . $this->id . "/" . $count . "/" . $kindOfDocument . "/" . $current_review->get_id()); $content->setVariable("DISPLAY_RESPONSE_SECOND", "none"); } else { $response_element = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $responseID); $response_released = $response_element->get_attribute("TCR_RELEASED"); if ($response_released == 0) { $content->setVariable("CREATE_RESPONSE", "Anzeigen / Bearbeiten"); $content->setVariable("RESPONSE_ICON", "view_32"); $content->setVariable("RESPONSE_URL", $TCRExtension->getExtensionUrl() . "edit/" . $response_element->get_id()); $content->setVariable("RESPONSE_ICON2", "release_32"); $content->setVariable("RESPONSE_URL2", $TCRExtension->getExtensionUrl() . "release/" . $response_element->get_id()); $content->setVariable("RELEASE_RESPONSE", "Veröffentlichen"); } else { $content->setVariable("CREATE_RESPONSE", "Anzeigen"); $content->setVariable("RESPONSE_ICON", "view_32"); $content->setVariable("RESPONSE_URL", $TCRExtension->getExtensionUrl() . "release/" . $response_element->get_id()); $content->setVariable("DISPLAY_RESPONSE_SECOND", "none"); } } } else { $content->setVariable("DISPLAY_REVIEW", "none"); $content->setVariable("DISPLAY_RESPONSE", "none"); } } } else { $content->setVariable("DISPLAY_THESIS", "none"); $content->setVariable("DISPLAY_REVIEW", "none"); $content->setVariable("DISPLAY_RESPONSE", "none"); } } $content->setVariable("ASSETURL", $TCRExtension->getAssetUrl()); $content->parse("BLOCK_DOCUMENTS_TABLE_ELEMENT"); } } // review view } else { $content->setVariable("THESES_LABEL", "Erhaltene Thesen"); $content->setVariable("REVIEWS_LABEL", "Erstellte Kritiken"); $content->setVariable("RESPONSES_LABEL", "Erhaltene Repliken"); for ($count = 1; $count <= $rounds; $count++) { $content->setCurrentBlock("BLOCK_DOCUMENTS_TABLE_ELEMENT"); $content->setVariable("ROUND_VALUE", "Runde " . $count); if (!array_key_exists($count, $theses_response)) { $content->setVariable("DISPLAY_THESIS", "none"); $content->setVariable("DISPLAY_REVIEW", "none"); $content->setVariable("DISPLAY_RESPONSE", "none"); } else { $content->setVariable("CREATE_THESIS", "Anzeigen"); $content->setVariable("THESIS_ICON", "view_32"); $content->setVariable("THESIS_URL", $TCRExtension->getExtensionUrl() . "release/" . $theses_response[$count]->get_id()); $content->setVariable("DISPLAY_THESIS_SECOND", "none"); $critics_array = $theses_response[$count]->get_attribute("TCR_REVIEWS"); if ($critics_array[$user->get_id()] == 0) { $content->setVariable("CREATE_REVIEW", "Kritik erstellen"); $content->setVariable("REVIEW_ICON", "create_32"); $content->setVariable("REVIEW_URL", $TCRExtension->getExtensionUrl() . "create/" . $this->id . "/" . $count . "/" . $kindOfDocument . "/" . $theses_response[$count]->get_id()); $content->setVariable("DISPLAY_REVIEW_SECOND", "none"); $content->setVariable("DISPLAY_RESPONSE", "none"); $content->setVariable("DISPLAY_RESPONSE_SECOND", "none"); } else { $review = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $critics_array[$user->get_id()]); $released = $review->get_attribute("TCR_RELEASED"); if ($released == 0) { $content->setVariable("CREATE_REVIEW", "Anzeigen / Bearbeiten"); $content->setVariable("REVIEW_ICON", "view_32"); $content->setVariable("REVIEW_URL", $TCRExtension->getExtensionUrl() . "edit/" . $review->get_id()); $content->setVariable("REVIEW_ICON2", "release_32"); $content->setVariable("REVIEW_URL2", $TCRExtension->getExtensionUrl() . "release/" . $review->get_id()); $content->setVariable("RELEASE_REVIEW", "Veröffentlichen"); $content->setVariable("DISPLAY_RESPONSE", "none"); } else { $content->setVariable("CREATE_REVIEW", "Anzeigen"); $content->setVariable("REVIEW_ICON", "view_32"); $content->setVariable("REVIEW_URL", $TCRExtension->getExtensionUrl() . "release/" . $review->get_id()); $content->setVariable("DISPLAY_REVIEW_SECOND", "none"); $responseID = $review->get_attribute("TCR_RESPONSE"); if ($responseID == 0) { $response_released = 0; } else { $response_element = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $responseID); $response_released = $response_element->get_attribute("TCR_RELEASED"); } if ($response_released == 0) { $content->setVariable("DISPLAY_RESPONSE", "none"); } else { $content->setVariable("CREATE_RESPONSE", "Anzeigen"); $content->setVariable("RESPONSE_ICON", "view_32"); $content->setVariable("RESPONSE_URL", $TCRExtension->getExtensionUrl() . "release/" . $response_element->get_id()); $content->setVariable("DISPLAY_RESPONSE_SECOND", "none"); } } } } $content->setVariable("ASSETURL", $TCRExtension->getAssetUrl()); $content->parse("BLOCK_DOCUMENTS_TABLE_ELEMENT"); } } $content->parse("BLOCK_DOCUMENTS_TABLE"); $rawWidget = new \Widgets\RawHtml(); $rawWidget->setHtml($content->get()); $frameResponseObject->addWidget($rawWidget); $frameResponseObject->setHeadline(array(array("name" => $courseOrGroup, "link" => $courseOrGroupUrl), array("name" => "Thesen-Kritik-Replik-Verfahren", "link" => $TCRExtension->getExtensionUrl() . "Index/" . $this->id), array("name" => "Private Dokumente"))); return $frameResponseObject; }
} } //�berpr�fen ob die Abgegeben Datei ein PDF ist $path_part = pathinfo($_FILES["user_upload"]["name"]); if ($path_part["extension"] != "pdf") { $problems = gettext("file-type not allowed") . " (" . $path_part["extension"] . ")"; $hints = gettext("Please choose a pdf-document") . " "; } if (!empty($_FILES["user_upload"]["error"]) && $_FILES["user_upload"]["error"] > 0) { $problems = gettext("No file chosen.") . " "; $hints = gettext("Please choose a local file to upload.") . " "; } if (empty($problems)) { $content = file_get_contents($_FILES["user_upload"]["tmp_name"]); $filename = str_replace(array("\\", "'"), array("", ""), $_FILES["user_upload"]["name"]); $new_material = steam_factory::create_document($GLOBALS["STEAM"]->get_id(), $user->get_name() . "_" . $filename, $content, $_FILES["user_upload"]["type"], FALSE); //Rechte richtig setzen $partici[] = $user; $new_material->set_sanction($group_staff, SANCTION_ALL, true); $new_material->set_sanction($group_admin, SANCTION_ALL, true); foreach ($partici as $pati) { $new_material->set_sanction($pati, SANCTION_ALL, true); } $new_material->set_acquire(false, true); $GLOBALS["STEAM"]->buffer_flush(); $new_material->set_attribute("HOMEWORK_PARTICIPANTS", $partici); $new_material->set_attribute("OBJ_DESC", "Solution by Student: " . $user->get_name()); // die zugeh�rige Aufgabenstellung zur L�sung setzen if (isset($values["homework_task"])) { $new_material->set_attribute("HOMEWORK_TASK", $values["homework_task"]); }
public static function create($type, $steamObj) { if (!self::checkType($type)) { throw new \Exception("unknown block type"); } $doc = \steam_factory::create_document($GLOBALS["STEAM"]->get_id(), "Neue Aufgabe", "", "text/html", $steamObj); $newBlock = new \Worksheet\Block($doc->get_id()); $newBlock->setType($type); return $newBlock; }
} if (empty($problems)) { $all_users = steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), STEAM_ALL_USER); $staff = $course->steam_group_staff; $learners = $course->steam_group_learners; $name = $values["name"]; if (!isset($unit)) { //Erstelle unit $env = $course->get_workroom(); $new_unit_vilm = steam_factory::create_room($GLOBALS["STEAM"]->get_id(), $name, $env, "Videostreaming Lektion"); $new_unit_vilm->set_attributes(array("UNIT_TYPE" => "units_videostreaming", "OBJ_TYPE" => "videostreaming_unit_koala", "UNIT_DISPLAY_TYPE" => gettext("units_videostreaming"))); $file = PATH_EXTENSIONS . "units_videostreaming/images/videostreaming.png"; $fh = fopen($file, 'r'); $data = fread($fh, filesize($file)); fclose($fh); $unit_icon = steam_factory::create_document($GLOBALS["STEAM"]->get_id(), "Videostreaming Icon", $data, "image/png"); $new_unit_vilm->set_attribute(OBJ_ICON, $unit_icon); // weitere Vorbereitungen z.B. Verzeichnisstuktur ... sollte hier erstellt werden } else { $new_unit = $unit->get_steam_object(); $koala_unit = $unit; $attrs = $new_unit->get_attributes(array(OBJ_NAME)); if ($attrs[OBJ_NAME] !== $values['name']) { $new_unit->set_name($values['name']); } } $GLOBALS["STEAM"]->buffer_flush(); if (!isset($unit)) { header("Location: " . $course->get_url() . "units/"); } else { header("Location: " . $unit->get_url());
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 (strpos($values["title"], "/")) { if (!isset($problems)) { $problems = ""; } $problems .= gettext("Please don't use the \"/\"-char in the subject of your post."); } if (empty($problems)) { if (!empty($values['save'])) { if ($create) { $wiki_doc = steam_factory::create_document($GLOBALS["STEAM"]->get_id(), $values["title"] . ".wiki", $values["body"], "text/wiki", $wiki_container, ""); } else { // PRUEFEN, OB ALLES OK, DANN NEUE WERTE SPEICHERN $wiki_doc->set_name($values['title'] . ".wiki"); $wiki_doc->set_content($values['body']); } // Clean cache for wiki_entries $cache = get_cache_function($wiki_container->get_id(), 600); $cache->clean($wiki_container->get_id()); header("Location: " . PATH_URL . "wiki/" . $wiki_doc->get_id() . "/"); exit; } else { // PREVIEW $content->setCurrentBlock("BLOCK_PREVIEW"); $content->setVariable("LABEL_PREVIEW_EDIT", gettext("Preview the description")); $content->setVariable("PREVIEW_EDIT", get_formatted_output($values["desc"]));
private function addComment($doc) { $comment = steam_factory::create_document($GLOBALS["STEAM"]->get_id(), "COMMENT", $comment, ""); $doc->add_annotation($comment); }
<?php include_once "../../etc/koala.conf.php"; ini_set('memory_limit', '2024M'); ini_set('max_execution_time', '300'); $portal = lms_portal::get_instance(); $portal->initialize(GUEST_NOT_ALLOWED); $user = lms_steam::get_current_user(); if (!lms_steam::is_koala_admin($user)) { header("location:/"); exit; } $STEAM = $GLOBALS["STEAM"]; echo "<h1>Installing SPM</h1>"; $package_container = steam_factory::get_object_by_name($STEAM->get_id(), "/packages"); if (!is_object($package_container)) { echo "Could not find /packages on your open-sTeam server.<br>"; die; } echo "Reading file <br>"; $myFile = PATH_TEMP . "elearning_stahl_verkauf-1_40.spm"; $fh = fopen($myFile, 'r'); $theData = fread($fh, filesize($myFile)); fclose($fh); echo "Uploading File <br>"; $package = steam_factory::create_document($STEAM->get_id(), "elearning_stahl_verkauf-1_40.spm", $theData, "application/download", $package_container); echo "Installiere Package<br>"; echo $STEAM->install_package($package);
public function frameResponse(\FrameResponseObject $frameResponseObject) { $workplanExtension = \Workplan::getInstance(); $workplanExtension->addJS(); $user = $GLOBALS["STEAM"]->get_current_steam_user(); $portal = \lms_portal::get_instance(); $newWorkplan = FALSE; if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST["new_workplan"])) { $newWorkplan = TRUE; $values = $_POST["values"]; $workplanContainer = \steam_factory::create_room($GLOBALS["STEAM"]->get_id(), $values["name"], $user->get_workroom()); $workplanContainer->set_attribute("OBJ_TYPE", "WORKPLAN_CONTAINER"); $xml = new \SimpleXMLElement("<workplan></workplan>"); $xml->addAttribute("name", $values["name"]); $start = $values["start"]; $start = mktime(0, 0, 0, substr($start, 3, 2), substr($start, 0, 2), substr($start, 6, 4)); $workplanContainer->set_attribute("WORKPLAN_START", $start); $xml->addAttribute("start", $start); if (!empty($values["end"])) { $end = $values["end"]; $end = mktime(0, 0, 0, substr($end, 3, 2), substr($end, 0, 2), substr($end, 6, 4)); $workplanContainer->set_attribute("WORKPLAN_END", $end); $xml->addAttribute("end", $end); } else { $workplanContainer->set_attribute("WORKPLAN_END", -1); $xml->addAttribute("end", -1); } if (!empty($values["description"])) { $workplanContainer->set_attribute("WORKPLAN_DESCRIPTION", $values["description"]); $xml->addAttribute("description", $values["description"]); } else { $workplanContainer->set_attribute("WORKPLAN_DESCRIPTION", ""); $xml->addAttribute("description", ""); } \steam_factory::create_document($GLOBALS["STEAM"]->get_id(), "version.xml", $xml->saveXML(), "text/xml", $workplanContainer); $portal->set_confirmation("Projektplan " . $values["name"] . " erfolgreich erstellt."); } if (!$newWorkplan) { $workplanContainer = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->params[0]); } if (is_object($workplanContainer) && $workplanContainer instanceof \steam_room) { $content = $workplanExtension->loadTemplate("workplan_overview.template.html"); if (!$newWorkplan) { $content->setCurrentBlock("BLOCK_CONFIRMATION"); $content->setVariable("CONFIRMATION_TEXT", "NONE"); $content->parse("BLOCK_CONFIRMATION"); } // if current user has required rights display actionbar if ($workplanContainer->get_creator()->get_id() == $user->get_id() || in_array("WORKPLAN_" . $user->get_id() . "_LEADER", $workplanContainer->get_attribute_names())) { $content->setCurrentBlock("BLOCK_WORKPLAN_OVERVIEW_ACTIONBAR"); $content->setVariable("LABEL_CHANGE", "Eigenschaften bearbeiten"); $content->setVariable("LABEL_SNAPSHOT", "Snapshot erstellen"); $content->setVariable("WORKPLAN_ID", $workplanContainer->get_id()); if ($workplanContainer->get_creator()->get_id() == $user->get_id()) { $content->setVariable("WORKPLAN_RIGHTS_CHANGE", ""); } else { $content->setVariable("WORKPLAN_RIGHTS_CHANGE", "none"); } $content->parse("BLOCK_WORKPLAN_OVERVIEW_ACTIONBAR"); } $actionBar = new \Widgets\RawHtml(); $actionBar->setHtml($content->get()); $frameResponseObject->addWidget($actionBar); $tabBar = new \Widgets\TabBar(); $tabBar->setTabs(array(array("name" => "Überblick", "link" => $this->getExtension()->getExtensionUrl() . "overview/" . $workplanContainer->get_id()), array("name" => "Tabelle", "link" => $this->getExtension()->getExtensionUrl() . "listView/" . $workplanContainer->get_id()), array("name" => "Gantt-Diagramm", "link" => $this->getExtension()->getExtensionUrl() . "ganttView/" . $workplanContainer->get_id()), array("name" => "Mitarbeiter", "link" => $this->getExtension()->getExtensionUrl() . "users/" . $workplanContainer->get_id()), array("name" => "Snapshots", "link" => $this->getExtension()->getExtensionUrl() . "snapshots/" . $workplanContainer->get_id()))); $tabBar->setActiveTab(0); $frameResponseObject->addWidget($tabBar); $content = $workplanExtension->loadTemplate("workplan_overview.template.html"); if (isset($_POST["edit"])) { $edit = $_POST["edit"]; } else { $edit = 0; } // if the user clicked on the edit symbol in Index-Command-View display edit view if ($edit == 1) { $content->setCurrentBlock("BLOCK_WORKPLAN_OVERVIEW_TABLE_EDIT"); $content->setVariable("WORKPLAN_OVERVIEW_EDIT", "Eigenschaften bearbeiten"); $content->setVariable("NAME_LABEL", "Projektname:*"); $content->setVariable("START_LABEL", "Beginn:*"); $content->setVariable("END_LABEL", "Ende:"); $content->setVariable("CREATOR_LABEL", "Projektersteller:"); $content->setVariable("DESCRIPTION_LABEL", "Beschreibung:"); $content->setVariable("NAME_VALUE", $workplanContainer->get_name()); $content->setVariable("START_VALUE", date("d.m.Y", (int) $workplanContainer->get_attribute("WORKPLAN_START"))); $content->setVariable("CREATOR_VALUE", $workplanContainer->get_creator()->get_full_name()); if ($workplanContainer->get_attribute("WORKPLAN_END") != -1) { $content->setVariable("END_VALUE", date("d.m.Y", (int) $workplanContainer->get_attribute("WORKPLAN_END"))); } if (in_array("WORKPLAN_DESCRIPTION", $workplanContainer->get_attribute_names())) { $content->setVariable("DESCRIPTION_VALUE", $workplanContainer->get_attribute("WORKPLAN_DESCRIPTION")); } $content->setVariable("LABEL_SAVE", "Speichern"); $content->setVariable("LABEL_BACK", "Abbrechen"); $content->setVariable("WORKPLAN_ID", $workplanContainer->get_id()); $content->parse("BLOCK_WORKPLAN_OVERVIEW_TABLE_EDIT"); // else display normal view } else { $content->setCurrentBlock("BLOCK_WORKPLAN_OVERVIEW_TABLE"); $content->setVariable("WORKPLAN_OVERVIEW_ATTRIBUTE", "Eigenschaft"); $content->setVariable("WORKPLAN_OVERVIEW_VALUE", "Wert"); $content->setVariable("NAME_LABEL", "Projektname"); $content->setVariable("START_LABEL", "Beginn"); $content->setVariable("END_LABEL", "Ende"); $content->setVariable("CREATOR_LABEL", "Projektersteller"); $content->setVariable("DESCRIPTION_LABEL", "Beschreibung"); $content->setVariable("NAME_VALUE", $workplanContainer->get_name()); $content->setVariable("START_VALUE", date("d.m.Y", (int) $workplanContainer->get_attribute("WORKPLAN_START"))); $content->setVariable("CREATOR_VALUE", $workplanContainer->get_creator()->get_full_name()); if ($workplanContainer->get_attribute("WORKPLAN_END") != -1) { $content->setVariable("END_VALUE", date("d.m.Y", (int) $workplanContainer->get_attribute("WORKPLAN_END"))); } else { $content->setVariable("END_VALUE", "-"); } if (in_array("WORKPLAN_DESCRIPTION", $workplanContainer->get_attribute_names())) { if (strlen(trim($workplanContainer->get_attribute("WORKPLAN_DESCRIPTION"))) > 0) { $content->setVariable("DESCRIPTION_VALUE", nl2br($workplanContainer->get_attribute("WORKPLAN_DESCRIPTION"))); } else { $content->setVariable("DESCRIPTION_VALUE", "-"); } } else { $content->setVariable("DESCRIPTION_VALUE", "-"); } $content->parse("BLOCK_WORKPLAN_OVERVIEW_TABLE"); } $rawWidget = new \Widgets\RawHtml(); $rawWidget->setHtml($content->get()); $frameResponseObject->setTitle("Projektplan: " . $workplanContainer->get_name()); $frameResponseObject->setHeadline(array(array("link" => $this->getExtension()->getExtensionUrl(), "name" => "Projektplanverwaltung"), array("", "name" => $workplanContainer->get_name()))); $frameResponseObject->addWidget($rawWidget); return $frameResponseObject; } }
public function saveCustomerCreationLogFile($customerID, $fileName, $fileContent) { $container = new steam_room($GLOBALS["STEAM"]->get_id(), $this->getCustomerWorkroom($customerID)); $doc = steam_factory::create_document($GLOBALS["STEAM"]->get_id(), $fileName, $fileContent, "text/xml", $container, ""); $doc->set_attribute(IS_LOGFILE, 1); }
} if (empty($problems)) { $all_users = steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), STEAM_ALL_USER); $staff = $course->steam_group_staff; $learners = $course->steam_group_learners; $name = $values["name"]; if (!isset($unit)) { //Erstelle unit $env = $course->get_workroom(); $new_unit_vilm = steam_factory::create_room($GLOBALS["STEAM"]->get_id(), $name, $env, "Mediathing Lektion"); $new_unit_vilm->set_attributes(array("UNIT_TYPE" => "units_mediathing", "OBJ_TYPE" => "mediathing_unit_koala", "UNIT_DISPLAY_TYPE" => gettext("units_mediathing"))); $file = PATH_EXTENSIONS . "units_mediathing/images/icon48.gif"; $fh = fopen($file, 'r'); $data = fread($fh, filesize($file)); fclose($fh); $unit_icon = steam_factory::create_document($GLOBALS["STEAM"]->get_id(), "Mediathing Icon", $data, "image/gif"); $unit_icon->set_sanction($learners, SANCTION_READ); $new_unit_vilm->set_attribute(OBJ_ICON, $unit_icon); $new_unit_vilm->set_sanction($learners, SANCTION_WRITE | SANCTION_READ | SANCTION_EXECUTE | SANCTION_INSERT | SANCTION_ANNOTATE); // weitere Vorbereitungen z.B. Verzeichnisstuktur ... sollte hier erstellt werden } else { $new_unit = $unit->get_steam_object(); $koala_unit = $unit; $attrs = $new_unit->get_attributes(array(OBJ_NAME)); if ($attrs[OBJ_NAME] !== $values['name']) { $new_unit->set_name($values['name']); } } $GLOBALS["STEAM"]->buffer_flush(); if (!isset($unit)) { header("Location: " . $course->get_url() . "units/");