- Modified to use build_navigation() for breadcrumb generation.
Author: Matt Clarkson <mattc@catalyst.net.nz>
$strname = get_string("name");
$strsummary = get_string("summary");
$strlastmodified = get_string("lastmodified");
+
+
+ $crumbs[] = array('name' => $strresources, 'link' => '', 'type' => 'activityinstance');
+ $navigation = build_navigation($crumbs, $course);
- print_header("$course->shortname: $strresources", $course->fullname, "$navigation $strresources",
+ print_header("$course->shortname: $strresources", $course->fullname, $navigation,
"", "", true, "", navmenu($course));
if (! $resources = get_all_instances_in_course("resource", $course)) {
$this->strresource = get_string("modulename", "resource");
$this->strresources = get_string("modulenameplural", "resource");
- if ($this->course->id != SITEID) {
- $this->navigation = "<a $CFG->frametarget onclick=\"this.target='$CFG->framename'\" href=\"$CFG->wwwroot/course/view.php?id={$this->course->id}\">{$this->course->shortname}</a> -> ".
- "<a $CFG->frametarget onclick=\"this.target='$CFG->framename'\" href=\"index.php?id={$this->course->id}\">$this->strresources</a> ->";
- } else {
- $this->navigation = "<a $CFG->frametarget onclick=\"this.target='$CFG->framename'\" href=\"index.php?id={$this->course->id}\">$this->strresources</a> ->";
- }
+ $this->crumbs[] = array('name' => $this->strresources, 'link' => "index.php?id={$this->course->id}", 'type' => 'activity');
if (!$this->cm->visible and !has_capability('moodle/course:viewhiddenactivities', get_context_instance(CONTEXT_MODULE, $this->cm->id))) {
$pagetitle = strip_tags($this->course->shortname.': '.$this->strresource);
- print_header($pagetitle, $this->course->fullname, "$this->navigation $this->strresource", "", "", true, '', navmenu($this->course, $this->cm));
+ $this->crumbs[] = array('name' => $this->strresource, 'link' => '', 'type' => 'activityinstance');
+ $this->navigation = build_navigation($this->crumbs, $this->course);
+
+ print_header($pagetitle, $this->course->fullname, $this->navigation, "", "", true, '', navmenu($this->course, $this->cm));
notice(get_string("activityiscurrentlyhidden"), "$CFG->wwwroot/course/view.php?id={$this->course->id}");
}
+
} else {
$this->course = $COURSE;
}
parent::display();
/// Set up some shorthand variables
- $cm = $this->cm;
+ $cm = $this->cm;
$course = $this->course;
- $resource = $this->resource;
+ $resource = $this->resource;
require_once($CFG->libdir.'/filelib.php');
- $subdir = optional_param('subdir','', PARAM_PATH);
+ $subdir = optional_param('subdir','', PARAM_PATH);
$resource->reference = clean_param($resource->reference, PARAM_PATH);
$formatoptions = new object();
$count = 0;
$subnav = "<a href=\"view.php?id={$cm->id}\">".format_string($resource->name,true)."</a>";
$backsub = '';
+ $this->crumbs[] = array('name' => format_string($resource->name,true), 'link' => "view.php?id={$cm->id}", 'type' => 'activity');
+
foreach ($subs as $sub) {
$count++;
if ($count < $countsubs) {
$backsub .= "/$sub";
- $subnav .= " -> <a href=\"view.php?id={$cm->id}&subdir=$backsub\">$sub</a>";
+
+ $this->crumbs[] = array('name' => $sub, 'link' => "view.php?id={$cm->id}", 'type' => 'title');
} else {
- $subnav .= " -> $sub";
+ $this->crumbs[] = array('name' => $sub, 'link' => '', 'type' => 'title');
}
}
} else {
- $subnav = format_string($resource->name);
+ $this->crumbs[] = array('name' => format_string($resource->name), 'link' => '', 'type' => 'activity');
}
$pagetitle = strip_tags($course->shortname.': '.format_string($resource->name));
$editfiles = print_single_button("$CFG->wwwroot/files/index.php", $options, get_string("editfiles"), 'get', '', true);
$update = $editfiles.$update;
}
- print_header($pagetitle, $course->fullname, "$this->navigation $subnav",
+ $this->navigation = build_navigation($this->crumbs, $this->course);
+ print_header($pagetitle, $course->fullname, $this->navigation,
"", "", true, $update,
navmenu($course, $cm));
global $CFG;
parent::setup($form);
-
+
$rawdirs = get_directory_list("$CFG->dataroot/{$this->course->id}", array($CFG->moddata, 'backupdata'), true, true, false);
$dirs = array();
foreach ($rawdirs as $rawdir) {
$dirs[$rawdir] = $rawdir;
}
-
+
include("$CFG->dirroot/mod/resource/type/directory/directory.html");
parent::setup_end();
}
+function setup_elements(&$mform) {
+ global $CFG;
+
+ $rawdirs = get_directory_list($CFG->dataroot.'/'.$this->course->id, array($CFG->moddata, 'backupdata'), true, true, false);
+ $dirs = array();
+ $dirs[0]=get_string('maindirectory', 'resource');
+ foreach ($rawdirs as $rawdir) {
+ $dirs[$rawdir] = $rawdir;
+ }
+
+ $mform->addElement('select', 'reference', get_string('resourcetypedirectory', 'resource'), $dirs);
+ $mform->setDefault('windowpopup', 0);
+
+}
+
}
print_footer($course);
} else { /// Make a page and a pop-up window
- print_header($pagetitle, $course->fullname, "$this->navigation ".format_string($resource->name),
+ $this->crumbs[] = array('name' => format_string($resource->name), 'link' => '', 'type' => 'activityinstance');
+ $this->navigation = build_navigation($this->crumbs, $this->course);
+
+ print_header($pagetitle, $course->fullname, $this->navigation,
"", "", true, update_module_button($cm->id, $course->id, $this->strresource),
navmenu($course, $cm));
}
} else { /// not a popup at all
- print_header($pagetitle, $course->fullname, "$this->navigation ".format_string($resource->name),
+ $this->crumbs[] = array('name' => format_string($resource->name), 'link' => '', 'type' => 'activityinstance');
+ $this->navigation = build_navigation($this->crumbs, $this->course);
+
+ print_header($pagetitle, $course->fullname, $this->navigation,
"", "", true, update_module_button($cm->id, $course->id, $this->strresource),
navmenu($course, $cm));
/// Instantiate a resource_ims object and modify its navigation
$resource_obj = new resource_ims ($cmid);
- if ($resource_obj->course->id != SITEID) {
- $resource_obj->navigation = "<a $CFG->frametarget href=\"$CFG->wwwroot/course/view.php?id={$course->id}\">{$course->shortname}</a> -> ".
- "<a $CFG->frametarget href=\"$CFG->wwwroot/mod/resource/index.php?id={$course->id}\">$resource_obj->strresources</a> -> ";
- } else {
- $resource_obj->navigation = "<a $CFG->frametarget href=\"$CFG->wwwroot/mod/resource/index.php?id={$course->id}\">$resource_obj->strresources</a> -> ";
- }
-
+
/// Print the header of the page
$pagetitle = strip_tags($course->shortname.': '.
format_string($resource->name)).': '.
if ($inpopup) {
print_header($pagetitle, $course->fullname);
} else {
- print_header($pagetitle, $course->fullname,
- $resource_obj->navigation.format_string($resource->name).' -> '.$strdeploy,
+
+ $resource_obj->crumbs[] = array('name' => format_string($resource->name), 'link' => '', 'type' => 'activityinstance');
+ $resource_obj->crumbs[] = array('name' => $strdeploy, 'link' => '', 'type' => 'action');
+ $navigation = build_navigation($resource_obj->crumbs, $resource_obj->course);
+ print_header($pagetitle, $course->fullname, $navigation,
'', '', true,
update_module_button($cm->id, $course->id, $resource_obj->strresource));
}
if ($inpopup) {
print_header($pagetitle, $course->fullname.' : '.$resource->name);
} else {
- print_header($pagetitle, $course->fullname, "$this->navigation ".format_string($resource->name), "", "", true, update_module_button($cm->id, $course->id, $this->strresource), navmenu($course, $cm));
+
+ $this->crumbs[] = array('name' => format_string($resource->name), 'link' => '', 'type' => 'activityinstance');
+ $this->navigation = build_navigation($this->crumbs, $this->course);
+
+ print_header($pagetitle, $course->fullname, $this->navigation, "", "", true, update_module_button($cm->id, $course->id, $this->strresource), navmenu($course, $cm));
}
print_simple_box_start('center', '60%');
echo '<p align="center">'.$errortext.'</p>';
//print_header($pagetitle, $course->fullname.' : '.$resource->name);
print_header();
} else {
- print_header($pagetitle, $course->fullname, "$this->navigation ".format_string($resource->name), "", "", true, update_module_button($cm->id, $course->id, $this->strresource), navmenu($course, $cm, "parent"));
+ $this->crumbs[] = array('name' => format_string($resource->name), 'link' => '', 'type' => 'activityinstance');
+ $this->navigation = build_navigation($this->crumbs, $this->course);
+ print_header($pagetitle, $course->fullname, $this->navigation, "", "", true, update_module_button($cm->id, $course->id, $this->strresource), navmenu($course, $cm, "parent"));
}
/// content - this produces everything else
$this->print_ims($cm, $course, $items, $resource, $page);
} else { /// not a popup at all
add_to_log($course->id, "resource", "view", "view.php?id={$cm->id}", $resource->id, $cm->id);
- print_header($pagetitle, $course->fullname, "$this->navigation ".format_string($resource->name),
+ $this->crumbs[] = array('name' => format_string($resource->name), 'link' => '', 'type' => 'title');
+ $this->navigation = build_navigation($this->crumbs, $this->course);
+
+ print_header($pagetitle, $course->fullname, $this->navigation,
"", "", true, update_module_button($cm->id, $course->id, $this->strresource),
navmenu($course, $cm));