Exemplo n.º 1
0
 public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject)
 {
     if (!isset($this->id)) {
         $ajaxResponseObject->setStatus("ok");
         $jswrapper = new \Widgets\JSWrapper();
         $ids = "";
         $elements = "";
         foreach ($this->elements as $key => $element) {
             if (count($this->elements) > $key + 1) {
                 $ids .= "{\"id\":\"" . $element->get_id() . "\", \"env\":\"" . $this->env . "\"}, ";
                 $elements .= "\"\", ";
             } else {
                 $ids .= "{\"id\":\"" . $element->get_id() . "\", \"env\":\"" . $this->env . "\"}";
                 $elements .= "\"\"";
             }
         }
         $js = "sendMultiRequest('Paste', jQuery.parseJSON('[{$ids}]'), jQuery.parseJSON('[{$elements}]'), 'updater', null, null, 'explorer', 'Füge Objekt ein ...', 0, " . count($this->elements) . ");";
         $jswrapper->setJs($js);
         $ajaxResponseObject->addWidget($jswrapper);
         return $ajaxResponseObject;
     } else {
         $ajaxResponseObject->setStatus("ok");
         $clipboardModel = new \Explorer\Model\Clipboard($this->clipboard);
         $jswrapper = new \Widgets\JSWrapper();
         $js = "document.getElementById('clipboardIconbarWrapper').innerHTML = '" . $clipboardModel->getIconbarHtml() . "';";
         if (count($this->clipboard->get_inventory()) == 0) {
             $js .= "window.location.reload();";
         }
         $jswrapper->setJs($js);
         $ajaxResponseObject->addWidget($jswrapper);
         return $ajaxResponseObject;
     }
 }
Exemplo n.º 2
0
 public function frameResponse(\FrameResponseObject $frameResponseObject)
 {
     $jsWrapper = new \Widgets\JSWrapper();
     $jsWrapper->setJs('self.location.href="' . PATH_URL . "favorite/index/" . '"');
     $frameResponseObject->addWidget($jsWrapper);
     return $frameResponseObject;
 }
Exemplo n.º 3
0
 public function getHtml()
 {
     $reverseSpecialHtmlWidget = new \Widgets\JSWrapper();
     $reverseSpecialHtmlWidget->setJs("function rSHW(value){\n\t\tvalue.replace(/&amp;/g,'&');value.replace(/&amp;/g,'&');\n\t\tvalue.replace(/&quot;/g,'\"');value.replace(/&#039;/g,'\\'');value.replace(/&lt;/g,'<');\n\t\tvalue.replace(/&gt;/g,'>');}");
     $this->id = rand();
     $this->addWidget($reverseSpecialHtmlWidget);
     if (isset($this->label) && trim($this->label) !== "") {
         $this->getContent()->setVariable("LABEL", $this->label . ":");
     } else {
         $this->getContent()->setVariable("LABEL", "");
     }
     $this->getContent()->setVariable("PLACEHOLDER", $this->placeholder);
     if (isset($this->labelWidth)) {
         $this->getContent()->setVariable("LABEL_STYLE", "style=\"width:{$this->labelWidth}px\"");
     }
     $this->getContent()->setVariable("ID", $this->id);
     if ($this->focus) {
         $this->getContent()->setVariable("FOCUS_ID", $this->id);
     }
     if ($this->readOnly) {
         $this->getContent()->setVariable("READONLY", "readonly");
         $this->getContent()->setVariable("ADD_CLASS_LABEL", "readonly");
         $this->getContent()->setVariable("ADD_CLASS_INPUT", "readonly");
     }
     if (isset($this->inputWidth) || isset($this->inputBackgroundColor)) {
         $style = "";
         if (isset($this->inputWidth)) {
             $style .= "width:{$this->inputWidth}px;";
         }
         if (isset($this->inputBackgroundColor)) {
             $style .= "background-color:{$this->inputBackgroundColor}";
         }
         $style = "style=\"{$style}\"";
         $this->getContent()->setVariable("INPUT_STYLE", $style);
     }
     if ($this->contentProvider) {
         if (!$this->contentProvider->isChangeable($this->data)) {
             $this->getContent()->setVariable("READONLY", "readonly");
             $this->getContent()->setVariable("ADD_CLASS_LABEL", "readonly");
             $this->getContent()->setVariable("ADD_CLASS_INPUT", "readonly");
         }
         $valueString = $this->contentProvider->getData($this->data);
         $valueString = $valueString === "0" || $valueString === "" ? "" : $valueString;
         $valueString = htmlspecialchars($valueString);
         $this->getContent()->setVariable("VALUE", $valueString);
         if (!$this->autosave) {
             $this->getContent()->setVariable("CHANGE_FUNCTION", "onClick=\"event.stopPropagation();\" onKeyup=\"if (event.keyCode==13) { value = getElementById({$this->id}).value;rSHW(value); widgets_textinput_save({$this->id});{$this->contentProvider->getUpdateCode($this->data, $this->id, "widgets_textinput_save_success")} } else { widgets_textinput_changed({$this->id});}\"");
             $this->getContent()->setVariable("SAVE_FUNCTION", "onClick=\"event.stopPropagation(); value = jQuery('#{$this->id}').val();rSHW(value); widgets_textinput_save({$this->id});{$this->contentProvider->getUpdateCode($this->data, $this->id, "widgets_textinput_save_success")}\"");
         } else {
             $this->getContent()->setVariable("CHANGE_FUNCTION", "onBlur=\"if (jQuery('#{$this->id}').hasClass('changed')) {value = getElementById({$this->id}).value; widgets_textinput_save({$this->id});{$this->contentProvider->getUpdateCode($this->data, $this->id, "widgets_textinput_save_success")}}\" onClick=\"event.stopPropagation();\" onKeyup=\"if (event.keyCode==13) { value = getElementById({$this->id}).value; widgets_textinput_save({$this->id});{$this->contentProvider->getUpdateCode($this->data, $this->id, "widgets_textinput_save_success")} } else { widgets_textinput_changed_autosave({$this->id});}\"");
         }
         $this->getContent()->setVariable("UNDO_FUNCTION", "onClick=\"event.stopPropagation(); value = jQuery('#{$this->id}').attr('oldValue'); widgets_textinput_save({$this->id});{$this->contentProvider->getUpdateCode($this->data, $this->id, "widgets_textinput_undo_success")}\"");
     } else {
         $valueString = htmlspecialchars($this->value);
         $this->getContent()->setVariable("VALUE", $valueString);
     }
     return $this->getContent()->get();
 }
Exemplo n.º 4
0
    public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject)
    {
        $user = $GLOBALS["STEAM"]->get_current_steam_user();
        if (!isset($this->params["group_course"])) {
            $rawWidget = new \Widgets\RawHtml();
            $rawWidget->setHtml("Error: Kurs oder Gruppe auswählen");
            $ajaxResponseObject->addWidget($rawWidget);
            return $ajaxResponseObject;
        }
        if ($this->params["group_course"] == 1) {
            if (!isset($this->params["course"])) {
                $rawWidget = new \Widgets\RawHtml();
                $rawWidget->setHtml("Error: Kurs oder Gruppe auswählen");
                $ajaxResponseObject->addWidget($rawWidget);
                return $ajaxResponseObject;
            }
            $course = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->params["course"]);
            $subgroups = $course->get_subgroups();
            foreach ($subgroups as $subgroup) {
                if ($subgroup->get_name() == "learners") {
                    $group = $subgroup;
                }
                if ($subgroup->get_name() == "staff") {
                    $staffgroup = $subgroup;
                }
            }
        } else {
            if (!isset($this->params["group"])) {
                $rawWidget = new \Widgets\RawHtml();
                $rawWidget->setHtml("Error: Kurs oder Gruppe auswählen");
                $ajaxResponseObject->addWidget($rawWidget);
                return $ajaxResponseObject;
            }
            $group = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->params["group"]);
            if ($this->params["group_admin"] == 0) {
                $staffgroup = $user;
            } else {
                $staffgroup = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->params["group_admin"]);
            }
        }
        // create data structure and set access rights
        $rapidfeedback = \steam_factory::create_room($GLOBALS["STEAM"]->get_id(), $this->params["title"], $group->get_workroom(), $this->params["desc"]);
        $rapidfeedback->set_attribute("OBJ_TYPE", "RAPIDFEEDBACK_CONTAINER");
        $rapidfeedback->set_attribute("RAPIDFEEDBACK_GROUP", $group);
        $rapidfeedback->set_attribute("RAPIDFEEDBACK_STAFF", $staffgroup);
        $rapidfeedback->set_attribute("RAPIDFEEDBACK_ADMIN_SURVEY", 1);
        $rapidfeedback->set_sanction_all($group);
        $rapidfeedback->set_sanction_all($staffgroup);
        $ajaxResponseObject->setStatus("ok");
        $jswrapper = new \Widgets\JSWrapper();
        $jswrapper->setJs(<<<END
\t\tcloseDialog();
END
);
        $ajaxResponseObject->addWidget($jswrapper);
        return $ajaxResponseObject;
    }
Exemplo n.º 5
0
 public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject)
 {
     $ajaxResponseObject->setStatus("ok");
     $jswrapper = new \Widgets\JSWrapper();
     $js = "jQuery('#{$this->id}').removeClass('red orange yellow green blue purple grey transparent').addClass('{$this->color}');";
     $jswrapper->setJs($js);
     $ajaxResponseObject->addWidget($jswrapper);
     return $ajaxResponseObject;
 }
Exemplo n.º 6
0
 public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject)
 {
     $ajaxResponseObject->setStatus("ok");
     $jswrapper = new \Widgets\JSWrapper();
     $js = "console.log('start');\n\t\t\t   if (jQuery('#explorerWrapper').length == 0) {\n\t\t\t   \tlocation.reload();\n\t\t\t   } else {\n\t\t\t  \t var element = jQuery('#{$this->id}');\n\t\t\t\t   if ('{$this->direction}' == 'up') {\n\t\t\t\t\t\telement.insertBefore(element.prev());\n\t\t\t\t   } else if ('{$this->direction}' == 'down') {\n\t\t\t\t\t\telement.insertAfter(element.next());\n\t\t\t\t   } else if ('{$this->direction}' == 'top') {\n\t\t\t\t   \t\telement.insertBefore(element.parent().children().first());\n\t\t\t\t   } else if ('{$this->direction}' == 'bottom') {\n\t\t\t\t   \t\telement.insertAfter(element.parent().children().last());\n\t\t\t\t   }\n\t\t\t   }\n\t\t       console.log('DOnE');";
     $jswrapper->setJs($js);
     $ajaxResponseObject->addWidget($jswrapper);
     return $ajaxResponseObject;
 }
Exemplo n.º 7
0
 public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject)
 {
     $ajaxResponseObject->setStatus("ok");
     $jswrapper = new \Widgets\JSWrapper();
     $clipboardModel = new \Explorer\Model\Clipboard($this->user);
     $js = "document.getElementById('clipboardIconbarWrapper').innerHTML = '" . $clipboardModel->getIconbarHtml() . "';";
     $jswrapper->setJs($js);
     $ajaxResponseObject->addWidget($jswrapper);
     return $ajaxResponseObject;
 }
Exemplo n.º 8
0
 public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject)
 {
     $ajaxResponseObject->setStatus("ok");
     $jswrapper = new \Widgets\JSWrapper();
     $clipboardModel = new \Explorer\Model\Clipboard($this->user);
     $js = "\n\t\t if (jQuery('#explorerWrapper').length == 0) {\n\t\t\t   \tlocation.reload();\n\t\t\t   }\n\t\t else{\n\t\t       jQuery('#{$this->id}').remove();document.getElementById('clipboardIconbarWrapper').innerHTML = '" . $clipboardModel->getIconbarHtml() . "';\n\t\t\t}";
     $jswrapper->setJs($js);
     $ajaxResponseObject->addWidget($jswrapper);
     return $ajaxResponseObject;
 }
Exemplo n.º 9
0
 public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject)
 {
     $ajaxResponseObject->setStatus("ok");
     $jswrapper = new \Widgets\JSWrapper();
     $trashbinModel = new \Explorer\Model\Trashbin($this->trashbin);
     $js = "jQuery('#{$this->id}').addClass('justTrashed').removeClass('listviewer-item-selected').find('input:checkbox').attr('disabled', 'disabled');\n\t\t\t   var checkbox = document.getElementById('{$this->id}_checkbox');\n\t\t\t   if (!checkbox) {\n\t\t\t   \t\tlocation.reload();\n\t\t\t   } else {\n\t\t\t   \tcheckbox.checked = false;\n\t\t\t   \tdocument.getElementById('{$this->id}').onclick_restore = document.getElementById('{$this->id}').onclick;\n\t\t\t   \tdocument.getElementById('{$this->id}').onclick = \"\";\n\t\t       \tdocument.getElementById('trashbinIconbarWrapper').innerHTML = '" . $trashbinModel->getIconbarHtml() . "';\n\t\t\t   }";
     $jswrapper->setJs($js);
     $ajaxResponseObject->addWidget($jswrapper);
     return $ajaxResponseObject;
 }
Exemplo n.º 10
0
    public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject)
    {
        $ajaxResponseObject->setStatus("ok");
        $jswrapper = new \Widgets\JSWrapper();
        $jswrapper->setJs(<<<END
\t\twindow.location.reload();
END
);
        $ajaxResponseObject->addWidget($jswrapper);
        return $ajaxResponseObject;
    }
Exemplo n.º 11
0
    public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject)
    {
        $idRequestObject = new \IdRequestObject();
        $idRequestObject->setId($this->id);
        $columnObject = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id);
        foreach ($GLOBALS["STEAM"]->get_current_steam_user()->get_inventory() as $steamObject) {
            $portletType = $steamObject->get_attribute("bid:portlet");
            $isPortlet = false;
            if ($portletType != 0) {
                switch ($portletType) {
                    case "msg":
                        $isPortlet = true;
                        break;
                    case "appointment":
                        $isPortlet = true;
                        break;
                    case "termplan":
                        $isPortlet = true;
                        break;
                    case "topic":
                        $isPortlet = true;
                        break;
                    case "headline":
                        $isPortlet = true;
                        break;
                    case "poll":
                        $isPortlet = true;
                        break;
                    case "media":
                        $isPortlet = true;
                        break;
                    case "rss":
                        $isPortlet = true;
                        break;
                    default:
                        $isPortlet = false;
                        break;
                }
            }
            if ($isPortlet) {
                $steamObject->move($columnObject);
            }
        }
        $ajaxResponseObject->setStatus("ok");
        $jswrapper = new \Widgets\JSWrapper();
        $jswrapper->setJs(<<<END
\t\twindow.location.reload();
END
);
        $ajaxResponseObject->addWidget($jswrapper);
        return $ajaxResponseObject;
    }
Exemplo n.º 12
0
    public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject)
    {
        $ajaxResponseObject->setStatus("ok");
        $newArtefact = \ArtefactModel::create($this->title, $this->content);
        $jswrapper = new \Widgets\JSWrapper();
        $jswrapper->setJs(<<<END
\t\tcloseDialog();
\t\tsendRequest("LoadArtefacts", {}, "artefactsWrapper", "updater");
END
);
        $ajaxResponseObject->addWidget($jswrapper);
        return $ajaxResponseObject;
    }
Exemplo n.º 13
0
    public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject)
    {
        $ajaxResponseObject->setStatus("ok");
        $current_room = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id);
        $portal = \steam_factory::create_docextern($GLOBALS["STEAM"]->get_id(), strip_tags($this->params["name"]), strip_tags($this->params["url"]), $current_room, "");
        $jswrapper = new \Widgets\JSWrapper();
        $jswrapper->setJs(<<<END
\t\tcloseDialog();
\t\tsendRequest("LoadContent", {"id":"{$this->id}"}, "explorerWrapper", "updater", null, null, "explorer");
END
);
        $ajaxResponseObject->addWidget($jswrapper);
        return $ajaxResponseObject;
    }
Exemplo n.º 14
0
    public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject)
    {
        $ajaxResponseObject->setStatus("ok");
        $env_room = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id);
        $forum = \steam_factory::create_messageboard($GLOBALS["STEAM"]->get_id(), $this->params["name"], $env_room);
        $forum->set_attribute("bid:forum_is_editable", 1);
        $jswrapper = new \Widgets\JSWrapper();
        $jswrapper->setJs(<<<END
\t\tcloseDialog();
\t\tlocation.reload();
\t\t
END
);
        $ajaxResponseObject->addWidget($jswrapper);
        return $ajaxResponseObject;
    }
Exemplo n.º 15
0
    public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject)
    {
        $ajaxResponseObject->setStatus("ok");
        $current_room = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id);
        $wave = \steam_factory::create_room($GLOBALS["STEAM"]->get_id(), rawurlencode($this->params["title"]), $current_room, $this->params["title"]);
        $wave->set_attribute("OBJ_TYPE", "container_waveside");
        $wave->set_attribute("WAVE_SLOGAN", $this->params["slogan"]);
        $jswrapper = new \Widgets\JSWrapper();
        $jswrapper->setJs(<<<END
\t\tcloseDialog();
\t\tsendRequest("LoadContent", {"id":"{$this->id}"}, "explorerWrapper", "updater", null, null, "explorer");
END
);
        $ajaxResponseObject->addWidget($jswrapper);
        return $ajaxResponseObject;
    }
Exemplo n.º 16
0
    public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject)
    {
        $ajaxResponseObject->setStatus("ok");
        $env_room = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id);
        $gallery = \steam_factory::create_room($GLOBALS["STEAM"]->get_id(), $this->params["name"], $env_room);
        $gallery->set_attribute("bid:collectiontype", "gallery");
        $jswrapper = new \Widgets\JSWrapper();
        $jswrapper->setJs(<<<END
\t\tcloseDialog();
\t\tlocation.reload();
\t\t
END
);
        $ajaxResponseObject->addWidget($jswrapper);
        return $ajaxResponseObject;
    }
Exemplo n.º 17
0
    public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject)
    {
        $ajaxResponseObject->setStatus("ok");
        $env_room = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id);
        $worksheetObject = \steam_factory::create_container($GLOBALS["STEAM"]->get_id(), $this->params["name"], $env_room);
        $worksheet = new \Worksheet\Worksheet($worksheetObject->get_id());
        $worksheet->setup();
        $worksheet->setName($worksheet->getName() . " (Vorlage)");
        $jswrapper = new \Widgets\JSWrapper();
        $jswrapper->setJs(<<<END
\t\tcloseDialog();
\t\tsendRequest("LoadContent", {"id":"{$this->id}"}, "explorerWrapper", "updater", null, null, "explorer");
\t\t
END
);
        $ajaxResponseObject->addWidget($jswrapper);
        return $ajaxResponseObject;
    }
Exemplo n.º 18
0
    public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject)
    {
        $ajaxResponseObject->setStatus("ok");
        $env_room = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id);
        $calendar = \steam_factory::create_room($GLOBALS["STEAM"]->get_id(), $this->params["name"], $env_room);
        $calendar->set_attribute("OBJ_TYPE", "calendar");
        $steamCalendar = \steam_factory::create_calendar($GLOBALS["STEAM"]->get_id(), $this->params["name"] . "_calendar", null);
        $calendar->set_attribute("GROUP_CALENDAR", $steamCalendar);
        $steamCalendar->set_attribute("CALENDAR_OWNER", $calendar);
        $calendar->set_attribute("CALENDAR_SUBSCRIPTIONS", array());
        $jswrapper = new \Widgets\JSWrapper();
        $jswrapper->setJs(<<<END
\t\tcloseDialog();
\t\tlocation.reload();
\t\t
END
);
        $ajaxResponseObject->addWidget($jswrapper);
        return $ajaxResponseObject;
    }
Exemplo n.º 19
0
    public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject)
    {
        $ajaxResponseObject->setStatus("ok");
        $current_room = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id);
        $portal = \steam_factory::create_container($GLOBALS["STEAM"]->get_id(), $this->params["name"], $current_room);
        $portal->set_attribute("OBJ_TYPE", "container_portal_bid");
        $columnWidth = array("1" => "900px", "2" => "200px;700px", "3" => "200px;500px;200px");
        $columnCount = $this->params["columns"];
        $columnWidth = explode(';', $columnWidth[$columnCount]);
        $columns = array();
        for ($i = 1; $i <= $columnCount; $i++) {
            $columns[$i] = \steam_factory::create_container($GLOBALS["STEAM"]->get_id(), '' . $i, $portal, '' . $i);
            $columns[$i]->set_attributes(array("OBJ_TYPE" => "container_portalColumn_bid", "bid:portal:column:width" => $columnWidth[$i - 1]));
        }
        // populate columns with default portlets
        switch (count($columns)) {
            case 1:
                \ExtensionMaster::getInstance()->callCommand("Create", "PortletHeadline", array("parent" => $columns[1], "title" => $this->params["name"], "version" => "3.0"));
                \ExtensionMaster::getInstance()->callCommand("Create", "PortletMsg", array("parent" => $columns[1], "title" => "Meldungen", "version" => "3.0"));
                break;
            case 2:
                \ExtensionMaster::getInstance()->callCommand("Create", "PortletTopic", array("parent" => $columns[1], "title" => "Kategorien", "version" => "3.0"));
                \ExtensionMaster::getInstance()->callCommand("Create", "PortletHeadline", array("parent" => $columns[2], "title" => $this->params["name"], "version" => "3.0"));
                \ExtensionMaster::getInstance()->callCommand("Create", "PortletMsg", array("parent" => $columns[2], "title" => "Meldungen", "version" => "3.0"));
                break;
            case 3:
                \ExtensionMaster::getInstance()->callCommand("Create", "PortletTopic", array("parent" => $columns[1], "title" => "Kategorien", "version" => "3.0"));
                \ExtensionMaster::getInstance()->callCommand("Create", "PortletHeadline", array("parent" => $columns[2], "title" => $this->params["name"], "version" => "3.0"));
                \ExtensionMaster::getInstance()->callCommand("Create", "PortletMsg", array("parent" => $columns[2], "title" => "Meldungen", "version" => "3.0"));
                \ExtensionMaster::getInstance()->callCommand("Create", "PortletAppointment", array("parent" => $columns[3], "title" => "Termine", "version" => "3.0"));
                break;
        }
        $jswrapper = new \Widgets\JSWrapper();
        $jswrapper->setJs(<<<END
\t\tcloseDialog();
\t\tsendRequest("LoadContent", {"id":"{$this->id}"}, "explorerWrapper", "updater", null, null, "explorer");
END
);
        $ajaxResponseObject->addWidget($jswrapper);
        return $ajaxResponseObject;
    }
Exemplo n.º 20
0
 public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject)
 {
     $object = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id);
     $objectId = $object->get_id();
     $title = $this->params["title"];
     $content = $this->params["content"];
     if ($title != "") {
         $newTopic = $object->add_thread(rawurlencode($title), stripslashes($content));
     } else {
         throw \Exception("Title not set!");
     }
     // TODO: Add other information
     if (!empty($newTopic)) {
         $newTopic->set_attributes(array("OBJ_DESC" => $title, "OBJ_TYPE" => "text_forumthread_bid"), 0);
     }
     $ajaxResponseObject->setStatus("ok");
     $widget = new \Widgets\JSWrapper();
     $widget->setJs("location.reload();");
     $ajaxResponseObject->addWidget($widget);
     return $ajaxResponseObject;
 }
Exemplo n.º 21
0
    public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject)
    {
        $ajaxResponseObject->setStatus("ok");
        if (isset($this->params["fromNameSpace"]) && $this->params["fromNameSpace"] === "Trashbin") {
            $reloadId = \lms_steam::get_current_user()->get_trashbin()->get_id();
            $reload = new \Widgets\JSWrapper();
            $reload->setPostJsCode(<<<END
\t\tcloseDialog();
\t\tsendRequest("LoadContent", {"id":"{$reloadId}"}, "trashbinWrapper", "updater", null, null, "trashbin");
END
);
            $ajaxResponseObject->addWidget($reload);
        }
        if (!isset($this->id)) {
            $jswrapper = new \Widgets\JSWrapper();
            $ids = "";
            $elements = "";
            foreach ($this->elements as $key => $element) {
                if (count($this->elements) > $key + 1) {
                    $ids .= "{\"id\":\"" . $element->get_id() . "\"}, ";
                    $elements .= "\"\", ";
                } else {
                    $ids .= "{\"id\":\"" . $element->get_id() . "\"}";
                    $elements .= "\"\"";
                }
            }
            $js = "sendMultiRequest('EmptyTrashbin', jQuery.parseJSON('[{$ids}]'), jQuery.parseJSON('[{$elements}]'), 'updater', null, null, 'explorer', 'Leere Papierkorb ...', 0, " . count($this->elements) . ");";
            $jswrapper->setJs($js);
            $ajaxResponseObject->addWidget($jswrapper);
            return $ajaxResponseObject;
        } else {
            $trashbinModel = new \Explorer\Model\Trashbin($this->trashbin);
            $jswrapper = new \Widgets\JSWrapper();
            $js = "document.getElementById('trashbinIconbarWrapper').innerHTML = '" . $trashbinModel->getIconbarHtml() . "'; jQuery('.justTrashed').hide();";
            $jswrapper->setJs($js);
            $ajaxResponseObject->addWidget($jswrapper);
            return $ajaxResponseObject;
        }
    }
Exemplo n.º 22
0
 public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject)
 {
     $forumId = $this->params["forum"];
     $object = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id);
     $objectId = $object->get_id();
     $steamUser = \lms_steam::get_current_user();
     $steamUserId = $steamUser->get_id();
     $steam = $GLOBALS["STEAM"];
     $steamId = (string) $steam->get_id();
     $allowed_write = $object->check_access_write($steamUser);
     $title = $this->params["title"];
     $content = $this->params["content"];
     $forum = \steam_factory::get_object($steamId, $forumId);
     $attributes = array("OBJ_DESC" => trim($title));
     $object->set_attributes($attributes, 0);
     $object->set_content($content);
     $ajaxResponseObject->setStatus("ok");
     $widget = new \Widgets\JSWrapper();
     $widget->setJs("location.reload();");
     $ajaxResponseObject->addWidget($widget);
     return $ajaxResponseObject;
 }
Exemplo n.º 23
0
 public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject)
 {
     $object_id = $this->id;
     /** log-in user */
     $steamUser = \lms_steam::get_current_user();
     /** id of the log-in user */
     $steamUserId = $steamUser->get_id();
     $steam = $GLOBALS["STEAM"];
     $steamId = $steam->get_id();
     /** the current object */
     $object = \steam_factory::get_object($steamId, $object_id);
     $objectCreatorId = $object->get_creator()->get_id();
     $forumId = $this->params["forum"];
     $forum = \steam_factory::get_object($steamId, $forumId);
     $forumCreatorId = $forum->get_creator()->get_id();
     if ($forumCreatorId == $steamUserId) {
         $annotations = $object->get_annotations();
         $annotating = $object->get_annotating(1);
         $result = $steam->buffer_flush();
         $annotating = $result[$annotating];
         if (!empty($annotations)) {
             foreach ($annotations as $annotation) {
                 $annotation->delete(1);
             }
         }
         $object->delete(1);
         $steam->buffer_flush();
     } else {
         if ($objectCreatorId == $steamUserId) {
             $object->set_attribute("OBJ_DESC", "");
             $object->set_content("");
         }
     }
     $widget = new \Widgets\JSWrapper();
     $widget->setJs("location.reload();");
     $ajaxResponseObject->setStatus("ok");
     $ajaxResponseObject->addWidget($widget);
     return $ajaxResponseObject;
 }
Exemplo n.º 24
0
 public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject)
 {
     //TODO: CORRECT REDIRECTION
     //$path=array();
     //$path=explode("/", $this->params["path"]);
     //$forumId=$path[count($path)-2];
     $forumId = $this->params["forum"];
     $object_id = $this->id;
     /** log-in user */
     $steamUser = \lms_steam::get_current_user();
     /** id of the log-in user */
     $steamUserId = $steamUser->get_id();
     $steam = $GLOBALS["STEAM"];
     $steamId = $steam->get_id();
     /** the current object */
     $object = \steam_factory::get_object($steamId, $object_id);
     $annotations = $object->get_annotations();
     $trash = $steamUser->get_attribute(USER_TRASHBIN, 1);
     $annotating = $object->get_annotating(1);
     $result = $steam->buffer_flush();
     $trash = $result[$trash];
     $annotating = $result[$annotating];
     //move objects to trashbin
     if (is_object($trash)) {
         if ($annotating) {
             $annotating->remove_annotation($object, 1);
             $annotating->set_acquire(false, 1);
         }
         $object->move($trash, 1);
         $steam->buffer_flush();
     }
     $widget = new \Widgets\JSWrapper();
     $backlink = PATH_URL . "forum/index/" . $forumId . "/";
     $widget->setJs("self.location.href='{$backlink}'");
     $ajaxResponseObject->setStatus("ok");
     $ajaxResponseObject->addWidget($widget);
     return $ajaxResponseObject;
 }
Exemplo n.º 25
0
 public function execute(\FrameResponseObject $frameResponseObject)
 {
     $steam = $GLOBALS["STEAM"];
     $id = $this->id;
     if ($this->params[1] == "group" || $this->params[1] == "user") {
         $category = $this->params[1];
     } else {
         throw new \Exception("category isn't set");
     }
     if ($category == "user" && $id != 0) {
         $user = \steam_factory::get_object($steam->get_id(), $id);
         $user_data = $user->get_attributes(array(OBJ_NAME, OBJ_DESC, USER_FIRSTNAME, USER_FULLNAME, USER_EMAIL, USER_ADRESS, OBJ_ICON, "bid:user_callto", "bid:user_im_adress", "bid:user_im_protocol"));
         //    $user_email_forwarding = $user->get_email_forwarding();
     } elseif ($category == "group" && $id != 0) {
         $group = \steam_factory::get_object($steam->get_id(), $id);
         $group_data = $group->get_attributes(array(OBJ_NAME, OBJ_DESC));
     }
     $user_favourites = $steam->get_current_steam_user()->get_buddies();
     if (count($user_favourites) == 0) {
         $user_favourites = array();
     }
     if ($category == "user") {
         array_push($user_favourites, $user);
     } else {
         if ($category == "group") {
             array_push($user_favourites, $group);
         }
     }
     $steam->get_current_steam_user()->set_attribute("USER_FAVOURITES", $user_favourites);
     //$frameResponseObject->setConfirmText(gettext("Favorite added successfully"));
     $frameResponseObject->setConfirmText("Favorit erfolgreich hinzugefügt!");
     $widget = new \Widgets\JSWrapper();
     $url = 'self.location.href="' . PATH_URL . 'favorite/index' . '"';
     $widget->setJs($url);
     $frameResponseObject->addWidget($widget);
     return $frameResponseObject;
 }
Exemplo n.º 26
0
 public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject)
 {
     $title = $this->params["title"];
     $content = $this->params["content"];
     $objectId = $this->id;
     $forumId = $this->params["forum"];
     $steam = $GLOBALS["STEAM"];
     $steamId = $steam->get_id();
     $object = \steam_factory::get_object($steamId, $objectId);
     $forum = \steam_factory::get_object($steamId, $forumId);
     if (trim($title) != "") {
         $new_annotation = \steam_factory::create_textdoc($steamId, rawurlencode($title), stripslashes($content));
         $new_annotation->set_attribute("OBJ_DESC", $title);
         $object->add_annotation($new_annotation);
         // set acquiring
         $new_annotation->set_acquire($object);
         $subscription = $forum->get_attribute("bid:forum_subscription");
         if ($subscription) {
             foreach ($subscription as $key => $user) {
                 $user->get_attributes(array("USER_EMAIL"), 1);
             }
             $result = $steam->buffer_flush();
             foreach ($subscription as $key => $user) {
                 $recipient = $user->get_attribute("USER_EMAIL");
                 $steam->send_mail_from($recipient, "New message in forum " . $forum->get_name . ", thread: " . $object->get_name(), "", "postmaster", 1, "text/plain");
             }
             $steam->buffer_flush();
         }
     } else {
         echo "Ihre Antwort hat keinen Inhalt!";
     }
     $ajaxResponseObject->setStatus("ok");
     $widget = new \Widgets\JSWrapper();
     $widget->setJs("location.reload();");
     $ajaxResponseObject->addWidget($widget);
     return $ajaxResponseObject;
 }
Exemplo n.º 27
0
 public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject)
 {
     $object = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id);
     $objectId = $object->get_id();
     $steamUser = \lms_steam::get_current_user();
     $steamUserId = $steamUser->get_id();
     $steam = $GLOBALS["STEAM"];
     $steamId = $steam->get_id();
     $allowed_write = $object->check_access_write($steamUser);
     $title = $this->params["title"];
     $content = $this->params["content"];
     if ($allowed_write && $title != "" && $content != "") {
         $attributes = array(OBJ_DESC => $title);
         $object->set_attributes($attributes, 0);
         $object->set_content($content);
     } else {
         throw \Exception("Title or content not set");
     }
     $ajaxResponseObject->setStatus("ok");
     $widget = new \Widgets\JSWrapper();
     $widget->setJs("location.reload();");
     $ajaxResponseObject->addWidget($widget);
     return $ajaxResponseObject;
 }
Exemplo n.º 28
0
    public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject)
    {
        $ajaxResponseObject->setStatus("ok");
        if (!isset($this->params["group"])) {
            $rawWidget = new \Widgets\RawHtml();
            $rawWidget->setHtml("Error: Kurs oder Gruppe auswählen");
            $ajaxResponseObject->addWidget($rawWidget);
            return $ajaxResponseObject;
        }
        if ($this->params["group"] == 1) {
            // course
            if (!isset($this->params["course"])) {
                $rawWidget = new \Widgets\RawHtml();
                $rawWidget->setHtml("Error: Kurs oder Gruppe auswählen");
                $ajaxResponseObject->addWidget($rawWidget);
                return $ajaxResponseObject;
            }
            $course = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->params["course"]);
            $subgroups = $course->get_subgroups();
            foreach ($subgroups as $subgroup) {
                if ($subgroup->get_name() == "staff") {
                    $admingroup = $subgroup;
                } else {
                    if ($subgroup->get_name() == "learners") {
                        $basegroup = $subgroup;
                    }
                }
            }
        } else {
            // group
            if (!isset($this->params["basegroup"]) || !isset($this->params["admingroup"])) {
                $rawWidget = new \Widgets\RawHtml();
                $rawWidget->setHtml("Error: Kurs oder Gruppe auswählen");
                $ajaxResponseObject->addWidget($rawWidget);
                return $ajaxResponseObject;
            }
            $basegroup = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->params["basegroup"]);
            $admingroup = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->params["admingroup"]);
        }
        $start = $this->params["startElements"];
        $maxcol = intval(log($start, 2) + 1);
        $pyramidRoom = \steam_factory::create_room($GLOBALS["STEAM"]->get_id(), $this->params["title"], $basegroup->get_workroom(), $this->params["title"]);
        $pyramidRoom->set_sanction_all($admingroup);
        $pyramidRoom->set_sanction_all($basegroup);
        $pyramidRoom->set_attribute("OBJ_TYPE", "container_pyramiddiscussion");
        $pyramidRoom->set_attribute("PYRAMIDDISCUSSION_ACTCOL", 0);
        $pyramidRoom->set_attribute("PYRAMIDDISCUSSION_ADMINGROUP", $admingroup);
        $pyramidRoom->set_attribute("PYRAMIDDISCUSSION_BASEGROUP", $basegroup);
        $pyramidRoom->set_attribute("PYRAMIDDISCUSSION_DEADLINES", array());
        $pyramidRoom->set_attribute("PYRAMIDDISCUSSION_EDITOR", $this->params["editor"]);
        $pyramidRoom->set_attribute("PYRAMIDDISCUSSION_INITIALIZED", 1);
        $pyramidRoom->set_attribute("PYRAMIDDISCUSSION_MAX", $start);
        $pyramidRoom->set_attribute("PYRAMIDDISCUSSION_MAXCOL", $maxcol);
        $pyramidRoom->set_attribute("PYRAMIDDISCUSSION_OVERRIDE_DEADLINES", 0);
        $pyramidRoom->set_attribute("PYRAMIDDISCUSSION_USEDEADLINES", "no");
        $pyramidRoom->set_attribute("PYRAMIDDISCUSSION_VERSION", "koala_3.0");
        $participants = array();
        $members = $basegroup->get_members();
        $admins = $admingroup->get_members();
        foreach ($admins as $admin) {
            if (!$basegroup->is_member($admin) && $admin instanceof \steam_user) {
                array_push($members, $admin);
            }
        }
        foreach ($members as $member) {
            if ($member instanceof \steam_user) {
                $participants[$member->get_id()] = 0;
            }
        }
        $pyramidRoom->set_attribute("PYRAMIDDISCUSSION_PARTICIPANT_MANAGEMENT", $participants);
        $adminconfig = array();
        foreach ($admins as $admin) {
            if ($admin instanceof \steam_user) {
                $options = array();
                $options["show_adminoptions"] = "true";
                $adminconfig[$admin->get_id()] = $options;
            }
        }
        $pyramidRoom->set_attribute("PYRAMIDDISCUSSION_ADMINCONFIG", $adminconfig);
        $pyramidGroup = \steam_factory::create_group($GLOBALS["STEAM"]->get_id(), "pyramid_" . $pyramidRoom->get_id(), $basegroup);
        // create position documents and corresponding groups
        $groups = array();
        for ($count = 1; $count <= $maxcol; $count++) {
            for ($count2 = 1; $count2 <= $start / pow(2, $count - 1); $count2++) {
                $newGroup = \steam_factory::create_group($GLOBALS["STEAM"]->get_id(), "group_" . $count . "_" . $count2, $pyramidGroup);
                $newGroup->set_insert_access($basegroup);
                $newGroup->set_insert_access($admingroup);
                $groups[$count . $count2] = $newGroup;
                $newPosition = \steam_factory::create_document($GLOBALS["STEAM"]->get_id(), "Position_" . $count . "_" . $count2, "", $this->params["editor"], $pyramidRoom, "Position " . $count . "-" . $count2);
                $newPosition->set_attribute("PYRAMIDDISCUSSION_COLUMN", $count);
                $newPosition->set_attribute("PYRAMIDDISCUSSION_ROW", $count2);
                $newPosition->set_attribute("PYRAMIDDISCUSSION_POS_READ_STATES", array());
                $newPosition->set_attribute("PYRAMIDDISCUSSION_POS_TITLE", "");
                $newPosition->set_attribute("PYRAMIDDISCUSSION_RELGROUP", $newGroup);
            }
        }
        // generate group structure
        for ($count = 2; $count <= $maxcol; $count++) {
            for ($count2 = 1; $count2 <= $start / pow(2, $count - 1); $count2++) {
                $groups[$count . $count2]->add_member($groups[$count - 1 . ($count2 * 2 - 1)]);
                $groups[$count . $count2]->add_member($groups[$count - 1 . $count2 * 2]);
            }
        }
        foreach ($groups as $group) {
            $pyramidGroup->add_member($group);
        }
        $path = PATH_URL;
        $jswrapper = new \Widgets\JSWrapper();
        $jswrapper->setJs(<<<END
\t\tcloseDialog();
END
);
        $ajaxResponseObject->addWidget($jswrapper);
        return $ajaxResponseObject;
    }
Exemplo n.º 29
0
 public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject)
 {
     $type = "";
     $object = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id);
     $type = getObjectType($object);
     switch ($type) {
         case "document":
             $labelName = "Dateiname";
             $typeName = "Dokument";
             break;
         case "forum":
             $labelName = "Forumname";
             $typeName = "Forum";
             break;
         case "referenceFolder":
             $labelName = "Linkname";
             $typeName = "Referenz";
             break;
         case "referenceFile":
             $labelName = "Linkname";
             $typeName = "Referenz";
             break;
         case "user":
             $labelName = "Benutzername";
             $typeName = "Benutzer";
             break;
         case "group":
             $labelName = "Gruppenname";
             $typeName = "Gruppe";
             break;
         case "trashbin":
             $labelName = "Papierkorb";
             $typeName = "Papierkorb";
             break;
         case "gallery":
             $labelName = "Galeriename";
             $typeName = "Galerie";
             break;
         case "portal":
             $labelName = "Portalname";
             $typeName = "Portal";
             break;
         case "portalColumn":
             $labelName = "Spaltenname";
             $typeName = "Portal-Spalte";
             break;
         case "portalPortlet":
             $labelName = "Portletname";
             $typeName = "Portal-Portlet";
             break;
         case "userHome":
             $labelName = "Ordnername";
             $typeName = "Benutzerordner";
             break;
         case "groupWorkroom":
             $labelName = "Ordnername";
             $typeName = "Gruppen-Arbeitsraum";
             break;
         case "room":
             $labelName = "Ordnername";
             $typeName = "Ordner";
             break;
         case "container":
             $labelName = "Ordnername";
             $typeName = "Ordner";
             break;
         case "unknown":
             $labelName = "Name";
             $typeName = "unbekannt";
             break;
         default:
             $labelName = "Name";
             $typeName = "unbekannt";
             break;
     }
     $dialog = new \Widgets\Dialog();
     $dialog->setTitle("Eigenschaften von »" . getCleanName($object) . "«<br>({$typeName})");
     $dialog->setPositionX($this->params["mouseX"]);
     $dialog->setPositionY($this->params["mouseY"]);
     if ($type == "userHome" || $type == "groupWorkroom") {
         $dataNameInput = new \Widgets\TextInput();
         $dataNameInput->setLabel("{$labelName}");
         $dataNameInput->setData($object);
         $dataNameInput->setReadOnly(true);
         $dataNameInput->setContentProvider(\Widgets\DataProvider::staticProvider(getCleanName($object, -1)));
         /*		$titelInput = new \Widgets\TextInput();
         			 $titelInput->setLabel("Titel (Beschreibung)");
         			 $titelInput->setData($object);
         			 $titelInput->setContentProvider(\Widgets\DataProvider::staticProvider(getCleanName($object)));*/
     } else {
         $dataNameInput = new \Widgets\TextInput();
         $dataNameInput->setLabel("{$labelName}");
         $dataNameInput->setData($object);
         $dataNameInput->setContentProvider(new NameAttributeDataProvider("OBJ_NAME", getCleanName($object, -1)));
         if ($type == "document") {
             $docType = $object->get_attribute("DOC_MIME_TYPE");
             $isJpg = strpos($docType, "jpg") !== false;
             $isJpeg = strpos($docType, "jpeg") !== false;
             $isGif = strpos($docType, "gif") !== false;
             $isPng = strpos($docType, "png") !== false;
             if ($isGif || $isJpeg || $isJpg || $isPng) {
                 $textArea = new \Widgets\Textarea();
                 $textArea->setLabel("Beschreibung");
                 $textArea->setData($object);
                 $textArea->setContentProvider(\Widgets\DataProvider::attributeProvider("OBJ_DESC"));
                 $textArea->setHeight(100);
                 $desc = $object->get_attribute("OBJ_DESC");
                 if ($desc !== 0) {
                     $jsWrapperPicture = new \Widgets\JSWrapper();
                     $jsWrapperPicture->setJs('$(".plain").val("' . $desc . '")');
                 }
             }
         }
         /*		$titelInput = new \Widgets\TextInput();
         			 $titelInput->setLabel("Titel (Beschreibung)");
         			 $titelInput->setData($object);
         			 $titelInput->setContentProvider(\Widgets\DataProvider::attributeProvider("OBJ_DESC"));*/
     }
     $ownerField = new \Widgets\TextField();
     $ownerField->setLabel("Besitzer");
     $creator = $object->get_creator();
     $creatorName = getCleanName($creator);
     $ownerField->setValue($creatorName);
     $changedField = new \Widgets\TextField();
     $changedField->setLabel("zuletzt geändert");
     $changedDate = $object->get_attribute(OBJ_LAST_CHANGED);
     $changedDate = getFormatedDate($changedDate);
     $changedField->setValue($changedDate);
     $createdField = new \Widgets\TextField();
     $createdField->setLabel("erstellt");
     $createDate = $object->get_attribute(OBJ_CREATION_TIME);
     $createDate = getFormatedDate($createDate);
     $createdField->setValue($createDate);
     //$hiddenCheckbox = new \Widgets\Checkbox();
     //$hiddenCheckbox->setLabel("Verstecken");
     //$hiddenCheckbox->setCheckedValue("1");
     //$hiddenCheckbox->setUncheckedValue(0);
     //$hiddenCheckbox->setData($object);
     //$hiddenCheckbox->setContentProvider(\Widgets\DataProvider::attributeProvider("bid:hidden"));
     $containerViewRadio = new \Widgets\RadioButton();
     $containerViewRadio->setLabel("Erstes Dokument");
     $containerViewRadio->setData($object);
     $containerViewRadio->setOptions(array(array("name" => "Normal (Ordneransicht)", "value" => "normal"), array("name" => "Deckblatt (statt der Ordneransicht)", "value" => "index"), array("name" => "Kopfdokument (über der Ordneransicht)", "value" => "head")));
     $containerViewRadio->setDefaultChecked("normal");
     $containerViewRadio->setContentProvider(\Widgets\DataProvider::attributeProvider("bid:presentation"));
     // 		$descriptionTextarea = new \Widgets\Textarea();
     // 		$descriptionTextarea->setLabel("Beschreibung");
     // 		$descriptionTextarea->setData($object);
     // 		$descriptionTextarea->setContentProvider(\Widgets\DataProvider::attributeProvider("bid:description"));
     //TODO: value is array
     $keywordArea = new \Widgets\TextInput();
     $keywordArea->setLabel("Schlüsselwörter");
     $keywordArea->setData($object);
     $keywordArea->setContentProvider(\Widgets\DataProvider::attributeProvider("OBJ_KEYWORDS"));
     //TODO: bid-attribute
     $descriptionInput = new \Widgets\TextInput();
     $descriptionInput->setLabel("Beschreibung");
     $descriptionInput->setData($object);
     $descriptionInput->setContentProvider(\Widgets\DataProvider::attributeProvider("bid:description"));
     $checkboxInput = new \Widgets\Checkbox();
     $checkboxInput->setLabel("Benutzer dürfen editieren?");
     $checkboxInput->setCheckedValue("1");
     $checkboxInput->setUncheckedValue(0);
     $checkboxInput->setData($object);
     $checkboxInput->setContentProvider(\Widgets\DataProvider::attributeProvider("bid:forum_is_editable"));
     $seperator = new \Widgets\RawHtml();
     $seperator->setHtml("<br style=\"clear:both\"/>");
     $headlineAlg = new \Widgets\RawHtml();
     $headlineAlg->setHtml("<h3>Allgemein</h3>");
     $headlineMeta = new \Widgets\RawHtml();
     $headlineMeta->setHtml("<h3>Meta-Informationen</h3>");
     $headlineView = new \Widgets\RawHtml();
     $headlineView->setHtml("<h3>Darstellung</h3>");
     $dialog->addWidget($headlineAlg);
     //$dialog->addWidget($titelInput);
     //$dialog->addWidget($seperator);
     if ($type == "document") {
         $docType = $object->get_attribute("DOC_MIME_TYPE");
         $isJpg = strpos($docType, "jpg") !== false;
         $isJpeg = strpos($docType, "jpeg") !== false;
         $isGif = strpos($docType, "gif") !== false;
         $isPng = strpos($docType, "png") !== false;
         if ($isGif || $isJpeg || $isJpg || $isPng) {
             $fileName = new \Widgets\TextInput();
             $fileName->setLabel("Dateiname");
             $fileName->setData($object);
             $fileName->setContentProvider(\Widgets\DataProvider::attributeProvider("OBJ_NAME"));
             $dialog->addWidget($fileName);
         }
     } else {
         $dialog->addWidget($dataNameInput);
     }
     $dialog->addWidget($seperator);
     $dialog->addWidget($ownerField);
     $dialog->addWidget($seperator);
     $dialog->addWidget($changedField);
     $dialog->addWidget($seperator);
     $dialog->addWidget($createdField);
     $dialog->addWidget($seperator);
     if ($type == "container" || $type == "room") {
         $dialog->addWidget($headlineView);
         //$dialog->addWidget($hiddenCheckbox);
         //$dialog->addWidget($seperator);
         $dialog->addWidget($containerViewRadio);
         $dialog->addWidget($seperator);
     } else {
         if ($type == "document") {
             $docType = $object->get_attribute("DOC_MIME_TYPE");
             $isJpg = strpos($docType, "jpg") !== false;
             $isJpeg = strpos($docType, "jpeg") !== false;
             $isGif = strpos($docType, "gif") !== false;
             $isPng = strpos($docType, "png") !== false;
             if ($isGif || $isJpeg || $isJpg || $isPng) {
                 $dialog->addWidget($textArea);
                 $dialog->addWidget($jsWrapperPicture);
             }
         } else {
             if ($type == "forum") {
                 $creatorId = $creator->get_id();
                 $currentUser = $GLOBALS["STEAM"]->get_current_steam_user();
                 $currentUserId = $currentUser->get_id();
                 if ($currentUserId == $creatorId) {
                     //				$checkValue= $object->get_attribute("bid:forum_is_editable");
                     //				$checked = $checkValue ? 1 : 0;
                     //				$checkboxInput;
                     $dialog->addWidget($checkboxInput);
                     $dialog->addWidget($seperator);
                 }
             }
         }
     }
     // 		$dialog->addWidget($headlineMeta);
     // 		$dialog->addWidget($keywordArea);
     // 		$dialog->addWidget($seperator);
     // 		$dialog->addWidget($descriptionInput);
     $ajaxResponseObject->setStatus("ok");
     $ajaxResponseObject->addWidget($dialog);
     return $ajaxResponseObject;
 }
Exemplo n.º 30
0
    public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject)
    {
        if (!isset($this->params["group_course"])) {
            $rawWidget = new \Widgets\RawHtml();
            $rawWidget->setHtml("Error: Kurs oder Gruppe auswählen");
            $ajaxResponseObject->addWidget($rawWidget);
            return $ajaxResponseObject;
        }
        $user = $GLOBALS["STEAM"]->get_current_steam_user();
        if ($this->params["group_course"] == 1) {
            // course
            if (!isset($this->params["course"])) {
                $rawWidget = new \Widgets\RawHtml();
                $rawWidget->setHtml("Error: Kurs oder Gruppe auswählen");
                $ajaxResponseObject->addWidget($rawWidget);
                return $ajaxResponseObject;
            }
            $course = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->params["course"]);
            $subgroups = $course->get_subgroups();
            foreach ($subgroups as $subgroup) {
                if ($subgroup->get_name() == "staff") {
                    $staff = $subgroup->get_members();
                    $admins = array();
                    foreach ($staff as $staffMember) {
                        if ($staffMember instanceof \steam_user) {
                            array_push($admins, $staffMember->get_id());
                        }
                    }
                } else {
                    if ($subgroup->get_name() == "learners") {
                        $group = $subgroup;
                    }
                }
            }
        } else {
            // group
            if (!isset($this->params["group"])) {
                $rawWidget = new \Widgets\RawHtml();
                $rawWidget->setHtml("Error: Kurs oder Gruppe auswählen");
                $ajaxResponseObject->addWidget($rawWidget);
                return $ajaxResponseObject;
            }
            $group = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->params["group"]);
            $admins = array($user->get_id());
        }
        if (intval($this->params["rounds"]) == 0) {
            $rawWidget = new \Widgets\RawHtml();
            $rawWidget->setHtml("Error: Rundenzahl bitte als Integer eingeben.");
            $ajaxResponseObject->addWidget($rawWidget);
            return $ajaxResponseObject;
        }
        // create data structure and set access rights
        $TCR = \steam_factory::create_room($GLOBALS["STEAM"]->get_id(), $this->params["title"], $group->get_workroom(), $this->params["title"]);
        \steam_factory::create_container($GLOBALS["STEAM"]->get_id(), "theses", $TCR, "container for theses");
        \steam_factory::create_container($GLOBALS["STEAM"]->get_id(), "reviews", $TCR, "container for reviews");
        \steam_factory::create_container($GLOBALS["STEAM"]->get_id(), "responses", $TCR, "container for responses");
        $TCR->set_attribute("OBJ_TYPE", "TCR_CONTAINER");
        $TCR->set_attribute("TCR_ROUNDS", $this->params["rounds"]);
        $TCR->set_attribute("TCR_USERS", array());
        $TCR->set_attribute("TCR_ADMINS", $admins);
        $TCR->set_attribute("TCR_GROUP", $group);
        $TCR->set_sanction_all($group);
        $ajaxResponseObject->setStatus("ok");
        $jswrapper = new \Widgets\JSWrapper();
        $jswrapper->setJs(<<<END
\t\tcloseDialog();
END
);
        $ajaxResponseObject->addWidget($jswrapper);
        return $ajaxResponseObject;
    }