当前位置: 首页>>代码示例>>PHP>>正文


PHP wiki_restore_page函数代码示例

本文整理汇总了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);
     }
 }
开发者ID:jackdaniels79,项目名称:moodle,代码行数:11,代码来源:pagelib.php

示例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);
        }
    }
开发者ID:Burick,项目名称:moodle,代码行数:12,代码来源:pagelib.php

示例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);
 }
开发者ID:evltuma,项目名称:moodle,代码行数:24,代码来源:events_test.php


注:本文中的wiki_restore_page函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。