$date = ouwiki_nice_date($prevnext->prev->timecreated); $prev = link_arrow_left(get_string('previousversion', 'ouwiki', $date), "viewold.php?{$wikiparams}&version={$prevnext->prev->versionid}"); } else { $prev = ''; } if ($prevnext->next) { if ($prevnext->next->versionid == $pageversion->currentversionid) { $date = get_string('currentversion', 'ouwiki'); $next = link_arrow_right(get_string('nextversion', 'ouwiki', $date), "view.php?{$wikiparams}"); } else { $date = ouwiki_nice_date($prevnext->next->timecreated); $next = link_arrow_right(get_string('nextversion', 'ouwiki', $date), "viewold.php?{$wikiparams}&version={$prevnext->next->versionid}"); } } else { $next = ''; } $date = userdate($pageversion->timecreated); $pageversion->id = $pageversion->userid; // To make it look like a user object $name = ouwiki_display_user($pageversion, $course->id); $savedby = get_string('savedby', 'ouwiki', $name); $stradvice = get_string('advice_viewold', 'ouwiki'); if (!empty($pageversion->deletedat)) { $stradvice = get_string('advice_viewdeleted', 'ouwiki'); } print "\n<div class='ouw_oldversion'>\n <h1>{$date} <span class='ouw_person'>({$savedby})</span></h1>\n <p>" . $stradvice . "</p>\n <div class='ouw_prev'>{$prev}</div>\n <div class='ouw_next'>{$next}</div>\n <div class='clearer'></div>\n</div>"; // Print page content $data = ouwiki_display_page($subwiki, $cm, $pageversion); print $data[0]; // Footer ouwiki_print_footer($course, $cm, $subwiki, $pagename);
</script>'; } // Get the current page version $pageversion = ouwiki_get_current_page($subwiki, $pagename); $locked = $pageversion ? $pageversion->locked : false; ouwiki_print_tabs('view', $pagename, $subwiki, $cm, $context, $pageversion ? true : false, $locked); if (($pagename === '' || $pagename === null) && strlen(preg_replace('/\\s|<br\\s*\\/?>|<p>|<\\/p>/', '', $ouwiki->summary)) > 0) { print '<div class="ouw_summary">' . format_text($ouwiki->summary) . '</div>'; } if ($pageversion) { // Print warning if page is large (more than 100KB) if (strlen($pageversion->xhtml) > 100 * 1024) { print '<div class="ouwiki-sizewarning"><img src="' . $CFG->modpixpath . '/ouwiki/warning.png" alt="" />' . get_string('sizewarning', 'ouwiki') . '</div>'; } // Print page content $data = ouwiki_display_page($subwiki, $cm, $pageversion, true, 'view'); print $data[0]; if ($pageversion->locked != '1') { print ouwiki_display_create_page_form($subwiki, $cm, $pageversion); } if (has_capability('mod/ouwiki:lock', $context)) { print ouwiki_display_lock_page_form($pageversion, $id); } } else { // Page does not exist print '<p>' . get_string($pagename ? 'pagedoesnotexist' : 'startpagedoesnotexist', 'ouwiki') . '</p>'; if ($subwiki->canedit) { print '<p>' . get_string('wouldyouliketocreate', 'ouwiki') . '</p>'; print "<form method='get' action='edit.php'>"; print ouwiki_display_wiki_parameters($pagename, $subwiki, $cm, OUWIKI_PARAMS_FORM); print "<input type='submit' value='" . get_string('createpage', 'ouwiki') . "' /></form>";
strCloseComments="' . addslashes_js(get_string('closecomments', 'ouwiki')) . '"; strCloseCommentForm="' . addslashes_js(get_string('closecommentform', 'ouwiki')) . '"; ouwikiStrings = {save : "' . addslashes_js(get_string('add')) . '", cancel : "' . addslashes_js(get_string('cancel')) . '"}; </script>'; } // Tabs ouwiki_print_tabs('annotate', $pagename, $subwiki, $cm, $context, $pageversion->versionid ? true : false, $pageversion->locked); ouwiki_print_editlock($lock, $ouwiki); if ($ouwiki->timeout && $js) { $countdowntext = get_string('countdowntext', 'ouwiki', $ouwiki->timeout / 60); print "<script type='text/javascript'>\ndocument.write('<p><div id=\"ouw_countdown\"></div>{$countdowntext}<span id=\"ouw_countdownurgent\"></span></p>');\n</script>"; } print get_string('advice_annotate', 'ouwiki'); $gewgaws = false; $data = ouwiki_display_page($subwiki, $cm, $pageversion, $gewgaws, 'annotate'); print $data[0]; $annotations = $data[1]; require_once 'annotate_form.php'; $customdata[0] = $annotations; $customdata[1] = $pageversion; $customdata[2] = $pagename; $customdata[3] = optional_param('user', 0, PARAM_INT); $annotateform = new mod_ouwiki_annotate_form('annotate.php?id=' . $id, $customdata); $annotateform->display(); $usedannotations = array(); foreach ($annotations as $annotation) { if (!$annotation->orphaned) { $usedannotations[$annotation->id] = $annotation; } }