/** * Enable an extension globally. This is done via the extensions persistent object. * Dependencies to other extensions are taken into account. If a required extension * is not active, activation will not be done. * @return boolean activation success or not */ public function enable() { if (!$this->is_enabled()) { $can_be_enabled = TRUE; $em = lms_steam::get_extensionmanager(); foreach ($this->requirements as $req_extension) { $req_extension = $em->get_extension($req_extension); if (!$req_extension->is_enabled()) { $can_be_enabled = FALSE; } } if ($can_be_enabled) { // if no extension config object exists, then create one: if (!is_object($this->steam_object)) { $this->steam_object = steam_factory::get_object_by_name($GLOBALS["STEAM"]->get_id(), "/config/koala/extensions/" . $this->get_name()); if (!is_object($this->steam_object)) { $env = steam_factory::path_to_object($GLOBALS["STEAM"]->get_id(), "/config/koala/extensions"); $this->steam_object = steam_factory::create_object($GLOBALS["STEAM"]->get_id(), $this->get_name(), CLASS_OBJECT, $env); $this->steam_object->set_attributes(array('OBJ_TYPE' => 'object_extension_koala', 'OBJ_DESC' => $this->description, 'EXTENSION_ENABLED' => 'TRUE')); } } $this->set_attribute("EXTENSION_ENABLED", "TRUE"); return TRUE; } return FALSE; } }
public function getSidebar() { $sidebarObject = \steam_factory::get_object_by_name($GLOBALS["STEAM"]->get_id(), $this->object->get_path() . "/sidebar.html"); if (isset($sidebarObject) && $sidebarObject instanceof \steam_document) { return $sidebarObject->get_content(); } else { return ""; } }
function __construct($parent_tmp, $steamObject_tmp, $type) { $this->parent = $parent_tmp; $this->steamObject = $steamObject_tmp; $this->type = $type; $this->myUser = lms_steam::get_current_user(); //get meta data $doc = steam_factory::get_object_by_name($GLOBALS["STEAM"]->get_id(), $this->steamObject->get_path() . "/exam.xml"); $this->xml = simplexml_load_string($doc->get_content()); }
public function getHtmlForObjectId(\FrameResponseObject $frameResponseObject) { $mplme = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id); if (isset($this->params[1]) && !strstr($this->params[1], "?")) { $doc = \steam_factory::get_object_by_name($GLOBALS["STEAM"]->get_id(), $mplme->get_path() . "/" . $this->params[1]); if (isset($doc) && $doc !== 0 && $doc instanceof \steam_document) { echo $doc->download(); //echo $doc->get_content(); } else { echo "404"; } die; } $elements = $mplme->get_inventory(); $html = ""; foreach ($elements as $element) { if ($element->get_name() == "data.xml") { $xmlContent = $element->get_content(); //$html .= "<b>".$element->get_name()."</b><br><pre>". htmlentities($element->get_content()) . "</pre><br>"; } else { if ($element->get_name() == $_REQUEST["xslName"] . ".xsl") { $xslContent = $element->get_content(); //$html .= "<b>".$element->get_name()."</b><br><pre>". htmlentities($element->get_content()) . "</pre><br>"; } else { //$html .= "<b>".$element->get_name()."</b><br>"; } } } if (isset($xmlContent) && isset($xslContent)) { $xml = new \DOMDocument(); $xml->loadXML($xmlContent); $searchstring = '/<includexslt[ 0-9a-zA-Z=\\/\\"]*url="([~\\-0-9a-zA-Z=\\:\\?\\&\\.\\/]+)"[ 0-9a-zA-Z=\\/"]*[ \\-0-9a-zA-Z=\\/"]*\\/>/i'; $xslContent = preg_replace_callback($searchstring, array(&$this, 'cb_replace'), $xslContent); $xsl = new \DOMDocument(); $xsl->loadXML($xslContent); $proc = new \XSLTProcessor(); $proc->importStylesheet($xsl); $html .= $proc->transformToXml($xml); } if (isset($_REQUEST['output']) && $_REQUEST['output'] === "download") { header('Content-Disposition: attachment; filename=data.' . $_REQUEST['xslName']); } $rawHtml = new \Widgets\RawHtml(); $rawHtml->setHtml($html); $frameResponseObject->addWidget($rawHtml); $frameResponseObject->setHeadline(array(array("name" => "zurück", "link" => "javascript:history.back()"), array("name" => "Mplme"))); return $frameResponseObject; }
public function frameResponse(\FrameResponseObject $frameResponseObject) { $rapidfeedback = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id); $RapidfeedbackExtension = \Rapidfeedback::getInstance(); $survey = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->params[1]); $survey_object = new \Rapidfeedback\Model\Survey($rapidfeedback); $xml = \steam_factory::get_object_by_name($GLOBALS["STEAM"]->get_id(), $survey->get_path() . "/survey.xml"); $user = $GLOBALS["STEAM"]->get_current_steam_user(); $RapidfeedbackExtension->addCSS(); $RapidfeedbackExtension->addJS(); $content = $RapidfeedbackExtension->loadTemplate("rapidfeedback_results.template.html"); $content->setCurrentBlock("BLOCK_RESULTS"); $content->setVariable("RESULTS_LABEL", "Auswertung"); if ($survey->get_attribute("RAPIDFEEDBACK_RESULTS") != 1) { $content->setVariable("RESULTS_AMOUNT", $survey->get_attribute("RAPIDFEEDBACK_RESULTS") . " Abgaben"); } else { $content->setVariable("RESULTS_AMOUNT", $survey->get_attribute("RAPIDFEEDBACK_RESULTS") . " Abgabe"); } $survey_object->parseXML($xml); $survey_object->generateResults($survey); $questions = $survey_object->getQuestions(); $question_html = ' <script type="text/javascript" src="https://www.google.com/jsapi"></script> <script type="text/javascript"> google.load("visualization", "1", {packages:["corechart"]}); </script>'; for ($count = 0; $count < count($questions); $count++) { $question_html = $question_html . $questions[$count]->getResultHTML($count + 1); } $content->setVariable("QUESTIONS_HTML", $question_html); $content->setVariable("BACK_LABEL", "Zurück"); $content->setVariable("BACK_URL", $RapidfeedbackExtension->getExtensionUrl() . "Index/" . $this->id); $content->parse("BLOCK_RESULTS"); $group = $rapidfeedback->get_attribute("RAPIDFEEDBACK_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(); } $rawWidget = new \Widgets\RawHtml(); $rawWidget->setHtml($content->get()); $frameResponseObject->addWidget($rawWidget); $frameResponseObject->setHeadline(array(array("name" => $courseOrGroup, "link" => $courseOrGroupUrl), array("name" => "Rapid Feedback", "link" => $RapidfeedbackExtension->getExtensionUrl() . "Index/" . $rapidfeedback->get_id()), array("name" => "Auswertung"))); return $frameResponseObject; }
public function frameResponse(\FrameResponseObject $frameResponseObject) { $portal = \lms_portal::get_instance(); $content = \Wave::getInstance()->loadTemplate("wave.template.html"); if (strtolower($this->calledNamespace) === "wave" && strtolower($this->calledCommand) === "index") { $sideId = $this->params[0]; $internalPath = $this->params; array_shift($internalPath); $sideUrl = $this->getExtension()->getExtensionUrl() . "Index/" . $sideId . "/"; } else { $sideObject = \steam_factory::get_object_by_name($GLOBALS["STEAM"]->get_id(), WAVE_PATH_INTERN); if ($sideObject instanceof \steam_object) { $sideId = $sideObject->get_id(); $internalPath = $this->params; $sideUrl = PATH_URL; } else { die("WAVE config broken (WAVE_PATH_INTERN: " . WAVE_PATH_INTERN . ")"); } } if (!isset($internalPath)) { $internalPath = array(); } $waveEngine = new \Wave\Model\WaveEngine($sideId, $internalPath, $sideUrl); $waveSide = $waveEngine->getSide(); $waveObject = $waveEngine->getCurrentObject(); if ($waveObject instanceof \Wave\Model\WavePage) { $content->setVariable("CONTENT", $waveObject->getHtml()); $rawHtml = new \Widgets\RawHtml(); $rawHtml->setHtml($content->get()); $frameResponseObject->addWidget($rawHtml); return $frameResponseObject; } else { if ($waveObject instanceof \Wave\Model\WaveDownload) { $waveObject->download(); die; } else { die("Not Wave-Object detected."); } } }
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; }
/** * function install_package: * * Installs an SPM package on the server. The package needs to be a valid * steam_document, so you will have to upload the package file first * before you pass it to this function. * * @param steam_document $spm_package the package object to install * @return boolean TRUE if the package was installed, FALSE on failure */ public function install_package($spm_package) { if (!is_object($spm_package) || !$spm_package instanceof steam_document) { throw new Exception("No valid SPM package provided."); } $spm_module = $this->get_module("SPM"); if (!is_object($spm_module)) { throw new Exception("Could not get the SPM module.\n"); } $root_room = steam_factory::get_object_by_name($this->get_id(), "/"); if (!is_object($root_room)) { throw new Exception("Could not find the root-room.\n"); } $result = $this->predefined_command($spm_module, "install_spm", array($spm_package, $root_room), 0); return is_array($result); }
public function frameResponse(\FrameResponseObject $frameResponseObject) { $user = $GLOBALS["STEAM"]->get_current_steam_user(); $userID = $user->get_id(); $pyramidRoom = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id); $pyramiddiscussionExtension = \Pyramiddiscussion::getInstance(); $pyramiddiscussionExtension->addCSS(); $pyramiddiscussionExtension->addJS(); $content = $pyramiddiscussionExtension->loadTemplate("pyramiddiscussion_index.template.html"); $admingroup = $pyramidRoom->get_attribute("PYRAMIDDISCUSSION_ADMINGROUP"); $basegroup = $pyramidRoom->get_attribute("PYRAMIDDISCUSSION_BASEGROUP"); $startElements = $pyramidRoom->get_attribute("PYRAMIDDISCUSSION_MAX"); $maxcol = $pyramidRoom->get_attribute("PYRAMIDDISCUSSION_MAXCOL"); $deadlines = $pyramidRoom->get_attribute("PYRAMIDDISCUSSION_DEADLINES"); $user_management = $pyramidRoom->get_attribute("PYRAMIDDISCUSSION_PARTICIPANT_MANAGEMENT"); $deadlines_used = false; $currentUserGroup = 0; $objtype = $pyramidRoom->get_attribute("OBJ_TYPE"); if (!strStartsWith($objtype, "container_pyramiddiscussion")) { $rawWidget = new \Widgets\RawHtml(); $rawWidget->setHtml("Objekt " . $this->id . " ist keine Pyramidendiskussion."); $frameResponseObject->addWidget($rawWidget); return $frameResponseObject; } // if one or more deadlines past by since the last visit on this page, change the phase $phase = $pyramidRoom->get_attribute("PYRAMIDDISCUSSION_ACTCOL"); if ($phase != 0 && $phase <= $maxcol && $pyramidRoom->get_attribute("PYRAMIDDISCUSSION_USEDEADLINES") == "yes" && $pyramidRoom->get_attribute("PYRAMIDDISCUSSION_OVERRIDE_DEADLINES") == 0) { $currentDeadline = $deadlines[$phase]; while (true) { if ($currentDeadline > time()) { break; } else { $phase++; $pyramidRoom->set_attribute("PYRAMIDDISCUSSION_ACTCOL", $phase); if ($phase == $maxcol + 1) { break; } $currentDeadline = $deadlines[$phase]; } } } $adminoptions_change = -1; if (isset($this->params[1])) { $adminoptions_change = $this->params[1]; } // if current user is admin display actionbar if ($admingroup->is_member($user)) { $adminconfig = $pyramidRoom->get_attribute("PYRAMIDDISCUSSION_ADMINCONFIG"); if (array_key_exists($userID, $adminconfig)) { $options = $adminconfig[$userID]; // change show/hide settings if ($adminoptions_change != -1) { if ($adminoptions_change == 1) { $options["show_adminoptions"] = "true"; } else { $options["show_adminoptions"] = "false"; } $adminconfig[$userID] = $options; $pyramidRoom->set_attribute("PYRAMIDDISCUSSION_ADMINCONFIG", $adminconfig); } } else { $adminconfig[$userID] = array(); $options = $adminconfig[$userID]; $options["show_adminoptions"] = "true"; $adminconfig[$userID] = $options; $pyramidRoom->set_attribute("PYRAMIDDISCUSSION_ADMINCONFIG", $adminconfig); } if ($options["show_adminoptions"] == "true") { $actionbar = new \Widgets\Actionbar(); $actions = array(array("name" => "Konfiguration", "link" => $pyramiddiscussionExtension->getExtensionUrl() . "configuration/" . $this->id), array("name" => "Teilnehmerverwaltung", "link" => $pyramiddiscussionExtension->getExtensionUrl() . "users/" . $this->id), array("name" => "Rundmail erstellen", "link" => $pyramiddiscussionExtension->getExtensionUrl() . "mail/" . $this->id), array("name" => "Adminmodus ausschalten", "link" => $pyramiddiscussionExtension->getExtensionUrl() . "Index/" . $this->id . "/0")); $actionbar->setActions($actions); $frameResponseObject->addWidget($actionbar); } else { $actionbar = new \Widgets\Actionbar(); $actions = array(array("name" => "Adminmodus einschalten", "link" => $pyramiddiscussionExtension->getExtensionUrl() . "Index/" . $this->id . "/1")); $actionbar->setActions($actions); $frameResponseObject->addWidget($actionbar); } } // display the general information block $content->setCurrentBlock("BEGIN BLOCK_PYRAMID_INFORMATION"); $content->setVariable("JS_URL", $pyramiddiscussionExtension->getAssetUrl()); $content->setVariable("GENERAL_INFORMATION", "Allgemeine Informationen"); $content->setVariable("PHASE_LABEL", "Aktueller Status:"); // if user is an admin and adminoptions are shown, display a select box to change the current phase if (isset($options["show_adminoptions"]) && $options["show_adminoptions"] == "true") { for ($count = 0; $count <= $maxcol + 2; $count++) { $content->setCurrentBlock("BLOCK_PHASE_OPTION"); $content->setVariable("PHASE_ID", $count); if ($count == 0) { $content->setVariable("PHASE_VALUE", "Gruppeneinteilungsphase"); } else { if ($count <= $maxcol) { $content->setVariable("PHASE_VALUE", $count . ". Diskussionsphase"); } else { if ($count == $maxcol + 1) { $content->setVariable("PHASE_VALUE", "Endphase"); } else { $content->setVariable("PHASE_VALUE", "Pyramide einfrieren"); } } } if ($count == $phase) { $content->setVariable("PHASE_SELECTED", "selected"); } $content->setVariable("CHANGE_PHASE", "Ändern"); $params = "{ id : " . $pyramidRoom->get_id() . ", action : 'phase', newphase : document.getElementById('phase').value }"; $content->setVariable("CHANGE_PHASE_ACTION", "sendRequest('Index', " . $params . ", '" . $pyramidRoom->get_id() . "', 'reload');"); $content->parse("BLOCK_PHASE_OPTION"); } } else { $content->setCurrentBlock("BLOCK_PYRAMID_PHASE_NOADMIN"); if ($phase == 0) { $content->setVariable("PHASE_VALUE", "Gruppeneinteilungsphase"); } else { if ($phase <= $pyramidRoom->get_attribute("PYRAMIDDISCUSSION_MAXCOL")) { $content->setVariable("PHASE_VALUE", $phase . ". Diskussionsphase"); } else { if ($phase == $pyramidRoom->get_attribute("PYRAMIDDISCUSSION_MAXCOL") + 1) { $content->setVariable("PHASE_VALUE", "Endphase"); } else { $content->setVariable("PHASE_VALUE", "Pyramide eingefroren"); } } } $content->parse("BLOCK_PYRAMID_PHASE_NOADMIN"); } $content->setVariable("DEADLINE_LABEL", "Deadline:"); // display current deadline if deadlines are used and override is off if ($pyramidRoom->get_attribute("PYRAMIDDISCUSSION_USEDEADLINES") == "yes" && $pyramidRoom->get_attribute("PYRAMIDDISCUSSION_OVERRIDE_DEADLINES") == 0 && $phase != 0 && $phase <= $maxcol) { $content->setVariable("DEADLINE_VALUE", date("d.m.Y H:i", (int) $deadlines[$phase])); $content->setVariable("DISPLAY_OVERRIDE", "none"); $deadlines_used = true; // if user is admin, adminoptions are shown, deadlines are used but override is on, display a dialog to stop the override } else { if ($pyramidRoom->get_attribute("PYRAMIDDISCUSSION_USEDEADLINES") == "yes" && $pyramidRoom->get_attribute("PYRAMIDDISCUSSION_OVERRIDE_DEADLINES") == 1 && isset($options["show_adminoptions"]) && $options["show_adminoptions"] == "true") { $content->setVariable("DEADLINE_VALUE", "Aktuelle Phase wurde trotz der Verwendung von Deadlines manuell gesetzt. Die Deadlines werden im Moment nicht berücksichtigt."); $content->setVariable("DEADLINE_OVERRIDE_LABEL", "Deadlines aktivieren"); $params = "{ id : " . $pyramidRoom->get_id() . ", action : 'deadlines' }"; $content->setVariable("DEADLINE_OVERRIDE_ACTION", "sendRequest('Index', " . $params . ", '" . $pyramidRoom->get_id() . "', 'reload');"); } else { $content->setVariable("DEADLINE_VALUE", "keine"); $content->setVariable("DISPLAY_OVERRIDE", "none"); } } $content->setVariable("INFO_LABEL", "Infotext:"); $content->setVariable("INFO_VALUE", nl2br($pyramidRoom->get_attribute("OBJ_DESC"))); $content->parse("BEGIN BLOCK_PYRAMID_INFORMATION"); // display pyramid $content->setCurrentBlock("BLOCK_PYRAMID"); // create array to store the users for all positions $users = array(); for ($count = 1; $count <= $maxcol; $count++) { for ($count2 = 1; $count2 <= $startElements / pow(2, $count - 1); $count2++) { $users[$count . $count2] = array(); } } // for every phase $maxuser = 1; for ($count = 1; $count <= $maxcol; $count++) { // if deadlines are used, display deadline of every phase on the top of the phase if ($pyramidRoom->get_attribute("PYRAMIDDISCUSSION_USEDEADLINES") == "yes" && $pyramidRoom->get_attribute("PYRAMIDDISCUSSION_OVERRIDE_DEADLINES") == 0 && $phase <= $maxcol) { $content->setCurrentBlock("BLOCK_PYRAMID_DEADLINE"); $content->setVariable("DEADLINE_ID", "deadline" . $count); $content->setVariable("DEADLINE_DATE", date("d.m.Y H:i", (int) $deadlines[$count])); $content->parse("BLOCK_PYRAMID_DEADLINE"); } // create user array for ($count2 = 1; $count2 <= $startElements / pow(2, $count - 1); $count2++) { $position = \steam_factory::get_object_by_name($GLOBALS["STEAM"]->get_id(), $pyramidRoom->get_path() . "/Position_" . $count . "_" . $count2); $positionGroup = $position->get_attribute("PYRAMIDDISCUSSION_RELGROUP"); $positionMembers = $positionGroup->get_members(); // add the users from the positions in the first phase to their corresponding arrays if ($count == 1) { if ($positionMembers instanceof \steam_user) { $users[$count . $count2] = $positionMembers->get_id(); if ($positionMembers->get_id() == $userID) { $currentUserGroup = $positionGroup->get_id(); } } else { foreach ($positionMembers as $positionMember) { array_push($users[$count . $count2], $positionMember->get_id()); if ($positionMember->get_id() == $userID) { $currentUserGroup = $positionGroup->get_id(); } } } if (count($users[$count . $count2]) > $maxuser) { $maxuser = count($users[$count . $count2]); } // add users to the arrays of the positions for all other phases } else { $users[$count . $count2] = array_merge($users[$count - 1 . ($count2 * 2 - 1)], $users[$count - 1 . $count2 * 2]); } } // for every position in a phase for ($count2 = 1; $count2 <= $startElements / pow(2, $count - 1); $count2++) { $position = \steam_factory::get_object_by_name($GLOBALS["STEAM"]->get_id(), $pyramidRoom->get_path() . "/Position_" . $count . "_" . $count2); $positionGroup = $position->get_attribute("PYRAMIDDISCUSSION_RELGROUP"); $positionMembers = $positionGroup->get_members(); // get the names from all users of the current position (that still take part in the discussion) $participants = $pyramidRoom->get_attribute("PYRAMIDDISCUSSION_PARTICIPANT_MANAGEMENT"); foreach ($users[$count . $count2] as $currentUserID) { if (!isset($participants[$currentUserID])) { $participants[$currentUserID] = 0; $pyramidRoom->set_attribute("PYRAMIDDISCUSSION_PARTICIPANT_MANAGEMENT", $participants); } if ($participants[$currentUserID] == 0 || $participants[$currentUserID] >= $count) { $currentMember = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $currentUserID); } } // get position read states $read_states = $position->get_attribute("PYRAMIDDISCUSSION_POS_READ_STATES"); if (!is_array($read_states)) { $read_states = array(); } // determine if there are unread comments for the current position $comments_read = 1; $comments = $position->get_annotations(); foreach ($comments as $comment) { $comment_read_states = $comment->get_attribute("PYRAMIDDISCUSSION_COMMENT_READ_STATES"); if (!is_array($comment_read_states)) { $comment_read_states = array(); } if (!array_key_exists($userID, $comment_read_states) || $comment_read_states[$userID] != "1") { $comments_read = 0; break; } } $read = false; $content->setCurrentBlock("BLOCK_PYRAMID_POSITION"); $state = "phase" . $count . " "; if ($count <= $phase && count($users[$count . $count2]) > 0) { $state = $state . "active "; } else { if (!($phase == 0 && $count == 1) || $phase != 0 && count($users[$count . $count2]) == 0) { $state = $state . "inactive "; $content->setVariable("POSITION_ACTION_HIDDEN", "hidden"); $read = true; } else { $state = $state . "active "; } } if (in_array($userID, $users[$count . $count2])) { $state = $state . "my "; if ($phase != 0) { if ($phase == $count && (!isset($user_management[$currentUserID]) || $user_management[$currentUserID] == 0 || $user_management[$currentUserID] >= $count)) { // current discussion phase $content->setVariable("POSITION_ACTION_LABEL", "Position lesen<br>und bearbeiten"); $content->setVariable("COMMENTS_URL", 'href="' . $pyramiddiscussionExtension->getExtensionUrl() . 'ViewPosition/' . $pyramidRoom->get_id() . '/' . $position->get_id() . '#comments"'); } else { if ($count < $phase) { // previous discussion phase $content->setVariable("POSITION_ACTION_LABEL", "Position lesen"); $content->setVariable("COMMENTS_URL", 'href="' . $pyramiddiscussionExtension->getExtensionUrl() . 'ViewPosition/' . $pyramidRoom->get_id() . '/' . $position->get_id() . '#comments"'); } } $content->setVariable("POSITION_ACTION_URL", $pyramiddiscussionExtension->getExtensionUrl() . "ViewPosition/" . $pyramidRoom->get_id() . "/" . $position->get_id()); if (array_key_exists($userID, $read_states) && $read_states[$userID] == "1" || $position->get_content() == "0" || $position->get_content() == "") { $read = true; } } else { // group choosing phase, my position $content->setVariable("POSITION_ACTION_LABEL", "Position<br>verlassen"); $params = "{ id : " . $position->get_id() . ", pyramid : " . $pyramidRoom->get_id() . ", action : 'join', formergroup : " . $currentUserGroup . ", newgroup : " . $positionGroup->get_id() . " }"; $content->setVariable("POSITION_ACTION_URL", "javascript:sendRequest('EditPosition', " . $params . ", '" . $position->get_id() . "', 'reload');"); $read = true; } } else { if ($phase != 0) { if ($count < $phase) { // previous discussion phase, other positions (reading allowed) $content->setVariable("POSITION_ACTION_LABEL", "Position lesen"); $content->setVariable("POSITION_ACTION_URL", $pyramiddiscussionExtension->getExtensionUrl() . "ViewPosition/" . $pyramidRoom->get_id() . "/" . $position->get_id()); if (array_key_exists($userID, $read_states) && $read_states[$userID] == "1" || $position->get_content() == "0" || $position->get_content() == "") { $read = true; } $content->setVariable("COMMENTS_URL", 'href="' . $pyramiddiscussionExtension->getExtensionUrl() . 'ViewPosition/' . $pyramidRoom->get_id() . '/' . $position->get_id() . '#comments"'); } else { if ($phase == $count) { // current discussion phase, other positions (reading not allowed) $content->setVariable("POSITION_ACTION_HIDDEN", "hidden"); $read = true; } } } else { // group choosing phase, other positions $content->setVariable("POSITION_ACTION_LABEL", "Position<br>beitreten"); $params = "{ id : " . $position->get_id() . ", pyramid : " . $pyramidRoom->get_id() . ", action : 'join', formergroup : " . $currentUserGroup . ", newgroup : " . $positionGroup->get_id() . " }"; $content->setVariable("POSITION_ACTION_URL", "javascript:sendRequest('EditPosition', " . $params . ", '" . $position->get_id() . "', 'reload');"); $read = true; } } if ($read) { $state = $state . "read"; $content->setVariable("READSTATUS_ICON", "read_position"); $content->setVariable("READSTATUS_TITLE", "Position gelesen"); } else { $state = $state . "unread"; $content->setVariable("READSTATUS_ICON", "not_read_position"); $content->setVariable("READSTATUS_TITLE", "Position ungelesen"); } if ($phase > 0 && $phase != $maxcol + 2 && (isset($options["show_adminoptions"]) && $options["show_adminoptions"] == "true")) { $content->setVariable("POSITION_ACTION_URL", $pyramiddiscussionExtension->getExtensionUrl() . "ViewPosition/" . $pyramidRoom->get_id() . "/" . $position->get_id()); $content->setVariable("POSITION_ACTION_HIDDEN", ""); $content->setVariable("POSITION_ACTION_LABEL", "Position lesen<br>und bearbeiten"); $content->setVariable("COMMENTS_URL", 'href="' . $pyramiddiscussionExtension->getExtensionUrl() . 'ViewPosition/' . $pyramidRoom->get_id() . '/' . $position->get_id() . '#comments"'); } $content->setVariable("POSITION_ID", "position" . $count . $count2); $content->setVariable("POSITION_STATE", $state); $content->setVariable("POSITION_LABEL", "Position " . $count . "-" . $count2); $content->setVariable("ASSETURL", $pyramiddiscussionExtension->getAssetUrl()); if ($comments_read == 1) { $content->setVariable("ANNOTATION_COUNT", count($comments)); $content->setVariable("ANNOTATION_TITLE", "Keine ungelesenen Kommentare vorhanden"); $content->setVariable("COMMENTSTATUS_ICON", "no_comments"); } else { $content->setVariable("ANNOTATION_COUNT", "<b>" . count($comments) . "</b>"); $content->setVariable("ANNOTATION_TITLE", "Ungelesene Kommentare vorhanden"); $content->setVariable("COMMENTSTATUS_ICON", "comments"); } foreach ($users[$count . $count2] as $currentUserID) { if (!isset($user_management[$currentUserID]) || $user_management[$currentUserID] == 0 || $user_management[$currentUserID] >= $count) { $currentUser = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $currentUserID); $pic_id = $currentUser->get_attribute("OBJ_ICON")->get_id(); $pic_link = $pic_id == 0 ? PATH_URL . "styles/standard/images/anonymous.jpg" : PATH_URL . "download/image/" . $pic_id . "/15/20"; $content->setCurrentBlock("BLOCK_PYRAMID_POSITION_USER"); $content->setVariable("USER_URL", PATH_URL . "user/index/" . $currentUser->get_name()); $content->setVariable("PIC_URL", $pic_link); $content->setVariable("USER_NAME", $currentUser->get_full_name()); $content->parse("BLOCK_PYRAMID_POSITION_USER"); } } $content->parse("BLOCK_PYRAMID_POSITION"); } } $heights = array(); $heights[0] = 5; // gap switch ($maxuser) { case 1: $heights[1] = 106; break; case 2: $heights[1] = 126; break; case 3: $heights[1] = 146; break; case 4: $heights[1] = 166; break; default: $heights[1] = 176; break; } $heights[2] = 2 * $heights[1] - 0.5 * $heights[1] + 1 * $heights[0]; $heights[3] = 3 * $heights[1] + 2 * $heights[0]; $heights[4] = 4 * $heights[1] + 3 * $heights[0]; $heights[5] = 8 * $heights[1] + 7 * $heights[0]; $heights[6] = 16 * $heights[1] + 15 * $heights[0]; $heights[7] = 32 * $heights[1] + 31 * $heights[0]; // special case if ($maxcol == 3) { $heights[3] = 2 * $heights[1] + 1 * $heights[0]; } $css = ""; for ($count = 1; $count <= $maxcol; $count++) { $css = $css . ".phase" . $count . " { width: 120px; height: " . $heights[$count] . "px; } \n"; } // background triangle $triangle = $startElements * ($heights[0] + $heights[1]) * 0.5 + 16; $triangle_end = array(0, 300, 450, 600, 720); if ($startElements <= 16) { $css = $css . "\n\t\t\t.pyramid_triangle {\n\t \t\t\tborder-color: transparent transparent transparent #FDF1A7;\n\t \t\t\tborder-style: solid;\n\t \t\t\tborder-width: " . $triangle . "px 0px " . $triangle . "px " . $triangle_end[$maxcol - 1] . "px;\n\t \t\t\twidth:0px;\n\t \t\t\theight:0px;\n\t\t\t}"; } $content->setVariable("CSS_HEIGHTS", $css); $content->setVariable("JS_STARTPOSITIONS", $startElements); $content->setVariable("JS_GAP", $heights[0]); $content->setVariable("JS_HEIGHT", $heights[1]); $content->setVariable("JS_DEADLINES", $deadlines_used); $content->setVariable("EMPTY_DIV_HEIGHT", $startElements * ($heights[0] + $heights[1]) + 16 . "px"); $content->parse("BLOCK_PYRAMID"); $rawWidget = new \Widgets\RawHtml(); $rawWidget->setHtml($content->get()); $frameResponseObject->addWidget($rawWidget); $frameResponseObject->setHeadline("Pyramidendiskussion: " . $pyramidRoom->get_name()); return $frameResponseObject; }
public function frameResponse(\FrameResponseObject $frameResponseObject) { $rapidfeedback = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id); $user = $GLOBALS["STEAM"]->get_current_steam_user(); $RapidfeedbackExtension = \Rapidfeedback::getInstance(); $RapidfeedbackExtension->addJS(); // admin action (start, stop, copy, delete) got submitted if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST["admin_action"])) { $element = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $_POST["element_id"]); if ($element instanceof \steam_object) { switch ($_POST["admin_action"]) { case 1: $element->set_attribute("RAPIDFEEDBACK_STATE", 1); break; case 2: $element->set_attribute("RAPIDFEEDBACK_STATE", 2); break; case 3: $copy = \steam_factory::create_copy($GLOBALS["STEAM"]->get_id(), $element); $copy->move($rapidfeedback); $copy->set_attribute("RAPIDFEEDBACK_PARTICIPANTS", array()); $copy->set_attribute("RAPIDFEEDBACK_STATE", 0); $copy->set_attribute("RAPIDFEEDBACK_RESULTS", 0); $copy->set_attribute("RAPIDFEEDBACK_STARTTYPE", 0); $resultContainer = \steam_factory::get_object_by_name($GLOBALS["STEAM"]->get_id(), $copy->get_path() . "/results"); $results = $resultContainer->get_inventory(); foreach ($results as $result) { $result->delete(); } break; case 4: $element->delete(); break; } } } // edit configuration got submitted if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST["edit_rapidfeedback"])) { $rapidfeedback->set_name($_POST["title"]); $rapidfeedback->set_attribute("OBJ_DESC", $_POST["desc"]); if (isset($_POST["adminsurvey"]) && $_POST["adminsurvey"] == "on") { $rapidfeedback->set_attribute("RAPIDFEEDBACK_ADMIN_SURVEY", 1); } else { $rapidfeedback->set_attribute("RAPIDFEEDBACK_ADMIN_SURVEY", 0); } } // create/edit survey got submitted if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST["create_survey"])) { $survey_object = new \Rapidfeedback\Model\Survey($rapidfeedback); $survey_object->setName($_POST["title"]); $survey_object->setBeginText($_POST["begintext"]); $survey_object->setEndText($_POST["endtext"]); $questioncounter = 0; $sortedQuestions = $_POST["sortable_array"]; $sortedQuestions != '' ? $sortedQuestions = explode(',', $sortedQuestions) : ''; foreach ($sortedQuestions as $question) { if ($question != "newquestion" && $question != "newlayout" && $question != "") { $questionValues = $_POST[$question]; $questionValues != '' ? $questionValues = explode(',', $questionValues) : ''; switch ($questionValues[0]) { case 0: $newquestion = new \Rapidfeedback\Model\TextQuestion(); break; case 1: $newquestion = new \Rapidfeedback\Model\TextareaQuestion(); break; case 2: $newquestion = new \Rapidfeedback\Model\SingleChoiceQuestion(); $options = $_POST[$question . "_options"]; $options != '' ? $options = explode(',', $options) : ''; foreach ($options as $option) { $newquestion->addOption(rawurldecode($option)); } $newquestion->setArrangement($questionValues[4]); break; case 3: $newquestion = new \Rapidfeedback\Model\MultipleChoiceQuestion(); $options = $_POST[$question . "_options"]; $options != '' ? $options = explode(',', $options) : ''; foreach ($options as $option) { $newquestion->addOption(rawurldecode($option)); } $newquestion->setArrangement($questionValues[4]); break; case 4: $newquestion = new \Rapidfeedback\Model\MatrixQuestion(); $columns = $_POST[$question . "_columns"]; $columns != '' ? $columns = explode(',', $columns) : ''; foreach ($columns as $column) { $newquestion->addcolumn(rawurldecode($column)); } $rows = $_POST[$question . "_rows"]; $rows != '' ? $rows = explode(',', $rows) : ''; foreach ($rows as $row) { $newquestion->addRow(rawurldecode($row)); } break; case 5: $newquestion = new \Rapidfeedback\Model\GradingQuestion(); $options = $_POST[$question . "_rows"]; $options != '' ? $options = explode(',', $options) : ''; foreach ($options as $option) { $newquestion->addRow(rawurldecode($option)); } break; case 6: $newquestion = new \Rapidfeedback\Model\TendencyQuestion(); $options = $_POST[$question . "_options"]; $options != '' ? $options = explode(',', $options) : ''; $newquestion->setSteps($questionValues[4]); for ($count = 0; $count < count($options); $count = $count + 2) { $newquestion->addOption(array($options[$count], $options[$count + 1])); } break; } $newquestion->setQuestionText(rawurldecode($questionValues[1])); $newquestion->setHelpText(rawurldecode($questionValues[2])); $newquestion->setRequired($questionValues[3]); $survey_object->addQuestion($newquestion); } } if ($_POST["starttype"] == 1) { $survey_object->setStartType(1, $_POST["begin"], $_POST["end"]); } else { $survey_object->setStartType(0); } if (isset($this->params[1])) { $survey_object->createSurvey($this->params[1]); } else { $survey_object->createSurvey(); } } // display actionbar if current user is admin $staff = $rapidfeedback->get_attribute("RAPIDFEEDBACK_STAFF"); $admin = 0; if ($staff instanceof \steam_group && $staff->is_member($user) || $staff instanceof \steam_user && $staff->get_id() == $user->get_id()) { $admin = 1; $actionbar = new \Widgets\Actionbar(); $actions = array(array("name" => "Konfiguration", "link" => $RapidfeedbackExtension->getExtensionUrl() . "configuration/" . $this->id), array("name" => "Import", "link" => $RapidfeedbackExtension->getExtensionUrl() . "import/" . $this->id), array("name" => "Umfrage erstellen", "link" => $RapidfeedbackExtension->getExtensionUrl() . "edit/" . $this->id)); $actionbar->setActions($actions); $frameResponseObject->addWidget($actionbar); } // get the surveys that are to be shown and sort them $surveys = $rapidfeedback->get_inventory(); $surveys_inactive = array(); $surveys_running = array(); $surveys_ended = array(); foreach ($surveys as $survey) { if ($survey instanceof \steam_container && !$survey instanceof \steam_user) { $starttype = $survey->get_attribute("RAPIDFEEDBACK_STARTTYPE"); $state = $survey->get_attribute("RAPIDFEEDBACK_STATE"); // if survey is started/ended automatically check the times if (is_array($starttype)) { if (time() > $starttype[1] && $state == 0) { $survey->set_attribute("RAPIDFEEDBACK_STATE", 1); } if (time() > $starttype[0] && $state == 1) { $survey->set_attribute("RAPIDFEEDBACK_STATE", 2); } } $state = $survey->get_attribute("RAPIDFEEDBACK_STATE"); if ($state == 0) { array_push($surveys_inactive, $survey); } else { if ($state == 1) { $participants = $survey->get_attribute("RAPIDFEEDBACK_PARTICIPANTS"); if ($admin == 1 || !in_array($user->get_id(), $participants)) { array_push($surveys_running, $survey); } } else { array_push($surveys_ended, $survey); } } } } usort($surveys_inactive, "sort_workplans"); usort($surveys_running, "sort_workplans"); usort($surveys_ended, "sort_workplans"); if ($admin == 1) { $surveys = array_merge($surveys_inactive, $surveys_running, $surveys_ended); } else { $surveys = $surveys_running; } // display surveys $content = $RapidfeedbackExtension->loadTemplate("rapidfeedback_index.template.html"); if (count($surveys) == 0) { $content->setCurrentBlock("BLOCK_NO_SURVEYS"); $content->setVariable("NO_SURVEYS", "Keine Umfragen vorhanden."); $content->setVariable("RAPIDFEEDBACK_NAME", $rapidfeedback->get_name()); if ($rapidfeedback->get_attribute("OBJ_DESC") != "0") { $content->setVariable("RAPIDFEEDBACK_DESC", $rapidfeedback->get_attribute("OBJ_DESC")); } $content->parse("BLOCK_NO_SURVEYS"); } else { $content->setCurrentBlock("BLOCK_SURVEY_TABLE"); $content->setVariable("RAPIDFEEDBACK_NAME", $rapidfeedback->get_name()); if ($rapidfeedback->get_attribute("OBJ_DESC") != "0") { $content->setVariable("RAPIDFEEDBACK_DESC", $rapidfeedback->get_attribute("OBJ_DESC")); } $content->setVariable("NAME_LABEL", "Name der Umfrage"); $content->setVariable("STATUS_LABEL", "Status"); $content->setVariable("QUESTIONS_LABEL", "Anzahl der Fragen"); $content->setVariable("RESULTS_LABEL", "Anzahl der Abgaben"); $content->setVariable("ACTIONS_LABEL", "Aktionen"); foreach ($surveys as $survey) { $content->setCurrentBlock("BLOCK_SURVEY_ELEMENT"); $content->setVariable("NAME_VALUE", $survey->get_name()); $participants = $survey->get_attribute("RAPIDFEEDBACK_PARTICIPANTS"); $state = $survey->get_attribute("RAPIDFEEDBACK_STATE"); $adminsAllowed = $rapidfeedback->get_attribute("RAPIDFEEDBACK_ADMIN_SURVEY"); if ($admin == 1 && in_array($user->get_id(), $participants) | $state != 1 | $adminsAllowed == 0) { $content->setVariable("DISPLAY_LINK", "none"); $content->setVariable("NAME_DONE", $survey->get_name()); } $starttype = $survey->get_attribute("RAPIDFEEDBACK_STARTTYPE"); if ($state == 0) { if (is_array($starttype)) { $content->setVariable("STATE_VALUE", "Inaktiv (Start: " . date('d.m.Y', $starttype[1]) . ")"); $content->setVariable("DISPLAY_START", "none"); } else { $content->setVariable("STATE_VALUE", "Inaktiv"); } $content->setVariable("DISPLAY_RESULTS", "none"); $content->setVariable("DISPLAY_STOP", "none"); $content->setVariable("DISPLAY_REPEAT", "none"); } else { if ($state == 1) { if (is_array($starttype)) { $content->setVariable("STATE_VALUE", "Aktiv (Ende: " . date('d.m.Y', $starttype[0]) . ")"); $content->setVariable("DISPLAY_STOP", "none"); } else { $content->setVariable("STATE_VALUE", "Aktiv"); } $content->setVariable("DISPLAY_EDIT", "none"); $content->setVariable("DISPLAY_START", "none"); $content->setVariable("DISPLAY_REPEAT", "none"); if ($survey->get_attribute("RAPIDFEEDBACK_RESULTS") == 0) { $content->setVariable("DISPLAY_RESULTS", "none"); } } else { $content->setVariable("STATE_VALUE", "Beendet"); $content->setVariable("DISPLAY_EDIT", "none"); $content->setVariable("DISPLAY_START", "none"); $content->setVariable("DISPLAY_STOP", "none"); if ($survey->get_attribute("RAPIDFEEDBACK_RESULTS") == 0) { $content->setVariable("DISPLAY_RESULTS", "none"); } } } $content->setVariable("QUESTIONS_VALUE", $survey->get_attribute("RAPIDFEEDBACK_QUESTIONS")); $content->setVariable("RESULTS_VALUE", $survey->get_attribute("RAPIDFEEDBACK_RESULTS")); $content->setVariable("ASSET_URL", $RapidfeedbackExtension->getAssetUrl() . "icons"); $content->setVariable("PREVIEW_TITLE", "Vorschau"); $content->setVariable("VIEW_URL", $RapidfeedbackExtension->getExtensionUrl() . "view/" . $this->id . "/" . $survey->get_id()); $content->setVariable("PREVIEW_URL", $RapidfeedbackExtension->getExtensionUrl() . "view/" . $this->id . "/" . $survey->get_id() . "/1"); $content->setVariable("EDIT_TITLE", "Umfrage bearbeiten"); $content->setVariable("EDIT_URL", $RapidfeedbackExtension->getExtensionUrl() . "edit/" . $this->id . "/" . $survey->get_id()); $content->setVariable("RESULTS_TITLE", "Auswertung"); $content->setVariable("RESULTS_URL", $RapidfeedbackExtension->getExtensionUrl() . "results/" . $this->id . "/" . $survey->get_id()); $content->setVariable("DELETE_TITLE", "Umfrage löschen"); $content->setVariable("START_TITLE", "Umfrage starten"); $content->setVariable("STOP_TITLE", "Umfrage beenden"); $content->setVariable("REPEAT_TITLE", "Umfrage wiederholen"); $content->setVariable("ELEMENT_ID", $survey->get_id()); if ($admin == 0) { $content->setVariable("DISPLAY_ADMIN_ELEMENT", "none"); } $content->parse("BLOCK_SURVEY_ELEMENT"); } if ($admin == 0) { $content->setVariable("DISPLAY_ADMIN", "none"); } $content->parse("BLOCK_SURVEY_TABLE"); } $group = $rapidfeedback->get_attribute("RAPIDFEEDBACK_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(); } $rawWidget = new \Widgets\RawHtml(); $rawWidget->setHtml($content->get()); $frameResponseObject->addWidget($rawWidget); $frameResponseObject->setHeadline(array(array("name" => $courseOrGroup, "link" => $courseOrGroupUrl), array("name" => "Rapid Feedback"))); 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; }
<?php include_once "../../etc/koala.conf.php"; $portal = lms_portal::get_instance(); $portal->initialize(GUEST_NOT_ALLOWED); $object = steam_factory::get_object_by_name($GLOBALS["STEAM"]->get_id(), "/home/root/"); if (!is_object($object)) { die("Kein Object gefunden."); } $clientsupport = $GLOBALS['STEAM']->get_module("package:clientsupport"); if (is_object($clientsupport)) { $result = $GLOBALS['STEAM']->predefined_command($clientsupport, "query_object_data", array($object, 1, 1), false); } else { die("package:clientsupport nicht installiert"); } echo "<h1>clientsupport PHP test</h1>"; echo "<pre>"; print_r($result); // JSON encoded result print_r(json_encode($result));
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(); $content = $TCRExtension->loadTemplate("tcr_index.template.html"); // 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); // create array data structure of the theses (identified by writer of the thesis and writer of the review) $theses_container = \steam_factory::get_object_by_name($GLOBALS["STEAM"]->get_id(), $TCR->get_path() . "/theses"); $theses_inventory = $theses_container->get_inventory(); $theses = array(); $rounds = $TCR->get_attribute("TCR_ROUNDS"); $members = $TCR->get_attribute("TCR_USERS"); sort($members); foreach ($members as $member) { $theses[$member] = array(); foreach ($members as $member2) { $theses[$member][$member2] = array(); } } $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(); } // display message if there are no members specified if (count($members) == 0) { $content->setCurrentBlock("BLOCK_OVERVIEW_TABLE"); $content->setVariable("TCR_TITLE", $TCR->get_attribute("OBJ_DESC")); $content->setVariable("TCR_NO_USERS", "Keine Teilnehmer festgelegt. Bitte in der Konfiguration die teilnehmenden Personen auswählen."); $content->setVariable("DISPLAY_MANY", "none"); $content->setVariable("DISPLAY_TABLE", "none"); $content->parse("BLOCK_OVERVIEW_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"))); return $frameResponseObject; } // shortform of the table is displayed if amount of members is > 4 $shortform = 0; if (count($members) > 4 && count($members) < 9) { $shortform = 1; } else { if (count($members) >= 9) { $help = round(count($members) / 8); if (count($members) / 8 > $help) { $shortform = $help + 1; } else { $shortform = $help; } } } if ($shortform > 1) { $divide = $shortform; } else { $divide = 1; } $area = 0; if (isset($this->params[1])) { $area = $this->params[1]; } // fill array data structure foreach ($theses_inventory as $thesis) { $creator = $thesis->get_creator(); $released = $thesis->get_attribute("TCR_RELEASED"); $round = $thesis->get_attribute("TCR_ROUND"); if ($released != 0) { $critic_array = $thesis->get_attribute("TCR_REVIEWS"); foreach ($critic_array as $critic => $review) { $theses[$creator->get_id()][$critic][$round] = $thesis->get_id(); } } } // display document table $content->setCurrentBlock("BLOCK_OVERVIEW_TABLE"); $content->setVariable("TCR_TITLE", $TCR->get_attribute("OBJ_DESC")); if ($divide == 1) { $content->setVariable("DISPLAY_MANY", "none"); } else { // if there are > 8 members only display 8 on a page and create navigation for the rest if ($area != 0) { $content->setVariable("PREVIOUS_CRITICS", "Zeige " . (($area - 1) * 8 + 1) . " bis " . (($area - 1) * 8 + 8)); $content->setVariable("PREVIOUS_URL", $TCRExtension->getExtensionUrl() . "Index/" . $this->id . "/" . ($area - 1)); } if (count($members) <= $area * 8 + 8) { $content->setVariable("CURRENT_CRITICS", "Aktuell angezeigt: Kritiker " . ($area * 8 + 1) . " bis " . count($members) . " (von " . count($members) . ")"); } else { $content->setVariable("CURRENT_CRITICS", "Aktuell angezeigt: Kritiker " . ($area * 8 + 1) . " bis " . ($area * 8 + 8) . " (von " . count($members) . ")"); } if (count($members) > $area * 8 + 8) { if (count($members) >= ($area + 1) * 8 + 8) { $content->setVariable("NEXT_CRITICS", "Zeige " . (($area + 1) * 8 + 1) . " bis " . (($area + 1) * 8 + 8)); } else { $content->setVariable("NEXT_CRITICS", "Zeige " . (($area + 1) * 8 + 1) . " bis " . count($members)); } $content->setVariable("NEXT_URL", $TCRExtension->getExtensionUrl() . "Index/" . $this->id . "/" . ($area + 1)); } } $content->setVariable("TABLE_LABEL", "Autoren \\ Kritiker"); $countmembers = 0; // create user columns for ($count = $area * 8; $count < min(count($members), ($area + 1) * 8); $count++) { $content->setCurrentBlock("BLOCK_USER_TH"); $member_object = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $members[$count]); $content->setVariable("USER_NAME", $member_object->get_name()); if (count($members) < 8) { $content->setVariable("USER_WIDTH", 80 / count($members)); } else { $content->setVariable("USER_WIDTH", 10); } $content->parse("BLOCK_USER_TH"); } if (count($members) > 8) { $tablewidth = 20 + (min(count($members), ($area + 1) * 8) - $area * 8) * 10; } else { $tablewidth = 100; } $content->setVariable("TABLE_WIDTH", $tablewidth . "%"); // create content of the table for ($count = 0; $count < count($members); $count++) { $content->setCurrentBlock("BLOCK_TABLE_ROW"); $creator = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $members[$count]); $content->setVariable("USER_NAME2", $creator->get_full_name() . " (" . $creator->get_name() . ")"); for ($count2 = $area * 8; $count2 < min(count($members), ($area + 1) * 8); $count2++) { $content->setCurrentBlock("BLOCK_TABLE_COLUMN"); $current_critic = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $members[$count2]); $content->setVariable("COLUMN_TITLE", "Autor: " . $creator->get_name() . " Kritiker: " . $current_critic->get_name()); for ($count3 = 1; $count3 <= $rounds; $count3++) { if (isset($theses[$members[$count]][$members[$count2]][$count3])) { $current_thesis = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $theses[$members[$count]][$members[$count2]][$count3]); $current_critics = $current_thesis->get_attribute("TCR_REVIEWS"); $content->setCurrentBlock("BLOCK_TABLE_ELEMENT"); if ($shortform == 0) { $content->setVariable("ROUND_ROW", "<td width='25%'>R" . $count3 . ":</td>"); $content->setVariable("OTHER_WIDTH", "25"); $content->setVariable("THESIS_LABEL", "These"); } else { $content->setVariable("THESIS_LABEL", "T" . $count3); $content->setVariable("OTHER_WIDTH", "33"); } $content->setVariable("THESIS_URL", $TCRExtension->getExtensionUrl() . "release/" . $theses[$members[$count]][$members[$count2]][$count3]); $current_review = $current_critics[$members[$count2]]; if ($current_review != 0) { $review = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $current_review); $released = $review->get_attribute("TCR_RELEASED"); if ($released != 0) { if ($shortform == 0) { $content->setVariable("REVIEW_LABEL", "Kritik"); } else { $content->setVariable("REVIEW_LABEL", "K" . $count3); } $content->setVariable("REVIEW_URL", $TCRExtension->getExtensionUrl() . "release/" . $current_review); } $current_response = $review->get_attribute("TCR_RESPONSE"); if ($current_response != 0) { $response = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $current_response); $released = $response->get_attribute("TCR_RELEASED"); if ($released != 0) { if ($shortform == 0) { $content->setVariable("RESPONSE_LABEL", "Replik"); } else { $content->setVariable("RESPONSE_LABEL", "R" . $count3); } $content->setVariable("RESPONSE_URL", $TCRExtension->getExtensionUrl() . "release/" . $current_response); } } } $content->parse("BLOCK_TABLE_ELEMENT"); } else { $content->setCurrentBlock("BLOCK_TABLE_ELEMENT"); $content->setVariable("ROUND_ROW", ""); $content->parse("BLOCK_TABLE_ELEMENT"); } } $content->parse("BLOCK_TABLE_COLUMN"); } $content->parse("BLOCK_TABLE_ROW"); } $content->parse("BLOCK_OVERVIEW_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"))); return $frameResponseObject; }
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; }
public function frameResponse(\FrameResponseObject $frameResponseObject) { if (isset($this->id)) { $object = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id); if ($object instanceof \steam_document) { $mimetype = $object->get_attribute(DOC_MIME_TYPE); $objName = $object->get_name(); $objDesc = trim($object->get_attribute(OBJ_DESC)); if ($objDesc === 0 || $objDesc === "") { $name = $objName; } else { $name = $objDesc . " (" . $objName . ")"; } $actionBar = new \Widgets\ActionBar(); if ($mimetype == "text/html") { $actionBar->setActions(array(array("name" => "Anzeigen", "link" => PATH_URL . "Explorer/ViewDocument/" . $this->id . "/"), array("name" => "Quelltext", "link" => PATH_URL . "Explorer/CodeEditDocument/" . $this->id . "/"), array("name" => "Eigenschaften", "ajax" => array("onclick" => array("command" => "properties", "params" => array("id" => $this->id), "requestType" => "popup"))), array("name" => "Rechte", "ajax" => array("onclick" => array("command" => "Sanctions", "params" => array("id" => $this->id), "requestType" => "popup"))))); } else { $actionBar->setActions(array(array("name" => "Anzeigen", "link" => PATH_URL . "Explorer/ViewDocument/" . $this->id . "/"), array("name" => "Eigenschaften", "ajax" => array("onclick" => array("command" => "properties", "params" => array("id" => $this->id), "requestType" => "popup"))), array("name" => "Rechte", "ajax" => array("onclick" => array("command" => "Sanctions", "params" => array("id" => $this->id), "requestType" => "popup"))))); } $contentText = new \Widgets\Textarea(); $contentText->setWidth(945); $contentText->setheight(400); $contentText->setData($object); $contentText->setTextareaClass("mce-full"); if ($mimetype !== "text/html") { $contentText->setTextareaClass("plain"); } $html = cleanHTML($object->get_content()); $dirname = dirname($object->get_path()) . "/"; preg_match_all('/src="([%a-z0-9.\\-_\\/]*)"/iU', $html, $matches); $orig_matches = $matches[0]; $path_matches = $matches[1]; foreach ($path_matches as $key => $path) { $path = urldecode($path); if (parse_url($path, PHP_URL_SCHEME) != null) { continue; } $ref_object = \steam_factory::get_object_by_name($GLOBALS["STEAM"]->get_id(), $dirname . $path); if ($ref_object instanceof \steam_object) { $new_path = PATH_URL . "Download/Document/" . $ref_object->get_id(); } else { $new_path = PATH_URL . "styles/standard/images/404.jpg"; } $html = str_replace($orig_matches[$key], "src=\"{$new_path}\" data-mce-src=\"{$path}\"", $html); } $contentText->setContentProvider(\Widgets\DataProvider::contentProvider($html)); $clearer = new \Widgets\Clearer(); // $html = ""; // if ($mimetype == "image/png" || $mimetype == "image/jpeg" || $mimetype == "image/gif") { // Image // $html = "<div style=\"text-align:center\"><img style=\"max-width:100%\" title=\"{$name}\" alt=\"Bild: {$name}\" src=\"" . PATH_URL . "Download/Document/" . $this->id . "/\"></div>"; // } else if ($mimetype == "text/html") { // $html = strip_tags($object->get_content(),"<h1><h2><h3><h4><h5><p><a><div><style><b><i><strong><img>"); // } else if (strstr($mimetype, "text")) { // $html = "<pre>{$object->get_content()}</pre>"; // } else { // header("location: " . PATH_URL . "Download/Document/" . $this->id . "/"); // } // $rawHtml = new \Widgets\RawHtml(); // $rawHtml->setHtml($html); //$rawHtml->addWidget($breadcrumb); //$rawHtml->addWidget($environment); //$rawHtml->addWidget($loader); $frameResponseObject->setTitle($name); $frameResponseObject->addWidget($actionBar); //$frameResponseObject->addWidget($rawHtml); $frameResponseObject->addWidget($contentText); $frameResponseObject->addWidget($clearer); return $frameResponseObject; } } else { ExtensionMaster::getInstance()->send404Error(); } }
public function generateResults($container) { $results = array(); for ($count = 0; $count < count($this->questions); $count++) { $results[$count] = array(); } $result_container = \steam_factory::get_object_by_name($GLOBALS["STEAM"]->get_id(), $container->get_path() . "/results"); $result_objects = $result_container->get_inventory(); foreach ($result_objects as $result_object) { if ($result_object instanceof \steam_document) { for ($count = 0; $count < count($this->questions); $count++) { if ($result_object->get_attribute("RAPIDFEEDBACK_ANSWER_" . $count) != -1) { array_push($results[$count], $result_object->get_attribute("RAPIDFEEDBACK_ANSWER_" . $count)); } } } } $counter = 0; foreach ($this->questions as $question) { $question->setResults($results[$counter]); $counter++; } }
public function frameResponse(\FrameResponseObject $frameResponseObject) { /* if (isset($this->params[1])) { $object = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id); $parent = $object->get_environment(); if ($parent instanceof \steam_container) { $doc = $parent->get_object_by_name($this->params[1]); if ($doc instanceof \steam_document) { header("location: " . PATH_URL . "Download/Document/" . $doc->get_id()); exit; } } \ExtensionMaster::getInstance()->send404Error(); exit; }*/ if (isset($this->id)) { $object = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id); $objName = $object->get_name(); if ($object instanceof \steam_docextern) { $actionBar = new \Widgets\ActionBar(); $actionBar->setActions(array(array("name" => "URL in neuem Fenster öffnen", "link" => "javascript:window.open('{$object->get_attribute("DOC_EXTERN_URL")}');"))); $rawHtml = new \Widgets\RawHtml(); $rawHtml->setHtml("<iframe height=\"800px\" width=\"100%\" src=\"{$object->get_attribute("DOC_EXTERN_URL")}\" scrolling=\"yes\"></iframe>"); $frameResponseObject->setTitle($objName); $frameResponseObject->addWidget($actionBar); $frameResponseObject->addWidget($rawHtml); return $frameResponseObject; } else { if ($object instanceof \steam_document) { $mimetype = $object->get_attribute(DOC_MIME_TYPE); $objDesc = trim($object->get_attribute(OBJ_DESC)); $actionBar = new \Widgets\ActionBar(); $actionBar->setActions(array(array("name" => "Herunterladen", "link" => PATH_URL . "Download/Document/" . $this->id . "/" . $objName), array("name" => "Eigenschaften", "ajax" => array("onclick" => array("command" => "properties", "params" => array("id" => $this->id), "requestType" => "popup"))), array("name" => "Rechte", "ajax" => array("onclick" => array("command" => "Sanctions", "params" => array("id" => $this->id), "requestType" => "popup"))))); if ($objDesc === 0 || $objDesc === "") { $name = $objName; } else { $name = $objDesc . " (" . $objName . ")"; } $html = ""; if ($mimetype == "image/png" || $mimetype == "image/jpeg" || $mimetype == "image/jpg" || $mimetype == "image/gif") { // Image $html = "<div style=\"text-align:center\"><img style=\"max-width:100%\" title=\"{$name}\" alt=\"Bild: {$name}\" src=\"" . PATH_URL . "Download/Document/" . $this->id . "/\"></div>"; } else { if ($mimetype == "text/html") { $actionBar->setActions(array(array("name" => "Bearbeiten", "link" => PATH_URL . "Explorer/EditDocument/" . $this->id . "/"), array("name" => "Quelltext", "link" => PATH_URL . "Explorer/CodeEditDocument/" . $this->id . "/"), array("name" => "Eigenschaften", "ajax" => array("onclick" => array("command" => "properties", "params" => array("id" => $this->id), "requestType" => "popup"))), array("name" => "Rechte", "ajax" => array("onclick" => array("command" => "Sanctions", "params" => array("id" => $this->id), "requestType" => "popup"))))); //$html = "<B>Hello</I> How are <U> you?</B>"; $html = cleanHTML($object->get_content()); $dirname = dirname($object->get_path()) . "/"; preg_match_all('/href="([%a-z0-9.-_\\/]*)"/iU', $html, $matches); $orig_matches = $matches[0]; $path_matches = $matches[1]; foreach ($path_matches as $key => $path) { $path = urldecode($path); if (parse_url($path, PHP_URL_SCHEME) != null) { continue; } $ref_object = \steam_factory::get_object_by_name($GLOBALS["STEAM"]->get_id(), $dirname . $path); if ($ref_object instanceof \steam_object) { $new_path = PATH_URL . "explorer/index/" . $ref_object->get_id(); } else { $new_path = PATH_URL . "404/"; } $html = str_replace($orig_matches[$key], "href=\"" . $new_path . "\"", $html); } preg_match_all('/src="([%a-z0-9.\\-_\\/]*)"/iU', $html, $matches); $orig_matches = $matches[0]; $path_matches = $matches[1]; foreach ($path_matches as $key => $path) { $path = urldecode($path); if (parse_url($path, PHP_URL_SCHEME) != null) { continue; } $ref_object = \steam_factory::get_object_by_name($GLOBALS["STEAM"]->get_id(), $dirname . $path); if ($ref_object instanceof \steam_object) { $new_path = PATH_URL . "Download/Document/" . $ref_object->get_id(); } else { $new_path = PATH_URL . "styles/standard/images/404.jpg"; } $html = str_replace($orig_matches[$key], "src=\"" . $new_path . "\"", $html); } // die; // $html = preg_replace('/href="([a-z0-9.-_\/]*)"/iU', 'href="' . $config_webserver_ip . '/tools/get.php?object=' . $current_path . '$1"', $html); // $html = preg_replace('/src="([a-z0-9.\-_\/]*)"/iU', 'src="' . $config_webserver_ip . '/tools/get.php?object=' . $current_path . '$1"', $html); } else { if (strstr($mimetype, "text")) { $bidDokument = new \BidDocument($object); $actionBar->setActions(array(array("name" => "Bearbeiten", "link" => PATH_URL . "Explorer/EditDocument/" . $this->id . "/"), array("name" => "Herunterladen", "link" => PATH_URL . "Download/Document/" . $this->id . "/"), array("name" => "Eigenschaften", "ajax" => array("onclick" => array("command" => "properties", "params" => array("id" => $this->id), "requestType" => "popup"))), array("name" => "Rechte", "ajax" => array("onclick" => array("command" => "Sanctions", "params" => array("id" => $this->id), "requestType" => "popup"))))); //$html = "<pre>{$object->get_content()}</pre>"; $html = $bidDokument->get_content(); } else { header("location: " . PATH_URL . "Download/Document/" . $this->id . "/"); } } } $rawHtml = new \Widgets\RawHtml(); $rawHtml->setHtml($html); //$rawHtml->addWidget($breadcrumb); //$rawHtml->addWidget($environment); //$rawHtml->addWidget($loader); $frameResponseObject->setTitle($name); $frameResponseObject->addWidget($actionBar); $frameResponseObject->addWidget($rawHtml); return $frameResponseObject; } } } else { header("location: " . PATH_URL . "404/"); } }
public function frameResponse(\FrameResponseObject $frameResponseObject) { $rapidfeedback = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id); $RapidfeedbackExtension = \Rapidfeedback::getInstance(); $RapidfeedbackExtension->addCSS(); $RapidfeedbackExtension->addJS(); $create_label = "Neue Umfrage erstellen"; $content = $RapidfeedbackExtension->loadTemplate("rapidfeedback_edit.template.html"); $content->setCurrentBlock("BLOCK_CREATE_SURVEY"); $content->setVariable("CREATE_LABEL", "Umfrage erstellen"); $content->setVariable("TITLE_LABEL", "Titel:*"); $content->setVariable("BEGINTEXT_LABEL", "Willkommenstext:"); $content->setVariable("ENDTEXT_LABEL", "Abschlusstext:"); $content->setVariable("STARTTYPE_LABEL", "Starttyp:*"); $content->setVariable("STARTTYPE0_LABEL", "Manuell"); $content->setVariable("STARTTYPE1_LABEL", "Automatisch"); $content->setVariable("START_LABEL", "von:"); $content->setVariable("END_LABEL", "bis:"); $content->setVariable("ELEMENT_COUNTER", 0); $content->setVariable("STARTTYPE_FIRST", "checked"); $content->setVariable("DISPLAY_DATEPICKER", "none"); $content->setVariable("QUESTION_LABEL", "Frage"); $content->setVariable("HELPTEXT_LABEL", "Hilfetext"); $content->setVariable("QUESTIONTYPE_LABEL", "Fragetyp"); $content->setVariable("TEXTQUESTION_LABEL", "Text"); $content->setVariable("TEXTAREAQUESTION_LABEL", "Textarea"); $content->setVariable("SINGLECHOICE_LABEL", "Single Choice"); $content->setVariable("MULTIPLECHOICE_LABEL", "Multiple Choice"); $content->setVariable("MATRIX_LABEL", "Matrix"); $content->setVariable("GRADING_LABEL", "Benotung"); $content->setVariable("TENDENCY_LABEL", "Tendenz"); $content->setVariable("ARRANGEMENT_LABEL", "Anordnung in"); $content->setVariable("SCALE_LABEL", "Skala"); $content->setVariable("STEPS_LABEL", "Schritte"); $content->setVariable("POSSIBLEANSWERS_LABEL", "Antwortmöglichkeiten"); $content->setVariable("ADDOPTION_LABEL", "Weitere Option hinzufügen"); $content->setVariable("COLUMNS_LABEL", "Spalten"); $content->setVariable("COLUMNSLABEL_LABEL", "Spalten Label"); $content->setVariable("ROWSLABEL_LABEL", "Zeilen Label"); $content->setvariable("ELEMENTS_LABEL", "Elemente"); $content->setVariable("ADDROWS_LABEL", "Weitere Zeilen hinzufügen"); $content->setVariable("MANDATORY_LABEL", "Als Pflichtfrage definieren"); $content->setVariable("SAVE_LABEL", "Speichern"); $content->setVariable("CANCEL_LABEL", "Abbrechen"); $content->setVariable("ADDQUESTION_LABEL", "Neue Frage hinzufügen"); $content->setVariable("ADDLAYOUT_LABEL", "Layout-Element hinzufügen"); $content->setVariable("CREATE_SURVEY", "Umfrage erstellen"); $content->setVariable("BACK_LABEL", "Zurück"); $content->setVariable("BACK_URL", $RapidfeedbackExtension->getExtensionUrl() . "Index/" . $rapidfeedback->get_id()); // if command is called with an object id load the corresponding survey data if (isset($this->params[1])) { $survey = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->params[1]); $survey_object = new \Rapidfeedback\Model\Survey($rapidfeedback); $xml = \steam_factory::get_object_by_name($GLOBALS["STEAM"]->get_id(), $survey->get_path() . "/survey.xml"); $survey_object->parseXML($xml); $content->setVariable("TITLE_VALUE", $survey_object->getName()); $content->setVariable("BEGINTEXT_VALUE", $survey_object->getBeginText()); $content->setVariable("ENDTEXT_VALUE", $survey_object->getEndText()); $starttype = $survey->get_attribute("RAPIDFEEDBACK_STARTTYPE"); if (is_array($starttype)) { $content->setVariable("STARTTYPE_FIRST", ""); $content->setVariable("STARTTYPE_SECOND", "checked"); $content->setVariable("DISPLAY_DATEPICKER", ""); $content->setVariable("BEGIN_VALUE", date('d.m.Y', $starttype[1])); $content->setVariable("END_VALUE", date('d.m.Y', $starttype[0])); } $questions = $survey_object->getQuestions(); $question_html = ""; $id_counter = 0; $asseturl = $RapidfeedbackExtension->getAssetUrl() . "icons/"; for ($count = 0; $count < count($questions); $count++) { $question_html = $question_html . $questions[$count]->getEditHTML($id_counter); $id_counter++; } $content->setVariable("ELEMENT_COUNTER", $id_counter); $content->setVariable("QUESTIONS_HTML", $question_html); $content->setVariable("BACK_URL", $RapidfeedbackExtension->getExtensionUrl() . "Index/" . $rapidfeedback->get_id() . "/" . $survey->get_id()); $content->setVariable("CREATE_LABEL", "Umfrage bearbeiten"); $content->setVariable("CREATE_SURVEY", "Änderungen speichern"); $create_label = "Umfrage bearbeiten"; } $content->setVariable("ASSET_URL", $RapidfeedbackExtension->getAssetUrl() . "icons"); $content->parse("BLOCK_CREATE_SURVEY"); $group = $rapidfeedback->get_attribute("RAPIDFEEDBACK_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(); } $rawWidget = new \Widgets\RawHtml(); $rawWidget->setHtml($content->get()); $frameResponseObject->addWidget($rawWidget); $frameResponseObject->setHeadline(array(array("name" => $courseOrGroup, "link" => $courseOrGroupUrl), array("name" => "Rapid Feedback", "link" => $RapidfeedbackExtension->getExtensionUrl() . "Index/" . $rapidfeedback->get_id()), array("name" => $create_label))); 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(); $TCRExtension->addJS(); $content = $TCRExtension->loadTemplate("tcr_index.template.html"); $members = $TCR->get_attribute("TCR_USERS"); // determine which kind of elements is displayed (0 = theses, 1 = reviews, 2 = responses, 3 = all) if (isset($this->params[1])) { $kind = $this->params[1]; } else { $kind = 3; } // 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); // display tabbar $tabBar = new \Widgets\TabBar(); $tabBar->setTabs(array(array("name" => "Alle", "link" => $TCRExtension->getExtensionUrl() . "documents/" . $this->id), array("name" => "Thesen", "link" => $TCRExtension->getExtensionUrl() . "documents/" . $this->id . "/0"), array("name" => "Kritiken", "link" => $TCRExtension->getExtensionUrl() . "documents/" . $this->id . "/1"), array("name" => "Repliken", "link" => $TCRExtension->getExtensionUrl() . "documents/" . $this->id . "/2"))); if ($kind == 3) { $tabBar->setActiveTab(0); } else { $tabBar->setActiveTab($kind + 1); } $frameResponseObject->addWidget($tabBar); // create arrays for every round and add the theses to these arrays $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(); for ($count = 1; $count <= $rounds; $count++) { $theses[$count] = array(); } foreach ($theses_inventory as $thesis) { $critics = $thesis->get_attribute("TCR_REVIEWS"); if (count($critics) > 0 && in_array($thesis->get_creator()->get_id(), $members)) { $current_round = $thesis->get_attribute("TCR_ROUND"); array_push($theses[$current_round], $thesis); } } // display documents table $content = $TCRExtension->loadTemplate("tcr_documents.template.html"); $content->setCurrentBlock("BLOCK_DOCUMENTS_TABLE"); $content->setVariable("ROUND_LABEL", "Runde"); $content->setVariable("DOCUMENT_KIND_LABEL", "Art"); $content->setVariable("CONTENT_LABEL", "Inhalt"); $content->setVariable("AUTHOR_LABEL", "Autor(in)"); $content->setVariable("DATE_LABEL", "Veröffentlicht am"); $content->setVariable("COMMENTS_LABEL", "Kommentare"); for ($count = 1; $count <= $rounds; $count++) { $content->setCurrentBlock("BLOCK_DOCUMENTS_ROUND"); $content->setVariable("CURRENT_ROUND", $count . ". Runde"); $content->setVariable("CURRENT_ROUND_VALUE", $count); // display every thesis in the corresponding round foreach ($theses[$count] as $current_thesis) { if ($kind == 3 || $kind == 0) { $creator = $current_thesis->get_creator(); $date = $current_thesis->get_attribute("TCR_RELEASED"); $content->setCurrentBlock("BLOCK_DOCUMENTS_ELEMENT"); $content->setVariable("ASSETURL", $TCRExtension->getAssetUrl()); $content->setVariable("DOCUMENT_KIND", "These"); $content->setVariable("ELEMENT_URL", $TCRExtension->getExtensionUrl() . "release/" . $current_thesis->get_id()); $content->setVariable("VIEW_ELEMENT", "Inhalt anzeigen"); $content->setVariable("ASSETURL", $TCRExtension->getAssetUrl()); $content->setVariable("AUTHOR_VALUE", $creator->get_full_name() . " (" . $creator->get_name() . ")"); $content->setVariable("DATE_VALUE", date("d.m.Y H:i:s", $date)); if (count($current_thesis->get_annotations()) == 1) { $content->setVariable("COMMENTS_VALUE", "(1 Kommentar)"); } else { $content->setVariable("COMMENTS_VALUE", "(" . count($current_thesis->get_annotations()) . " Kommentare)"); } $content->setVariable("COMMENTS_URL", $TCRExtension->getExtensionUrl() . "release/" . $current_thesis->get_id()); $content->parse("BLOCK_DOCUMENTS_ELEMENT"); } $critics = $current_thesis->get_attribute("TCR_REVIEWS"); // display reviews to the thesis if there are any released ones foreach ($critics as $critic => $review) { if ($review != 0) { $review_object = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $review); $review_released = $review_object->get_attribute("TCR_RELEASED"); if ($review_released != 0 && in_array($critic, $members)) { if ($kind == 3 || $kind == 1) { $creator = $review_object->get_creator(); $date = $review_object->get_attribute("TCR_RELEASED"); $content->setCurrentBlock("BLOCK_DOCUMENTS_ELEMENT"); $content->setVariable("ASSETURL", $TCRExtension->getAssetUrl()); $content->setVariable("DOCUMENT_KIND", "Kritik"); $content->setVariable("ELEMENT_URL", $TCRExtension->getExtensionUrl() . "release/" . $review_object->get_id()); $content->setVariable("VIEW_ELEMENT", "Inhalt anzeigen"); $content->setVariable("ASSETURL", $TCRExtension->getAssetUrl()); $content->setVariable("AUTHOR_VALUE", $creator->get_full_name() . " (" . $creator->get_name() . ")"); $content->setVariable("DATE_VALUE", date("d.m.Y H:i:s", $date)); if (count($review_object->get_annotations()) == 1) { $content->setVariable("COMMENTS_VALUE", "(1 Kommentar)"); } else { $content->setVariable("COMMENTS_VALUE", "(" . count($review_object->get_annotations()) . " Kommentare)"); } $content->setVariable("COMMENTS_URL", $TCRExtension->getExtensionUrl() . "release/" . $review_object->get_id()); $content->parse("BLOCK_DOCUMENTS_ELEMENT"); } // display response if it exists and is released $response = $review_object->get_attribute("TCR_RESPONSE"); if ($response != 0) { $response_object = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $response); $response_released = $response_object->get_attribute("TCR_RELEASED"); if ($response_released != 0) { if ($kind == 3 || $kind == 2) { $creator = $response_object->get_creator(); $date = $response_object->get_attribute("TCR_RELEASED"); $content->setCurrentBlock("BLOCK_DOCUMENTS_ELEMENT"); $content->setVariable("ASSETURL", $TCRExtension->getAssetUrl()); $content->setVariable("DOCUMENT_KIND", "Replik"); $content->setVariable("ELEMENT_URL", $TCRExtension->getExtensionUrl() . "release/" . $response_object->get_id()); $content->setVariable("VIEW_ELEMENT", "Inhalt anzeigen"); $content->setVariable("ASSETURL", $TCRExtension->getAssetUrl()); $content->setVariable("AUTHOR_VALUE", $creator->get_full_name() . " (" . $creator->get_name() . ")"); $content->setVariable("DATE_VALUE", date("d.m.Y H:i:s", $date)); if (count($response_object->get_annotations()) == 1) { $content->setVariable("COMMENTS_VALUE", "(1 Kommentar)"); } else { $content->setVariable("COMMENTS_VALUE", "(" . count($response_object->get_annotations()) . " Kommentare)"); } $content->setVariable("COMMENTS_URL", $TCRExtension->getExtensionUrl() . "release/" . $response_object->get_id()); $content->parse("BLOCK_DOCUMENTS_ELEMENT"); } } } } } } } $content->parse("BLOCK_DOCUMENTS_ROUND"); } // display filter $content->setVariable("FILTER_LABEL", "Filter:"); $content->setCurrentBlock("BLOCK_DOCUMENTS_DROPDOWN"); $content->setVariable("OPTION_VALUE", 0); $content->setVariable("OPTION_NAME", "Alle Runden"); $content->setVariable("ROUNDS_VALUE", $rounds); $content->parse("BLOCK_DOCUMENTS_DROPDOWN"); for ($count = 1; $count <= $rounds; $count++) { $content->setCurrentBlock("BLOCK_DOCUMENTS_DROPDOWN"); $content->setVariable("OPTION_VALUE", $count); $content->setVariable("OPTION_NAME", $count . ". Runde"); $content->setVariable("ROUNDS_VALUE", $rounds); $content->parse("BLOCK_DOCUMENTS_DROPDOWN"); } $content->parse("BLOCK_DOCUMENTS_TABLE"); $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(); } $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/" . $TCR->get_id()), array("name" => "Alle Dokumente"))); return $frameResponseObject; }
public function frameResponse(\FrameResponseObject $frameResponseObject) { $user = $GLOBALS["STEAM"]->get_current_steam_user(); $pyramidRoom = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id); $pyramiddiscussionExtension = \Pyramiddiscussion::getInstance(); $pyramiddiscussionExtension->addCSS(); $basegroup = $pyramidRoom->get_attribute("PYRAMIDDISCUSSION_BASEGROUP"); $admingroup = $pyramidRoom->get_attribute("PYRAMIDDISCUSSION_ADMINGROUP"); $content = $pyramiddiscussionExtension->loadTemplate("pyramiddiscussion_users.template.html"); // if user is no admin display error msg if (!$admingroup->is_member($user)) { $rawWidget = new \Widgets\RawHtml(); $rawWidget->setHtml("Error: Kein Administrator"); $frameResponseObject->addWidget($rawWidget); return $frameResponseObject; } $members = $basegroup->get_members(); $admins = $admingroup->get_members(); foreach ($admins as $admin) { if (!$basegroup->is_member($admin)) { array_push($members, $admin); } } $maxcol = $pyramidRoom->get_attribute("PYRAMIDDISCUSSION_MAXCOL"); $maxstart = $pyramidRoom->get_attribute("PYRAMIDDISCUSSION_MAX"); $participants = $pyramidRoom->get_attribute("PYRAMIDDISCUSSION_PARTICIPANT_MANAGEMENT"); foreach ($members as $member) { if (!isset($participants[$member->get_id()])) { $participants[$member->get_id()] = 0; } } // save changes if form got submitted if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST["change_users"])) { $previousstartpositions_post = $_POST["previousstartposition"]; $startpositions_post = $_POST["startposition"]; $deactivate_post = $_POST["deactivate"]; if (isset($_POST["admin"])) { $admin_post = $_POST["admin"]; } else { $admin_post = array(); } $formeradmin_post = $_POST["formeradmin"]; for ($count = 0; $count < count($members); $count++) { if ($members[$count] instanceof \steam_user && $members[$count]->get_name() != "root") { // change startposition $currentUserID = $members[$count]->get_id(); if ($previousstartpositions_post[$currentUserID] == "") { $previousstartpositions_post[$currentUserID] = 0; } if ($previousstartpositions_post[$currentUserID] != $startpositions_post[$currentUserID]) { if ($previousstartpositions_post[$currentUserID] != 0) { $oldPosition = \steam_factory::get_object_by_name($GLOBALS["STEAM"]->get_id(), $pyramidRoom->get_path() . "/Position_1_" . $previousstartpositions_post[$currentUserID]); $oldPositionGroup = $oldPosition->get_attribute("PYRAMIDDISCUSSION_RELGROUP"); $oldPositionGroup->remove_member($members[$count]); $userGroupID = 0; } if ($startpositions_post[$currentUserID] != 0) { $newPosition = \steam_factory::get_object_by_name($GLOBALS["STEAM"]->get_id(), $pyramidRoom->get_path() . "/Position_1_" . $startpositions_post[$currentUserID]); $newPositionGroup = $newPosition->get_attribute("PYRAMIDDISCUSSION_RELGROUP"); $newPositionGroup->add_member($members[$count]); $userGroupID = $newPositionGroup->get_id(); } } else { if ($previousstartpositions_post[$currentUserID] != 0) { $userPosition = \steam_factory::get_object_by_name($GLOBALS["STEAM"]->get_id(), $pyramidRoom->get_path() . "/Position_1_" . $previousstartpositions_post[$currentUserID]); $helpGroup = $userPosition->get_attribute("PYRAMIDDISCUSSION_RELGROUP"); $userGroupID = $helpGroup->get_id(); } else { $userGroupID = 0; } } $participants[$currentUserID] = $deactivate_post[$currentUserID]; if (!isset($admin_post[$currentUserID])) { if ($formeradmin_post[$currentUserID] == "on" && $admingroup->is_admin($user)) { // take adminrights (and remove user from the discussion if basegroup = admingroup) if ($admingroup == $basegroup) { if ($userGroupID != 0) { $userGroup = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $userGroupID); $userGroup->remove_member($members[$count]); } $admingroup->remove_member($members[$count]); } else { $admingroup->remove_member($members[$count]); } if (!$basegroup->is_member($members[$count])) { unset($members[$count]); $members = array_values($members); } } } else { if ($formeradmin_post[$currentUserID] == "off") { // give adminrights $admingroup->add_member($members[$count]); } } } } $pyramidRoom->set_attribute("PYRAMIDDISCUSSION_PARTICIPANT_MANAGEMENT", $participants); $frameResponseObject->setConfirmText("Änderungen erfolgreich gespeichert."); } // save users of the startpositions to arrays $startpositions = array(); for ($count = 1; $count <= $maxstart; $count++) { $startpositions[$count] = array(); $position = \steam_factory::get_object_by_name($GLOBALS["STEAM"]->get_id(), $pyramidRoom->get_path() . "/Position_1_" . $count); $positionGroup = $position->get_attribute("PYRAMIDDISCUSSION_RELGROUP"); $positionMembers = $positionGroup->get_members(); for ($count2 = 0; $count2 < count($positionMembers); $count2++) { array_push($startpositions[$count], $positionMembers[$count2]->get_id()); } } // display users $content->setCurrentBlock("BLOCK_PYRAMID_USERS"); $content->setVariable("LOGIN_LABEL", "Login"); $content->setVariable("NAME_LABEL", "Name"); $content->setVariable("START_LABEL", "Startposition"); $content->setVariable("DEACTIVATE_LABEL", "Hat mitgemacht bis"); $content->setVariable("ADMIN_LABEL", "Admin"); for ($count = 0; $count < count($members); $count++) { if ($members[$count] instanceof \steam_user && $members[$count]->get_name() != "root") { $content->setCurrentBlock("BLOCK_PYRAMID_USERS_ELEMENT"); $content->setVariable("USER_LOGIN", $members[$count]->get_name()); $content->setVariable("USER_NAME", $members[$count]->get_full_name()); $content->setVariable("USER_ID", $members[$count]->get_id()); for ($count2 = 0; $count2 <= $maxstart; $count2++) { $content->setCurrentBlock("BLOCK_POSITION_OPTION"); $content->setVariable("POSITION_ID", $count2); if ($count2 == 0) { if ($maxstart >= 10) { $content->setVariable("POSITION_VALUE", "--"); } else { $content->setVariable("POSITION_VALUE", "-"); } } else { $content->setVariable("POSITION_VALUE", $count2); if (in_array($members[$count]->get_id(), $startpositions[$count2])) { $content->setVariable("POSITION_SELECTED", "selected"); $content->setVariable("PREVIOUSSTART_VALUE", $count2); } } $content->parse("BLOCK_POSITION_OPTION"); } for ($count2 = 0; $count2 <= $maxcol - 1; $count2++) { $content->setCurrentBlock("BLOCK_PHASE_OPTION"); $content->setVariable("PHASE_ID", $count2); if ($count2 == 0) { $content->setVariable("PHASE_VALUE", "Komplette Diskussion"); } else { $content->setVariable("PHASE_VALUE", $count2 . ". Diskussionsphase"); } if ($count2 == $participants[$members[$count]->get_id()]) { $content->setVariable("PHASE_SELECTED", "selected"); } $content->parse("BLOCK_PHASE_OPTION"); } if ($admingroup->is_member($members[$count])) { $content->setVariable("ADMIN_SELECTED", "checked"); $content->setVariable("FORMER_ADMIN", "on"); } else { $content->setVariable("FORMER_ADMIN", "off"); } if (!$admingroup->is_admin($user)) { $content->setVariable("ADMIN_DISABLED", "disabled"); } $content->parse("BLOCK_PYRAMID_USERS_ELEMENT"); } } $content->setVariable("SAVE_CHANGES", "Änderungen speichern"); $content->setVariable("BACK_LINK", $pyramiddiscussionExtension->getExtensionUrl() . "Index/" . $this->id); $content->setVariable("BACK_LABEL", "Zurück"); $content->parse("BLOCK_PYRAMID_USERS"); $rawWidget = new \Widgets\RawHtml(); $rawWidget->setHtml($content->get()); $frameResponseObject->addWidget($rawWidget); $frameResponseObject->setHeadline(array(array("name" => "Pyramidendiskussion", "link" => $pyramiddiscussionExtension->getExtensionUrl() . "Index/" . $this->id), array("name" => "Teilnehmerverwaltung"))); return $frameResponseObject; }
public function frameResponse(\FrameResponseObject $frameResponseObject) { $element = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id); $user = $GLOBALS["STEAM"]->get_current_steam_user(); $path = $element->get_path(); $path = substr($path, 0, strrpos($path, "/")); $type = substr($path, strrpos($path, "/") + 1, strlen($path)); $TCR = \steam_factory::get_object_by_name($GLOBALS["STEAM"]->get_id(), substr($path, 0, strrpos($path, "/"))); $TCRExtension = \TCR::getInstance(); $TCRExtension->addCSS(); $TCRExtension->addJS(); $content = $TCRExtension->loadTemplate("tcr_release.template.html"); $members = $TCR->get_attribute("TCR_USERS"); sort($members); $critics = $element->get_attribute("TCR_REVIEWS"); $group = $TCR->get_attribute("TCR_GROUP"); $private = 1; // determine where the user is coming from $referer = getenv("HTTP_REFERER"); if (strpos($referer, "Index") !== false) { $backurl = $TCRExtension->getExtensionUrl() . "Index/" . $TCR->get_id(); $referer = 1; } else { if (strpos($referer, "documents") !== false) { $backurl = $TCRExtension->getExtensionUrl() . "documents/" . $TCR->get_id(); $referer = 2; } else { if (strpos($referer, "privateDocuments") !== false) { $backurl = $TCRExtension->getExtensionUrl() . "privateDocuments/" . $TCR->get_id(); $referer = 3; } } } if ($_SERVER["REQUEST_METHOD"] == "POST") { // if a new comment was submitted if (isset($_POST["add_comment"])) { $new_comment = \steam_factory::create_textdoc($GLOBALS["STEAM"]->get_id(), $_POST["title"], stripslashes($_POST["content"])); $new_comment->set_read_access($group); $new_comment->set_write_access($group); $element->add_annotation($new_comment); } // if a comment edit got submitted if (isset($_POST["edit_comment"])) { $comment = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $_POST["edit_id"]); $comment->set_content($_POST["content"]); $comment->set_name($_POST["title"]); } // determine where the user is coming from $referer = $_POST["referer"]; if ($referer == 1) { $backurl = $TCRExtension->getExtensionUrl() . "Index/" . $TCR->get_id(); } else { if ($referer == 2) { $backurl = $TCRExtension->getExtensionUrl() . "documents/" . $TCR->get_id(); } else { if ($referer == 3) { $backurl = $TCRExtension->getExtensionUrl() . "privateDocuments/" . $TCR->get_id(); } } } } // display dialog $content->setCurrentBlock("BLOCK_RELEASE_ELEMENT"); if ($type == "theses") { if (is_array($critics) && count($critics) > 0) { // display already released thesis $release_label = "These anzeigen"; $content->setVariable("SHOW_CRITICS", "none"); $content->setVariable("SHOW_RELEASE", "none"); $private = 0; $released = 1; } else { // release dialog $release_label = "These veröffentlichen"; $released = 0; } $kind = 0; $kindWord = "These"; } else { if ($type == "reviews") { $released = $element->get_attribute("TCR_RELEASED"); if ($released != 0) { // display already released review $release_label = "Kritik anzeigen"; $content->setVariable("SHOW_RELEASE", "none"); $private = 0; } else { // release dialog $release_label = "Kritik veröffentlichen"; } $content->setVariable("SHOW_CRITICS", "none"); $kind = 1; $kindWord = "Kritik"; } else { $released = $element->get_attribute("TCR_RELEASED"); if ($released != 0) { // display already released response $release_label = "Replik anzeigen"; $content->setVariable("SHOW_RELEASE", "none"); $private = 0; } else { // release dialog $release_label = "Replik veröffentlichen"; } $content->setVariable("SHOW_CRITICS", "none"); $kind = 2; $kindWord = "Replik"; } } if ($released == 0 && $referer == 3) { $backurl = $TCRExtension->getExtensionUrl() . "privateDocuments/" . $TCR->get_id() . "/" . $kind; } $content->setVariable("SUBMIT_URL", $TCRExtension->getExtensionUrl() . "privateDocuments/" . $TCR->get_id() . "/" . $kind); $content->setVariable("RELEASE_LABEL", $release_label); $content->setVariable("TITLE_LABEL", "Titel"); $content->setVariable("TITLE_VALUE", $element->get_name()); $content->setVariable("DESC_LABEL", "Untertitel / Beschreibung"); $content->setVariable("DESC_VALUE", $element->get_attribute("OBJ_DESC")); $content->setVariable("AUTHOR_LABEL", "Autor"); $author = $element->get_creator(); $content->setVariable("AUTHOR_VALUE", $author->get_full_name() . " (" . $author->get_name() . ")"); $content->setVariable("CONTENT_LABEL", "Inhalt"); if ($element->get_attribute("DOC_MIME_TYPE") == "text/plain") { // if element is plain text display content directly $content->setVariable("DISPLAY_DOWNLOAD", "none"); $content->setVariable("CONTENT_VALUE", nl2br($element->get_content())); } else { // if element is of another mime type display download dialog $content->setVariable("DISPLAY_TEXT", "none"); $content->setVariable("ASSET_URL", $TCRExtension->getAssetUrl()); $content->setVariable("DOWNLOAD_URL", PATH_URL . "download/Document/" . $this->id); $content->setVariable("DOWNLOAD_TITLE", "Datei herunterladen"); } // display select critic dialog $content->setVariable("CRITICS_LABEL", "Kritiker(in)"); $radioSelect = 0; foreach ($members as $memberID) { $member = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $memberID); $content->setCurrentBlock("BLOCK_CRITIC"); $content->setVariable("CRITIC_ID", $member->get_id()); $content->setVariable("CRITIC_NAME", $member->get_full_name()); if ($radioSelect == 0) { $content->setVariable("CRITIC_CHECKED", "checked"); $radioSelect++; } $content->parse("BLOCK_CRITIC"); } $content->setVariable("RELEASE_WARNING", "Wenn Sie die " . $kindWord . " veröffentlichen, können Sie sie nicht mehr ändern oder löschen."); $content->setVariable("SUBMIT_RELEASE", "Veröffentlichen"); $content->setVariable("BACK_LABEL", "Zurück"); $content->setVariable("BACK_URL", $backurl); $content->setVariable("KIND_VALUE", $kind); $content->setVariable("ID_VALUE", $this->id); $content->parse("BLOCK_RELEASE_ELEMENT"); // display comments if ($released != 0) { $comments = $element->get_annotations(); usort($comments, "sortRepliesByDate"); $content->setCurrentBlock("BLOCK_TCR_COMMENTS"); $content->setVariable("COMMENTS_LABEL", "Kommentare"); if (count($comments) == 0) { $content->setCurrentBlock("BLOCK_NO_COMMENTS"); $content->setVariable("NO_COMMENTS", "Es sind noch keine Kommentare zu diesem Dokument vorhanden."); $content->parse("BLOCK_NO_COMMENTS"); } else { for ($count = 0; $count < count($comments); $count++) { $author = $comments[$count]->get_creator(); $content->setCurrentBlock("BLOCK_COMMENT"); $content->setVariable("COMMENT_CONTENT", nl2br($comments[$count]->get_content())); $content->setVariable("COMMENT_CONTENT_NOBR", $comments[$count]->get_content()); $content->setVariable("COMMENT_TITLE", $comments[$count]->get_name()); $content->setVariable("COMMENT_ID", $comments[$count]->get_id()); $content->setVariable("ASSET", $TCRExtension->getAssetUrl()); $content->setVariable("EDIT_COMMENT", "Kommentar bearbeiten"); // if user is not the author and admin options are not shown dont display edit button if ($author->get_id() != $user->get_id()) { $content->setVariable("SHOW_COMMENT_EDIT", "none"); } $content->setVariable("COMMENT_AUTHOR", "von " . $author->get_name() . " (" . $author->get_full_name() . ")"); $content->setVariable("COMMENT_DATE", "am " . date("d.m.Y H:i", (int) $comments[$count]->get_attribute("OBJ_CREATION_TIME"))); $content->parse("BLOCK_COMMENT"); } } $content->parse("BLOCK_TCR_COMMENTS"); $content->setCurrentBlock("BLOCK_CREATE_COMMENT"); $content->setVariable("CREATE_COMMENT", "Kommentar hinzufügen"); $content->setVariable("BACKURL_LABEL", "Zurück"); $content->setVariable("BACKURL", $backurl); $content->setVariable("TITLE_LABEL_COMMENT", "Titel:"); $content->setVariable("CONTENT_LABEL_COMMENT", "Kommentar:"); $content->setVariable("BACK_LABEL_COMMENT", "Abbrechen"); $content->setVariable("EDIT_COMMENT", "Kommentar bearbeiten"); $content->setVariable("EDIT_COMMENT_SUBMIT", "Änderungen speichern"); $content->setVariable("REFERER_VALUE", $referer); $content->parse("BLOCK_CREATE_COMMENT"); } else { $content->setVariable("DISPLAY_COMMENTS", "none"); } 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(); } $rawWidget = new \Widgets\RawHtml(); $rawWidget->setHtml($content->get()); $frameResponseObject->addWidget($rawWidget); if ($private == 1) { $frameResponseObject->setHeadline(array(array("name" => $courseOrGroup, "link" => $courseOrGroupUrl), array("name" => "Thesen-Kritik-Replik-Verfahren", "link" => $TCRExtension->getExtensionUrl() . "Index/" . $TCR->get_id()), array("name" => "Private Dokumente", "link" => $TCRExtension->getExtensionUrl() . "privateDocuments/" . $TCR->get_id()), array("name" => $release_label))); } else { $frameResponseObject->setHeadline(array(array("name" => $courseOrGroup, "link" => $courseOrGroupUrl), array("name" => "Thesen-Kritik-Replik-Verfahren", "link" => $TCRExtension->getExtensionUrl() . "Index/" . $TCR->get_id()), array("name" => $release_label))); } return $frameResponseObject; }
private function loadHtmlTemplate() { $htmlTemplateName = $this->plistXML->RWTemplateHTML; $htmlTemplateObject = \steam_factory::get_object_by_name($GLOBALS["STEAM"]->get_id(), $this->object->get_path() . "/" . $htmlTemplateName); $this->setHtmlTemplate($htmlTemplateObject->get_content()); }
public function frameResponse(\FrameResponseObject $frameResponseObject) { $rapidfeedback = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id); $RapidfeedbackExtension = \Rapidfeedback::getInstance(); $RapidfeedbackExtension->addCSS(); // TODO: import funktion if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST["import_survey"])) { echo $_POST["id"]; $bidowl_container = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $_POST["id"]); if (!$bidowl_container instanceof \steam_container || $bidowl_container->get_attribute("bid:doctype") != "questionary") { // error } else { $name = $bidowl_container->get_name(); /* $description = $bidowl_container->get_attribute("bid:questionary:description"); $fillout = $bidowl_container->get_attribute("bid:questionary:fillout"); // wie oft kann ein benutzer fragebogen ausfüllen; 1 oder n $editanswer = $bidowl_container->get_attribute("bid:questionary:editanswer"); // können autoren antworten später bearbeiten $editownanswer = $bidowl_container->get_attribute("bid:questionary:editownanswer"); // kann der benutzer selbst seine antworten bearbeiten $numbering = $bidowl_container->get_attribute("bid:questionary:number"); // fragen des fragebogens nummerieren $resultcreationtime = $bidowl_container->get_attribute("bid:questionary:resultcreationtime"); // creationtime in auswertung anzeigen $resultcreator = $bidowl_container->get_attribute("bid:questionary:resultcreator"); // creator in auswertung anzeigen $enabled = $bidowl_container->get_attribute("bid:questionary:enabled"); $layout = $bidowl_container->get_attribute("bid:questionary:layout"); $analyst_rights = $bidowl_container->get_attribute("bid:questionary:analyst_rights");; $editor_rights = $bidowl_container->get_attribute("bid:questionary:editor_rights");; $author_rights = $bidowl_container->get_attribute("bid:questionary:author_rights");; */ // TODO: einstellungen am container setzen $survey_object = new \Rapidfeedback\Model\Survey($rapidfeedback); $survey_object->setName($name); $survey_object->setBeginText(""); $survey_object->setEndText(""); // TODO: fragen hinzufügen $question_container = \steam_factory::get_object_by_name($GLOBALS["STEAM"]->get_id(), $bidowl_container->get_path() . "/questions"); $questions = $question_container->get_inventory(); // TODO: evtl. erst noch sortieren foreach ($questions as $question) { $isQuestion = false; $question_geometry = $question->get_attribute("bid:question:geometry"); switch ($question_geometry["type"]) { case 0: // description break; case 1: // empty line break; case 2: // checkbox $newquestion = new \Rapidfeedback\Model\MultipleChoiceQuestion(); foreach ($question_geometry["options"] as $option) { $newquestion->addOption($option); } $newquestion->setArrangement($question_geometry["columns"]); $isQuestion = true; break; case 3: // input file break; case 4: // radio $newquestion = new \Rapidfeedback\Model\SingleChoiceQuestion(); foreach ($question_geometry["options"] as $option) { $newquestion->addOption($option); } $newquestion->setArrangement($question_geometry["columns"]); $isQuestion = true; break; case 5: // select $newquestion = new \Rapidfeedback\Model\SingleChoiceQuestion(); foreach ($question_geometry["options"] as $option) { $newquestion->addOption($option); } $isQuestion = true; break; case 6: // caption break; case 7: // text $newquestion = new \Rapidfeedback\Model\TextQuestion(); $isQuestion = true; break; case 8: // textarea $newquestion = new \Rapidfeedback\Model\TextareaQuestion(); $isQuestion = true; break; case 9: // new page break; case 10: // full line break; case 11: // grading $newquestion = new \Rapidfeedback\Model\GradingQuestion(); foreach ($question_geometry["grading_options"] as $option) { $newquestion->addRow($option); } $question_geometry["question"] = $question_geometry["description"]; $isQuestion = true; break; case 12: // tendency $newquestion = new \Rapidfeedback\Model\TendencyQuestion(); foreach ($question_geometry["tendency_elements"] as $option) { $newquestion->addOption($option); } $question_geometry["question"] = $question_geometry["description"]; $newquestion->setSteps($question_geometry["tendency_steps"]); $isQuestion = true; break; } // TODO: bug: bearbeiten single choice geöffnet --> auf neue frage erstellen klicken --> antwortmöglichkeiten // TODO: evtl weitere attribute if ($isQuestion) { $newquestion->setQuestionText($question_geometry["question"]); $newquestion->setHelpText(""); $newquestion->setRequired($question_geometry["must"]); $survey_object->addQuestion($newquestion); } } // TODO: einstellungen am container setzen $survey_container = $survey_object->createSurvey(); $edittime = $bidowl_container->get_attribute("bid:questionary:edittime"); if ($edittime[0]) { $times = array(); array_push($times, $edittime[2]); array_push($times, $edittime[1]); $survey_container->set_attribute("RAPIDFEEDBACK_STARTTYPE", $times); } } } $content = $RapidfeedbackExtension->loadTemplate("rapidfeedback_import.template.html"); $content->setCurrentBlock("BLOCK_IMPORT_DIALOG"); $content->setVariable("RAPIDFEEDBACK_IMPORT", "Fragebogen importieren"); $content->setVariable("ID_LABEL", "Objekt ID:*"); $content->setVariable("IMPORT_SURVEY", "Fragebogen importieren"); $content->setVariable("BACK_URL", $RapidfeedbackExtension->getExtensionUrl() . "Index/" . $rapidfeedback->get_id()); $content->setVariable("BACK_LABEL", "Zurück"); $content->parse("BLOCK_IMPORT_DIALOG"); $group = $rapidfeedback->get_attribute("RAPIDFEEDBACK_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(); } $rawWidget = new \Widgets\RawHtml(); $rawWidget->setHtml($content->get()); $frameResponseObject->addWidget($rawWidget); $frameResponseObject->setHeadline(array(array("name" => $courseOrGroup, "link" => $courseOrGroupUrl), array("name" => "Rapid Feedback", "link" => $RapidfeedbackExtension->getExtensionUrl() . "Index/" . $rapidfeedback->get_id()), array("name" => "Import"))); return $frameResponseObject; }
public function run($path = null) { $html_footer_code = ""; $html_navbar_code = ""; $html_navbar_full_code = ""; $html_sidebar_code = ""; $html_integratedfeed_code = ""; $html_breadcrumb_code = ""; $html_search_code = ""; $html_header_code = ""; $html_content_code = ""; $html_login_info_code = ""; $html_htmlheader_code = ""; $html_navbar_prev_url = ""; $html_navbar_next_url = ""; $html_navbar_main_parent_url = ""; $html_navbar_main_parent_title = ""; $html_navbar_main_parent_number = ""; $wave_style = $this->determineStyle(); if (!isset($_SESSION[WAVE_PATH_INTERN]["web_root"])) { $_SESSION[WAVE_PATH_INTERN]["web_root"] = \steam_factory::get_object_by_name($GLOBALS["STEAM"]->get_id(), WAVE_PATH_INTERN); } $web_root = $_SESSION[WAVE_PATH_INTERN]["web_root"]; if ($path) { $akt_page = \steam_factory::get_object_by_name($GLOBALS["STEAM"]->get_id(), WAVE_PATH_INTERN . $path); } else { $akt_page = $web_root; $path = "/"; } if (!$akt_page || !$akt_page instanceof \steam_container) { unset($_SESSION[WAVE_PATH_INTERN]["web_root"]); throw new \Exception("WAVE Extension not configured."); } return $akt_page->get_name(); /* if ($akt_page !== 0 && $akt_page instanceof steam_container) { //TODO: move to control helper $control_file = $akt_page->get_object_by_name("control.xml"); if ($control_file !== 0 && $control_file instanceof steam_document) { $xml = simplexml_load_string($control_file->get_content()); if ($xml->steamweb_type == "REDIRECT") { $redirectControl = new RedirectControl(); $redirectControl->getHtml($xml); } } } if ( isset($_GET["mode"]) && $_GET["mode"] == "download") { $akt_page = steam_factory::get_object( $steam_connector, (int)$_GET[ "id" ], CLASS_DOCUMENT); $path = "/download_" . $_GET[ "id" ]; // use special path for id calls } if ($akt_page === 0) { $file_found = FALSE; $akt_page = $web_root; } else { $file_found = TRUE; } $access_read = $akt_page->check_access_read($steam_connector->get_login_user()); if ( isset($_GET["output"]) && $_GET["output"] == "rss" ) { include( MODULE_PATH . "common/rss.control.php"); } if ( ($akt_page->get_type() & CLASS_DOCUMENT) === CLASS_DOCUMENT ) { $is_document = TRUE; } else $is_document = FALSE; if ($access_read) { $mimetype= $akt_page->get_attribute(DOC_MIME_TYPE); $textpos = strstr((string)$mimetype, "text"); } $do_login = (((isset($_GET["page"]) && $_GET["page"] == "login") || !$access_read)?TRUE:FALSE); if (!$do_login && $file_found && $is_document && ( ($mimetype !== 0 && (strlen($textpos) == 0)) || $path == "robots.txt" || $mimetype == "text/css") && $mimetype != "source/pike" ) { $download_object = $akt_page; include( MODULE_PATH . "helper/get.php"); } else { $html_portalseite = new IntegratedTemplate(); $index_template = TEMPLATE_PATH . "index." . STYLE_NAME .".template.html"; if (!file_exists($index_template)) { $steam_doc = steam_factory::path_to_object( $steam_connector, STEAMWEB_PATH_INTERN . "/style/" . STYLE_NAME . "/index.template.html"); if ($steam_doc === 0) { echo "Can't find index.template.html."; die; } else { $myFile = TEMP_PATH . "index." . STYLE_NAME .".template.html"; $fh = fopen($myFile, 'w') or die("can't open temp file"); fwrite($fh, $steam_doc->get_content()); fclose($fh); $index_template = $myFile; } } $html_portalseite->loadTemplateFile( $index_template ); include( MODULE_PATH . "common/global_infos.control.php"); try { if ($do_login) include( MODULE_PATH . "common/login.control.php"); else if (!$file_found) include( MODULE_PATH . "common/notfound.control.php"); else include( MODULE_PATH . "common/content.control.php"); } catch(Exception $ex) { $html_content_code = "<h1>Error</h1>An error occured during website creation."; } if (!$ajaxcall && $access_read) { include( MODULE_PATH . "common/breadcrumb.control.php"); include( MODULE_PATH . 'common/search.control.php' ); include( MODULE_PATH . "common/login_info.control.php"); include( MODULE_PATH . "common/navbar.control.php"); include( MODULE_PATH . "common/footer.control.php"); if (!ENABLE_UPB_MODE) include( MODULE_PATH . "common/sidebar.control.php"); include( MODULE_PATH . "common/integratedfeed.control.php"); if ( !ENABLE_UPB_MODE && (!(isset($_GET["mode"]) && $_GET["mode"]=="edit") || $do_login) ) include( MODULE_PATH . "common/header.control.php"); } if (isset($_SESSION[STEAMWEB_PATH_INTERN][ "userdata" ][ "OBJ_NAME" ]) && $_SESSION[STEAMWEB_PATH_INTERN][ "userdata" ][ "OBJ_NAME" ] != "guest" && $_SESSION[STEAMWEB_PATH_INTERN][ "admin" ]) { $html_footer_code .= ", Serverzugriffe: " . ($steam_connector->get_request_count() - $requestcount_old); if (function_exists('memory_get_peak_usage')) { $html_footer_code .= ", Speicherverbrauch: " . number_format(memory_get_peak_usage()); } } if (ENABLE_UPB_MODE && $upb_title_html !==0) $site_title = $upb_title_html; else $site_title = strip_tags($_SESSION[STEAMWEB_PATH_INTERN][ "SITE_TITLE" ]); // variable page is set and valid $html_portalseite->setVariable(array( "STYLE_PATH" => STYLE_PATH, "SITE_TITLE" => $site_title, "SITE_HEADER" => $_SESSION[STEAMWEB_PATH_INTERN][ "SITE_TITLE" ], "SITE_SLOGAN" => $_SESSION[STEAMWEB_PATH_INTERN][ "SITE_SLOGAN" ], "FOOTER" => $html_footer_code, "NAVBAR" => $html_navbar_code, "NAVBAR_FULL" => $html_navbar_full_code, "NAVBAR_PREV_URL" => $html_navbar_prev_url, "NAVBAR_NEXT_URL" => $html_navbar_next_url, "NAVBAR_MAIN_PARENT_URL" => $html_navbar_main_parent_url, "NAVBAR_MAIN_PARENT_TITLE" => $html_navbar_main_parent_title, "NAVBAR_MAIN_PARENT_NUMBER" => $html_navbar_main_parent_number, "PAGE_TITLE" => $html_pagetitle, "PAGE_NUMBER" => $html_pagenumber, "SIDEBAR" => $html_sidebar_code, "PLUGIN_SIDEBAR" => $html_integratedfeed_code, "BREADCRUMB" => $html_breadcrumb_code, 'SEARCH' => $html_search_code, "CONTENT" => $html_header_code . $html_content_code, "LOGO" => "<img src=" . LOGO_PATH. " />", "LOGIN" => $html_login_info_code, "HEADER" => $html_htmlheader_code, "DUMMY" => "" )); $loginInfoAjaxControl = new LoginInfoAjaxControl(); $html_portalseite->setVariable("LOGIN_INFO_AJAX", $loginInfoAjaxControl->getHtml()); if ($ajaxcall || $type == "rss") { $siteoutput = $content; } else { $siteoutput = $html_portalseite->get(); $ssp = new ssp(); $siteoutput = $ssp->parse_content($siteoutput); } if (!$ajaxcall && $type != "rss") { ini_set('zlib.output_compression_level', 5); // Start output buffering ob_start('ob_gzhandler'); $mylastm = time(); $mlast_modified = substr(date('r', $mylastm), 0, -5).'GMT'; $metag = '"'.md5($mlast_modified).'"'; header('Cache-Control: private'); header('Cache-Control: must-revalidate'); header("Last-Modified: $mlast_modified"); header("ETag: $metag"); } echo($siteoutput); if (USE_CACHE && !$ajaxcall) { if ($steam_connector->get_login_user()->get_name() == "guest" && !$do_login) { cache_debug( "index: Saving cache file for path=" . $path . " style=".STYLE_NAME . " type=" . $type); $timestampcache->save($mylastm, $path, STYLE_NAME . $type . "_timestamp"); $cachedata = array(); $cachedata["siteoutput"] = $siteoutput; if (!$file_found) $cachedata["notfound"] = "true"; $cache->save($cachedata, $path, STYLE_NAME . $type); } else { cache_debug( "index: Removing cache file(s) for path=" . $path); if (is_array($_SESSION[STEAMWEB_PATH_INTERN][ "styles" ])) { foreach( $_SESSION[STEAMWEB_PATH_INTERN][ "styles" ] as $stylename) { $timestampcache->remove($path, $stylename . $type . "_timestamp"); $cache->remove($path, $stylename . $type); $timestampcache->remove($path, $stylename . "rss" . "_timestamp"); $cache->remove($path, $stylename . "rss"); } } else { $timestampcache->remove($path, STYLE_NAME . $type . "_timestamp"); $cache->remove($path, STYLE_NAME . $type); $timestampcache->remove($path, STYLE_NAME . "rss" . "_timestamp"); $cache->remove($path, STYLE_NAME . "rss"); } } } } $steam_connector->disconnect(); } }*/ }
<?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);
function revealPath($savedPath, $currentPath = "") { //path is an absolute path if (strtolower(substr($savedPath, 0, 4)) == "http") { return $savedPath; } if (strtolower(substr($savedPath, 0, 3)) == "www") { return "http://" . $savedPath; } if (strtolower(substr($savedPath, 0, 7)) == "mailto:") { return $savedPath; } //case relative path in portal-portlet $constructedPath1 = $currentPath . "/../../../" . $savedPath; //redirect from a portlet $steamObject = \steam_factory::get_object_by_name($GLOBALS["STEAM"]->get_id(), trim($constructedPath1)); if (gettype($steamObject) == "object") { $objectId = $steamObject->get_id(); $newUrl = PATH_URL . "explorer/Index/" . $objectId . "/"; return $newUrl; } //case relative path 5 $constructedPath2 = $currentPath . "/../../../../" . $savedPath; //redirect from a portlet $steamObject = \steam_factory::get_object_by_name($GLOBALS["STEAM"]->get_id(), trim($constructedPath2)); if (gettype($steamObject) == "object") { $objectId = $steamObject->get_id(); $newUrl = PATH_URL . "explorer/Index/" . $objectId . "/"; return $newUrl; } //case relative path 2 $constructedPath2 = $currentPath . "/../../" . $savedPath; //redirect from a portlet $steamObject = \steam_factory::get_object_by_name($GLOBALS["STEAM"]->get_id(), trim($constructedPath2)); if (gettype($steamObject) == "object") { $objectId = $steamObject->get_id(); $newUrl = PATH_URL . "explorer/Index/" . $objectId . "/"; return $newUrl; } //case relative path 3 $constructedPath2 = $currentPath . "/../" . $savedPath; //redirect from a portlet $steamObject = \steam_factory::get_object_by_name($GLOBALS["STEAM"]->get_id(), trim($constructedPath2)); if (gettype($steamObject) == "object") { $objectId = $steamObject->get_id(); $newUrl = PATH_URL . "explorer/Index/" . $objectId . "/"; return $newUrl; } //case relative path 4 $constructedPath2 = $currentPath . "/" . $savedPath; //redirect from a portlet $steamObject = \steam_factory::get_object_by_name($GLOBALS["STEAM"]->get_id(), trim($constructedPath2)); if (gettype($steamObject) == "object") { $objectId = $steamObject->get_id(); $newUrl = PATH_URL . "explorer/Index/" . $objectId . "/"; return $newUrl; } return $savedPath; //return not modified }
$content->setVariable("ELEARNING_COURSE_CONTENT", $html); } else { $html .= "Zugriff auf ungültiges Kapitel"; $content->setVariable("ELEARNING_COURSE_CONTENT", $html); } } else { if ($action == "media") { $c = $elearning_course->get_chapter_by_id($chapter); $m = $c->get_media_by_id($media); $m->download(); exit; } else { if ($action == "scripts") { //error_log("c"); //error_log("Called Script : " . $elearning_course->get_internal_path() . $scripts); $sd = steam_factory::get_object_by_name($GLOBALS["STEAM"]->get_id(), $elearning_course->get_internal_path() . $scripts); if ($sd instanceof steam_document) { //echo $sd->download(); $download_url = "/download/" . $sd->get_id() . "/" . $sd->get_name(); header("Location: " . $download_url); exit; } } else { //ERROR } } } } } $html_handler->set_html_left($content->get()); $headline = $html_handler->get_headline();
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 getContent() { $contentObject = \steam_factory::get_object_by_name($GLOBALS["STEAM"]->get_id(), $this->object->get_path() . "/start.html"); if (isset($contentObject) && $contentObject instanceof \steam_document) { // $encoding = $contentObject->get_attribute(DOC_ENCODING); // if ($encoding === 0) { // if (mb_detect_encoding($contentObject) == "UTF-8") { // echo "found utf-8"; // $encoding = "utf-8"; // $contentObject->set_attribute(DOC_ENCODING, $encoding); // } else { // echo "found " . mb_detect_encoding($contentObject); // } // } return $contentObject->get_content(); } else { return "Content object is missing!"; } }
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; }