~ubuntu-branches/ubuntu/hoary/moodle/hoary

« back to all changes in this revision

Viewing changes to blocks/admin/block_admin.php

  • Committer: Bazaar Package Importer
  • Author(s): Isaac Clerencia
  • Date: 2004-12-29 00:49:52 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20041229004952-gliyqzpj2w3e7clx
Tags: 1.4.3-1
* Urgency high as upstream release fixes several security bugs
* New upstream release
* Write database creation errors and warn the user about it, 
closes: #285842, #285842

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<?PHP //$Id: block_admin.php,v 1.2 2004/04/26 09:03:40 defacer Exp $
 
1
<?PHP //$Id: block_admin.php,v 1.8.2.3 2004/10/09 13:11:49 stronk7 Exp $
2
2
 
3
3
class CourseBlock_admin extends MoodleBlock {
4
4
    function CourseBlock_admin($course) {
5
5
        $this->title = get_string('administration');
6
6
        $this->content_type = BLOCK_TYPE_LIST;
7
7
        $this->course = $course;
8
 
        $this->version = 2004041000;
 
8
        $this->version = 2004081200;
9
9
    }
 
10
 
10
11
    function get_content() {
11
 
        global $USER, $CFG, $THEME;
12
 
 
13
 
        require_once($CFG->dirroot.'/mod/forum/lib.php');
14
12
 
15
13
        if($this->content !== NULL) {
16
14
            return $this->content;
21
19
        $this->content->icons = array();
22
20
        $this->content->footer = '';
23
21
 
 
22
        if (empty($this->course)) {
 
23
            $this->content = '';
 
24
        } else if ($this->course->id == SITEID) {
 
25
            $this->load_content_for_site();
 
26
        } else {
 
27
            $this->load_content_for_course();
 
28
        }
 
29
 
 
30
        return $this->content;
 
31
    }
 
32
 
 
33
 
 
34
    function load_content_for_site() {
 
35
        global $CFG, $USER;
 
36
 
 
37
        if (isadmin()) {
 
38
            $this->content->items[] = '<a href="'.$CFG->wwwroot.'/'.$CFG->admin.'/configure.php">'.get_string('configuration').'</a>...';
 
39
            $this->content->icons[] = '<img src="'.$CFG->pixpath.'/i/admin.gif" height="16" width="16" alt="" />';
 
40
 
 
41
            $this->content->items[] = '<a href="'.$CFG->wwwroot.'/'.$CFG->admin.'/users.php">'.get_string('users').'</a>...';
 
42
            $this->content->icons[] = '<img src="'.$CFG->pixpath.'/i/users.gif" height="16" width="16" alt="" />';
 
43
 
 
44
            $this->content->items[]='<a href="'.$CFG->wwwroot.'/backup/backup.php?id='.SITEID.'">'.get_string('backup').'...</a>';
 
45
            $this->content->icons[]='<img src="'.$CFG->pixpath.'/i/backup.gif" height="16" width="16" alt="">';
 
46
 
 
47
            $this->content->items[]='<a href="'.$CFG->wwwroot.'/files/index.php?id='.SITEID.'&amp;wdir=/backupdata">'.get_string('restore').'...</a>';
 
48
            $this->content->icons[]='<img src="'.$CFG->pixpath.'/i/restore.gif" height="16" width="16" alt="">';
 
49
        }
 
50
 
 
51
        if (iscreator()) {
 
52
            $this->content->items[] = '<a href="'.$CFG->wwwroot.'/course/index.php?edit=on&sesskey='.$USER->sesskey.'">'.get_string('courses').'</a>';
 
53
            $this->content->icons[] = '<img src="'.$CFG->pixpath.'/i/course.gif" height="16" width="16" alt="" />';
 
54
        }
 
55
 
 
56
        if (isadmin()) {
 
57
            $this->content->items[] = '<a href="'.$CFG->wwwroot.'/course/log.php?id='.SITEID.'">'.get_string('logs').'</a>';
 
58
            $this->content->icons[] = '<img src="'.$CFG->pixpath.'/i/log.gif" height="16" width="16" alt="" />';
 
59
 
 
60
            $this->content->items[] = '<a href="'.$CFG->wwwroot.'/files/index.php?id='.SITEID.'">'.get_string('sitefiles').'</a>';
 
61
            $this->content->icons[] = '<img src="'.$CFG->pixpath.'/i/files.gif" height="16" width="16" alt="" />';
 
62
 
 
63
            if (file_exists($CFG->dirroot.'/'.$CFG->admin.'/'.$CFG->dbtype)) {
 
64
                $this->content->items[] = '<a href="'.$CFG->wwwroot.'/'.$CFG->admin.'/'.$CFG->dbtype.'/frame.php">'.get_string('managedatabase').'</a>';
 
65
                $this->content->icons[] = '<img src="'.$CFG->pixpath.'/i/db.gif" height="16" width="16" alt="" />';
 
66
            }
 
67
            $this->content->footer = '<a href="'.$CFG->wwwroot.'/'.$CFG->admin.'/">'.get_string('admin').'</a>...';
 
68
        }
 
69
    }
 
70
 
 
71
    function load_content_for_course() {
 
72
        global $CFG, $USER;
 
73
 
 
74
        require_once($CFG->dirroot.'/mod/forum/lib.php');
 
75
 
24
76
        if (isguest()) {
25
77
            return $this->content;
26
78
        }
82
134
            }
83
135
 
84
136
        } else if (!isguest()) {  // Students menu
 
137
 
85
138
            if ($this->course->showgrades) {
86
139
                $this->content->items[]='<a href="grade.php?id='.$this->course->id.'">'.get_string('grades').'...</a>';
87
140
                $this->content->icons[]='<img src="'.$CFG->pixpath.'/i/grades.gif" height="16" width="16" alt="">';
102
155
                $this->content->icons[]='<img src="'.$CFG->pixpath.'/i/user.gif" height="16" width="16" alt="">';
103
156
            }
104
157
        }
105
 
 
106
 
        return $this->content;
107
158
    }
108
159
}
109
160