Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
<?php
2
// This file is part of Moodle - http://moodle.org/
3
//
4
// Moodle is free software: you can redistribute it and/or modify
5
// it under the terms of the GNU General Public License as published by
6
// the Free Software Foundation, either version 3 of the License, or
7
// (at your option) any later version.
8
//
9
// Moodle is distributed in the hope that it will be useful,
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
// GNU General Public License for more details.
13
//
14
// You should have received a copy of the GNU General Public License
15
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
16
 
17
/**
18
 * Settings for the Moodle Multiblock.
19
 *
20
 * @package   block_multiblock
21
 * @copyright 2021 Muhammad Ali <ma2716@bath.ac.uk>
22
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
23
 */
24
 
25
defined('MOODLE_INTERNAL') || die;
26
 
27
if ($ADMIN->fulltree) {
28
    global $DB, $PAGE, $CFG;
29
 
30
    $blocks = $DB->get_records('block', array(), 'name ASC');
31
 
32
    // Multiblock title (heading).
33
    $settings->add(new admin_setting_configtext('block_multiblock/title', get_string('multiblock_title', 'block_multiblock'),
34
    get_string('multiblock_title_desc', 'block_multiblock'), "",
35
    PARAM_TEXT));
36
 
37
    // Multiblock presentation style options array.
38
    $multiblockpresentationoptions = array();
39
    $presentations = block_multiblock::get_valid_presentations();
40
    foreach ($presentations as $presentationid => $presentation) {
41
        array_push($multiblockpresentationoptions, $presentationid);
42
    }
43
    // Multiblock presentation style.
44
    $settings->add(new admin_setting_configselect('block_multiblock/presentation',
45
    get_string('multiblock_presentation_style', 'block_multiblock'),
46
    get_string('multiblock_presentation_style_desc', 'block_multiblock'), 7, $multiblockpresentationoptions));
47
 
48
    // Multiblock - available sub-blocks.
49
    $blocklist = [];
50
    foreach ($blocks as $block) {
51
        if ($block->name == 'multiblock') {
52
            continue;
53
        }
54
 
55
        $blocklist[$block->name] = trim($block->name) ? trim($block->name) : '[block_' . $block->name . ']';
56
    }
57
    // Multiblock manage contents (add subblock).
58
    $settings->add(new admin_setting_configmultiselect('block_multiblock/subblock',
59
    get_string('multiblock_subblock', 'block_multiblock'),
60
    get_string('multiblock_subblock_desc', 'block_multiblock'), [1], $blocklist));
61
 
62
}