Index: lang/en_utf8/admin.php =================================================================== RCS file: /globalcvs/ou-moodle/lang/en_utf8/admin.php,v retrieving revision 1.19 diff -u -r1.19 admin.php --- lang/en_utf8/admin.php 13 Nov 2006 14:09:05 -0000 1.19 +++ lang/en_utf8/admin.php 27 Nov 2006 17:32:49 -0000 @@ -399,6 +399,7 @@ $string['mediapluginrm'] = 'Enable .rm filter'; $string['mediapluginrpm'] = 'Enable .rpm filter'; $string['mediapluginwmv'] = 'Enable .wmv filter'; +$string['moduleinstances'] = 'Module instances'; $string['mysql416bypassed'] = 'However, if your site is using iso-8859-1 (latin) languages ONLY, you may continue using your currently installed MySQL 4.1.12 (or higher).'; $string['mysql416required'] = 'MySQL 4.1.16 is the minimum version required for Moodle 1.6 in order to guarantee that all data can be converted to UTF-8 in the future.'; $string['nolangupdateneeded'] = 'All your language packs are up to date, no update is needed'; Index: lang/en_utf8/report_moduleinstances.php =================================================================== RCS file: lang/en_utf8/report_moduleinstances.php diff -N lang/en_utf8/report_moduleinstances.php --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lang/en_utf8/report_moduleinstances.php 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,22 @@ + Index: admin/report/moduleinstances/index.php =================================================================== RCS file: admin/report/moduleinstances/index.php diff -N admin/report/moduleinstances/index.php --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ admin/report/moduleinstances/index.php 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,123 @@ +libdir . '/tablelib.php'); +require_once($CFG->libdir . '/adminlib.php'); + +// Test permissions. +require_login(); +require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID)); + +// Set up the admin page stuff. +$adminroot = admin_get_root(); +admin_externalpage_setup('reportmoduleinstances', $adminroot); +admin_externalpage_print_header($adminroot); + +// Read the URL parameters. +$moduletype = optional_param('module', '', PARAM_SAFEDIR); + +// Get a list of all the modules. +$modules = get_records('modules'); +$allmodules = array(); +foreach ($modules as $module) { + $allmodules[$module->name] = get_string('modulename', $module->name); +} +asort($allmodules); + +// If a module is specified, generate the report. +if ($moduletype) { + if (empty($allmodules[$moduletype])) { + error(get_string('unknownmoduletype', 'report_moduleinstances')); + } + $modulename = $allmodules[$moduletype]; + + $instances = get_records_sql(" +SELECT + cm.id, + c.id AS courseid, + c.shortname, + c.fullname, + m.id AS instanceid, + m.name +FROM + {$CFG->prefix}course c, + {$CFG->prefix}course_modules cm, + {$CFG->prefix}modules mod, + {$CFG->prefix}quiz m +WHERE + c.id = cm.course AND + cm.instance = m.id AND + cm.module = mod.id AND + mod.name = 'quiz' +ORDER BY + c.shortname, + m.name"); + + if ($instances) { + // Set up the table. + $table = new flexible_table('moduleinstances'); + $tablecolumns = array( + 'courseid' => 'right', + 'shortname' => 'left', + 'fullname' => 'left', + 'instanceid' => 'right', + 'name' => 'left' + ); + $headers = array(); + foreach ($tablecolumns as $name => $notused) { + $headers[$name] = get_string($name, 'report_moduleinstances', $modulename); + } + $table->define_columns(array_keys($tablecolumns)); + $table->define_headers(array_keys($tablecolumns)); + foreach ($tablecolumns as $name => $align) { + $table->column_style($name, 'text-align', $align); + } + $table->set_attribute('border', '5'); + $table->set_attribute('rowspan', '5'); + $table->set_attribute('colspan', '10'); + $table->set_attribute('bgcolor', 'khaki'); + $table->set_attribute('cellspdding', '0'); + $table->set_attribute('cellspacing', '0'); + $table->set_attribute('id', 'types'); + $table->set_attribute('class', 'generaltable generalbox'); + $table->setup(); + + // Add the data to the table. + foreach ($instances as $instance) { + $data = array(); + $data[] = "wwwroot}/course/view.php?id={$instance->courseid}\">{$instance->courseid}"; + $data[] = $instance->shortname; + $data[] = $instance->fullname; + $data[] = "wwwroot}/mod/$moduletype/view.php?id={$instance->id}\">{$instance->instanceid}"; + $data[] = $instance->name; + $table->add_data($data); + } + + // Print the table. + print_heading(get_string('instancesofmodule', 'report_moduleinstances', $modulename)); + $table->print_html(); + + } else { + echo '
', get_string('noinstances', 'report_moduleinstances', $modulename), '
'; + } +} + +// Print the module type selection form. +if (empty($moduletype)) { + $moduletype = reset(array_keys($allmodules)); +} + +echo ''; + +//Finish the page +print_footer(); +?>