files in a directory to make them available to students.
$string['configpopupwidth'] = 'What width should be the default width for new popup windows?';
$string['configwebsearch'] = 'When adding a URL as a webpage or weblink, this location is offered as a site to help the user search for the URL they want.';
$string['directlink'] = 'Direct link to this file';
+$string['directoryinfo'] = 'All the files in the chosen directory will be displayed.';
$string['editingaresource'] = 'Editing a resource';
$string['example'] = 'Example';
$string['examplereference'] = 'Tobin, K. & Tippins, D (1993) Constructivism as a Referent for Teaching and Learning. In: K. Tobin (Ed) The Practice of Constructivism in Science Education, pp 3-21, Lawrence-Erlbaum, Hillsdale, NJ.';
$string['filename'] = 'File name';
$string['fulltext'] = 'Full text';
$string['htmlfragment'] = 'HTML fragment';
+$string['maindirectory'] = 'Main files directory';
$string['modulename'] = 'Resource';
$string['modulenameplural'] = 'Resources';
$string['neverseen'] = 'Never seen';
$string['resourcetype6'] = 'HTML text';
$string['resourcetype7'] = 'Program';
$string['resourcetype8'] = 'Wiki text';
+$string['resourcetype9'] = 'Directory';
?>
<?php
break;
+ case DIRECTORY:
+ $rawdirs = get_directory_list("$CFG->dataroot/$course->id", 'moddata', true, true);
+ $dirs = array();
+ foreach ($rawdirs as $rawdir) {
+ $dirs[$rawdir] = $rawdir;
+ }
+ $strdirectoryinfo = get_string("directoryinfo", "resource");
+ $strmaindirectory = get_string("maindirectory", "resource");
+ ?>
+ <tr valign="top">
+ <td align="right" nowrap>
+ <p><b><?php echo $strtypename?>:</b></p>
+ </td>
+ <td>
+ <?php choose_from_menu($dirs, "reference", $form->reference, $strmaindirectory, '', '') ?>
+ </td>
+ </tr>
+ <tr valign="top">
+ <td align="right" nowrap>
+ </td>
+ <td>
+ <p><?php echo "$strdirectoryinfo" ?></p>
+ </td>
+ </tr>
+
+ <?php
+ break;
+
default:
error(get_string("notypechosen", "resource"), $_SERVER["HTTP_REFERER"]);
break;
define("HTML", "6");
define("PROGRAM", "7");
define("WIKITEXT", "8");
+define("DIRECTORY", "9");
$RESOURCE_TYPE = array (REFERENCE => get_string("resourcetype1", "resource"),
WEBPAGE => get_string("resourcetype2", "resource"),
WEBLINK => get_string("resourcetype5", "resource"),
HTML => get_string("resourcetype6", "resource"),
PROGRAM => get_string("resourcetype7", "resource"),
- WIKITEXT => get_string("resourcetype8", "resource") );
+ WIKITEXT => get_string("resourcetype8", "resource"),
+ DIRECTORY => get_string("resourcetype9", "resource") );
if (!isset($CFG->resource_framesize)) {
set_config("resource_framesize", 130);
print_footer($course);
break;
-
+
+ case DIRECTORY:
+ require_once("../../files/mimetypes.php");
+
+ add_to_log($course->id, "resource", "view", "view.php?id=$cm->id", $resource->id, $cm->id);
+ print_header($pagetitle, "$course->fullname", "$navigation $resource->name",
+ "", "", true, update_module_button($cm->id, $course->id, $strresource), navmenu($course, $cm));
+
+ if (trim($resource->summary)) {
+ print_simple_box(text_to_html($resource->summary), "center");
+ print_spacer(10,10);
+ }
+
+ print_simple_box_start("center", "", "$THEME->cellcontent", "20" );
+
+ if ($resource->reference) {
+ $relativepath = "$course->id/$resource->reference";
+ } else {
+ $relativepath = "$course->id";
+ }
+
+ $files = get_directory_list("$CFG->dataroot/$relativepath", 'moddata', false);
+ $strftime = get_string('strftimedatetime');
+
+ echo '<table cellpadding="4">';
+ foreach ($files as $file) {
+ $icon = mimeinfo("icon", $file);
+
+ if ($CFG->slasharguments) {
+ $relativeurl = "/file.php/$course->id/$resource->reference/$file";
+ } else {
+ $relativeurl = "/file.php?file=/$course->id/$resource->reference/$file";
+ }
+
+ echo '<tr>';
+ echo '<td>';
+ echo "<img src=\"$CFG->pixpath/f/$icon\" width=\"16\" height=\"16\">";
+ echo '</td>';
+ echo '<td nowrap="nowrap"><p>';
+ link_to_popup_window($relativeurl, "resourceedirectory$resource->id", "$file", 450, 600, '');
+ echo '</p></td>';
+ echo '<td> </td>';
+ echo '<td align="right" nowrap="nowrap"><p><font size="-1">';
+ echo userdate(filectime("$CFG->dataroot/$course->id/$resource->reference/$file"), $strftime);
+ echo '</font></p></td>';
+ echo '</tr>';
+ }
+ echo '</table>';
+
+ print_simple_box_end();
+
+ print_footer($course);
+ break;
default:
print_header($pagetitle, "$course->fullname", "$navigation $resource->name",