Skip to content

Commit

Permalink
MDL-13101
Browse files Browse the repository at this point in the history
1. Showing full path
2. Showing plugins to be installed
3. Lang strings properly used
4. Table headers
  • Loading branch information
nicolasconnault committed Jan 24, 2008
1 parent c0491d4 commit 51b57ef
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 9 deletions.
2 changes: 2 additions & 0 deletions lang/en_utf8/moodle.php
Expand Up @@ -2,6 +2,7 @@
// moodle.php - created with Moodle 1.7 beta + (2006101003)


$string['abouttobeinstalled'] = 'about to be installed';
$string['action'] = 'Action';
$string['actions'] = 'Actions';
$string['active'] = 'Active';
Expand Down Expand Up @@ -385,6 +386,7 @@
$string['deselectall'] = 'Deselect all';
$string['detailedless'] = 'Less detailed';
$string['detailedmore'] = 'More detailed';
$string['directory'] = 'Directory';
$string['directorypaths'] = 'Directory Paths';
$string['disable'] = 'Disable';
$string['displayingfirst'] = 'Only the first $a->count $a->things are displayed';
Expand Down
74 changes: 65 additions & 9 deletions lib/adminlib.php
Expand Up @@ -4558,7 +4558,7 @@ function db_replace($search, $replace) {
*/
function print_plugin_tables() {
$compatlist = array();
$compatlist['mods'] = array('assignment',
$compatlist['mod'] = array('assignment',
'chat',
'choice',
'data',
Expand Down Expand Up @@ -4587,7 +4587,6 @@ function print_plugin_tables() {
'calendar_upcoming',
'course_list',
'course_summary',
'db',
'glossary_random',
'html',
'loancalc',
Expand All @@ -4610,7 +4609,7 @@ function print_plugin_tables() {
'tag_youtube',
'tags');

$compatlist['filters'] = array('activitynames',
$compatlist['filter'] = array('activitynames',
'algebra',
'censor',
'emailprotect',
Expand All @@ -4620,29 +4619,86 @@ function print_plugin_tables() {
'tex',
'tidy');

$installed_list = array();
$installed_mods = get_records_list('modules', '', '', '', 'name');
$installed_blocks = get_records_list('block', '', '', '', 'name');

foreach($installed_mods as $mod) {
$installed_list['mod'][] = $mod->name;
}

foreach($installed_blocks as $block) {
$installed_list['blocks'][] = $block->name;
}

$plugins = array();
$plugins['mods'] = get_list_of_plugins();
$plugins['blocks'] = get_list_of_plugins('blocks');
$plugins['filters'] = get_list_of_plugins('filter');
$plugins['mod'] = get_list_of_plugins('mod', 'db');
$plugins['blocks'] = get_list_of_plugins('blocks', 'db');
$plugins['filter'] = get_list_of_plugins('filter', 'db');

$strstandard = get_string('standard');
$strnonstandard = get_string('nonstandard');

$html = '';

foreach ($plugins as $cat => $list) {
$strcaption = get_string($cat);
if ($cat == 'mod') {
$strcaption = get_string('activitymodule');
} elseif ($cat == 'filter') {
$strcaption = get_string('managefilters');
}

$html .= '<table class="plugincompattable generaltable boxaligncenter" cellspacing="1" cellpadding="5" '
. 'id="' . $cat . 'compattable" summary="compatibility table"><caption>' . ucfirst($cat) . '</caption>' . "\n";
$row = 0;
. 'id="' . $cat . 'compattable" summary="compatibility table"><caption>' . $strcaption . '</caption>' . "\n";
$html .= '<tr class="r0"><th class="header c0">' . get_string('directory') . "</th>\n"
. '<th class="header c1">' . get_string('name') . "</th>\n"
. '<th class="header c2">' . get_string('status') . "</th>\n";

$row = 1;

foreach ($list as $k => $plugin) {
$standard = 'standard';

if (!in_array($plugin, $compatlist[$cat])) {
$standard = 'nonstandard';
}

$html .= "<tr class=\"r$row\"><td class=\"cell c0\">" . ucfirst($plugin) . "</td><td class=\"$standard cell c1\">" . ${'str' . $standard} . "</td></tr>\n";
// Get real name and full path of plugin
$plugin_name = "[[$plugin]]";

global $CFG;
$plugin_path = $CFG->dirroot . "/$cat/$plugin";

if ($cat == 'mod') {
$plugin_name = get_string('modulename', $plugin);
} elseif ($cat == 'blocks') {
$plugin_name = get_string('blockname', "block_$plugin");
if (empty($plugin_name) || $plugin_name == '[[blockname]]') {
if (($block = block_instance($plugin)) !== false) {
$plugin_name = $block->get_title();
} else {
$plugin_name = "[[$plugin]]";
}
}
} elseif ($cat == 'filter') {
$plugin_name = trim(get_string('filtername', $plugin));
if (empty($plugin_name) or ($plugin_name == '[[filtername]]')) {
$textlib = textlib_get_instance();
$plugin_name = $textlib->strtotitle($plugin);
}
}

// Determine if the plugin is about to be installed
$strabouttobeinstalled = '';
if ($cat != 'filter' && !in_array($plugin, $installed_list[$cat])) {
$strabouttobeinstalled = ' (' . get_string('abouttobeinstalled') . ')';
}

$html .= "<tr class=\"r$row\">\n"
. "<td class=\"cell c0\">$plugin_path</td>\n"
. "<td class=\"cell c1\">$plugin_name</td>\n"
. "<td class=\"$standard cell c2\">" . ${'str' . $standard} . $strabouttobeinstalled . "</td>\n</tr>\n";
$row++;
}
$html .= '</table><br />';
Expand Down

0 comments on commit 51b57ef

Please sign in to comment.