Beispiel #1
0
// Get the current page version
$pageversion = ouwiki_get_current_page($subwiki, $pagename);
if ($pageversion) {
    $ouwikioutput->set_export_button('page', $pageversion->pageid, $course->id);
}
echo $ouwikioutput->ouwiki_print_start($ouwiki, $cm, $course, $subwiki, $pagename, $context);
// Check consistency in setting subwikis and group mode
$courselink = new moodle_url('/course/view.php?id=', array('id' => $cm->course));
if ($cm->groupmode == 0 && isset($subwiki->groupid)) {
    print_error("Sub-wikis is set to 'One wiki per group'.\n        Please change Group mode to 'Separate groups' or 'Visible groups'.", 'error', $courselink);
}
if ($cm->groupmode > 0 && !isset($subwiki->groupid)) {
    print_error("Sub-wikis is NOT set to 'One wiki per group'.\n        Please change Group mode to 'No groups'.", 'error', $courselink);
}
$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->intro)) > 0) {
    echo $ouwikioutput->ouwiki_get_intro($ouwiki->intro, $context->id);
}
if ($pageversion) {
    // Print warning if page is large (more than 75KB)
    if (strlen($pageversion->xhtml) > 75 * 1024) {
        print '<div class="ouwiki-sizewarning"><img src="' . $OUTPUT->pix_url('warning', 'ouwiki') . '" alt="" />' . get_string('sizewarning', 'ouwiki') . '</div>';
    }
    // Print page content
    $hideannotations = get_user_preferences(OUWIKI_PREF_HIDEANNOTATIONS, 0);
    $data = $ouwikioutput->ouwiki_print_page($subwiki, $cm, $pageversion, true, 'view', $ouwiki->enablewordcount, (bool) $hideannotations);
    echo $data[0];
    echo $ouwikioutput->ouwiki_get_addnew($subwiki, $cm, $pageversion, $context, $id, $pagename);
    echo $ouwikioutput->get_bottom_buttons($subwiki, $cm, $context, $pageversion, true);
} else {
    exit;
}
// The page is now locked to us! Go ahead and print edit form
// get title of the page
$title = get_string('annotatingpage', 'ouwiki');
$wikiname = format_string(htmlspecialchars($ouwiki->name));
$name = $pagename;
if ($pagename) {
    $title = $wikiname . ' - ' . $title . ' : ' . $pagename;
} else {
    $title = $wikiname . ' - ' . $title . ' : ' . get_string('startpage', 'ouwiki');
}
// Print header
echo $ouwikioutput->ouwiki_print_start($ouwiki, $cm, $course, $subwiki, $pagename, $context, array(array('name' => get_string('annotatingpage', 'ouwiki'), 'link' => null)), false, false, '', $title);
// Tabs
ouwiki_print_tabs('annotate', $pagename, $subwiki, $cm, $context, $pageversion->versionid ? true : false, $pageversion->locked);
// prints the div that contains a message when js is disabled in the browser so cannot annotate.
print '<div id="ouwiki_belowtabs_annotate_nojs"><p>' . get_string('jsnotenabled', 'ouwiki') . '</p>' . '<div class="ouwiki_jsrequired"><p>' . get_string('jsajaxrequired', 'ouwiki') . '</p></div></div>';
// opens the annotate specific div for when js is enabled in the browser, user can annotate.
print '<div id="ouwiki_belowtabs_annotate">';
ouwiki_print_editlock($lock, $ouwiki);
if ($ouwiki->timeout) {
    $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');
$data = $ouwikioutput->ouwiki_print_page($subwiki, $cm, $pageversion, false, 'annotate', $ouwiki->enablewordcount);
echo $data[0];
$annotations = $data[1];
$customdata[0] = $annotations;
$customdata[1] = $pageversion;
$name = '';
if ($pagename) {
    $name = $pagename;
} else {
    $name = get_string('startpage', 'ouwiki');
}
$title = $wikiname . ' - ' . $title . ' : ' . $name;
ouwiki_print_start($ouwiki, $cm, $course, $subwiki, $pagename, $context, null, false, false, $meta, $title);
// get delete capability for wiki page versions and associated delete strings
$candelete = has_capability('mod/ouwiki:deletepage', $context);
$strdelete = get_string('delete');
$strdeleted = get_string('deleted');
$strundelete = get_string('undelete', 'ouwiki');
// Get history
$changes = ouwiki_get_page_history($pageversion->pageid, $candelete);
ouwiki_print_tabs('history', $pagename, $subwiki, $cm, $context, true, $pageversion->locked);
print_string('advice_history', 'ouwiki', "view.php?{$wikiparams}");
// Print message about deleted things being invisible to students so admins
// don't get confused
if ($candelete) {
    $found = false;
    foreach ($changes as $change) {
        if (!empty($change->deletedat)) {
            $found = true;
            break;
        }
    }
    if ($found) {
        print '<p class="ouw_deletedpageinfo">' . get_string('pagedeletedinfo', 'ouwiki') . '</p>';
    }
}
Beispiel #4
0
    } else {
        if (!$section) {
            $name = get_string('startpage', 'ouwiki');
        } else {
            $name = htmlspecialchars($sectiontitle);
            $title = get_string('editingsection', 'ouwiki', $name);
        }
    }
}
$title = $wikiname . ' - ' . $title;
echo $ouwikioutput->ouwiki_print_start($ouwiki, $cm, $course, $subwiki, $pagename, $context, array(array('name' => $section ? get_string('editingsection', 'ouwiki', htmlspecialchars($sectiontitle)) : get_string('editingpage', 'ouwiki'), 'link' => null)), false, false, '', $title);
if ($newsection) {
    $section = false;
}
// Tabs
ouwiki_print_tabs('edit', $pagename, $subwiki, $cm, $context, $pageversion->versionid ? true : false);
// setup the edit locking
ouwiki_print_editlock($lock, $ouwiki);
// Calculate initial text for editor
if ($section) {
    $existing = $sectiondetails->content;
} else {
    if ($newsection) {
        $existing = $sectionheader;
    } else {
        if ($pageversion) {
            $existing = $pageversion->xhtml;
        } else {
            $existing = '';
        }
    }