本文整理匯總了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);
}