Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 1441
Línea 841... Línea 841...
841
        if (!$registered && site_is_public()) {
841
        if (!$registered && site_is_public()) {
842
            if (has_capability('moodle/site:config', context_system::instance())) {
842
            if (has_capability('moodle/site:config', context_system::instance())) {
843
                $registerbutton = $this->single_button(new moodle_url('/admin/registration/index.php'),
843
                $registerbutton = $this->single_button(new moodle_url('/admin/registration/index.php'),
844
                    get_string('register', 'admin'));
844
                    get_string('register', 'admin'));
845
                $str = 'registrationwarning';
845
                $str = 'registrationwarning';
-
 
846
                $type = 'error alert alert-danger';
846
            } else {
847
            } else {
847
                $registerbutton = '';
848
                $registerbutton = '';
848
                $str = 'registrationwarningcontactadmin';
849
                $str = 'registrationwarningcontactadmin';
-
 
850
                $type = 'info';
849
            }
851
            }
Línea 850... Línea 852...
850
 
852
 
851
            return $this->warning( get_string($str, 'admin')
-
 
852
                    . ' ' . $this->help_icon('registration', 'admin') . $registerbutton ,
-
 
853
                'error alert alert-danger');
853
            return $this->warning( get_string($str, 'admin') . ' ' . $registerbutton , $type);
Línea 854... Línea 854...
854
        }
854
        }
855
 
855
 
Línea 872... Línea 872...
872
     * @return string HTML to output.
872
     * @return string HTML to output.
873
     */
873
     */
874
    protected function mobile_configuration_warning($mobileconfigured) {
874
    protected function mobile_configuration_warning($mobileconfigured) {
875
        $output = '';
875
        $output = '';
876
        if (!$mobileconfigured) {
876
        if (!$mobileconfigured) {
877
            $settingslink = new moodle_url('/admin/settings.php', ['section' => 'mobilesettings']);
877
            $settingslink = new moodle_url('/admin/search.php', ['query' => 'enablemobilewebservice']);
878
            $configurebutton = $this->single_button($settingslink, get_string('enablemobilewebservice', 'admin'));
878
            $configurebutton = $this->single_button($settingslink, get_string('enablemobilewebservice', 'admin'), 'get');
879
            $output .= $this->warning(get_string('mobilenotconfiguredwarning', 'admin') . ' ' . $configurebutton);
879
            $output .= $this->warning(get_string('mobilenotconfiguredwarning', 'admin') . ' ' . $configurebutton);
880
        }
880
        }
Línea 881... Línea 881...
881
 
881
 
882
        return $output;
882
        return $output;
Línea 1002... Línea 1002...
1002
     * @return string HTML to output.
1002
     * @return string HTML to output.
1003
     */
1003
     */
1004
    function upgrade_reload($url) {
1004
    function upgrade_reload($url) {
1005
        return html_writer::empty_tag('br') .
1005
        return html_writer::empty_tag('br') .
1006
                html_writer::tag('div',
1006
                html_writer::tag('div',
1007
                    html_writer::link($url, $this->pix_icon('i/reload', '', '', array('class' => 'icon icon-pre')) .
1007
                    html_writer::link($url, $this->pix_icon('i/reload', '', '', ['class' => 'icon']) .
1008
                            get_string('reload'), array('title' => get_string('reload'))),
1008
                            get_string('reload'), array('title' => get_string('reload'))),
1009
                array('class' => 'continuebutton')) . html_writer::empty_tag('br');
1009
                array('class' => 'continuebutton')) . html_writer::empty_tag('br');
1010
    }
1010
    }
Línea 1011... Línea 1011...
1011
 
1011
 
Línea 1022... Línea 1022...
1022
     * @param array $options rendering options
1022
     * @param array $options rendering options
1023
     * @return string HTML code
1023
     * @return string HTML code
1024
     */
1024
     */
1025
    public function plugins_check_table(core_plugin_manager $pluginman, $version, array $options = array()) {
1025
    public function plugins_check_table(core_plugin_manager $pluginman, $version, array $options = array()) {
1026
        global $CFG;
1026
        global $CFG;
1027
        $plugininfo = $pluginman->get_plugins();
1027
        $plugininfo = $pluginman->get_plugins(true);
Línea 1028... Línea 1028...
1028
 
1028
 
1029
        if (empty($plugininfo)) {
1029
        if (empty($plugininfo)) {
1030
            return '';
1030
            return '';
Línea 1057... Línea 1057...
1057
        $installabortable = $pluginman->list_cancellable_installations();
1057
        $installabortable = $pluginman->list_cancellable_installations();
1058
        // List of all components we can cancel upgrade of.
1058
        // List of all components we can cancel upgrade of.
1059
        $upgradeabortable = $pluginman->list_restorable_archives();
1059
        $upgradeabortable = $pluginman->list_restorable_archives();
Línea 1060... Línea 1060...
1060
 
1060
 
-
 
1061
        foreach ($plugininfo as $type => $plugins) {
-
 
1062
            // Skip deleted plugin types.
-
 
1063
            if (\core_component::is_deleted_plugin_type($type)) {
-
 
1064
                continue;
-
 
1065
            }
-
 
1066
 
-
 
1067
            // Skip deprecated plugintypes having no installed plugins, in which case there is nothing to report.
-
 
1068
            if (\core_component::is_deprecated_plugin_type($type)) {
-
 
1069
                $reportableplugins = array_filter($plugins, function($plugininfo) {
-
 
1070
                    return $plugininfo->versiondb != null;
-
 
1071
                });
-
 
1072
                if (empty($reportableplugins)) {
-
 
1073
                    continue;
-
 
1074
                }
Línea 1061... Línea 1075...
1061
        foreach ($plugininfo as $type => $plugins) {
1075
            }
1062
 
1076
 
1063
            $header = new html_table_cell($pluginman->plugintype_name_plural($type));
1077
            $header = new html_table_cell($pluginman->plugintype_name_plural($type));
1064
            $header->header = true;
1078
            $header->header = true;
Línea 1105... Línea 1119...
1105
                    html_writer::span($plugin->displayname, 'pluginname').
1119
                    html_writer::span($plugin->displayname, 'pluginname').
1106
                    html_writer::div($plugin->get_dir(), 'plugindir text-muted small')
1120
                    html_writer::div($plugin->get_dir(), 'plugindir text-muted small')
1107
                );
1121
                );
Línea 1108... Línea 1122...
1108
 
1122
 
1109
                $versiondb = new html_table_cell($plugin->versiondb);
1123
                $versiondb = new html_table_cell($plugin->versiondb);
Línea 1110... Línea 1124...
1110
                $versiondisk = new html_table_cell($plugin->versiondisk);
1124
                $versiondisk = $plugin->is_deprecated() ? new html_table_cell() : new html_table_cell($plugin->versiondisk);
1111
 
1125
 
1112
                if ($isstandard = $plugin->is_standard()) {
1126
                if ($isstandard = $plugin->is_standard()) {
1113
                    $row->attributes['class'] .= ' standard';
1127
                    $row->attributes['class'] .= ' standard';
Línea 1124... Línea 1138...
1124
                $otherpluginsdependencies = $pluginman->are_dependencies_satisfied($plugin->get_other_required_plugins());
1138
                $otherpluginsdependencies = $pluginman->are_dependencies_satisfied($plugin->get_other_required_plugins());
1125
                $dependenciesok = $coredependency && $otherpluginsdependencies && $incompatibledependency;
1139
                $dependenciesok = $coredependency && $otherpluginsdependencies && $incompatibledependency;
Línea 1126... Línea 1140...
1126
 
1140
 
1127
                $statuscode = $plugin->get_status();
1141
                $statuscode = $plugin->get_status();
-
 
1142
                $row->attributes['class'] .= ' status-' . $statuscode;
-
 
1143
                if ($plugin->is_deprecated()) {
-
 
1144
                    $row->attributes['class'] .= ' deprecatedtype';
1128
                $row->attributes['class'] .= ' status-' . $statuscode;
1145
                }
1129
                $statusclass = 'statustext badge ';
1146
                $statusclass = 'statustext badge ';
1130
                switch ($statuscode) {
1147
                switch ($statuscode) {
1131
                    case core_plugin_manager::PLUGIN_STATUS_NEW:
1148
                    case core_plugin_manager::PLUGIN_STATUS_NEW:
1132
                        $statusclass .= $dependenciesok ? 'bg-success text-white' : 'bg-warning text-dark';
1149
                        $statusclass .= $dependenciesok ? 'bg-success text-white' : 'bg-warning text-dark';
Línea 1144... Línea 1161...
1144
                        $statusclass .= $dependenciesok ? 'bg-light text-dark' : 'bg-warning text-dark';
1161
                        $statusclass .= $dependenciesok ? 'bg-light text-dark' : 'bg-warning text-dark';
1145
                        break;
1162
                        break;
1146
                }
1163
                }
1147
                $status = html_writer::span(get_string('status_' . $statuscode, 'core_plugin'), $statusclass);
1164
                $status = html_writer::span(get_string('status_' . $statuscode, 'core_plugin'), $statusclass);
Línea -... Línea 1165...
-
 
1165
 
-
 
1166
                $deprecatedstatus = '';
-
 
1167
                if ($plugin->is_deprecated()) {
-
 
1168
                    // During upgrade, omit the status for deprecated plugin types, unless it's 'missing from disk'.
-
 
1169
                    // Deprecated plugins cannot be installed, upgraded, downgraded, and won't be automatically deleted.
-
 
1170
                    $status = in_array($statuscode,
-
 
1171
                        [core_plugin_manager::PLUGIN_STATUS_MISSING, core_plugin_manager::PLUGIN_STATUS_DELETE]) ? $status : '';
-
 
1172
                    $deprecatedstatus = html_writer::span(
-
 
1173
                        get_string('deprecated_type', 'core_plugin'),
-
 
1174
                        'statustext badge bg-danger text-white'
-
 
1175
                    );
-
 
1176
                }
1148
 
1177
 
1149
                if (!empty($installabortable[$plugin->component])) {
1178
                if (!empty($installabortable[$plugin->component])) {
1150
                    $status .= $this->output->single_button(
1179
                    $status .= $this->output->single_button(
1151
                        new moodle_url($this->page->url, array('abortinstall' => $plugin->component, 'confirmplugincheck' => 0)),
1180
                        new moodle_url($this->page->url, array('abortinstall' => $plugin->component, 'confirmplugincheck' => 0)),
1152
                        get_string('cancelinstallone', 'core_plugin'),
1181
                        get_string('cancelinstallone', 'core_plugin'),
Línea 1169... Línea 1198...
1169
                    foreach ($availableupdates as $availableupdate) {
1198
                    foreach ($availableupdates as $availableupdate) {
1170
                        $status .= $this->plugin_available_update_info($pluginman, $availableupdate);
1199
                        $status .= $this->plugin_available_update_info($pluginman, $availableupdate);
1171
                    }
1200
                    }
1172
                }
1201
                }
Línea 1173... Línea 1202...
1173
 
1202
 
1174
                $status = new html_table_cell($sourcelabel.' '.$status);
1203
                $status = new html_table_cell($sourcelabel.' '.$status.' '.$deprecatedstatus);
1175
                if ($plugin->pluginsupported != null) {
1204
                if ($plugin->pluginsupported != null) {
1176
                    $requires = new html_table_cell($this->required_column($plugin, $pluginman, $version, $CFG->branch));
1205
                    $requires = new html_table_cell($this->required_column($plugin, $pluginman, $version, $CFG->branch));
1177
                } else {
1206
                } else {
1178
                    $requires = new html_table_cell($this->required_column($plugin, $pluginman, $version));
1207
                    $requires = new html_table_cell($this->required_column($plugin, $pluginman, $version));
Línea 1179... Línea 1208...
1179
                }
1208
                }
1180
 
1209
 
-
 
1210
                $statusisboring = in_array($statuscode, array(
Línea 1181... Línea 1211...
1181
                $statusisboring = in_array($statuscode, array(
1211
                        core_plugin_manager::PLUGIN_STATUS_NODB, core_plugin_manager::PLUGIN_STATUS_UPTODATE))
1182
                        core_plugin_manager::PLUGIN_STATUS_NODB, core_plugin_manager::PLUGIN_STATUS_UPTODATE));
1212
                        && !$plugin->is_deprecated();
1183
 
1213
 
1184
                if ($options['xdep']) {
1214
                if ($options['xdep']) {
Línea 1239... Línea 1269...
1239
        if ($installableupdates) {
1269
        if ($installableupdates) {
1240
            $out .= $this->output->single_button(
1270
            $out .= $this->output->single_button(
1241
                new moodle_url($this->page->url, array('installupdatex' => 1)),
1271
                new moodle_url($this->page->url, array('installupdatex' => 1)),
1242
                get_string('updateavailableinstallall', 'core_admin', count($installableupdates)),
1272
                get_string('updateavailableinstallall', 'core_admin', count($installableupdates)),
1243
                'post',
1273
                'post',
1244
                array('class' => 'singlebutton updateavailableinstallall mr-1')
1274
                array('class' => 'singlebutton updateavailableinstallall me-1')
1245
            );
1275
            );
1246
        }
1276
        }
Línea 1247... Línea 1277...
1247
 
1277
 
1248
        if ($installabortable) {
1278
        if ($installabortable) {
1249
            $out .= $this->output->single_button(
1279
            $out .= $this->output->single_button(
1250
                new moodle_url($this->page->url, array('abortinstallx' => 1, 'confirmplugincheck' => 0)),
1280
                new moodle_url($this->page->url, array('abortinstallx' => 1, 'confirmplugincheck' => 0)),
1251
                get_string('cancelinstallall', 'core_plugin', count($installabortable)),
1281
                get_string('cancelinstallall', 'core_plugin', count($installabortable)),
1252
                'post',
1282
                'post',
1253
                array('class' => 'singlebutton cancelinstallall mr-1')
1283
                array('class' => 'singlebutton cancelinstallall me-1')
1254
            );
1284
            );
Línea 1255... Línea 1285...
1255
        }
1285
        }
1256
 
1286
 
1257
        if ($upgradeabortable) {
1287
        if ($upgradeabortable) {
1258
            $out .= $this->output->single_button(
1288
            $out .= $this->output->single_button(
1259
                new moodle_url($this->page->url, array('abortupgradex' => 1)),
1289
                new moodle_url($this->page->url, array('abortupgradex' => 1)),
1260
                get_string('cancelupgradeall', 'core_plugin', count($upgradeabortable)),
1290
                get_string('cancelupgradeall', 'core_plugin', count($upgradeabortable)),
1261
                'post',
1291
                'post',
1262
                array('class' => 'singlebutton cancelupgradeall mr-1')
1292
                array('class' => 'singlebutton cancelupgradeall me-1')
Línea 1263... Línea 1293...
1263
            );
1293
            );
1264
        }
1294
        }
1265
 
1295
 
Línea 1266... Línea 1296...
1266
        $out .= html_writer::div(html_writer::link(new moodle_url($this->page->url, array('showallplugins' => 0)),
1296
        $out .= html_writer::div(html_writer::link(new moodle_url($this->page->url, array('showallplugins' => 0)),
1267
            get_string('plugincheckattention', 'core_plugin')).' '.html_writer::span($sumattention, 'badge bg-light text-dark'),
1297
            get_string('plugincheckattention', 'core_plugin')).' '.html_writer::span($sumattention, 'badge bg-light text-dark'),
1268
            'btn btn-link mr-1');
1298
            'btn btn-link me-1');
Línea 1269... Línea 1299...
1269
 
1299
 
1270
        $out .= html_writer::div(html_writer::link(new moodle_url($this->page->url, array('showallplugins' => 1)),
1300
        $out .= html_writer::div(html_writer::link(new moodle_url($this->page->url, array('showallplugins' => 1)),
Línea 1271... Línea 1301...
1271
            get_string('plugincheckall', 'core_plugin')).' '.html_writer::span($sumtotal, 'badge bg-light text-dark'),
1301
            get_string('plugincheckall', 'core_plugin')).' '.html_writer::span($sumtotal, 'badge bg-light text-dark'),
Línea 1286... Línea 1316...
1286
     *
1316
     *
1287
     * @param null|moodle_url $continue URL for the continue button, should it be displayed
1317
     * @param null|moodle_url $continue URL for the continue button, should it be displayed
1288
     * @param null|moodle_url $cancel URL for the cancel link, defaults to the current page
1318
     * @param null|moodle_url $cancel URL for the cancel link, defaults to the current page
1289
     * @return string HTML
1319
     * @return string HTML
1290
     */
1320
     */
1291
    public function plugins_management_confirm_buttons(moodle_url $continue=null, moodle_url $cancel=null) {
1321
    public function plugins_management_confirm_buttons(?moodle_url $continue=null, ?moodle_url $cancel=null) {
Línea 1292... Línea 1322...
1292
 
1322
 
Línea 1293... Línea 1323...
1293
        $out = html_writer::start_div('plugins-management-confirm-buttons');
1323
        $out = html_writer::start_div('plugins-management-confirm-buttons');
1294
 
1324
 
Línea 1374... Línea 1404...
1374
            if ($installable) {
1404
            if ($installable) {
1375
                $out .= $this->output->single_button(
1405
                $out .= $this->output->single_button(
1376
                    new moodle_url($this->page->url, array('installdepx' => 1)),
1406
                    new moodle_url($this->page->url, array('installdepx' => 1)),
1377
                    get_string('dependencyinstallmissing', 'core_plugin', count($installable)),
1407
                    get_string('dependencyinstallmissing', 'core_plugin', count($installable)),
1378
                    'post',
1408
                    'post',
1379
                    array('class' => 'singlebutton dependencyinstallmissing d-inline-block mr-1')
1409
                    array('class' => 'singlebutton dependencyinstallmissing d-inline-block me-1')
1380
                );
1410
                );
1381
            }
1411
            }
Línea 1382... Línea 1412...
1382
 
1412
 
1383
            $out .= html_writer::div(html_writer::link(new moodle_url('/admin/tool/installaddon/'),
1413
            $out .= html_writer::div(html_writer::link(new moodle_url('/admin/tool/installaddon/'),
1384
                get_string('dependencyuploadmissing', 'core_plugin'), array('class' => 'btn btn-link')),
1414
                get_string('dependencyuploadmissing', 'core_plugin'), array('class' => 'btn btn-link')),
Línea 1385... Línea 1415...
1385
                'dependencyuploadmissing d-inline-block mr-1');
1415
                'dependencyuploadmissing d-inline-block me-1');
Línea 1386... Línea 1416...
1386
 
1416
 
1387
            $out .= $this->output->container_end(); // End of .plugins-check-dependencies-actions container.
1417
            $out .= $this->output->container_end(); // End of .plugins-check-dependencies-actions container.
Línea 1446... Línea 1476...
1446
            $info .= $this->output->container_start('actions');
1476
            $info .= $this->output->container_start('actions');
Línea 1447... Línea 1477...
1447
 
1477
 
1448
            $info .= html_writer::div(
1478
            $info .= html_writer::div(
1449
                html_writer::link('https://moodle.org/plugins/view.php?plugin='.$plugin->component,
1479
                html_writer::link('https://moodle.org/plugins/view.php?plugin='.$plugin->component,
1450
                    get_string('misdepinfoplugin', 'core_plugin')),
1480
                    get_string('misdepinfoplugin', 'core_plugin')),
1451
                'misdepinfoplugin d-inline-block mr-3 mb-1'
1481
                'misdepinfoplugin d-inline-block me-3 mb-1'
Línea 1452... Línea 1482...
1452
            );
1482
            );
1453
 
1483
 
1454
            $info .= html_writer::div(
1484
            $info .= html_writer::div(
1455
                html_writer::link('https://moodle.org/plugins/pluginversion.php?id='.$plugin->version->id,
1485
                html_writer::link('https://moodle.org/plugins/pluginversion.php?id='.$plugin->version->id,
1456
                    get_string('misdepinfoversion', 'core_plugin')),
1486
                    get_string('misdepinfoversion', 'core_plugin')),
Línea 1457... Línea 1487...
1457
                'misdepinfoversion d-inline-block mr-3 mb-1'
1487
                'misdepinfoversion d-inline-block me-3 mb-1'
1458
            );
1488
            );
Línea 1459... Línea 1489...
1459
 
1489
 
1460
            $info .= html_writer::div(html_writer::link($plugin->version->downloadurl, get_string('download')),
1490
            $info .= html_writer::div(html_writer::link($plugin->version->downloadurl, get_string('download')),
1461
                'misdepdownload d-inline-block mr-3 mb-1');
1491
                'misdepdownload d-inline-block me-3 mb-1');
1462
 
1492
 
1463
            if ($pluginman->is_remote_plugin_installable($plugin->component, $plugin->version->version, $reason)) {
1493
            if ($pluginman->is_remote_plugin_installable($plugin->component, $plugin->version->version, $reason)) {
1464
                $info .= $this->output->single_button(
1494
                $info .= $this->output->single_button(
1465
                    new moodle_url($this->page->url, array('installdep' => $plugin->component)),
1495
                    new moodle_url($this->page->url, array('installdep' => $plugin->component)),
1466
                    get_string('dependencyinstall', 'core_plugin'),
1496
                    get_string('dependencyinstall', 'core_plugin'),
1467
                    'post',
1497
                    'post',
1468
                    array('class' => 'singlebutton dependencyinstall mr-3 mb-1')
1498
                    array('class' => 'singlebutton dependencyinstall me-3 mb-1')
1469
                );
1499
                );
1470
            } else {
1500
            } else {
1471
                $reasonhelp = $this->info_remote_plugin_not_installable($reason);
1501
                $reasonhelp = $this->info_remote_plugin_not_installable($reason);
Línea 1472... Línea 1502...
1472
                if ($reasonhelp) {
1502
                if ($reasonhelp) {
Línea 1653... Línea 1683...
1653
     * @param array $options filtering options
1683
     * @param array $options filtering options
1654
     * @return string as usually
1684
     * @return string as usually
1655
     */
1685
     */
1656
    public function plugins_overview_panel(core_plugin_manager $pluginman, array $options = array()) {
1686
    public function plugins_overview_panel(core_plugin_manager $pluginman, array $options = array()) {
Línea 1657... Línea 1687...
1657
 
1687
 
-
 
1688
        $plugininfo = $pluginman->get_plugins(true);
Línea 1658... Línea 1689...
1658
        $plugininfo = $pluginman->get_plugins();
1689
        $this->page->requires->js_call_amd('core_admin/plugins_overview', 'init');
Línea 1659... Línea 1690...
1659
 
1690
 
-
 
1691
        $numtotal = $numextension = $numupdatable = $numinstallable = $nummissing = $numnew = 0;
-
 
1692
 
-
 
1693
        foreach ($plugininfo as $type => $plugins) {
-
 
1694
            if (\core_component::is_deleted_plugin_type($type)) {
-
 
1695
                continue;
-
 
1696
            }
-
 
1697
 
-
 
1698
            // Skip deprecated plugintypes having no installed plugins, in which case there is nothing to report.
-
 
1699
            if (\core_component::is_deprecated_plugin_type($type)) {
-
 
1700
                $reportableplugins = array_filter($plugins, function($plugininfo) {
-
 
1701
                    return $plugininfo->versiondb != null;
-
 
1702
                });
-
 
1703
                if (empty($reportableplugins)) {
-
 
1704
                    continue;
1660
        $numtotal = $numextension = $numupdatable = $numinstallable = 0;
1705
                }
1661
 
1706
            }
1662
        foreach ($plugininfo as $type => $plugins) {
1707
 
1663
            foreach ($plugins as $name => $plugin) {
1708
            foreach ($plugins as $name => $plugin) {
1664
                if ($res = $plugin->available_updates()) {
1709
                if ($res = $plugin->available_updates()) {
Línea 1669... Línea 1714...
1669
                            break;
1714
                            break;
1670
                        }
1715
                        }
1671
                    }
1716
                    }
1672
                }
1717
                }
1673
                if ($plugin->get_status() === core_plugin_manager::PLUGIN_STATUS_MISSING) {
1718
                if ($plugin->get_status() === core_plugin_manager::PLUGIN_STATUS_MISSING) {
-
 
1719
                    $nummissing++;
1674
                    continue;
1720
                    continue;
1675
                }
1721
                }
-
 
1722
                if ($plugin->get_status() === core_plugin_manager::PLUGIN_STATUS_NEW) {
-
 
1723
                    $numnew++;
-
 
1724
                }
1676
                $numtotal++;
1725
                $numtotal++;
1677
                if (!$plugin->is_standard()) {
1726
                if (!$plugin->is_standard()) {
1678
                    $numextension++;
1727
                    $numextension++;
1679
                }
1728
                }
1680
            }
1729
            }
1681
        }
1730
        }
Línea 1682... Línea 1731...
1682
 
1731
 
1683
        $infoall = html_writer::link(
1732
        $infoall = html_writer::link(
1684
            new moodle_url($this->page->url, array('contribonly' => 0, 'updatesonly' => 0)),
1733
            $this->page->url,
1685
            get_string('overviewall', 'core_plugin'),
1734
            get_string('overviewall', 'core_plugin'),
1686
            array('title' => get_string('filterall', 'core_plugin'))
1735
            ['title' => get_string('filterall', 'core_plugin'), 'data-filterby' => 'all', 'class' => 'active']
Línea 1687... Línea 1736...
1687
        ).' '.html_writer::span($numtotal, 'badge number number-all');
1736
        ).' '.html_writer::span($numtotal, 'badge text-dark number number-all');
1688
 
1737
 
1689
        $infoext = html_writer::link(
1738
        $infoext = html_writer::link(
1690
            new moodle_url($this->page->url, array('contribonly' => 1, 'updatesonly' => 0)),
1739
            new moodle_url($this->page->url, [], 'additional'),
1691
            get_string('overviewext', 'core_plugin'),
1740
            get_string('overviewext', 'core_plugin'),
Línea 1692... Línea 1741...
1692
            array('title' => get_string('filtercontribonly', 'core_plugin'))
1741
            ['title' => get_string('filtercontribonly', 'core_plugin'), 'data-filterby' => 'additional']
1693
        ).' '.html_writer::span($numextension, 'badge number number-additional');
1742
        ).' '.html_writer::span($numextension, 'badge text-dark number number-additional');
1694
 
1743
 
1695
        if ($numupdatable) {
1744
        if ($numupdatable) {
1696
            $infoupdatable = html_writer::link(
1745
            $infoupdatable = html_writer::link(
1697
                new moodle_url($this->page->url, array('contribonly' => 0, 'updatesonly' => 1)),
1746
                new moodle_url($this->page->url, [], 'updatable'),
1698
                get_string('overviewupdatable', 'core_plugin'),
1747
                get_string('overviewupdatable', 'core_plugin'),
1699
                array('title' => get_string('filterupdatesonly', 'core_plugin'))
1748
                ['title' => get_string('filterupdatesonly', 'core_plugin'), 'data-filterby' => 'updatable']
1700
            ).' '.html_writer::span($numupdatable, 'badge bg-info text-white number number-updatable');
1749
            ).' '.html_writer::span($numupdatable, 'badge bg-info text-white number number-updatable');
1701
        } else {
1750
        } else {
Línea -... Línea 1751...
-
 
1751
            // No updates, or the notifications disabled.
-
 
1752
            $infoupdatable = '';
-
 
1753
        }
-
 
1754
 
-
 
1755
        if ($numnew) {
1702
            // No updates, or the notifications disabled.
1756
            $infonew = html_writer::link(
-
 
1757
                new moodle_url($this->page->url, [], 'newplugin'),
-
 
1758
                get_string('status_new', 'plugin'),
-
 
1759
                ['title' => get_string('filternewpluginsonly', 'core_plugin'), 'data-filterby' => 'newplugin']
Línea 1703... Línea 1760...
1703
            $infoupdatable = '';
1760
            ).' '.html_writer::span($numnew, 'badge bg-success text-white number number-newplugin');
-
 
1761
        } else {
1704
        }
1762
            $infonew = '';
1705
 
1763
        }
1706
        $out = html_writer::start_div('', array('id' => 'plugins-overview-panel'));
1764
 
-
 
1765
        if ($nummissing) {
-
 
1766
            $infomissing = html_writer::link(
-
 
1767
                new moodle_url($this->page->url, [], 'missing'),
1707
 
1768
                get_string('status_missing', 'plugin'),
Línea -... Línea 1769...
-
 
1769
                ['title' => get_string('filtermissingonly', 'core_plugin'), 'data-filterby' => 'missing']
-
 
1770
            ).' '.html_writer::span($nummissing, 'badge bg-danger text-white number number-missing');
1708
        if (!empty($options['updatesonly'])) {
1771
        } else {
1709
            $out .= $this->output->heading(get_string('overviewupdatable', 'core_plugin'), 3);
1772
            $infomissing = '';
1710
        } else if (!empty($options['contribonly'])) {
1773
        }
1711
            $out .= $this->output->heading(get_string('overviewext', 'core_plugin'), 3);
1774
 
1712
        }
1775
        $out = html_writer::start_div('', ['id' => 'plugins-overview-panel']);
1713
 
1776
 
1714
        if ($numinstallable) {
1777
        if ($numinstallable) {
1715
            $out .= $this->output->single_button(
1778
            $out .= $this->output->single_button(
Línea 1716... Línea 1779...
1716
                new moodle_url($this->page->url, array('installupdatex' => 1)),
1779
                new moodle_url($this->page->url, array('installupdatex' => 1)),
1717
                get_string('updateavailableinstallall', 'core_admin', $numinstallable),
1780
                get_string('updateavailableinstallall', 'core_admin', $numinstallable),
1718
                'post',
1781
                'post',
-
 
1782
                array('class' => 'singlebutton updateavailableinstallall')
-
 
1783
            );
Línea 1719... Línea 1784...
1719
                array('class' => 'singlebutton updateavailableinstallall')
1784
        }
Línea 1720... Línea 1785...
1720
            );
1785
 
1721
        }
1786
        $out .= html_writer::div($infoall, 'info info-all').
Línea 1738... Línea 1803...
1738
     * @param array $options filtering options
1803
     * @param array $options filtering options
1739
     * @return string HTML code
1804
     * @return string HTML code
1740
     */
1805
     */
1741
    public function plugins_control_panel(core_plugin_manager $pluginman, array $options = array()) {
1806
    public function plugins_control_panel(core_plugin_manager $pluginman, array $options = array()) {
Línea 1742... Línea 1807...
1742
 
1807
 
1743
        $plugininfo = $pluginman->get_plugins();
-
 
1744
 
-
 
1745
        // Filter the list of plugins according the options.
-
 
1746
        if (!empty($options['updatesonly'])) {
-
 
1747
            $updateable = array();
-
 
1748
            foreach ($plugininfo as $plugintype => $pluginnames) {
-
 
1749
                foreach ($pluginnames as $pluginname => $pluginfo) {
-
 
1750
                    $pluginavailableupdates = $pluginfo->available_updates();
-
 
1751
                    if (!empty($pluginavailableupdates)) {
-
 
1752
                        foreach ($pluginavailableupdates as $pluginavailableupdate) {
-
 
1753
                            $updateable[$plugintype][$pluginname] = $pluginfo;
-
 
1754
                        }
-
 
1755
                    }
-
 
1756
                }
-
 
1757
            }
-
 
1758
            $plugininfo = $updateable;
-
 
1759
        }
-
 
1760
 
-
 
1761
        if (!empty($options['contribonly'])) {
-
 
1762
            $contribs = array();
-
 
1763
            foreach ($plugininfo as $plugintype => $pluginnames) {
-
 
1764
                foreach ($pluginnames as $pluginname => $pluginfo) {
-
 
1765
                    if (!$pluginfo->is_standard()) {
-
 
1766
                        $contribs[$plugintype][$pluginname] = $pluginfo;
-
 
1767
                    }
-
 
1768
                }
-
 
1769
            }
-
 
1770
            $plugininfo = $contribs;
-
 
1771
        }
-
 
1772
 
-
 
1773
        if (empty($plugininfo)) {
-
 
1774
            return '';
-
 
Línea 1775... Línea 1808...
1775
        }
1808
        $plugininfo = $pluginman->get_plugins(true);
1776
 
1809
 
1777
        $table = new html_table();
1810
        $table = new html_table();
1778
        $table->id = 'plugins-control-panel';
1811
        $table->id = 'plugins-control-panel';
Línea 1787... Línea 1820...
1787
        $table->colclasses = array(
1820
        $table->colclasses = array(
1788
            'pluginname', 'version', 'availability', 'settings', 'uninstall', 'notes'
1821
            'pluginname', 'version', 'availability', 'settings', 'uninstall', 'notes'
1789
        );
1822
        );
Línea 1790... Línea 1823...
1790
 
1823
 
-
 
1824
        foreach ($plugininfo as $type => $plugins) {
-
 
1825
            if (\core_component::is_deleted_plugin_type($type)) {
-
 
1826
                continue;
-
 
1827
            }
-
 
1828
 
-
 
1829
            // Skip deprecated plugintypes having no installed plugins, in which case there is nothing to report.
-
 
1830
            if (\core_component::is_deprecated_plugin_type($type)) {
-
 
1831
                $reportableplugins = array_filter($plugins, function($plugininfo) {
-
 
1832
                    return $plugininfo->versiondb != null;
-
 
1833
                });
-
 
1834
                if (empty($reportableplugins)) {
-
 
1835
                    continue;
-
 
1836
                }
-
 
1837
            }
1791
        foreach ($plugininfo as $type => $plugins) {
1838
 
1792
            $heading = $pluginman->plugintype_name_plural($type);
1839
            $heading = $pluginman->plugintype_name_plural($type);
1793
            $pluginclass = core_plugin_manager::resolve_plugininfo_class($type);
1840
            $pluginclass = core_plugin_manager::resolve_plugininfo_class($type);
1794
            if ($manageurl = $pluginclass::get_manage_url()) {
1841
            if ($manageurl = $pluginclass::get_manage_url()) {
1795
                $heading .= $this->output->action_icon($manageurl, new pix_icon('i/settings',
1842
                $heading .= $this->output->action_icon($manageurl, new pix_icon('i/settings',
Línea 1829... Línea 1876...
1829
                } else {
1876
                } else {
1830
                    $icon = $this->output->spacer();
1877
                    $icon = $this->output->spacer();
1831
                }
1878
                }
1832
                $status = $plugin->get_status();
1879
                $status = $plugin->get_status();
1833
                $row->attributes['class'] .= ' status-'.$status;
1880
                $row->attributes['class'] .= ' status-'.$status;
-
 
1881
                if ($plugin->is_deprecated()) {
-
 
1882
                    $row->attributes['class'] .= ' deprecatedtype';
-
 
1883
                }
1834
                $pluginname  = html_writer::tag('div', $icon.$plugin->displayname, array('class' => 'displayname')).
1884
                $pluginname  = html_writer::tag('div', $icon.$plugin->displayname, array('class' => 'displayname')).
1835
                               html_writer::tag('div', $plugin->component, array('class' => 'componentname'));
1885
                               html_writer::tag('div', $plugin->component, array('class' => 'componentname'));
1836
                $pluginname  = new html_table_cell($pluginname);
1886
                $pluginname  = new html_table_cell($pluginname);
Línea 1837... Línea 1887...
1837
 
1887
 
Línea 1869... Línea 1919...
1869
 
1919
 
1870
                if ($plugin->is_standard()) {
1920
                if ($plugin->is_standard()) {
1871
                    $row->attributes['class'] .= ' standard';
1921
                    $row->attributes['class'] .= ' standard';
1872
                    $source = '';
1922
                    $source = '';
1873
                } else {
1923
                } else {
1874
                    $row->attributes['class'] .= ' extension';
1924
                    $row->attributes['class'] .= ' additional';
1875
                    $source = html_writer::div(get_string('sourceext', 'core_plugin'), 'source badge bg-info text-white');
1925
                    $source = html_writer::div(get_string('sourceext', 'core_plugin'), 'source badge me-1 text-bg-info');
Línea 1876... Línea 1926...
1876
                }
1926
                }
-
 
1927
 
1877
 
1928
                if ($status === core_plugin_manager::PLUGIN_STATUS_MISSING) {
1878
                if ($status === core_plugin_manager::PLUGIN_STATUS_MISSING) {
1929
                    $row->attributes['class'] .= ' missing';
-
 
1930
                    $msg = html_writer::div(get_string('status_missing', 'core_plugin'), 'statusmsg badge text-bg-danger');
1879
                    $msg = html_writer::div(get_string('status_missing', 'core_plugin'), 'statusmsg badge bg-danger text-white');
1931
                } else if ($status === core_plugin_manager::PLUGIN_STATUS_NEW) {
1880
                } else if ($status === core_plugin_manager::PLUGIN_STATUS_NEW) {
1932
                    $row->attributes['class'] .= ' newplugin';
1881
                    $msg = html_writer::div(get_string('status_new', 'core_plugin'), 'statusmsg badge bg-success text-white');
1933
                    $msg = html_writer::div(get_string('status_new', 'core_plugin'), 'statusmsg badge text-bg-success');
1882
                } else {
1934
                } else {
Línea -... Línea 1935...
-
 
1935
                    $msg = '';
-
 
1936
                }
-
 
1937
 
-
 
1938
                $deprecatedmsg = '';
-
 
1939
                if ($plugin->is_deprecated()) {
-
 
1940
                    // Omit the status for deprecated plugin types, unless it's 'missing from disk'.
-
 
1941
                    $msg = $status == core_plugin_manager::PLUGIN_STATUS_MISSING ? $msg : '';
-
 
1942
                    $deprecatedmsg = html_writer::div(
-
 
1943
                        get_string('deprecated_type', 'core_plugin'),
-
 
1944
                        'statusmsg badge bg-danger text-white'
1883
                    $msg = '';
1945
                    );
1884
                }
1946
                }
1885
 
1947
 
1886
                $requriedby = $pluginman->other_plugins_that_require($plugin->component);
1948
                $requriedby = $pluginman->other_plugins_that_require($plugin->component);
1887
                if ($requriedby) {
1949
                if ($requriedby) {
1888
                    $requiredby = html_writer::tag('div', get_string('requiredby', 'core_plugin', implode(', ', $requriedby)),
1950
                    $requiredby = html_writer::tag('div', get_string('requiredby', 'core_plugin', implode(', ', $requriedby)),
1889
                        array('class' => 'requiredby'));
1951
                        array('class' => 'requiredby'));
Línea 1890... Línea 1952...
1890
                } else {
1952
                } else {
1891
                    $requiredby = '';
1953
                    $requiredby = '';
-
 
1954
                }
1892
                }
1955
 
1893
 
1956
                $updateinfo = '';
1894
                $updateinfo = '';
1957
                if (is_array($plugin->available_updates())) {
1895
                if (is_array($plugin->available_updates())) {
1958
                    $row->attributes['class'] .= ' updatable';
Línea 1896... Línea 1959...
1896
                    foreach ($plugin->available_updates() as $availableupdate) {
1959
                    foreach ($plugin->available_updates() as $availableupdate) {
Línea 1897... Línea 1960...
1897
                        $updateinfo .= $this->plugin_available_update_info($pluginman, $availableupdate);
1960
                        $updateinfo .= $this->plugin_available_update_info($pluginman, $availableupdate);
1898
                    }
1961
                    }
1899
                }
1962
                }
1900
 
1963
 
Línea 1998... Línea 2061...
1998
            get_string('report'),
2061
            get_string('report'),
1999
            get_string('plugin'),
2062
            get_string('plugin'),
2000
            get_string('status'),
2063
            get_string('status'),
2001
        );
2064
        );
2002
        $servertable->colclasses = array('centeralign name', 'centeralign info', 'leftalign report', 'leftalign plugin', 'centeralign status');
2065
        $servertable->colclasses = array('centeralign name', 'centeralign info', 'leftalign report', 'leftalign plugin', 'centeralign status');
2003
        $servertable->attributes['class'] = 'admintable environmenttable generaltable table-sm';
2066
        $servertable->attributes['class'] = 'table table-striped admintable environmenttable generaltable table-sm';
2004
        $servertable->id = 'serverstatus';
2067
        $servertable->id = 'serverstatus';
Línea 2005... Línea 2068...
2005
 
2068
 
Línea 2006... Línea 2069...
2006
        $serverdata = array('ok'=>array(), 'warn'=>array(), 'error'=>array());
2069
        $serverdata = array('ok'=>array(), 'warn'=>array(), 'error'=>array());
Línea 2011... Línea 2074...
2011
            get_string('report'),
2074
            get_string('report'),
2012
            get_string('plugin'),
2075
            get_string('plugin'),
2013
            get_string('status'),
2076
            get_string('status'),
2014
        );
2077
        );
2015
        $othertable->colclasses = array('aligncenter info', 'alignleft report', 'alignleft plugin', 'aligncenter status');
2078
        $othertable->colclasses = array('aligncenter info', 'alignleft report', 'alignleft plugin', 'aligncenter status');
2016
        $othertable->attributes['class'] = 'admintable environmenttable generaltable table-sm';
2079
        $othertable->attributes['class'] = 'table table-striped admintable environmenttable generaltable table-sm';
2017
        $othertable->id = 'otherserverstatus';
2080
        $othertable->id = 'otherserverstatus';
Línea 2018... Línea 2081...
2018
 
2081
 
Línea 2019... Línea 2082...
2019
        $otherdata = array('ok'=>array(), 'warn'=>array(), 'error'=>array());
2082
        $otherdata = array('ok'=>array(), 'warn'=>array(), 'error'=>array());
Línea 2112... Línea 2175...
2112
                if (empty($CFG->docroot) or $environment_result->plugin) {
2175
                if (empty($CFG->docroot) or $environment_result->plugin) {
2113
                    $report = get_string($stringtouse, 'admin', $rec);
2176
                    $report = get_string($stringtouse, 'admin', $rec);
2114
                } else {
2177
                } else {
2115
                    $report = $this->doc_link(join('/', $linkparts), get_string($stringtouse, 'admin', $rec), true);
2178
                    $report = $this->doc_link(join('/', $linkparts), get_string($stringtouse, 'admin', $rec), true);
2116
                }
2179
                }
2117
                // Enclose report text in div so feedback text will be displayed underneath it.
-
 
2118
                $report = html_writer::div($report);
-
 
Línea 2119... Línea 2180...
2119
 
2180
 
2120
                // Format error or warning line
2181
                // Format error or warning line
2121
                if ($errorline) {
2182
                if ($errorline) {
2122
                    $messagetype = 'error';
2183
                    $messagetype = 'error';
-
 
2184
                    $statusclass = 'bg-danger text-white';
2123
                    $statusclass = 'bg-danger text-white';
2185
                    $feedbackclass = 'alert-danger';
2124
                } else if ($warningline) {
2186
                } else if ($warningline) {
2125
                    $messagetype = 'warn';
2187
                    $messagetype = 'warn';
-
 
2188
                    $statusclass = 'bg-warning text-dark';
2126
                    $statusclass = 'bg-warning text-dark';
2189
                    $feedbackclass = 'alert-warning';
2127
                } else {
2190
                } else {
2128
                    $messagetype = 'ok';
2191
                    $messagetype = 'ok';
-
 
2192
                    $statusclass = 'bg-success text-white';
2129
                    $statusclass = 'bg-success text-white';
2193
                    $feedbackclass = 'alert-success';
2130
                }
2194
                }
2131
                $status = html_writer::span($status, 'badge ' . $statusclass);
2195
                $status = html_writer::span($status, 'badge ' . $statusclass);
2132
                // Here we'll store all the feedback found
2196
                // Here we'll store all the feedback found
2133
                $feedbacktext = '';
2197
                $feedbacktext = '';
2134
                // Append the feedback if there is some
2198
                // Append the feedback if there is some
-
 
2199
                $feedbacktext .= $environment_result->strToReport($environment_result->getFeedbackStr(),
2135
                $feedbacktext .= $environment_result->strToReport($environment_result->getFeedbackStr(), $messagetype);
2200
                    "alert {$feedbackclass} px-2 py-1 m-1");
2136
                //Append the bypass if there is some
2201
                //Append the bypass if there is some
-
 
2202
                $feedbacktext .= $environment_result->strToReport($environment_result->getBypassStr(),
2137
                $feedbacktext .= $environment_result->strToReport($environment_result->getBypassStr(), 'warn');
2203
                    'alert alert-warning px-2 py-1 m-1');
2138
                //Append the restrict if there is some
2204
                //Append the restrict if there is some
-
 
2205
                $feedbacktext .= $environment_result->strToReport($environment_result->getRestrictStr(),
Línea 2139... Línea 2206...
2139
                $feedbacktext .= $environment_result->strToReport($environment_result->getRestrictStr(), 'error');
2206
                    'alert alert-danger px-2 py-1 m-1');
Línea 2140... Línea 2207...
2140
 
2207
 
2141
                $report .= $feedbacktext;
2208
                $report .= $feedbacktext;
Línea 2178... Línea 2245...
2178
     */
2245
     */
2179
    public function upgradekey_form_page($url) {
2246
    public function upgradekey_form_page($url) {
Línea 2180... Línea 2247...
2180
 
2247
 
2181
        $output = '';
2248
        $output = '';
2182
        $output .= $this->header();
-
 
2183
        $output .= $this->container_start('upgradekeyreq');
2249
        $output .= $this->header();
-
 
2250
        $output .= $this->heading(get_string('upgradekeyreq', 'core_admin'));
2184
        $output .= $this->heading(get_string('upgradekeyreq', 'core_admin'));
2251
        $output .= $this->container_start('upgradekeyreq w-25');
2185
        $output .= html_writer::start_tag('form', array('method' => 'POST', 'action' => $url));
2252
        $output .= html_writer::start_tag('form', array('method' => 'POST', 'action' => $url));
-
 
2253
        $output .= html_writer::empty_tag('input', [
2186
        $output .= html_writer::empty_tag('input', [
2254
            'id' => 'upgradekey',
2187
            'name' => 'upgradekey',
2255
            'name' => 'upgradekey',
2188
            'type' => 'password',
2256
            'type' => 'password',
2189
            'class' => 'form-control w-auto',
2257
            'class' => 'form-control w-auto',
2190
        ]);
2258
        ]);
Línea 2204... Línea 2272...
2204
     * Display message about the benefits of registering on Moodle.org
2272
     * Display message about the benefits of registering on Moodle.org
2205
     *
2273
     *
2206
     * @return string
2274
     * @return string
2207
     */
2275
     */
2208
    public function moodleorg_registration_message() {
2276
    public function moodleorg_registration_message() {
2209
 
-
 
2210
        $out = format_text(get_string('registerwithmoodleorginfo', 'core_hub'), FORMAT_MARKDOWN);
2277
        $a = new stdClass();
2211
 
-
 
2212
        $out .= html_writer::link(
2278
        $a->moreinformation = '#id_sitestats'; // More information anchor.
2213
            MOODLE_PRODUCTURL.'/solutions/moodle-app/',
2279
        $a->moodleapp = MOODLE_PRODUCTURL . '/solutions/moodle-app/';
2214
            $this->output->pix_icon('i/info', '').' '.get_string('registerwithmoodleorginfoapp', 'core_hub'),
2280
        $out = format_text(get_string('registerwithmoodleorginfo', 'core_hub', $a), FORMAT_MARKDOWN);
2215
            ['class' => 'btn btn-link', 'role' => 'opener', 'target' => '_href']
-
 
2216
        );
-
 
Línea 2217... Línea 2281...
2217
 
2281
 
2218
        $out .= html_writer::link(
2282
        $out .= html_writer::link(
2219
            HUB_MOODLEORGHUBURL,
2283
            HUB_MOODLEORGHUBURL,
2220
            $this->output->pix_icon('i/stats', '').' '.get_string('registerwithmoodleorginfostats', 'core_hub'),
2284
            $this->output->pix_icon('i/stats', '').' '.get_string('registerwithmoodleorginfostats', 'core_hub'),