示例#1
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;
    }
示例#2
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();*/
 }
示例#3
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();
     		*/
 }
示例#4
0
 public function execute(\FrameResponseObject $frameResponseObject)
 {
     if (!($env = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $_GET["env"]))) {
         throw new \Exception("Environment unknown.");
     }
     $koala_env = \koala_object::get_koala_object($env);
     if (isset($_SERVER["HTTP_REFERER"])) {
         $http_referer = $_SERVER["HTTP_REFERER"];
     } else {
         $http_referer = "";
     }
     $backlink = empty($_POST["values"]["backlink"]) ? $http_referer : $_POST["values"]["backlink"];
     $max_file_size = parse_filesize(ini_get('upload_max_filesize'));
     $max_post_size = parse_filesize(ini_get('post_max_size'));
     if ($max_post_size > 0 && $max_post_size < $max_file_size) {
         $max_file_size = $max_post_size;
     }
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         $values = isset($_POST["values"]) ? $_POST["values"] : array();
         $problems = "";
         $hints = "";
         if (empty($_FILES) || !empty($_FILES["material"]["error"]) && $_FILES["material"]["error"] > 0) {
             if (!empty($_FILES) && empty($_FILES["material"]["name"])) {
                 $problems = gettext("No file chosen.") . " ";
                 $hints = gettext("Please choose a local file to upload.") . " ";
             } else {
                 $problems = gettext("Could not upload document.") . " ";
                 $hints = str_replace(array("%SIZE", "%TIME"), array(readable_filesize($max_file_size), (string) ini_get('max_execution_time')), gettext("Maybe your document exceeded the allowed file size (max. %SIZE) or the upload might have taken too long (max. %TIME seconds).")) . " ";
             }
         }
         if (empty($problems)) {
             $content = file_get_contents($_FILES["material"]["tmp_name"]);
             /*
             ob_start();
             readfile( $_FILES["material"]["tmp_name"] );
             $content = ob_get_contents();
             ob_end_clean();
             */
             if (defined("LOG_DEBUGLOG")) {
                 $time1 = microtime(TRUE);
                 \logging::write_log(LOG_DEBUGLOG, "upload" . " \t" . $GLOBALS["STEAM"]->get_login_user_name() . " \t" . $_FILES["material"]["name"] . " \t" . filesize($_FILES["material"]["tmp_name"]) . " Bytes \t... ");
             }
             $filename = str_replace(array("\\", "'"), array("", ""), $_FILES["material"]["name"]);
             $new_material = \steam_factory::create_document($GLOBALS["STEAM"]->get_id(), $filename, $content, $_FILES["material"]["type"], FALSE);
             if (defined("LOG_DEBUGLOG")) {
                 \logging::append_log(LOG_DEBUGLOG, " \t" . round((microtime(TRUE) - $time1) * 1000) . " ms");
             }
             //  Disabled for Testing issues
             // upload($new_material->get_content_id(), $content);
             if (isset($values["dsc"])) {
                 $new_material->set_attribute("OBJ_DESC", $values["dsc"]);
             }
             $new_material->move($env);
             $_SESSION["confirmation"] = str_replace("%DOCUMENT", h($filename), gettext("'%DOCUMENT' has been uploaded."));
             header("Location: " . $backlink);
             exit;
         } else {
             $frameResponseObject->setProblemDescription($problems);
             $frameResponseObject->setProblemSolution($hints);
             //$portal->set_problem_description( $problems, $hints );
         }
     }
     $content = \Wiki::getInstance()->loadTemplate("upload.template.html");
     //$content = new HTML_TEMPLATE_IT( PATH_TEMPLATES );
     //$content->loadTemplateFile( "upload.template.html" );
     $content->setVariable("LABEL_UPLOAD", gettext("Upload"));
     $content->setVariable("LABEL_FILE", gettext("Local file"));
     $content->setVariable("LABEL_DSC", gettext("Description"));
     $content->setVariable("BACKLINK", "<a href=\"{$backlink}\">" . gettext("back") . "</a>");
     $content->setVariable("BACK_LINK", $backlink);
     $content->setVariable("FORM_ACTION", PATH_URL . "wiki/upload/" . (isset($_GET["env"]) ? "?env=" . $_GET["env"] : ""));
     if ($max_file_size > 0) {
         $content->setVariable("MAX_FILE_SIZE_INPUT", "<input type='hidden' name='MAX_FILE_SIZE' value='" . (string) $max_file_size . "'/>");
         $content->setVariable("MAX_FILE_SIZE_INFO", "<br />" . str_replace("%SIZE", readable_filesize($max_file_size), gettext("The maximum allowed file size is %SIZE.")));
     }
     $link_path = $koala_env->get_link_path();
     if (!is_array($link_path)) {
         $link_path = array();
     }
     $link_path[] = array("name" => gettext("Upload document"));
     if (!WIKI_FULL_HEADLINE) {
         $tmp_array = array();
         $elem_last = array_pop($link_path);
         $elem_first = array_pop($link_path);
         $tmp_array[] = $elem_first;
         $tmp_array[] = $elem_last;
         $link_path = $tmp_array;
     }
     //$portal->set_page_main( $link_path, $content->get() );
     //$portal->set_page_main( str_replace( "%ENV", $env->get_name(), gettext( "New upload in '%ENV'" ) ), $content->get() );
     //$portal->set_page_title( gettext( "Upload document" ) );
     //$portal->show_html();
     $frameResponseObject->setHeadline($link_path);
     $widget = new \Widgets\RawHtml();
     $widget->setHtml($content->get());
     $frameResponseObject->addWidget($widget);
     return $frameResponseObject;
 }
示例#5
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;
 }
示例#6
0
 public function execute(\FrameResponseObject $frameResponseObject)
 {
     //$portal = \lms_portal::get_instance();
     //$portal->initialize( GUEST_NOT_ALLOWED );
     //$portal->set_page_title( gettext( "Buddy Icon" ) );
     $user = \lms_steam::get_current_user();
     $confirmText = "";
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         $problem = "";
         $hint = "";
         if (isset($_POST["action"]) && $_POST["action"] == "deleteicon") {
             // need to set OBJ_ICON to "0" and then to icons module to avoid weird
             // effects in icon handling (server side fix done but not testedyet)
             $old_icon = $user->get_attribute("OBJ_ICON");
             $user->set_acquire_attribute("OBJ_ICON", 0);
             $user->set_attribute("OBJ_ICON", 0);
             // set the default user icon by acquiring OBJ_ICON from icons module
             $user->set_acquire_attribute("OBJ_ICON", $GLOBALS["STEAM"]->get_module("icons"));
             // delete previous user icon object
             if ($old_icon instanceof steam_document) {
                 if ($old_icon->get_path() != "/images/doctypes/user_unknown.jpg" && $old_icon->check_access_write($user)) {
                     $this->clean_iconcache($old_icon);
                     $old_icon->delete();
                 }
             }
             $confirmText = gettext("Your profile icon has been deleted.");
             $this->clean_usericoncache($user);
         } else {
             // upload new icon
             if (count($_FILES) == 0) {
                 $problem = gettext("No image specified.") . " ";
                 $hint = gettext("Please choose an image on your local disk to upload.") . " ";
             }
             if (strpos($_FILES["icon"]["type"], "image") === FALSE) {
                 $problem .= gettext("File is not an image.") . " ";
                 $hint .= gettext("The icon has to be an image file (JPG, GIF or PNG).");
             }
             if ((int) $_FILES["icon"]["size"] > 256000) {
                 $problem .= gettext("File is larger than 250 KByte.");
                 $hint .= gettext("It is only allowed to upload profile icons with file size smaller than 250 KByte.");
             }
             if (empty($problem)) {
                 $user->set_acquire_attribute("OBJ_ICON", 0);
                 $user->delete_value("OBJ_ICON");
                 $old_icon = $user->get_attribute("OBJ_ICON");
                 ob_start();
                 readfile($_FILES["icon"]["tmp_name"]);
                 $content = ob_get_contents();
                 ob_end_clean();
                 $filename = str_replace(array("\\", "'"), array("", ""), $_FILES["icon"]["name"]);
                 if ($old_icon instanceof steam_document && $old_icon->check_access_write($user)) {
                     $new_icon = $old_icon;
                     $new_icon->set_attribute("OBJ_NAME", $filename);
                     $new_icon->set_content($content);
                     $new_icon->set_attribute("DOC_MIME_TYPE", $_FILES["icon"]["type"]);
                 } else {
                     $new_icon = \steam_factory::create_document($GLOBALS["STEAM"]->get_id(), $filename, $content, $_FILES["icon"]["type"], FALSE);
                     $new_icon->set_attribute("OBJ_TYPE", "document_icon_usericon");
                 }
                 $user->set_attribute("OBJ_ICON", $new_icon);
                 $all_user = \steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), "sTeam");
                 $new_icon->set_read_access($all_user);
                 $GLOBALS["STEAM"]->buffer_flush();
                 // clean cache-related data
                 $this->clean_usericoncache($user);
                 $confirmText = gettext("Your profile icon has been changed.");
             } else {
                 $frameResponseObject->setProblemDescription($problem);
             }
         }
     }
     $content = \Profile::getInstance()->loadTemplate("profile_icon.template.html");
     //$content = new \HTML_TEMPLATE_IT();
     //$content->loadTemplateFile( PATH_TEMPLATES . "profile_icon.template.html" );
     //$content->setVariable( "INFO_TEXT", gettext( "Your buddy icon is what we use to represent you when you're in koaLA." ) );
     if (PLATFORM_ID == "bid") {
         $content->setVariable("INFO_TEXT", "Hier können Sie ein Benutzerbild hinterlegen. Dieses wird beispielsweise an Ihren Dokumenten und Forenbeiträgen zusammen mit Ihrem Namen angezeigt.");
     } else {
         $content->setVariable("INFO_TEXT", "Das Benutzerbild wird Sie in " . PLATFORM_NAME . " repräsentieren");
     }
     $content->setVariable("WINDOW_CONFIRM_TEXT", gettext("Are you sure you want to delete your current buddy icon?"));
     $content->setVariable("LABEL_DELETE", gettext("DELETE"));
     $user->delete_value("OBJ_ICON");
     $icon = $user->get_attribute("OBJ_ICON");
     if ($icon instanceof \steam_object) {
         $icon_id = $icon->get_id();
         // if user icon is acquired (= default icon) hide the delete button
         if (is_object($user->get_acquire_attribute("OBJ_ICON"))) {
             $content->setVariable("HIDE_BUTTON", "style='display:none;'");
         }
     } else {
         $icon_id = 0;
         $content->setVariable("HIDE_BUTTON", "style='display:none;'");
     }
     // use it in 140x185 standard thumb size to optimize sharing of icon cache data
     $icon_link = $icon_id == 0 ? PATH_URL . "styles/standard/images/anonymous.jpg" : PATH_URL . "download/image/" . $icon_id . "/140/185";
     $content->setVariable("USER_IMAGE", $icon_link);
     $content->setVariable("LABEL_YOUR_BUDDY_ICON", gettext("This is your buddy icon at the moment."));
     $content->setVariable("LABEL_REPLACE", gettext("Replace with an image"));
     $content->setVariable("LABEL_UPLOAD_INFO", gettext("The uploaded file has to be an image file (JPG, GIF or PNG), should have the dimensions of 140 x 185 pixels and <b>may not be larger than 250 KByte</b>. "));
     $content->setVariable("LABEL_UPLOAD", gettext("Upload"));
     if (PLATFORM_ID == "bid") {
         $breadcrumb = array(array("name" => $user->get_attribute("USER_FIRSTNAME") . " " . $user->get_attribute("USER_FULLNAME"), "link" => PATH_URL . "home"), array("name" => gettext("Profile"), "link" => PATH_URL . "profile/"), array("name" => gettext("Your buddy icon")));
     } else {
         $breadcrumb = array(array("name" => $user->get_attribute("USER_FIRSTNAME") . " " . $user->get_attribute("USER_FULLNAME"), "link" => PATH_URL . "profile/" . "index/" . $user->get_name() . "/"), array("name" => gettext("Profile"), "link" => PATH_URL . "profile/index/" . $user->get_name() . "/"), array("name" => gettext("Your buddy icon")));
     }
     $frameResponseObject->setHeadline($breadcrumb);
     $frameResponseObject->setConfirmText($confirmText);
     $rawHtml = new \Widgets\RawHtml();
     $rawHtml->setHtml($content->get());
     $frameResponseObject->addWidget($rawHtml);
     return $frameResponseObject;
     //$portal->set_page_main($breadcrumb, $content->get(), "");
     //return $portal->get_html();
 }
示例#7
0
 public function execute(\FrameResponseObject $frameResponseObject)
 {
     //DEFINITION OF IGNORED USERS AND GROUPS
     $ignoredUser = array(0 => "postman", 1 => "root", 2 => "guest");
     $ignoredGroups = array(0 => "sTeam", 1 => "admin");
     $steam = $GLOBALS["STEAM"];
     $action = isset($_POST["action"]) ? $_POST["action"] : "";
     $searchString = isset($_POST["searchString"]) ? $_POST["searchString"] : "";
     $searchType = isset($_POST["searchType"]) ? $_POST["searchType"] : "searchUser";
     $steamUser = \lms_steam::get_current_user();
     $searchResult = array();
     $min_search_string_count = 4;
     if ($action != "") {
         $searchString = trim($searchString);
         if (strlen($searchString) < $min_search_string_count) {
             //$frameResponseObject->setProblemDescription(gettext("Search string too short"));
             $frameResponseObject->setProblemDescription("Länge der Suchanfrage zu klein! Eine Suchanfrage muss aus mindestens 4 Zeichen bestehen.");
         } else {
             /* prepare search string */
             $modSearchString = $searchString;
             if ($modSearchString[0] != "%") {
                 $modSearchString = "%" . $modSearchString;
             }
             if ($modSearchString[strlen($modSearchString) - 1] != "%") {
                 $modSearchString = $modSearchString . "%";
             }
             $searchModule = $steam->get_module("searching");
             $searchobject = new \searching($searchModule);
             $search = new \search_define();
             if ($searchType == "searchUser") {
                 $search->extendAttr("OBJ_NAME", \search_define::like($modSearchString));
                 $resultItems = $searchobject->search($search, CLASS_USER);
                 foreach ($resultItems as $r) {
                     $id = $r->get_id();
                     $resultItemName[$id] = $r->get_name(1);
                 }
             } elseif ($searchType == "searchGroup") {
                 $search->extendAttr("GROUP_NAME", \search_define::like($modSearchString));
                 $resultItems = $searchobject->search($search, CLASS_GROUP);
                 foreach ($resultItems as $r) {
                     $id = $r->get_id();
                     $resultItemName[$id] = $r->get_groupname(1);
                 }
             } elseif ($searchType == "searchUserFullname") {
                 $cache = get_cache_function($steamUser->get_name(), 60);
                 $resultUser = $cache->call("lms_steam::search_user", $searchString, "name");
                 $resultItems = array();
                 for ($i = 0; $i < count($resultUser); $i++) {
                     $resultItems[$i] = \steam_factory::get_object($steam->get_id(), $resultUser[$i]["OBJ_ID"]);
                 }
                 foreach ($resultItems as $r) {
                     $id = $r->get_id();
                     $resultItemName[$id] = $r->get_name();
                 }
             }
             if ($searchType != "searchUserFullname") {
                 $result = $steam->buffer_flush();
             } else {
                 $result = array();
                 $counter = 0;
                 foreach ($resultItems as $r) {
                     $result[$r->get_name()] = $r->get_id();
                     $counter++;
                 }
             }
             $helper = array();
             foreach ($resultItems as $r) {
                 $id = $r->get_id();
                 if ($r instanceof \steam_user) {
                     $helper[$r->get_name()] = $id;
                 } else {
                     $helper[$r->get_groupname()] = $id;
                 }
                 $resultItemName[$id] = $result[$resultItemName[$id]];
                 $searchResult[] = $resultItemName[$id];
             }
         }
     }
     // sort favourites
     natcasesort($searchResult);
     $content = \Favorite::getInstance()->loadTemplate("fav_search.html");
     //$content->setVariable("TITLE", gettext("Search for favorites"));
     $content->setVariable("TITLE", "Favoritensuche");
     //$content->setVariable("SEARCH",gettext("Search"));
     $content->setVariable("SEARCH", "Suche");
     //$content->setVariable("BUTTON_LABEL", gettext("Search"));
     $content->setVariable("BUTTON_LABEL", "Suchen");
     //$content->setVariable("GROUPS",gettext("Groups"));
     //$content->setVariable("USER_LOGIN",gettext("User (login)"));
     //$content->setVariable("USER_FULLNAME", gettext("User (fullname)"));
     $content->setVariable("GROUPS", "Gruppen");
     $content->setVariable("USER_LOGIN", "Benutzer (Login)");
     $content->setVariable("USER_FULLNAME", "Benutzer (Namen)");
     if ($action != "") {
         //$content->setVariable("SEARCH_RESULTS", gettext("Search results"));
         $loopCount = 0;
         if ($searchType == "searchUser" || $searchType == "searchUserFullname") {
             $category = "user";
         } else {
             $category = "group";
         }
         foreach ($searchResult as $resultEntry) {
             $content->setVariable("SEARCH_RESULTS", "Suchergebnisse");
             $b = false;
             if ($searchType != "searchUserFullname") {
                 $urlId = $helper[$resultEntry];
             } else {
                 $urlId = $resultEntry;
             }
             if ($category == "user") {
                 foreach ($ignoredUser as $ignore) {
                     if ($ignore == $resultEntry) {
                         $b = true;
                     }
                 }
             }
             if ($category == "group") {
                 foreach ($ignoredGroups as $ignore) {
                     if ($ignore == $resultEntry) {
                         $b = true;
                     }
                 }
             }
             if (!$b) {
                 if ($category == "user") {
                     $content->setCurrentBlock("BLOCK_SEARCH_RESULTS");
                     $content->setVariable("BUDDY_NAME", PATH_URL . "profile/index/" . $resultEntry . "/");
                     //$content->setVariable("BUDDY_NAME1",$resultEntry);
                     $resultUser = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $urlId);
                     $fullname = $resultUser->get_full_name();
                     $content->setVariable("BUDDY_NAME1", $fullname);
                     $picId = $resultUser->get_attribute("OBJ_ICON")->get_id();
                     $content->setVariable("BUDDY_PIC_LINK", PATH_URL . "download/image/" . $picId . "/60/40/");
                     if ($steamUser->get_id() == $resultUser->get_id()) {
                         //$content->setVariable("ALREADY_BUDDY",gettext("Your profile"));
                         $content->setVariable("ALREADY_BUDDY", "Das bist Du!");
                     } elseif (!$steamUser->is_buddy($resultUser)) {
                         //$content->setVariable("ADD_FAVORITE_BUDDY", gettext("Add favorite"));
                         $content->setVariable("ADD_FAVORITE_BUDDY", "Favorit hinzufügen");
                         $content->setVariable("FAVORITE_BUDDY_LINK", PATH_URL . "favorite/add/" . $urlId . "/" . $category . "/");
                     } else {
                         //$content->setVariable("ALREADY_BUDDY", gettext("Already your favorite"));
                         $content->setVariable("ALREADY_BUDDY", "Bereits Teil der Favoritenliste");
                     }
                     $content->parse("BLOCK_SEARCH_RESULTS");
                     $loopCount++;
                 } else {
                     if ($category == "group") {
                         $content->setCurrentBlock("BLOCK_GROUP_LIST");
                         $content->setVariable("GROUP_NAME", $resultEntry);
                         $resultGroup = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $urlId);
                         $groupDesc = $resultGroup->get_attribute("OBJ_DESC");
                         $content->setVariable("GROUP_DESC", $groupDesc);
                         if (!$steamUser->is_buddy($resultGroup)) {
                             $content->setVariable("ADD_FAVORITE_GROUP", "Favorit hinzufügen");
                             //$content->setVariable("ALREADY_BUDDY", "Bereits Teil der Favoritenliste");
                             $content->setVariable("FAVORITE_GROUP_LINK", PATH_URL . "favorite/add/" . $urlId . "/" . $category . "/");
                         } else {
                             $content->setVariable("ALREADY_GROUP", "Bereits Teil der Favoritenliste");
                         }
                         $content->parse("BLOCK_GROUP_LIST");
                         $loopCount++;
                     }
                 }
             }
         }
         if ($loopCount == 0 || count($searchResult) == 0) {
             $content->setVariable("NO_RESULT", "Suchanfrage ergab keinen Treffer");
         }
     }
     $headline = new \Widgets\Breadcrumb();
     //$headline->setData(array(array("name"=>gettext("Profile"), "link"=>PATH_URL."profile/index/"),array("name"=>" / ".gettext("Favorites"), "link"=>PATH_URL."favorite/index/"),array("name"=>" / ".gettext("Favorite search"))));
     $headline->setData(array(array("name" => "Profil", "link" => PATH_URL . "profile/index/"), array("name" => "Favoriten", "link" => PATH_URL . "favorite/index/"), array("name" => "Favoritensuche")));
     $rawHtml = new \Widgets\RawHtml();
     $rawHtml->setHtml($content->get());
     $frameResponseObject->addWidget($headline);
     $frameResponseObject->addWidget($rawHtml);
     return $frameResponseObject;
 }
示例#8
0
 public function frameResponse(\FrameResponseObject $frameResponseObject)
 {
     $rawHtml = new \Widgets\RawHtml();
     $errorCode = isset($this->params[0]) ? $this->params[0] : 0;
     $errorId = isset($this->params[1]) ? $this->params[1] : 0;
     try {
         switch ($errorCode) {
             case E_AJAX_ERROR:
             case E_JS_ERROR:
                 $frameResponseObject->setTitle("Error");
                 $frameResponseObject->setHeadline("Das hätte nicht passieren sollen.");
                 $frameResponseObject->setProblemDescription("Es ist ein undefinierter Fehler aufgetreten. Das Problem ist protokolliert und es wird bald behoben.");
                 $errorTitle = isset($_COOKIE["title"]) ? $_COOKIE["title"] : "";
                 $errorDescription = isset($_COOKIE["description"]) ? $_COOKIE["description"] : "";
                 $errorLocation = isset($_COOKIE["location"]) ? $_COOKIE["location"] : "";
                 $errorParams = isset($_COOKIE["params"]) ? $_COOKIE["params"] : "";
                 $subject = PLATFORM_NAME . " Error AJAX/JS Handling";
                 mail(ERROR_MAIL_RECEIVER, '=?UTF-8?B?' . base64_encode($subject) . '?=', $errorTitle . "\n" . $errorDescription, null, '-f' . ERROR_MAIL_SENDER);
                 setcookie("title", "", -1);
                 setcookie("description", "", -1);
                 setcookie("location", "", -1);
                 setcookie("params", "", -1);
                 break;
             case E_USER_RIGHTS:
                 $frameResponseObject->setTitle(gettext("No Access"));
                 $rawHtml->setHtml(gettext("No sufficient rights for this object"));
                 $frameResponseObject->setProblemDescription(gettext("You have not the required rights to execute this action. Please consult the owner of the object for further information.") . "<br /><a href=\"" . $_SERVER["HTTP_REFERER"] . "\">" . gettext("back") . "</a>");
                 break;
             case E_USER_NO_NETWORKINGPROFILE:
                 $frameResponseObject->setTitle(gettext("User Profile not initialized"));
                 $rawHtml->setHtml(gettext("User Profile not initialized"));
                 $frameResponseObject->setProblemDescription(gettext("This user never logged in using the koaLA frontend. Therefore the profile is not initilized yet.<br />The profile will be displayed if the user has used the koaLA frontend at least once.") . "<br /><a href=\"" . $_SERVER["HTTP_REFERER"] . "\">" . gettext("back") . "</a>");
                 break;
             case E_CONNECTION:
                 switch (TRUE) {
                     case defined("MAINTAINANCE") && MAINTAINANCE && defined("MAINTAINANCE_MESSAGE") && MAINTAINANCE_MESSAGE && MAINTAINANCE_MESSAGE != "":
                         $frameResponseObject->setTitle(gettext("Maintainance"));
                         $rawHtml->setHtml(gettext("Maintainance"));
                         $frameResponseObject->setProblemDescription(MAINTAINANCE_MESSAGE . "<br /><a href=\"" . PATH_URL . "\">" . gettext("To the start page.") . "</a>");
                         break;
                     case defined("BACKUP_TIME_START") && defined("BACKUP_TIME_END") && BACKUP_TIME_START && BACKUP_TIME_END && BACKUP_TIME_START <= date("G") && date("G") <= BACKUP_TIME_END:
                         $frameResponseObject->setTitle(gettext("Backup"));
                         $rawHtml->setHtml(gettext("Backup"));
                         $frameResponseObject->setProblemDescription(str_replace("%START", BACKUP_TIME_START, str_replace("%END", BACKUP_TIME_END, gettext("The koaLA System is being backuped. The backup process approximately runs from %START to %END each day.") . "<br />" . gettext("Please try again later."))) . "<br /><a href=\"" . PATH_URL . "\">" . gettext("To the start page.") . "</a>");
                         break;
                     default:
                         $frameResponseObject->setTitle(gettext("Unable to process request"));
                         $rawHtml->setHtml(gettext("Unable to process request"));
                         $frameResponseObject->setProblemDescription(gettext("system is not available at the moment. We are working on the problem. Please try again later.") . "</a> " . "<br /><a href=\"" . PATH_URL . "\">" . gettext("To the start page."));
                 }
                 break;
             case E_CONFIGURATION:
                 $frameResponseObject->setTitle(gettext("Error in koala configuration"));
                 $rawHtml->setHtml(gettext("Error in koala configuration"));
                 $frameResponseObject->setProblemDescription(str_replace("%MAIL", "<a href=\"mailto:" . SUPPORT_EMAIL . "?subject=" . PLATFORM_NAME . "%20Configuration%20Error%20" . $errorId . "%20&body=Configuration error: Refer to the " . PLATFORM_NAME . " error log to get more details." . "\">" . gettext("Mail an error description") . "</a>", gettext("There is an error in the koala configuration. %MAIL.")) . "<br /><a href=\"" . PATH_URL . "\">" . gettext("To the start page.") . "</a>");
                 break;
             case E_SOAP_SERVICE_ERROR:
             case E_SOAP_INVALID_PASSWORD:
             case E_SOAP_INVALID_INPUT:
             case E_SOAP_INVALID_RESPONSE_DATA:
                 $frameResponseObject->setTitle(gettext("SOAP Error"));
                 $rawHtml->setHtml(gettext("Communication error"));
                 $frameResponseObject->setProblemDescription(str_replace("%MAIL", "<a href=\"mailto:" . SUPPORT_EMAIL . "?subject=" . PLATFORM_NAME . "%20Configuration%20Error%20" . $errorId . "%20&body=Communication error: Refer to the " . PLATFORM_NAME . " error log to get more details.\r\n" . rawurlencode("\r\nReferer: " . (!empty($_SERVER["HTTP_REFERER"]) ? $_SERVER["HTTP_REFERER"] : "Direct call") . "\n") . "\"/>" . gettext("Mail an error description") . "</a>", gettext(" An error occured while communicating with the PAUL system. Please help the koaLA support fixing this issue by providing some information e.g. how to produce this error. Please keep in mind that it may be a temporary problem, so try again later.") . "<br />" . "%MAIL") . "<br /><br /><a href=\"" . PATH_URL . "\">" . gettext("To the start page.") . "</a>");
                 break;
             default:
                 if (isset($_SESSION["ERROR_ID"]) && $errorId == $_SESSION["ERROR_ID"]) {
                     if (isset($_SESSION["ERROR_REFERER"]) && !empty($_SESSION["ERROR_REFERER"])) {
                         $referer = $_SESSION["ERROR_REFERER"];
                     } else {
                         if (isset($_SERVER["HTTP_REFERER"]) && !empty($_SERVER["HTTP_REFERER"])) {
                             $referer = $_SERVER["HTTP_REFERER"];
                         } else {
                             $referer = "Direct call";
                         }
                     }
                     $frameResponseObject->setTitle("Error");
                     $frameResponseObject->setHeadline(gettext("An error occured."));
                     $frameResponseObject->setProblemDescription(str_replace("%MAIL", "<a href=\"mailto:" . SUPPORT_EMAIL . "?subject=" . PLATFORM_NAME . "%20Error%20" . $errorId . "&body=" . rawurlencode("\n\nReferer: " . $referer . "\n") . "\">" . gettext("Mail an error description") . "</a>", gettext("An unspecified error occured. Please help fixing this issue by sending a detailed error description: %MAIL.")) . "<br /><a href=\"" . PATH_URL . "\">" . gettext("To the start page.") . "</a>");
                     $error_text = "";
                     if (defined("DEVELOPMENT_MODE") && DEVELOPMENT_MODE) {
                         if (isset($_SESSION["ERROR_REFERER"])) {
                             $error_referer = $_SESSION["ERROR_REFERER"];
                         } else {
                             $error_referer = "";
                         }
                         if (isset($_SESSION["ERROR_TEXT"])) {
                             $error_text = $_SESSION["ERROR_TEXT"];
                         } else {
                             $error_text = "";
                         }
                         $error_text = htmlentities($error_text);
                         $error_text = "<h1 style=\"display:inline\">Entwickler Modus</h1> <a href=\"" . $error_referer . "\">Seite erneut laden</a><br><div style=\"background-color:#ccc;border:1px solid #ddd;overflow-x:auto\"><pre>" . $error_text . "</pre></div>";
                     }
                     $rawHtml->setHtml($error_text);
                 } else {
                     $frameResponseObject->setTitle("Error");
                     $frameResponseObject->setProblemDescription("Probleme bei der Fehlerbehandlung. <br> Mögliche Ursache: Es sind mehrer Fehler aufgetreten. Diese Seite bezieht sich auf ein veraltetes Problem.<br>Daher ist leider keine nähere Fehlerbeschreibung möglich.");
                 }
                 break;
         }
         $frameResponseObject->addWidget($rawHtml);
         return $frameResponseObject;
     } catch (Exception $e) {
         echo "error in server configuration";
         error_log($e->getMessage() . "\n" . $e->getTraceAsString());
         die;
     }
 }
示例#9
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");
        $survey_object->parseXML($xml);
        $questions = $survey_object->getQuestions();
        $user = $GLOBALS["STEAM"]->get_current_steam_user();
        $RapidfeedbackExtension->addCSS();
        // check 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;
        }
        // collect user input if view got submitted (and check for errors)
        $values = array();
        $errors = array();
        if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST["submit_survey"])) {
            $questionCounter = 0;
            foreach ($questions as $question) {
                if ($question instanceof \Rapidfeedback\Model\TextQuestion | $question instanceof \Rapidfeedback\Model\TextareaQuestion) {
                    $value = $_POST["question" . $questionCounter];
                    if ($question->getRequired() == 1 && trim($value) == "") {
                        array_push($errors, $questionCounter);
                    } else {
                        if (trim($value) == "") {
                            $values[$questionCounter] = -1;
                        } else {
                            $values[$questionCounter] = trim($value);
                        }
                    }
                } else {
                    if ($question instanceof \Rapidfeedback\Model\SingleChoiceQuestion) {
                        if (!isset($_POST["question" . $questionCounter])) {
                            if ($question->getRequired() == 1) {
                                array_push($errors, $questionCounter);
                            } else {
                                $values[$questionCounter] = -1;
                            }
                        } else {
                            $values[$questionCounter] = $_POST["question" . $questionCounter];
                        }
                    } else {
                        if ($question instanceof \Rapidfeedback\Model\MultipleChoiceQuestion) {
                            $optionsCount = count($question->getOptions());
                            $results = array();
                            for ($count = 0; $count < $optionsCount; $count++) {
                                if (isset($_POST["question" . $questionCounter . "_" . $count])) {
                                    array_push($results, $count);
                                }
                            }
                            if ($question->getRequired() == 1 && empty($results)) {
                                array_push($errors, $questionCounter);
                            } else {
                                $values[$questionCounter] = $results;
                            }
                        } else {
                            if ($question instanceof \Rapidfeedback\Model\MatrixQuestion) {
                                $rowCount = count($question->getRows());
                                $results = array();
                                for ($count = 0; $count < $rowCount; $count++) {
                                    if (isset($_POST["question" . $questionCounter . "_" . $count])) {
                                        array_push($results, $_POST["question" . $questionCounter . "_" . $count]);
                                    }
                                }
                                if ($question->getRequired() == 1 && count($results) < $rowCount) {
                                    array_push($errors, $questionCounter);
                                    $values[$questionCounter] = $results;
                                } else {
                                    $values[$questionCounter] = $results;
                                }
                            }
                        }
                    }
                }
                $questionCounter++;
            }
            // if there are errors show error msg, else save answers
            if (!empty($errors)) {
                $problemdescription = "Erforderliche Fragen nicht beantwortet: ";
                foreach ($errors as $error) {
                    $problemdescription = $problemdescription . ($error + 1) . ", ";
                }
                $problemdescription = substr($problemdescription, 0, strlen($problemdescription) - 2);
                $frameResponseObject->setProblemDescription($problemdescription);
            } else {
                $participants = $survey->get_attribute("RAPIDFEEDBACK_PARTICIPANTS");
                $adminsAllowed = $rapidfeedback->get_attribute("RAPIDFEEDBACK_ADMIN_SURVEY");
                if (!in_array($user->get_id(), $participants) && ($admin == 1 && $adminsAllowed == 1) | $admin == 0) {
                    $resultCount = $survey->get_attribute("RAPIDFEEDBACK_RESULTS");
                    array_push($participants, $user->get_id());
                    $survey->set_attribute("RAPIDFEEDBACK_PARTICIPANTS", $participants);
                    $survey->set_attribute("RAPIDFEEDBACK_RESULTS", $resultCount + 1);
                    $resultContainer = \steam_factory::get_object_by_name($GLOBALS["STEAM"]->get_id(), $survey->get_path() . "/results");
                    $resultObject = \steam_factory::create_document($GLOBALS["STEAM"]->get_id(), "results" . $user->get_id(), "", "text/plain", $resultContainer, "Results of user " . $user->get_id());
                    $questionCounter = 0;
                    foreach ($questions as $question) {
                        if (isset($values[$questionCounter])) {
                            $resultObject->set_attribute("RAPIDFEEDBACK_ANSWER_" . $questionCounter, $values[$questionCounter]);
                        } else {
                            $resultObject->set_attribute("RAPIDFEEDBACK_ANSWER_" . $questionCounter, -1);
                        }
                        $questionCounter++;
                    }
                }
            }
        }
        // display success msg if there was a submit, else just display survey
        if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST["submit_survey"]) && empty($errors)) {
            $headline_label = "Antworten gespeichert";
            $html = '
			<center>
				<h1>Ihre Antworten wurden erfolgreich gespeichert.</h1>
				<div style="text-align:center" class="buttons">
					<a class="button" href="' . $RapidfeedbackExtension->getExtensionUrl() . "Index/" . $rapidfeedback->get_id() . '">Zurück zur Übersicht</a>
				</div>
			</center>
			';
        } else {
            $content = $RapidfeedbackExtension->loadTemplate("rapidfeedback_view.template.html");
            $content->setCurrentBlock("BLOCK_VIEW_SURVEY");
            $content->setVariable("SURVEY_NAME", $survey_object->getName());
            $content->setVariable("SURVEY_BEGIN", $survey_object->getBeginText());
            $content->setVariable("SURVEY_END", $survey_object->getEndText());
            $content->setVariable("QUESTION_NEEDED", "Erforderlich");
            $state = $survey->get_attribute("RAPIDFEEDBACK_STATE");
            if ($admin == 0 | $state != 0) {
                $content->setVariable("DISPLAY_EDIT", "none");
            }
            $content->setVariable("ASSET_URL", $RapidfeedbackExtension->getAssetUrl() . "icons");
            $content->setVariable("EDIT_TITLE", "Umfrage bearbeiten");
            $content->setVariable("EDIT_URL", $RapidfeedbackExtension->getExtensionUrl() . "edit/" . $this->id . "/" . $survey->get_id());
            $html = "";
            $counter = 0;
            foreach ($questions as $question) {
                if (in_array($counter, $errors)) {
                    if (isset($values[$counter])) {
                        $html = $html . $question->getViewHTML($counter, 1, $values[$counter]);
                    } else {
                        $html = $html . $question->getViewHTML($counter, 1);
                    }
                } else {
                    if (isset($values[$counter])) {
                        $html = $html . $question->getViewHTML($counter, 0, $values[$counter]);
                    } else {
                        $html = $html . $question->getViewHTML($counter, 0);
                    }
                }
                $counter++;
            }
            $content->setVariable("QUESTIONS_HTML", $html);
            $content->setVariable("SUBMIT_SURVEY", "Antworten abschicken");
            $preview = 0;
            if (isset($this->params[2])) {
                $preview = 1;
            }
            if ($preview == 1) {
                $content->setVariable("DISPLAY_SUBMIT", "none");
                $headline_label = "Umfrage: Vorschau";
            } else {
                $headline_label = "Umfrage ausfüllen";
            }
            $content->setVariable("BACK_LABEL", "Zurück");
            $content->setVariable("BACK_URL", $RapidfeedbackExtension->getExtensionUrl() . "Index/" . $rapidfeedback->get_id());
            $content->parse("BLOCK_VIEW_SURVEY");
            $html = $content->get();
        }
        $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($html);
        $frameResponseObject->addWidget($rawWidget);
        $frameResponseObject->setHeadline(array(array("name" => $courseOrGroup, "link" => $courseOrGroupUrl), array("name" => "Rapid Feedback", "link" => $RapidfeedbackExtension->getExtensionUrl() . "Index/" . $rapidfeedback->get_id()), array("name" => $headline_label)));
        return $frameResponseObject;
    }
示例#10
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 {
         $currentUser = $GLOBALS["STEAM"]->get_current_steam_user();
         $object = $currentUser->get_workroom();
         $this->id = $object->get_id();
     }
     if (!$object instanceof \steam_object) {
         \ExtensionMaster::getInstance()->send404Error();
         die;
     }
     $objectModel = \AbstractObjectModel::getObjectModel($object);
     if ($object && $object instanceof \steam_container) {
         $count = $object->count_inventory();
         if ($count > 150) {
             die("Es befinden sich {$count} Objekte im diesem Ordner. Das Laden ist nicht möglich.");
         }
         $objects = $object->get_inventory();
     } else {
         $objects = array();
     }
     $objectType = getObjectType($object);
     switch ($objectType) {
         case "document":
             header("location: " . PATH_URL . "explorer/ViewDocument/" . $this->id . "/");
             die;
             break;
         case "forum":
             header("location: " . PATH_URL . "forum/Index/" . $this->id . "/");
             die;
             break;
         case "referenceFolder":
             $exitObject = $object->get_exit();
             header("location: " . PATH_URL . "explorer/Index/" . $exitObject->get_id() . "/");
             die;
             break;
         case "referenceFile":
             $linkObject = $object->get_link_object();
             header("location: " . PATH_URL . "explorer/Index/" . $linkObject->get_id() . "/");
             die;
             break;
         case "user":
             header("location: " . PATH_URL . "user/Index/" . $object->get_name() . "/");
             die;
             break;
         case "group":
             \ExtensionMaster::getInstance()->send404Error();
             die;
             break;
         case "trashbin":
             \ExtensionMaster::getInstance()->send404Error();
             die;
             break;
         case "portal_old":
             $rawHtml = new \Widgets\RawHtml();
             //$rawHtml->setHtml("Dies ist ein \"altes\" Portal und kann nicht mehr angezeigt werden. Bitte umwandeln.");
             $frameResponseObject->addWidget($rawHtml);
             $frameResponseObject->setProblemDescription("Dies ist ein \"altes\" Portal und kann nicht mehr angezeigt werden.");
             $frameResponseObject->setProblemSolution("Bitte umwandeln.");
             return $frameResponseObject;
             break;
         case "gallery":
             header("location: " . PATH_URL . "gallery/Index/" . $this->id . "/");
             die;
             break;
         case "portal":
             header("location: " . PATH_URL . "portal/Index/" . $this->id . "/");
             die;
             break;
         case "portalColumn":
             \ExtensionMaster::getInstance()->send404Error();
             die;
             break;
         case "portalPortlet":
             \ExtensionMaster::getInstance()->send404Error();
             die;
             break;
         case "userHome":
             //ok
             break;
         case "groupWorkroom":
             //ok
             break;
         case "room":
             //ok
             break;
         case "container":
             //ok
             break;
         case "unknown":
             \ExtensionMaster::getInstance()->send404Error();
             die;
             break;
     }
     $title = getCleanName($object);
     $parent = $object->get_environment();
     if ($parent instanceof \steam_container) {
         //$parentLink = array("name"=>"nach oben", "link"=>PATH_URL . "explorer/Index/" . $parent->get_id() . "/");
         $parentLink = "";
     } else {
         $parentLink = "";
     }
     $breadcrumb = new \Widgets\Breadcrumb();
     $breadcrumb->setData(array($parentLink, array("name" => "<img src=\"" . PATH_URL . "explorer/asset/icons/mimetype/" . deriveIcon($object) . "\"></img> " . $title . " " . \Explorer\Model\Sanction::getMarkerHtml($object, false))));
     $this->getExtension()->addJS();
     $this->getExtension()->addCSS();
     $actionBar = new \Widgets\ActionBar();
     $actionBar->setActions(array(array("name" => "Neu", "ajax" => array("onclick" => array("command" => "newElement", "params" => array("id" => $this->id), "requestType" => "popup"))), array("name" => "Eigenschaften", "ajax" => array("onclick" => array("command" => "properties", "params" => array("id" => $this->id), "requestType" => "popup"))), array("name" => "Rechte", "ajax" => array("onclick" => array("command" => "Sanctions", "params" => array("id" => $this->id), "requestType" => "popup")))));
     //$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/")));
     $presentation = $object->get_attribute("bid:presentation");
     $preHtml = "";
     if ($presentation === "head") {
         $objects = $object->get_inventory();
         if (count($objects) > 0) {
             $first = $objects[0];
             $mimetype = $first->get_attribute(DOC_MIME_TYPE);
             if ($mimetype == "image/png" || $mimetype == "image/jpeg" || $mimetype == "image/gif") {
                 // Image
                 $preHtml = "<div style=\"text-align:center\"><img style=\"max-width:100%\" src=\"" . PATH_URL . "Download/Document/" . $first->get_id() . "/\"></div>";
             } else {
                 if ($mimetype == "text/html") {
                     $preHtml = strip_tags($first->get_content(), "<h1><h2><h3><h4><h5><p><a><div><style><b><i><strong><img><hr><table><tr><th><td><ul><ol><li>");
                 } else {
                     if (strstr($mimetype, "text")) {
                         $bidDokument = new \BidDocument($first);
                         $preHtml = $bidDokument->get_content();
                     }
                 }
             }
         }
     } else {
         if ($presentation === "index" && !(isset($_GET["view"]) && $_GET["view"] === "list")) {
             $objects = $object->get_inventory();
             if (count($objects) > 0) {
                 $first = $objects[0];
                 $url = \ExtensionMaster::getInstance()->getUrlForObjectId($first->get_id(), "view");
                 header("location: {$url}");
                 exit;
             }
         }
     }
     if ($preHtml !== "") {
         $preHtml = "<div style=\"border-bottom: 1px solid #ccc; padding-bottom:10px; margin-bottom:10px\">{$preHtml}</div>";
     }
     $environment = new \Widgets\RawHtml();
     $environment->setHtml("{$preHtml}<input type=\"hidden\" id=\"environment\" name=\"environment\" value=\"{$this->id}\">");
     $loader = new \Widgets\Loader();
     $loader->setWrapperId("explorerWrapper");
     $loader->setMessage("Lade Dokumente ...");
     $loader->setCommand("loadContent");
     $loader->setParams(array("id" => $this->id));
     $loader->setElementId("explorerWrapper");
     $loader->setType("updater");
     $rawHtml = new \Widgets\RawHtml();
     $rawHtml->setHtml("<div id=\"explorerContent\">" . $breadcrumb->getHtml() . $environment->getHtml() . $loader->getHtml() . "</div>");
     $rawHtml->addWidget($breadcrumb);
     $rawHtml->addWidget($environment);
     $rawHtml->addWidget($loader);
     $frameResponseObject->setTitle($title);
     $frameResponseObject->addWidget($actionBar);
     $frameResponseObject->addWidget($rawHtml);
     return $frameResponseObject;
 }