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
|
|
|
* prints the form to confirm delete a featured course |
19
|
|
|
* |
20
|
|
|
* @package block_featuredcourses |
21
|
|
|
* @author Daniel Neis |
22
|
|
|
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License |
23
|
|
|
*/ |
24
|
|
|
|
25
|
|
|
defined('MOODLE_INTERNAL') || die(); |
26
|
|
|
|
27
|
|
|
require_once($CFG->libdir.'/formslib.php'); |
28
|
|
|
|
29
|
|
|
class block_featuredcourses_delete_featuredcourse_form extends moodleform { |
|
|
|
|
30
|
|
|
|
31
|
|
|
public function definition() { |
32
|
|
|
$mform =& $this->_form; |
33
|
|
|
|
34
|
|
|
$mform->addElement('hidden', 'id'); |
35
|
|
|
$mform->setType('id', PARAM_INT); |
36
|
|
|
$mform->addElement('hidden', 'courseid'); |
37
|
|
|
$mform->setType('courseid', PARAM_INT); |
38
|
|
|
$mform->addElement('hidden', 'confirmdelete'); |
39
|
|
|
$mform->setType('confirmdelete', PARAM_INT); |
40
|
|
|
|
41
|
|
|
$this->add_action_buttons(true, get_string('yes')); |
42
|
|
|
|
43
|
|
|
} |
44
|
|
|
} |
45
|
|
|
|
The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.
The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.
To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.