Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 1441
Línea 301... Línea 301...
301
     */
301
     */
302
    protected function col_enabled(stdClass $row): string {
302
    protected function col_enabled(stdClass $row): string {
303
        global $OUTPUT;
303
        global $OUTPUT;
Línea 304... Línea 304...
304
 
304
 
305
        $enabled = $row->plugininfo->is_enabled();
-
 
306
        $params = [
-
 
307
            'sesskey' => sesskey(),
-
 
308
            'plugin' => $row->plugininfo->name,
-
 
309
            'action' => $enabled ? 'disable' : 'enable',
-
 
310
        ];
-
 
311
 
305
        $enabled = $row->plugininfo->is_enabled();
312
        if ($enabled) {
306
        if ($enabled) {
313
            $icon = $OUTPUT->pix_icon('t/hide', get_string('disableplugin', 'core_admin', $row->plugininfo->displayname));
307
            $labelstr = get_string('disableplugin', 'core_admin', $row->plugininfo->displayname);
314
        } else {
308
        } else {
315
            $icon = $OUTPUT->pix_icon('t/show', get_string('enableplugin', 'core_admin', $row->plugininfo->displayname));
309
            $labelstr = get_string('enableplugin', 'core_admin', $row->plugininfo->displayname);
Línea 316... Línea 310...
316
        }
310
        }
-
 
311
 
317
 
312
        $params = [
318
        return html_writer::link(
313
            'id' => 'admin-toggle-' . $row->plugininfo->name,
319
            $this->get_action_url($params),
314
            'checked' => $enabled,
-
 
315
            'dataattributes' => [
320
            $icon,
316
                'name' => 'id',
321
            [
317
                'value' => $row->plugininfo->name,
322
                'data-toggle-method' => $this->get_toggle_service(),
318
                'toggle-method' => $this->get_toggle_service(),
323
                'data-action' => 'togglestate',
319
                'action' => 'togglestate',
324
                'data-plugin' => $row->plugin,
320
                'plugin' => $row->plugin,
-
 
321
                'state' => $enabled ? 1 : 0,
-
 
322
            ],
-
 
323
            'title' => $labelstr,
325
                'data-state' => $enabled ? 1 : 0,
324
            'label' => $labelstr,
-
 
325
            'labelclasses' => 'visually-hidden',
-
 
326
        ];
326
            ],
327
 
Línea 327... Línea 328...
327
        );
328
        return $OUTPUT->render_from_template('core_admin/setting_configtoggle', $params);
328
    }
329
    }
Línea 498... Línea 499...
498
     * @return bool
499
     * @return bool
499
     */
500
     */
500
    protected function supports_ordering(): bool {
501
    protected function supports_ordering(): bool {
501
        return $this->plugininfoclass::plugintype_supports_ordering();
502
        return $this->plugininfoclass::plugintype_supports_ordering();
502
    }
503
    }
-
 
504
 
-
 
505
    /**
-
 
506
     * Check if the user has the capability to access this table.
-
 
507
     *
-
 
508
     * Default implementation for plugin management tables is to require 'moodle/site:config' capability
-
 
509
     *
-
 
510
     * @return bool Return true if capability check passed.
-
 
511
     */
-
 
512
    public function has_capability(): bool {
-
 
513
        return has_capability('moodle/site:config', $this->get_context());
-
 
514
    }
503
}
515
}