Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 1441
Línea 75... Línea 75...
75
 
75
 
76
    /**
76
    /**
77
     * Export this data so it can be used as the context for a mustache template.
77
     * Export this data so it can be used as the context for a mustache template.
78
     *
78
     *
79
     * @param \renderer_base $output typically, the renderer that's calling this function
79
     * @param \renderer_base $output typically, the renderer that's calling this function
80
     * @return stdClass data context for a mustache template
80
     * @return stdClass|null data context for a mustache template
81
     */
81
     */
82
    public function export_for_template(\renderer_base $output): stdClass {
82
    public function export_for_template(\renderer_base $output): ?stdClass {
83
        $this->build_export_data($output);
83
        $this->build_export_data($output);
84
        return $this->data;
84
        return $this->data;
Línea 85... Línea 85...
85
    }
85
    }
Línea 140... Línea 140...
140
        $editurl = new \moodle_url(
140
        $editurl = new \moodle_url(
141
            '/course/editsection.php',
141
            '/course/editsection.php',
142
            ['id' => $this->section->id, 'showonly' => 'availabilityconditions']
142
            ['id' => $this->section->id, 'showonly' => 'availabilityconditions']
143
        );
143
        );
144
        $info = ['editurl' => $editurl->out(false)];
144
        $info = ['editurl' => $editurl->out(false)];
-
 
145
 
-
 
146
        if ($section->is_orphan()) {
-
 
147
            $info['editing'] = false;
-
 
148
        }
-
 
149
 
145
        if (!$section->visible) {
150
        if (!$section->visible) {
146
            return [];
151
            return [];
147
        } else if (!$section->uservisible) {
152
        } else if (!$section->uservisible) {
148
            if ($section->availableinfo) {
153
            if ($section->availableinfo) {
149
                // Note: We only get to this function if availableinfo is non-empty,
154
                // Note: We only get to this function if availableinfo is non-empty,
Línea 244... Línea 249...
244
 
249
 
245
        return (object) $data;
250
        return (object) $data;
Línea 246... Línea 251...
246
    }
251
    }
247
 
-
 
248
    /**
-
 
249
     * Generate the basic availability information data.
252
 
250
     *
-
 
251
     * @deprecated since Moodle 4.3 MDL-78204. Please use {@see self::get_availability_data} instead.
-
 
252
     * @todo MDL-78489 This will be deleted in Moodle 4.7.
-
 
253
     * @param string $text the formatted avalability text
-
 
254
     * @param string $additionalclasses additional css classes
253
    /**
255
     * @return stdClass the availability information data
254
     * @deprecated since Moodle 4.3 MDL-78204. Please use {@see self::get_availability_data} instead.
256
     */
-
 
257
    protected function availability_info($text, $additionalclasses = ''): stdClass {
-
 
258
        debugging('Use of ' . __FUNCTION__ . '() have been deprecated, ' .
-
 
259
        'please use core_courseformat\output\local\content\section\availability::get_availability_data()', DEBUG_DEVELOPER);
-
 
260
 
-
 
261
        $data = (object)[
255
     */
262
            'text' => $text,
-
 
263
            'classes' => $additionalclasses
-
 
264
        ];
-
 
265
        $additionalclasses = array_filter(explode(' ', $additionalclasses));
-
 
266
 
-
 
267
        if (in_array('ishidden', $additionalclasses)) {
-
 
268
            $data->ishidden = 1;
-
 
269
        } else if (in_array('isstealth', $additionalclasses)) {
256
    #[\core\attribute\deprecated('get_availability_data()', since: '4.3', mdl: 'MDL-78489', final: true)]
270
            $data->isstealth = 1;
-
 
271
        } else if (in_array('isrestricted', $additionalclasses)) {
-
 
272
            $data->isrestricted = 1;
-
 
273
 
-
 
274
            if (in_array('isfullinfo', $additionalclasses)) {
-
 
275
                $data->isfullinfo = 1;
-
 
276
            }
-
 
277
        }
-
 
278
 
257
    protected function availability_info() {
279
        return $data;
258
        \core\deprecation::emit_deprecation([self::class, __FUNCTION__]);