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


PHP blocks_parse_default_blocks_list函数代码示例

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


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

示例1: get_default_blocks

 /**
  * Returns the list of blocks to be automatically added for the newly created course
  *
  * @see blocks_add_default_course_blocks()
  *
  * @return array of default blocks, must contain two keys BLOCK_POS_LEFT and BLOCK_POS_RIGHT
  *     each of values is an array of block names (for left and right side columns)
  */
 public function get_default_blocks()
 {
     global $CFG;
     if (isset($CFG->defaultblocks)) {
         return blocks_parse_default_blocks_list($CFG->defaultblocks);
     }
     $blocknames = array(BLOCK_POS_LEFT => array(), BLOCK_POS_RIGHT => array());
     return $blocknames;
 }
开发者ID:EsdrasCaleb,项目名称:moodle,代码行数:17,代码来源:lib.php

示例2: blocks_add_default_course_blocks

/**
 * Add the default blocks to a course.
 *
 * @param object $course a course object.
 */
function blocks_add_default_course_blocks($course)
{
    global $CFG;
    if (!empty($CFG->defaultblocks_override)) {
        $blocknames = blocks_parse_default_blocks_list($CFG->defaultblocks_override);
    } else {
        if ($course->id == SITEID) {
            $blocknames = blocks_get_default_site_course_blocks();
        } else {
            if (!empty($CFG->{'defaultblocks_' . $course->format})) {
                $blocknames = blocks_parse_default_blocks_list($CFG->{'defaultblocks_' . $course->format});
            } else {
                $blocknames = course_get_format($course)->get_default_blocks();
            }
        }
    }
    if ($course->id == SITEID) {
        $pagetypepattern = 'site-index';
    } else {
        $pagetypepattern = 'course-view-*';
    }
    $page = new moodle_page();
    $page->set_course($course);
    $page->blocks->add_blocks($blocknames, $pagetypepattern);
}
开发者ID:Burick,项目名称:moodle,代码行数:30,代码来源:blocklib.php

示例3: blocks_add_default_course_blocks

/**
 * Add the default blocks to a course.
 *
 * @param object $course a course object.
 */
function blocks_add_default_course_blocks($course)
{
    global $CFG;
    if (!empty($CFG->defaultblocks_override)) {
        $blocknames = blocks_parse_default_blocks_list($CFG->defaultblocks_override);
    } else {
        if ($course->id == SITEID) {
            $blocknames = blocks_get_default_site_course_blocks();
        } else {
            $defaultblocks = 'defaultblocks_' . $course->format;
            if (!empty($CFG->{$defaultblocks})) {
                $blocknames = blocks_parse_default_blocks_list($CFG->{$defaultblocks});
            } else {
                $formatconfig = $CFG->dirroot . '/course/format/' . $course->format . '/config.php';
                $format = array();
                // initialize array in external file
                if (is_readable($formatconfig)) {
                    include $formatconfig;
                }
                if (!empty($format['defaultblocks'])) {
                    $blocknames = blocks_parse_default_blocks_list($format['defaultblocks']);
                } else {
                    if (!empty($CFG->defaultblocks)) {
                        $blocknames = blocks_parse_default_blocks_list($CFG->defaultblocks);
                    } else {
                        $blocknames = array(BLOCK_POS_LEFT => array(), BLOCK_POS_RIGHT => array('search_forums', 'news_items', 'calendar_upcoming', 'recent_activity'));
                    }
                }
            }
        }
    }
    if ($course->id == SITEID) {
        $pagetypepattern = 'site-index';
    } else {
        $pagetypepattern = 'course-view-*';
    }
    $page = new moodle_page();
    $page->set_course($course);
    $page->blocks->add_blocks($blocknames, $pagetypepattern);
}
开发者ID:nmicha,项目名称:moodle,代码行数:45,代码来源:blocklib.php

示例4: get_default_blocks

 /**
  * Returns the list of blocks to be automatically added for the newly created course
  *
  * This function checks the existence of the file config.php in the course format folder.
  * If file exists and contains the code
  * $format['defaultblocks'] = 'leftblock1,leftblock2:rightblock1,rightblock2';
  * these blocks are used, otherwise parent function is called
  *
  * @return array of default blocks, must contain two keys BLOCK_POS_LEFT and BLOCK_POS_RIGHT
  *     each of values is an array of block names (for left and right side columns)
  */
 public function get_default_blocks()
 {
     global $CFG;
     $formatconfig = $CFG->dirroot . '/course/format/' . $this->format . '/config.php';
     $format = array();
     // initialize array in external file
     if (is_readable($formatconfig)) {
         include $formatconfig;
     }
     if (!empty($format['defaultblocks'])) {
         return blocks_parse_default_blocks_list($format['defaultblocks']);
     }
     return parent::get_default_blocks();
 }
开发者ID:evltuma,项目名称:moodle,代码行数:25,代码来源:formatlegacy.php

示例5: get_default_blocks

 /**
  * Returns the list of blocks to be automatically added for the newly created course
  *
  * @see blocks_add_default_course_blocks()
  *
  * @return array of default blocks, must contain two keys BLOCK_POS_LEFT and BLOCK_POS_RIGHT
  *     each of values is an array of block names (for left and right side columns)
  */
 public function get_default_blocks()
 {
     global $CFG;
     if (!empty($CFG->defaultblocks)) {
         return blocks_parse_default_blocks_list($CFG->defaultblocks);
     }
     $blocknames = array(BLOCK_POS_LEFT => array(), BLOCK_POS_RIGHT => array('search_forums', 'news_items', 'calendar_upcoming', 'recent_activity'));
     return $blocknames;
 }
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:17,代码来源:lib.php

示例6: blocks_repopulate_page

/**
 * @deprecated since 2.0
 * Dispite what this function is called, it seems to be mostly used to populate
 * the default blocks when a new course (or whatever) is created.
 * @param object $page the page to add default blocks to.
 * @return boolean success or failure.
 */
function blocks_repopulate_page($page)
{
    global $CFG;
    debugging('Call to deprecated function blocks_repopulate_page. ' . 'Use a more specific method like blocks_add_default_course_blocks, ' . 'or just call $PAGE->blocks->add_blocks()', DEBUG_DEVELOPER);
    /// If the site override has been defined, it is the only valid one.
    if (!empty($CFG->defaultblocks_override)) {
        $blocknames = $CFG->defaultblocks_override;
    } else {
        $blocknames = $page->blocks_get_default();
    }
    $blocks = blocks_parse_default_blocks_list($blocknames);
    $page->blocks->add_blocks($blocks);
    return true;
}
开发者ID:nicolasconnault,项目名称:moodle2.0,代码行数:21,代码来源:blocklib.php


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