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

PHP wiki_get_page_list函数代码示例

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

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



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

示例1: page_index

    public function page_index() {
        global $CFG;
        $output = '';
        // Checking wiki instance
        if (!$wiki = wiki_get_wiki($this->page->cm->instance)) {
            return false;
        }

        // @TODO: Fix call to wiki_get_subwiki_by_group
        $gid = groups_get_activity_group($this->page->cm);
        $gid = !empty($gid) ? $gid : 0;
        if (!$subwiki = wiki_get_subwiki_by_group($this->page->cm->instance, $gid)) {
            return false;
        }
        $swid = $subwiki->id;
        $pages = wiki_get_page_list($swid);
        $selectoptions = array();
        foreach ($pages as $page) {
            $selectoptions[$page->id] = $page->title;
        }
        $label = get_string('pageindex', 'wiki') . ': ';
        $select = new single_select(new moodle_url('/mod/wiki/view.php'), 'pageid', $selectoptions);
        $select->label = $label;
        return $this->output->container($this->output->render($select), 'wiki_index');
    }
开发者ID:nigeldaley,项目名称:moodle,代码行数:25,代码来源:renderer.php


示例2: wiki_delete_pages

/**
 * Delete pages and all related data
 *
 * @param mixed $context context in which page needs to be deleted.
 * @param mixed $pageids id's of pages to be deleted
 * @param int $subwikiid id of the subwiki for which all pages should be deleted
 */
function wiki_delete_pages($context, $pageids = null, $subwikiid = null)
{
    global $DB;
    if (!empty($pageids) && is_int($pageids)) {
        $pageids = array($pageids);
    } else {
        if (!empty($subwikiid)) {
            $pageids = wiki_get_page_list($subwikiid);
        }
    }
    //If there is no pageid then return as we can't delete anything.
    if (empty($pageids)) {
        return;
    }
    /// Delete page and all it's relevent data
    foreach ($pageids as $pageid) {
        if (is_object($pageid)) {
            $pageid = $pageid->id;
        }
        //Delete page comments
        $comments = wiki_get_comments($context->id, $pageid);
        foreach ($comments as $commentid => $commentvalue) {
            wiki_delete_comment($commentid, $context, $pageid);
        }
        //Delete page tags
        $tags = tag_get_tags_array('wiki_pages', $pageid);
        foreach ($tags as $tagid => $tagvalue) {
            tag_delete_instance('wiki_pages', $pageid, $tagid);
        }
        //Delete Synonym
        wiki_delete_synonym($subwikiid, $pageid);
        //Delete all page versions
        wiki_delete_page_versions(array($pageid => array(0)));
        //Delete all page locks
        wiki_delete_locks($pageid);
        //Delete all page links
        wiki_delete_links(null, $pageid);
        //Delete page
        $params = array('id' => $pageid);
        $DB->delete_records('wiki_pages', $params);
    }
}
开发者ID:esyacelga,项目名称:sisadmaca,代码行数:49,代码来源:locallib.php


示例3: wiki_reset_userdata

/**
 * Implements callback to reset course
 *
 * @param stdClass $data
 * @return boolean|array
 */
function wiki_reset_userdata($data)
{
    global $CFG, $DB;
    require_once $CFG->dirroot . '/mod/wiki/pagelib.php';
    require_once $CFG->dirroot . "/mod/wiki/locallib.php";
    $componentstr = get_string('modulenameplural', 'wiki');
    $status = array();
    //get the wiki(s) in this course.
    if (!($wikis = $DB->get_records('wiki', array('course' => $data->courseid)))) {
        return false;
    }
    if (empty($data->reset_wiki_comments) && empty($data->reset_wiki_tags) && empty($data->reset_wiki_pages)) {
        return $status;
    }
    foreach ($wikis as $wiki) {
        if (!($cm = get_coursemodule_from_instance('wiki', $wiki->id, $data->courseid))) {
            continue;
        }
        $context = context_module::instance($cm->id);
        // Remove tags or all pages.
        if (!empty($data->reset_wiki_pages) || !empty($data->reset_wiki_tags)) {
            // Get subwiki information.
            $subwikis = wiki_get_subwikis($wiki->id);
            foreach ($subwikis as $subwiki) {
                // Get existing pages.
                if ($pages = wiki_get_page_list($subwiki->id)) {
                    // If the wiki page isn't selected then we are only removing tags.
                    if (empty($data->reset_wiki_pages)) {
                        // Go through each page and delete the tags.
                        foreach ($pages as $page) {
                            core_tag_tag::remove_all_item_tags('mod_wiki', 'wiki_pages', $page->id);
                        }
                    } else {
                        // Otherwise we are removing pages and tags.
                        wiki_delete_pages($context, $pages, $subwiki->id);
                    }
                }
                if (!empty($data->reset_wiki_pages)) {
                    // Delete any subwikis.
                    $DB->delete_records('wiki_subwikis', array('id' => $subwiki->id), IGNORE_MISSING);
                    // Delete any attached files.
                    $fs = get_file_storage();
                    $fs->delete_area_files($context->id, 'mod_wiki', 'attachments');
                }
            }
            if (!empty($data->reset_wiki_pages)) {
                $status[] = array('component' => $componentstr, 'item' => get_string('deleteallpages', 'wiki'), 'error' => false);
            }
            if (!empty($data->reset_wiki_tags)) {
                $status[] = array('component' => $componentstr, 'item' => get_string('tagsdeleted', 'wiki'), 'error' => false);
            }
        }
        // Remove all comments.
        if (!empty($data->reset_wiki_comments) || !empty($data->reset_wiki_pages)) {
            $DB->delete_records_select('comments', "contextid = ? AND commentarea='wiki_page'", array($context->id));
            if (!empty($data->reset_wiki_comments)) {
                $status[] = array('component' => $componentstr, 'item' => get_string('deleteallcomments'), 'error' => false);
            }
        }
    }
    return $status;
}
开发者ID:dg711,项目名称:moodle,代码行数:68,代码来源:lib.php


示例4: print_delete_content

    /**
     * Show wiki page delete options
     *
     * @param bool $showorphan
     */
    protected function print_delete_content($showorphan = true) {
        $contents = array();
        $table = new html_table();
        $table->head = array('', get_string('pagename','wiki'));
        $table->attributes['class'] = 'generaltable mdl-align';
        $swid = $this->subwiki->id;
        if ($showorphan) {
            if ($orphanedpages = wiki_get_orphaned_pages($swid)) {
                $this->add_page_delete_options($orphanedpages, $swid, $table);
            } else {
                $table->data[] = array('', get_string('noorphanedpages', 'wiki'));
            }
        } else {
            if ($pages = wiki_get_page_list($swid)) {
                $this->add_page_delete_options($pages, $swid, $table);
            } else {
                $table->data[] = array('', get_string('nopages', 'wiki'));
            }
        }

        ///Print the form
        echo html_writer::start_tag('form', array(
                                                'action' => new moodle_url('/mod/wiki/admin.php'),
                                                'method' => 'post'));
        echo html_writer::tag('div', html_writer::empty_tag('input', array(
                                                                         'type'  => 'hidden',
                                                                         'name'  => 'pageid',
                                                                         'value' => $this->page->id)));

        echo html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'option', 'value' => $this->view));
        echo html_writer::table($table);
        echo html_writer::start_tag('div', array('class' => 'mdl-align'));
        if (!$showorphan) {
            echo html_writer::empty_tag('input', array(
                                                     'type'    => 'submit',
                                                     'class'   => 'wiki_form-button',
                                                     'value'   => get_string('listorphan', 'wiki'),
                                                     'sesskey' => sesskey()));
        } else {
            echo html_writer::empty_tag('input', array('type'=>'hidden', 'name'=>'listall', 'value'=>'1'));
            echo html_writer::empty_tag('input', array(
                                                     'type'    => 'submit',
                                                     'class'   => 'wiki_form-button',
                                                     'value'   => get_string('listall', 'wiki'),
                                                     'sesskey' => sesskey()));
        }
        echo html_writer::end_tag('div');
        echo html_writer::end_tag('form');
    }
开发者ID:Burick,项目名称:moodle,代码行数:54,代码来源:pagelib.php


示例5: wiki_delete_pages

/**
 * Delete pages and all related data
 *
 * @param mixed $context context in which page needs to be deleted.
 * @param mixed $pageids id's of pages to be deleted
 * @param int $subwikiid id of the subwiki for which all pages should be deleted
 */
function wiki_delete_pages($context, $pageids = null, $subwikiid = null)
{
    global $DB, $CFG;
    if (!empty($pageids) && is_int($pageids)) {
        $pageids = array($pageids);
    } else {
        if (!empty($subwikiid)) {
            $pageids = wiki_get_page_list($subwikiid);
        }
    }
    //If there is no pageid then return as we can't delete anything.
    if (empty($pageids)) {
        return;
    }
    /// Delete page and all it's relevent data
    foreach ($pageids as $pageid) {
        if (is_object($pageid)) {
            $pageid = $pageid->id;
        }
        //Delete page comments
        $comments = wiki_get_comments($context->id, $pageid);
        foreach ($comments as $commentid => $commentvalue) {
            wiki_delete_comment($commentid, $context, $pageid);
        }
        //Delete page tags
        core_tag_tag::remove_all_item_tags('mod_wiki', 'wiki_pages', $pageid);
        //Delete Synonym
        wiki_delete_synonym($subwikiid, $pageid);
        //Delete all page versions
        wiki_delete_page_versions(array($pageid => array(0)), $context);
        //Delete all page locks
        wiki_delete_locks($pageid);
        //Delete all page links
        wiki_delete_links(null, $pageid);
        $params = array('id' => $pageid);
        // Get page before deleting.
        $page = $DB->get_record('wiki_pages', $params);
        //Delete page
        $DB->delete_records('wiki_pages', $params);
        // Trigger page_deleted event.
        $event = \mod_wiki\event\page_deleted::create(array('context' => $context, 'objectid' => $pageid, 'other' => array('subwikiid' => $subwikiid)));
        $event->add_record_snapshot('wiki_pages', $page);
        $event->trigger();
    }
}
开发者ID:isuruAb,项目名称:moodle,代码行数:52,代码来源:locallib.php


示例6: print_page_list_content

 /**
  * Prints the page list tab content
  *
  *
  */
 private function print_page_list_content()
 {
     global $OUTPUT;
     $page = $this->page;
     if ($page->timerendered + WIKI_REFRESH_CACHE_TIME < time()) {
         $fresh = wiki_refresh_cachedcontent($page);
         $page = $fresh['page'];
     }
     $pages = wiki_get_page_list($this->subwiki->id);
     $stdaux = new stdClass();
     $strspecial = get_string('special', 'wiki');
     foreach ($pages as $page) {
         $letter = strtoupper(substr($page->title, 0, 1));
         if (preg_match('/[A-Z]/', $letter)) {
             $stdaux->{$letter}[] = wiki_parser_link($page);
         } else {
             $stdaux->{$strspecial}[] = wiki_parser_link($page);
         }
     }
     $table = new html_table();
     $table->head = array(get_string('pagelist', 'wiki') . $OUTPUT->help_icon('pagelist', 'wiki'));
     $table->attributes['class'] = 'wiki_editor generalbox';
     $table->align = array('center');
     foreach ($stdaux as $key => $elem) {
         $table->data[] = array($key);
         foreach ($elem as $e) {
             $table->data[] = array(html_writer::link($e['url'], $e['content']));
         }
     }
     echo html_writer::table($table);
 }
开发者ID:sebastiansanio,项目名称:tallerdeprogramacion2fiuba,代码行数:36,代码来源:pagelib.php


示例7: get_subwiki_pages

 /**
  * Returns the list of pages from a specific subwiki.
  *
  * @param int $wikiid The wiki instance ID.
  * @param int $groupid The group ID. If not defined, use current group.
  * @param int $userid The user ID. If not defined, use current user.
  * @param array $options Several options like sort by, sort direction, ...
  * @return array Containing a list of warnings and a list of pages.
  * @since Moodle 3.1
  */
 public static function get_subwiki_pages($wikiid, $groupid = -1, $userid = 0, $options = array())
 {
     $returnedpages = array();
     $warnings = array();
     $params = self::validate_parameters(self::get_subwiki_pages_parameters(), array('wikiid' => $wikiid, 'groupid' => $groupid, 'userid' => $userid, 'options' => $options));
     // Get wiki instance.
     if (!($wiki = wiki_get_wiki($params['wikiid']))) {
         throw new moodle_exception('incorrectwikiid', 'wiki');
     }
     list($course, $cm) = get_course_and_cm_from_instance($wiki, 'wiki');
     $context = context_module::instance($cm->id);
     self::validate_context($context);
     // Determine groupid and userid to use.
     list($groupid, $userid) = self::determine_group_and_user($cm, $wiki, $params['groupid'], $params['userid']);
     // Get subwiki and validate it.
     $subwiki = wiki_get_subwiki_by_group_and_user_with_validation($wiki, $groupid, $userid);
     if ($subwiki === false) {
         throw new moodle_exception('cannotviewpage', 'wiki');
     } else {
         if ($subwiki->id != -1) {
             // Set sort param.
             $options = $params['options'];
             if (!empty($options['sortby'])) {
                 if ($options['sortdirection'] != 'ASC' && $options['sortdirection'] != 'DESC') {
                     // Invalid sort direction. Use default.
                     $options['sortdirection'] = 'ASC';
                 }
                 $sort = $options['sortby'] . ' ' . $options['sortdirection'];
             }
             $pages = wiki_get_page_list($subwiki->id, $sort);
             $caneditpages = wiki_user_can_edit($subwiki);
             $firstpage = wiki_get_first_page($subwiki->id);
             foreach ($pages as $page) {
                 $retpage = array('id' => $page->id, 'subwikiid' => $page->subwikiid, 'title' => external_format_string($page->title, $context->id), 'timecreated' => $page->timecreated, 'timemodified' => $page->timemodified, 'timerendered' => $page->timerendered, 'userid' => $page->userid, 'pageviews' => $page->pageviews, 'readonly' => $page->readonly, 'caneditpage' => $caneditpages, 'firstpage' => $page->id == $firstpage->id);
                 // Refresh page cached content if needed.
                 if ($page->timerendered + WIKI_REFRESH_CACHE_TIME < time()) {
                     if ($content = wiki_refresh_cachedcontent($page)) {
                         $page = $content['page'];
                     }
                 }
                 list($cachedcontent, $contentformat) = external_format_text($page->cachedcontent, FORMAT_HTML, $context->id, 'mod_wiki', 'attachments', $subwiki->id);
                 if ($options['includecontent']) {
                     // Return the page content.
                     $retpage['cachedcontent'] = $cachedcontent;
                     $retpage['contentformat'] = $contentformat;
                 } else {
                     // Return the size of the content.
                     if (function_exists('mb_strlen') && (int) ini_get('mbstring.func_overload') & 2) {
                         $retpage['contentsize'] = mb_strlen($cachedcontent, '8bit');
                     } else {
                         $retpage['contentsize'] = strlen($cachedcontent);
                     }
                 }
                 $returnedpages[] = $retpage;
             }
         }
     }
     $result = array();
     $result['pages'] = $returnedpages;
     $result['warnings'] = $warnings;
     return $result;
 }
开发者ID:jackdaniels79,项目名称:moodle,代码行数:72,代码来源:external.php


示例8: get_subwiki_pages

 /**
  * Returns the list of pages from a specific subwiki.
  *
  * @param int $wikiid The wiki instance ID.
  * @param int $groupid The group ID. If not defined, use current group.
  * @param int $userid The user ID. If not defined, use current user.
  * @param array $options Several options like sort by, sort direction, ...
  * @return array Containing a list of warnings and a list of pages.
  * @since Moodle 3.1
  */
 public static function get_subwiki_pages($wikiid, $groupid = -1, $userid = 0, $options = array())
 {
     global $USER, $DB;
     $returnedpages = array();
     $warnings = array();
     $params = self::validate_parameters(self::get_subwiki_pages_parameters(), array('wikiid' => $wikiid, 'groupid' => $groupid, 'userid' => $userid, 'options' => $options));
     // Get wiki instance.
     if (!($wiki = wiki_get_wiki($params['wikiid']))) {
         throw new moodle_exception('incorrectwikiid', 'wiki');
     }
     list($course, $cm) = get_course_and_cm_from_instance($wiki, 'wiki');
     $context = context_module::instance($cm->id);
     self::validate_context($context);
     // Determine group.
     $groupmode = groups_get_activity_groupmode($cm);
     if ($groupmode == NOGROUPS) {
         $groupid = 0;
     } else {
         if ($params['groupid'] == -1) {
             // Use current group.
             $groupid = groups_get_activity_group($cm);
             $groupid = !empty($groupid) ? $groupid : 0;
         } else {
             $groupid = $params['groupid'];
         }
     }
     // Determine user.
     if ($wiki->wikimode == 'collaborative') {
         // Collaborative wikis don't use userid in subwikis.
         $userid = 0;
     } else {
         if (empty($params['userid'])) {
             // Use current user.
             $userid = $USER->id;
         } else {
             $userid = $params['userid'];
         }
     }
     // Get subwiki based on group and user.
     if (!($subwiki = wiki_get_subwiki_by_group($cm->instance, $groupid, $userid))) {
         // The subwiki doesn't exist.
         // Validate if user is valid.
         if ($userid != 0 && $userid != $USER->id && !($user = $DB->get_record('user', array('id' => $userid)))) {
             throw new moodle_exception('invaliduserid', 'error');
         }
         // Validate that groupid is valid.
         if ($groupid != 0 && !groups_group_exists($groupid)) {
             throw new moodle_exception('cannotfindgroup', 'error');
         }
         // Valid data but subwiki not found. We'll simulate a subwiki object to check if the user would be able to see it
         // if it existed. If he's able to see it then we'll return an empty array because the subwiki has no pages.
         $subwiki = new stdClass();
         $subwiki->wikiid = $wiki->id;
         $subwiki->userid = $userid;
         $subwiki->groupid = $groupid;
         // Check that the user can view the subwiki. This function checks capabilities.
         if (!wiki_user_can_view($subwiki, $wiki)) {
             throw new moodle_exception('cannotviewpage', 'wiki');
         }
     } else {
         // Check that the user can view the subwiki. This function checks capabilities.
         if (!wiki_user_can_view($subwiki, $wiki)) {
             throw new moodle_exception('cannotviewpage', 'wiki');
         }
         // Set sort param.
         $options = $params['options'];
         if (!empty($options['sortby'])) {
             if ($options['sortdirection'] != 'ASC' && $options['sortdirection'] != 'DESC') {
                 // Invalid sort direction. Use default.
                 $options['sortdirection'] = 'ASC';
             }
             $sort = $options['sortby'] . ' ' . $options['sortdirection'];
         }
         $pages = wiki_get_page_list($subwiki->id, $sort);
         $caneditpages = wiki_user_can_edit($subwiki);
         $firstpage = wiki_get_first_page($subwiki->id);
         foreach ($pages as $page) {
             $retpage = array('id' => $page->id, 'subwikiid' => $page->subwikiid, 'title' => external_format_string($page->title, $context->id), 'timecreated' => $page->timecreated, 'timemodified' => $page->timemodified, 'timerendered' => $page->timerendered, 'userid' => $page->userid, 'pageviews' => $page->pageviews, 'readonly' => $page->readonly, 'caneditpage' => $caneditpages, 'firstpage' => $page->id == $firstpage->id);
             if ($options['includecontent']) {
                 // Refresh page cached content if needed.
                 if ($page->timerendered + WIKI_REFRESH_CACHE_TIME < time()) {
                     if ($content = wiki_refresh_cachedcontent($page)) {
                         $page = $content['page'];
                     }
                 }
                 list($retpage['cachedcontent'], $retpage['contentformat']) = external_format_text($page->cachedcontent, FORMAT_HTML, $context->id, 'mod_wiki', 'attachments', $subwiki->id);
             }
             $returnedpages[] = $retpage;
         }
     }
//.........这里部分代码省略.........
开发者ID:rushi963,项目名称:moodle,代码行数:101,代码来源:external.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP wiki_get_subwiki函数代码示例发布时间:2022-05-23
下一篇:
PHP wiki_get_page_by_title函数代码示例发布时间: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