Exemple #1
0
function wiki_refresh_cachedcontent($page, $newcontent = null)
{
    global $DB;
    $version = wiki_get_current_version($page->id);
    if (empty($version)) {
        return null;
    }
    if (!isset($newcontent)) {
        $newcontent = $version->content;
    }
    $options = array('swid' => $page->subwikiid, 'pageid' => $page->id);
    $parseroutput = wiki_parse_content($version->contentformat, $newcontent, $options);
    $page->cachedcontent = $parseroutput['toc'] . $parseroutput['parsed_text'];
    $page->timerendered = time();
    $DB->update_record('wiki_pages', $page);
    wiki_refresh_page_links($page, $parseroutput['link_count']);
    return array('page' => $page, 'sections' => $parseroutput['repeated_sections'], 'version' => $version->version);
}
Exemple #2
0
 private function print_pretty_view()
 {
     $version = wiki_get_current_version($this->page->id);
     $content = wiki_parse_content($version->contentformat, $version->content, array('printable' => true, 'swid' => $this->subwiki->id, 'pageid' => $this->page->id, 'pretty_print' => true));
     $html = $content['parsed_text'];
     $id = $this->subwiki->wikiid;
     if ($cm = get_coursemodule_from_instance("wiki", $id)) {
         $context = context_module::instance($cm->id);
         $html = file_rewrite_pluginfile_urls($html, 'pluginfile.php', $context->id, 'mod_wiki', 'attachments', $this->subwiki->id);
     }
     echo '<div id="wiki_printable_content">';
     echo format_text($html, FORMAT_HTML);
     echo '</div>';
 }
Exemple #3
0
    private function print_pretty_view() {
        $version = wiki_get_current_version($this->page->id);

        $content = wiki_parse_content($version->contentformat, $version->content, array('printable' => true, 'swid' => $this->subwiki->id, 'pageid' => $this->page->id, 'pretty_print' => true));

        echo '<div id="wiki_printable_content">';
        echo format_text($content['parsed_text'], FORMAT_HTML);
        echo '</div>';
    }
function wiki_print_page_content(&$text, &$WS)
{
    global $CFG;
    echo wiki_parse_content($text, $WS);
    // display attached files, if any :-) (nadavkav)
    if ($WS->upload_bar or $WS->dfperms['attach'] and count($WS->dfdir->content) != 0) {
        //Scritp WIKI_TREE
        $prop = null;
        $prop->type = 'text/javascript';
        if (isset($WS->dfcourse)) {
            $prop->src = '../mod/wiki/editor/wiki_tree.js';
        } else {
            $prop->src = 'editor/wiki_tree.js';
        }
        wiki_script('', $prop);
        wiki_print_view_uploaded($WS);
    }
}