Beispiel #1
0
 public function frameResponse(\FrameResponseObject $frameResponseObject)
 {
     $rawWidget = $this->displayWorkplans();
     $frameResponseObject->setTitle("Projektplanverwaltung");
     $frameResponseObject->setHeadline("Projektplanverwaltung");
     $frameResponseObject->addWidget($rawWidget);
     return $frameResponseObject;
 }
Beispiel #2
0
    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;
    }
Beispiel #3
0
 public function getHtmlForObjectId(\FrameResponseObject $frameResponseObject)
 {
     $mplme = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id);
     if (isset($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() == "web_table.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);
     }
     $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;
 }
Beispiel #4
0
 public function execute(\FrameResponseObject $frameResponseObject)
 {
     //CODE FOR ALL COMMANDS OF THIS PAKAGE END
     $user = \lms_steam::get_current_user();
     // Disable caching
     // TODO: Work on cache handling. An enabled cache leads to bugs
     // if used with the wiki.
     \CacheSettings::disable_caching();
     if (!($wiki_container = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id))) {
         include "bad_link.php";
         exit;
     }
     if (!$wiki_container instanceof \steam_container) {
         $wiki_doc = $wiki_container;
         $wiki_container = $wiki_doc->get_environment();
         if ($wiki_doc->get_attribute(DOC_MIME_TYPE) != "text/wiki") {
             include "bad_link.php";
             exit;
         }
     }
     //CODE FOR ALL COMMANDS OF THIS PAKAGE END
     $compare = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->params[1]);
     $to = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->params[2]);
     $wiki_html_handler = new \lms_wiki($wiki_container);
     //$wiki_html_handler->set_admin_menu( "versions", $wiki_doc );
     $content = \Wiki::getInstance()->loadTemplate("wiki_version_compare.template.html");
     //$content = new HTML_TEMPLATE_IT();
     //$content->loadTemplateFile( PATH_TEMPLATES . "wiki_version_compare.template.html" );
     $difftext = wiki_diff_html($to, $compare);
     $content->setVariable("DIFF_TEXT", $difftext);
     $wiki_html_handler->set_main_html($content->get());
     $rootlink = \lms_steam::get_link_to_root($wiki_container);
     WIKI_FULL_HEADLINE ? $headline = array($rootlink[0], $rootlink[1], array("link" => $rootlink[1]["link"] . "communication/", "name" => gettext("Communication")), array("name" => h($wiki_container->get_name()), "link" => PATH_URL . "wiki/index/" . $wiki_container->get_id() . "/"), array("link" => PATH_URL . "wiki/viewentry/" . $wiki_doc->get_id() . "/", "name" => str_replace(".wiki", "", h($wiki_doc->get_name()))), array("link" => PATH_URL . "wiki/versionoverview/" . $wiki_doc->get_id(), "name" => gettext("Version management")), array("link" => "", "name" => gettext("Version compare") . " (" . $compare->get_version() . " " . gettext("to") . " " . $to->get_version() . ")")) : ($headline = array(array("name" => h($wiki_container->get_name()), "link" => PATH_URL . "wiki/index/" . $wiki_container->get_id() . "/"), array("link" => PATH_URL . "wiki/viewentry/" . $wiki_doc->get_id() . "/", "name" => str_replace(".wiki", "", h($wiki_doc->get_name()))), array("link" => PATH_URL . "wiki/versionoverview/" . $wiki_doc->get_id() . "/versions/", "name" => gettext("Version management")), array("link" => "", "name" => gettext("Version compare") . " (" . $compare->get_version() . " " . gettext("to") . " " . $to->get_version() . ")")));
     /*$portal->set_page_main(
     		$headline,
     		$wiki_html_handler->get_html()
     		);
     		$portal->show_html();
     		*/
     $frameResponseObject->setHeadline($headline);
     $widget = new \Widgets\RawHtml();
     $widget->setHtml($wiki_html_handler->get_html());
     $frameResponseObject->addWidget($widget);
     return $frameResponseObject;
 }
Beispiel #5
0
 public function frameResponse(\FrameResponseObject $frameResponseObject)
 {
     if (isset($this->id)) {
         $object = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id);
         if ($object instanceof \steam_exit) {
             $object = $object->get_exit();
             $this->id = $object->get_id();
         }
     } else {
         $object = \School\Model\FolderSchoolBookmark::getSchoolBookmarkFolderObject();
         $this->id = $object->get_id();
     }
     if ($object && $object instanceof \steam_container) {
         $objects = $object->get_inventory();
     } else {
         $objects = array();
     }
     $this->getExtension()->addJS();
     $breadcrumb = new \Widgets\Breadcrumb();
     $breadcrumb->setData(array(array("name" => "Schul-Lesezeichenordner")));
     $actionBar = new \Widgets\ActionBar();
     $actionBar->setActions(array(array("name" => "Neues Lesezeichen", "link" => "#"), array("name" => "Ordner anlegen", "link" => "#")));
     //	$actionBar->setActions(array(array("name"=>"Neues Lesezeichen", "ajax"=>array("onclick"=>array("command"=>"newBookmark", "params"=>array("id"=>$this->id), "requestType"=>"popup"))), array("name"=>"Ordner anlegen", "ajax"=>array("onclick"=>array("command"=>"createFolder", "params"=>array("id"=>$this->id), "requestType"=>"popup")))));
     //$actionBar->setActions(array(array("name"=>"Neu", "ajax"=>array("onclick"=>array("command"=>"newelement"))), array("name"=>"Eigenschaften", "link"=>PATH_URL."explorer/properties/"), array("name"=>"Rechte", "link"=>PATH_URL."explorer/rights/")));
     $loader = new \Widgets\Loader();
     $loader->setWrapperId("schoolBookmarksWrapper");
     $loader->setMessage("Lade meine Schule...");
     $loader->setCommand("loadSchoolBookmarks");
     $loader->setParams(array("id" => $this->id));
     $loader->setElementId("schoolBookmarksWrapper");
     $loader->setType("updater");
     $frameResponseObject->setTitle("Meine Schule");
     $frameResponseObject->setHeadline(array(array("name" => "DIESE SEITE FUNTIONIERT NACH DEM NÄCHSTEN UPDATE.")));
     $frameResponseObject->addWidget($actionBar);
     $frameResponseObject->addWidget($breadcrumb);
     $frameResponseObject->addWidget($loader);
     return $frameResponseObject;
 }
Beispiel #6
0
 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->addCSS();
     $content = $RapidfeedbackExtension->loadTemplate("rapidfeedback_configuration.template.html");
     $content->setCurrentBlock("BLOCK_CONFIGURATION_TABLE");
     $content->setVariable("RAPIDFEEDBACK_OPTIONS", "Konfiguration");
     $content->setVariable("TITLE_LABEL", "Titel:*");
     $content->setVariable("TITLE_VALUE", $rapidfeedback->get_name());
     $content->setVariable("DESC_LABEL", "Beschreibung:");
     if ($rapidfeedback->get_attribute("OBJ_DESC") != "0") {
         $content->setVariable("DESC_VALUE", $rapidfeedback->get_attribute("OBJ_DESC"));
     }
     $content->setVariable("ADMINSURVEY_LABEL", "Administratoren können auch an den Umfragen teilnehmen");
     if ($rapidfeedback->get_attribute("RAPIDFEEDBACK_ADMIN_SURVEY") == 1) {
         $content->setVariable("ADMINSURVEY_CHECKED", "checked");
     }
     $content->setVariable("BACK_LABEL", "Zurück");
     $content->setVariable("BACK_URL", $RapidfeedbackExtension->getExtensionUrl() . "Index/" . $this->id);
     $content->setVariable("EDIT_RAPIDFEEDBACK", "Änderungen speichern");
     $content->parse("BLOCK_CONFIGURATION_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", "link" => $RapidfeedbackExtension->getExtensionUrl() . "Index/" . $this->id), array("name" => "Konfiguration")));
     return $frameResponseObject;
 }
Beispiel #7
0
 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();
     // mail form got submitted
     if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST["send_mail"])) {
         $basegroup = $pyramidRoom->get_attribute("PYRAMIDDISCUSSION_BASEGROUP");
         $admingroup = $pyramidRoom->get_attribute("PYRAMIDDISCUSSION_ADMINGROUP");
         if ($admingroup->is_member($user)) {
             $title = "Rundmail zur Pyramidendiskussion: " . $pyramidRoom->get_name();
             $content = nl2br($_POST["content"]);
             if ($basegroup->get_id() != $admingroup->get_id()) {
                 $basegroup->mail($title, $content);
                 $admingroup->mail($title, $content);
             } else {
                 $basegroup->mail($title, $content);
             }
             $frameResponseObject->setConfirmText("Rundmail erfolgreich gesendet.");
         }
     }
     $content = $pyramiddiscussionExtension->loadTemplate("pyramiddiscussion_mail.template.html");
     $content->setCurrentBlock("BLOCK_PYRAMID_MAIL");
     $content->setVariable("PYRAMID_MAIL", "Rundmail erstellen");
     $content->setVariable("CONTENT_LABEL", "Inhalt:");
     $content->setVariable("SEND_MAIL", "Rundmail senden");
     $content->setVariable("BACK_LABEL", "Zurück");
     $content->setVariable("BACK_URL", $pyramiddiscussionExtension->getExtensionUrl() . "Index/" . $this->id);
     $content->parse("BLOCK_PYRAMID_MAIL");
     $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" => "Rundmail erstellen")));
     return $frameResponseObject;
 }
Beispiel #8
0
 public function frameResponse(\FrameResponseObject $frameResponseObject)
 {
     $workplanExtension = \Workplan::getInstance();
     $workplanExtension->addJS();
     $content = $workplanExtension->loadTemplate("workplan_create.template.html");
     $content->setCurrentBlock("BLOCK_INFO");
     $content->setVariable("INFO_TEXT", "Sie sind dabei einen neuen Projektplan zu erstellen.");
     $content->parse("BLOCK_INFO");
     $content->setCurrentBlock("BLOCK_CREATE_FORMULAR");
     $content->setVariable("NAME_LABEL", "Projektname:*");
     $content->setVariable("START_DATE_LABEL", "Beginn:*");
     $content->setVariable("END_DATE_LABEL", "Ende:");
     $content->setVariable("DESCRIPTION_LABEL", "Beschreibung:");
     $content->setVariable("CREATE_WORKPLAN_LABEL", "Projektplan erstellen");
     $content->setVariable("LABEL_BACK", "Zurück");
     $content->setVariable("WORKPLAN_LINK_BACK", $this->getExtension()->getExtensionUrl());
     $content->parse("BLOCK_CREATE_FORMULAR");
     $rawWidget = new \Widgets\RawHtml();
     $rawWidget->setHtml($content->get());
     $frameResponseObject->setTitle("Projektplan erstellen");
     $frameResponseObject->setHeadline(array(array("link" => $this->getExtension()->getExtensionUrl(), "name" => "Projektplanverwaltung"), array("", "name" => "Neuer Projektplan")));
     $frameResponseObject->addWidget($rawWidget);
     return $frameResponseObject;
 }
Beispiel #9
0
 public function frameResponse(\FrameResponseObject $frameResponseObject)
 {
     $workplanExtension = \Workplan::getInstance();
     $workplanExtension->addJS();
     $workplanExtension->addJS($fileName = 'jsgantt.js');
     $workplanExtension->addCSS($fileName = 'jsgantt.css');
     $user = $GLOBALS["STEAM"]->get_current_steam_user();
     $portal = \lms_portal::get_instance();
     $objectID = $this->params[0];
     $workplanContainer = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $objectID);
     $xmlfile = $workplanContainer->get_inventory_filtered(array(array("+", "class", CLASS_DOCUMENT)));
     $createContainer = 0;
     // check if user submitted create milestone or create task form
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         if (isset($_POST["new_milestone"])) {
             $createContainer = 1;
         } else {
             if (isset($_POST["new_task"])) {
                 $createContainer = 2;
             }
         }
     }
     // create new milestone or task
     if ($createContainer != 0) {
         $xmltree = new \SimpleXMLElement($xmlfile[0]->get_content());
         if ($createContainer == 1) {
             $xml = $xmltree->addChild("milestone");
             $newName = $_POST["milestonename"];
             $newStart = $_POST["milestonedate"];
             $newStart = mktime(0, 0, 0, substr($newStart, 3, 2), substr($newStart, 0, 2), substr($newStart, 6, 4));
             $newEnd = $_POST["milestonedate"];
             $newEnd = mktime(0, 0, 0, substr($newEnd, 3, 2), substr($newEnd, 0, 2), substr($newEnd, 6, 4));
             if (strlen($_POST["milestoneduration"]) > 0) {
                 $newDuration = $_POST["milestoneduration"];
             } else {
                 $newDuration = -1;
             }
             if (strlen($_POST["milestonedepends"]) > 0) {
                 $newDepends = $_POST["milestonedepends"];
             } else {
                 $newDepends = -1;
             }
             $newUsers = "";
             if (isset($_POST["milestoneusers"])) {
                 for ($count = 0; $count < count($_POST["milestoneusers"]); $count++) {
                     $newUsers = $newUsers . $_POST["milestoneusers"][$count] . ",";
                 }
                 $newUsers = substr($newUsers, 0, strlen($newUsers) - 1);
             }
             $portal->set_confirmation("Meilenstein " . $newName . " wurde erfolgreich erstellt.");
         } else {
             $xml = $xmltree->addChild("task");
             $newName = $_POST["taskname"];
             $newStart = $_POST["taskstart"];
             $newStart = mktime(0, 0, 0, substr($newStart, 3, 2), substr($newStart, 0, 2), substr($newStart, 6, 4));
             $newEnd = $_POST["taskend"];
             $newEnd = mktime(0, 0, 0, substr($newEnd, 3, 2), substr($newEnd, 0, 2), substr($newEnd, 6, 4));
             if (strlen($_POST["taskduration"]) > 0) {
                 $newDuration = $_POST["taskduration"];
             } else {
                 $newDuration = -1;
             }
             if (strlen($_POST["taskdepends"]) > 0) {
                 $newDepends = $_POST["taskdepends"];
             } else {
                 $newDepends = -1;
             }
             $newUsers = "";
             if (isset($_POST["taskusers"])) {
                 for ($count = 0; $count < count($_POST["taskusers"]); $count++) {
                     $newUsers = $newUsers . $_POST["taskusers"][$count] . ",";
                 }
                 $newUsers = substr($newUsers, 0, strlen($newUsers) - 1);
             }
             $portal->set_confirmation("Vorgang " . $newName . " wurde erfolgreich erstellt.");
         }
         $newContainer = \steam_factory::create_container($GLOBALS["STEAM"]->get_id(), $newName, $workplanContainer);
         $xml->addChild("name", $newName);
         $xml->addChild("oid", $newContainer->get_id());
         $newContainer->set_attribute("WORKPLAN_START", $newStart);
         $xml->addChild("start", $newStart);
         $newContainer->set_attribute("WORKPLAN_END", $newEnd);
         $xml->addChild("end", $newEnd);
         $xml->addChild("duration", $newDuration);
         $newContainer->set_attribute("WORKPLAN_DURATION", $newDuration);
         $xml->addChild("depends", $newDepends);
         $newContainer->set_attribute("WORKPLAN_DEPENDS", $newDepends);
         $newContainer->set_attribute("WORKPLAN_USERS", $newUsers);
         $xml->addChild("users", $newUsers);
         $xmlfile[0]->set_content($xmltree->saveXML());
     }
     if (is_object($workplanContainer) && $workplanContainer instanceof \steam_room) {
         // if user has the required rights display actionbar
         if ($user->get_id() == $workplanContainer->get_creator()->get_id() || in_array("WORKPLAN_" . $user->get_id() . "_LEADER", $workplanContainer->get_attribute_names())) {
             $content = $workplanExtension->loadTemplate("workplan_ganttview.template.html");
             $content->setCurrentBlock("BLOCK_CONFIRMATION");
             $content->setVariable("CONFIRMATION_TEXT", "NONE");
             $content->parse("BLOCK_CONFIRMATION");
             $content->setCurrentBlock("BLOCK_WORKPLAN_GANTT_ACTIONBAR");
             $content->setVariable("LABEL_NEW_SNAPSHOT", "Snapshot erstellen");
             $content->setVariable("WORKPLAN_ID", $objectID);
             $content->setVariable("LABEL_NEW_MILESTONE", "Neuer Meilenstein");
             $content->setVariable("LABEL_NEW_TASK", "Neuer Vorgang");
             $content->parse("BLOCK_WORKPLAN_GANTT_ACTIONBAR");
             $actionBar = new \Widgets\RawHtml();
             $actionBar->setHtml($content->get());
             $frameResponseObject->addWidget($actionBar);
         }
         $tabBar = new \Widgets\TabBar();
         $tabBar->setTabs(array(array("name" => "Überblick", "link" => $this->getExtension()->getExtensionUrl() . "overview/" . $objectID), array("name" => "Tabelle", "link" => $this->getExtension()->getExtensionUrl() . "listView/" . $objectID), array("name" => "Gantt-Diagramm", "link" => $this->getExtension()->getExtensionUrl() . "ganttView/" . $objectID), array("name" => "Mitarbeiter", "link" => $this->getExtension()->getExtensionUrl() . "users/" . $objectID), array("name" => "Snapshots", "link" => $this->getExtension()->getExtensionUrl() . "snapshots/" . $objectID)));
         $tabBar->setActiveTab(2);
         $frameResponseObject->addWidget($tabBar);
         $xml = simplexml_load_string($xmlfile[0]->get_content());
         $helpToArray = $xml->children();
         $list = array();
         for ($counter = 0; $counter < count($helpToArray); $counter++) {
             array_push($list, $helpToArray[$counter]);
         }
         usort($list, 'sort_xmllist');
         $content = $workplanExtension->loadTemplate("workplan_ganttview.template.html");
         if (count($list) == 0) {
             $content->setCurrentBlock("BLOCK_WORKPLAN_GANTT_EMPTY");
             $content->setVariable("WORKPLAN_GANTT_EMPTY", "Keine Meilensteine oder Vorgänge zu diesem Projektplan vorhanden.");
             $content->parse("BLOCK_WORKPLAN_GANTT_EMPTY");
         }
         // change the format of the information so it can be displayed via javascript/jsgantt
         $oids = "[";
         $tasks = "[";
         $starts = "[";
         $ends = "[";
         $dependslist = "[";
         $milestones = "[";
         for ($counter = 0; $counter < count($list); $counter++) {
             $name = $list[$counter]->name;
             $tasks = $tasks . $name . ",";
             $starts = $starts . (int) $list[$counter]->start . ",";
             $ends = $ends . (int) $list[$counter]->end . ",";
             $oids = $oids . $list[$counter]->oid . ",";
             $depends = $list[$counter]->depends;
             if ($depends == -1) {
                 $dependslist = $dependslist . "-1,";
             } else {
                 $dependslist = $dependslist . $depends . ",";
             }
             if ($list[$counter]->getName() == "milestone") {
                 $milestones = $milestones . "1,";
             } else {
                 $milestones = $milestones . "0,";
             }
         }
         if (count($list) > 0) {
             $oids = substr($oids, 0, strlen($oids) - 1) . "]";
             $tasks = substr($tasks, 0, strlen($tasks) - 1) . "]";
             $starts = substr($starts, 0, strlen($starts) - 1) . "]";
             $ends = substr($ends, 0, strlen($ends) - 1) . "]";
             $dependslist = substr($dependslist, 0, strlen($dependslist) - 1) . "]";
             $milestones = substr($milestones, 0, strlen($milestones) - 1) . "]";
         } else {
             $oids = $oids . "]";
             $tasks = $tasks . "]";
             $starts = $starts . "]";
             $ends = $ends . "]";
             $dependslist = $dependslist . "]";
             $milestones = $milestones . "]";
         }
         $content->setCurrentBlock("BLOCK_GANTT_CHART");
         $content->setVariable("GANTT_DIV", "ganttchartdiv");
         $content->setVariable("WORKPLAN_GANTT_TASKS", $tasks);
         $content->setVariable("WORKPLAN_GANTT_OID", $oids);
         $content->setVariable("WORKPLAN_GANTT_MILESTONE", $milestones);
         $content->setVariable("WORKPLAN_GANTT_DEPENDS", $dependslist);
         $content->setVariable("WORKPLAN_GANTT_START", $starts);
         $content->setVariable("WORKPLAN_GANTT_END", $ends);
         $content->parse("BLOCK_GANTT_CHART");
         $content->setCurrentBlock("BLOCK_WORKPLAN_LIST_FORMULAR");
         $content->setVariable("LABEL_NEW_MILESTONE", "Meilenstein hinzufügen");
         $content->setVariable("LABEL_NEW_TASK", "Vorgang hinzufügen");
         $content->setVariable("NAME_LABEL", "Name:*");
         $content->setVariable("START_LABEL", "Beginn:*");
         $content->setVariable("END_LABEL", "Ende:*");
         $content->setVariable("DATE_LABEL", "Datum:*");
         $content->setVariable("DURATION_LABEL", "Dauer:");
         $content->setVariable("DEPENDS_LABEL", "Abhängigkeit:");
         $content->setVariable("USERS_LABEL", "Mitarbeiter:");
         $groupID = 0;
         if (in_array("WORKPLAN_GROUP", $workplanContainer->get_attribute_names())) {
             $groupID = $workplanContainer->get_attribute("WORKPLAN_GROUP");
         }
         if ($groupID == 0) {
             $content->setCurrentBlock("BEGIN BLOCK_USER_OPTION_MILESTONE");
             $content->setVariable("USER_ID", $user->get_id());
             $content->setVariable("USER_NAME", $user->get_full_name());
             $content->parse("BLOCK_USER_OPTION_MILESTONE");
             $content->setCurrentBlock("BEGIN BLOCK_USER_OPTION_TASK");
             $content->setVariable("USER_ID", $user->get_id());
             $content->setVariable("USER_NAME", $user->get_full_name());
             if (in_array("WORKPLAN_" . $user->get_id() . "_RESSOURCE", $workplanContainer->get_attribute_names())) {
                 $content->setVariable("USER_RESSOURCE", $workplanContainer->get_attribute("WORKPLAN_" . $user->get_id() . "_RESSOURCE"));
             } else {
                 $content->setVariable("USER_RESSOURCE", 0);
             }
             $content->parse("BLOCK_USER_OPTION_TASK");
         } else {
             $groupObject = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $groupID);
             $members = $groupObject->get_members();
             for ($count = 0; $count < count($members); $count++) {
                 $currentMember = $members[$count];
                 $content->setCurrentBlock("BEGIN BLOCK_USER_OPTION_MILESTONE");
                 $content->setVariable("USER_ID", $currentMember->get_id());
                 $content->setVariable("USER_NAME", $currentMember->get_full_name());
                 $content->parse("BLOCK_USER_OPTION_MILESTONE");
                 $content->setCurrentBlock("BEGIN BLOCK_USER_OPTION_TASK");
                 $content->setVariable("USER_ID", $currentMember->get_id());
                 $content->setVariable("USER_NAME", $currentMember->get_full_name());
                 if (in_array("WORKPLAN_" . $currentMember->get_id() . "_RESSOURCE", $workplanContainer->get_attribute_names())) {
                     $content->setVariable("USER_RESSOURCE", $workplanContainer->get_attribute("WORKPLAN_" . $currentMember->get_id() . "_RESSOURCE"));
                 } else {
                     $content->setVariable("USER_RESSOURCE", 0);
                 }
                 $content->parse("BLOCK_USER_OPTION_TASK");
             }
         }
         $content->setCurrentBlock("BLOCK_LIST_MILESTONE_DEPENDS");
         $content->setVariable("DEPENDS_OID", "-1");
         $content->setVariable("DEPENDS_NAME", "Keine Abhängigkeit");
         $content->parse("BLOCK_LIST_MILESTONE_DEPENDS");
         $content->setCurrentBlock("BLOCK_LIST_TASK_DEPENDS");
         $content->setVariable("DEPENDS_OID", "-1");
         $content->setVariable("DEPENDS_NAME", "Keine Abhängigkeit");
         $content->parse("BLOCK_LIST_TASK_DEPENDS");
         for ($count = 0; $count < count($list); $count++) {
             if ($list[$count]->getName() == 'task') {
                 $content->setCurrentBlock("BLOCK_LIST_MILESTONE_DEPENDS");
                 $content->setVariable("DEPENDS_OID", $list[$count]->oid);
                 $content->setVariable("DEPENDS_NAME", $list[$count]->name);
                 $content->parse("BLOCK_LIST_MILESTONE_DEPENDS");
                 $content->setCurrentBlock("BLOCK_LIST_TASK_DEPENDS");
                 $content->setVariable("DEPENDS_OID", $list[$count]->oid);
                 $content->setVariable("DEPENDS_NAME", $list[$count]->name);
                 $content->parse("BLOCK_LIST_TASK_DEPENDS");
             }
         }
         $content->setVariable("LABEL_BACK", "Ausblenden");
         $content->setVariable("LABEL_ADD", "Hinzufügen");
         $content->setVariable("WORKPLAN_ID", $this->params[0]);
         $content->parse("BLOCK_WORKPLAN_LIST_FORMULAR");
         $rawWidget = new \Widgets\RawHtml();
         $rawWidget->setHtml($content->get());
         $frameResponseObject->setTitle("Projektplan: " . $workplanContainer->get_name());
         $frameResponseObject->setHeadline(array(array("link" => $this->getExtension()->getExtensionUrl(), "name" => "Projektplanverwaltung"), array("", "name" => $workplanContainer->get_name())));
         $frameResponseObject->addWidget($rawWidget);
         return $frameResponseObject;
     }
 }
Beispiel #10
0
 public function execute(\FrameResponseObject $frameResponseObject)
 {
     $user = \lms_steam::get_current_user();
     $cache = get_cache_function($user->get_name(), 86400);
     $user_profile = $cache->call("lms_steam::user_get_profile", $user->get_name());
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         $values = $_POST["values"];
         foreach ($values as $i => $val) {
             $values[$i] = htmlspecialchars($val);
         }
         if (!empty($values["USER_PROFILE_WEBSITE_URI"]) && substr($values["USER_PROFILE_WEBSITE_URI"], 0, 7) != "http://") {
             $values["USER_PROFILE_WEBSITE_URI"] = "http://" . $values["USER_PROFILE_WEBSITE_URI"];
         }
         $user->set_attributes($values);
         if (!empty($values["USER_PROFILE_FACULTY"])) {
             $old_fac_id = $user_profile["USER_PROFILE_FACULTY"];
             $new_fac_id = $values["USER_PROFILE_FACULTY"];
             if ($new_fac_id != $old_fac_id) {
                 if ($old_fac_id > 0) {
                     $old_faculty = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $old_fac_id, CLASS_GROUP);
                     $old_faculty->remove_member($user);
                 }
                 if ($new_fac_id > 0) {
                     $new_faculty = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $new_fac_id, CLASS_GROUP);
                     $new_faculty->add_member($user);
                 }
             }
         }
         /*
         			 require_once( "Cache/Lite.php" );
         			 $cache = new Cache_Lite( array( "cacheDir" => PATH_CACHE ) );
         			 $cache->clean( $user->get_name() );
         			 $cache->clean( $user->get_id() );*/
         if (!empty($values["USER_LANGUAGE"])) {
             //var_dump($values["USER_LANGUAGE"]);die;
             $lang_index = \language_support::get_language_index();
             \language_support::choose_language($lang_index[$values["USER_LANGUAGE"]]);
         }
         $cache = get_cache_function(\lms_steam::get_current_user()->get_name());
         $cache->drop("lms_portal::get_menu_html", \lms_steam::get_current_user()->get_name(), TRUE);
         $cache = get_cache_function($user->get_name());
         $cache->drop("lms_steam::user_get_profile", $user->get_name());
         $_SESSION["confirmation"] = gettext("Your profile data has been saved.");
         header("Location: " . PATH_URL . "profile/edit");
     }
     $content = \Profile::getInstance()->loadTemplate("profile_edit.template.html");
     //$content = new \HTML_TEMPLATE_IT();
     //$content->loadTemplateFile( PATH_TEMPLATES . "profile_edit.template.html" );
     if (PLATFORM_ID == "bid") {
         $content->setVariable("LABEL_INFO", "Hier können Sie Ihre persönlichen Kontaktdaten einrichten. Bis auf Ihren Namen sind alle Angaben freiwillig und können von Ihnen geändert werden. Klicken Sie auf den Button <b><i>Profil-Privatsphäre</i></b> um festzulegen, wem welche Informationen angezeigt werden sollen.");
     } else {
         $content->setVariable("LABEL_INFO", gettext("Please complete your profile. None of the fields are mandatory. Some of the fields can not be changed due to central identity management at the IMT.<br/><b>Note: With the button <i>Profile Privacy</i> you can control which information can be seen by other users.</b>"));
     }
     if (ENABLED_PROFILE_TITLE) {
         $content->setVariable("LABEL_PROFILE", gettext("General Information"));
     }
     $content->setVariable("LABEL_LOOKING", gettext("Your buddy icon"));
     $content->setVariable("LABEL_MAIL_PREFS", gettext("Your mail preferences"));
     $content->setVariable("LABEL_PROFILE_PRIVACY", gettext("Profile Privacy"));
     $content->setVariable("LINK_BUDDY_ICON", PATH_URL . "profile/image");
     $content->setVariable("LINK_MAIL_PREFS", PATH_URL . "messages_prefs.php");
     $content->setVariable("LINK_PROFILE_PRIVACY", PATH_URL . "profile/privacy");
     if (ENABLED_FIRST_NAME) {
         $content->setVariable("LABEL_FIRST_NAME", gettext("First name"));
     }
     if (ENABLED_FULL_NAME) {
         $content->setVariable("LABEL_LAST_NAME", gettext("Last name"));
     }
     if (ENABLED_DEGREE) {
         $content->setVariable("LABEL_TITLE", gettext("Academic title"));
         $content->setVariable("LABEL_DEGREE", gettext("Academic degree"));
         $content->setVariable("LABEL_IF_AVAILABLE", gettext("only if available"));
         $academicTitle = (string) $user_profile["USER_ACADEMIC_TITLE"];
         switch ($academicTitle) {
             case "Dr.":
                 $content->setVariable("TITLE_DR_SELECTED", 'selected="selected"');
                 break;
             case "PD Dr.":
                 $content->setVariable("TITLE_PRIVDOZDR_SELECTED", 'selected="selected"');
                 break;
             case "Prof.":
                 $content->setVariable("TITLE_PROF_SELECTED", 'selected="selected"');
                 break;
             case "Prof. Dr.":
                 $content->setVariable("TITLE_PROFDR_SELECTED", 'selected="selected"');
                 break;
             default:
                 $content->setVariable("TITLE_NULL_SELECTED", 'selected="selected"');
                 break;
         }
         $content->setVariable("VALUE_ACADEMIC_DEGREE", $this->safe_string($user_profile["USER_ACADEMIC_DEGREE"]));
     }
     if (ENABLED_BID_DESCIPTION) {
         $content->setVariable("LABEL_STATUS_BID", gettext("Description"));
     }
     if (ENABLED_STATUS) {
         $content->setVariable("LABEL_STATUS", gettext("Status"));
     }
     if (ENABLED_GENDER) {
         $content->setVariable("LABEL_GENDER", gettext("Gender"));
         $content->setVariable("LABEL_FEMALE", gettext("female"));
         $content->setVariable("LABEL_MALE", gettext("male"));
         $content->setVariable("LABEL_NOT_SAY", gettext("rather not say"));
     }
     if (ENABLED_FACULTY) {
         $content->setVariable("LABEL_FACULTY", gettext("Origin"));
     }
     if (ENABLED_MAIN_FOCUS) {
         $content->setVariable("LABEL_MAIN_FOCUS", gettext("Main focus"));
     }
     if (ENABLED_HOMETOWN) {
         $content->setVariable("LABEL_HOMETOWN", gettext("Hometown"));
     }
     if (ENABLED_WANTS) {
         $content->setVariable("LABEL_WANTS", gettext("Wants"));
     }
     if (ENABLED_HAVES) {
         $content->setVariable("LABEL_HAVES", gettext("Haves"));
     }
     if (ENABLED_OTHER_INTERESTS) {
         $content->setVariable("LABEL_OTHER_INTERESTS", gettext("Other interests"));
     }
     if (ENABLED_ORGANIZATIONS) {
         $content->setVariable("LABEL_ORGANIZATIONS", gettext("Organizations"));
     }
     if (ENABLED_USER_DESC) {
         $content->setVariable("LABEL_DESCRIBE_YOURSELF", gettext("Describe yourself"));
     }
     if (ENABLED_CONTACTS_TITLE) {
         $content->setVariable("LABEL_CONTACT_DATA", gettext("Contact Data"));
     }
     if (ENABLED_EMAIL) {
         $content->setVariable("LABEL_EMAIL", gettext("E-mail"));
         $content->setVariable("LABEL_EMAIL_PREFERENCES", gettext("Looking for your e-mail preferences?"));
         //$content->setVariable( "LINK_EMAIL_PREFERENCES", PATH_URL . "messages_prefs.php" );
     }
     if (ENABLED_TELEPHONE) {
         //$content->setVariable( "LABEL_TELEPHONE", gettext( "Phone" ) );
         $content->setVariable("LABEL_TELEPHONE", "Telefon");
     }
     $content->setVariable("LABEL_MOBILE", gettext("Phone, mobile"));
     if (ENABLED_ADDRESS) {
         $content->setVariable("LABEL_ADDRESS", gettext("Address"));
     }
     if (ENABLED_PHONE_MOBILE) {
         $content->setVariable("LABEL_PHONE_MOBILE", gettext("Phone, mobile"));
     }
     if (ENABLED_WEBSITE) {
         $content->setVariable("LABEL_WEBSITE", gettext("Website"));
         $content->setVariable("LABEL_WEBSITE_NAME", gettext("Website name"));
     }
     //TODO: IM-Speichern dementsprechend anpassen
     if (ENABLED_ICQ_NUMBER || ENABLED_BID_IM) {
         $content->setVariable("LABEL_ICQ_NUMBER", gettext("ICQ number"));
     }
     if (ENABLED_MSN_IDENTIFICATION || ENABLED_BID_IM) {
         $content->setVariable("LABEL_MSN_IDENTIFICATION", gettext("MSN identification"));
     }
     if (ENABLED_AIM_ALIAS || ENABLED_BID_IM) {
         $content->setVariable("LABEL_AIM_ALIAS", gettext("AIM-alias"));
     }
     if (ENABLED_YAHOO_ID || ENABLED_BID_IM) {
         $content->setVariable("LABEL_YAHOO_ID", gettext("Yahoo-ID"));
     }
     if (ENABLED_SKYPE_NAME || ENABLED_BID_IM) {
         $content->setVariable("LABEL_SKYPE_NAME", gettext("Skype name"));
     }
     $content->setVariable("INFO_INCLUDE_HTTP", gettext("Please include the 'http://'"));
     $content->setVariable("LABEL_SAVE_IT", gettext("Save changes"));
     $content->setVariable("BACK_LINK", PATH_URL . "profile/index/" . $user->get_name() . "/");
     $content->setVariable("LABEL_GOTO_HOMEPAGE", "<a href=\"" . PATH_URL . "profile/index/" . $user->get_name() . "/\">" . gettext("back") . "</a>");
     if (ENABLED_USER_DESC) {
         $content->setVariable("LABEL_BB_BOLD", gettext("B"));
         $content->setVariable("HINT_BB_BOLD", gettext("boldface"));
         $content->setVariable("LABEL_BB_ITALIC", gettext("I"));
         $content->setVariable("HINT_BB_ITALIC", gettext("italic"));
         $content->setVariable("LABEL_BB_UNDERLINE", gettext("U"));
         $content->setVariable("HINT_BB_UNDERLINE", gettext("underline"));
         $content->setVariable("LABEL_BB_STRIKETHROUGH", gettext("S"));
         $content->setVariable("HINT_BB_STRIKETHROUGH", gettext("strikethrough"));
         $content->setVariable("LABEL_BB_IMAGE", gettext("IMG"));
         $content->setVariable("HINT_BB_IMAGE", gettext("image"));
         $content->setVariable("LABEL_BB_URL", gettext("URL"));
         $content->setVariable("HINT_BB_URL", gettext("web link"));
         $content->setVariable("LABEL_BB_MAIL", gettext("MAIL"));
         $content->setVariable("HINT_BB_MAIL", gettext("email link"));
     }
     // PROFILE VALUES
     if (ENABLED_FIRST_NAME) {
         $content->setVariable("VALUE_USER_FIRSTNAME", $this->safe_string($user_profile["USER_FIRSTNAME"]));
     }
     if (ENABLED_FULL_NAME) {
         $content->setVariable("VALUE_USER_FULLNAME", $this->safe_string($user_profile["USER_FULLNAME"]));
     }
     /*
      *  Assure translations for statuses are available via gettext
      */
     //var_dump($user_profile);die;
     gettext("student");
     gettext("staff member");
     gettext("guest");
     gettext("alumni");
     if (ENABLED_BID_DESCIPTION) {
         $content->setVariable("VALUE_STATUS_BID", $this->safe_string($user_profile["OBJ_DESC"]));
     }
     if (ENABLED_STATUS) {
         $stati = array("student", "staff member", "guest", "alumni");
         foreach ($stati as $status) {
             $content->setCurrentBlock("BLOCK_STATUS");
             $content->setVariable("VALUE_STATUS", $status);
             if ($status === $user_profile["OBJ_DESC"]) {
                 $content->setVariable("STATUS_SELECTED", 'selected="selected"');
             }
             $content->setVariable("VALUE_STATUS_TRANSLATED", secure_gettext($status));
             $content->parse("BLOCK_STATUS");
         }
     }
     //TODO: TEMPLATE EDITIEREN
     if (ENABLED_GENDER) {
         $content->setVariable("GENDER_" . $this->safe_string($user_profile["USER_PROFILE_GENDER"], "X") . "_CHECKED", 'checked="checked"');
     }
     $cache = get_cache_function("ORGANIZATION", 86400);
     if (ENABLED_FACULTY) {
         $faculties = $cache->call("lms_steam::get_faculties_asc");
         $content->setVariable("LABEL_MISCELLANEOUS", gettext("miscellaneous"));
         foreach ($faculties as $faculty) {
             $content->setCurrentBlock("BLOCK_FACULTY");
             $content->setVariable("FACULTY_ID", $faculty["OBJ_ID"]);
             if ($user_profile["USER_PROFILE_FACULTY"] == $faculty["OBJ_ID"]) {
                 $content->setVariable("FACULTY_SELECTED", 'selected="selected"');
             }
             $content->setVariable("FACULTY_NAME", $faculty["OBJ_NAME"]);
             $content->parse("BLOCK_FACULTY");
         }
     }
     if (ENABLED_MAIN_FOCUS) {
         $content->setVariable("VALUE_FOCUS", $this->safe_string($user_profile["USER_PROFILE_FOCUS"]));
     }
     if (ENABLED_HOMETOWN) {
         $content->setVariable("VALUE_HOMETOWN", $this->safe_string($user_profile["USER_PROFILE_HOMETOWN"]));
     }
     if (ENABLED_WANTS) {
         $content->setVariable("VALUE_WANTS", $this->safe_string($user_profile["USER_PROFILE_WANTS"]));
     }
     if (ENABLED_HAVES) {
         $content->setVariable("VALUE_HAVES", $this->safe_string($user_profile["USER_PROFILE_HAVES"]));
     }
     if (ENABLED_OTHER_INTERESTS) {
         $content->setVariable("VALUE_OTHER_INTERESTS", $this->safe_string($user_profile["USER_PROFILE_OTHER_INTERESTS"]));
     }
     if (ENABLED_ORGANIZATIONS) {
         $content->setVariable("VALUE_ORGANIZATIONS", $this->safe_string($user_profile["USER_PROFILE_ORGANIZATIONS"]));
     }
     if (ENABLED_USER_DESC) {
         $content->setVariable("VALUE_USER_PROFILE_DSC", $this->safe_string($user_profile["USER_PROFILE_DSC"]));
     }
     if (ENABLED_EMAIL) {
         $content->setVariable("VALUE_EMAIL", $this->safe_string($user_profile["USER_EMAIL"]));
     }
     if (ENABLED_ADDRESS) {
         $content->setVariable("VALUE_ADDRESS", $this->safe_string($user_profile["USER_PROFILE_ADDRESS"]));
     }
     if (ENABLED_TELEPHONE) {
         $content->setVariable("VALUE_TELEPHONE", $this->safe_string($user_profile["USER_PROFILE_TELEPHONE"]));
     }
     if (ENABLED_PHONE_MOBILE) {
         $content->setVariable("VALUE_PHONE_MOBILE", $this->safe_string($user_profile["USER_PROFILE_PHONE_MOBILE"]));
     }
     if (ENABLED_WEBSITE) {
         $content->setVariable("VALUE_WEBSITE", $this->safe_string($user_profile["USER_PROFILE_WEBSITE_URI"]));
         $content->setVariable("VALUE_WEBSITE_NAME", $this->safe_string($user_profile["USER_PROFILE_WEBSITE_NAME"]));
     }
     if (ENABLED_ICQ_NUMBER || ENABLED_BID_IM) {
         $content->setVariable("VALUE_IM_ICQ", $this->safe_string($user_profile["USER_PROFILE_IM_ICQ"]));
     }
     if (ENABLED_SKYPE_NAME || ENABLED_BID_IM) {
         $content->setVariable("VALUE_IM_SKYPE", $this->safe_string($user_profile["USER_PROFILE_IM_SKYPE"]));
     }
     if (ENABLED_AIM_ALIAS || ENABLED_BID_IM) {
         $content->setVariable("VALUE_IM_AIM", $this->safe_string($user_profile["USER_PROFILE_IM_AIM"]));
     }
     if (ENABLED_MSN_IDENTIFICATION || ENABLED_BID_IM) {
         $content->setVariable("VALUE_IM_MSN", $this->safe_string($user_profile["USER_PROFILE_IM_MSN"]));
     }
     if (ENABLED_YAHOO_ID || ENABLED_BID_IM) {
         $content->setVariable("VALUE_IM_YAHOO", $this->safe_string($user_profile["USER_PROFILE_IM_YAHOO"]));
     }
     if (ENABLED_LANGUAGES) {
         // LANGUAGE
         if (TRUE) {
             // && !empty($user_profile["USER_LANGUAGE"]) ) {
             $ulang = $user_profile["USER_LANGUAGE"];
             if (!is_string($ulang) || $ulang === "0") {
                 $ulang = LANGUAGE_DEFAULT_STEAM;
             }
             $languages = array("english" => array("name" => gettext("English"), "icon" => "flag_gb.gif", "lang_key" => "en_US"), "german" => array("name" => gettext("German"), "icon" => "flag_de.gif", "lang_key" => "de_DE"));
             if (!array_key_exists($ulang, $languages)) {
                 $ulang = LANGUAGE_DEFAULT_STEAM;
             }
             $content->setCurrentBlock("USER_LANGUAGE");
             $content->setVariable("LABEL_LANGUAGES", gettext("Language"));
             foreach ($languages as $key => $language) {
                 $content->setCurrentBlock("LANGUAGE");
                 $content->setVariable("LABEL_LANGUAGE_LABEL", "profile_language_" . $key);
                 $content->setVariable("LANGUAGE_ICON", PATH_STYLE . "/images/" . $language["icon"]);
                 $content->setVariable("LABEL_LANGUAGE", $language["name"]);
                 $content->setVariable("LANGUAGE_VALUE", $key);
                 if ($ulang == $key) {
                     $content->setVariable("LANGUAGE_CHECKED", "checked=\"checked\"");
                 }
                 $content->parse("LANGUAGE");
             }
             $content->parse("USER_LANGUAGE");
         }
     }
     if (ENABLED_BID_LANGUAGE) {
         $content->setVariable("LABEL_LANGUAGES", gettext("Language"));
         if (trim($user_profile["USER_LANGUAGE"]) == trim("german")) {
             $content->setVariable("LANG1", "Deutsch");
             $content->setVariable("LANG2", "English");
             $content->setVariable("LANG3", "german");
             $content->setVariable("LANG4", "english");
         } else {
             $content->setVariable("LANG1", "English");
             $content->setVariable("LANG2", "Deutsch");
             $content->setVariable("LANG3", "english");
             $content->setVariable("LANG4", "german");
         }
     }
     if (ENABLED_BID_NAME) {
         $content->setVariable("LABEL_BID_NAME", gettext("name"));
         $completeName = $user_profile["USER_FIRSTNAME"] . " " . $user_profile["USER_FULLNAME"];
         $content->setVariable("VALUE_USER_NAME_BID", $completeName);
     }
     if (ENABLED_BID_ADRESS) {
         $content->setVariable("LABEL_BID_ADDRESS", gettext("Address"));
         $content->setVariable("VALUE_BID_ADDRESS", $user->get_attribute("USER_ADRESS"));
     }
     if (ENABLED_BID_EMAIL) {
         $content->setVariable("LABEL_EMAIL_BID", gettext("E-Mail"));
         $content->setVariable("VALUE_EMAIL_BID", $user->get_attribute("USER_EMAIL"));
     }
     if (ENABLED_BID_PHONE) {
         $content->setVariable("LABEL_TELEPHONE_BID", "Telefon");
         $content->setVariable("VALUE_TELEPHONE_BID", $user->get_attribute("bid:user_callto"));
     }
     //var_dump($user_profile);die;
     if (PLATFORM_ID == "bid") {
         $frameResponseObject->setHeadline(array(array("link" => PATH_URL . "home/", "name" => $user->get_attribute("USER_FIRSTNAME") . " " . $user->get_attribute("USER_FULLNAME")), array("link" => PATH_URL . "profile/", "name" => gettext("Profile")), array("link" => "", "name" => "Profil ändern")));
     } else {
         $frameResponseObject->setHeadline(array(array("link" => PATH_URL . "profile/index/" . $user->get_name() . "/", "name" => $user->get_attribute("USER_FIRSTNAME") . " " . $user->get_attribute("USER_FULLNAME")), array("link" => "", "name" => gettext("Profile"))));
     }
     $rawHtml = new \Widgets\RawHtml();
     $rawHtml->setHtml($content->get());
     $frameResponseObject->addWidget($rawHtml);
     /*$portal->set_page_main(
     	 array(
     	 array( "link" => PATH_URL . "profile/index/" . $user->get_name() . "/",
     		"name" => $user->get_attribute( "USER_FIRSTNAME" ) . " " . $user->get_attribute( "USER_FULLNAME" )
     		),
     		array( "link" => "",
     		"name" => gettext( "Profile" )
     		)
     		),
     		$content->get(),
     		""
     		);*/
     return $frameResponseObject;
 }
Beispiel #11
0
    public function execute(\FrameResponseObject $frameResponseObject)
    {
        //CODE FOR ALL COMMANDS OF THIS PAKAGE END
        $user = \lms_steam::get_current_user();
        // Disable caching
        // TODO: Work on cache handling. An enabled cache leads to bugs
        // if used with the wiki.
        \CacheSettings::disable_caching();
        if (!($wiki_container = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id))) {
            include "bad_link.php";
            exit;
        }
        if (!$wiki_container instanceof \steam_container) {
            $wiki_doc = $wiki_container;
            $wiki_container = $wiki_doc->get_environment();
            if ($wiki_doc->get_attribute(DOC_MIME_TYPE) != "text/wiki") {
                include "bad_link.php";
                exit;
            }
        }
        //CODE FOR ALL COMMANDS OF THIS PAKAGE END
        defined("OBJ_ID") or define("OBJ_ID", $wiki_container->get_id());
        $content = \Wiki::getInstance()->loadTemplate("wiki_edit.template.html");
        //$content = new HTML_TEMPLATE_IT();
        //$content->loadTemplateFile( PATH_TEMPLATES . "wiki_edit.template.html" );
        $wiki_entries = $wiki_container->get_inventory(CLASS_DOCUMENT);
        foreach ($wiki_entries as $wiki_entry) {
            if ($wiki_entry->get_attribute(DOC_MIME_TYPE) === "text/wiki") {
                $name = $wiki_entry->get_name();
                $content->setCurrentBlock("BLOCK_WIKI_ENTRY_OPTION");
                $content->setVariable("WIKI_ENTRY_OPTION", "<option value=\"{$name}\">{$name}</option>");
                $content->parse("BLOCK_WIKI_ENTRY_OPTION");
            }
        }
        $problems = "";
        if (!isset($create)) {
            $create = FALSE;
        }
        if ($_SERVER["REQUEST_METHOD"] == "POST") {
            $values = $_POST["values"];
            if (get_magic_quotes_gpc()) {
                if (!empty($values['title'])) {
                    $values['title'] = stripslashes($values['title']);
                }
                if (!empty($values['body'])) {
                    $values['body'] = stripslashes($values['body']);
                }
            }
            if (empty($values["title"])) {
                $problems = gettext("Please enter a subject for your message.");
            }
            if (empty($values["body"])) {
                $problems .= empty($problems) ? gettext("Please enter your message.") : "<br>" . gettext("Please enter your message.");
            }
            if (strpos($values["title"], "/")) {
                if (!isset($problems)) {
                    $problems = "";
                }
                $problems .= gettext("Please don't use the \"/\"-char in the subject of your post.");
            }
            if (empty($problems)) {
                $wiki_content = str_replace("@", "&#64;", $values["body"]);
                if (!empty($values['save'])) {
                    if ($create) {
                        $wiki_doc = \steam_factory::create_document($GLOBALS["STEAM"]->get_id(), $values["title"] . ".wiki", $wiki_content, "text/wiki", $wiki_container, "");
                    } else {
                        // PRUEFEN, OB ALLES OK, DANN NEUE WERTE SPEICHERN
                        $wiki_doc->set_name($values['title'] . ".wiki");
                        $wiki_doc->set_content($wiki_content);
                    }
                    // Clean cache for wiki_entries
                    $cache = get_cache_function($wiki_container->get_id(), 600);
                    $cache->clean($wiki_container->get_id());
                    // clean rsscache
                    $rcache = get_cache_function("rss", 600);
                    $feedlink = PATH_URL . "services/feeds/wiki_public.php?id=" . $wiki_container->get_id();
                    $rcache->drop("lms_rss::get_items", $feedlink);
                    header("Location: " . PATH_URL . "wiki/editentry/" . $wiki_doc->get_id() . "/");
                    exit;
                } else {
                    // PREVIEW
                    $content->setCurrentBlock("BLOCK_PREVIEW");
                    $content->setVariable("LABEL_PREVIEW_EDIT", gettext("Preview the description"));
                    $content->setVariable("PREVIEW_EDIT", get_formatted_output($values["desc"]));
                    $content->parse("BLOCK_PREVIEW");
                    $headline = gettext("Change it?");
                    $content->setVariable("TEXT_DSC", h($values["desc"]));
                    $content->setVariable("TITLE_COMMENT", h($values["title"]));
                }
            } else {
                $frameResponseObject->setProblemDescription($problems);
                //$portal->set_problem_description( $problems );
            }
        }
        if (empty($values)) {
            $wikicontent = "";
            $wikiname = "";
            if (!$create) {
                $wikicontent = $wiki_doc->get_content();
                $wikicontent = str_replace("&#64;", "@", $wikicontent);
                $wikiname = $wiki_doc->get_name();
            }
            if (WIKI_WYSIWYG) {
                //TODO
                $content->setVariable("TEXT_DSC", h($wikicontent));
                //$content->setVariable( "TEXT_DSC", wikitext_to_html( h($wikicontent), $wiki_container->get_id() ) );
                //$content->setVariable( "NIC_SCRIPT", PATH_JAVASCRIPT . "niceditor/nicEdit.js");
            } else {
                $content->setVariable("TEXT_DSC", h($wikicontent));
            }
            $content->setVariable("TITLE_COMMENT", str_replace(".wiki", "", h($wikiname)));
            $content->setVariable("BACK_LINK", $_SERVER["HTTP_REFERER"]);
        } else {
            $content->setVariable("TITLE_COMMENT", h($values["title"]));
            if (isset($values["body"])) {
                $content->setVariable("TEXT_DSC", h($values["body"]));
            }
        }
        $content->setVariable("LABEL_HERE_IT_IS", "");
        $content->setVariable("LABEL_TITLE", gettext("Title"));
        $content->setVariable("LABEL_BODY", gettext("Body"));
        //$content->setVariable( "LABEL_WIKI_H2", gettext( "H2" ) );
        //$content->setVariable( "HINT_WIKI_H2", gettext( "heading (level 2)" ) );
        //$content->setVariable( "LABEL_WIKI_H3", gettext( "H3" ) );
        //$content->setVariable( "HINT_WIKI_H3", gettext( "heading (level 3)" ) );
        //$content->setVariable( "LABEL_WIKI_BOLD", gettext( "'''B'''" ) );
        //$content->setVariable( "HINT_WIKI_BOLD", gettext( "boldface" ) );
        //$content->setVariable( "LABEL_WIKI_ITALIC", gettext( "''I''" ) );
        //$content->setVariable( "HINT_WIKI_ITALIC", gettext( "italic" ) );
        //$content->setVariable( "LABEL_WIKI_BULLET_LIST", gettext( "* list" ) );
        //$content->setVariable( "HINT_WIKI_BULLET_LIST", gettext( "bullet list" ) );
        //$content->setVariable( "LABEL_WIKI_NUMBERED_LIST", gettext( "# list" ) );
        //$content->setVariable( "HINT_WIKI_NUMBERED_LIST", gettext( "numbered list" ) );
        //$content->setVariable( "LABEL_WIKI_LINE", gettext( "-----" ) );
        //$content->setVariable( "HINT_WIKI_LINE", gettext( "horizontal line" ) );
        //$content->setVariable( "LABEL_WIKI_LINK", gettext( "[[wiki]]" ) );
        //$content->setVariable( "HINT_WIKI_LINK", gettext( "wiki link" ) );
        //$content->setVariable( "LABEL_WIKI_URL", gettext( "[URL]" ) );
        //$content->setVariable( "HINT_WIKI_URL", gettext( "web link" ) );
        //$content->setVariable( "LABEL_WIKI_IMAGE", gettext( "IMG" ) );
        //$content->setVariable( "HINT_WIKI_IMAGE", gettext( "image" ) );
        $content->setVariable("LABEL_PREVIEW", gettext("Preview"));
        $content->setVariable("LABEL_SAVE_CHANGES", gettext("Save changes"));
        $content->setVariable("LABEL_RETURN", gettext("back"));
        $content->setVariable("JS_NOTICE", '"' . gettext("Warning!\\nYou have edited your entry!\\nIf you proceed, all changes will be lost!\\nDo you really want to proceed?") . '"');
        // widget: Images
        //$widget = new HTML_TEMPLATE_IT();
        //$widget->loadTemplateFile( PATH_TEMPLATES . "widget_wiki_images.template.html" );
        $inventory = $wiki_container->get_inventory();
        if (!is_array($inventory)) {
            $inventory = array();
        }
        if (sizeof($inventory) > 0) {
            \steam_factory::load_attributes($GLOBALS["STEAM"]->get_id(), $inventory, array(OBJ_NAME, OBJ_DESC, DOC_MIME_TYPE));
            $images = array();
            foreach ($inventory as $object) {
                $mime = strtolower($object->get_attribute(DOC_MIME_TYPE));
                if ($mime === "image/jpg" || $mime === "image/jpeg" || $mime === "image/gif" || $mime === "image/png") {
                    $images[] = $object;
                }
            }
            if (empty($images)) {
                $content->setCurrentBlock("BLOCK_WIKI_ENTRY_NOIMAGE");
                $content->setVariable("WIKI_ENTRY_NOIMAGE", "Es befinden sich keine Bilder in der Mediathek.");
                $content->parse("BLOCK_WIKI_ENTRY_NOIMAGE");
            } else {
                $i = 0;
                foreach ($images as $image) {
                    $path = PATH_URL . "download/image/" . $image->get_id() . "/40/80/";
                    $content->setCurrentBlock("BLOCK_WIKI_ENTRY_IMAGE");
                    $content->setVariable("WIKI_ENTRY_IMAGE", <<<END
<table style="float:left">
\t<tr>
\t\t<td>
\t\t\t<input id="image{$i}" type="radio" name="images" value="{$image->get_name()}"/>
\t\t</td>
\t\t<td>
\t\t\t<img src="{$path}" title="{$image->get_name()}">
\t\t</td>
\t</tr>
</table>  \t
END
);
                    $content->parse("BLOCK_WIKI_ENTRY_IMAGE");
                    $i++;
                    //$widget->setCurrentBlock("BLOCK_IMAGE");
                    //$widget->setVariable("WIKI_IMAGE_NAME", $image->get_name());
                    //$widget->setVariable("WIKI_IMAGE_ADD_LINK", "javascript:insert('[[Image:" . $image->get_identifier() . "]]', '', 'formular', 'values[body]')");
                    //$widget->setVariable("WIKI_IMAGE_LINK", PATH_URL . "get_document.php?id=" . $image->get_id() . "&width=40&height=80");
                    //$widget->setVariable("WIKI_IMAGE_VIEW_LINK", PATH_URL . "doc/" . $image->get_id() . "/");
                    //$widget->setVariable("WIKI_IMAGE_TITLE", $image->get_name());
                    //$widget->setVariable("WIKI_IMAGE_ADD", gettext("Insert"));
                    //$widget->setVariable("WIKI_IMAGE_VIEW", gettext("View"));
                    //$widget->parse("BLOCK_IMAGE");
                }
            }
        }
        //$widget->setVariable("UPLOAD_TEXT", gettext("Upload an image"));
        //$widget->setVariable("UPLOAD_LINK", PATH_URL . "upload/?env=" . $wiki_container->get_id());
        //$widget->setVariable("WIKI_IMAGE_EXTERNAL", gettext("External image"));
        //$widget->setVariable("WIKI_IMAGE_EXTERNAL_LINK", "javascript:insert('[[Image:http://', ']]', 'formular', 'values[body]')");
        //$content->setCurrentBlock("BLOCK_WIDGET");
        //$content->setVariable("WIDGET_TITLE", gettext("Images"));
        //$content->setVariable("WIDGET_HTML_CODE", $widget->get());
        //$content->parse("BLOCK_WIDGET");
        if ($create) {
            $pagetitle = gettext("New Article");
        } else {
            $pagetitle = str_replace("%NAME", h(substr($wiki_doc->get_name(), 0, -5)), gettext("Edit '%NAME'?"));
        }
        $rootlink = \lms_steam::get_link_to_root($wiki_container);
        WIKI_FULL_HEADLINE ? $headline = array($rootlink[0], $rootlink[1], array("link" => $rootlink[1]["link"] . "communication/", "name" => gettext("Communication")), array("name" => h($wiki_container->get_name()), "link" => PATH_URL . "wiki/index/" . $wiki_container->get_id() . "/"), array("link" => "", "name" => $pagetitle)) : ($headline = array(array("name" => h($wiki_container->get_name()), "link" => PATH_URL . "wiki/index/" . $wiki_container->get_id() . "/"), array("link" => "", "name" => $pagetitle)));
        /*$portal->set_page_main(
        		$headline,
        		$content->get()
        		);
        		$portal->show_html();
        		*/
        $frameResponseObject->setHeadline($headline);
        $rawHtml = new \Widgets\RawHtml();
        $rawHtml->setHtml($content->get());
        $frameResponseObject->addWidget($rawHtml);
        return $frameResponseObject;
    }
Beispiel #12
0
 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;
 }
Beispiel #13
0
 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_create.template.html");
     $kindOfDocument = $this->params[2];
     // display create element dialog
     $content->setCurrentBlock("BLOCK_CREATE_ELEMENT");
     if ($kindOfDocument == 0) {
         $create_label = "Neue These erstellen";
     } else {
         if ($kindOfDocument == 1) {
             $create_label = "Neue Kritik erstellen";
             $thesisID = $this->params[3];
             $content->setVariable("ELEMENT_ID", $thesisID);
         } else {
             $create_label = "Neue Replik erstellen";
             $reviewID = $this->params[3];
             $content->setVariable("ELEMENT_ID", $reviewID);
         }
     }
     $content->setVariable("CREATE_LABEL", $create_label);
     $content->setVariable("TITLE_LABEL", "Titel");
     $content->setVariable("DESC_LABEL", "Untertitel / Beschreibung");
     $content->setVariable("PLAIN_LABEL", "Text-Dokument erstellen");
     $content->setVariable("FILE_LABEL", "Datei hochladen");
     $content->setVariable("CONTENT_LABEL", "Inhalt");
     $content->setVariable("SUBMIT_CREATE", $create_label);
     $content->setVariable("BACK_LABEL", "Zurück");
     $content->setVariable("BACK_URL", $TCRExtension->getExtensionUrl() . "privateDocuments/" . $this->id . "/" . $this->params[2]);
     $content->setVariable("KIND_VALUE", $kindOfDocument);
     $content->setVariable("ROUND_VALUE", $this->params[1]);
     // max file size message
     $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;
     }
     $content->setVariable("UPLOAD_MAXSIZE", str_replace("%SIZE", readable_filesize($max_file_size), gettext("The maximum allowed file size is %SIZE.")));
     $content->parse("BLOCK_CREATE_ELEMENT");
     $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/" . $this->id), array("name" => "Private Dokumente", "link" => $TCRExtension->getExtensionUrl() . "privateDocuments/" . $this->id), array("name" => $create_label)));
     return $frameResponseObject;
 }
Beispiel #14
0
 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();
     $pyramiddiscussionExtension->addJS();
     $basegroup = $pyramidRoom->get_attribute("PYRAMIDDISCUSSION_BASEGROUP");
     $admingroup = $pyramidRoom->get_attribute("PYRAMIDDISCUSSION_ADMINGROUP");
     $content = $pyramiddiscussionExtension->loadTemplate("pyramiddiscussion_configuration.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;
     }
     // change configuration
     if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST["change_options"])) {
         $pyramidRoom->set_name($_POST["title"]);
         $pyramidRoom->set_attribute("OBJ_DESC", $_POST["info"]);
         $pyramidRoom->set_attribute("PYRAMIDDISCUSSION_ACTCOL", $_POST["phase"]);
         if (isset($_POST["use_deadlines"]) && $_POST["use_deadlines"] == "on") {
             $pyramidRoom->set_attribute("PYRAMIDDISCUSSION_USEDEADLINES", "yes");
             $deadlines = $_POST["deadline"];
             $deadlineArray = $pyramidRoom->get_attribute("PYRAMIDDISCUSSION_DEADLINES");
             for ($count = 1; $count <= count($deadlines); $count++) {
                 $deadline = $deadlines[$count];
                 $time = substr($deadline, 11);
                 $deadline = substr($deadline, 0, 10);
                 $deadline = mktime(substr($time, 0, 2), substr($time, 3, 2), 0, substr($deadline, 3, 2), substr($deadline, 0, 2), substr($deadline, 6, 4));
                 $deadlineArray[$count] = $deadline;
             }
             $pyramidRoom->set_attribute("PYRAMIDDISCUSSION_DEADLINES", $deadlineArray);
             $pyramidRoom->set_attribute("PYRAMIDDISCUSSION_OVERRIDE_DEADLINES", 0);
         } else {
             $pyramidRoom->set_attribute("PYRAMIDDISCUSSION_USEDEADLINES", "no");
             $pyramidRoom->set_attribute("PYRAMIDDISCUSSION_OVERRIDE_DEADLINES", 0);
         }
         $frameResponseObject->setConfirmText("Änderungen erfolgreich gespeichert.");
     }
     $phase = $pyramidRoom->get_attribute("PYRAMIDDISCUSSION_ACTCOL");
     $maxcol = $pyramidRoom->get_attribute("PYRAMIDDISCUSSION_MAXCOL");
     $deadlines = $pyramidRoom->get_attribute("PYRAMIDDISCUSSION_DEADLINES");
     // display configuration table
     $content->setCurrentBlock("BLOCK_PYRAMID_OPTIONS");
     $content->setVariable("PYRAMID_OPTIONS", "Konfiguration der Pyramidendiskussion");
     $content->setVariable("TITLE_LABEL", "Diskussionsthema:");
     $content->setVariable("TITLE_VALUE", $pyramidRoom->get_name());
     $content->setVariable("INFO_LABEL", "Infotext:");
     $content->setVariable("INFO_VALUE", $pyramidRoom->get_attribute("OBJ_DESC"));
     $content->setVariable("START_LABEL", "Anzahl der Startfelder:");
     $content->setVariable("START_VALUE", $pyramidRoom->get_attribute("PYRAMIDDISCUSSION_MAX"));
     $content->setVariable("BASEGROUP_LABEL", "Basisgruppe:");
     $content->setVariable("BASEGROUP_VALUE", $basegroup->get_name());
     $content->setVariable("ADMINGROUP_LABEL", "Admingruppe:");
     $content->setVariable("ADMINGROUP_VALUE", $admingroup->get_name());
     $content->setVariable("EDITOR_LABEL", "Editor-Typ:");
     $editortype = $pyramidRoom->get_attribute("PYRAMIDDISCUSSION_EDITOR");
     if ($editortype == "text/plain") {
         $content->setVariable("EDITOR_VALUE", "Einfacher Text");
     } else {
         if ($editortype == "text/html") {
             $content->setVariable("EDITOR_VALUE", "HTML Notation");
         } else {
             $content->setVariable("EDITOR_VALUE", "Wiki Notation");
         }
     }
     $content->setVariable("PHASE_LABEL", "Aktuelle Phase:");
     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->parse("BLOCK_PHASE_OPTION");
     }
     $content->setVariable("DEADLINES_LABEL", "Benutze Deadlines:");
     if (count($deadlines) > 0 && $pyramidRoom->get_attribute("PYRAMIDDISCUSSION_USEDEADLINES") == "yes") {
         $content->setVariable("DEADLINES_SELECTED", "checked");
     }
     $content->setVariable("MAX_PHASE", $maxcol);
     $content->setVariable("DEADLINE_PHASE_LABEL", "Diskussionsphase");
     $content->setVariable("DEADLINE_LABEL", "Deadline");
     for ($count = 1; $count <= $maxcol; $count++) {
         $hours = 0;
         $minutes = 0;
         $content->setCurrentBlock("BLOCK_DEADLINE_ENTRY");
         $content->setVariable("DEADLINE_PHASE", $count);
         if (array_key_exists($count, $deadlines)) {
             $content->setVariable("DEADLINE_PHASE_VALUE", date("d.m.Y H:i", (int) $deadlines[$count]));
         } else {
             $content->setVariable("DEADLINE_PHASE_VALUE", date("d.m.Y H:i", time() + 172800 * ($count - 1)));
         }
         $content->parse("BLOCK_DEADLINE_ENTRY");
     }
     $content->setVariable("SAVE_CHANGES", "Änderungen speichern");
     $content->setVariable("BACK_LABEL", "Zurück");
     $content->setVariable("BACK_LINK", $pyramiddiscussionExtension->getExtensionUrl() . "Index/" . $this->id);
     $content->parse("BLOCK_PYRAMID_OPTIONS");
     $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" => "Konfiguration")));
     return $frameResponseObject;
 }
Beispiel #15
0
 public function frameResponse(\FrameResponseObject $frameResponseObject)
 {
     $workplanExtension = \Workplan::getInstance();
     $workplanExtension->addJS();
     $user = $GLOBALS["STEAM"]->get_current_steam_user();
     $portal = \lms_portal::get_instance();
     $objectID = $this->params[0];
     $workplanContainer = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $objectID);
     // move workplan to group workroom if form was submitted
     if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST["move"])) {
         $values = $_POST["values"];
         $groupID = $values["groupid"];
         $newgroup = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $groupID);
         $newroom = $newgroup->get_workroom();
         $workplanContainer->set_attribute("WORKPLAN_GROUP", $groupID);
         $workplanContainer->move($newroom);
         $portal->set_confirmation("Projektplan " . $workplanContainer->get_name() . " erfolgreich in Gruppe " . $newgroup->get_name() . " verschoben.");
     }
     if (is_object($workplanContainer) && $workplanContainer instanceof \steam_room) {
         $content = $workplanExtension->loadTemplate("workplan_users.template.html");
         $content->setCurrentBlock("BLOCK_CONFIRMATION");
         $content->setVariable("CONFIRMATION_TEXT", "NONE");
         $content->parse("BLOCK_CONFIRMATION");
         $confirmationBar = new \Widgets\RawHtml();
         $confirmationBar->setHtml($content->get());
         $frameResponseObject->addWidget($confirmationBar);
         // if current user has required rights display actionbar
         if ($workplanContainer->get_creator()->get_id() == $user->get_id()) {
             $actionBar = new \Widgets\ActionBar();
             $actionBar->setActions(array(array("name" => "Mitarbeiter bearbeiten", "link" => "javascript:changeUsers(" . $objectID . ")")));
             $frameResponseObject->addWidget($actionBar);
         }
         $tabBar = new \Widgets\TabBar();
         $tabBar->setTabs(array(array("name" => "Überblick", "link" => $this->getExtension()->getExtensionUrl() . "overview/" . $objectID), array("name" => "Tabelle", "link" => $this->getExtension()->getExtensionUrl() . "listView/" . $objectID), array("name" => "Gantt-Diagramm", "link" => $this->getExtension()->getExtensionUrl() . "ganttView/" . $objectID), array("name" => "Mitarbeiter", "link" => $this->getExtension()->getExtensionUrl() . "users/" . $objectID), array("name" => "Snapshots", "link" => $this->getExtension()->getExtensionUrl() . "snapshots/" . $objectID)));
         $tabBar->setActiveTab(3);
         $frameResponseObject->addWidget($tabBar);
         $content = $workplanExtension->loadTemplate("workplan_users.template.html");
         $content->setCurrentBlock("BLOCK_USERS_LIST");
         $content->setVariable("WORKPLAN_USERS_ELEMENT_NAME", "Name");
         $content->setVariable("WORKPLAN_USERS_ELEMENT_ROLE", "Rolle");
         $content->setVariable("WORKPLAN_USERS_ELEMENT_RESSOURCE", "Ressourcenwert");
         // check if workplan is in group and save the right users in array (sorted according to their role)
         $group = 0;
         if (in_array("WORKPLAN_GROUP", $workplanContainer->get_attribute_names())) {
             $group = $workplanContainer->get_attribute("WORKPLAN_GROUP");
         }
         if ($group == 0) {
             $users = array();
             array_push($users, $workplanContainer->get_creator());
         } else {
             $groupObject = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $group);
             $users = array();
             $normalusers = array();
             $groupusers = $groupObject->get_members();
             array_push($users, $workplanContainer->get_creator());
             for ($count = 0; $count < count($groupusers); $count++) {
                 if ($groupusers[$count]->get_id() != $workplanContainer->get_creator()->get_id()) {
                     if (in_array("WORKPLAN_" . $groupusers[$count]->get_id() . "_LEADER", $workplanContainer->get_attribute_names())) {
                         array_push($users, $groupusers[$count]);
                     } else {
                         array_push($normalusers, $groupusers[$count]);
                     }
                 }
             }
             $users = array_merge($users, $normalusers);
         }
         // display found users sorted according to their role
         for ($count = 0; $count < count($users); $count++) {
             $content->setCurrentBlock("BLOCK_USERS_ELEMENT");
             $content->setVariable("WORKPLAN_USERS_ELEMENT_NAME_VALUE", $users[$count]->get_full_name());
             $content->setVariable("WORKPLAN_USERS_ELEMENT_RESSOURCE_VALUE", $workplanContainer->get_attribute("WORKPLAN_" . $users[$count]->get_id() . "_RESSOURCE"));
             if ($workplanContainer->get_creator()->get_id() == $users[$count]->get_id()) {
                 $content->setVariable("WORKPLAN_USERS_ELEMENT_ROLE_VALUE", "Projektersteller");
             } else {
                 if (in_array("WORKPLAN_" . $users[$count]->get_id() . "_LEADER", $workplanContainer->get_attribute_names())) {
                     $content->setVariable("WORKPLAN_USERS_ELEMENT_ROLE_VALUE", "Projektleiter");
                 } else {
                     $content->setVariable("WORKPLAN_USERS_ELEMENT_ROLE_VALUE", "Mitarbeiter");
                 }
             }
             $content->parse("BLOCK_USERS_ELEMENT");
         }
         $content->parse("BLOCK_USERS_LIST");
         // if workplan is private display dialog to move it to a group the current user is member in
         if ($group == 0) {
             $groups = $user->get_groups();
             $koalagroups = array();
             for ($count = 0; $count < count($groups); $count++) {
                 $currentGroup = $groups[$count];
                 if (substr($currentGroup->get_groupname(), 0, 10) == 'PrivGroups' | substr($currentGroup->get_groupname(), 0, 12) == 'PublicGroups') {
                     array_push($koalagroups, $currentGroup);
                 }
             }
             if (count($koalagroups) > 0) {
                 $content->setCurrentBlock("BLOCK_USERS_TOGROUP");
                 $content->setVariable("WORKPLAN_TOGROUP", "Verschieben in Gruppe: ");
                 $content->setVariable("GROUPCOUNT", count($koalagroups));
                 $content->setVariable("LABEL_MOVE", "Verschieben");
                 for ($count = 0; $count < count($koalagroups); $count++) {
                     $currentGroup = $koalagroups[$count];
                     $content->setCurrentBlock("BLOCK_USERS_TOGROUP_ELEMENT");
                     $content->setVariable("GROUPID", $currentGroup->get_id());
                     $content->setVariable("GROUPNAME", $currentGroup->get_name());
                     $content->parse("BLOCK_USERS_TOGROUP_ELEMENT");
                 }
                 $content->parse("BLOCK_USERS_TOGROUP");
             }
         }
         $rawWidget = new \Widgets\RawHtml();
         $rawWidget->setHtml($content->get());
         $frameResponseObject->setTitle("Projektplan: " . $workplanContainer->get_name());
         $frameResponseObject->setHeadline(array(array("link" => $this->getExtension()->getExtensionUrl(), "name" => "Projektplanverwaltung"), array("", "name" => $workplanContainer->get_name())));
         $frameResponseObject->addWidget($rawWidget);
         return $frameResponseObject;
     }
 }
Beispiel #16
0
 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;
 }
Beispiel #17
0
 public function execute(\FrameResponseObject $frameResponseObject)
 {
     //CODE FOR ALL COMMANDS OF THIS PACKAGE START
     $user = \lms_steam::get_current_user();
     // Disable caching
     // TODO: Work on cache handling. An enabled cache leads to bugs
     // if used with the wiki.
     \CacheSettings::disable_caching();
     if (!($wiki_container = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id))) {
         include "bad_link.php";
         exit;
     }
     if (!$wiki_container instanceof \steam_container) {
         $wiki_doc = $wiki_container;
         $wiki_container = $wiki_doc->get_environment();
         if ($wiki_doc->get_attribute(DOC_MIME_TYPE) != "text/wiki") {
             include "bad_link.php";
             exit;
         }
     }
     //CODE FOR ALL COMMANDS OF THIS PACKAGE END
     $env = $wiki_container->get_environment();
     $grp = $env->get_creator();
     if ($grp->get_name() == "learners" && $grp->get_attribute(OBJ_TYPE) == "course_learners") {
         $grp = $grp->get_parent_group();
     }
     if (!isset($wiki_container) || !is_object($wiki_container)) {
         if (!($env = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $_GET["env"]))) {
             throw new Exception("Environment unknown.");
         }
         if (!($grp = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $_GET["group"]))) {
             throw new Exception("Group unknown");
         }
     }
     $accessmergel = FALSE;
     if (isset($wiki_container) && is_object($wiki_container)) {
         $creator = $wiki_container->get_creator();
         if ($wiki_container->get_attribute(KOALA_ACCESS) == PERMISSION_UNDEFINED && \lms_steam::get_current_user()->get_id() != $creator->get_id() && !\lms_steam::is_koala_admin(\lms_steam::get_current_user())) {
             $accessmergel = TRUE;
         }
     }
     $backlink = empty($_POST["values"]["backlink"]) ? $_SERVER["HTTP_REFERER"] : $_POST["values"]["backlink"];
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         $values = $_POST["values"];
         if (get_magic_quotes_gpc()) {
             if (!empty($values['name'])) {
                 $values['name'] = stripslashes($values['name']);
             }
             if (!empty($values['dsc'])) {
                 $values['dsc'] = stripslashes($values['dsc']);
             }
         }
         if (empty($values["name"])) {
             $problems = gettext("The name of new wiki is missing.");
             $hints = gettext("Please type in a name.");
         }
         if (strpos($values["name"], "/")) {
             if (!isset($problems)) {
                 $problems = "";
             }
             $problems .= gettext("Please don't use the \"/\"-char in the name of the wiki.");
         }
         if (empty($problems)) {
             $group_members = $grp;
             $group_admins = 0;
             $group_staff = 0;
             // check if group is a course
             $grouptype = (string) $grp->get_attribute("OBJ_TYPE");
             if ($grouptype == "course") {
                 $group_staff = \steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), $grp->get_groupname() . ".staff");
                 $group_admins = \steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), $grp->get_groupname() . ".admins");
                 $group_members = \steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), $grp->get_groupname() . ".learners");
                 $workroom = $group_members->get_workroom();
             } else {
                 $workroom = $grp->get_workroom();
             }
             if (!isset($wiki_container) || !is_object($wiki_container)) {
                 $new_wiki = \steam_factory::create_room($GLOBALS["STEAM"]->get_id(), $values["name"], $env, $values["dsc"]);
                 $new_wiki->set_attribute("OBJ_TYPE", "container_wiki_koala");
                 $_SESSION["confirmation"] = str_replace("%NAME", $values["name"], gettext("New wiki '%NAME' created."));
             } else {
                 $wiki_container->set_attribute(OBJ_NAME, $values["name"]);
                 if ($values["wiki_startpage"] == gettext("Glossary")) {
                     $values["wiki_startpage"] = "glossary";
                 }
                 $wiki_container->set_attribute("OBJ_WIKI_STARTPAGE", $values["wiki_startpage"]);
                 $wiki_container->set_attribute(OBJ_DESC, $values["dsc"]);
                 //$portal->set_confirmation(gettext( "The changes have been saved." ));
                 $new_wiki = $wiki_container;
             }
             $koala_wiki = new \lms_wiki($new_wiki);
             $access = (int) $values["access"];
             $access_descriptions = \lms_wiki::get_access_descriptions($grp);
             if (!$accessmergel) {
                 $koala_wiki->set_access($access, $access_descriptions[$access]["members"], $access_descriptions[$access]["steam"], $group_members, $group_staff, $group_admins);
             }
             $GLOBALS["STEAM"]->buffer_flush();
             $cache = get_cache_function(\lms_steam::get_current_user()->get_name());
             $cache->drop("lms_steam::get_inventory_recursive", $workroom->get_id(), CLASS_CONTAINER, array("OBJ_TYPE", "WIKI_LANGUAGE"));
             $cache->drop("lms_steam::get_group_communication_objects", $workroom->get_id(), CLASS_MESSAGEBOARD | CLASS_CALENDAR | CLASS_CONTAINER | CLASS_ROOM);
             if (!isset($wiki_container) || !is_object($wiki_container)) {
                 header("Location: " . $backlink);
                 exit;
             }
         } else {
             $frameResponseObject->setProblemDescription($problems);
             $frameResponseObject->setProblemSolution(isset($hints) ? $hints : "");
         }
     }
     $content = \Wiki::getInstance()->loadTemplate("object_new.template.html");
     //$content = new HTML_TEMPLATE_IT( PATH_TEMPLATES );
     //$content->loadTemplateFile( "object_new.template.html" );
     if (isset($wiki_container) && is_object($wiki_container)) {
         $content->setVariable("INFO_TEXT", str_replace("%NAME", h($wiki_container->get_name()), gettext("You are going to edit the wiki '<b>%NAME</b>'.")));
         $content->setVariable("LABEL_CREATE", gettext("Save changes"));
         $pagetitle = gettext("Preferences");
         if (empty($values)) {
             $values = array();
             $values["name"] = $wiki_container->get_name();
             $values["dsc"] = $wiki_container->get_attribute(OBJ_DESC);
             $values["wiki_startpage"] = $wiki_container->get_attribute("OBJ_WIKI_STARTPAGE");
             $values["access"] = $wiki_container->get_attribute(KOALA_ACCESS);
         }
         $breadcrumbheader = gettext("Preferences");
         $content->setVariable("OPTION_WIKI_GLOSSARY", gettext("Glossary"));
         $wiki_entries = $wiki_container->get_inventory(CLASS_DOCUMENT);
         $wiki_entries_sorted = array();
         foreach ($wiki_entries as $wiki_entry) {
             if ($wiki_entry->get_attribute(DOC_MIME_TYPE) === "text/wiki") {
                 $wiki_entries_sorted[] = str_replace(".wiki", "", $wiki_entry->get_name());
             }
         }
         sort($wiki_entries_sorted);
         $startpageFound = false;
         foreach ($wiki_entries_sorted as $wiki_entry) {
             $content->setCurrentBlock("BLOCK_WIKI_STARTPAGE_OPTION");
             $content->setVariable("OPTION_WIKI_STARTPAGE", $wiki_entry);
             if ($values["wiki_startpage"] == $wiki_entry) {
                 $content->setVariable("WIKI_STARTPAGE_SELECTED", "selected");
                 $startpageFound = true;
             }
             $content->parse("BLOCK_WIKI_STARTPAGE_OPTION");
         }
         if (!$startpageFound) {
             $content->setVariable("OPTION_WIKI_GLOSSARY_SELECTED", "selected");
         }
     } else {
         $grpname = $grp->get_attribute(OBJ_NAME);
         if ($grp->get_attribute(OBJ_TYPE) == "course") {
             $grpname = $grp->get_attribute(OBJ_DESC);
         }
         $content->setVariable("OPTION_WIKI_GLOSSARY", gettext("Glossary"));
         $content->setVariable("OPTION_WIKI_GLOSSARY_SELECTED", "selected");
         $content->setVariable("INFO_TEXT", str_replace("%ENV", h($grpname), gettext("You are going to create a new wiki in '<b>%ENV</b>'.")));
         $content->setVariable("LABEL_CREATE", gettext("Create wiki"));
         $pagetitle = gettext("Create wiki");
         $breadcrumbheader = gettext("Add new wiki");
     }
     if (!empty($values)) {
         if (!empty($values["name"])) {
             $content->setVariable("VALUE_NAME", h($values["name"]));
         }
         if (!empty($values["dsc"])) {
             $content->setVariable("VALUE_DSC", h($values["dsc"]));
         }
         if (!empty($values["wiki_startpage"])) {
             $content->setVariable("VALUE_WIKI_STARTPAGE", h($values["wiki_startpage"]));
         }
     }
     $content->setVariable("VALUE_BACKLINK", $backlink);
     $content->setVariable("LABEL_NAME", gettext("Name"));
     $content->setVariable("LABEL_DSC", gettext("Description"));
     $content->setVariable("LABEL_WIKI_STARTPAGE", gettext("Startpage"));
     $content->setVariable("LABEL_ACCESS", gettext("Access"));
     $content->setVariable("LABEL_BB_BOLD", gettext("B"));
     $content->setVariable("HINT_BB_BOLD", gettext("boldface"));
     $content->setVariable("LABEL_BB_ITALIC", gettext("I"));
     $content->setVariable("HINT_BB_ITALIC", gettext("italic"));
     $content->setVariable("LABEL_BB_UNDERLINE", gettext("U"));
     $content->setVariable("HINT_BB_UNDERLINE", gettext("underline"));
     $content->setVariable("LABEL_BB_STRIKETHROUGH", gettext("S"));
     $content->setVariable("HINT_BB_STRIKETHROUGH", gettext("strikethrough"));
     $content->setVariable("LABEL_BB_IMAGE", gettext("IMG"));
     $content->setVariable("HINT_BB_IMAGE", gettext("image"));
     $content->setVariable("LABEL_BB_URL", gettext("URL"));
     $content->setVariable("HINT_BB_URL", gettext("web link"));
     $content->setVariable("LABEL_BB_MAIL", gettext("MAIL"));
     $content->setVariable("HINT_BB_MAIL", gettext("email link"));
     if ($accessmergel) {
         $mailto = "mailto:'.SUPPORT_EMAIL.'?subject=KoaLA:%20Invalid%20Access%20Rights&body=" . rawurlencode("\nLink: " . get_current_URL() . "\nCreator: " . $creator->get_identifier() . "\n");
         $content->setCurrentBlock("BLOCK_ACCESSMERGEL");
         $content->setVariable("LABEL_ACCESSMERGEL", str_replace("%MAILTO", $mailto, gettext("There is a problem with the access settings. Please <a href=\"%MAILTO\">contact the support team</a> to fix it by setting the access rights again.")));
         $content->parse("BLOCK_ACCESSMERGEL");
     } else {
         $access = \lms_wiki::get_access_descriptions($grp);
         if ((string) $grp->get_attribute("OBJ_TYPE") == "course") {
             $access_default = PERMISSION_PUBLIC;
         } else {
             $access_default = PERMISSION_PUBLIC_READONLY;
             if (isset($wiki_container) && is_object($wiki_container) && $creator->get_id() != \lms_steam::get_current_user()->get_id()) {
                 $access[PERMISSION_PRIVATE_READONLY] = str_replace("%NAME", $creator->get_name(), $access[PERMISSION_PRIVATE_READONLY]);
             } else {
                 $access[PERMISSION_PRIVATE_READONLY] = str_replace("%NAME", "you", $access[PERMISSION_PRIVATE_READONLY]);
             }
         }
         if (is_array($access)) {
             $content->setCurrentBlock("BLOCK_ACCESS");
             foreach ($access as $key => $array) {
                 if ($key != PERMISSION_UNDEFINED || isset($values) && (int) $values["access"] == PERMISSION_UNDEFINED) {
                     $content->setCurrentBlock("ACCESS");
                     $content->setVariable("LABEL", $array["summary_short"] . ": " . $array["label"]);
                     $content->setVariable("VALUE", $key);
                     if (isset($values) && $key == (int) $values["access"] || empty($values) && $key == $access_default) {
                         $content->setVariable("CHECK", "checked=\"checked\"");
                     }
                     $content->parse("ACCESS");
                 }
             }
             $content->parse("BLOCK_ACCESS");
         }
     }
     $content->setVariable("BACKLINK", "<a href=\"{$backlink}\">" . gettext("back") . "</a>");
     $rootlink = \lms_steam::get_link_to_root($grp);
     WIKI_FULL_HEADLINE ? $headline = array($rootlink[0], $rootlink[1], array("link" => $rootlink[1]["link"] . "communication/", "name" => gettext("Communication"))) : "";
     if (isset($wiki_container) && is_object($wiki_container)) {
         $headline[] = array("link" => PATH_URL . "wiki/index/" . $wiki_container->get_id() . "/", "name" => h($wiki_container->get_name()));
     }
     $headline[] = array("link" => "", "name" => $breadcrumbheader);
     $frameResponseObject->setTitle($pagetitle);
     $frameResponseObject->setHeadline($headline);
     $widget = new \Widgets\RawHtml();
     $widget->setHtml($content->get());
     $frameResponseObject->addWidget($widget);
     return $frameResponseObject;
     /*$portal->set_page_main( $headline, $content->get() );
     	 $portal->set_page_title( $pagetitle );
     	 $portal->show_html();*/
 }
Beispiel #18
0
 public function execute(\FrameResponseObject $frameResponseObject)
 {
     //CODE FOR ALL COMMANDS OF THIS PAKAGE END
     $user = \lms_steam::get_current_user();
     // Disable caching
     // TODO: Work on cache handling. An enabled cache leads to bugs
     // if used with the wiki.
     \CacheSettings::disable_caching();
     if (!($wiki_container = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id))) {
         include "bad_link.php";
         exit;
     }
     if (!$wiki_container instanceof \steam_container) {
         $wiki_doc = $wiki_container;
         $wiki_container = $wiki_doc->get_environment();
         if ($wiki_doc->get_attribute(DOC_MIME_TYPE) != "text/wiki") {
             include "bad_link.php";
             exit;
         }
     }
     //CODE FOR ALL COMMANDS OF THIS PAKAGE END
     if ($wiki_doc != null) {
         if (@$_REQUEST["force_delete"]) {
             // is deleted entry wiki startpage ?
             $entryName = $wiki_doc->get_name();
             $startpage = $wiki_container->get_attribute("OBJ_WIKI_STARTPAGE") . ".wiki";
             if ($entryName == $startpage) {
                 $wiki_container->set_attribute("OBJ_WIKI_STARTPAGE", "glossary");
             }
             \lms_steam::delete($wiki_doc);
             // clean wiki cache (not used by wiki)
             $cache = get_cache_function($wiki_container->get_id(), 600);
             $cache->clean("lms_wiki::get_items", $wiki_container->get_id());
             $_SESSION["confirmation"] = gettext("Wiki entry deleted sucessfully");
             // clean rsscache
             $rcache = get_cache_function("rss", 600);
             $feedlink = PATH_URL . "services/feeds/wiki_public.php?id=" . $wiki_container->get_id();
             $rcache->drop("lms_rss::get_items", $feedlink);
             header("Location: " . PATH_URL . "wiki/deleteentry/" . $wiki_container->get_id() . "/");
         } else {
             $wiki_name = h(substr($wiki_doc->get_name(), 0, -5));
             $content = \Wiki::getInstance()->loadTemplate("wiki_delete.template.html");
             //$content = new HTML_TEMPLATE_IT();
             //$content->loadTemplateFile( PATH_TEMPLATES . "wiki_delete.template.html" );
             $content->setVariable("LABEL_ARE_YOU_SURE", str_replace("%NAME", h($wiki_name), gettext("Are you sure you want to delete the wiki page '%NAME' ?")));
             $content->setVariable("LABEL_DELETE", gettext('Delete'));
             $content->setVariable("LABEL_OR", gettext('or'));
             $content->setVariable("LABEL_CANCEL", gettext('Cancel'));
             $content->setVariable("FORM_ACTION", $_SERVER["REQUEST_URI"]);
             $content->setVariable("BACK_LINK", PATH_URL . "wiki/viewentry/" . $wiki_doc->get_id() . "/");
             //Breadcrumbs
             $rootlink = \lms_steam::get_link_to_root($wiki_container);
             WIKI_FULL_HEADLINE ? $headline = array($rootlink[0], $rootlink[1], array("link" => $rootlink[1]["link"] . "communication/", "name" => gettext("Communication")), array("name" => h($wiki_container->get_name()), "link" => PATH_URL . "wiki/index/" . $wiki_container->get_id() . "/"), array("link" => PATH_URL . "wiki/viewentry/" . $wiki_doc->get_id() . "/", "name" => str_replace(".wiki", "", h($wiki_doc->get_name()))), array("link" => "", "name" => gettext("Delete"))) : ($headline = array(array("name" => h($wiki_container->get_name()), "link" => PATH_URL . "wiki/index/" . $wiki_container->get_id() . "/"), array("link" => PATH_URL . "wiki/viewentry/" . $wiki_doc->get_id() . "/", "name" => str_replace(".wiki", "", h($wiki_doc->get_name()))), array("link" => "", "name" => gettext("Delete"))));
             /*$portal->set_page_main($headline, $content->get(), "");
             		$portal->show_html();*/
             $frameResponseObject->setHeadline($headline);
             $widget = new \Widgets\RawHtml();
             $widget->setHtml($content->get());
             $frameResponseObject->addWidget($widget);
             return $frameResponseObject;
         }
     }
 }
Beispiel #19
0
 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;
 }
Beispiel #20
0
 public function execute(\FrameResponseObject $frameResponseObject)
 {
     //$portal = \lms_portal::get_instance();
     //$portal->initialize( GUEST_NOT_ALLOWED );
     //$portal->set_guest_allowed( GUEST_NOT_ALLOWED );
     $user = \lms_steam::get_current_user();
     //$portal_user = $portal->get_user();
     //$path = $request->getPath();
     //$current_semester = $path[3];
     $scg = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), STEAM_COURSES_GROUP, CLASS_GROUP);
     $current_semester = \steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), $scg->get_groupname() . "." . STEAM_CURRENT_SEMESTER);
     $group_course = \steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), "Courses." . $this->params[0] . "." . $this->params[1]);
     $group = new \koala_group_course($group_course);
     $all_users = \steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), STEAM_ALL_USER);
     if (!$group->is_admin($user)) {
         include "bad_link.php";
         exit;
     }
     $lsfid = $group->get_steam_group()->get_attribute("COURSE_HISLSF_ID");
     $is_lsfcourse = is_string($lsfid) && strlen($lsfid) > 0 && $lsfid > 0;
     $paul_id = $group->get_attribute("COURSE_NUMBER");
     $is_paul_course = \koala_group_course::is_paul_course($paul_id);
     $accessmergel = FALSE;
     if (is_object($group)) {
         $creator = $group->get_steam_group()->get_creator();
         if ($group->get_steam_group()->get_attribute(KOALA_GROUP_ACCESS) == PERMISSION_UNDEFINED && lms_steam::get_current_user()->get_id() != $creator->get_id() && !lms_steam::is_koala_admin(lms_steam::get_current_user())) {
             $accessmergel = TRUE;
         }
     }
     if (isset($_POST["course_save"])) {
         $values = $_POST["values"];
         $problems = "";
         $hints = "";
         if (empty($values["OBJ_DESC"])) {
             $problems .= gettext("The course name is missing.") . " ";
             $hints .= gettext("A name is necessary for identification.") . " ";
         }
         if (empty($values["COURSE_TUTORS"])) {
             $values["COURSE_TUTORS"] = "NN";
         }
         $max_members = -1;
         $sizeproblems = FALSE;
         if (!empty($values["maxsize"]) && trim($values["maxsize"]) != "" && preg_match('/[^-.0-9]/', trim($values["maxsize"]))) {
             $problems .= gettext("Invalid max number of participants.") . " ";
             $hints .= gettext("Please enter a valid number for the max number of participants.") . " " . gettext("Please note that the input of a '0' or to leave the field blank means no limitation.") . " ";
             $sizeproblems = TRUE;
         } else {
             if (!empty($values["maxsize"]) && trim($values["maxsize"]) != "" && trim($values["maxsize"]) < 0) {
                 $problems .= gettext("Invalid max number of participants.") . " ";
                 $hints .= gettext("Please enter a number equal or greater than '0' for the max number of participants.") . " " . gettext("Please note that the input of a '0' or to leave the field blank means no limitation.") . " ";
                 $sizeproblems = TRUE;
             } else {
                 if (isset($values["maxsize"])) {
                     if (trim($values["maxsize"]) === "") {
                         $max_members = 0;
                     } else {
                         $max_members = (int) trim($values["maxsize"]);
                     }
                 }
             }
         }
         if (!$sizeproblems && isset($max_members) && $max_members > 0 && $max_members < $group->count_members()) {
             $problems .= gettext("Cannot set max number of participants.") . " ";
             $hints .= str_replace("%ACTUAL", $group->count_members(), str_replace("%CHOSEN", $max_members, gettext("You choosed to limit your course's max number of participants of %CHOSEN but your course already has %ACTUAL participants. If you want to set the max number of participants below %ACTUAL you have to remove some participants first."))) . " ";
         }
         if (!empty($values["access"]) && $values["access"] == PERMISSION_COURSE_PASSWORD && empty($values["password"])) {
             $problems .= gettext("The course password is missing.") . " ";
             $hints .= gettext("You chose to password protect your course. Please provide a password.") . " ";
         }
         if (empty($problems)) {
             $group->set_attributes(array_diff_key($values, array("password" => "", "maxsize" => "")));
             $learners = $group->get_group_learners();
             if (!$is_lsfcourse) {
                 $access = $values["access"];
                 $waspassword = 0;
                 $akt_access = $group->get_attribute(KOALA_GROUP_ACCESS);
                 if ($akt_access == PERMISSION_COURSE_PASSWORD) {
                     $waspassword = 1;
                 }
                 if (!$accessmergel) {
                     $group->set_access($access, $learners, $group->get_group_staff());
                 }
                 if (isset($values) && $waspassword == 1 && isset($values["password"]) && $values["password"] == "******" && $values["access"] == PERMISSION_COURSE_PASSWORD) {
                     // Do nothing in case of valid password dummy
                 } elseif ($values["access"] != PERMISSION_COURSE_PASSWORD) {
                     $learners->set_password("");
                 } else {
                     $learners->set_password(isset($values["password"]) ? trim($values["password"]) : "");
                 }
                 if ($max_members > -1) {
                     $learners->set_attribute(GROUP_MAXSIZE, $max_members);
                 }
             }
             // extensions:
             if (isset($_POST["extensions_available"]) && !empty($_POST["extensions_available"])) {
                 $extensions_available = explode("/", $_POST["extensions_available"]);
                 if (isset($_POST["extensions_enabled"])) {
                     $extensions_enabled = $_POST["extensions_enabled"];
                 } else {
                     $extensions_enabled = array();
                 }
                 if (isset($_POST["extensions_enabled_add"])) {
                     $extensions_enabled = array_merge($extensions_enabled, explode("/", $_POST["extensions_enabled_add"]));
                 }
                 if (is_array($extensions_available)) {
                     foreach ($extensions_available as $extension_name) {
                         $extension = \lms_steam::get_extensionmanager()->get_extension($extension_name);
                         if (!is_object($extension)) {
                             continue;
                         }
                         if (array_search($extension_name, $extensions_enabled) === FALSE) {
                             $extension->disable_for($group);
                         } else {
                             $extension->enable_for($group);
                         }
                     }
                 }
             }
             $cache = get_cache_function("ORGANIZATION");
             $cache->drop("lms_steam::semester_get_courses", $current_semester->get_id());
             $_SESSION["confirmation"] = gettext("The changes have been saved.");
             header("Location: " . $_SERVER["REQUEST_URI"]);
             exit;
         } else {
             //$portal->set_problem_description( $problems, $hints );
         }
     } elseif (isset($_POST["get_paul_course_data"])) {
         //at this time only the course name and short description are updated/changed
         $paul_client = new \paul_soap();
         $paul_course_id = h($group->get_attribute(OBJ_NAME));
         try {
             $paul_course_info = $paul_client->get_course_information($paul_course_id);
         } catch (Exception $exception) {
             $problem = $exception->getMessage();
             error_log($problem);
             throw new Exception("PAUL_SOAP exception: " . $problem);
         }
         //the same as in the following else-block
         $values = $group->get_attributes(array("OBJ_NAME", "OBJ_DESC", "COURSE_TUTORS", "COURSE_SHORT_DSC", "COURSE_LONG_DSC"));
         $ms = $group->get_group_learners()->get_attribute(GROUP_MAXSIZE);
         if ($ms === 0) {
             $values["maxsize"] = "";
         } else {
             $values["maxsize"] = $ms;
         }
         $values["OBJ_DESC"] = $paul_course_info["course_name_german"];
         $values["COURSE_SHORT_DSC"] = $paul_course_info["short_description"];
         //$portal->set_confirmation("test");
         //print_r($paul_course_values);
     } else {
         $values = $group->get_attributes(array("OBJ_NAME", "OBJ_DESC", "COURSE_TUTORS", "COURSE_SHORT_DSC", "COURSE_LONG_DSC"));
         $ms = $group->get_group_learners()->get_attribute(GROUP_MAXSIZE);
         if ($ms === 0) {
             $values["maxsize"] = "";
         } else {
             $values["maxsize"] = $ms;
         }
     }
     $content = \Course::getInstance()->loadTemplate("courses_edit.template.html");
     //$content = new HTML_TEMPLATE_IT();
     //$content->loadTemplateFile( PATH_TEMPLATES . "courses_edit.template.html" );
     $content->setVariable("LABEL_EDIT_COURSE_DESCRIPTION", gettext("Course Preferences"));
     $course_name = $group->get_attribute(OBJ_NAME);
     $course_number = $group->get_attribute("COURSE_NUMBER");
     $course_name = \koala_group_course::convert_course_id($course_name, $course_number);
     if (\koala_group_course::is_paul_course($course_number) && \lms_steam::is_koala_admin($user)) {
         $content->setVariable("VALUE_PAUL_ID", "  (" . gettext("PAUL-ID: " . h($group->get_attribute(OBJ_NAME))) . ")");
         $content->setVariable("ACTION_PAUL_COURSE_DATA", "<input type=\"submit\"  name=\"get_paul_course_data\" id=\"get_paul_course_data\" title=\"" . gettext("Get the course name and short description from PAUL") . "\" value=\"" . gettext("Get PAUL course data") . "\">");
     }
     $content->setVariable("LABEL_COURSE_ID", gettext("Course ID"));
     $content->setVariable("VALUE_COURSE_ID", h($course_name));
     $content->setVariable("LABEL_COURSE_NAME", gettext("Name"));
     $content->setVariable("VALUE_COURSE_NAME", h($values["OBJ_DESC"]));
     $content->setVariable("LABEL_COURSE_SHORT_INFORMATION", gettext("Short Info"));
     $content->setVariable("VALUE_SHORT_DSC", h($values["COURSE_SHORT_DSC"]));
     $content->setVariable("SHORT_DSC_SHOW_UP", gettext("This value will show up in the semester's courses list beside id, name and staff members."));
     $content->setVariable("LABEL_COURSE_TUTORS", gettext("Staff members"));
     $content->setVariable("VALUE_TUTORS", h($values["COURSE_TUTORS"]));
     $content->setVariable("LABEL_LONG_DSC", gettext("Long description"));
     $content->setVariable("LONG_DSC_SHOW_UP", gettext("This is for your course page. Please add information about schedule and locations at least."));
     $content->setVariable("VALUE_LONG_DSC", h($values["COURSE_LONG_DSC"]));
     $content->setVariable("COURSE_SAVE", gettext("Save changes"));
     $content->setVariable("AENDERN", gettext("Are you sure about your changes?"));
     $content->setVariable("LABEL_BB_BOLD", gettext("B"));
     $content->setVariable("HINT_BB_BOLD", gettext("boldface"));
     $content->setVariable("LABEL_BB_ITALIC", gettext("I"));
     $content->setVariable("HINT_BB_ITALIC", gettext("italic"));
     $content->setVariable("LABEL_BB_UNDERLINE", gettext("U"));
     $content->setVariable("HINT_BB_UNDERLINE", gettext("underline"));
     $content->setVariable("LABEL_BB_STRIKETHROUGH", gettext("S"));
     $content->setVariable("HINT_BB_STRIKETHROUGH", gettext("strikethrough"));
     $content->setVariable("LABEL_BB_IMAGE", gettext("IMG"));
     $content->setVariable("HINT_BB_IMAGE", gettext("image"));
     $content->setVariable("LABEL_BB_URL", gettext("URL"));
     $content->setVariable("HINT_BB_URL", gettext("web link"));
     $content->setVariable("LABEL_BB_MAIL", gettext("MAIL"));
     $content->setVariable("HINT_BB_MAIL", gettext("email link"));
     if (!$is_lsfcourse) {
         $content->setCurrentBlock("BLOCK_MAXSIZE");
         $content->setVariable("LABEL_MAXSIZE", gettext("Max number of participants"));
         $content->setVariable("LABEL_MAXSIZE_DSC", gettext("To limit the max number of participants for your course enter a number greater than 0. Leave this field blank or enter a '0' for no limitation."));
         $content->setVariable("VALUE_MAXSIZE", h($values["maxsize"]));
         $content->parse("BLOCK_MAXSIZE");
         $content->setCurrentBlock("BLOCK_ACCESS");
         $content->setVariable("PARTICIPANT_MANAGEMENT", gettext("Participant Management"));
         if ($accessmergel) {
             $mailto = "mailto:'.SUPPORT_EMAIL.'?subject=KoaLA:%20Invalid%20Access%20Rights&body=" . rawurlencode("\nLink: " . get_current_URL() . "\nCreator: " . $creator->get_identifier() . "\n");
             $content->setCurrentBlock("BLOCK_ACCESSMERGEL");
             $content->setVariable("LABEL_ACCESSMERGEL", str_replace("%MAILTO", $mailto, gettext("There is a problem with the access settings. Please <a href=\"%MAILTO\">contact the support team</a> to fix it by setting the access rights again.")));
             $content->parse("BLOCK_ACCESSMERGEL");
         } else {
             $waspassword = 0;
             $access = \koala_group_course::get_access_descriptions();
             if (isset($values) && isset($values["access"])) {
                 $akt_access = $values["access"];
             } else {
                 $akt_access = $group->get_attribute(KOALA_GROUP_ACCESS);
                 if ($akt_access == PERMISSION_COURSE_PASSWORD) {
                     $waspassword = 1;
                 }
             }
             if (is_array($access)) {
                 $content->setVariable("WASPASSWORD", $waspassword);
                 foreach ($access as $key => $array) {
                     if ($key != PERMISSION_UNDEFINED || $akt_access == PERMISSION_UNDEFINED) {
                         if ($key != PERMISSION_COURSE_PAUL_SYNC || $is_paul_course || $akt_access == PERMISSION_COURSE_PAUL_SYNC) {
                             $content->setCurrentBlock("ACCESS");
                             $content->setVariable("LABEL", $array["summary_short"] . ": " . $array["label"]);
                             $content->setVariable("VALUE", $key);
                             if ($key == $akt_access) {
                                 $content->setVariable("CHECK", "checked=\"checked\"");
                             }
                             if ($key == PERMISSION_COURSE_PASSWORD) {
                                 $content->setVariable("ONCHANGE", "onchange=\"document.getElementById('passworddiv').style.display='block'\"");
                                 $content->setCurrentBlock("ACCESS_PASSWORD");
                                 $content->setVariable("LABEL_PASSWORD", gettext("Password"));
                                 if (!empty($values["password"])) {
                                     $content->setVariable("VALUE_PASSWORD", $values["password"]);
                                 } else {
                                     if ($waspassword == 1) {
                                         $content->setVariable("VALUE_PASSWORD", "******");
                                     }
                                 }
                                 if ($akt_access == PERMISSION_COURSE_PASSWORD) {
                                     $content->setVariable("PASSWORDDIV_DISPLAY", "block");
                                 } else {
                                     $content->setVariable("PASSWORDDIV_DISPLAY", "none");
                                 }
                                 $content->parse("ACCESS_PASSWORD");
                             } else {
                                 $content->setVariable("ONCHANGE", "onchange=\"document.getElementById('passworddiv').style.display='none'\"");
                             }
                             $content->parse("ACCESS");
                         }
                     }
                 }
             }
         }
         $content->parse("BLOCK_ACCESS");
     } else {
         $content->setCurrentBlock("BLOCK_ACCESS");
         $content->setCurrentBlock("BLOCK_HISLSF");
         $content->setVariable("PARTICIPANT_MANAGEMENT", gettext("Participant Management"));
         $hislink = "<a href=\"https://lsf.uni-paderborn.de/qisserver/rds?state=wsearchv&search=2&veranstaltung.veranstid=" . trim($lsfid) . "\" target=\"_blank\">HIS-LSF</a>";
         $content->setVariable("PARTICIPANT_MANAGEMENT_VALUE", str_replace("%LINK", $hislink, gettext("The participant management for this course is handled by <b>%LINK</b>.")));
         $content->parse("BLOCK_HISLSF");
         $content->parse("BLOCK_ACCESS");
     }
     // extensions:
     //$extensions = \lms_steam::get_extensionmanager()->get_extensions_by_class( 'koala_group_course' );
     $extensions = 0;
     /*	if ( count( $extensions ) > 0 ) {
     			$content->setCurrentBlock( "BLOCK_EXTENSIONS" );
     			$content->setVariable( "LABEL_EXTENSIONS", gettext( "Extensions" ) );
     			$extension_list = array();
     			foreach ( $extensions as $extension ) {
     				if( $extension->get_requirements() === array() )
     				{
     					$extension_name = $extension->get_name();
     					$content->setCurrentBlock( "BLOCK_EXTENSION" );
     					$content->setVariable( "EXTENSION_ID", $extension_name );
     					$content->setVariable( "EXTENSION_NAME", $extension->get_display_name() );
     					$content->setVariable( "EXTENSION_DESC", $extension->get_display_description() );
     					$extension_enabled = $extension->is_enabled( $group );
     					if ( $extension_enabled )
     					$content->setVariable( "EXTENSION_ENABLED", "checked='checked'" );
     					$subextensions = lms_steam::get_extensionmanager()->get_dependent_extensions($extension);
     					if( count( $subextensions ) > 0 )
     					{
     						$content->setCurrentBlock( "BLOCK_SUBEXTENSIONS" );
     						$content->setVariable( "LABEL_SUBEXTENSIONS", str_replace( "%EXTENSION", h($extension->get_display_name()), gettext( "The following sub-extensions are available for %EXTENSION" ) ));
     						foreach($subextensions as $subextension)
     						{
     							$subextension_name = $subextension->get_name();
     							$content->setCurrentBlock( "BLOCK_SUBEXTENSION" );
     							$content->setVariable( "PARENT_EXTENSION_ID", $extension_name );
     							$content->setVariable( "SUBEXTENSION_ID", $subextension->get_name() );
     							$content->setVariable( "SUBEXTENSION_NAME", $subextension->get_display_name() );
     							$content->setVariable( "SUBEXTENSION_DESC", $subextension->get_display_description() );
     							$checkbox_attributes = '';
     							if ( $subextension->is_enabled_for( $group ) )
     							$checkbox_attributes .= "checked='checked'";
     							if ( ! $extension_enabled || $subextension_name === "units_docpool")
     							$checkbox_attributes .= " disabled='disabled'";
     							$content->setVariable( "SUBEXTENSION_ENABLED", $checkbox_attributes );
     							$content->parse( "BLOCK_SUBEXTENSION" );
     							$extension_list[] = $subextension_name;
     						}
     						$content->parse( "BLOCK_SUBEXTENSIONS" );
     					}
     					$content->parse( "BLOCK_EXTENSION" );
     					$extension_list[] = $extension_name;
     				}
     			}
     			$content->setVariable( "VALUE_EXTENSIONS", implode( "/", $extension_list ) );
     			$content->parse( "BLOCK_EXTENSIONS" );
     		}*/
     $backlink = PATH_URL . "course/index/" . $this->params[0] . "/" . $this->params[1] . "/";
     $content->setVariable("BACKLINK", "<a href=\"{$backlink}\">" . gettext("back") . "</a>");
     //$portal->set_page_main(
     //array( array( "link" => $backlink, "name" => h($values["OBJ_DESC"]) ), array( "linK" => "", "name" => gettext( "Course Preferences" ) ) ),
     //$content->get()
     //);
     $frameResponseObject->setHeadline(array(array("link" => $backlink, "name" => h($values["OBJ_DESC"])), array("linK" => "", "name" => gettext("Course Preferences"))));
     $widget = new \Widgets\RawHtml();
     $widget->setHtml($content->get());
     $frameResponseObject->addWidget($widget);
     return $frameResponseObject;
 }
Beispiel #21
0
 public function execute(\FrameResponseObject $frameResponseObject)
 {
     $current_user = \lms_steam::get_current_user();
     $login = $current_user->get_name();
     //$path = $request->getPath();
     if (isset($this->id)) {
         $userName = $this->id;
         $user = \steam_factory::get_user($GLOBALS["STEAM"]->get_id(), $userName);
     } else {
         $user = $current_user;
     }
     //$portal=\lms_portal::get_instance();
     $cache = get_cache_function($login, 86400);
     //	$portal->set_page_title( $login );
     $html_handler_profile = new \koala_html_profile($user);
     $html_handler_profile->set_context("groups");
     $content = \Profile::getInstance()->loadTemplate("list_groups.template.html");
     //$content = new HTML_TEMPLATE_IT();
     //$content->loadTemplateFile( PATH_TEMPLATES . "list_groups.template.html" );
     if ($this->viewer_authorized($current_user, $user)) {
         $public = $user->get_id() != $current_user->get_id() ? TRUE : FALSE;
         $groups = $cache->call("lms_steam::user_get_groups", $login, $public);
         usort($groups, "sort_objects");
         $no_groups = count($groups);
         if ($no_groups > 0) {
             $content->setCurrentBlock("BLOCK_GROUP_LIST");
             $pageIterator = \lms_portal::get_paginator(10, $no_groups, "(" . gettext("%TOTAL groups in list") . ")");
             $content->setVariable("PAGEITERATOR", $pageIterator["html"]);
             $start = $pageIterator["startIndex"];
             $end = $start + 10 > $no_groups ? $no_groups : $start + 10;
             if ($current_user->get_id() == $user->get_id()) {
                 $content->setVariable("LABEL_GROUPS", gettext("Your groups") . " (" . str_replace(array("%a", "%z", "%s"), array($start + 1, $end, $no_groups), gettext("%a-%z out of %s")) . ")");
             } else {
                 $content->setVariable("LABEL_GROUPS", str_replace("%NAME", $user->get_attribute("USER_FIRSTNAME") . " " . $user->get_attribute("USER_FULLNAME"), gettext("%NAME's groups")) . " (" . str_replace(array("%a", "%z", "%s"), array($start + 1, $end, $no_groups), gettext("%a-%z out of %s")) . ")");
             }
             // GROUPS
             $content->setVariable("LABEL_NAME_DESCRIPTION", gettext("Name, description"));
             $content->setVariable("LABEL_MEMBERS", gettext("Members list"));
             $content->setVariable("LABEL_COMMUNICATION", gettext("Communication"));
             if ($user->get_id() == $current_user->get_id()) {
                 $content->setVariable("TH_MANAGE_GROUP", gettext("Manage membership"));
             }
             for ($i = $start; $i < $end; $i++) {
                 $group = $groups[$i];
                 $content->setCurrentBlock("BLOCK_GROUP");
                 $content->setVariable("GROUP_LINK", PATH_URL . "groups/" . $group["OBJ_ID"] . "/");
                 $content->setVariable("GROUP_NAME", h($group["OBJ_NAME"]));
                 $content->setVariable("MEMBER_LINK", PATH_URL . "groups/" . $group["OBJ_ID"] . "/members/");
                 $content->setVariable("GROUP_MEMBERS", h($group["GROUP_NO_MEMBERS"]));
                 $content->setVariable("LINK_SEND_MESSAGE", PATH_URL . "messages_write.php?group=" . $group["OBJ_ID"]);
                 $content->setVariable("LABEL_MESSAGE", gettext("Message"));
                 $content->setVariable("LABEL_SEND", gettext("Send"));
                 if ($user->get_id() == $current_user->get_id()) {
                     $content->setVariable("TD_MANAGE_GROUP", "<a href=\"" . PATH_URL . "group_cancel.php?group=" . $group["OBJ_ID"] . "\">" . gettext("Resign") . "</a>");
                 }
                 $content->setVariable("OBJ_DESC", h($group["OBJ_DESC"]));
                 $content->parse("BLOCK_GROUP");
             }
             $content->parse("BLOCK_GROUP_LIST");
         } else {
             $content->setVariable("LABEL_GROUPS", gettext("No memberships found."));
         }
     } else {
         $messagebox = "<div class=\"infoBar\"><h2>" . gettext("The user has restricted the display of this information.") . "</h2></div>";
         $content->setVariable("LABEL_PRIVACY_DENY_PARTICIPANTS", $messagebox);
     }
     $frameResponseObject->setHeadline($html_handler_profile->get_headline());
     $html_handler_profile->set_html_left($content->get());
     $rawHtml = new \Widgets\RawHtml();
     $rawHtml->setHtml($html_handler_profile->get_html());
     $frameResponseObject->addWidget($rawHtml);
     return $frameResponseObject;
     //$portal->set_page_main( $html_handler_profile->get_headline(), $html_handler_profile->get_html());
     //return $portal->get_html();
 }
Beispiel #22
0
 public function frameResponse(\FrameResponseObject $frameResponseObject)
 {
     $workplanExtension = \Workplan::getInstance();
     $workplanExtension->addJS();
     $user = $GLOBALS["STEAM"]->get_current_steam_user();
     $portal = \lms_portal::get_instance();
     $newWorkplan = FALSE;
     if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST["new_workplan"])) {
         $newWorkplan = TRUE;
         $values = $_POST["values"];
         $workplanContainer = \steam_factory::create_room($GLOBALS["STEAM"]->get_id(), $values["name"], $user->get_workroom());
         $workplanContainer->set_attribute("OBJ_TYPE", "WORKPLAN_CONTAINER");
         $xml = new \SimpleXMLElement("<workplan></workplan>");
         $xml->addAttribute("name", $values["name"]);
         $start = $values["start"];
         $start = mktime(0, 0, 0, substr($start, 3, 2), substr($start, 0, 2), substr($start, 6, 4));
         $workplanContainer->set_attribute("WORKPLAN_START", $start);
         $xml->addAttribute("start", $start);
         if (!empty($values["end"])) {
             $end = $values["end"];
             $end = mktime(0, 0, 0, substr($end, 3, 2), substr($end, 0, 2), substr($end, 6, 4));
             $workplanContainer->set_attribute("WORKPLAN_END", $end);
             $xml->addAttribute("end", $end);
         } else {
             $workplanContainer->set_attribute("WORKPLAN_END", -1);
             $xml->addAttribute("end", -1);
         }
         if (!empty($values["description"])) {
             $workplanContainer->set_attribute("WORKPLAN_DESCRIPTION", $values["description"]);
             $xml->addAttribute("description", $values["description"]);
         } else {
             $workplanContainer->set_attribute("WORKPLAN_DESCRIPTION", "");
             $xml->addAttribute("description", "");
         }
         \steam_factory::create_document($GLOBALS["STEAM"]->get_id(), "version.xml", $xml->saveXML(), "text/xml", $workplanContainer);
         $portal->set_confirmation("Projektplan " . $values["name"] . " erfolgreich erstellt.");
     }
     if (!$newWorkplan) {
         $workplanContainer = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->params[0]);
     }
     if (is_object($workplanContainer) && $workplanContainer instanceof \steam_room) {
         $content = $workplanExtension->loadTemplate("workplan_overview.template.html");
         if (!$newWorkplan) {
             $content->setCurrentBlock("BLOCK_CONFIRMATION");
             $content->setVariable("CONFIRMATION_TEXT", "NONE");
             $content->parse("BLOCK_CONFIRMATION");
         }
         // if current user has required rights display actionbar
         if ($workplanContainer->get_creator()->get_id() == $user->get_id() || in_array("WORKPLAN_" . $user->get_id() . "_LEADER", $workplanContainer->get_attribute_names())) {
             $content->setCurrentBlock("BLOCK_WORKPLAN_OVERVIEW_ACTIONBAR");
             $content->setVariable("LABEL_CHANGE", "Eigenschaften bearbeiten");
             $content->setVariable("LABEL_SNAPSHOT", "Snapshot erstellen");
             $content->setVariable("WORKPLAN_ID", $workplanContainer->get_id());
             if ($workplanContainer->get_creator()->get_id() == $user->get_id()) {
                 $content->setVariable("WORKPLAN_RIGHTS_CHANGE", "");
             } else {
                 $content->setVariable("WORKPLAN_RIGHTS_CHANGE", "none");
             }
             $content->parse("BLOCK_WORKPLAN_OVERVIEW_ACTIONBAR");
         }
         $actionBar = new \Widgets\RawHtml();
         $actionBar->setHtml($content->get());
         $frameResponseObject->addWidget($actionBar);
         $tabBar = new \Widgets\TabBar();
         $tabBar->setTabs(array(array("name" => "Überblick", "link" => $this->getExtension()->getExtensionUrl() . "overview/" . $workplanContainer->get_id()), array("name" => "Tabelle", "link" => $this->getExtension()->getExtensionUrl() . "listView/" . $workplanContainer->get_id()), array("name" => "Gantt-Diagramm", "link" => $this->getExtension()->getExtensionUrl() . "ganttView/" . $workplanContainer->get_id()), array("name" => "Mitarbeiter", "link" => $this->getExtension()->getExtensionUrl() . "users/" . $workplanContainer->get_id()), array("name" => "Snapshots", "link" => $this->getExtension()->getExtensionUrl() . "snapshots/" . $workplanContainer->get_id())));
         $tabBar->setActiveTab(0);
         $frameResponseObject->addWidget($tabBar);
         $content = $workplanExtension->loadTemplate("workplan_overview.template.html");
         if (isset($_POST["edit"])) {
             $edit = $_POST["edit"];
         } else {
             $edit = 0;
         }
         // if the user clicked on the edit symbol in Index-Command-View display edit view
         if ($edit == 1) {
             $content->setCurrentBlock("BLOCK_WORKPLAN_OVERVIEW_TABLE_EDIT");
             $content->setVariable("WORKPLAN_OVERVIEW_EDIT", "Eigenschaften bearbeiten");
             $content->setVariable("NAME_LABEL", "Projektname:*");
             $content->setVariable("START_LABEL", "Beginn:*");
             $content->setVariable("END_LABEL", "Ende:");
             $content->setVariable("CREATOR_LABEL", "Projektersteller:");
             $content->setVariable("DESCRIPTION_LABEL", "Beschreibung:");
             $content->setVariable("NAME_VALUE", $workplanContainer->get_name());
             $content->setVariable("START_VALUE", date("d.m.Y", (int) $workplanContainer->get_attribute("WORKPLAN_START")));
             $content->setVariable("CREATOR_VALUE", $workplanContainer->get_creator()->get_full_name());
             if ($workplanContainer->get_attribute("WORKPLAN_END") != -1) {
                 $content->setVariable("END_VALUE", date("d.m.Y", (int) $workplanContainer->get_attribute("WORKPLAN_END")));
             }
             if (in_array("WORKPLAN_DESCRIPTION", $workplanContainer->get_attribute_names())) {
                 $content->setVariable("DESCRIPTION_VALUE", $workplanContainer->get_attribute("WORKPLAN_DESCRIPTION"));
             }
             $content->setVariable("LABEL_SAVE", "Speichern");
             $content->setVariable("LABEL_BACK", "Abbrechen");
             $content->setVariable("WORKPLAN_ID", $workplanContainer->get_id());
             $content->parse("BLOCK_WORKPLAN_OVERVIEW_TABLE_EDIT");
             // else display normal view
         } else {
             $content->setCurrentBlock("BLOCK_WORKPLAN_OVERVIEW_TABLE");
             $content->setVariable("WORKPLAN_OVERVIEW_ATTRIBUTE", "Eigenschaft");
             $content->setVariable("WORKPLAN_OVERVIEW_VALUE", "Wert");
             $content->setVariable("NAME_LABEL", "Projektname");
             $content->setVariable("START_LABEL", "Beginn");
             $content->setVariable("END_LABEL", "Ende");
             $content->setVariable("CREATOR_LABEL", "Projektersteller");
             $content->setVariable("DESCRIPTION_LABEL", "Beschreibung");
             $content->setVariable("NAME_VALUE", $workplanContainer->get_name());
             $content->setVariable("START_VALUE", date("d.m.Y", (int) $workplanContainer->get_attribute("WORKPLAN_START")));
             $content->setVariable("CREATOR_VALUE", $workplanContainer->get_creator()->get_full_name());
             if ($workplanContainer->get_attribute("WORKPLAN_END") != -1) {
                 $content->setVariable("END_VALUE", date("d.m.Y", (int) $workplanContainer->get_attribute("WORKPLAN_END")));
             } else {
                 $content->setVariable("END_VALUE", "-");
             }
             if (in_array("WORKPLAN_DESCRIPTION", $workplanContainer->get_attribute_names())) {
                 if (strlen(trim($workplanContainer->get_attribute("WORKPLAN_DESCRIPTION"))) > 0) {
                     $content->setVariable("DESCRIPTION_VALUE", nl2br($workplanContainer->get_attribute("WORKPLAN_DESCRIPTION")));
                 } else {
                     $content->setVariable("DESCRIPTION_VALUE", "-");
                 }
             } else {
                 $content->setVariable("DESCRIPTION_VALUE", "-");
             }
             $content->parse("BLOCK_WORKPLAN_OVERVIEW_TABLE");
         }
         $rawWidget = new \Widgets\RawHtml();
         $rawWidget->setHtml($content->get());
         $frameResponseObject->setTitle("Projektplan: " . $workplanContainer->get_name());
         $frameResponseObject->setHeadline(array(array("link" => $this->getExtension()->getExtensionUrl(), "name" => "Projektplanverwaltung"), array("", "name" => $workplanContainer->get_name())));
         $frameResponseObject->addWidget($rawWidget);
         return $frameResponseObject;
     }
 }
Beispiel #23
0
 public function execute(\FrameResponseObject $frameResponseObject)
 {
     //CODE FOR ALL COMMANDS OF THIS PAKAGE END
     $user = \lms_steam::get_current_user();
     // Disable caching
     // TODO: Work on cache handling. An enabled cache leads to bugs
     // if used with the wiki.
     \CacheSettings::disable_caching();
     if (!($wiki_container = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id))) {
         include "bad_link.php";
         exit;
     }
     if (!$wiki_container instanceof \steam_container) {
         $wiki_doc = $wiki_container;
         $wiki_container = $wiki_doc->get_environment();
         if ($wiki_doc->get_attribute(DOC_MIME_TYPE) != "text/wiki") {
             include "bad_link.php";
             exit;
         }
     }
     //CODE FOR ALL COMMANDS OF THIS PAKAGE END
     $version_doc = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->params[1]);
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         $problems = "";
         try {
             $new_content = $version_doc->get_content();
             $wiki_doc->set_content($new_content);
         } catch (Exception $ex) {
             $problems = $ex->get_message();
         }
         if (empty($problems)) {
             $_SESSION["confirmation"] = str_replace("%VERSION", $version_doc->get_version(), gettext("Version %VERSION recovered."));
             header("Location: " . PATH_URL . "wiki/viewentry/" . $wiki_doc->get_id() . "/");
             exit;
         } else {
             $frameResponseObject->setProblemDescription($problems);
             //$portal->set_problem_description( $problems, $hints );
         }
     }
     $backlink = PATH_URL . "wiki/viewentry/" . $wiki_doc->get_id() . "/";
     $content = \Wiki::getInstance()->loadTemplate("wiki_recover_version.template.html");
     //$content = new HTML_TEMPLATE_IT();
     //$content->loadTemplateFile( PATH_TEMPLATES . "wiki_recover_version.template.html" );
     $content->setVariable("BACK_LINK", $backlink);
     $content->setVariable("INFO_TEXT", gettext("A new version will be created from the one you are recovering. The actual version will not be lost. Is that what you want?"));
     $content->setVariable("LABEL_OK", gettext("Yes, Recover version"));
     $content->setVariable("BACKLINK", "<a href=\"{$backlink}\">" . gettext("back") . "</a>");
     $rootlink = \lms_steam::get_link_to_root($wiki_container);
     WIKI_FULL_HEADLINE ? $headline = array($rootlink[0], $rootlink[1], array("link" => $rootlink[1]["link"] . "communication/", "name" => gettext("Communication")), array("name" => h($wiki_container->get_name()), "link" => PATH_URL . "wiki/" . $wiki_container->get_id() . "/"), array("link" => PATH_URL . "wiki/" . $wiki_doc->get_id() . "/", "name" => str_replace(".wiki", "", h($wiki_doc->get_name()))), array("link" => "", "name" => str_replace("%VERSION", $version_doc->get_version(), gettext("Recover version %VERSION")))) : ($headline = array(array("name" => h($wiki_container->get_name()), "link" => PATH_URL . "wiki/" . $wiki_container->get_id() . "/"), array("link" => PATH_URL . "wiki/" . $wiki_doc->get_id() . "/", "name" => str_replace(".wiki", "", h($wiki_doc->get_name()))), array("link" => "", "name" => str_replace("%VERSION", $version_doc->get_version(), gettext("Recover version %VERSION")))));
     $frameResponseObject->setHeadline($headline);
     $widget = new \Widgets\RawHtml();
     $widget->setHtml($content->get());
     $frameResponseObject->addWidget($widget);
     return $frameResponseObject;
     /*$portal->set_page_main(
     		$headline,
     		$content->get()
     		);
     		$portal->show_html();
     		*/
 }
Beispiel #24
0
 public function execute(\FrameResponseObject $frameResponseObject)
 {
     //CODE FOR ALL COMMANDS OF THIS PAKAGE END
     $user = \lms_steam::get_current_user();
     // Disable caching
     // TODO: Work on cache handling. An enabled cache leads to bugs
     // if used with the wiki.
     \CacheSettings::disable_caching();
     if (!($wiki_container = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id))) {
         include "bad_link.php";
         exit;
     }
     if (!$wiki_container instanceof \steam_container) {
         $wiki_doc = $wiki_container;
         $wiki_container = $wiki_doc->get_environment();
         if ($wiki_doc->get_attribute(DOC_MIME_TYPE) != "text/wiki") {
             include "bad_link.php";
             exit;
         }
     }
     //CODE FOR ALL COMMANDS OF THIS PAKAGE END
     $wiki_html_handler = new \lms_wiki($wiki_container);
     $wiki_html_handler->set_admin_menu("mediathek", $wiki_container);
     $content = \Wiki::getInstance()->loadTemplate("wiki_mediathek.template.html");
     //$content = new HTML_TEMPLATE_IT();
     //$content->loadTemplateFile( PATH_TEMPLATES . "wiki_mediathek.template.html" );
     // get images
     $inventory = $wiki_container->get_inventory();
     if (!is_array($inventory)) {
         $inventory = array();
     }
     if (sizeof($inventory) > 0) {
         \steam_factory::load_attributes($GLOBALS["STEAM"]->get_id(), $inventory, array(OBJ_NAME, OBJ_DESC, DOC_MIME_TYPE));
         $images = array();
         foreach ($inventory as $object) {
             $mime = strtolower($object->get_attribute(DOC_MIME_TYPE));
             if ($mime === "image/jpg" || $mime === "image/jpeg" || $mime === "image/gif" || $mime === "image/png") {
                 $images[] = $object;
             }
         }
         foreach ($images as $image) {
             $actions = '<a href="' . PATH_URL . 'doc/' . $image->get_id() . '/">' . gettext("show properties") . '</a><br>';
             $actions .= '<a href="' . PATH_URL . 'doc/' . $image->get_id() . '/edit/">' . gettext("edit properties") . '</a><br>';
             $actions .= '<a href="' . PATH_URL . 'doc/' . $image->get_id() . '/deleteImage/" onclick="return confirmDeletion();">' . gettext("delete image") . '</a>';
             $imageData = imagecreatefromstring($image->get_content());
             $width = $newWidth = imagesx($imageData);
             $height = $newHeight = imagesy($imageData);
             if ($width > 160) {
                 $newHeight = (int) ($height * 160 / $width);
                 $newWidth = 160;
             }
             if ($newHeight > 80) {
                 $newWidth = (int) ($newWidth * 80 / $newHeight);
                 $newHeight = 80;
             }
             $content->setCurrentBlock("BLOCK_IMAGE");
             $content->setVariable("IMAGE_NAME", $image->get_name());
             $content->setVariable("IMAGE_ID", $image->get_id());
             $content->setVariable("IMAGE_DESCRIPTION", $image->get_attribute('OBJ_DESC'));
             $content->setVariable("IMAGE_LINK", PATH_URL . "download/image/" . $image->get_id() . "/" . $newWidth . "/" . $newHeight . "/");
             $content->setVariable("PREVIEW_LINK", "javascript:showBox(" . $image->get_id() . "," . $width . "," . $height . ");");
             $content->setVariable("IMAGE_ACTIONS", $actions);
             $content->parse("BLOCK_IMAGE");
         }
     }
     $question = gettext("Do you really want to delete this image?");
     $note = gettext("NOTE: All wiki-entries containing this image have to be updated manually!");
     $content->setVariable("QUESTION", $question);
     $content->setVariable("NOTE", $note);
     $content->setVariable("LABEL_CLOSE", gettext("close"));
     $content->setVariable("BACK_LINK", PATH_URL . "wiki/index/" . $wiki_container->get_id() . "/");
     $content->setVariable("BACK_LABEL", gettext("back"));
     $wiki_html_handler->set_main_html($content->get());
     // breadcrumbs
     $rootlink = \lms_steam::get_link_to_root($wiki_container);
     WIKI_FULL_HEADLINE ? $headline = array($rootlink[0], $rootlink[1], array("link" => $rootlink[1]["link"] . "communication/", "name" => gettext("Communication")), array("name" => h($wiki_container->get_name()), "link" => PATH_URL . "wiki/index/" . $wiki_container->get_id() . "/"), array("link" => "", "name" => gettext("Mediathek"))) : ($headline = array(array("name" => h($wiki_container->get_name()), "link" => PATH_URL . "wiki/index/" . $wiki_container->get_id() . "/"), array("link" => "", "name" => gettext("Mediathek"))));
     /*$portal->set_page_main(
     		$headline,
     		$wiki_html_handler->get_html()
     		);
     		$portal->show_html();
     		*/
     $frameResponseObject->setHeadline($headline);
     $widget = new \Widgets\RawHtml();
     $widget->setHtml($wiki_html_handler->get_html());
     $frameResponseObject->addWidget($widget);
     return $frameResponseObject;
 }
Beispiel #25
0
 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_configuration.template.html");
     $group = $TCR->get_attribute("TCR_GROUP");
     $members = $group->get_members();
     $admins = $TCR->get_attribute("TCR_ADMINS");
     $users = $TCR->get_attribute("TCR_USERS");
     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();
     }
     if ($group->get_name() == "learners") {
         $parent = $group->get_parent_group();
         $groupname = $parent->get_attribute("OBJ_DESC") . " (" . $parent->get_name() . ")";
         $subgroups = $parent->get_subgroups();
         foreach ($subgroups as $subgroup) {
             if ($subgroup->get_name() == "staff") {
                 $staff = $subgroup->get_members();
                 foreach ($staff as $staffMember) {
                     if ($staffMember instanceof \steam_user) {
                         array_push($members, $staffMember);
                     }
                 }
                 break;
             }
         }
     } else {
         $groupname = $group->get_name();
     }
     // configuration form got submitted
     if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST["change_configuration"])) {
         $TCR->set_attribute("OBJ_DESC", $_POST["title"]);
         if (intval($_POST["rounds"]) > 0) {
             $TCR->set_attribute("TCR_ROUNDS", $_POST["rounds"]);
         }
         if (isset($_POST["admin"])) {
             $admins_post = $_POST["admin"];
         } else {
             $admins_post = array();
         }
         if (isset($_POST["member"])) {
             $members_post = $_POST["member"];
         } else {
             $members_post = array();
         }
         foreach ($members as $member) {
             if ($member instanceof \steam_user) {
                 if (!array_key_exists($member->get_id(), $admins_post)) {
                     $admins_post[$member->get_id()] = "off";
                 }
                 if (!array_key_exists($member->get_id(), $members_post)) {
                     $members_post[$member->get_id()] = "off";
                 }
             }
         }
         $former_admins_post = $_POST["formeradmin"];
         $former_members_post = $_POST["formermember"];
         foreach ($members as $member) {
             if ($member instanceof \steam_user) {
                 // set new admin rights
                 if ($admins_post[$member->get_id()] != $former_admins_post[$member->get_id()] && $member->get_id() != $TCR->get_creator()->get_id()) {
                     if ($admins_post[$member->get_id()] == "off" && $former_admins_post[$member->get_id()] == "on") {
                         unset($admins[array_search($member->get_id(), $admins)]);
                         $admins = array_values($admins);
                     } else {
                         if ($admins_post[$member->get_id()] == "on" && $former_admins_post[$member->get_id()] == "off") {
                             array_push($admins, $member->get_id());
                         }
                     }
                 }
                 // set new members
                 if ($members_post[$member->get_id()] != $former_members_post[$member->get_id()]) {
                     if ($members_post[$member->get_id()] == "off" && $former_members_post[$member->get_id()] == "on") {
                         unset($users[array_search($member->get_id(), $users)]);
                         $users = array_values($users);
                     } else {
                         if ($members_post[$member->get_id()] == "on" && $former_members_post[$member->get_id()] == "off") {
                             array_push($users, $member->get_id());
                         }
                     }
                 }
             }
         }
         $TCR->set_attribute("TCR_ADMINS", $admins);
         $TCR->set_attribute("TCR_USERS", $users);
     }
     // display error message if current user is no admin
     if (!in_array($user->get_id(), $admins)) {
         $actionbar = new \Widgets\Actionbar();
         $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);
         $rawWidget = new \Widgets\RawHtml();
         $rawWidget->setHtml("<center>Zugang verwehrt. Sie sind kein Administrator in diesem Thesen-Kritik-Replik-Verfahren</center>");
         $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" => "Konfiguration")));
         return $frameResponseObject;
     }
     // display actionbar
     $actionbar = new \Widgets\Actionbar();
     $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));
     $actionbar->setActions($actions);
     $frameResponseObject->addWidget($actionbar);
     // display configuration table
     $content->setCurrentBlock("BLOCK_TCR_CONFIGURATION");
     $content->setVariable("TCR_OPTIONS", "Thesen-Kritik-Replik-Verfahren Konfiguration");
     $content->setVariable("TITLE_LABEL", "Titel");
     $content->setVariable("TITLE_VALUE", $TCR->get_attribute("OBJ_DESC"));
     $content->setVariable("ROUNDS_LABEL", "Runden");
     $content->setVariable("ROUNDS_VALUE", $TCR->get_attribute("TCR_ROUNDS"));
     $content->setVariable("GROUP_LABEL", "Arbeitsgruppe");
     $content->setVariable("GROUP_VALUE", $groupname);
     // user management
     $content->setVariable("USERS_LABEL", "Benutzerverwaltung");
     $content->setVariable("USER_LABEL", "Name");
     $content->setVariable("ADMIN_LABEL", "Administrator");
     $content->setVariable("MEMBER_LABEL", "Teilnehmer");
     usort($members, "sort_workplans");
     foreach ($members as $member) {
         if ($member instanceof \steam_user) {
             $content->setCurrentBlock("BLOCK_USER");
             $content->setVariable("USER_NAME", $member->get_full_name() . " (" . $member->get_name() . ")");
             $content->setVariable("USER_ID", $member->get_id());
             if (in_array($member->get_id(), $admins)) {
                 $content->setVariable("ADMIN_CHECKED", "checked");
                 if ($member->get_id() == $TCR->get_creator()->get_id()) {
                     $content->setVariable("ADMIN_DISABLED", "disabled");
                 }
                 $content->setVariable("FORMER_ADMIN", "on");
             } else {
                 $content->setVariable("FORMER_ADMIN", "off");
             }
             if (in_array($member->get_id(), $users)) {
                 $content->setVariable("MEMBER_CHECKED", "checked");
                 $content->setVariable("FORMER_MEMBER", "on");
             } else {
                 $content->setVariable("FORMER_MEMBER", "off");
             }
             $content->parse("BLOCK_USER");
         }
     }
     $content->setVariable("SAVE_CHANGES", "Änderungen speichern");
     $content->parse("BLOCK_TCR_CONFIGURATION");
     $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" => "Konfiguration")));
     return $frameResponseObject;
 }
Beispiel #26
0
 public function execute(\FrameResponseObject $frameResponseObject)
 {
     $timestamp = $this->params[1];
     //$portal = \lms_portal::get_instance();
     //$portal->initialize( GUEST_NOT_ALLOWED );
     $user = \lms_steam::get_current_user();
     //$path = $request->getPath();
     $STEAM = $GLOBALS["STEAM"];
     $weblogId = $this->params[0];
     $weblog = \steam_factory::get_object($STEAM->get_id(), $weblogId);
     //if ( ! $weblog = steam_factory::get_object( $STEAM->get_id(), $_GET[ "id" ] ) )
     //{
     //	include( "bad_link.php" );
     //	exit;
     //}
     if (!$weblog instanceof \steam_calendar) {
         if ($weblog instanceof \steam_container) {
             $category = $weblog;
             $categories = $category->get_environment();
             $weblog = new \steam_weblog($GLOBALS["STEAM"], $categories->get_environment()->get_id());
         } elseif ($weblog instanceof \steam_date) {
             $date = $weblog;
             $weblog = new \steam_weblog($GLOBALS["STEAM"], $date->get_environment()->get_id());
         } else {
             include "bad_link.php";
             exit;
         }
     } else {
         $weblog = new \steam_weblog($GLOBALS["STEAM"]->get_id(), $weblogId);
         define("OBJ_ID", $weblogId);
         if (!$weblog->check_access_read($user)) {
             throw new \Exception("No rights to view this.", E_USER_RIGHTS);
         }
     }
     $weblog_html_handler = new \lms_weblog($weblog);
     $weblog_html_handler->set_widget_categories();
     $weblog_html_handler->set_widget_archive();
     $first_of_month = $timestamp;
     $last_of_month = strtotime("-1 day", strtotime("+1 month", $first_of_month));
     $date_objects = $weblog->get_date_objects((int) $first_of_month, (int) $last_of_month);
     // $date_objects = $weblog->get_date_objects( );
     $no_entries = count($date_objects);
     //TODO: PAGINATOR REINKNALLEN
     $pageIterator = \lms_portal::get_paginator(5, $no_entries, gettext("%TOTAL entries in this archive."));
     //$content->setVariable("PAGEITERATOR", $pageIterator["html"]);
     $start = $pageIterator["startIndex"];
     //$start = $portal->set_paginator( 5, $no_entries, gettext( "%TOTAL entries in this archive." ) );
     $end = $start + 5 > $no_entries ? $no_entries : $start + 5;
     $weblog_html_handler->print_entries($date_objects, TRUE);
     //$portal->set_rss_feed( PATH_URL . "services/feeds/weblog_public.php?id=" . OBJ_ID , gettext( "Feed" ), str_replace( "%l", (isset($login))?$login:'', gettext( "Subscribe to this forum's Newsfeed" ) ) );
     $rootlink = \lms_steam::get_link_to_root($weblog);
     $headline = array($rootlink[0], $rootlink[1], array("link" => $rootlink[1]["link"] . "communication/", "name" => gettext("Communication")), array("name" => h($weblog->get_name()), "link" => PATH_URL . "weblog/" . $weblog->get_id() . "/"), array("link" => "", "name" => strftime("%B %G", $timestamp)));
     //$portal->set_page_main(
     //	$headline,
     //	$weblog_html_handler->get_html()
     //);
     $frameResponseObject->setHeadline($headline);
     $widget = new \Widgets\RawHtml();
     $widget->setHtml($weblog_html_handler->get_html());
     $frameResponseObject->addWidget($widget);
     return $frameResponseObject;
 }
Beispiel #27
0
 public function execute(\FrameResponseObject $frameResponseObject)
 {
     //$portal = \lms_portal::get_instance();
     //$portal->initialize( GUEST_NOT_ALLOWED );
     //$portal->set_guest_allowed( GUEST_NOT_ALLOWED );
     $user = \lms_steam::get_current_user();
     //$portal_user = $portal->get_user();
     //$path = $request->getPath();
     $current_semester = $this->params[1];
     $group_course = \steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), "Courses." . $this->params[0] . "." . $this->params[1]);
     $group = new \koala_group_course($group_course);
     //$html_handler_course = new \koala_html_course($course);
     if (!$group instanceof \koala_group) {
         throw new \Exception("Variable group not set.");
     }
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         if (isset($_POST["remove"]) && is_array($_POST["remove"])) {
             $id = key($_POST["remove"]);
             $member_to_kick = \steam_factory::username_to_object($GLOBALS["STEAM"]->get_id(), $id);
             $group->remove_member($member_to_kick);
             $frameResponseObject->setConfirmText(str_replace("%NAME", h($member_to_kick->get_attribute("USER_FIRSTNAME")) . " " . h($member_to_kick->get_attribute("USER_FULLNAME")), gettext("User %NAME successfully removed from group members.")));
             //$portal->set_confirmation( str_replace( "%NAME", h($member_to_kick->get_attribute( "USER_FIRSTNAME" ))." " . h($member_to_kick->get_attribute( "USER_FULLNAME" )), gettext( "User %NAME successfully removed from group members." ) ) );
             // clear caches:
             $cache = get_cache_function($member_to_kick->get_name());
             $cache->drop("lms_steam::user_get_groups", $member_to_kick->get_name(), TRUE);
             $cache->drop("lms_steam::user_get_groups", $member_to_kick->get_name(), FALSE);
             $cache->drop("lms_steam::user_get_profile", $member_to_kick->get_name());
             $cache->drop("lms_portal::get_menu_html", $member_to_kick->get_name(), TRUE);
             $cache = get_cache_function($group->get_id());
             $cache->drop("lms_steam::group_get_members", $group->get_id());
         } else {
             if (isset($_POST["hide"]) && is_array($_POST["hide"])) {
                 $hidden_members = $group->get_steam_group()->get_attribute("COURSE_HIDDEN_STAFF");
                 if (!is_array($hidden_members)) {
                     $hidden_members = array();
                 }
                 $users_to_hide = array_keys($_POST["hide"]);
                 $displayed_staff_members = array();
                 $displayed_staff_members = array_keys($_POST["displayed_staff_member"]);
                 $tmp1_users_to_hide = array_unique(array_merge($hidden_members, $users_to_hide));
                 $tmp2_users_to_hide = array_diff($tmp1_users_to_hide, $displayed_staff_members);
                 $final_users_to_hide = array_unique(array_merge($tmp2_users_to_hide, $users_to_hide));
                 $group->get_steam_group()->set_attribute("COURSE_HIDDEN_STAFF", $final_users_to_hide);
             } else {
                 $hidden_members = $group->get_steam_group()->get_attribute("COURSE_HIDDEN_STAFF");
                 if (!is_array($hidden_members)) {
                     $hidden_members = array();
                 }
                 $displayed_staff_members = array();
                 $displayed_staff_members = array_keys($_POST["displayed_staff_member"]);
                 $users_to_hide = array();
                 $users_to_hide = array_diff($hidden_members, $displayed_staff_members);
                 $group->get_steam_group()->set_attribute("COURSE_HIDDEN_STAFF", $users_to_hide);
             }
             $frameResponseObject->setConfirmText("Sucessfully updated the visibility of course staff");
             //$portal->set_confirmation( "Sucessfully updated the visibility of course staff" );
         }
     }
     $cache = get_cache_function($group->get_id(), CACHE_LIFETIME_STATIC);
     switch (get_class($group)) {
         case "koala_group_course":
             $html_handler_group = new \koala_html_course($group);
             $html_handler_group->set_context("staff");
             //$members = $cache->call( "lms_steam::group_get_members", $group->steam_group_staff->get_id() );
             $members = \lms_steam::group_get_members($group->steam_group_staff->get_id());
             break;
         default:
             $html_handler_group = new \koala_html_group($group);
             $html_handler_group->set_context("staff");
             //$members = $cache->call( "lms_steam::group_get_members", $group->get_id() );
             $members = \lms_steam::group_get_members($group->get_id());
             break;
     }
     $is_admin = $group->is_admin($user);
     $content = \Course::getInstance()->loadTemplate("list_staff.template.html");
     //$content = new HTML_TEMPLATE_IT();
     //$content->loadTemplateFile( PATH_TEMPLATES . "list_staff.template.html" );
     $no_members = count($members);
     //DONE
     if ($no_members > 0) {
         $pageIterator = \lms_portal::get_paginator(10, $no_members, "(" . str_replace("%NAME", h($group->get_name()), gettext("%TOTAL members in %NAME")) . ")");
         $content->setVariable("PAGEITERATOR", $pageIterator["html"]);
         $start = $pageIterator["startIndex"];
         //$start = $portal->set_paginator( $content, 10, $no_members, "(" . str_replace( "%NAME", h($group->get_name()), gettext( "%TOTAL members in %NAME" ) ) . ")" );
         $end = $start + 10 > $no_members ? $no_members : $start + 10;
         $content->setVariable("LABEL_CONTACTS", gettext("staff member") . " (" . str_replace(array("%a", "%z", "%s"), array($start + 1, $end, $no_members), gettext("%a-%z out of %s")) . ")");
         $content->setCurrentBlock("BLOCK_CONTACT_LIST");
         $content->setVariable("LABEL_NAME_POSITION", gettext("Name, position"));
         !COURSE_STAFF_FACULTY_AND_FOCUS or $content->setVariable("LABEL_SUBJECT_AREA", gettext("Origin/Focus"));
         $content->setVariable("LABEL_COMMUNICATION", gettext("Communication"));
         if (\lms_steam::is_koala_admin($user) || !COURSE_KOALAADMIN_ONLY && $is_admin) {
             !COURSE_STAFFLIST_MANAGE or $content->setVariable("TH_MANAGE_CONTACT", gettext("Action"));
             !COURSE_STAFFLIST_HIDE or $content->setVariable("TH_STAFF_MEMBER_VISIBILITY", gettext("hidden"));
             !COURSE_STAFFLIST_HIDE or $content->setVariable("STAFF_MEMBER_VISIBILITY_TITLE", gettext("Selected staff members will not be visible on the course start page."));
         }
         !COURSE_STAFF_EXTENSIONS or $content->setVariable("TH_MANAGE_EXTENSIONS", "Status");
         $content->setVariable("BEGIN_HTML_FORM", "<form method=\"POST\" action=\"\">");
         $content->setVariable("END_HTML_FORM", "</form>");
         $hidden_members = $group->get_steam_group()->get_attribute("COURSE_HIDDEN_STAFF");
         if (!is_array($hidden_members)) {
             $hidden_members = array();
         }
         for ($i = $start; $i < $end; $i++) {
             $member = $members[$i];
             if ($member["USER_TRASHED"] === 1) {
                 continue;
             }
             $content->setCurrentBlock("BLOCK_CONTACT");
             $content->setVariable("CONTACT_LINK", PATH_URL . "user/" . h($member["OBJ_NAME"]) . "/");
             $icon_link = $member["OBJ_ICON"] == 0 ? PATH_STYLE . "images/anonymous.jpg" : PATH_URL . "download/image/" . h($member["OBJ_ICON"]) . "/26/35";
             $content->setVariable("CONTACT_IMAGE", $icon_link);
             $title = !empty($member["USER_ACADEMIC_TITLE"]) ? h($member["USER_ACADEMIC_TITLE"]) . " " : "";
             $content->setVariable("CONTACT_NAME", $title . h($member["USER_FIRSTNAME"]) . " " . h($member["USER_FULLNAME"]));
             if (!COURSE_SHOW_ONLY_EXTERN_MAIL || COURSE_SHOW_ONLY_EXTERN_MAIL && is_string(\steam_factory::get_user($GLOBALS['STEAM']->get_id(), $member["OBJ_NAME"])->get_attribute("USER_EMAIL")) && steam_factory::get_user($GLOBALS['STEAM']->get_id(), $member["OBJ_NAME"])->get_attribute("USER_EMAIL") != "" && steam_factory::get_user($GLOBALS['STEAM']->get_id(), $member["OBJ_NAME"])->get_attribute("USER_FORWARD_MSG") === 1) {
                 $content->setVariable("LINK_SEND_MESSAGE", PATH_URL . "messages_write.php?to=" . h($member["OBJ_NAME"]));
                 $content->setVariable("LABEL_MESSAGE", gettext("Message"));
                 $content->setVariable("LABEL_SEND", gettext("Send"));
             }
             !COURSE_STAFF_FACULTY_AND_FOCUS or $content->setVariable("FACULTY_AND_FOCUS", h($member["USER_PROFILE_FACULTY"]));
             if (\lms_steam::is_koala_admin($user) || !COURSE_KOALAADMIN_ONLY && $is_admin) {
                 !COURSE_STAFFLIST_MANAGE or $content->setVariable("TD_MANAGE_CONTACT", "<td align=\"center\"><input type=\"submit\"  name=\"remove[" . h($member["OBJ_NAME"]) . "]\" value=\"" . gettext("Remove") . "\"/></td>");
                 if (in_array($member["OBJ_ID"], $hidden_members)) {
                     !COURSE_STAFFLIST_HIDE or $content->setVariable("TD_STAFF_MEMBER_VISIBILITY", "<td align=\"center\"><input type=\"checkbox\" name=\"hide[" . $member["OBJ_ID"] . "]\" checked=\"checked\"/>" . "\n\t\t\t<input type=\"hidden\" name=\"displayed_staff_member[" . $member["OBJ_ID"] . "]\" />" . "</td>");
                 } else {
                     !COURSE_STAFFLIST_HIDE or $content->setVariable("TD_STAFF_MEMBER_VISIBILITY", "<td align=\"center\"><input type=\"checkbox\" name=\"hide[" . $member["OBJ_ID"] . "]\" />" . "\n\t\t\t<input type=\"hidden\" name=\"displayed_staff_member[" . $member["OBJ_ID"] . "]\" />" . "</td>");
                 }
             }
             $member_desc = empty($member["OBJ_DESC"]) ? "student" : $member["OBJ_DESC"];
             $status = secure_gettext($member_desc);
             $content->setVariable("OBJ_DESC", h($status));
             if (COURSE_STAFF_EXTENSIONS) {
                 $extensions = $group->get_extensions();
                 $result = "";
                 foreach ($extensions as $extension) {
                     $result .= $extension->get_member_info(\steam_factory::get_user($GLOBALS["STEAM"]->get_id(), $member["OBJ_NAME"]), $group);
                 }
                 $content->setVariable("EXTENSIONS_DATA", $result);
             }
             $content->parse("BLOCK_CONTACT");
         }
         if (\lms_steam::is_koala_admin($user) || !COURSE_KOALAADMIN_ONLY && $is_admin) {
             !COURSE_STAFFLIST_HIDE or $content->setVariable("LABEL_SUBMIT_BUTTON", gettext("Save"));
         }
         $content->parse("BLOCK_CONTACT_LIST");
     } else {
         $content->setVariable("LABEL_NO_MEMBERS", gettext("No staff found."));
     }
     $html_handler_group->set_html_left($content->get());
     //$portal->set_page_main( $html_handler_group->get_headline(), $html_handler_group->get_html() , "" );
     $frameResponseObject->setHeadline($html_handler_group->get_headline());
     $widget = new \Widgets\RawHtml();
     $widget->setHtml($html_handler_group->get_html());
     $frameResponseObject->addWidget($widget);
     return $frameResponseObject;
 }
Beispiel #28
0
 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;
 }
Beispiel #29
0
 public function execute(\FrameResponseObject $frameResponseObject)
 {
     //echo SEMESTER_URL;die;
     //$portal = \lms_portal::get_instance();
     //$portal->initialize( GUEST_NOT_ALLOWED );
     $user = \lms_steam::get_current_user();
     $all_users = \steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), STEAM_ALL_USER);
     $scg = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), STEAM_COURSES_GROUP, CLASS_GROUP);
     $current_semester = \steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), $scg->get_groupname() . "." . STEAM_CURRENT_SEMESTER);
     if (!\lms_steam::is_steam_admin($user) && !lms_steam::is_semester_admin($current_semester, $user)) {
         include "bad_link.php";
         exit;
     }
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         $values = $_POST["values"];
         $problems = "";
         $hints = "";
         if (empty($values["semester"])) {
             throw new Exception("Semester is not given.");
         }
         if (empty($values["id"])) {
             $problems .= gettext("The course ID is missing.") . " ";
             $hints .= gettext("The ID is necessary for unique identification, ordering and finding the course. Please fill this out.") . " ";
         }
         if (!empty($values["access"]) && $values["access"] == PERMISSION_COURSE_PASSWORD && empty($values["password"])) {
             $problems .= gettext("The course password is missing.") . " ";
             $hints .= gettext("You chose to password protect your course. Please provide a password.") . " ";
         }
         if (empty($problems) && !empty($values["get_lsf_infos"])) {
             // INFOS UEBER LSF HOLEN
             $lsf_client = new \hislsf_soap();
             unset($_SESSION["LSF_COURSE_INFO"]);
             // TODO: SEMESTER DYNAMISCH SETZEN
             $result = $lsf_client->get_available_courses(SYNC_HISLSF_SEMESTER, $values["id"]);
             if (isset($result->veranstaltung)) {
                 if (count($result->veranstaltung) == 1) {
                     header("Location: " . PATH_URL . "course/create" . "/" . $current_semester->get_name() . "/?lsf_course_id=" . $result->veranstaltung->Veranstaltungsschluessel);
                     exit;
                 } else {
                     header("Location: " . PATH_URL . "course" . "/" . $current_semester->get_name() . "/hislsf/" . $values["id"] . "/");
                     exit;
                 }
             } else {
                 $problems = "Keine Veranstaltungen im LSF unter dieser Nummer gefunden.";
             }
         }
         if (empty($problems)) {
             if (empty($values["name"])) {
                 $problems .= gettext("The course name is missing.") . " ";
                 $hints .= gettext("A name is necessary for identification.") . " ";
             }
             if (strpos($values['id'], '.')) {
                 $problems .= gettext("Please don't use the \".\"-char in the course ID.") . ' ';
             }
             if (empty($values["tutors"])) {
                 $values["tutors"] = "NN";
             }
             if (empty($problems)) {
                 if (!isset($values["hislsf"]) || !$values["hislsf"]) {
                     $values["lsf_id"] = "";
                 }
                 $max_members = -1;
                 if ($values["lsf_id"] === "") {
                     if (!empty($values["maxsize"]) && trim($values["maxsize"]) != "" && preg_match('/[^-.0-9]/', trim($values["maxsize"]))) {
                         $problems .= gettext("Invalid max number of participants.") . " ";
                         $hints .= gettext("Please enter a valid number for the max number of participants.") . " " . gettext("Please note that the input of a '0' or to leave the field blank means no limitation.") . " ";
                     } else {
                         if (!empty($values["maxsize"]) && trim($values["maxsize"]) != "" && trim($values["maxsize"]) < 0) {
                             $problems .= gettext("Invalid max number of participants.") . " ";
                             $hints .= gettext("Please enter a number equal or greater than '0' for the max number of participants.") . " " . gettext("Please note that the input of a '0' or to leave the field blank means no limitation.") . " ";
                         } else {
                             if (isset($values["maxsize"])) {
                                 if (trim($values["maxsize"]) === "") {
                                     $max_members = 0;
                                 } else {
                                     $max_members = (int) trim($values["maxsize"]);
                                 }
                             }
                         }
                     }
                 }
                 if (empty($problems)) {
                     try {
                         $new_course = \steam_factory::create_group($GLOBALS["STEAM"]->get_id(), $values["id"], $current_semester, FALSE, $values["name"]);
                     } catch (Exception $e) {
                         $problems .= gettext("The course ID already exists.") . " ";
                         $hints .= gettext("The ID is necessary for unique identification, ordering and finding the course. This ID already exists.") . " ";
                     }
                     if (empty($problems)) {
                         $new_course->set_attributes(array("OBJ_TYPE" => "course", "COURSE_PARTICIPANT_MNGMNT" => $obj_type, "COURSE_SEMESTER" => $values["semester"], "COURSE_TUTORS" => $values["tutors"], "COURSE_SHORT_DSC" => $values["short_dsc"], "COURSE_LONG_DSC" => $values["long_dsc"], "COURSE_HISLSF_ID" => $values["lsf_id"]));
                         $learners = \steam_factory::create_group($GLOBALS["STEAM"]->get_id(), "learners", $new_course, FALSE, "Participants of course '" . $values["name"] . "'");
                         $learners->set_attribute("OBJ_TYPE", "course_learners");
                         $staff = \steam_factory::create_group($GLOBALS["STEAM"]->get_id(), "staff", $new_course, FALSE, "Tutors of course '" . $values["name"] . "'");
                         $staff->set_attribute("OBJ_TYPE", "course_staff");
                         $staff->add_member($user);
                         $admins = \steam_factory::create_group($GLOBALS["STEAM"]->get_id(), "admins", $new_course, FALSE, "Admins of course '" . $values["name"] . "'");
                         $admins->set_attribute("OBJ_TYPE", "course_admins");
                         // uncomment below if koala can handle admins vs tutors
                         //$admins->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);
                         if (!isset($values["hislsf"]) || !$values["hislsf"]) {
                             $access = $values["access"];
                             $koala_course->set_access($access, $learners, $staff, $admins, KOALA_GROUP_ACCESS);
                             if (isset($values["password"]) && $access == PERMISSION_COURSE_PASSWORD) {
                                 $koala_course->get_group_learners()->set_password($values["password"]);
                             } else {
                                 $koala_course->get_group_learners()->set_password("");
                             }
                         } else {
                             $koala_course->set_access(PERMISSION_COURSE_HISLSF, $learners, $staff, $admins, KOALA_GROUP_ACCESS);
                         }
                         if ($max_members > -1) {
                             $learners->set_attribute(GROUP_MAXSIZE, $max_members);
                         }
                         // RIGHTS MANAGEMENT =======================================
                         // extensions:
                         if (isset($_POST["extensions_available"]) && !empty($_POST["extensions_available"])) {
                             $extensions_available = explode("/", $_POST["extensions_available"]);
                             if (isset($_POST["extensions_enabled"])) {
                                 $extensions_enabled = $_POST["extensions_enabled"];
                             } else {
                                 $extensions_enabled = array();
                             }
                             if (isset($_POST["extensions_enabled_add"])) {
                                 $extensions_enabled = array_merge($extensions_enabled, explode("/", $_POST["extensions_enabled_add"]));
                             }
                             if (is_array($extensions_available)) {
                                 foreach ($extensions_available as $extension_name) {
                                     $extension = \lms_steam::get_extensionmanager()->get_extension($extension_name);
                                     if (!is_object($extension)) {
                                         continue;
                                     }
                                     if (array_search($extension_name, $extensions_enabled) === FALSE) {
                                         $extension->disable_for($koala_course);
                                     } else {
                                         $extension->enable_for($koala_course);
                                     }
                                 }
                             }
                         }
                         $cache = get_cache_function("ORGANIZATION");
                         $cache->drop("lms_steam::semester_get_courses", $current_semester->get_id());
                         header("Location: " . PATH_URL . "semester/index" . "/" . $current_semester->get_name() . "/" . $new_course->get_name() . "/");
                         exit;
                     }
                 }
             }
         }
         if (!empty($problems)) {
             $frameResponseObject->setConfirmText($problems, $hints);
             //$portal->set_problem_description( $problems, $hints );
         }
     }
     if (!empty($_GET["lsf_course_id"])) {
         $lsf_client = new hislsf_soap();
         $course_infos = $lsf_client->get_course_information(SYNC_HISLSF_SEMESTER, $_GET["lsf_course_id"]);
         if (empty($course_infos) && empty($problems)) {
             $frameResponseObject->setConfirmText(gettext("Error getting course data from HIS/LSF."));
             //$portal->set_problem_description(gettext("Error getting course data from HIS/LSF.") );
         } else {
             if (empty($course_infos["course_dsc"])) {
                 $course_infos["course_dsc"] = "keine Beschreibung vorhanden.";
             } else {
                 $course_infos["course_dsc"] = unhtmlentities($course_infos["course_dsc"]);
             }
             $values = array("lsf_id" => $course_infos["course_lsf_id"], "id" => $course_infos["course_id"], "name" => $course_infos["course_name"], "tutors" => $course_infos["course_tutors"], "short_dsc" => $course_infos["course_type"], "long_dsc" => $course_infos["course_dsc"]);
         }
         $_SESSION["LSF_COURSE_INFO"] = "";
     }
     $content = \Course::getInstance()->loadTemplate("courses_create.template.html");
     //$content = new HTML_TEMPLATE_IT();
     //$content->loadTemplateFile( PATH_TEMPLATES . "courses_create.template.html" );
     $content->setVariable("FORM_ACTION", PATH_URL . "course/create" . "/" . $current_semester->get_name() . "/");
     $content->setVariable("VALUE_SEMESTER", h($current_semester->get_name()));
     //$content->setVariable( "INFO_TEXT", gettext( "Creating a course means..." ) );
     $content->setVariable("CONFIRMATION_TEXT", str_replace("%SEMESTER", h($current_semester->get_attribute("OBJ_DESC")), gettext("You are going to create a new course in <b>%SEMESTER</b>.")) . " " . gettext("Please fill out the requested meta data at first.") . " " . gettext("At the bottom, you can determine the manner of participant management.") . " " . gettext("Also you can add further course admins later on."));
     $content->setVariable("LABEL_GENERAL_INFORMATION", gettext("General Information"));
     $content->setVariable("LABEL_COURSE_ID", gettext("Course ID"));
     $content->setVariable("VALUE_COURSE_ID", isset($values) ? h($values["id"]) : '');
     $content->setVariable("LABEL_COURSE_NAME", gettext("Name"));
     $content->setVariable("VALUE_COURSE_NAME", isset($values) ? h($values["name"]) : '');
     $content->setVariable("LABEL_COURSE_SHORT_INFORMATION", gettext("Short Info"));
     $content->setVariable("VALUE_SHORT_DSC", isset($values) ? h($values["short_dsc"]) : '');
     $content->setVariable("SHORT_DSC_SHOW_UP", gettext("This value will show up in the semester's courses list beside id, name and staff members."));
     $content->setVariable("LABEL_COURSE_TUTORS", gettext("Staff members"));
     $content->setVariable("VALUE_TUTORS", isset($values) ? h($values["tutors"]) : '');
     $content->setVariable("LABEL_LONG_DSC", gettext("Long description"));
     $content->setVariable("LONG_DSC_SHOW_UP", gettext("This is for your course page. Please add information about schedule and locations at least."));
     $content->setVariable("VALUE_LONG_DSC", isset($values) ? h($values["long_dsc"]) : '');
     $content->setVariable("LABEL_BB_BOLD", gettext("B"));
     $content->setVariable("HINT_BB_BOLD", gettext("boldface"));
     $content->setVariable("LABEL_BB_ITALIC", gettext("I"));
     $content->setVariable("HINT_BB_ITALIC", gettext("italic"));
     $content->setVariable("LABEL_BB_UNDERLINE", gettext("U"));
     $content->setVariable("HINT_BB_UNDERLINE", gettext("underline"));
     $content->setVariable("LABEL_BB_STRIKETHROUGH", gettext("S"));
     $content->setVariable("HINT_BB_STRIKETHROUGH", gettext("strikethrough"));
     $content->setVariable("LABEL_BB_IMAGE", gettext("IMG"));
     $content->setVariable("HINT_BB_IMAGE", gettext("image"));
     $content->setVariable("LABEL_BB_URL", gettext("URL"));
     $content->setVariable("HINT_BB_URL", gettext("web link"));
     $content->setVariable("LABEL_BB_MAIL", gettext("MAIL"));
     $content->setVariable("HINT_BB_MAIL", gettext("email link"));
     $content->setVariable("PARTICIPANT_MANAGEMENT", gettext("Participant Management"));
     if (isset($values) && $values["lsf_id"] > 1) {
         $content->setCurrentBlock("HIS_LSF_PM");
         $content->setVariable("LSF_COURSE_ID", isset($values) ? h($values["lsf_id"]) : '');
         $content->setVariable("LSF_COURSE", isset($values) ? h($values["id"]) : '' . " " . isset($values) ? h($values["name"]) : '' . " (" . isset($values) ? h($values["short_dsc"]) : '' . ")");
         if ($values["hislsf"]) {
             $content->setVariable("HISLSF_CHECKED", "CHECKED");
         }
         $content->setVariable("LABEL_HISLSF", "Ja, es soll die Teilnehmerverwaltung des HIS LSF verwendet werden.");
         $content->setVariable("HISLSF_INFO", "Wenn gesetzt, k&ouml;nnen sich Studenten f&uuml;r diesen Kurs nur &uuml;ber das HIS LSF anmelden.");
         $content->parse("HIS_LSF_PM");
     }
     if (!isset($values) || !isset($values["hislsf"])) {
         $content->setCurrentBlock("BLOCK_MAXSIZE");
         $content->setVariable("LABEL_MAXSIZE", gettext("Max number of participants"));
         $content->setVariable("LABEL_MAXSIZE_DSC", gettext("To limit the max number of participants for your course enter a number greater than 0. Leave this field blank or enter a '0' for no limitation."));
         if (isset($values["maxsize"])) {
             $content->setVariable("VALUE_MAXSIZE", h($values["maxsize"]));
         }
         $content->parse("BLOCK_MAXSIZE");
         $content->setCurrentBlock("BLOCK_ACCESS");
         $content->setVariable("PARTICIPANT_MANAGEMENT", gettext("Participant Management"));
     }
     $access = \koala_group_course::get_access_descriptions();
     $access_default = PERMISSION_COURSE_PUBLIC;
     if (is_array($access) && (!isset($values) || !isset($values["hislsf"]))) {
         $content->setCurrentBlock("BLOCK_ACCESS");
         foreach ($access as $key => $array) {
             if ($key != PERMISSION_COURSE_PAUL_SYNC && $key != PERMISSION_UNDEFINED || isset($values) && (int) $values["access"] == PERMISSION_UNDEFINED) {
                 $content->setCurrentBlock("ACCESS");
                 $content->setVariable("LABEL", $array["summary_short"] . ": " . $array["label"]);
                 $content->setVariable("VALUE", $key);
                 if (isset($values) && $key == (int) $values["access"] || empty($values) && $key == $access_default) {
                     $content->setVariable("CHECK", "checked=\"checked\"");
                 }
                 if ($key == PERMISSION_COURSE_PASSWORD) {
                     $content->setVariable("ONCHANGE", "onchange=\"document.getElementById('passworddiv').style.display='block'\"");
                     $content->setCurrentBlock("ACCESS_PASSWORD");
                     $content->setVariable("LABEL_PASSWORD", gettext("Password"));
                     if (!empty($values["password"])) {
                         $content->setVariable("VALUE_PASSWORD", $values["password"]);
                     }
                     if (isset($values["access"]) && $values["access"] == PERMISSION_COURSE_PASSWORD) {
                         $content->setVariable("PASSWORDDIV_DISPLAY", "block");
                     } elseif (!isset($values["access"]) && $access_default == PERMISSION_COURSE_PASSWORD) {
                         $content->setVariable("PASSWORDDIV_DISPLAY", "block");
                     } else {
                         $content->setVariable("PASSWORDDIV_DISPLAY", "none");
                     }
                     $content->parse("ACCESS_PASSWORD");
                 } else {
                     $content->setVariable("ONCHANGE", "onchange=\"document.getElementById('passworddiv').style.display='none'\"");
                 }
                 $content->parse("ACCESS");
             }
         }
         $content->parse("BLOCK_ACCESS");
     }
     // extensions:
     //$extensions = \lms_steam::get_extensionmanager()->get_extensions_by_class( 'koala_group_course' );
     $extensions = 0;
     /*if ( count( $extensions ) > 0 ) {
     			$content->setCurrentBlock( "BLOCK_EXTENSIONS" );
     			$content->setVariable( "LABEL_EXTENSIONS", gettext( "Extensions" ) );
     			$extension_list = array();
     			foreach ( $extensions as $extension ) {
     				if( $extension->get_requirements() === array() )
     				{
     					$extension_name = $extension->get_name();
     					$content->setCurrentBlock( "BLOCK_EXTENSION" );
     					$content->setVariable( "EXTENSION_ID", $extension_name );
     					$content->setVariable( "EXTENSION_NAME", $extension->get_display_name() );
     					$content->setVariable( "EXTENSION_DESC", $extension->get_display_description() );
     					$subextensions = \lms_steam::get_extensionmanager()->get_dependent_extensions($extension);
     					if( count( $subextensions ) > 0 )
     					{
     						$content->setCurrentBlock( "BLOCK_SUBEXTENSIONS" );
     						$content->setVariable( "LABEL_SUBEXTENSIONS", str_replace( "%EXTENSION", h($extension->get_display_name()), gettext( "The following sub-extensions are available for %EXTENSION" ) ));
     						foreach($subextensions as $subextension)
     						{
     							$subextension_name = $subextension->get_name();
     							$content->setCurrentBlock( "BLOCK_SUBEXTENSION" );
     							$content->setVariable( "PARENT_EXTENSION_ID", $extension_name );
     							$content->setVariable( "SUBEXTENSION_ID", $subextension_name );
     							$content->setVariable( "SUBEXTENSION_NAME", $subextension->get_display_name() );
     							$content->setVariable( "SUBEXTENSION_DESC", $subextension->get_display_description() );
     							$content->setVariable( "SUBEXTENSION_DISABLED", "disabled=\"disabled\"" );
     							$content->parse( "BLOCK_SUBEXTENSION" );
     							$extension_list[] = $subextension_name;
     						}
     						$content->parse( "BLOCK_SUBEXTENSIONS" );
     					}
     					$content->parse( "BLOCK_EXTENSION" );
     					$extension_list[] = $extension_name;
     				}
     			}
     			$content->setVariable( "VALUE_EXTENSIONS", implode( "/", $extension_list ) );
     			$content->parse( "BLOCK_EXTENSIONS" );
     		}*/
     $content->setVariable("LABEL_CREATE_COURSE", gettext("Create and finish"));
     $content->setVariable("LABEL_CREATE_ADD_ADMIN", gettext("Create and add further admins"));
     //$portal->set_page_main(
     //array( array( "link" => PATH_URL . SEMESTER_URL . "/" . $current_semester->get_name(). "/", "name" => h($current_semester->get_attribute( "OBJ_DESC" )) ), array( "link" => "", "name" => gettext( "Create new course" ) ) ),
     //$content->get()
     //);
     $frameResponseObject->setHeadline(array(array("link" => PATH_URL . "semester/index" . "/" . $current_semester->get_name() . "/", "name" => h($current_semester->get_attribute("OBJ_DESC"))), array("link" => "", "name" => gettext("Create new course"))));
     $widget = new \Widgets\RawHtml();
     $widget->setHtml($content->get());
     $frameResponseObject->addWidget($widget);
     return $frameResponseObject;
 }
Beispiel #30
0
 public function execute(\FrameResponseObject $frameResponseObject)
 {
     //var_dump($GLOBALS[ "STEAM" ]->get_id());
     //		$portal = \lms_portal::get_instance();
     //		$portal->initialize( GUEST_NOT_ALLOWED );
     $user = \lms_steam::get_current_user();
     //		$path = $request->getPath();
     $STEAM = $GLOBALS["STEAM"];
     $weblogId = $this->id;
     $weblog = \steam_factory::get_object($STEAM->get_id(), $weblogId);
     //if ( ! $weblog = steam_factory::get_object( $STEAM->get_id(), $_GET[ "id" ] ) )
     //{
     //	include( "bad_link.php" );
     //	exit;
     //}
     if (!$weblog instanceof \steam_calendar) {
         if ($weblog instanceof \steam_container) {
             $category = $weblog;
             $categories = $category->get_environment();
             $weblog = new \steam_weblog($GLOBALS["STEAM"]->get_id(), $categories->get_environment()->get_id());
         } elseif ($weblog instanceof \steam_date) {
             $date = $weblog;
             $weblog = new \steam_weblog($GLOBALS["STEAM"]->get_id(), $date->get_environment()->get_id());
         } else {
             include "bad_link.php";
             exit;
         }
     } else {
         $weblog = new \steam_weblog($GLOBALS["STEAM"]->get_id(), $weblogId);
         define("OBJ_ID", $weblogId);
         if (!$weblog->check_access_read($user)) {
             throw new \Exception("No rights to view this.", E_USER_RIGHTS);
         }
     }
     $content = \Weblog::getInstance()->loadTemplate("weblog_entry_edit.template.html");
     //$content = new HTML_TEMPLATE_IT();
     //$content->loadTemplateFile( PATH_TEMPLATES . "weblog_entry_edit.template.html" );
     if ($_SERVER["REQUEST_METHOD"] == "GET") {
         $content->setVariable("BACK_LINK", $_SERVER["HTTP_REFERER"]);
     }
     if ($_SERVER["REQUEST_METHOD"] == "POST" && $date->check_access_write($user)) {
         $values = $_POST["values"];
         if (!empty($values["save"])) {
             $problem = "";
             $hint = "";
             if (empty($values["title"])) {
                 $problem .= gettext("The title is missing.") . "&nbsp;";
                 $hint .= gettext("Please add the missing values.");
             }
             if (empty($values["body"])) {
                 $problem .= gettext("There is no message for your readers.") . "&nbsp;";
                 $hint .= gettext("Please write your post into the text area.");
             }
             if (!empty($values["category"]) && $values["category"] != 0) {
                 $category = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $values["category"]);
                 if (!$category instanceof \steam_container) {
                     throw new \Exception("Not a valid category: " . $values["category"]);
                 }
             } else {
                 $category = "";
             }
             if (!($timestamp = strtotime($values["date"] . ":00"))) {
                 $problem .= gettext("I cannot parse the date and time.");
                 $hint .= gettext("Please verify your date and time format") . ": YYYY-MM-DD HH:MM";
             }
             if (empty($problem)) {
                 require_once "Cache/Lite.php";
                 $cache = new \Cache_Lite(array("cacheDir" => PATH_CACHE));
                 $cache->clean($weblog->get_id());
                 $cache->clean($date->get_id());
                 $attributes = array("DATE_START_DATE" => $timestamp, "DATE_TITLE" => $values["title"], "DATE_DESCRIPTION" => $values["body"]);
                 $date->set_attributes($attributes);
                 $weblog->categorize_entry($date, $category);
                 header("Location: " . $values["return_to"]);
                 exit;
             } else {
                 //TODO: PROBLEMDESCRIPTION
                 //$portal->set_problem_description( $problem, $hint );
             }
         }
         if ($values["preview"]) {
             $content->setCurrentBlock("BLOCK_PREVIEW");
             $content->setVariable("LABEL_PREVIEW_EDIT", gettext("Preview the edit"));
             $content->setVariable("PREVIEW_EDIT", get_formatted_output($values["body"]));
             $content->parse("BLOCK_PREVIEW");
         }
     }
     $content->setVariable("LABEL_HERE_IT_IS", "");
     $content->setVariable("LABEL_DATE", gettext("Date"));
     $content->setVariable("LABEL_SUBJECT", gettext("Subject"));
     $content->setVariable("LABEL_CATEGORY", gettext("Category"));
     $content->setVariable("CAT_NO_SELECTION", gettext("nothing selected"));
     $content->setVariable("LABEL_YOUR_POST", gettext("Your post"));
     $content->setVariable("LABEL_PREVIEW", gettext("Preview"));
     $content->setVariable("LABEL_SAVE_CHANGES", gettext("Save changes"));
     $content->setVariable("LABEL_RETURN", gettext("back"));
     $content->setVariable("LABEL_BB_BOLD", gettext("B"));
     $content->setVariable("HINT_BB_BOLD", gettext("boldface"));
     $content->setVariable("LABEL_BB_ITALIC", gettext("I"));
     $content->setVariable("HINT_BB_ITALIC", gettext("italic"));
     $content->setVariable("LABEL_BB_UNDERLINE", gettext("U"));
     $content->setVariable("HINT_BB_UNDERLINE", gettext("underline"));
     $content->setVariable("LABEL_BB_STRIKETHROUGH", gettext("S"));
     $content->setVariable("HINT_BB_STRIKETHROUGH", gettext("strikethrough"));
     $content->setVariable("LABEL_BB_IMAGE", gettext("IMG"));
     $content->setVariable("HINT_BB_IMAGE", gettext("image"));
     $content->setVariable("LABEL_BB_URL", gettext("URL"));
     $content->setVariable("HINT_BB_URL", gettext("web link"));
     $content->setVariable("LABEL_BB_MAIL", gettext("MAIL"));
     $content->setVariable("HINT_BB_MAIL", gettext("email link"));
     if (isset($values) && count($values)) {
         // FORMULAR WURDE SCHON EINMAL ABGESCHICKT
         $date_value = empty($values["date"]) ? strftime("%Y-%m-%d %H:%M") : $values["date"];
         $content->setVariable("DATE_COMMENT", h($date_value));
         $content->setVariable("TEXT_COMMENT", h($values["body"]));
         $content->setVariable("TITLE_COMMENT", h($values["title"]));
         $cat = $values["category"];
         $content->setVariable("BACK_LINK", $values["return_to"]);
     } else {
         $attribs = $date->get_attributes(array("DATE_START_DATE", "DATE_TITLE", "DATE_DESCRIPTION", "DATE_CATEGORY"));
         $content->setVariable("DATE_COMMENT", strftime("%Y-%m-%d %H:%M", $attribs["DATE_START_DATE"]));
         $content->setVariable("TITLE_COMMENT", h($attribs["DATE_TITLE"]));
         $content->setVariable("TEXT_COMMENT", h($attribs["DATE_DESCRIPTION"]));
         $content->setVariable("TITLE_COMMENT", h($attribs["DATE_TITLE"]));
         $cat = is_object($attribs["DATE_CATEGORY"]) ? $attribs["DATE_CATEGORY"]->get_id() : 0;
     }
     $categories = $weblog->get_categories();
     foreach ($categories as $category) {
         $content->setCurrentBlock("BLOCK_SELECT_CAT");
         $content->setVariable("VALUE_CAT", $category->get_id());
         $content->setVariable("LABEL_CAT", h($category->get_name()));
         if ($category->get_id() == $cat) {
             $content->setVariable("CAT_SELECTED", 'selected="selected"');
         }
         $content->parse("BLOCK_SELECT_CAT");
     }
     $rootlink = \lms_steam::get_link_to_root($weblog);
     $headline = array($rootlink[0], $rootlink[1], array("link" => $rootlink[1]["link"] . "communication/", "name" => gettext("Communication")), array("link" => "", "name" => h($weblog->get_name()), "link" => PATH_URL . "weblog/" . $weblog->get_id() . "/"), array("name" => str_replace("%NAME", h($date->get_attribute("DATE_TITLE")), gettext("Edit '%NAME'?"))));
     /*$portal->set_page_main(
     		$headline,
     		$content->get(),
     		""
     		);
     		return $portal->get_html();*/
     $frameResponseObject->setHeadline($headline);
     $widget = new \Widgets\RawHtml();
     $widget->setHtml($content->get());
     $frameResponseObject->addWidget($widget);
     return $frameResponseObject;
 }