本文整理汇总了PHP中wiki_restore_page函数的典型用法代码示例。如果您正苦于以下问题:PHP wiki_restore_page函数的具体用法?PHP wiki_restore_page怎么用?PHP wiki_restore_page使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wiki_restore_page函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: print_content
function print_content()
{
global $CFG, $PAGE;
$version = wiki_get_version($this->version->id);
$wiki = $PAGE->activityrecord;
if (wiki_user_can_edit($this->subwiki, $wiki) && wiki_restore_page($this->page, $version, $this->modcontext)) {
redirect($CFG->wwwroot . '/mod/wiki/view.php?pageid=' . $this->page->id, get_string('restoring', 'wiki', $version->version), 3);
} else {
print_error('restoreerror', 'wiki', $version->version);
}
}
示例2: print_content
function print_content() {
global $CFG, $PAGE;
require_capability('mod/wiki:managewiki', $this->modcontext, NULL, true, 'nomanagewikipermission', 'wiki');
$version = wiki_get_version($this->version->id);
if (wiki_restore_page($this->page, $version->content, $version->userid)) {
redirect($CFG->wwwroot . '/mod/wiki/view.php?pageid=' . $this->page->id, get_string('restoring', 'wiki', $version->version), 3);
} else {
print_error('restoreerror', 'wiki', $version->version);
}
}
示例3: test_page_version_restored
/**
* Test page_version_restored event.
*/
public function test_page_version_restored()
{
$this->setUp();
$page = $this->wikigenerator->create_first_page($this->wiki);
$context = context_module::instance($this->wiki->cmid);
$version = wiki_get_current_version($page->id);
// Triggering and capturing the event.
$sink = $this->redirectEvents();
wiki_restore_page($page, $version, $context);
$events = $sink->get_events();
$this->assertCount(2, $events);
$event = array_pop($events);
// Checking that the event contains the expected values.
$this->assertInstanceOf('\\mod_wiki\\event\\page_version_restored', $event);
$this->assertEquals($context, $event->get_context());
$this->assertEquals($version->id, $event->objectid);
$this->assertEquals($page->id, $event->other['pageid']);
$expected = array($this->course->id, 'wiki', 'restore', 'view.php?pageid=' . $page->id, $page->id, $this->wiki->cmid);
$this->assertEventLegacyLogData($expected, $event);
$this->assertEventContextNotUsed($event);
}