本文整理汇总了PHP中blocks_get_default_site_course_blocks函数的典型用法代码示例。如果您正苦于以下问题:PHP blocks_get_default_site_course_blocks函数的具体用法?PHP blocks_get_default_site_course_blocks怎么用?PHP blocks_get_default_site_course_blocks使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了blocks_get_default_site_course_blocks函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
示例2: get_default_blocks
/**
* Returns the list of blocks to be automatically added on the site frontpage when moodle is installed
*
* @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()
{
return blocks_get_default_site_course_blocks();
}
示例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);
}