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


PHP block_manager::get_undeletable_block_types方法代码示例

本文整理汇总了PHP中block_manager::get_undeletable_block_types方法的典型用法代码示例。如果您正苦于以下问题:PHP block_manager::get_undeletable_block_types方法的具体用法?PHP block_manager::get_undeletable_block_types怎么用?PHP block_manager::get_undeletable_block_types使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在block_manager的用法示例。


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

示例1: add_to_config_log

    add_to_config_log('block_visibility', $block->visible, '1', $block->name);
    core_plugin_manager::reset_caches();
    admin_get_root(true, false);
    // settings not required - only pages
}
if (!empty($protect) && confirm_sesskey()) {
    block_manager::protect_block((int) $protect);
    admin_get_root(true, false);
    // settings not required - only pages
}
if (!empty($unprotect) && confirm_sesskey()) {
    block_manager::unprotect_block((int) $unprotect);
    admin_get_root(true, false);
    // settings not required - only pages
}
$undeletableblocktypes = block_manager::get_undeletable_block_types();
echo $OUTPUT->header();
echo $OUTPUT->heading($strmanageblocks);
/// Main display starts here
/// Get and sort the existing blocks
if (!($blocks = $DB->get_records('block', array(), 'name ASC'))) {
    print_error('noblocks', 'error');
    // Should never happen
}
$incompatible = array();
/// Print the table of all blocks
$table = new flexible_table('admin-blocks-compatible');
$table->define_columns(array('name', 'instances', 'version', 'hideshow', 'undeletable', 'settings', 'uninstall'));
$table->define_headers(array($strname, $strcourses, $strversion, $strhide . '/' . $strshow, $strprotecthdr, $strsettings, $struninstall));
$table->define_baseurl($CFG->wwwroot . '/' . $CFG->admin . '/blocks.php');
$table->set_attribute('class', 'admintable blockstable generaltable');
开发者ID:Chocolate-lightning,项目名称:moodle,代码行数:31,代码来源:blocks.php

示例2: test_create_all_block_instances

 public function test_create_all_block_instances()
 {
     global $CFG, $PAGE, $DB;
     $this->resetAfterTest();
     $regionname = 'side-pre';
     $context = context_system::instance();
     $PAGE->reset_theme_and_output();
     $CFG->theme = 'boost';
     list($page, $blockmanager) = $this->get_a_page_and_block_manager(array($regionname), $context, 'page-type');
     $blockmanager->load_blocks();
     $blockmanager->create_all_block_instances();
     $blocks = $blockmanager->get_blocks_for_region($regionname);
     $this->assertEmpty($blocks);
     // There should be no blocks in the DB.
     $PAGE->reset_theme_and_output();
     // Change to a theme with undeletable blocks.
     $CFG->theme = 'clean';
     list($page, $blockmanager) = $this->get_a_page_and_block_manager(array($regionname), $context, 'page-type');
     $blockmanager->show_only_fake_blocks(true);
     $blockmanager->load_blocks();
     $blockmanager->create_all_block_instances();
     $blocks = $blockmanager->get_blocks_for_region($regionname);
     $this->assertEmpty($blocks);
     $PAGE->reset_theme_and_output();
     list($page, $blockmanager) = $this->get_a_page_and_block_manager(array($regionname), $context, 'page-type');
     $blockmanager->show_only_fake_blocks(false);
     $blockmanager->load_blocks();
     $blockmanager->create_all_block_instances();
     $blocks = $blockmanager->get_blocks_for_region($regionname);
     $this->assertCount(2, $blocks);
     $undeletable = block_manager::get_undeletable_block_types();
     foreach ($undeletable as $blockname) {
         $instance = $DB->get_record('block_instances', array('blockname' => $blockname));
         $this->assertEquals(1, $instance->requiredbytheme);
     }
     // Switch back and those auto blocks should not be returned.
     $PAGE->reset_theme_and_output();
     $CFG->theme = 'boost';
     list($page, $blockmanager) = $this->get_a_page_and_block_manager(array($regionname), $context, 'page-type');
     $blockmanager->load_blocks();
     $blockmanager->create_all_block_instances();
     $blocks = $blockmanager->get_blocks_for_region($regionname);
     $this->assertEmpty($blocks);
     // But they should exist in the DB.
     foreach ($undeletable as $blockname) {
         $count = $DB->count_records('block_instances', array('blockname' => $blockname));
         $this->assertEquals(1, $count);
     }
 }
开发者ID:EsdrasCaleb,项目名称:moodle,代码行数:49,代码来源:blocklib_test.php

示例3: blocks_add_default_system_blocks

/**
 * Add the default system-context blocks. E.g. the admin tree.
 */
function blocks_add_default_system_blocks()
{
    global $DB;
    $page = new moodle_page();
    $page->set_context(context_system::instance());
    $page->blocks->add_blocks(array(BLOCK_POS_LEFT => block_manager::get_undeletable_block_types()), '*', null, true);
    $page->blocks->add_blocks(array(BLOCK_POS_LEFT => array('admin_bookmarks')), 'admin-*', null, null, 2);
    if ($defaultmypage = $DB->get_record('my_pages', array('userid' => null, 'name' => '__default', 'private' => 1))) {
        $subpagepattern = $defaultmypage->id;
    } else {
        $subpagepattern = null;
    }
    $newblocks = array('private_files', 'online_users', 'badges', 'calendar_month', 'calendar_upcoming');
    $newcontent = array('lp', 'course_overview');
    $page->blocks->add_blocks(array(BLOCK_POS_RIGHT => $newblocks, 'content' => $newcontent), 'my-index', $subpagepattern);
}
开发者ID:dg711,项目名称:moodle,代码行数:19,代码来源:blocklib.php


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