title = get_string('administration');
$this->content_type = BLOCK_TYPE_LIST;
$this->version = 2004081200;
}
function get_content() {
if($this->content !== NULL) {
return $this->content;
}
$this->content = new stdClass;
$this->content->items = array();
$this->content->icons = array();
$this->content->footer = '';
if (empty($this->instance)) {
$this->content = '';
} else if ($this->instance->pageid == SITEID) {
$this->load_content_for_site();
} else {
$this->load_content_for_course();
}
return $this->content;
}
function load_content_for_site() {
global $CFG, $USER;
if (isadmin()) {
$this->content->items[] = ''.get_string('configuration').'...';
$this->content->icons[] = '
';
$this->content->items[] = ''.get_string('users').'...';
$this->content->icons[] = '
';
$this->content->items[]=''.get_string('backup').'...';
$this->content->icons[]='
';
$this->content->items[]=''.get_string('restore').'...';
$this->content->icons[]='
';
}
if (iscreator()) {
$this->content->items[] = ''.get_string('courses').'';
$this->content->icons[] = '
';
}
if (isadmin()) {
$this->content->items[] = ''.get_string('logs').'';
$this->content->icons[] = '
';
$this->content->items[] = ''.get_string('sitefiles').'';
$this->content->icons[] = '
';
if (file_exists($CFG->dirroot.'/'.$CFG->admin.'/'.$CFG->dbtype)) {
$this->content->items[] = ''.get_string('managedatabase').'';
$this->content->icons[] = '
';
}
$this->content->footer = ''.get_string('admin').'...';
}
}
function load_content_for_course() {
global $CFG, $USER;
require_once($CFG->dirroot.'/mod/forum/lib.php');
if (isguest()) {
return $this->content;
}
$course = get_record('course', 'id', $this->instance->pageid);
if (isteacher($this->instance->pageid)) {
$isteacheredit = isteacheredit($this->instance->pageid);
if ($isteacheredit) {
$this->content->icons[]='
';
if (isediting($this->instance->pageid)) {
$this->content->items[]=''.get_string('turneditingoff').'';
} else {
$this->content->items[]=''.get_string('turneditingon').'';
}
$this->content->items[]=''.get_string('settings').'...';
$this->content->icons[]='
';
if (iscreator() || !empty($CFG->teacherassignteachers)) {
if (!$course->teachers) {
$course->teachers = get_string('defaultcourseteachers');
}
$this->content->items[]=''.$course->teachers.'...';
$this->content->icons[]='
';
}
if (!$course->students) {
$course->students = get_string('defaultcoursestudents');
}
if (!$course->metacourse) {
$this->content->items[]=''.$course->students.'...';
$this->content->icons[]='
';
}
else {
$this->content->items[]=''.$course->students.'...';
$this->content->icons[]='
';
}
$this->content->items[]=''.get_string('backup').'...';
$this->content->icons[]='
';
$this->content->items[]=''.get_string('restore').'...';
$this->content->icons[]='
';
$this->content->items[]=''.get_string('scales').'...';
$this->content->icons[]='
';
}
$this->content->items[]=''.get_string('grades').'...';
$this->content->icons[]='
';
$this->content->items[]=''.get_string('logs').'...';
$this->content->icons[]='
';
if ($isteacheredit) {
$this->content->items[]=''.get_string('files').'...';
$this->content->icons[]='
';
}
$this->content->items[]=''.get_string('help').'...';
$this->content->icons[]='
';
if ($teacherforum = forum_get_course_forum($this->instance->pageid, 'teacher')) {
$this->content->items[]=''.get_string('nameteacher', 'forum').'';
$this->content->icons[]='
';
}
} else if (!isguest()) { // Students menu
if ($course->showgrades) {
$this->content->items[]=''.get_string('grades').'...';
$this->content->icons[]='
';
}
if ($course->showreports) {
$this->content->items[]=''.get_string('activityreport').'...';
$this->content->icons[]='
';
}
if (is_internal_auth()) {
$this->content->items[]=''.get_string('changepassword').'...';
$this->content->icons[]='
';
} else if ($CFG->changepassword) {
$this->content->items[]=''.get_string('changepassword').'...';
$this->content->icons[]='
';
}
if ($CFG->allowunenroll) {
$this->content->items[]=''.get_string('unenrolme', '', $course->shortname).'...';
$this->content->icons[]='
';
}
}
}
}
?>