Permalink
Browse files

The resource types are now always displayed in a standard order

no matter what the language.
  • Loading branch information...
moodler
moodler committed Aug 2, 2004
1 parent 093a4a2 commit 6da4b2618fa7f451d692a48ac82dfcfe64ad01b9
Showing with 54 additions and 9 deletions.
  1. +10 −7 course/lib.php
  2. +22 −1 help.php
  3. +22 −1 mod/resource/lib.php
View
@@ -968,24 +968,27 @@ function print_section_add_menus($course, $section, $modnames, $vertical=false,
// Prints the menus to add activities and resources
global $CFG;
- static $straddactivity, $straddresource, $resources;
+ static $straddactivity, $stractivities, $straddresource, $resources;
if (!isset($straddactivity)) {
$straddactivity = get_string('addactivity');
$straddresource = get_string('addresource');
- $resourcetypes = get_list_of_plugins('mod/resource/type');
- foreach ($resourcetypes as $resourcetype) {
- $resources["resource&type=$resourcetype"] = get_string("resourcetype$resourcetype", 'resource');
+
+ /// Standard resource types
+ require_once("$CFG->dirroot/mod/resource/lib.php");
+ $resourceraw = resource_get_resource_types();
+
+ foreach ($resourceraw as $type => $name) {
+ $resources["resource&type=$type"] = $name;
}
- asort($resources);
$resources['label'] = get_string('resourcetypelabel', 'resource');
}
$output = '';
$output .= '<div align="right"><table align="right"><tr><td>';
$output .= popup_form("$CFG->wwwroot/course/mod.php?id=$course->id&amp;section=$section&add=",
- $resources, "ressection$section", "", $straddresource, '', '', true);
+ $resources, "ressection$section", "", $straddresource, 'resource/types', $straddresource, true);
$output .= '</td>';
if ($vertical) {
@@ -994,7 +997,7 @@ function print_section_add_menus($course, $section, $modnames, $vertical=false,
$output .= '<td>';
$output .= popup_form("$CFG->wwwroot/course/mod.php?id=$course->id&amp;section=$section&add=",
- $modnames, "section$section", "", $straddactivity, '', '', true);
+ $modnames, "section$section", "", $straddactivity, 'mods', $straddactivity, true);
$output .= '</td></tr></table>';
$output .= '</div>';
View
@@ -36,7 +36,7 @@
$helpfound = true;
include("$filepath"); // The actual helpfile
- if ($module == "moodle" && ($file == "index.html" || $file == "mods.html")) {
+ if ($module == "moodle" and ($file == "index.html" or $file == "mods.html")) {
// include file for each module
if (!$modules = get_records("modules", "visible", 1)) {
@@ -57,6 +57,27 @@
$filepath = "$CFG->dirroot/lang/$lang/help/$mod->name/$file";
if (file_exists("$filepath")) {
+ echo '<hr size="1" />';
+ include("$filepath"); // The actual helpfile
+ break;
+ }
+ }
+ }
+ }
+
+ if ($module == "moodle" and ($file == "resource/types.html")) { // RESOURCES
+ require_once("$CFG->dirroot/mod/resource/lib.php");
+ $typelist = resource_get_resource_types();
+ $typelist['label'] = get_string('resourcetypelabel', 'resource');
+
+ foreach ($typelist as $type => $name) {
+ foreach ($langs as $lang) {
+ if (empty($lang)) {
+ continue;
+ }
+ $filepath = "$CFG->dirroot/lang/$lang/help/resource/type/$type.html";
+ if (file_exists("$filepath")) {
+ echo '<hr size="1" />';
include("$filepath"); // The actual helpfile
break;
}
View
@@ -112,7 +112,7 @@ function setup(&$form) {
}
$nohtmleditorneeded = true;
- print_heading_with_help(get_string("resourcetype$form->type", 'resource'), $form->type, 'resource');
+ print_heading_with_help(get_string("resourcetype$form->type", 'resource'), $form->type, 'resource/type');
include("$CFG->dirroot/mod/resource/type/common.html");
}
@@ -477,4 +477,25 @@ function resource_is_url($path) {
return false;
}
+function resource_get_resource_types() {
+/// Returns a menu of current resource types, in standard order
+ global $resource_standard_order;
+
+ $resources = array();
+
+ /// Standard resource types
+ $standardresources = array('text','html','file','directory','reference');
+ foreach ($standardresources as $resourcetype) {
+ $resources[$resourcetype] = get_string("resourcetype$resourcetype", 'resource');
+ }
+
+ /// Drop-in extra resource types
+ $resourcetypes = get_list_of_plugins('mod/resource/type');
+ foreach ($resourcetypes as $resourcetype) {
+ if (!in_array($resourcetype, $resources)) {
+ $resources[$resourcetype] = get_string("resourcetype$resourcetype", 'resource');
+ }
+ }
+ return $resources;
+}
?>

0 comments on commit 6da4b26

Please sign in to comment.