public function processData(\IRequestObject $requestObject) { //create portlet $params = $requestObject->getParams(); $name = $params["title"]; $column = $params["parent"]; $version = "3.0"; //check diffrent types of parameter if (is_string($column)) { $columnObject = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $column); } else { $columnObject = $column; } //default values $address = "http://api.flickr.com/services/feeds/photoset.gne?set=72157603709124069&nsid=12597119@N03&lang=de-de&format=rss_200"; $address = "http://www.lehrer-online.de/rss-materialien.xml"; $num_items = "5"; $desc_length = "50"; $style = "message"; //Breit $style = "rss_feed"; //Schmal $allow_html = "checked"; //create object $portletObject = \steam_factory::create_container($GLOBALS["STEAM"]->get_id(), $name, $columnObject); $portletContent = array("address" => $address, "num_items" => $num_items, "desc_length" => $desc_length, "style" => $style, "allow_html" => $allow_html); $portletObject->set_attributes(array(OBJ_DESC => $name, OBJ_TYPE => "container_portlet_bid", "bid:portlet" => "rss", "bid:portlet:version" => $version, "bid:portlet:content" => $portletContent)); }
public function processData(\IRequestObject $requestObject) { $params = $requestObject->getParams(); $name = $params["title"]; $column = $params["parent"]; $version = "3.0"; //check diffrent types of parameter if (is_string($column)) { $columnObject = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $column); } else { $columnObject = $column; } //default values $descripton = "keine Beschreibung"; $mediaType = "movie"; //$url="http://www.bid-owl.de/download/347240/video.flv"; //test url $url = ""; //create $media = \steam_factory::create_container($GLOBALS["STEAM"]->get_id(), $name, $columnObject); //$mediaType = "image"; //$mediaType = "audio"; $mediaType = "movie"; $mediaContent = array("headline" => $name, "description" => $descripton, "media_type" => $mediaType, "url" => $url); $media->set_attributes(array(OBJ_DESC => $name, OBJ_TYPE => "container_portlet_bid", "bid:portlet" => "media", "bid:portlet:version" => $version, "bid:portlet:content" => $mediaContent)); }
function copy_msg($steam, $source) { //create container $copy = steam_factory::create_container($steam, $source->get_attribute(OBJ_NAME), $steam->get_login_user()); $copy->set_attribute("bid:doctype", "portlet"); $copy->set_attribute("bid:portlet", "msg"); //copy pictures if available $old_content = $source->get_attribute("bid:portlet:content"); $copy_content = array(); foreach ($old_content as $msg_id) { $message = steam_factory::get_object($steam, $msg_id); $new_message = steam_factory::create_copy($steam, $message); $new_message->move($copy); array_push($copy_content, $new_message->get_id()); $picture_id = $message->get_attribute("bid:portlet:msg:picture_id"); if ($picture_id != null || $picture_id != "") { //duplicate picture $new_picture = steam_factory::create_copy($steam, steam_factory::get_object($steam, $picture_id)); $new_picture->move($copy); //update portlet content $new_message->set_attribute("bid:portlet:msg:picture_id", $new_picture->get_id()); } } //set correct content $copy->set_attribute("bid:portlet:content", $copy_content); return $copy; }
public function processData(\IRequestObject $requestObject) { $params = $requestObject->getParams(); $name = $params["title"]; $column = $params["parent"]; $version = "1.0"; //check diffrent types of parameter if (is_string($column)) { $columnObject = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $column); } else { $columnObject = $column; } //get date $currentYear = date("Y") . ""; $nextYear = date("Y") + 1 . ""; //create $pollObject = \steam_factory::create_container($GLOBALS["STEAM"]->get_id(), $name, $columnObject); $pollTopic = "Beschreibung der Abstimmung"; $startDate = array("day" => "01", "month" => "01", "year" => $currentYear); $endDate = array("day" => "01", "month" => "01", "year" => $nextYear); $options = array("Eintrag A", "Eintrag B", "Eintrag C", "Eintrag D", "Eintrag E", "Eintrag F"); $optionsVotecount = array(0, 0, 0, 0, 0, 0); $pollContent = array("end_date" => $endDate, "options" => $options, "options_votecount" => $optionsVotecount, "poll_topic" => $pollTopic, "start_date" => $startDate); $pollObject->set_attributes(array(OBJ_DESC => $name, OBJ_TYPE => "container_portlet_bid", "bid:portlet" => "poll", "bid:portlet:version" => $version, "bid:portlet:content" => $pollContent)); }
public function create_category($name, $description) { if (!($categories = $this->get_object_by_name("categories"))) { $categories = steam_factory::create_container($GLOBALS["STEAM"]->get_id(), "categories", $this, "all categories for this weblog"); } $new_category = steam_factory::create_container($GLOBALS["STEAM"]->get_id(), $name, $categories, $description); return $new_category; }
public function execute($request, $response) { $myExtension = \Questionary::getInstance(); $name = trim(isset($_POST["name"]) ? $_POST["name"] : "test"); //current room steam object //if( (int) $object != 0 ) //$current_room = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $object); //else $current_room = $GLOBALS["STEAM"]->get_current_steam_user()->get_workroom(); $steamUser = $GLOBALS["STEAM"]->get_current_steam_user(); //get write permission $access_write = $current_room->check_access_write($steamUser); $access_read = $current_room->check_access_read($steamUser); $access_insert = $current_room->check_access_insert($steamUser); $allowed = $access_write && $access_read && $access_insert ? true : false; if (!$allowed) { // ACCESS DENIED? } //create questionary if adviced too if (isset($_POST["mission"]) && $_POST["mission"] == "create" && $name != "" && $allowed) { //create new questionary $questionary = \steam_factory::create_container($GLOBALS["STEAM"]->get_id(), $name, $current_room); $questions_folder = \steam_factory::create_container($GLOBALS["STEAM"]->get_id(), 'questions', $questionary); $answers_folder = \steam_factory::create_container($GLOBALS["STEAM"]->get_id(), 'answers', $questionary); if (isset($_POST["description"])) { $description = $_POST["description"]; } else { $description = ""; } if ($questionary && $questions_folder && $answers_folder) { //set standard layout $layout = "template"; //$templates[1]; //define rights for the attributes $loginuser_id = $steamUser->get_id(); $rootid = \steam_factory::username_to_object($GLOBALS["STEAM"]->get_id(), "root")->get_id(); $author_rights[$loginuser_id] = $loginuser_id; $editor_rights[$loginuser_id] = $loginuser_id; $analyst_rights[$loginuser_id] = $loginuser_id; $author_rights[$rootid] = $rootid; $editor_rights[$rootid] = $rootid; $analyst_rights[$rootid] = $rootid; //define container as questionary and set all attributes $attributes = array("bid:doctype" => "questionary", "bid:questionary:fillout" => "1", "bid:questionary:editanswer" => "1", "bid:questionary:editownanswer" => "0", "bid:questionary:number" => "1", "bid:questionary:resultcreator" => "1", "bid:questionary:resultcreationtime" => "1", "bid:questionary:description" => $description, "bid:questionary:edittime" => array(0, 0, 0), "bid:questionary:enabled" => false, "bid:questionary:layout" => $layout, "bid:questionary:author_rights" => $author_rights, "bid:questionary:editor_rights" => $editor_rights, "bid:questionary:analyst_rights" => $analyst_rights); $result = $questionary->set_attributes($attributes); header("Location: " . PATH_URL . "questionary/editQuestionary/" . $questionary->get_id()); } } else { $myExtension->addCSS(); $content = $myExtension->loadTemplate("questionaryNewQuestionary.template.html"); $content->setCurrentBlock('BLOCK_FORM_NEW_QUESTIONARY'); $content->setVariable("QUESTIONARY_ID", ""); $content->setVariable("BUTTON_MISSION", "create"); $content->setVariable("OBJECT_ID", $current_room->get_id()); $content->parse('BLOCK_FORM_NEW_QUESTIONARY'); return $content->get(); } }
/** * Creates and returns a new steam_container object. * * @param String $name name of the new container * @param Object $environment steam_container or koala_container in which * to create the new container * @param String $description (optional) description of the new container * @return Object the resulting new steam_container */ public static function create_container($name, $environment, $description = "") { if ($environment instanceof koala_container) { $environment = $environment->get_steam_object(); } if ($environment instanceof koala_container) { $environment = $environment->get_steam_object(); } if (!$environment instanceof steam_container) { throw new Exception("No valid environment provided.", E_PARAMETER); } // just create and return a new steam_container (containers need no // special treatment in koaLA): return steam_factory::create_container($GLOBALS["STEAM"]->get_id(), $name, $environment, $description); }
public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject) { $ajaxResponseObject->setStatus("ok"); $current_room = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id); $mplme = \steam_factory::create_container($GLOBALS["STEAM"]->get_id(), rawurlencode($this->params["title"]), $current_room, $this->params["title"]); $mplme->set_attribute("OBJ_TYPE", "container_mplme"); $mplme->set_attribute("MPLME_URL", $this->url); $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 processData(\IRequestObject $requestObject) { $params = $requestObject->getParams(); $name = $params["title"]; $column = $params["parent"]; $version = "3.0"; //check diffrent types of parameter if (is_string($column)) { $columnObject = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $column); } else { $columnObject = $column; } ///old method $msg = \steam_factory::create_container($GLOBALS["STEAM"]->get_id(), $name, $columnObject); $msg->set_attributes(array(OBJ_DESC => $name, OBJ_TYPE => "container_portlet_bid", "bid:portlet:version" => $version, "bid:portlet" => "msg")); }
public function processData(\IRequestObject $requestObject) { //create headline $params = $requestObject->getParams(); $name = $params["title"]; $column = $params["parent"]; $version = "3.0"; //check diffrent types of parameter if (is_string($column)) { $columnObject = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $column); } else { $columnObject = $column; } //create object $headline = \steam_factory::create_container($GLOBALS["STEAM"]->get_id(), $name, $columnObject); $headline_content = array("headline" => $name, "alignment" => "center", "size" => 15); $headline->set_attributes(array(OBJ_DESC => $name, OBJ_TYPE => "container_portlet_bid", "bid:portlet" => "headline", "bid:portlet:version" => $version, "bid:portlet:content" => $headline_content)); }
public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject) { $ajaxResponseObject->setStatus("ok"); $env_room = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id); $worksheetObject = \steam_factory::create_container($GLOBALS["STEAM"]->get_id(), $this->params["name"], $env_room); $worksheet = new \Worksheet\Worksheet($worksheetObject->get_id()); $worksheet->setup(); $worksheet->setName($worksheet->getName() . " (Vorlage)"); $jswrapper = new \Widgets\JSWrapper(); $jswrapper->setJs(<<<END \t\tcloseDialog(); \t\tsendRequest("LoadContent", {"id":"{$this->id}"}, "explorerWrapper", "updater", null, null, "explorer"); \t\t END ); $ajaxResponseObject->addWidget($jswrapper); return $ajaxResponseObject; }
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 ajaxResponse(\AjaxResponseObject $ajaxResponseObject) { $ajaxResponseObject->setStatus("ok"); $current_room = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id); $portal = \steam_factory::create_container($GLOBALS["STEAM"]->get_id(), $this->params["name"], $current_room); $portal->set_attribute("OBJ_TYPE", "container_portal_bid"); $columnWidth = array("1" => "900px", "2" => "200px;700px", "3" => "200px;500px;200px"); $columnCount = $this->params["columns"]; $columnWidth = explode(';', $columnWidth[$columnCount]); $columns = array(); for ($i = 1; $i <= $columnCount; $i++) { $columns[$i] = \steam_factory::create_container($GLOBALS["STEAM"]->get_id(), '' . $i, $portal, '' . $i); $columns[$i]->set_attributes(array("OBJ_TYPE" => "container_portalColumn_bid", "bid:portal:column:width" => $columnWidth[$i - 1])); } // populate columns with default portlets switch (count($columns)) { case 1: \ExtensionMaster::getInstance()->callCommand("Create", "PortletHeadline", array("parent" => $columns[1], "title" => $this->params["name"], "version" => "3.0")); \ExtensionMaster::getInstance()->callCommand("Create", "PortletMsg", array("parent" => $columns[1], "title" => "Meldungen", "version" => "3.0")); break; case 2: \ExtensionMaster::getInstance()->callCommand("Create", "PortletTopic", array("parent" => $columns[1], "title" => "Kategorien", "version" => "3.0")); \ExtensionMaster::getInstance()->callCommand("Create", "PortletHeadline", array("parent" => $columns[2], "title" => $this->params["name"], "version" => "3.0")); \ExtensionMaster::getInstance()->callCommand("Create", "PortletMsg", array("parent" => $columns[2], "title" => "Meldungen", "version" => "3.0")); break; case 3: \ExtensionMaster::getInstance()->callCommand("Create", "PortletTopic", array("parent" => $columns[1], "title" => "Kategorien", "version" => "3.0")); \ExtensionMaster::getInstance()->callCommand("Create", "PortletHeadline", array("parent" => $columns[2], "title" => $this->params["name"], "version" => "3.0")); \ExtensionMaster::getInstance()->callCommand("Create", "PortletMsg", array("parent" => $columns[2], "title" => "Meldungen", "version" => "3.0")); \ExtensionMaster::getInstance()->callCommand("Create", "PortletAppointment", array("parent" => $columns[3], "title" => "Termine", "version" => "3.0")); break; } $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; }
private function save() { if ($GLOBALS["STEAM"]->get_login_user_name() != "root") { $sc = new steam_connector(STEAM_SERVER, STEAM_PORT, STEAM_ROOT_LOGIN, STEAM_ROOT_PW); } else { $sc = $GLOBALS["STEAM"]; } $license_container = steam_factory::get_object_by_name($sc->get_id(), "/home/root/licenses/"); if (!$license_container instanceof steam_container) { $root_home = steam_factory::get_object_by_name($sc->get_id(), "/home/root/"); $license_container = steam_factory::create_container($sc->get_id(), "licenses", $root_home, "licenses for elearning plattform a stored here"); $license_container->set_attribute("OBJ_HIDDEN", "TRUE"); $license_container->set_attribute("OBJ_TYPE", "usermanagement_licensemanager_data"); } $license_file = steam_factory::get_object_by_name($sc->get_id(), "/home/root/licenses/licenses.xml"); if (!$license_file instanceof steam_document) { $license_file = steam_factory::create_document($sc->get_id(), "licenses.xml", $this->license_xml->asXML(), "text/xml"); $license_file->move($license_container); } else { $license_file->set_content($this->license_xml->asXML()); } }
public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject) { if (!isset($this->params["group_course"])) { $rawWidget = new \Widgets\RawHtml(); $rawWidget->setHtml("Error: Kurs oder Gruppe auswählen"); $ajaxResponseObject->addWidget($rawWidget); return $ajaxResponseObject; } $user = $GLOBALS["STEAM"]->get_current_steam_user(); if ($this->params["group_course"] == 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") { $staff = $subgroup->get_members(); $admins = array(); foreach ($staff as $staffMember) { if ($staffMember instanceof \steam_user) { array_push($admins, $staffMember->get_id()); } } } else { if ($subgroup->get_name() == "learners") { $group = $subgroup; } } } } else { // group if (!isset($this->params["group"])) { $rawWidget = new \Widgets\RawHtml(); $rawWidget->setHtml("Error: Kurs oder Gruppe auswählen"); $ajaxResponseObject->addWidget($rawWidget); return $ajaxResponseObject; } $group = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->params["group"]); $admins = array($user->get_id()); } if (intval($this->params["rounds"]) == 0) { $rawWidget = new \Widgets\RawHtml(); $rawWidget->setHtml("Error: Rundenzahl bitte als Integer eingeben."); $ajaxResponseObject->addWidget($rawWidget); return $ajaxResponseObject; } // create data structure and set access rights $TCR = \steam_factory::create_room($GLOBALS["STEAM"]->get_id(), $this->params["title"], $group->get_workroom(), $this->params["title"]); \steam_factory::create_container($GLOBALS["STEAM"]->get_id(), "theses", $TCR, "container for theses"); \steam_factory::create_container($GLOBALS["STEAM"]->get_id(), "reviews", $TCR, "container for reviews"); \steam_factory::create_container($GLOBALS["STEAM"]->get_id(), "responses", $TCR, "container for responses"); $TCR->set_attribute("OBJ_TYPE", "TCR_CONTAINER"); $TCR->set_attribute("TCR_ROUNDS", $this->params["rounds"]); $TCR->set_attribute("TCR_USERS", array()); $TCR->set_attribute("TCR_ADMINS", $admins); $TCR->set_attribute("TCR_GROUP", $group); $TCR->set_sanction_all($group); $ajaxResponseObject->setStatus("ok"); $jswrapper = new \Widgets\JSWrapper(); $jswrapper->setJs(<<<END \t\tcloseDialog(); END ); $ajaxResponseObject->addWidget($jswrapper); return $ajaxResponseObject; }
public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject) { $workplanExtension = \Workplan::getInstance(); $content = $workplanExtension->loadTemplate("workplan_listview.template.html"); $user = $GLOBALS["STEAM"]->get_current_steam_user(); $objectID = $this->params["id"]; $workplanContainer = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $objectID); $xmlfile = $workplanContainer->get_inventory_filtered(array(array("+", "class", CLASS_DOCUMENT))); $snapshot = $this->params["snapshot"]; $update = $this->params["update"]; if ($user->get_id() != $workplanContainer->get_creator()->get_id() && !in_array("WORKPLAN_" . $user->get_id() . "_LEADER", $workplanContainer->get_attribute_names())) { $update = -1; } // load old version if snapshot is requested if ($snapshot != 0) { if ($snapshot == $xmlfile[0]->get_version() || $snapshot == -1) { $snapshot = -1; } else { $previousversions = $xmlfile[0]->get_previous_versions(); $xmlfile[0] = $previousversions[count($previousversions) - $snapshot]; $snapshot = -1; } // if user submitted the update dialog } else { if ($update == 1) { $xmltree = new \SimpleXMLElement($xmlfile[0]->get_content()); $children = $xmltree->children(); $changeID = $this->params["changeID"]; $changeObject = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $changeID); // search for changeObject in xml tree for ($count = 0; $count < count($children); $count++) { $currentElementID = $children[$count]->oid; if ((int) $currentElementID == (int) $changeID) { $changeElement = $children[$count]; break; } } // save changes in xml file and attributes of the container $changeElement->name = $this->params["name"]; $changeObject->set_name($this->params["name"]); $start = $this->params["start"]; $start = mktime(0, 0, 0, substr($start, 3, 2), substr($start, 0, 2), substr($start, 6, 4)); $changeElement->start = $start; $changeObject->set_attribute("WORKPLAN_START", $start); $end = $this->params["end"]; $end = mktime(0, 0, 0, substr($end, 3, 2), substr($end, 0, 2), substr($end, 6, 4)); $changeElement->end = $end; $changeObject->set_attribute("WORKPLAN_END", $end); if (strlen($this->params["duration"]) > 0) { $changeElement->duration = $this->params["duration"]; $changeObject->set_attribute("WORKPLAN_DURATION", $this->params["duration"]); } else { $changeElement->duration = -1; $changeObject->set_attribute("WORKPLAN_DURATION", -1); } if (strlen($this->params["depends"]) > 0) { $changeElement->depends = $this->params["depends"]; $changeObject->set_attribute("WORKPLAN_DEPENDS", $this->params["depends"]); } else { $changeElement->depends = -1; $changeObject->set_attribute("WORKPLAN_DEPENDS", -1); } $changeElement->users = $this->params["users"]; $changeObject->set_attribute("WORKPLAN_USERS", $this->params["users"]); $xmlfile[0]->set_content($xmltree->saveXML()); // if user deleted something delete it in xml file and on the steam server } else { if ($update == 2) { $mot = $this->params["mot"]; $deleteID = $this->params["elementid"]; $xmltree = new \SimpleXMLElement($xmlfile[0]->get_content()); $children = $xmltree->children(); $tasks = 0; $milestones = 0; for ($count = 0; $count < count($children); $count++) { $currentElementID = $children[$count]->oid; if ((int) $currentElementID == (int) $deleteID) { break; } if ($children[$count]->getName() == 'task') { $tasks++; } else { $milestones++; } } if ($mot == 1) { unset($xmltree->milestone[$milestones]); } else { unset($xmltree->task[$tasks]); } for ($count = 0; $count < count($children); $count++) { if ($children[$count]->depends == (int) $deleteID) { $children[$count]->depends = -1; $dependelement = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $children[$count]->oid); $dependelement->set_attribute("WORKPLAN_DEPENDS", -1); } } $xmlfile[0]->set_content($xmltree->saveXML()); $deleteElement = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $deleteID); $deleteElement->delete(); // if user created a new milestone or task } else { if ($update == 0) { $xmltree = new \SimpleXMLElement($xmlfile[0]->get_content()); if ($this->params["mot"] == 0) { $xml = $xmltree->addChild("milestone"); } else { $xml = $xmltree->addChild("task"); } $newContainer = \steam_factory::create_container($GLOBALS["STEAM"]->get_id(), $this->params["name"], $workplanContainer); $xml->addChild("name", $this->params["name"]); $xml->addChild("oid", $newContainer->get_id()); $start = $this->params["start"]; $start = mktime(0, 0, 0, substr($start, 3, 2), substr($start, 0, 2), substr($start, 6, 4)); $newContainer->set_attribute("WORKPLAN_START", $start); $xml->addChild("start", $start); $end = $this->params["end"]; $end = mktime(0, 0, 0, substr($end, 3, 2), substr($end, 0, 2), substr($end, 6, 4)); $newContainer->set_attribute("WORKPLAN_END", $end); $xml->addChild("end", $end); if (strlen($this->params["duration"]) > 0) { $xml->addChild("duration", $this->params["duration"]); $newContainer->set_attribute("WORKPLAN_DURATION", $this->params["duration"]); } else { $xml->addChild("duration", -1); $newContainer->set_attribute("WORKPLAN_DURATION", -1); } if (strlen($this->params["depends"]) > 0) { $xml->addChild("depends", $this->params["depends"]); $newContainer->set_attribute("WORKPLAN_DEPENDS", $this->params["depends"]); } else { $xml->addChild("depends", -1); $newContainer->set_attribute("WORKPLAN_DEPENDS", -1); } $newContainer->set_attribute("WORKPLAN_USERS", $this->params["users"]); $xml->addChild("users", $this->params["users"]); $xmlfile[0]->set_content($xmltree->saveXML()); } } } } // display updated list view of current workplan $xml = simplexml_load_string($xmlfile[0]->get_content()); $helpToArray = $xml->children(); $list = array(); for ($counter = 0; $counter < count($helpToArray); $counter++) { array_push($list, $helpToArray[$counter]); } usort($list, 'sort_xmllist'); if (count($list) == 0) { $content->setCurrentBlock("BLOCK_WORKPLAN_LIST_EMPTY"); $content->setVariable("WORKPLAN_LIST_EMPTY", "Keine Meilensteine oder Vorgänge zu diesem Projektplan vorhanden."); $content->parse("BLOCK_WORKPLAN_LIST_EMPTY"); } else { $content->setCurrentBlock("BLOCK_WORKPLAN_LIST"); $content->setVariable("WORKPLAN_LIST_ELEMENT_NAME", "Name"); $content->setVariable("WORKPLAN_LIST_ELEMENT_START", "Beginn"); $content->setVariable("WORKPLAN_LIST_ELEMENT_END", "Ende"); $content->setVariable("WORKPLAN_LIST_ELEMENT_DURATION", "Arbeitsstunden"); $content->setVariable("WORKPLAN_LIST_ELEMENT_DEPENDS", "Abhängigkeit"); $content->setVariable("WORKPLAN_LIST_ELEMENT_USERS", "Mitarbeiter"); // create and fill array for displaying dependencies $dependencies = array(); for ($counter = 0; $counter < count($list); $counter++) { $dependencies[strval($list[$counter]->oid)] = $counter + 1; } // create list view of current elements for ($counter = 0; $counter < count($list); $counter++) { $content->setCurrentBlock("BLOCK_WORKPLAN_LIST_ELEMENT"); $content->setVariable("WORKPLAN_LIST_ELEMENT_NUMBER", $counter + 1); if ($snapshot == -1) { $content->setVariable("WORKPLAN_LIST_ELEMENT_NAME_VALUE", $list[$counter]->name); } else { $element = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $list[$counter]->oid); $elinventory = $element->get_inventory(); $content->setVariable("WORKPLAN_LIST_ELEMENT_NAME_VALUE", $list[$counter]->name . " (" . count($elinventory) . ")"); } $content->setVariable("WORKPLAN_LIST_ELEMENT_START_VALUE", date("d.m.Y", (int) $list[$counter]->start)); $content->setVariable("WORKPLAN_LIST_ELEMENT_END_VALUE", date("d.m.Y", (int) $list[$counter]->end)); if ($list[$counter]->duration == -1) { $content->setVariable("WORKPLAN_LIST_ELEMENT_DURATION_VALUE", "-"); } else { $content->setVariable("WORKPLAN_LIST_ELEMENT_DURATION_VALUE", $list[$counter]->duration); } $content->setVariable("WORKPLAN_LIST_ELEMENT_DURATION_UPDATE", $list[$counter]->duration); if ($list[$counter]->depends == -1) { $content->setVariable("WORKPLAN_LIST_ELEMENT_DEPENDS_VALUE", "-"); } else { if (array_key_exists(strval($list[$counter]->depends), $dependencies)) { $content->setVariable("WORKPLAN_LIST_ELEMENT_DEPENDS_VALUE", $dependencies[strval($list[$counter]->depends)]); } } $content->setVariable("WORKPLAN_LIST_ELEMENT_DEPENDS_UPDATE", $list[$counter]->depends); if ($list[$counter]->getName() == 'task') { $content->setVariable("WORKPLAN_LIST_ELEMENT_MOT", "0"); } else { $content->setVariable("WORKPLAN_LIST_ELEMENT_MOT", "1"); } $content->setVariable("WORKPLAN_LIST_ELEMENT_OID", $list[$counter]->oid); $content->setVariable("WORKPLAN_LIST_ELEMENT_NAME_DEL", $list[$counter]->name); $content->setVariable("WORKPLAN_ID", $objectID); // convert saved users to output format $userList = $list[$counter]->users; $userList = "[" . str_replace(";", ",", $userList) . "]"; $content->setVariable("WORKPLAN_LIST_ELEMENT_USERS_JSON", $userList); $userList = json_decode($userList); $outputUsers = ""; for ($count = 0; $count < count($userList); $count++) { $currentUser = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $userList[$count]); $outputUsers = $outputUsers . $currentUser->get_full_name() . "<br>"; } if (count($userList) == 0) { $outputUsers = "-"; } $content->setVariable("WORKPLAN_LIST_ELEMENT_USERS_VALUE", $outputUsers); $content->setVariable("WORKPLAN_LIST_ELEMENT_CHANGE_VALUE", "Bearbeiten"); $content->setVariable("WORKPLAN_LIST_ELEMENT_DELETE_VALUE", "Löschen"); if ($snapshot != -1 && ($user->get_id() == $workplanContainer->get_creator()->get_id() || in_array("WORKPLAN_" . $user->get_id() . "_LEADER", $workplanContainer->get_attribute_names()))) { $content->setVariable("WORKPLAN_RIGHTS", ""); } else { $content->setVariable("WORKPLAN_RIGHTS", "none"); } $content->parse("BLOCK_WORKPLAN_LIST_ELEMENT"); } $content->parse("BLOCK_WORKPLAN_LIST"); } $rawWidget = new \Widgets\RawHtml(); $rawWidget->setHtml($content->get()); $ajaxResponseObject->setStatus("ok"); $ajaxResponseObject->addWidget($rawWidget); return $ajaxResponseObject; }
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 createCourse($id, $courseID, $customerID) { $user = lms_steam::get_current_user(); $all_users = steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), STEAM_ALL_USER); $current_semester = steam_factory::get_group($GLOBALS["STEAM"]->get_id(), "Courses." . $this->getObjectName($customerID)); $elearning_course = elearning_mediathek::get_instance()->get_elearning_course_by_id($courseID); $name = $elearning_course->get_name(); $new_course = steam_factory::create_group($GLOBALS["STEAM"]->get_id(), $id, $current_semester, FALSE, $name); $icon_id = steam_factory::get_object_by_name($GLOBALS["STEAM"]->get_id(), "/packages/elearning_stahl_verkauf/icon_verkauf.jpg")->get_id(); $new_course->set_attributes(array("OBJ_TYPE" => "course", "COURSE_PARTICIPANT_MNGMNT" => 0, "COURSE_SEMESTER" => $this->getObjectName($customerID), "COURSE_TUTORS" => "", "COURSE_SHORT_DSC" => $elearning_course->get_description(), "COURSE_LONG_DSC" => "[img]" . PATH_SERVER . "/cached/get_document.php?id={$icon_id}&height=100[/img]\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tIn dieser Schulung möchten wir Ihnen die notwendigen Kenntnisse vermitteln, wie Sie ein Verkaufsgespräch gut führen – beginnend mit dem Blickkontakt, wenn eine Kundin oder ein Kunde Ihr Geschäft betritt, bis hin zur Verabschiedung, mit der Sie den Kunden hoffentlich mit dem Gefühl verabschieden, dass er bald wiederkommen wird.\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tOberhalb dieses Textes befindet sich eine Registerkarte »Lektionen«, über die Sie sich zunächst die Schulungsinhalte aneignen können. Auf diese Inhalte haben Sie jederzeit Zugriff; Sie können die Inhalte so oft durcharbeiten, wie Sie wünschen. Und Sie können dies von jedem an das Internet angeschlossenen Computer aus, also beispielsweise auch von zu Hause.\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tUm zu zeigen, dass Sie die Inhalte beherrschen, müssen Sie an einem Test teilnehmen. Dieser Test wird zu einem bestimmten Termin für Sie freigeschaltet. Sie erhalten dann zu gegebener Zeit eine Mitteilung, dass Sie zu dem Test zugelassen sind. Neben der Registerkarte, mit der Sie zu den Schulungsinhalten gelangen, finden Sie dann eine zusätzliche Registerkarte, mit der Sie den Test ablegen können.\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tSollten Sie auf Probleme stoßen – seien es technische, inhaltliche oder Fragen zur Benutzung dieses Systems – finden Sie Hilfe am oberen Rand dieser Seite. Außerdem können Sie jederzeit Kontakt zu Ihrem Ansprechpartner aufnehmen, der Ihnen gerne weiterhelfen wird.", "COURSE_HISLSF_ID" => "", "ACTIVATED_FOR_CUSTOMER" => $customerID)); $learners = steam_factory::create_group($GLOBALS["STEAM"]->get_id(), "learners", $new_course, FALSE, "Participants of course '" . $name . "'"); $learners->set_attribute("OBJ_TYPE", "course_learners"); $staff = steam_factory::create_group($GLOBALS["STEAM"]->get_id(), "staff", $new_course, FALSE, "Tutors of course '" . $name . "'"); $staff->set_attribute("OBJ_TYPE", "course_staff"); $admins = steam_factory::create_group($GLOBALS["STEAM"]->get_id(), "admins", $new_course, FALSE, "Admins of course '" . $name . "'"); $admins->set_attribute("OBJ_TYPE", "course_admins"); //$staff->add_member( $user ); // RIGHTS MANAGEMENT ======================================= $course_calendar = $new_course->get_calendar(); $learners_workroom = $learners->get_workroom(); $course_workroom = $new_course->get_workroom(); $staff->set_sanction_all($staff); $staff->sanction_meta(SANCTION_ALL, $staff); $learners->set_sanction_all($staff); $learners->sanction_meta(SANCTION_ALL, $staff); $new_course->set_sanction_all($staff); $new_course->sanction_meta(SANCTION_ALL, $staff); $admins->set_sanction_all($admins); $admins->sanction_meta(SANCTION_ALL, $admins); $staff->set_sanction_all($admins); $staff->sanction_meta(SANCTION_ALL, $admins); $learners->set_sanction_all($admins); $learners->sanction_meta(SANCTION_ALL, $admins); $new_course->set_sanction_all($admins); $new_course->sanction_meta(SANCTION_ALL, $admins); $course_calendar->set_acquire(FALSE); $course_calendar->set_sanction_all($staff); $course_calendar->sanction_meta(SANCTION_ALL, $staff); $course_calendar->set_sanction_all($admins); $course_calendar->sanction_meta(SANCTION_ALL, $admins); $course_calendar->set_read_access($learners, TRUE); $course_calendar->set_write_access($new_course, FALSE); $course_calendar->set_insert_access($new_course, FALSE); $course_calendar->set_insert_access($all_users, FALSE); // Course workroom $course_workroom->set_sanction($new_course, SANCTION_READ | SANCTION_EXECUTE | SANCTION_ANNOTATE); $course_workroom->set_sanction_all($staff); $course_workroom->set_sanction_all($admins); $course_workroom->sanction_meta(SANCTION_ALL, $staff); $course_workroom->sanction_meta(SANCTION_ALL, $admins); // Learners workroom $learners_workroom->set_read_access($all_users, TRUE); $learners_workroom->set_sanction($learners, SANCTION_READ | SANCTION_EXECUTE | SANCTION_ANNOTATE); $learners_workroom->set_sanction_all($staff); $learners_workroom->set_sanction_all($admins); $learners_workroom->sanction_meta(SANCTION_ALL, $staff); $learners_workroom->sanction_meta(SANCTION_ALL, $admins); $koala_course = new koala_group_course($new_course); $koala_course->set_access(1, $learners, $staff, $admins, KOALA_GROUP_ACCESS); $new_course->set_attributes(array("COURSE_UNITS_ENABLED" => "TRUE", "UNITS_DOCPOOL_ENABLED" => "TRUE", "UNITS_ELEARNING_ENABLED" => "TRUE", "UNITS_MEDIATHING_ENABLED" => "FALSE", "UNITS_ORGANIZATION_ENABLED" => "FALSE", "UNITS_VIDEOSTREAMING_ENABLED" => "FALSE")); // create unit elearning $env = $koala_course->get_workroom(); $new_unit_elearning_course = steam_factory::create_container($GLOBALS["STEAM"]->get_id(), $elearning_course->get_name(), $env, $elearning_course->get_description()); $new_unit_elearning_course->set_attributes(array("UNIT_TYPE" => "units_elearning", "OBJ_TYPE" => "elearning_unit_koala", "UNIT_DISPLAY_TYPE" => gettext("units_elearning"), "ELEARNING_UNIT_ID" => $courseID)); return true; }
exit; } //current room steam object $column = $column != 0 ? steam_factory::get_object($steam, $column) : $steam->get_login_user()->get_workroom(); $column_name = $column->get_attribute(OBJ_NAME); //get write permission $allowed = $column->check_access_read($steam->get_login_user()); if (!$allowed) { die("Erstellung nicht möglich!<br>"); } // Action save if ($action == "save" && trim($_POST["title"]) != "") { require_once "portlets/" . $_POST["portlet_type"] . "/name.php"; $tmp_mapping = $_POST["portlet_type"] . "_version"; $version = ${$tmp_mapping}; $new_portlet = steam_factory::create_container($steam, rawurlencode($_POST["title"]), $column); $new_portlet->set_attributes(array(OBJ_DESC => trim($_POST["title"]), OBJ_TYPE => "container_portlet_bid", "bid:portlet" => $_POST["portlet_type"], "bid:portlet:version" => $version)); //redirect to portlet edit script $steam->disconnect(); header("Location: {$config_webserver_ip}/modules/portal2/portlets/" . $_POST["portlet_type"] . "/edit.php?portlet=" . $new_portlet->get_id()); exit; } // Action cancel if ($action == "cancel") { // redirect to column edit script $steam->disconnect(); header("Location: " . "{$config_webserver_ip}/modules/portal2/edit_column.php?column=" . $column->get_id()); exit; } //Logout/Disconnect $steam->disconnect();
//get write permission $access_write = $current_room->check_access_write($steam->get_login_user()); $access_read = $current_room->check_access_read($steam->get_login_user()); $access_insert = $current_room->check_access_insert($steam->get_login_user()); $allowed = $access_write && $access_read && $access_insert ? true : false; if (!$allowed) { //Disconnect & close $steam->disconnect(); die("<html>\n<body onload='javascript:window.close();'>\n</body>\n</html>"); } //create questionary if adviced too if (isset($_POST["mission"]) && $_POST["mission"] == "create" && $name != "" && $allowed) { //create new questionary $questionary = steam_factory::create_container($steam, $name, $current_room); $questions_folder = steam_factory::create_container($steam, 'questions', $questionary); $answers_folder = steam_factory::create_container($steam, 'answers', $questionary); if (isset($_POST["description"])) { $description = norm_post($_POST["description"]); } else { $description = ""; } if ($questionary && $questions_folder && $answers_folder) { //set standard layout $layout = $templates[1]; unset($layout["name_ge"]); unset($layout["name_en"]); //define rights for the attributes $loginuser_id = $steam->get_login_user()->get_id(); $rootid = steam_factory::username_to_object($steam, "root")->get_id(); $author_rights[$loginuser_id] = $loginuser_id; $editor_rights[$loginuser_id] = $loginuser_id;
$problems .= gettext("One of the required fields is missing."); $hints .= gettext("Please provide a existing id of an elearning couse."); } // if correct 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; // 1. create object on server if (!isset($unit)) { $env = $course->get_workroom(); $id = $values["elearning_course_id"]; $mediathek = elearning_mediathek::get_instance(); $elearning_course = $mediathek->get_course_by_id($id); $name = $elearning_course->get_name(); $new_unit_elearning_course = steam_factory::create_container($GLOBALS["STEAM"]->get_id(), $elearning_course->get_name(), $env, $elearning_course->get_description()); $new_unit_elearning_course->set_attributes(array("UNIT_TYPE" => "units_elearning", "OBJ_TYPE" => "elearning_unit_koala", "UNIT_DISPLAY_TYPE" => gettext("units_elearning"), "ELEARNING_UNIT_ID" => $id)); //$koala_unit = new koala_object_docextern( $new_unit, new units_extern( $course->get_steam_object() ) ); } else { die; $new_unit = $unit->get_steam_object(); $koala_unit = $unit; $attrs = $new_unit->get_attributes(array(OBJ_NAME, OBJ_DESC, 'OBJ_LONG_DESC', OBJ_TYPE, 'UNIT_TYPE', 'UNIT_DISPLAY_TYPE', 'UNIT_EXTERN_APPEARANCE', 'DOC_EXTERN_URL', 'UNIT_EXTERN_URL_DESCRIPTION')); if ($attrs[OBJ_NAME] !== $values['name']) { $new_unit->set_name($values['name']); } $changes = array(); if ($attrs['OBJ_TYPE'] !== 'docextern_unit_koala') { $changes['OBJ_TYPE'] = 'docextern_unit_koala'; } if ($attrs['UNIT_TYPE'] !== 'units_extern') {
} //add/edit description if ($action != "" && isset($_POST["text"])) { //check for error if (trim($_POST["text"]) == "") { $error = "error_no_text"; } else { //update text if ($action == "edit" && isset($question_id)) { //add_description $geo = new questionary_geo(); $geo->add_description($_POST["text"]); } else { if ($action == "insert") { //create new element in questions $question = steam_factory::create_container($steam, time() . "", $question_folder); $question_id = $question->get_id(); //add_description $geo = new questionary_geo(); $geo->add_description($_POST["text"], $question_id); } } //save geometry in questionary $result = $question->set_attribute("bid:question:geometry", $geo->get_last_element()); } } //Disconnect $steam->disconnect(); //redirect to edit page again if (isset($result) && $result) { header("Location: {$config_webserver_ip}/modules/questionary/edit.php?questionary=" . $questionary->get_id());
function createMsg($steam, $column, $name, $version) { $msg = steam_factory::create_container($steam, $name, $column); $msg->set_attributes(array(OBJ_DESC => $name, OBJ_TYPE => "container_portlet_bid", "bid:portlet:version" => $version, "bid:portlet" => "msg")); }
if (isset($post[$input_id . "_" . $key])) { $tendency_elements[] = $post[$input_id . "_" . $key]; } } $input[$input_id] = $tendency_elements; break; default: $input[$input_id] = $post[$input_id]; } } } //if answer is set then store data in answer object otherwise create a new one if ($answer) { $input_object = $answer; } else { $input_object = steam_factory::create_container($steam, time() . "", $answer_folder); } //if answer object is ok then save data if ($input_object) { $saved = $input_object->set_attribute("bid:questionary:input", $input); } } //****************************************************** //** Display Stuff //****************************************************** //template stuff $tpl = new Template("./templates/{$language}", "keep"); $tpl->set_file("content", "answer.ihtml"); $tpl->set_block("content", "error", "DUMMY"); $tpl->set_block("content", "error_no_write_access", "DUMMY"); $tpl->set_block("content", "error_multiple_input", "DUMMY");
function check_steam_container($container_path, $description = "", $fix = FALSE) { $container = steam_factory::get_object_by_name($GLOBALS["STEAM"]->get_id(), $container_path); if (!is_object($container)) { if (!$fix) { return FALSE; } if (!is_object($container_environment = steam_factory::get_object_by_name($GLOBALS["STEAM"]->get_id(), dirname($container_path)))) { output("Error: could not get parent directory for container: '" . dirname($container_path) . "'\n"); return FALSE; } if (!is_object($container = steam_factory::create_container($GLOBALS["STEAM"]->get_id(), basename($container_path), $container_environment, $description))) { output("Error: could not create container: '" . $container_path . "'.\n"); return FALSE; } output("Created container: '" . $container_path . "'.\n"); } return $container; }
private function createTry($tryNumber) { //create steam container for try $this->container_try[$tryNumber] = steam_factory::create_container($GLOBALS["STEAM"]->get_id(), "" . $tryNumber, $this->elearning_course_data); //create attributes xml $attributes_xml = new SimpleXMLElement("<attributes></attributes>"); $attributes_xml->addChild("UNIT_ELEARNING_EXAM_FINAL_EXAM_ENABLED", "false"); $attributes_xml->addChild("UNIT_ELEARNING_EXAM_FINAL_EXAM_FINISHED", "false"); $attributes_xml->addChild("UNIT_ELEARNING_EXAM_FINAL_EXAM_PASSED", "false"); $attributes_xml->addChild("UNIT_ELEARNING_EXAM_FINAL_EXAM_SUM_POINTS", ""); $attributes_xml->addChild("UNIT_ELEARNING_EXAM_FINAL_EXAM_SUM_SCORE", ""); $attributes_xml->addChild("UNIT_ELEARNING_EXAM_FINAL_EXAM_ANSWERS", ""); $this->try_data_xml[$tryNumber] = steam_factory::create_document($GLOBALS["STEAM"]->get_id(), "attributes.xml", (string) $attributes_xml->asXML(), "text/xml", $this->container_try[$tryNumber]); $GLOBALS["STEAM"]->buffer_flush(); }
public function frameResponse(\FrameResponseObject $frameResponseObject) { $workplanExtension = \Workplan::getInstance(); $workplanExtension->addJS(); $workplanExtension->addJS($fileName = 'jsgantt.js'); $workplanExtension->addCSS($fileName = 'jsgantt.css'); $user = $GLOBALS["STEAM"]->get_current_steam_user(); $portal = \lms_portal::get_instance(); $objectID = $this->params[0]; $workplanContainer = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $objectID); $xmlfile = $workplanContainer->get_inventory_filtered(array(array("+", "class", CLASS_DOCUMENT))); $createContainer = 0; // check if user submitted create milestone or create task form if ($_SERVER["REQUEST_METHOD"] == "POST") { if (isset($_POST["new_milestone"])) { $createContainer = 1; } else { if (isset($_POST["new_task"])) { $createContainer = 2; } } } // create new milestone or task if ($createContainer != 0) { $xmltree = new \SimpleXMLElement($xmlfile[0]->get_content()); if ($createContainer == 1) { $xml = $xmltree->addChild("milestone"); $newName = $_POST["milestonename"]; $newStart = $_POST["milestonedate"]; $newStart = mktime(0, 0, 0, substr($newStart, 3, 2), substr($newStart, 0, 2), substr($newStart, 6, 4)); $newEnd = $_POST["milestonedate"]; $newEnd = mktime(0, 0, 0, substr($newEnd, 3, 2), substr($newEnd, 0, 2), substr($newEnd, 6, 4)); if (strlen($_POST["milestoneduration"]) > 0) { $newDuration = $_POST["milestoneduration"]; } else { $newDuration = -1; } if (strlen($_POST["milestonedepends"]) > 0) { $newDepends = $_POST["milestonedepends"]; } else { $newDepends = -1; } $newUsers = ""; if (isset($_POST["milestoneusers"])) { for ($count = 0; $count < count($_POST["milestoneusers"]); $count++) { $newUsers = $newUsers . $_POST["milestoneusers"][$count] . ","; } $newUsers = substr($newUsers, 0, strlen($newUsers) - 1); } $portal->set_confirmation("Meilenstein " . $newName . " wurde erfolgreich erstellt."); } else { $xml = $xmltree->addChild("task"); $newName = $_POST["taskname"]; $newStart = $_POST["taskstart"]; $newStart = mktime(0, 0, 0, substr($newStart, 3, 2), substr($newStart, 0, 2), substr($newStart, 6, 4)); $newEnd = $_POST["taskend"]; $newEnd = mktime(0, 0, 0, substr($newEnd, 3, 2), substr($newEnd, 0, 2), substr($newEnd, 6, 4)); if (strlen($_POST["taskduration"]) > 0) { $newDuration = $_POST["taskduration"]; } else { $newDuration = -1; } if (strlen($_POST["taskdepends"]) > 0) { $newDepends = $_POST["taskdepends"]; } else { $newDepends = -1; } $newUsers = ""; if (isset($_POST["taskusers"])) { for ($count = 0; $count < count($_POST["taskusers"]); $count++) { $newUsers = $newUsers . $_POST["taskusers"][$count] . ","; } $newUsers = substr($newUsers, 0, strlen($newUsers) - 1); } $portal->set_confirmation("Vorgang " . $newName . " wurde erfolgreich erstellt."); } $newContainer = \steam_factory::create_container($GLOBALS["STEAM"]->get_id(), $newName, $workplanContainer); $xml->addChild("name", $newName); $xml->addChild("oid", $newContainer->get_id()); $newContainer->set_attribute("WORKPLAN_START", $newStart); $xml->addChild("start", $newStart); $newContainer->set_attribute("WORKPLAN_END", $newEnd); $xml->addChild("end", $newEnd); $xml->addChild("duration", $newDuration); $newContainer->set_attribute("WORKPLAN_DURATION", $newDuration); $xml->addChild("depends", $newDepends); $newContainer->set_attribute("WORKPLAN_DEPENDS", $newDepends); $newContainer->set_attribute("WORKPLAN_USERS", $newUsers); $xml->addChild("users", $newUsers); $xmlfile[0]->set_content($xmltree->saveXML()); } if (is_object($workplanContainer) && $workplanContainer instanceof \steam_room) { // if user has the required rights display actionbar if ($user->get_id() == $workplanContainer->get_creator()->get_id() || in_array("WORKPLAN_" . $user->get_id() . "_LEADER", $workplanContainer->get_attribute_names())) { $content = $workplanExtension->loadTemplate("workplan_ganttview.template.html"); $content->setCurrentBlock("BLOCK_CONFIRMATION"); $content->setVariable("CONFIRMATION_TEXT", "NONE"); $content->parse("BLOCK_CONFIRMATION"); $content->setCurrentBlock("BLOCK_WORKPLAN_GANTT_ACTIONBAR"); $content->setVariable("LABEL_NEW_SNAPSHOT", "Snapshot erstellen"); $content->setVariable("WORKPLAN_ID", $objectID); $content->setVariable("LABEL_NEW_MILESTONE", "Neuer Meilenstein"); $content->setVariable("LABEL_NEW_TASK", "Neuer Vorgang"); $content->parse("BLOCK_WORKPLAN_GANTT_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/" . $objectID), array("name" => "Tabelle", "link" => $this->getExtension()->getExtensionUrl() . "listView/" . $objectID), array("name" => "Gantt-Diagramm", "link" => $this->getExtension()->getExtensionUrl() . "ganttView/" . $objectID), array("name" => "Mitarbeiter", "link" => $this->getExtension()->getExtensionUrl() . "users/" . $objectID), array("name" => "Snapshots", "link" => $this->getExtension()->getExtensionUrl() . "snapshots/" . $objectID))); $tabBar->setActiveTab(2); $frameResponseObject->addWidget($tabBar); $xml = simplexml_load_string($xmlfile[0]->get_content()); $helpToArray = $xml->children(); $list = array(); for ($counter = 0; $counter < count($helpToArray); $counter++) { array_push($list, $helpToArray[$counter]); } usort($list, 'sort_xmllist'); $content = $workplanExtension->loadTemplate("workplan_ganttview.template.html"); if (count($list) == 0) { $content->setCurrentBlock("BLOCK_WORKPLAN_GANTT_EMPTY"); $content->setVariable("WORKPLAN_GANTT_EMPTY", "Keine Meilensteine oder Vorgänge zu diesem Projektplan vorhanden."); $content->parse("BLOCK_WORKPLAN_GANTT_EMPTY"); } // change the format of the information so it can be displayed via javascript/jsgantt $oids = "["; $tasks = "["; $starts = "["; $ends = "["; $dependslist = "["; $milestones = "["; for ($counter = 0; $counter < count($list); $counter++) { $name = $list[$counter]->name; $tasks = $tasks . $name . ","; $starts = $starts . (int) $list[$counter]->start . ","; $ends = $ends . (int) $list[$counter]->end . ","; $oids = $oids . $list[$counter]->oid . ","; $depends = $list[$counter]->depends; if ($depends == -1) { $dependslist = $dependslist . "-1,"; } else { $dependslist = $dependslist . $depends . ","; } if ($list[$counter]->getName() == "milestone") { $milestones = $milestones . "1,"; } else { $milestones = $milestones . "0,"; } } if (count($list) > 0) { $oids = substr($oids, 0, strlen($oids) - 1) . "]"; $tasks = substr($tasks, 0, strlen($tasks) - 1) . "]"; $starts = substr($starts, 0, strlen($starts) - 1) . "]"; $ends = substr($ends, 0, strlen($ends) - 1) . "]"; $dependslist = substr($dependslist, 0, strlen($dependslist) - 1) . "]"; $milestones = substr($milestones, 0, strlen($milestones) - 1) . "]"; } else { $oids = $oids . "]"; $tasks = $tasks . "]"; $starts = $starts . "]"; $ends = $ends . "]"; $dependslist = $dependslist . "]"; $milestones = $milestones . "]"; } $content->setCurrentBlock("BLOCK_GANTT_CHART"); $content->setVariable("GANTT_DIV", "ganttchartdiv"); $content->setVariable("WORKPLAN_GANTT_TASKS", $tasks); $content->setVariable("WORKPLAN_GANTT_OID", $oids); $content->setVariable("WORKPLAN_GANTT_MILESTONE", $milestones); $content->setVariable("WORKPLAN_GANTT_DEPENDS", $dependslist); $content->setVariable("WORKPLAN_GANTT_START", $starts); $content->setVariable("WORKPLAN_GANTT_END", $ends); $content->parse("BLOCK_GANTT_CHART"); $content->setCurrentBlock("BLOCK_WORKPLAN_LIST_FORMULAR"); $content->setVariable("LABEL_NEW_MILESTONE", "Meilenstein hinzufügen"); $content->setVariable("LABEL_NEW_TASK", "Vorgang hinzufügen"); $content->setVariable("NAME_LABEL", "Name:*"); $content->setVariable("START_LABEL", "Beginn:*"); $content->setVariable("END_LABEL", "Ende:*"); $content->setVariable("DATE_LABEL", "Datum:*"); $content->setVariable("DURATION_LABEL", "Dauer:"); $content->setVariable("DEPENDS_LABEL", "Abhängigkeit:"); $content->setVariable("USERS_LABEL", "Mitarbeiter:"); $groupID = 0; if (in_array("WORKPLAN_GROUP", $workplanContainer->get_attribute_names())) { $groupID = $workplanContainer->get_attribute("WORKPLAN_GROUP"); } if ($groupID == 0) { $content->setCurrentBlock("BEGIN BLOCK_USER_OPTION_MILESTONE"); $content->setVariable("USER_ID", $user->get_id()); $content->setVariable("USER_NAME", $user->get_full_name()); $content->parse("BLOCK_USER_OPTION_MILESTONE"); $content->setCurrentBlock("BEGIN BLOCK_USER_OPTION_TASK"); $content->setVariable("USER_ID", $user->get_id()); $content->setVariable("USER_NAME", $user->get_full_name()); if (in_array("WORKPLAN_" . $user->get_id() . "_RESSOURCE", $workplanContainer->get_attribute_names())) { $content->setVariable("USER_RESSOURCE", $workplanContainer->get_attribute("WORKPLAN_" . $user->get_id() . "_RESSOURCE")); } else { $content->setVariable("USER_RESSOURCE", 0); } $content->parse("BLOCK_USER_OPTION_TASK"); } else { $groupObject = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $groupID); $members = $groupObject->get_members(); for ($count = 0; $count < count($members); $count++) { $currentMember = $members[$count]; $content->setCurrentBlock("BEGIN BLOCK_USER_OPTION_MILESTONE"); $content->setVariable("USER_ID", $currentMember->get_id()); $content->setVariable("USER_NAME", $currentMember->get_full_name()); $content->parse("BLOCK_USER_OPTION_MILESTONE"); $content->setCurrentBlock("BEGIN BLOCK_USER_OPTION_TASK"); $content->setVariable("USER_ID", $currentMember->get_id()); $content->setVariable("USER_NAME", $currentMember->get_full_name()); if (in_array("WORKPLAN_" . $currentMember->get_id() . "_RESSOURCE", $workplanContainer->get_attribute_names())) { $content->setVariable("USER_RESSOURCE", $workplanContainer->get_attribute("WORKPLAN_" . $currentMember->get_id() . "_RESSOURCE")); } else { $content->setVariable("USER_RESSOURCE", 0); } $content->parse("BLOCK_USER_OPTION_TASK"); } } $content->setCurrentBlock("BLOCK_LIST_MILESTONE_DEPENDS"); $content->setVariable("DEPENDS_OID", "-1"); $content->setVariable("DEPENDS_NAME", "Keine Abhängigkeit"); $content->parse("BLOCK_LIST_MILESTONE_DEPENDS"); $content->setCurrentBlock("BLOCK_LIST_TASK_DEPENDS"); $content->setVariable("DEPENDS_OID", "-1"); $content->setVariable("DEPENDS_NAME", "Keine Abhängigkeit"); $content->parse("BLOCK_LIST_TASK_DEPENDS"); for ($count = 0; $count < count($list); $count++) { if ($list[$count]->getName() == 'task') { $content->setCurrentBlock("BLOCK_LIST_MILESTONE_DEPENDS"); $content->setVariable("DEPENDS_OID", $list[$count]->oid); $content->setVariable("DEPENDS_NAME", $list[$count]->name); $content->parse("BLOCK_LIST_MILESTONE_DEPENDS"); $content->setCurrentBlock("BLOCK_LIST_TASK_DEPENDS"); $content->setVariable("DEPENDS_OID", $list[$count]->oid); $content->setVariable("DEPENDS_NAME", $list[$count]->name); $content->parse("BLOCK_LIST_TASK_DEPENDS"); } } $content->setVariable("LABEL_BACK", "Ausblenden"); $content->setVariable("LABEL_ADD", "Hinzufügen"); $content->setVariable("WORKPLAN_ID", $this->params[0]); $content->parse("BLOCK_WORKPLAN_LIST_FORMULAR"); $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; } }
} if (strpos($values['name'], '/')) { $problems .= ' ' . gettext("Please don't use the \"/\"-char in the name of the unit."); $have_problems = TRUE; } if ($values['access'] == PERMISSION_UNDEFINED) { $problems .= ' ' . gettext('Invalid access rights.'); $hints .= ' ' . gettext('Please choose a valid access rights option.'); $have_problems = TRUE; } if (!empty($problems)) { $portal->set_problem_description($problems, $hints); } else { if (!isset($unit)) { $env = $owner->get_workroom(); $new_unit = steam_factory::create_container($GLOBALS["STEAM"]->get_id(), $values["name"], $env, $values["short_dsc"]); $new_unit->set_attributes(array('UNIT_TYPE' => "units_docpool", 'UNIT_DISPLAY_TYPE' => gettext("Document Pool"), 'OBJ_TYPE' => "container_docpool_unit_koala", 'OBJ_LONG_DESC' => $values["dsc"])); $GLOBALS["STEAM"]->buffer_flush(); $koala_unit = new koala_container_docpool($new_unit, new units_docpool($owner->get_steam_object())); } else { $new_unit = $unit->get_steam_object(); $koala_unit = $unit; $attrs = $new_unit->get_attributes(array(OBJ_NAME, OBJ_DESC, 'OBJ_LONG_DESC', OBJ_TYPE, 'UNIT_TYPE', 'UNIT_DISPLAY_TYPE')); if ($attrs[OBJ_NAME] !== $values['name']) { $new_unit->set_name($values['name']); } $changes = array(); if ($attrs['OBJ_TYPE'] !== 'container_docpool_unit_koala') { $changes['OBJ_TYPE'] = 'container_docpool_unit_koala'; } if ($attrs['UNIT_TYPE'] !== 'units_docpool') {