]> git.mjollnir.org Git - moodle.git/commitdiff
Breadcrumbs: mod/lesson changes
authormattc-catalyst <mattc-catalyst>
Mon, 16 Apr 2007 21:20:20 +0000 (21:20 +0000)
committermattc-catalyst <mattc-catalyst>
Mon, 16 Apr 2007 21:20:20 +0000 (21:20 +0000)
- Modified to use build_navigation() for breadcrumb generation.

Author: Matt Clarkson <mattc@catalyst.net.nz>

mod/lesson/import.php
mod/lesson/importppt.php
mod/lesson/index.php
mod/lesson/locallib.php
mod/lesson/pagelib.php

index 87b1b4e6849978f4299ada0d39fa115aec71a971..f897cda4141b29d93fd9d328009e2a5c49fb407f 100644 (file)
     $strimportquestions = get_string("importquestions", "lesson");
     $strlessons = get_string("modulenameplural", "lesson");
 
-    print_header_simple("$strimportquestions", " $strimportquestions",
-                 "<a href=\"index.php?id=$course->id\">$strlessons</a> -> <a href=\"view.php?id=$cm->id\">".format_string($lesson->name,true)."</a>-> $strimportquestions");
+    $crumbs[] = array('name' => $strlesson, 'link' => "index.php?id=$course->id", 'type' => 'activity');
+    $crumbs[] = array('name' => format_string($lesson->name,true), 'link' => "view.php?id=$cm->id", 'type' => 'activityinstance');
+    $crumbs[] = array('name' => $strimportquestions, 'link' => '', 'type' => 'title');
+            
+    $navigation = build_navigation($crumbs, $course);
+
+    print_header_simple("$strimportquestions", " $strimportquestions", $navigation);
 
     if ($form = data_submitted()) {   /// Filename
 
index bdc744eb03e2fc98076253b9733c6d286a2e2c89..4aa26e29db4b6ba028085e8660e0c865ff7a33a1 100644 (file)
     $strimportppt = get_string("importppt", "lesson");
     $strlessons = get_string("modulenameplural", "lesson");
 
-    print_header_simple("$strimportppt", " $strimportppt",
-                 "<a href=\"index.php?id=$course->id\">$strlessons</a> -> <a href=\"$CFG->wwwroot/mod/$modname/view.php?id=$cm->id\">".format_string($mod->name,true)."</a>-> $strimportppt");
+    $crumbs[] = array('name' => $strlessons, 'link' => "index.php?id=$course->id", 'type' => 'activity');
+    $crumbs[] = array('name' => format_string($mod->name,true), 'link' => "$CFG->wwwroot/mod/$modname/view.php?id=$cm->id", 'type' => 'activityinstance');
+    $crumbs[] = array('name' => $strimportppt, 'link' => '', 'type' => 'title');
+            
+    $navigation = build_navigation($crumbs, $course);
+
+    print_header_simple("$strimportppt", " $strimportppt", $navigation);
 
     if ($form = data_submitted()) {   /// Filename
 
index 26c90cc8100e2be9e46a8083a236910ff3bb3523..ddc567a26779bad6038988df0fbf7589268b6f7d 100644 (file)
 
 /// Print the header
 
-    if ($course->id != SITEID) {
-        $navigation = "<a href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</a> ->";
-    } else {
-        $navigation = '';
-    }
+    $crumbs[] = array('name' => $strlessons, 'link' => '', 'type' => 'activity');
+    
+    $navigation = build_navigation($crumbs, $course);
 
-    print_header("$course->shortname: $strlessons", $course->fullname, "$navigation $strlessons", "", "", true, "", navmenu($course));
+    print_header("$course->shortname: $strlessons", $course->fullname, $navigation, "", "", true, "", navmenu($course));
 
 /// Get all the appropriate data
 
index 4a0211bff90ff1ff499030051ccfc48e9aea1da9..8e536542aeacb02aa64bdc76cc76abcb41307a05 100644 (file)
@@ -239,25 +239,14 @@ function lesson_print_header($cm, $course, $lesson, $currenttab = '') {
     }
 
 /// Header setup
-    $navigation = array();
-    if ($course->id != SITEID) {
-        $navigation[$course->shortname] = "$CFG->wwwroot/course/view.php?id=$course->id";
-    }
-    $navigation[$strlessons] = "$CFG->wwwroot/mod/lesson/index.php?id=$course->id";
-    $navigation[$strname]    = '';
-
-    $urls = array();
-    foreach($navigation as $text => $href) {
-        if (empty($href)) {
-            $urls[] = $text;
-        } else {
-            $urls[] = '<a href="'.$href.'">'.$text.'</a>';
-        }
-    }
-    $breadcrumb = implode(' -> ', $urls);
-
+    
+    $crumbs[] = array('name' => $strlessons, 'link' => "$CFG->wwwroot/mod/lesson/index.php?id=$course->id", 'type' => 'activity');
+    $crumbs[] = array('name' => $strname, 'link' => '', 'type' => 'activityinstance');
+    
+    $navigation = build_navigation($crumbs, $course);
+    
 /// Print header, heading, tabs and messages
-    print_header("$course->shortname: $strname", $course->fullname, $breadcrumb,
+    print_header("$course->shortname: $strname", $course->fullname, $navigation,
                   '', '', true, $button, navmenu($course, $cm));
 
     if (has_capability('mod/lesson:manage', $context)) {
index b8b2c5fe13f45e5c2a39b87e407918b0c675eee5..0e0d777af90f9d5b3baed3d268472f82c72d7192 100644 (file)
@@ -76,29 +76,13 @@ class page_lesson extends page_generic_activity {
             $title = "{$this->courserecord->shortname}: $activityname";
         }
 
-    /// Build the breadcrumb
-        $breadcrumbs = array();
-        if ($this->courserecord->id != SITEID) {
-           $breadcrumbs[$this->courserecord->shortname] = "$CFG->wwwroot/course/view.php?id={$this->courserecord->id}";
+        $crumbs[] = array('name' => get_string('modulenameplural', $this->activityname), 'link' => $CFG->wwwroot."/mod/{$this->activityname}/index.php?id={$this->courserecord->id}", 'type' => 'activity');
+        $crumbs[] = array('name' => format_string($this->activityrecord->name), 'link' => $CFG->wwwroot."/mod/{$this->activityname}/view.php?id={$this->modulerecord->id}", 'type' => 'activityinstance');
+    
+        if (!empty($morebreadcrumbs)) {
+            $breadcrumbs = array_merge($crumbs, $morebreadcrumbs);
         }
-        $breadcrumbs[get_string('modulenameplural', 'lesson')] = "$CFG->wwwroot/mod/lesson/index.php?id={$this->courserecord->id}";
-
-        if (empty($morebreadcrumbs)) {
-            $breadcrumbs[$activityname] = '';
-        } else {
-            $breadcrumbs[$activityname] = "$CFG->wwwroot/mod/lesson/view.php?id={$this->modulerecord->id}&amp;pageid=$this->lessonpageid";
-            $breadcrumbs = array_merge($breadcrumbs, $morebreadcrumbs);
-        }
-        // Convert to breadcrumb string
-        $urls = array();
-        foreach($breadcrumbs as $text => $href) {
-            if (empty($href)) {
-                $urls[] = $text;
-            } else {
-                $urls[] = '<a href="'.$href.'">'.$text.'</a>';
-            }
-        }
-        $breadcrumb = implode(' -> ', $urls);
 
     /// Build the buttons
         if (has_capability('mod/lesson:edit', $context)) {
@@ -148,7 +132,9 @@ class page_lesson extends page_generic_activity {
             $meta = '';
         // }
 
-        print_header($title, $this->courserecord->fullname, $breadcrumb, '', $meta, true, $buttons, navmenu($this->courserecord, $this->modulerecord));
+        $navigation = build_navigation($crumbs, $this->courserecord);
+
+        print_header($title, $this->courserecord->fullname, $navigation, '', $meta, true, $buttons, navmenu($this->courserecord, $this->modulerecord));
 
         if (has_capability('mod/lesson:manage', $context)) {
             print_heading_with_help($activityname, 'overview', 'lesson');