Example #1
0
            print '<xhtml>' . htmlspecialchars($pageversion->xhtml) . '</xhtml>';
            print '</page>';
            break;
        case OUWIKI_FORMAT_RTF:
            $html .= '<h1>' . htmlspecialchars($visibletitle) . '</h1>';
            $html .= trim($pageversion->xhtml);
            $html .= '<br /><br /><hr />';
            break;
        case OUWIKI_FORMAT_HTML:
            print '<div class="ouw_entry"><a name="' . $pageversion->pageid . '"></a><h1 class="ouw_entry_heading"><a href="view.php?' . ouwiki_display_wiki_parameters($pageversion->title, $subwiki, $cm) . '">' . htmlspecialchars($visibletitle) . '</a></h1>';
            print ouwiki_convert_content($pageversion->xhtml, $subwiki, $cm, $index, $pageversion->xhtmlformat);
            print '</div>';
            break;
    }
    if ($first) {
        $first = false;
    }
}
switch ($format) {
    case OUWIKI_FORMAT_TEMPLATE:
        print '</wiki>';
        break;
    case OUWIKI_FORMAT_RTF:
        $html .= '</root>';
        rtf_from_html($filename . '.rtf', $html);
        break;
    case OUWIKI_FORMAT_HTML:
        print '</div>';
        ouwiki_print_footer($course, $cm, $subwiki);
        break;
}
        $filerec->component = 'mod_ouwiki';
        $filerec->filearea = 'temp';
        $filerec->filepath = '/';
        $filerec->itemid = $id;
        $filerec->filename = strtolower(get_string('template', 'mod_ouwiki')) . '.xml';
        $files[$filerec->filename] = $fs->create_file_from_string($filerec, $markup);
        $zip = get_file_packer();
        $file = $zip->archive_to_storage($files, $context->id, 'mod_ouwiki', 'temp', $id, '/', $filename . '.zip');
        send_stored_file($file, 0, 0, true, array('dontdie' => true));
        // Delete all our temp files used in this process.
        $fs->delete_area_files($context->id, 'mod_ouwiki', 'temp', $id);
        exit;
        break;
    case OUWIKI_FORMAT_RTF:
        $markup .= '</root>';
        rtf_from_html($filename . '.rtf', $markup);
        break;
    case OUWIKI_FORMAT_HTML:
        ouwiki_print_footer($course, $cm, $subwiki);
        break;
}
function get_online_display_content($format, $pageversion, $context, $subwiki, $cm, $index, $fs, &$files)
{
    $markup = '';
    $visibletitle = $pageversion->title === '' ? get_string('startpage', 'ouwiki') : $pageversion->title;
    if ($format != OUWIKI_FORMAT_TEMPLATE) {
        $pageversion->xhtml = file_rewrite_pluginfile_urls($pageversion->xhtml, 'pluginfile.php', $context->id, 'mod_ouwiki', 'content', $pageversion->versionid);
    }
    switch ($format) {
        case OUWIKI_FORMAT_TEMPLATE:
            // Print template wiki page.