From: moodler Date: Mon, 2 Aug 2004 19:11:15 +0000 (+0000) Subject: The resource types are now always displayed in a standard order X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=6da4b2618fa7f451d692a48ac82dfcfe64ad01b9;p=moodle.git The resource types are now always displayed in a standard order no matter what the language. --- diff --git a/course/lib.php b/course/lib.php index ba418173ce..839761d24f 100644 --- a/course/lib.php +++ b/course/lib.php @@ -968,16 +968,19 @@ 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'); } @@ -985,7 +988,7 @@ function print_section_add_menus($course, $section, $modnames, $vertical=false, $output .= '
'; if ($vertical) { @@ -994,7 +997,7 @@ function print_section_add_menus($course, $section, $modnames, $vertical=false, $output .= '
'; $output .= popup_form("$CFG->wwwroot/course/mod.php?id=$course->id&section=$section&add=", - $resources, "ressection$section", "", $straddresource, '', '', true); + $resources, "ressection$section", "", $straddresource, 'resource/types', $straddresource, true); $output .= ''; $output .= popup_form("$CFG->wwwroot/course/mod.php?id=$course->id&section=$section&add=", - $modnames, "section$section", "", $straddactivity, '', '', true); + $modnames, "section$section", "", $straddactivity, 'mods', $straddactivity, true); $output .= '
'; $output .= '
'; diff --git a/help.php b/help.php index fac83cd722..49426df277 100644 --- a/help.php +++ b/help.php @@ -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 '
'; + 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 '
'; include("$filepath"); // The actual helpfile break; } diff --git a/mod/resource/lib.php b/mod/resource/lib.php index 72818924f2..2100411589 100644 --- a/mod/resource/lib.php +++ b/mod/resource/lib.php @@ -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; +} ?>