title and ->body * $nav_page A wiki page object with navigation, has ->body */ public function display_page(Page $page, WikiPage $wiki_page, ?WikiPage $nav_page=null) { global $user; if (is_null($nav_page)) { $nav_page = new WikiPage(); $nav_page->body = ""; } $tfe = new TextFormattingEvent($nav_page->body); send_event($tfe); // only the admin can edit the sidebar if ($user->can(Permissions::WIKI_ADMIN)) { $tfe->formatted .= "
(Edit)";
        }
        // see if title is a category'd tag
        $title_html = html_escape($wiki_page->title);
        if (class_exists('TagCategories')) {
            $this->tagcategories = new TagCategories;
            $tag_category_dict = $this->tagcategories->getKeyedDict();
            $title_html = $this->tagcategories->getTagHtml($title_html, $tag_category_dict);
        }
        $page->set_title(html_escape($wiki_page->title));
        $page->set_heading(html_escape($wiki_page->title));
        $page->add_block(new NavBlock());
        $page->add_block(new Block("Wiki Index", $tfe->formatted, "left", 20));
        $page->add_block(new Block($title_html, $this->create_display_html($wiki_page)));
    }
    public function display_page_editor(Page $page, WikiPage $wiki_page)
    {
        $page->set_title(html_escape($wiki_page->title));
        $page->set_heading(html_escape($wiki_page->title));
        $page->add_block(new NavBlock());
        $page->add_block(new Block("Editor", $this->create_edit_html($wiki_page)));
    }
    protected function create_edit_html(WikiPage $page)
    {
        $h_title = html_escape($page->title);
        $i_revision = $page->revision + 1;
        global $user;
        if ($user->can(Permissions::WIKI_ADMIN)) {
            $val = $page->is_locked() ? " checked" : "";
            $lock = "
Lock page: ";
        } else {
            $lock = "";
        }
        return "
			".make_form(make_link("wiki_admin/save"))."
				
				
				
				$lock
				
			
		";
    }
    protected function create_display_html(WikiPage $page)
    {
        global $user;
        $owner = $page->get_owner();
        $formatted_body = Wiki::format_tag_wiki_page($page);
        $edit = "
| ".make_form(make_link("wiki_admin/edit"))."" : ""; if ($user->can(Permissions::WIKI_ADMIN)) { $edit .= " | ".make_form(make_link("wiki_admin/delete_revision"))." | ".make_form(make_link("wiki_admin/delete_all")).""; } $edit .= " |