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
 * File containing a class allowing set editing mode on either on moodle 3 & moodle 4.
19
 *
20
 * @package     block_featured_courses
21
 * @copyright   2022 - CALL Learning
22
 * @license     http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
23
 * @author      Martin CORNU-MANSUY <martin@call-learning>
24
 */
25
 
26
/**
27
 * A patch to make "I turn editing mode on" compatible with moodle 3.
28
 *
29
 * @package     block_featured_courses
30
 * @copyright   2022 - CALL Learning
31
 * @license     http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
32
 * @author      Martin CORNU-MANSUY <martin@call-learning>
33
 */
34
class behat_block_featured_courses extends behat_base {
35
 
36
    /**
37
     * Turn on editing mode in moodle compatible with version 3 and 4.
38
     *
39
     * @Given I set editing mode on
40
     */
41
    public function i_set_editing_mode_on() {
42
        global $CFG;
43
        require_once($CFG->dirroot . "/lib/environmentlib.php");
44
        $release = intval(get_config('', 'release')[0]);
45
        if (normalize_version($release) > 3) {
46
            $this->execute('behat_navigation::i_turn_editing_mode_on', []);
47
        } else {
48
            $this->execute('behat_general::i_click_on', ["Customise this page", "button"]);
49
        }
50
    }
51
}