function wiki_export_html_content(&$WS)
{
    global $CFG;
    //generate a list with all dfwiki groups
    if ($grouppages = get_records_sql('SELECT *
    			FROM ' . $CFG->prefix . 'wiki_pages
    			WHERE dfwiki=' . $WS->dfwiki->id . ' GROUP BY groupid')) {
        //gets every single group
        foreach ($grouppages as $grouppage) {
            //generate a list with every latest page version
            if ($contentspages = get_records_sql('SELECT *
    			FROM ' . $CFG->prefix . 'wiki_pages
    			WHERE dfwiki=' . $WS->dfwiki->id . '
                AND groupid=' . $grouppage->groupid . ' GROUP BY pagename')) {
                $WS->groupmember->groupid = $grouppage->groupid;
                if (!($groupname = get_record_sql('SELECT * FROM ' . $CFG->prefix . 'groups WHERE id=' . $grouppage->groupid))) {
                    $groupname->name = 'no_groups';
                }
                //list_pages
                check_dir_exists("{$CFG->dataroot}/temp", true);
                check_dir_exists("{$CFG->dataroot}/temp/html", true);
                check_dir_exists("{$CFG->dataroot}/temp/html/dfwiki{$WS->cm->id}", true);
                check_dir_exists("{$CFG->dataroot}/temp/html/dfwiki{$WS->cm->id}/{$groupname->name}", true);
                $html_file_list = fopen("{$CFG->dataroot}/temp/html/dfwiki{$WS->cm->id}/{$groupname->name}/block_list_pages.html", "w");
                $contentlist_parsed = wiki_treat_list_pages($contentspages, $grouppage->groupid);
                $l_pages = get_string('block_list_pages', 'dfwiki');
                fwrite($html_file_list, "<html><header></header><body><center><h1>{$l_pages}</h1></center><table align='center' border='1' cellpadding='5' cellspacing='0'><tr><td>{$contentlist_parsed}</td></tr></table></body></html>");
                fclose($html_file_list);
                foreach ($contentspages as $contentpage) {
                    $max = get_record_sql('SELECT MAX(version) AS maxim
    				    FROM ' . $CFG->prefix . 'wiki_pages
    				    WHERE pagename=\'' . addslashes($contentpage->pagename) . '\' AND dfwiki=' . $WS->dfwiki->id . '
                        AND groupid=' . $grouppage->groupid);
                    $WS->pagedata = get_record_sql('SELECT *
    				   FROM ' . $CFG->prefix . 'wiki_pages
    				   WHERE pagename=\'' . addslashes($contentpage->pagename) . '\' AND dfwiki=' . $WS->dfwiki->id . '
                       AND groupid=' . $grouppage->groupid . ' AND version=' . $max->maxim);
                    //en $cont->content tenim el contingut que hem de parsear
                    check_dir_exists("{$CFG->dataroot}/temp", true);
                    check_dir_exists("{$CFG->dataroot}/temp/html", true);
                    check_dir_exists("{$CFG->dataroot}/temp/html/dfwiki{$WS->cm->id}", true);
                    check_dir_exists("{$CFG->dataroot}/temp/html/dfwiki{$WS->cm->id}/{$groupname->name}", true);
                    $cleanpagename = clean_filename($WS->pagedata->pagename);
                    $html_file = fopen("{$CFG->dataroot}/temp/html/dfwiki{$WS->cm->id}/{$groupname->name}/{$cleanpagename}.html", "w");
                    $content_parsed = wiki_page_content($WS->pagedata->content, $WS);
                    fwrite($html_file, "<html><header></header><body><center><h1>{$WS->pagedata->pagename}</h1></center><table align='center' border='1' cellpadding='5' cellspacing='0' width='95%'><tr><td>{$content_parsed}</td></tr></table></body></html>");
                    fclose($html_file);
                }
            }
        }
    }
}
Пример #2
0
		<div id='tabs'>
			<ul>
				<li><a href="#">editovat</a></li>
				<li><a href="#">editovat</a></li>
			</ul>
		</div>

		<div id='tabpage'>
			<div id='contentbody'>
				<h1 class='titlepage'><?php 
wiki('page_title', '/');
?>
</h1>
<!-- CONTENT BEGIN -->
<?php 
wiki_page_content();
?>
<!-- CONTENT END -->
				<div class="error"><?php 
wiki('wiki_errors');
?>
</div>

<!-- EDIT BEGIN -->
<div class="edit">
          <?php 
wiki_page_editor();
?>
<a name="___edit___" />
          <script type="text/javascript">
            showhide('edit');