no matter what the language.
// 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 .= '<div align="right"><table align="right"><tr><td>';
$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 .= '</td>';
if ($vertical) {
$output .= '<td>';
$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 .= '</td></tr></table>';
$output .= '</div>';
$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)) {
$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;
}
}
$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");
}
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;
+}
?>