title = get_string('adminbookmarks'); $this->version = 2006090300; } function applicable_formats() { return array('all' => true); } function preferred_width() { return 210; } function create_item($visiblename,$link,$icon) { $this->tempcontent .= ' ' . $visiblename . '
' . "\n"; } function get_content() { global $CFG, $USER, $PAGE; require_once($CFG->libdir.'/adminlib.php'); $adminroot = admin_get_root(); if ($this->content !== NULL) { return $this->content; } $this->content = new stdClass; $this->content->text = ''; if (isset($USER->preference['admin_bookmarks'])) { $bookmarks = explode(',',$USER->preference['admin_bookmarks']); // hmm... just a liiitle (potentially) processor-intensive // (recall that $adminroot->locate is a huge recursive call... and we're calling it repeatedly here /// Accessibility: markup as a list. $this->content->text .= '
    '."\n"; foreach($bookmarks as $bookmark) { $temp = $adminroot->locate($bookmark); if (is_a($temp, 'admin_settingpage')) { $this->content->text .= '
  1. ' . $temp->visiblename . "
  2. \n"; } elseif (is_a($temp, 'admin_externalpage')) { $this->content->text .= '
  3. ' . $temp->visiblename . "
  4. \n"; } } $this->content->text .= "
\n"; } else { $bookmarks = array(); } if (($section = (isset($PAGE->section) ? $PAGE->section : '')) && (in_array($section, $bookmarks))) { $this->content->footer = '' . get_string('unbookmarkthispage','admin') . ''; } elseif ($section = (isset($PAGE->section) ? $PAGE->section : '')) { $this->content->footer = '' . get_string('bookmarkthispage','admin') . ''; } else { $this->content->footer = ''; } return $this->content; } } ?>