当前位置: 首页>>代码示例>>PHP>>正文


PHP Wiki::getInstance方法代码示例

本文整理汇总了PHP中Wiki::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP Wiki::getInstance方法的具体用法?PHP Wiki::getInstance怎么用?PHP Wiki::getInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Wiki的用法示例。


在下文中一共展示了Wiki::getInstance方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: execute

 public function execute(\FrameResponseObject $frameResponseObject)
 {
     //CODE FOR ALL COMMANDS OF THIS PAKAGE END
     $user = \lms_steam::get_current_user();
     // Disable caching
     // TODO: Work on cache handling. An enabled cache leads to bugs
     // if used with the wiki.
     \CacheSettings::disable_caching();
     if (!($wiki_container = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id))) {
         include "bad_link.php";
         exit;
     }
     if (!$wiki_container instanceof \steam_container) {
         $wiki_doc = $wiki_container;
         $wiki_container = $wiki_doc->get_environment();
         if ($wiki_doc->get_attribute(DOC_MIME_TYPE) != "text/wiki") {
             include "bad_link.php";
             exit;
         }
     }
     //CODE FOR ALL COMMANDS OF THIS PAKAGE END
     $compare = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->params[1]);
     $to = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->params[2]);
     $wiki_html_handler = new \lms_wiki($wiki_container);
     //$wiki_html_handler->set_admin_menu( "versions", $wiki_doc );
     $content = \Wiki::getInstance()->loadTemplate("wiki_version_compare.template.html");
     //$content = new HTML_TEMPLATE_IT();
     //$content->loadTemplateFile( PATH_TEMPLATES . "wiki_version_compare.template.html" );
     $difftext = wiki_diff_html($to, $compare);
     $content->setVariable("DIFF_TEXT", $difftext);
     $wiki_html_handler->set_main_html($content->get());
     $rootlink = \lms_steam::get_link_to_root($wiki_container);
     WIKI_FULL_HEADLINE ? $headline = array($rootlink[0], $rootlink[1], array("link" => $rootlink[1]["link"] . "communication/", "name" => gettext("Communication")), array("name" => h($wiki_container->get_name()), "link" => PATH_URL . "wiki/index/" . $wiki_container->get_id() . "/"), array("link" => PATH_URL . "wiki/viewentry/" . $wiki_doc->get_id() . "/", "name" => str_replace(".wiki", "", h($wiki_doc->get_name()))), array("link" => PATH_URL . "wiki/versionoverview/" . $wiki_doc->get_id(), "name" => gettext("Version management")), array("link" => "", "name" => gettext("Version compare") . " (" . $compare->get_version() . " " . gettext("to") . " " . $to->get_version() . ")")) : ($headline = array(array("name" => h($wiki_container->get_name()), "link" => PATH_URL . "wiki/index/" . $wiki_container->get_id() . "/"), array("link" => PATH_URL . "wiki/viewentry/" . $wiki_doc->get_id() . "/", "name" => str_replace(".wiki", "", h($wiki_doc->get_name()))), array("link" => PATH_URL . "wiki/versionoverview/" . $wiki_doc->get_id() . "/versions/", "name" => gettext("Version management")), array("link" => "", "name" => gettext("Version compare") . " (" . $compare->get_version() . " " . gettext("to") . " " . $to->get_version() . ")")));
     /*$portal->set_page_main(
     		$headline,
     		$wiki_html_handler->get_html()
     		);
     		$portal->show_html();
     		*/
     $frameResponseObject->setHeadline($headline);
     $widget = new \Widgets\RawHtml();
     $widget->setHtml($wiki_html_handler->get_html());
     $frameResponseObject->addWidget($widget);
     return $frameResponseObject;
 }
开发者ID:rolwi,项目名称:koala,代码行数:45,代码来源:Compareversions.class.php

示例2: execute

    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);
//.........这里部分代码省略.........
开发者ID:rolwi,项目名称:koala,代码行数:101,代码来源:Editentry.class.php

示例3: execute

 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();
     		*/
 }
开发者ID:rolwi,项目名称:koala,代码行数:61,代码来源:Recoverversion.class.php

示例4: execute


//.........这里部分代码省略.........
             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");
开发者ID:rolwi,项目名称:koala,代码行数:67,代码来源:Editwiki.class.php

示例5: execute

 public function execute(\FrameResponseObject $frameResponseObject)
 {
     //CODE FOR ALL COMMANDS OF THIS PAKAGE END
     $user = \lms_steam::get_current_user();
     // Disable caching
     // TODO: Work on cache handling. An enabled cache leads to bugs
     // if used with the wiki.
     \CacheSettings::disable_caching();
     if (!($wiki_container = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id))) {
         include "bad_link.php";
         exit;
     }
     if (!$wiki_container instanceof \steam_container) {
         $wiki_doc = $wiki_container;
         $wiki_container = $wiki_doc->get_environment();
         if ($wiki_doc->get_attribute(DOC_MIME_TYPE) != "text/wiki") {
             include "bad_link.php";
             exit;
         }
     }
     //CODE FOR ALL COMMANDS OF THIS PAKAGE END
     $wiki_html_handler = new \lms_wiki($wiki_container);
     $wiki_html_handler->set_admin_menu("mediathek", $wiki_container);
     $content = \Wiki::getInstance()->loadTemplate("wiki_mediathek.template.html");
     //$content = new HTML_TEMPLATE_IT();
     //$content->loadTemplateFile( PATH_TEMPLATES . "wiki_mediathek.template.html" );
     // get images
     $inventory = $wiki_container->get_inventory();
     if (!is_array($inventory)) {
         $inventory = array();
     }
     if (sizeof($inventory) > 0) {
         \steam_factory::load_attributes($GLOBALS["STEAM"]->get_id(), $inventory, array(OBJ_NAME, OBJ_DESC, DOC_MIME_TYPE));
         $images = array();
         foreach ($inventory as $object) {
             $mime = strtolower($object->get_attribute(DOC_MIME_TYPE));
             if ($mime === "image/jpg" || $mime === "image/jpeg" || $mime === "image/gif" || $mime === "image/png") {
                 $images[] = $object;
             }
         }
         foreach ($images as $image) {
             $actions = '<a href="' . PATH_URL . 'doc/' . $image->get_id() . '/">' . gettext("show properties") . '</a><br>';
             $actions .= '<a href="' . PATH_URL . 'doc/' . $image->get_id() . '/edit/">' . gettext("edit properties") . '</a><br>';
             $actions .= '<a href="' . PATH_URL . 'doc/' . $image->get_id() . '/deleteImage/" onclick="return confirmDeletion();">' . gettext("delete image") . '</a>';
             $imageData = imagecreatefromstring($image->get_content());
             $width = $newWidth = imagesx($imageData);
             $height = $newHeight = imagesy($imageData);
             if ($width > 160) {
                 $newHeight = (int) ($height * 160 / $width);
                 $newWidth = 160;
             }
             if ($newHeight > 80) {
                 $newWidth = (int) ($newWidth * 80 / $newHeight);
                 $newHeight = 80;
             }
             $content->setCurrentBlock("BLOCK_IMAGE");
             $content->setVariable("IMAGE_NAME", $image->get_name());
             $content->setVariable("IMAGE_ID", $image->get_id());
             $content->setVariable("IMAGE_DESCRIPTION", $image->get_attribute('OBJ_DESC'));
             $content->setVariable("IMAGE_LINK", PATH_URL . "download/image/" . $image->get_id() . "/" . $newWidth . "/" . $newHeight . "/");
             $content->setVariable("PREVIEW_LINK", "javascript:showBox(" . $image->get_id() . "," . $width . "," . $height . ");");
             $content->setVariable("IMAGE_ACTIONS", $actions);
             $content->parse("BLOCK_IMAGE");
         }
     }
     $question = gettext("Do you really want to delete this image?");
     $note = gettext("NOTE: All wiki-entries containing this image have to be updated manually!");
     $content->setVariable("QUESTION", $question);
     $content->setVariable("NOTE", $note);
     $content->setVariable("LABEL_CLOSE", gettext("close"));
     $content->setVariable("BACK_LINK", PATH_URL . "wiki/index/" . $wiki_container->get_id() . "/");
     $content->setVariable("BACK_LABEL", gettext("back"));
     $wiki_html_handler->set_main_html($content->get());
     // breadcrumbs
     $rootlink = \lms_steam::get_link_to_root($wiki_container);
     WIKI_FULL_HEADLINE ? $headline = array($rootlink[0], $rootlink[1], array("link" => $rootlink[1]["link"] . "communication/", "name" => gettext("Communication")), array("name" => h($wiki_container->get_name()), "link" => PATH_URL . "wiki/index/" . $wiki_container->get_id() . "/"), array("link" => "", "name" => gettext("Mediathek"))) : ($headline = array(array("name" => h($wiki_container->get_name()), "link" => PATH_URL . "wiki/index/" . $wiki_container->get_id() . "/"), array("link" => "", "name" => gettext("Mediathek"))));
     /*$portal->set_page_main(
     		$headline,
     		$wiki_html_handler->get_html()
     		);
     		$portal->show_html();
     		*/
     $frameResponseObject->setHeadline($headline);
     $widget = new \Widgets\RawHtml();
     $widget->setHtml($wiki_html_handler->get_html());
     $frameResponseObject->addWidget($widget);
     return $frameResponseObject;
 }
开发者ID:rolwi,项目名称:koala,代码行数:88,代码来源:Mediathek.class.php

示例6: execute

 public function execute(\FrameResponseObject $frameResponseObject)
 {
     //CODE FOR ALL COMMANDS OF THIS PAKAGE END
     $user = \lms_steam::get_current_user();
     // Disable caching
     // TODO: Work on cache handling. An enabled cache leads to bugs
     // if used with the wiki.
     \CacheSettings::disable_caching();
     if (!($wiki_container = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id))) {
         include "bad_link.php";
         exit;
     }
     if (!$wiki_container instanceof \steam_container) {
         $wiki_doc = $wiki_container;
         $wiki_container = $wiki_doc->get_environment();
         if ($wiki_doc->get_attribute(DOC_MIME_TYPE) != "text/wiki") {
             include "bad_link.php";
             exit;
         }
     }
     //CODE FOR ALL COMMANDS OF THIS PAKAGE END
     if ($wiki_doc != null) {
         if (@$_REQUEST["force_delete"]) {
             // is deleted entry wiki startpage ?
             $entryName = $wiki_doc->get_name();
             $startpage = $wiki_container->get_attribute("OBJ_WIKI_STARTPAGE") . ".wiki";
             if ($entryName == $startpage) {
                 $wiki_container->set_attribute("OBJ_WIKI_STARTPAGE", "glossary");
             }
             \lms_steam::delete($wiki_doc);
             // clean wiki cache (not used by wiki)
             $cache = get_cache_function($wiki_container->get_id(), 600);
             $cache->clean("lms_wiki::get_items", $wiki_container->get_id());
             $_SESSION["confirmation"] = gettext("Wiki entry deleted sucessfully");
             // clean rsscache
             $rcache = get_cache_function("rss", 600);
             $feedlink = PATH_URL . "services/feeds/wiki_public.php?id=" . $wiki_container->get_id();
             $rcache->drop("lms_rss::get_items", $feedlink);
             header("Location: " . PATH_URL . "wiki/deleteentry/" . $wiki_container->get_id() . "/");
         } else {
             $wiki_name = h(substr($wiki_doc->get_name(), 0, -5));
             $content = \Wiki::getInstance()->loadTemplate("wiki_delete.template.html");
             //$content = new HTML_TEMPLATE_IT();
             //$content->loadTemplateFile( PATH_TEMPLATES . "wiki_delete.template.html" );
             $content->setVariable("LABEL_ARE_YOU_SURE", str_replace("%NAME", h($wiki_name), gettext("Are you sure you want to delete the wiki page '%NAME' ?")));
             $content->setVariable("LABEL_DELETE", gettext('Delete'));
             $content->setVariable("LABEL_OR", gettext('or'));
             $content->setVariable("LABEL_CANCEL", gettext('Cancel'));
             $content->setVariable("FORM_ACTION", $_SERVER["REQUEST_URI"]);
             $content->setVariable("BACK_LINK", PATH_URL . "wiki/viewentry/" . $wiki_doc->get_id() . "/");
             //Breadcrumbs
             $rootlink = \lms_steam::get_link_to_root($wiki_container);
             WIKI_FULL_HEADLINE ? $headline = array($rootlink[0], $rootlink[1], array("link" => $rootlink[1]["link"] . "communication/", "name" => gettext("Communication")), array("name" => h($wiki_container->get_name()), "link" => PATH_URL . "wiki/index/" . $wiki_container->get_id() . "/"), array("link" => PATH_URL . "wiki/viewentry/" . $wiki_doc->get_id() . "/", "name" => str_replace(".wiki", "", h($wiki_doc->get_name()))), array("link" => "", "name" => gettext("Delete"))) : ($headline = array(array("name" => h($wiki_container->get_name()), "link" => PATH_URL . "wiki/index/" . $wiki_container->get_id() . "/"), array("link" => PATH_URL . "wiki/viewentry/" . $wiki_doc->get_id() . "/", "name" => str_replace(".wiki", "", h($wiki_doc->get_name()))), array("link" => "", "name" => gettext("Delete"))));
             /*$portal->set_page_main($headline, $content->get(), "");
             		$portal->show_html();*/
             $frameResponseObject->setHeadline($headline);
             $widget = new \Widgets\RawHtml();
             $widget->setHtml($content->get());
             $frameResponseObject->addWidget($widget);
             return $frameResponseObject;
         }
     }
 }
开发者ID:rolwi,项目名称:koala,代码行数:63,代码来源:Deleteentry.class.php

示例7: execute

 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;
 }
开发者ID:rolwi,项目名称:koala,代码行数:98,代码来源:Upload.class.php

示例8: execute

 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]);
     defined("OBJ_ID") or define("OBJ_ID", $wiki_doc->get_id());
     $is_prev_version = isset($version_doc) && is_object($version_doc) && $version_doc instanceof \steam_document ? TRUE : FALSE;
     $wiki_html_handler = new \lms_wiki($wiki_container);
     if (!$is_prev_version) {
         $wiki_html_handler->set_admin_menu("entry", $wiki_doc);
         $attributes = $wiki_doc->get_attributes(array("DOC_VERSION", "DOC_AUTHORS", "OBJ_LAST_CHANGED", "DOC_USER_MODIFIED", "DOC_TIMES_READ", "DOC_LAST_MODIFIED", "OBJ_WIKILINKS"));
         //TODO: check if sourcecode can be deleted
         //$wiki_html_handler->set_widget_links( $wiki_doc );
         //$wiki_html_handler->set_widget_previous_versions( $wiki_doc );
     } else {
         $wiki_html_handler->set_admin_menu("version", $version_doc);
         $attributes = $version_doc->get_attributes(array("DOC_VERSION", "DOC_AUTHORS", "OBJ_LAST_CHANGED", "DOC_USER_MODIFIED", "DOC_TIMES_READ", "DOC_LAST_MODIFIED", "OBJ_WIKILINKS"));
     }
     $last_author = $attributes["DOC_USER_MODIFIED"]->get_attributes(array("USER_FIRSTNAME", "USER_FULLNAME"));
     $content = \Wiki::getInstance()->loadTemplate("wiki_entry.template.html");
     //$content = new HTML_TEMPLATE_IT();
     //$content->loadTemplateFile( PATH_TEMPLATES . "wiki_entry.template.html" );
     $content->setVariable("LABEL_CLOSE", gettext("close"));
     if (!$is_prev_version) {
         $content->setVariable("VALUE_ENTRY_TEXT", wiki_to_html_plain($wiki_doc));
     } else {
         $content->setVariable("VALUE_ENTRY_TEXT", wiki_to_html_plain($wiki_doc, $version_doc));
     }
     $content->setVariable("IMAGE_SRC", PATH_URL . "download/image/" . $attributes["DOC_USER_MODIFIED"]->get_attribute("OBJ_ICON")->get_id() . "/60/70/");
     $content->setVariable("AUTHOR_LINK", PATH_URL . "user/index/" . $attributes["DOC_USER_MODIFIED"]->get_name() . "/");
     $content->setVariable("VALUE_POSTED_BY", h($last_author["USER_FIRSTNAME"]) . " " . h($last_author["USER_FULLNAME"]));
     $content->setVariable("LABEL_BY", gettext("created by"));
     $content->setVariable("VALUE_VERSION", h($attributes["DOC_VERSION"]));
     $content->setVariable("VALUE_DATE_TIME", strftime("%x %X", $attributes["DOC_LAST_MODIFIED"]));
     /*
     if(!$is_prev_version)
     {
     $content->setVariable( "POST_PERMALINK", PATH_URL . "wiki/" . $wiki_doc->get_id() . "/" );
     $content->setVariable( "POST_PERMALINK_LABEL", "(" . gettext( "permalink" ) . ")");
     }
     */
     if ($wiki_doc->check_access_write($user)) {
         $content->setCurrentBlock("BLOCK_ACCESS");
         $content->setVariable("POST_LABEL_DELETE", gettext("delete"));
         $content->setVariable("POST_LABEL_EDIT", gettext("edit"));
         $content->parse("BLOCK_ACCESS");
     }
     $versions = $wiki_doc->get_previous_versions();
     $no_versions = is_array($versions) ? count($versions) : 0;
     $content->setVariable("VERSION_MANAGEMENT", gettext("Version Management"));
     if ($no_versions > 0) {
         $content->setVariable("NUMBER_VERSIONS", "<li>" . $no_versions . " " . gettext("previous version(s) available") . "</li>");
         $content->setVariable("LINK_VERSION_MANAGEMENT", "<li><a href=\"" . PATH_URL . "wiki/versionoverview/" . $wiki_doc->get_id() . "/\">&raquo; " . gettext("enter version management") . "</a></li>");
     } else {
         $content->setVariable("NUMBER_VERSIONS", "<li>" . gettext("no previous versions available") . "</li>");
     }
     $content->setVariable("LINKS", gettext("Wiki Links"));
     $links = $wiki_doc->get_attribute("OBJ_WIKILINKS_CURRENT");
     $found_doc = false;
     if (is_array($links)) {
         foreach ($links as $doc) {
             if ($doc instanceof \steam_document) {
                 $found_doc = true;
                 break;
             }
         }
     }
     if (!$found_doc) {
         $content->setCurrentBlock("BLOCK_LINKS");
         $content->setVariable("LINK", gettext("no links available"));
         $content->parse("BLOCK_LINKS");
     } else {
         foreach ($links as $doc) {
             if ($doc instanceof \steam_document) {
                 $name = str_replace(".wiki", "", h($doc->get_name()));
                 $link = PATH_URL . "wiki/viewversion/" . $wiki_doc->get_id() . "/" . $doc->get_identifier();
                 $content->setVariable("LINK", '<li>&raquo; <a href="' . $link . '">' . $name . '</a></li>');
                 $content->parse("BLOCK_LINKS");
             }
         }
     }
     $wiki_html_handler->set_main_html($content->get());
     $rootlink = \lms_steam::get_link_to_root($wiki_container);
//.........这里部分代码省略.........
开发者ID:rolwi,项目名称:koala,代码行数:101,代码来源:Viewversion.class.php

示例9: execute

 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());
     $wiki_html_handler = new \lms_wiki($wiki_container);
     $wiki_html_handler->set_admin_menu("index", $wiki_container);
     $grp = $wiki_container->get_environment()->get_creator();
     if ($grp->get_name() == "learners" && $grp->get_attribute(OBJ_TYPE) == "course_learners") {
         $grp = $grp->get_parent_group();
     }
     $content = \Wiki::getInstance()->loadTemplate("wiki_entries.template.html");
     //$content = new HTML_TEMPLATE_IT();
     //$content->loadTemplateFile( PATH_TEMPLATES . "wiki_entries.template.html" );
     $cache = get_cache_function($wiki_container->get_id(), 600);
     $wiki_entries = $cache->call("lms_wiki::get_items", $wiki_container->get_id());
     $recently_changed = new \LinkedList(5);
     $most_discussed = new \LinkedList(5);
     $latest_comments = new \LinkedList(5);
     $no_wiki_entries = count($wiki_entries);
     if ($no_wiki_entries > 0) {
         $first_char = "";
         for ($i = 0; $i < $no_wiki_entries; $i++) {
             $this_char = substr(strtoupper($wiki_entries[$i]["OBJ_NAME"]), 0, 1);
             if ($this_char > $first_char) {
                 $first_char = $this_char;
                 if ($i > 1) {
                     $content->parse("BLOCK_CHARACTER");
                 }
                 $content->setCurrentBlock("BLOCK_CHARACTER");
                 $content->setVariable("FIRST_CHAR", h($this_char));
             }
             $char_articles = array();
             while ($i < $no_wiki_entries && $this_char == substr(strtoupper($wiki_entries[$i]["OBJ_NAME"]), 0, 1)) {
                 $char_articles[] = $wiki_entries[$i];
                 if ($recently_changed->can_be_added($wiki_entries[$i]["DOC_LAST_MODIFIED"])) {
                     $recently_changed->add_element($wiki_entries[$i]["DOC_LAST_MODIFIED"], $wiki_entries[$i]);
                 }
                 if (isset($wiki_entries[$i]["COMMENTS_NO"]) && $most_discussed->can_be_added($wiki_entries[$i]["COMMENTS_NO"]) && $wiki_entries[$i]["COMMENTS_NO"] > 1) {
                     $most_discussed->add_element($wiki_entries[$i]["COMMENTS_NO"], $wiki_entries[$i]);
                 }
                 if (isset($wiki_entries[$i]["COMMENTS_LAST"]) && $latest_comments->can_be_added($wiki_entries[$i]["COMMENTS_LAST"]) && $wiki_entries[$i]["COMMENTS_LAST"] > 0) {
                     $latest_comments->add_element($wiki_entries[$i]["COMMENTS_LAST"], $wiki_entries[$i]);
                 }
                 $i++;
             }
             $i--;
             $no_articles_in_first_row = ceil(count($char_articles) / 2);
             $content->setCurrentBlock("BLOCK_COLUMN");
             for ($c = 0; $c < $no_articles_in_first_row; $c++) {
                 $content->setCurrentBlock("BLOCK_ARTICLE");
                 $content->setVariable("ARTICLE_LINK", PATH_URL . "wiki/viewentry/" . $char_articles[$c]["OBJ_ID"] . "/");
                 $content->setVariable("ARTICLE_NAME", str_replace(".wiki", "", h($char_articles[$c]["OBJ_NAME"])));
                 $content->parse("BLOCK_ARTICLE");
             }
             $content->parse("BLOCK_COLUMN");
             $content->setCurrentBlock("BLOCK_COLUMN");
             for ($c = $no_articles_in_first_row; $c < count($char_articles); $c++) {
                 $content->setCurrentBlock("BLOCK_ARTICLE");
                 $content->setVariable("ARTICLE_LINK", PATH_URL . "wiki/viewentry/" . $char_articles[$c]["OBJ_ID"] . "/");
                 $content->setVariable("ARTICLE_NAME", str_replace(".wiki", "", h($char_articles[$c]["OBJ_NAME"])));
                 $content->parse("BLOCK_ARTICLE");
             }
             $content->parse("BLOCK_COLUMN");
             $content->parse("BLOCK_CHARACTER");
         }
         foreach ($wiki_entries as $entry) {
             $content->setCurrentBlock("BLOCK_ARTICLE");
             $content->setVariable("VALUE_WIKI_ENTRY", h($entry["OBJ_NAME"]));
             $content->setVariable("LINK_WIKI_ENTRY", PATH_URL . "wiki/viewentry/" . $wiki_container->get_id() . "/" . h($entry["OBJ_NAME"]));
             $content->setVariable("LABEL_LAST_MODIFICATION", gettext("last edited"));
             $content->setVariable("VALUE_POSTED_BY", $entry["DOC_USER_MODIFIED"]);
             $content->setVariable("POST_PERMALINK", PATH_URL . "wiki/viewentry/" . $entry["OBJ_ID"] . "/");
             $content->setVariable("VALUE_DATE_TIME", strftime("%x %X", $entry["OBJ_CREATION_TIME"]));
             $content->setVariable("POST_PERMALINK_LABEL", gettext("permalink"));
             $content->parse("BLOCK_ARTICLE");
         }
     }
     /* TODO: check if these functions can be deleted
     		 $wiki_html_handler->set_widget_latest_comments( $latest_comments );
     		 $wiki_html_handler->set_widget_last_changed( $recently_changed );
     		 $wiki_html_handler->set_widget_most_discussed( $most_discussed );
     		 $wiki_html_handler->set_widget_access( $grp );
//.........这里部分代码省略.........
开发者ID:rolwi,项目名称:koala,代码行数:101,代码来源:Index.class.php

示例10: execute

 public function execute(\FrameResponseObject $frameResponseObject)
 {
     //CODE FOR ALL COMMANDS OF THIS PAKAGE END
     $user = \lms_steam::get_current_user();
     // Disable caching
     // TODO: Work on cache handling. An enabled cache leads to bugs
     // if used with the wiki.
     \CacheSettings::disable_caching();
     if (!($wiki_container = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id))) {
         include "bad_link.php";
         exit;
     }
     if (!$wiki_container instanceof \steam_container) {
         $wiki_doc = $wiki_container;
         $wiki_container = $wiki_doc->get_environment();
         if ($wiki_doc->get_attribute(DOC_MIME_TYPE) != "text/wiki") {
             include "bad_link.php";
             exit;
         }
     }
     //CODE FOR ALL COMMANDS OF THIS PAKAGE END
     $wiki_html_handler = new \lms_wiki($wiki_container);
     $wiki_html_handler->set_admin_menu("versions", $wiki_doc);
     $content = \Wiki::getInstance()->loadTemplate("wiki_versions.template.html");
     //$content = new HTML_TEMPLATE_IT();
     //$content->loadTemplateFile( PATH_TEMPLATES . "wiki_versions.template.html" );
     $prev_versions = $wiki_doc->get_previous_versions();
     if (!is_array($prev_versions)) {
         $prev_versions = array();
     }
     array_unshift($prev_versions, $wiki_doc);
     $no_versions = count($prev_versions);
     $content->setCurrentBlock("BLOCK_VERSION_LIST");
     if (isset($_GET["markedfordiff"]) && !empty($_GET["markedfordiff"])) {
         $uri_params = "?markedfordiff=" . $_GET["markedfordiff"];
         //$start = $portal->set_paginator( $content, 10, $no_versions, "(" . gettext("%TOTAL versions in list") . ")", $uri_params );
         $pageIterator = \lms_portal::get_paginator(10, $no_versions, "(" . gettext("%TOTAL groups in list") . ")");
         $content->setVariable("PAGEITERATOR", $pageIterator["html"]);
         $start = $pageIterator["startIndex"];
     } else {
         $pageIterator = \lms_portal::get_paginator(10, $no_versions, "(" . gettext("%TOTAL groups in list") . ")");
         $content->setVariable("PAGEITERATOR", $pageIterator["html"]);
         $start = $pageIterator["startIndex"];
     }
     //$start = $portal->set_paginator( $content, 10, $no_versions, "(" . gettext("%TOTAL versions in list") . ")" );
     $end = $start + 10 > $no_versions ? $no_versions : $start + 10;
     $entry_name = str_replace(".wiki", "", $wiki_doc->get_identifier());
     $content->setVariable("LABEL_VERSIONS", gettext("Available Versions for the entry") . " \"" . h($entry_name) . "\" (" . str_replace(array("%a", "%z", "%s"), array($start + 1, $end, $no_versions), gettext("%a-%z out of %s")) . ")");
     $content->setVariable("LABEL_VERSION_NUMBER", gettext("Version number"));
     $content->setVariable("LABEL_SIZE", gettext("Size"));
     $content->setVariable("LABEL_DATE", gettext("Modification date"));
     $content->setVariable("LABEL_CREATOR", gettext("Modified by"));
     $content->setVariable("LABEL_ACTION", gettext("Action"));
     // Use buffer for document attributes
     $attributes_tnr = array();
     for ($i = $start; $i < $end; $i++) {
         $attributes_tnr[$prev_versions[$i]->get_id()] = $prev_versions[$i]->get_attributes(array(DOC_USER_MODIFIED, DOC_LAST_MODIFIED, DOC_VERSION, DOC_SIZE), TRUE);
     }
     $attributes_result = $GLOBALS["STEAM"]->buffer_flush();
     // use buffer for author attributes
     $author_tnr = array();
     for ($i = $start; $i < $end; $i++) {
         $author_tnr[$prev_versions[$i]->get_id()] = $attributes_result[$attributes_tnr[$prev_versions[$i]->get_id()]][DOC_USER_MODIFIED]->get_attributes(array(USER_FIRSTNAME, USER_FULLNAME, OBJ_NAME), TRUE);
     }
     $author_result = $GLOBALS["STEAM"]->buffer_flush();
     for ($i = $start; $i < $end; $i++) {
         $doc = $prev_versions[$i];
         $attributes = $attributes_result[$attributes_tnr[$doc->get_id()]];
         $last_author = $author_result[$author_tnr[$doc->get_id()]];
         $content->setCurrentBlock("BLOCK_VERSION");
         if ($doc instanceof \steam_document) {
             $content->setVariable("VALUE_SIZE", get_formatted_filesize($doc->get_content_size()));
             $content->setVariable("VALUE_CREATOR_LINK", PATH_URL . "user/index/" . $author_result[$author_tnr[$doc->get_id()]][OBJ_NAME] . "/");
             $content->setVariable("VALUE_CREATOR", h($last_author[USER_FIRSTNAME]) . " " . h($last_author[USER_FULLNAME]));
             $content->setVariable("VALUE_DATE", strftime("%x %X", $attributes["DOC_LAST_MODIFIED"]));
             if ($doc->get_id() !== $wiki_doc->get_id()) {
                 $content->setVariable("VALUE_VERSION_LINK", PATH_URL . "wiki/viewversion/" . $wiki_doc->get_id() . "/" . $doc->get_id() . "/");
                 $content->setVariable("VALUE_VERSION_NUMBER", "Version " . h($attributes_result[$attributes_tnr[$doc->get_id()]][DOC_VERSION]));
                 $content->setCurrentBlock("BLOCK_RECOVER");
                 $content->setVariable("VALUE_ACTION_RECOVER", "&raquo; " . gettext("Recover this version"));
                 $content->setVariable("VALUE_RECOVER_LINK", PATH_URL . "wiki/recoverversion/" . $wiki_doc->get_id() . "/" . $doc->get_id() . "/");
                 $content->parse("BLOCK_RECOVER");
             } else {
                 $content->setVariable("VALUE_VERSION_LINK", PATH_URL . "wiki/viewentry/" . $wiki_doc->get_id() . "/");
                 $content->setVariable("VALUE_VERSION_NUMBER", "Version " . h($attributes_result[$attributes_tnr[$doc->get_id()]][DOC_VERSION]) . " (" . gettext("current") . ")");
             }
             if (isset($_GET["markedfordiff"]) && $_GET["markedfordiff"] == $doc->get_id()) {
                 $content->setVariable("VALUE_ACTION_MARK", "&raquo; " . gettext("Currently marked for version compare"));
             } else {
                 $content->setVariable("VALUE_ACTION_MARK", "<a href=\"" . PATH_URL . "wiki/versionoverview/" . $wiki_doc->get_id() . "/?markedfordiff=" . $doc->get_id() . "\">" . "&raquo; " . gettext("Mark for version compare") . "</a>");
             }
             if ($attributes[DOC_VERSION] != 1) {
                 $content->setVariable("VALUE_ACTION_DIFF", "&raquo; " . gettext("Compare to previous version") . " " . ($attributes[DOC_VERSION] - 1));
                 $content->setVariable("VALUE_DIFF_LINK", PATH_URL . "wiki/compareversions/" . $wiki_doc->get_id() . "/" . $doc->get_id() . "/" . $prev_versions[$i + 1]->get_id());
             }
             if (isset($_GET["markedfordiff"]) && $_GET["markedfordiff"] != $doc->get_id()) {
                 $marked = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $_GET["markedfordiff"]);
                 $content->setVariable("VALUE_ACTION_MARKED_DIFF", "<a href=\"" . PATH_URL . "wiki/compareversions/" . $wiki_doc->get_id() . "/" . $doc->get_id() . "/" . $_GET["markedfordiff"] . "\">" . "&raquo; " . gettext("Compare to marked version") . " " . $marked->get_version() . "</a>");
             }
         }
//.........这里部分代码省略.........
开发者ID:rolwi,项目名称:koala,代码行数:101,代码来源:Versionoverview.class.php

示例11: execute

 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
     $object = $wiki_container;
     $user = \lms_steam::get_current_user();
     if ($_SERVER["REQUEST_METHOD"] == "POST" && $object->check_access_write($user)) {
         $values = $_POST["values"];
         if ($values["delete"]) {
             $_SESSION["confirmation"] = str_replace("%NAME", h($object->get_name()), gettext("The wiki '%NAME' has been deleted."));
             $workroom = $object->get_environment();
             \lms_steam::delete($object);
             $wid = $object->get_id();
             // Clean Cache for the deleted wiki
             require_once "Cache/Lite.php";
             $cache = new \Cache_Lite(array("cacheDir" => PATH_CACHE));
             $cache = get_cache_function($wid, 600);
             $cache->drop("lms_steam::get_items", $wid);
             // Handle Related Cache-Data
             require_once "Cache/Lite.php";
             $cache = new \Cache_Lite(array("cacheDir" => PATH_CACHE));
             $cache->clean($wid);
             // clean wiki cache (not used by wiki)
             $fcache = get_cache_function($object->get_id(), 600);
             $fcache->drop("lms_wiki::get_items", $object->get_id());
             // Clean communication summary cache für the group/course
             if (is_object($workroom)) {
                 $cache = get_cache_function(\lms_steam::get_current_user()->get_name(), 600);
                 $cache->drop("lms_steam::get_inventory_recursive", $workroom->get_id(), CLASS_CONTAINER | CLASS_ROOM, array("OBJ_TYPE", "WIKI_LANGUAGE"));
                 $cache->drop("lms_steam::get_group_communication_objects", $workroom->get_id(), CLASS_MESSAGEBOARD | CLASS_CALENDAR | CLASS_CONTAINER | CLASS_ROOM);
                 // clean rsscache
                 $rcache = get_cache_function("rss", 600);
                 $feedlink = PATH_URL . "services/feeds/wiki_public.php?id=" . $wid;
                 $rcache->drop("lms_rss::get_items", $feedlink);
             }
             header("Location: " . $values["return_to"]);
             exit;
         }
     }
     $content = \Wiki::getInstance()->loadTemplate("object_delete.template.html");
     //$content = new HTML_TEMPLATE_IT();
     //$content->loadTemplateFile( PATH_TEMPLATES . "object_delete.template.html" );
     if ($object->check_access_write($user)) {
         $content->setVariable("LABEL_ARE_YOU_SURE", str_replace("%NAME", h($object->get_name()), gettext("Are you sure you want to delete the wiki '%NAME' ?")));
         $rootlink = \lms_steam::get_link_to_root($object);
         $content->setVariable("DELETE_BACK_LINK", $rootlink[1]["link"] . "communication/");
         $content->setCurrentBlock("BLOCK_DELETE");
         $content->setVariable("FORM_ACTION", $_SERVER["REQUEST_URI"]);
         $content->setVariable("LABEL_DELETE_IT", gettext("yes, delete it"));
         $content->setVariable("BACK_LINK", $_SERVER["HTTP_REFERER"]);
         $content->setVariable("LABEL_RETURN", gettext("back"));
         $content->parse("BLOCK_DELETE");
     } else {
         $content->setVariable("LABEL_ARE_YOU_SURE", gettext("You have no rights to delete this wiki!"));
     }
     $content->setVariable("TEXT_INFORMATION", gettext("The Wiki and all its entries will be deleted."));
     $creator = $object->get_creator();
     $creator_data = $creator->get_attributes(array("USER_FULLNAME", "USER_FIRSTNAME", "OBJ_ICON"));
     $content->setVariable("LABEL_FROM_AND_AGO", str_replace("%N", "<a href=\"" . PATH_URL . "/user/" . $creator->get_name() . "/\">" . h($creator_data["USER_FIRSTNAME"]) . " " . h($creator_data["USER_FULLNAME"]) . "</a>", gettext("by %N")) . "," . how_long_ago($object->get_attribute("OBJ_CREATION_TIME")));
     $icon = $creator_data["OBJ_ICON"];
     if ($icon instanceof \steam_object) {
         $icon_id = $icon->get_id();
     } else {
         $icon_id = 0;
     }
     $content->setVariable("ICON_SRC", PATH_URL . "get_document.php?id=" . $icon_id);
     $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("name" => gettext("Delete wiki"), "link" => "")) : ($headline = array(array("name" => h($wiki_container->get_name()), "link" => PATH_URL . "wiki/index/" . $wiki_container->get_id() . "/"), array("name" => gettext("Delete wiki"), "link" => "")));
     $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();*/
 }
开发者ID:rolwi,项目名称:koala,代码行数:98,代码来源:Deletewiki.class.php

示例12: set_widget_access

 public function set_widget_access($grp)
 {
     $access_descriptions = lms_wiki::get_access_descriptions($grp);
     $act_access = $this->steam_wiki->get_attribute(KOALA_ACCESS);
     $access_descriptions = $access_descriptions[$act_access];
     $access = $access_descriptions["summary_short"] . ": " . $access_descriptions["label"];
     if ($act_access == PERMISSION_PRIVATE_READONLY) {
         $creator = $this->steam_wiki->get_creator();
         if ($creator->get_id() != lms_steam::get_current_user()->get_id()) {
             $access = str_replace("%NAME", $creator->get_name(), $access);
         } else {
             $access = str_replace("%NAME", "you", $access);
         }
     }
     $t = Wiki::getInstance()->loadTemplate("widget_weblog_access.template.html");
     //  $t = new HTML_TEMPLATE_IT();
     // $t->loadTemplateFile( PATH_TEMPLATES . "widget_weblog_access.template.html" );
     $t->setCurrentBlock("BLOCK_ACCESS");
     $t->setVariable("LABEL_ACCESS", $access);
     $t->parse("BLOCK_ACCESS");
     $this->set_widget_html(gettext("Access"), $t->get());
 }
开发者ID:rolwi,项目名称:koala,代码行数:22,代码来源:lms_wiki.class.php


注:本文中的Wiki::getInstance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。