Proyectos de Subversion Moodle

Rev

Rev 1 | Rev 111 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 110
Línea 19... Línea 19...
19
 *
19
 *
20
 * @package    block_comments
20
 * @package    block_comments
21
 * @copyright 2009 Dongsheng Cai <dongsheng@moodle.com>
21
 * @copyright 2009 Dongsheng Cai <dongsheng@moodle.com>
22
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
22
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
23
 */
23
 */
24
class block_comments extends block_base {
24
class block_comments extends block_base
-
 
25
{
Línea 25... Línea 26...
25
 
26
 
-
 
27
    function init()
26
    function init() {
28
    {
Línea 27... Línea 29...
27
        global $CFG;
29
        global $CFG;
Línea 28... Línea 30...
28
 
30
 
29
        require_once($CFG->dirroot . '/comment/lib.php');
31
        require_once($CFG->dirroot . '/comment/lib.php');
Línea 30... Línea 32...
30
 
32
 
-
 
33
        $this->title = get_string('pluginname', 'block_comments');
31
        $this->title = get_string('pluginname', 'block_comments');
34
    }
32
    }
35
 
-
 
36
    /*function specialization()
-
 
37
    {
-
 
38
        // require js for commenting
-
 
39
        comment::init();
-
 
40
    }*/
-
 
41
 
-
 
42
    function specialization()
-
 
43
    {
-
 
44
        global $CFG, $DB;
-
 
45
        if (empty($this->config)) {
-
 
46
            $this->instance->defaultregion = 'below-content';
-
 
47
            $this->instance->region = 'below-content';
-
 
48
            $DB->update_record('block_instances', $this->instance);
-
 
49
 
33
 
50
            $this->title = 'Comments';
34
    function specialization() {
51
        } else {
-
 
52
            $this->title = get_string('pluginname', 'block_comments');
35
        // require js for commenting
53
        }
36
        comment::init();
54
    }
Línea 37... Línea 55...
37
    }
55
    function applicable_formats()
-
 
56
    {
38
    function applicable_formats() {
57
        return array('all' => true);
39
        return array('all' => true);
58
    }
Línea 40... Línea 59...
40
    }
59
 
-
 
60
    function instance_allow_multiple()
41
 
61
    {
Línea 42... Línea 62...
42
    function instance_allow_multiple() {
62
        return false;
43
        return false;
63
    }
44
    }
64
 
Línea 89... Línea 109...
89
     * This block shouldn't be added to a page if the comments advanced feature is disabled.
109
     * This block shouldn't be added to a page if the comments advanced feature is disabled.
90
     *
110
     *
91
     * @param moodle_page $page
111
     * @param moodle_page $page
92
     * @return bool
112
     * @return bool
93
     */
113
     */
94
    public function can_block_be_added(moodle_page $page): bool {
114
    public function can_block_be_added(moodle_page $page): bool
-
 
115
    {
95
        global $CFG;
116
        global $CFG;
Línea 96... Línea 117...
96
 
117
 
97
        return $CFG->usecomments;
118
        return $CFG->usecomments;
98
    }
119
    }