Fixed error that caused self_test failure during initial install; made changes for PHP4 compatibility (no use of instanceof, no use of private/protected/public)

This commit is contained in:
vinkmar 2006-08-19 01:38:57 +00:00
parent 63aafc9e56
commit 0155cf991d

View file

@ -2,12 +2,12 @@
class block_admin_2 extends block_base { class block_admin_2 extends block_base {
private $currentdepth; var $currentdepth;
private $spancounter; var $spancounter;
private $tempcontent; var $tempcontent;
private $pathtosection; var $pathtosection;
private $expandjavascript; var $expandjavascript;
private $destination; var $destination;
function init() { function init() {
$this->title = "Administration (Beta)"; $this->title = "Administration (Beta)";
@ -51,15 +51,15 @@ class block_admin_2 extends block_base {
function build_tree (&$content) { function build_tree (&$content) {
global $CFG; global $CFG;
if ($content instanceof admin_settingpage) { if (is_a($content, 'admin_settingpage')) {
if ($content->check_access()) { if ($content->check_access()) {
$this->create_item($content->visiblename,$CFG->wwwroot.'/admin/settings.php?section=' . $content->name,$CFG->wwwroot .'/blocks/admin_2/item.gif'); $this->create_item($content->visiblename,$CFG->wwwroot.'/admin/settings.php?section=' . $content->name,$CFG->wwwroot .'/blocks/admin_2/item.gif');
} }
} else if ($content instanceof admin_externalpage) { } else if (is_a($content, 'admin_externalpage')) {
if ($content->check_access()) { if ($content->check_access()) {
$this->create_item($content->visiblename, $content->url, $CFG->wwwroot . '/blocks/admin_2/item.gif'); $this->create_item($content->visiblename, $content->url, $CFG->wwwroot . '/blocks/admin_2/item.gif');
} }
} else if ($content instanceof admin_category) { } else if (is_a($content, 'admin_category')) {
if ($content->check_access()) { if ($content->check_access()) {
// check if the category we're currently printing is a parent category for the current page; if it is, we // check if the category we're currently printing is a parent category for the current page; if it is, we
@ -167,6 +167,10 @@ class block_admin_2 extends block_base {
$this->content->text .= '</script>' . "\n"; $this->content->text .= '</script>' . "\n";
$this->content->footer = ''; $this->content->footer = '';
} else {
$this->content = new stdClass;
$this->content->text = '';
$this->content->footer = '';
} }
return $this->content; return $this->content;