• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP wiki_get_page函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中wiki_get_page函数的典型用法代码示例。如果您正苦于以下问题:PHP wiki_get_page函数的具体用法?PHP wiki_get_page怎么用?PHP wiki_get_page使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了wiki_get_page函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: print_navigation_content

    /**
     * Prints the navigation tab content
     *
     * @uses $OUTPUT
     *
     */
    private function print_navigation_content() {
        global $OUTPUT;
        $page = $this->page;

        if ($page->timerendered + WIKI_REFRESH_CACHE_TIME < time()) {
            $fresh = wiki_refresh_cachedcontent($page);
            $page = $fresh['page'];
        }

        $tolinks = wiki_get_linked_to_pages($page->id);
        $fromlinks = wiki_get_linked_from_pages($page->id);

        $table = new html_table();
        $table->attributes['class'] = 'wiki_navigation_from';
        $table->head = array(get_string('navigationfrom', 'wiki') . $OUTPUT->help_icon('navigationfrom', 'wiki') . ':');
        $table->data = array();
        $table->rowclasses = array();
        foreach ($fromlinks as $link) {
            $lpage = wiki_get_page($link->frompageid);
            $link = new moodle_url('/mod/wiki/view.php', array('pageid' => $lpage->id));
            $table->data[] = array(html_writer::link($link->out(false), format_string($lpage->title)));
            $table->rowclasses[] = 'mdl-align';
        }

        $table_left = html_writer::table($table);

        $table = new html_table();
        $table->attributes['class'] = 'wiki_navigation_to';
        $table->head = array(get_string('navigationto', 'wiki') . $OUTPUT->help_icon('navigationto', 'wiki') . ':');
        $table->data = array();
        $table->rowclasses = array();
        foreach ($tolinks as $link) {
            if ($link->tomissingpage) {
                $viewlink = new moodle_url('/mod/wiki/create.php', array('swid' => $page->subwikiid, 'title' => $link->tomissingpage, 'action' => 'new'));
                $table->data[] = array(html_writer::link($viewlink->out(false), format_string($link->tomissingpage), array('class' => 'wiki_newentry')));
            } else {
                $lpage = wiki_get_page($link->topageid);
                $viewlink = new moodle_url('/mod/wiki/view.php', array('pageid' => $lpage->id));
                $table->data[] = array(html_writer::link($viewlink->out(false), format_string($lpage->title)));
            }
            $table->rowclasses[] = 'mdl-align';
        }
        $table_right = html_writer::table($table);
        echo $OUTPUT->container($table_left . $table_right, 'wiki_navigation_container');
    }
开发者ID:Burick,项目名称:moodle,代码行数:51,代码来源:pagelib.php


示例2: required_param

 *
 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
require_once '../../config.php';
require_once $CFG->dirroot . '/mod/wiki/lib.php';
require_once $CFG->dirroot . '/mod/wiki/locallib.php';
$pageid = required_param('pageid', PARAM_INT);
// Page ID
$wid = optional_param('wid', 0, PARAM_INT);
// Wiki ID
$currentgroup = optional_param('group', 0, PARAM_INT);
// Group ID
$userid = optional_param('uid', 0, PARAM_INT);
// User ID
$groupanduser = optional_param('groupanduser', null, PARAM_TEXT);
if (!($page = wiki_get_page($pageid))) {
    print_error('incorrectpageid', 'wiki');
}
if ($groupanduser) {
    list($currentgroup, $userid) = explode('-', $groupanduser);
    $currentgroup = clean_param($currentgroup, PARAM_INT);
    $userid = clean_param($userid, PARAM_INT);
}
if ($wid) {
    // in group mode
    if (!($wiki = wiki_get_wiki($wid))) {
        print_error('incorrectwikiid', 'wiki');
    }
    if (!($subwiki = wiki_get_subwiki_by_group($wiki->id, $currentgroup, $userid))) {
        // create subwiki if doesn't exist
        $subwikiid = wiki_add_subwiki($wiki->id, $currentgroup, $userid);
开发者ID:evltuma,项目名称:moodle,代码行数:31,代码来源:files.php


示例3: array

}
$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
if (!($wiki = wiki_get_wiki($subwiki->wikiid))) {
    print_error('incorrectwikiid', 'wiki');
}
require_login($course, true, $cm);
if (!wiki_user_can_view($subwiki, $wiki)) {
    print_error('cannotviewpage', 'wiki');
}
$context = context_module::instance($cm->id);
require_capability('mod/wiki:managewiki', $context);
//Delete page if a page ID to delete was supplied
if (!empty($delete) && confirm_sesskey()) {
    if ($pageid != $delete) {
        // Validate that we are deleting from the same subwiki.
        $deletepage = wiki_get_page($delete);
        if (!$deletepage || $deletepage->subwikiid != $page->subwikiid) {
            print_error('incorrectsubwikiid', 'wiki');
        }
    }
    wiki_delete_pages($context, $delete, $page->subwikiid);
    //when current wiki page is deleted, then redirect user to create that page, as
    //current pageid is invalid after deletion.
    if ($pageid == $delete) {
        $params = array('swid' => $page->subwikiid, 'title' => $page->title);
        $url = new moodle_url('/mod/wiki/create.php', $params);
        redirect($url);
    }
}
//delete version if toversion and fromversion are set.
if (!empty($toversion) && !empty($fromversion) && confirm_sesskey()) {
开发者ID:evltuma,项目名称:moodle,代码行数:31,代码来源:admin.php


示例4: test_new_page

 /**
  * Test new_page. We won't test all the possible cases because that's already
  * done in the tests for wiki_create_page.
  */
 public function test_new_page()
 {
     $this->create_individual_wikis_with_groups();
     $sectioncontent = '<h1>Title1</h1>Text inside section';
     $pagecontent = $sectioncontent . '<h1>Title2</h1>Text inside section';
     $pagetitle = 'Page Title';
     // Test user with full capabilities.
     $this->setUser($this->student);
     // Test on existing subwiki.
     $result = mod_wiki_external::new_page($pagetitle, $pagecontent, 'html', $this->fpsepg1indstu->subwikiid);
     $result = external_api::clean_returnvalue(mod_wiki_external::new_page_returns(), $result);
     $this->assertInternalType('int', $result['pageid']);
     $version = wiki_get_current_version($result['pageid']);
     $this->assertEquals($pagecontent, $version->content);
     $this->assertEquals('html', $version->contentformat);
     $page = wiki_get_page($result['pageid']);
     $this->assertEquals($pagetitle, $page->title);
     // Test existing page creation.
     try {
         mod_wiki_external::new_page($pagetitle, $pagecontent, 'html', $this->fpsepg1indstu->subwikiid);
         $this->fail('Exception expected due to creation of an existing page.');
     } catch (moodle_exception $e) {
         $this->assertEquals('pageexists', $e->errorcode);
     }
     // Test on non existing subwiki. Add student to group2 to have a new subwiki to be created.
     $this->getDataGenerator()->create_group_member(array('userid' => $this->student->id, 'groupid' => $this->group2->id));
     $result = mod_wiki_external::new_page($pagetitle, $pagecontent, 'html', null, $this->wikisepind->id, $this->student->id, $this->group2->id);
     $result = external_api::clean_returnvalue(mod_wiki_external::new_page_returns(), $result);
     $this->assertInternalType('int', $result['pageid']);
     $version = wiki_get_current_version($result['pageid']);
     $this->assertEquals($pagecontent, $version->content);
     $this->assertEquals('html', $version->contentformat);
     $page = wiki_get_page($result['pageid']);
     $this->assertEquals($pagetitle, $page->title);
     $subwiki = wiki_get_subwiki($page->subwikiid);
     $expected = new StdClass();
     $expected->id = $subwiki->id;
     $expected->wikiid = $this->wikisepind->id;
     $expected->groupid = $this->group2->id;
     $expected->userid = $this->student->id;
     $this->assertEquals($expected, $subwiki);
     // Check page creation for a user not in course.
     $this->studentnotincourse = self::getDataGenerator()->create_user();
     $this->anothercourse = $this->getDataGenerator()->create_course();
     $this->groupnotincourse = $this->getDataGenerator()->create_group(array('courseid' => $this->anothercourse->id));
     try {
         mod_wiki_external::new_page($pagetitle, $pagecontent, 'html', null, $this->wikisepind->id, $this->studentnotincourse->id, $this->groupnotincourse->id);
         $this->fail('Exception expected due to creation of an invalid subwiki creation.');
     } catch (moodle_exception $e) {
         $this->assertEquals('cannoteditpage', $e->errorcode);
     }
 }
开发者ID:jackdaniels79,项目名称:moodle,代码行数:56,代码来源:externallib_test.php


示例5: edit_page

 /**
  * Edit a page contents.
  *
  * @param int $pageid The page ID.
  * @param string $content Page contents.
  * @param int $section Section to be edited.
  * @return array of warnings and page data.
  * @since Moodle 3.1
  */
 public static function edit_page($pageid, $content, $section = null)
 {
     global $USER;
     $params = self::validate_parameters(self::edit_page_parameters(), array('pageid' => $pageid, 'content' => $content, 'section' => $section));
     $warnings = array();
     // Get wiki page.
     if (!($page = wiki_get_page($params['pageid']))) {
         throw new moodle_exception('incorrectpageid', 'wiki');
     }
     // Get wiki instance.
     if (!($wiki = wiki_get_wiki_from_pageid($params['pageid']))) {
         throw new moodle_exception('incorrectwikiid', 'wiki');
     }
     // Get subwiki instance.
     if (!($subwiki = wiki_get_subwiki($page->subwikiid))) {
         throw new moodle_exception('incorrectsubwikiid', 'wiki');
     }
     // Permission validation.
     $cm = get_coursemodule_from_instance('wiki', $wiki->id, $wiki->course);
     $context = context_module::instance($cm->id);
     self::validate_context($context);
     if (!wiki_user_can_edit($subwiki)) {
         throw new moodle_exception('cannoteditpage', 'wiki');
     }
     if (wiki_is_page_section_locked($page->id, $USER->id, $params['section'])) {
         throw new moodle_exception('pageislocked', 'wiki');
     }
     // Save content.
     if (!is_null($params['section'])) {
         $version = wiki_get_current_version($page->id);
         $content = wiki_parser_proxy::get_section($version->content, $version->contentformat, $params['section'], false);
         if (!$content) {
             throw new moodle_exception('invalidsection', 'wiki');
         }
         $save = wiki_save_section($page, $params['section'], $params['content'], $USER->id);
     } else {
         $save = wiki_save_page($page, $params['content'], $USER->id);
     }
     wiki_delete_locks($page->id, $USER->id, $params['section']);
     if (!$save) {
         throw new moodle_exception('savingerror', 'wiki');
     }
     $result = array();
     $result['pageid'] = $page->id;
     $result['warnings'] = $warnings;
     return $result;
 }
开发者ID:jackdaniels79,项目名称:moodle,代码行数:56,代码来源:external.php


示例6: content_wiki_page

 function content_wiki_page($url)
 {
     return wiki_get_page($url);
 }
开发者ID:Nazg-Gul,项目名称:gate,代码行数:4,代码来源:content.php


示例7: view_page

 /**
  * Trigger the page viewed event and update the module completion status.
  *
  * @param int $pageid The page ID.
  * @return array of warnings and status result.
  * @since Moodle 3.1
  * @throws moodle_exception if page is not valid.
  */
 public static function view_page($pageid)
 {
     $params = self::validate_parameters(self::view_page_parameters(), array('pageid' => $pageid));
     $warnings = array();
     // Get wiki page.
     if (!($page = wiki_get_page($params['pageid']))) {
         throw new moodle_exception('incorrectpageid', 'wiki');
     }
     // Get wiki instance.
     if (!($wiki = wiki_get_wiki_from_pageid($params['pageid']))) {
         throw new moodle_exception('incorrectwikiid', 'wiki');
     }
     // Permission validation.
     list($course, $cm) = get_course_and_cm_from_instance($wiki, 'wiki');
     $context = context_module::instance($cm->id);
     self::validate_context($context);
     // Check if user can view this wiki.
     if (!($subwiki = wiki_get_subwiki($page->subwikiid))) {
         throw new moodle_exception('incorrectsubwikiid', 'wiki');
     }
     if (!wiki_user_can_view($subwiki, $wiki)) {
         throw new moodle_exception('cannotviewpage', 'wiki');
     }
     // Trigger page_viewed event and completion.
     wiki_page_view($wiki, $page, $course, $cm, $context);
     $result = array();
     $result['status'] = true;
     $result['warnings'] = $warnings;
     return $result;
 }
开发者ID:matiasma,项目名称:moodle,代码行数:38,代码来源:external.php


示例8: create_page

 /**
  * Generates a page in wiki.
  *
  * @param stdClass wiki object returned from create_instance (if known)
  * @param stdClass|array $record data to insert as wiki entry.
  * @return stdClass
  * @throws coding_exception if neither $record->wikiid nor $wiki->id is specified
  */
 public function create_page($wiki, $record = array())
 {
     global $CFG, $USER;
     require_once $CFG->dirroot . '/mod/wiki/locallib.php';
     $this->pagecount++;
     $record = (array) $record + array('title' => 'wiki page ' . $this->pagecount, 'wikiid' => $wiki->id, 'subwikiid' => 0, 'group' => 0, 'content' => 'Wiki page content ' . $this->pagecount, 'format' => $wiki->defaultformat);
     if (empty($record['wikiid']) && empty($record['subwikiid'])) {
         throw new coding_exception('wiki page generator requires either wikiid or subwikiid');
     }
     if (!$record['subwikiid']) {
         if (!isset($record['userid'])) {
             $record['userid'] = $wiki->wikimode == 'individual' ? $USER->id : 0;
         }
         if ($subwiki = wiki_get_subwiki_by_group($record['wikiid'], $record['group'], $record['userid'])) {
             $record['subwikiid'] = $subwiki->id;
         } else {
             $record['subwikiid'] = wiki_add_subwiki($record['wikiid'], $record['group'], $record['userid']);
         }
     }
     if ($wikipage = wiki_get_page_by_title($record['subwikiid'], $record['title'])) {
         $rv = wiki_save_page($wikipage, $record['content'], $USER->id);
         return $rv['page'];
     }
     $pageid = wiki_create_page($record['subwikiid'], $record['title'], $record['format'], $USER->id);
     $wikipage = wiki_get_page($pageid);
     $rv = wiki_save_page($wikipage, $record['content'], $USER->id);
     return $rv['page'];
 }
开发者ID:alanaipe2015,项目名称:moodle,代码行数:36,代码来源:lib.php


示例9: create_page

 /**
  * Generates a page in wiki.
  *
  * @param stdClass wiki object returned from create_instance (if known)
  * @param stdClass|array $record data to insert as wiki entry.
  * @return stdClass
  * @throws coding_exception if neither $record->wikiid nor $wiki->id is specified
  */
 public function create_page($wiki, $record = array())
 {
     global $CFG, $USER;
     require_once $CFG->dirroot . '/mod/wiki/locallib.php';
     $this->pagecount++;
     $record = (array) $record + array('title' => 'wiki page ' . $this->pagecount, 'wikiid' => $wiki->id, 'subwikiid' => 0, 'group' => 0, 'content' => 'Wiki page content ' . $this->pagecount, 'format' => $wiki->defaultformat);
     if (empty($record['wikiid']) && empty($record['subwikiid'])) {
         throw new coding_exception('wiki page generator requires either wikiid or subwikiid');
     }
     if (!$record['subwikiid']) {
         if (!isset($record['userid'])) {
             $record['userid'] = $wiki->wikimode == 'individual' ? $USER->id : 0;
         }
         if ($subwiki = wiki_get_subwiki_by_group($record['wikiid'], $record['group'], $record['userid'])) {
             $record['subwikiid'] = $subwiki->id;
         } else {
             $record['subwikiid'] = wiki_add_subwiki($record['wikiid'], $record['group'], $record['userid']);
         }
     }
     $wikipage = wiki_get_page_by_title($record['subwikiid'], $record['title']);
     if (!$wikipage) {
         $pageid = wiki_create_page($record['subwikiid'], $record['title'], $record['format'], $USER->id);
         $wikipage = wiki_get_page($pageid);
     }
     $rv = wiki_save_page($wikipage, $record['content'], $USER->id);
     if (array_key_exists('tags', $record)) {
         $tags = is_array($record['tags']) ? $record['tags'] : preg_split('/,/', $record['tags']);
         if (empty($wiki->cmid)) {
             $cm = get_coursemodule_from_instance('wiki', $wiki->id, isset($wiki->course) ? $wiki->course : 0);
             $wiki->cmid = $cm->id;
         }
         core_tag_tag::set_item_tags('mod_wiki', 'wiki_pages', $wikipage->id, context_module::instance($wiki->cmid), $tags);
     }
     return $rv['page'];
 }
开发者ID:evltuma,项目名称:moodle,代码行数:43,代码来源:lib.php


示例10: ReturnContents

 function ReturnContents()
 {
     global $CORE;
     if (!check_locked()) {
         // Getting the content and printing it to page
         if (!$this->wiki) {
             $content_type = "wiki";
             if (nav_inside('/admin') >= 0) {
                 $this->PAGE->AppendTitle('Администрирование', true);
             }
             $this->PAGE->TPrint(content_static_page($this->URL));
         } else {
             $content_type = "system";
             $this->PAGE->TPrint(wiki_get_page($this->URL));
         }
     } else {
         die;
     }
 }
开发者ID:Nazg-Gul,项目名称:gate,代码行数:19,代码来源:main.php


示例11: get_page_contents

 /**
  * Get a page contents.
  *
  * @param int $pageid The page ID.
  * @return array of warnings and page data.
  * @since Moodle 3.1
  */
 public static function get_page_contents($pageid)
 {
     $params = self::validate_parameters(self::get_page_contents_parameters(), array('pageid' => $pageid));
     $warnings = array();
     // Get wiki page.
     if (!($page = wiki_get_page($params['pageid']))) {
         throw new moodle_exception('incorrectpageid', 'wiki');
     }
     // Get wiki instance.
     if (!($wiki = wiki_get_wiki_from_pageid($params['pageid']))) {
         throw new moodle_exception('incorrectwikiid', 'wiki');
     }
     // Permission validation.
     $cm = get_coursemodule_from_instance('wiki', $wiki->id, $wiki->course);
     $context = context_module::instance($cm->id);
     self::validate_context($context);
     // Check if user can view this wiki.
     if (!($subwiki = wiki_get_subwiki($page->subwikiid))) {
         throw new moodle_exception('incorrectsubwikiid', 'wiki');
     }
     if (!wiki_user_can_view($subwiki, $wiki)) {
         throw new moodle_exception('cannotviewpage', 'wiki');
     }
     $returnedpage = array();
     $returnedpage['id'] = $page->id;
     $returnedpage['wikiid'] = $wiki->id;
     $returnedpage['subwikiid'] = $page->subwikiid;
     $returnedpage['groupid'] = $subwiki->groupid;
     $returnedpage['userid'] = $subwiki->userid;
     $returnedpage['title'] = $page->title;
     // Refresh page cached content if needed.
     if ($page->timerendered + WIKI_REFRESH_CACHE_TIME < time()) {
         if ($content = wiki_refresh_cachedcontent($page)) {
             $page = $content['page'];
         }
     }
     list($returnedpage['cachedcontent'], $returnedpage['contentformat']) = external_format_text($page->cachedcontent, FORMAT_HTML, $context->id, 'mod_wiki', 'attachments', $subwiki->id);
     $returnedpage['caneditpage'] = wiki_user_can_edit($subwiki);
     $result = array();
     $result['page'] = $returnedpage;
     $result['warnings'] = $warnings;
     return $result;
 }
开发者ID:rushi963,项目名称:moodle,代码行数:50,代码来源:external.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP wiki_get_page_by_title函数代码示例发布时间:2022-05-23
下一篇:
PHP wiki_get_orphaned_pages函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap