Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 1441
Línea 49... Línea 49...
49
 
49
 
50
    /**
50
    /**
51
     * Returns the display name of the given section that the course prefers.
51
     * Returns the display name of the given section that the course prefers.
52
     *
52
     *
53
     * @param int|stdClass $section Section object from database or just field section.section
53
     * @param int|stdClass $section Section object from database or just field section.section
54
     * @return Display name that the course format prefers, e.g. "Topic 2"
54
     * @return string Display name that the course format prefers, e.g. "Topic 2"
55
     */
55
     */
56
    function get_section_name($section) {
56
    function get_section_name($section) {
57
        $section = $this->get_section($section);
57
        $section = $this->get_section($section);
58
        if ((string)$section->name !== '') {
58
        if ((string)$section->name !== '') {
59
            // Return the name the user set.
59
            // Return the name the user set.
60
            return format_string($section->name, true, array('context' => context_course::instance($this->courseid)));
-
 
61
        } else {
-
 
62
            return get_string('site');
60
            return format_string($section->name, true, array('context' => context_course::instance($this->courseid)));
-
 
61
        }
-
 
62
        // The section zero is located in a block.
-
 
63
        if ($section->sectionnum == 0) {
-
 
64
            return get_string('block');
-
 
65
        }
63
        }
66
        return get_string('site');
Línea 64... Línea 67...
64
    }
67
    }
65
 
68
 
66
    /**
69
    /**
Línea 83... Línea 86...
83
     */
86
     */
84
    public function get_default_blocks() {
87
    public function get_default_blocks() {
85
        return blocks_get_default_site_course_blocks();
88
        return blocks_get_default_site_course_blocks();
86
    }
89
    }
Línea -... Línea 90...
-
 
90
 
-
 
91
    #[\Override]
-
 
92
    public function supports_ajax() {
-
 
93
        // All home page is rendered in the backend, we only need an ajax editor components in edit mode.
-
 
94
        // This will also prevent redirectng to the login page when a guest tries to access the site,
-
 
95
        // and will make the home page loading faster.
-
 
96
        $ajaxsupport = new stdClass();
-
 
97
        $ajaxsupport->capable = $this->show_editor();
-
 
98
        return $ajaxsupport;
-
 
99
    }
-
 
100
 
-
 
101
    #[\Override]
-
 
102
    public function supports_components() {
-
 
103
        return true;
-
 
104
    }
-
 
105
 
-
 
106
    #[\Override]
-
 
107
    public function uses_sections() {
-
 
108
        return true;
-
 
109
    }
87
 
110
 
88
    /**
111
    /**
89
     * Definitions of the additional options that site uses
112
     * Definitions of the additional options that site uses
90
     *
113
     *
91
     * @param bool $foreditform
114
     * @param bool $foreditform
Línea 217... Línea 240...
217
    if (!can_access_course($course, null, '', true) || !$cm->uservisible) {
240
    if (!can_access_course($course, null, '', true) || !$cm->uservisible) {
218
        throw new require_login_exception('Activity is not available');
241
        throw new require_login_exception('Activity is not available');
219
    }
242
    }
Línea 220... Línea 243...
220
 
243
 
-
 
244
    $format = course_get_format($course);
-
 
245
    if (isset($args['pagesectionid'])) {
221
    $format = course_get_format($course);
246
        $format->set_sectionid($args['pagesectionid']);
222
    if (!is_null($args['sr'])) {
247
    } else if (isset($args['sr'])) {
223
        $format->set_sectionnum($args['sr']);
248
        $format->set_sectionnum($args['sr']);
224
    }
249
    }
225
    $renderer = $format->get_renderer($PAGE);
250
    $renderer = $format->get_renderer($PAGE);
226
    $section = $cm->get_section_info();
251
    $section = $cm->get_section_info();
Línea 244... Línea 269...
244
    if (!can_access_course($course, null, '', true)) {
269
    if (!can_access_course($course, null, '', true)) {
245
        throw new require_login_exception('Course is not available');
270
        throw new require_login_exception('Course is not available');
246
    }
271
    }
Línea 247... Línea 272...
247
 
272
 
-
 
273
    $format = course_get_format($course);
-
 
274
    if (isset($args['pagesectionid'])) {
248
    $format = course_get_format($course);
275
        $format->set_sectionid($args['pagesectionid']);
249
    if (!is_null($args['sr'])) {
276
    } else if (isset($args['sr'])) {
250
        $format->set_sectionnum($args['sr']);
277
        $format->set_sectionnum($args['sr']);
Línea 251... Línea 278...
251
    }
278
    }
252
 
279