title = get_string('administration');
$this->content_type = BLOCK_TYPE_LIST;
$this->course = $course;
$this->version = 2004041000;
}
function get_content() {
global $USER, $CFG, $THEME;
require_once($CFG->dirroot.'/mod/forum/lib.php');
if($this->content !== NULL) {
return $this->content;
}
$this->content = New object;
$this->content->items = array();
$this->content->icons = array();
$this->content->footer = '';
if (isguest()) {
return $this->content;
}
if (isteacher($this->course->id)) {
$isteacheredit = isteacheredit($this->course->id);
if ($isteacheredit) {
$this->content->icons[]='
';
if (isediting($this->course->id)) {
$this->content->items[]=''.get_string('turneditingoff').'';
} else {
$this->content->items[]=''.get_string('turneditingon').'';
}
$this->content->items[]=''.get_string('settings').'...';
$this->content->icons[]='
';
if (iscreator() or !empty($CFG->teacherassignteachers)) {
if (!$this->course->teachers) {
$this->course->teachers = get_string('defaultcourseteachers');
}
$this->content->items[]=''.$this->course->teachers.'...';
$this->content->icons[]='
';
}
if (!$this->course->students) {
$this->course->students = get_string('defaultcoursestudents');
}
$this->content->items[]=''.$this->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->course->id, 'teacher')) {
$this->content->items[]=''.get_string('nameteacher', 'forum').'';
$this->content->icons[]='
';
}
} else if (!isguest()) { // Students menu
if ($this->course->showgrades) {
$this->content->items[]=''.get_string('grades').'...';
$this->content->icons[]='
';
}
if ($this->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', '', $this->course->shortname).'...';
$this->content->icons[]='
';
}
}
return $this->content;
}
}
/*
function block_admin(&$course) {
global $USER, $CFG, $THEME;
$block = New object;
$block->title = get_string('administration');
$block->type = BLOCK_TYPE_LIST;
if (isguest()) {
return $block;
}
if (isteacher($course->id)) {
$isteacheredit = isteacheredit($course->id);
if ($isteacheredit) {
$block->icons[]="
pixpath/i/edit.gif\" height=16 width=16 alt=\"\">";
if (isediting($course->id)) {
$block->items[]="id&edit=off\">".get_string("turneditingoff")."";
} else {
$block->items[]="id&edit=on\">".get_string("turneditingon")."";
}
$block->items[]="id\">".get_string("settings")."...";
$block->icons[]="
pixpath/i/settings.gif\" height=16 width=16 alt=\"\">";
if (iscreator() or !empty($CFG->teacherassignteachers)) {
if (!$course->teachers) {
$course->teachers = get_string("defaultcourseteachers");
}
$block->items[]="id\">$course->teachers...";
$block->icons[]="
pixpath/i/users.gif\" height=16 width=16 alt=\"\">";
}
if (!$course->students) {
$course->students = get_string("defaultcoursestudents");
}
$block->items[]="id\">$course->students...";
$block->icons[]="
pixpath/i/users.gif\" height=16 width=16 alt=\"\">";
$block->items[]="wwwroot/backup/backup.php?id=$course->id\">".get_string("backup")."...";
$block->icons[]="
pixpath/i/backup.gif\" height=16 width=16 alt=\"\">";
$block->items[]="wwwroot/files/index.php?id=$course->id&wdir=/backupdata\">".get_string("restore")."...";
$block->icons[]="
pixpath/i/restore.gif\" height=16 width=16 alt=\"\">";
$block->items[]="id\">".get_string("scales")."...";
$block->icons[]="
pixpath/i/scales.gif\" height=16 width=16 alt=\"\">";
}
$block->items[]="id\">".get_string("grades")."...";
$block->icons[]="
pixpath/i/grades.gif\" height=16 width=16 alt=\"\">";
$block->items[]="id\">".get_string("logs")."...";
$block->icons[]="
pixpath/i/log.gif\" height=16 width=16 alt=\"\">";
if ($isteacheredit) {
$block->items[]="wwwroot/files/index.php?id=$course->id\">".get_string("files")."...";
$block->icons[]="
pixpath/i/files.gif\" height=16 width=16 alt=\"\">";
}
$block->items[]="wwwroot/doc/view.php?id=$course->id&file=teacher.html\">".get_string("help")."...";
$block->icons[]="
modpixpath/resource/icon.gif\" height=16 width=16 alt=\"\">";
if ($teacherforum = forum_get_course_forum($course->id, "teacher")) {
$block->items[]="wwwroot/mod/forum/view.php?f=$teacherforum->id\">$teacherforum->name";
$block->icons[]="
modpixpath/forum/icon.gif\" height=16 width=16 alt=\"\">";
}
} else if (!isguest()) { // Students menu
if ($course->showgrades) {
$block->items[]="id\">".get_string("grades")."...";
$block->icons[]="
pixpath/i/grades.gif\" height=16 width=16 alt=\"\">";
}
if ($course->showreports) {
$block->items[]="id&user=$USER->id\">".get_string("activityreport")."...";
$block->icons[]="
pixpath/i/report.gif\" height=16 width=16 alt=\"\">";
}
if (is_internal_auth()) {
$block->items[]="wwwroot/login/change_password.php?id=$course->id\">".
get_string("changepassword")."...";
$block->icons[]="
pixpath/i/user.gif\" height=16 width=16 alt=\"\">";
} else if ($CFG->changepassword) {
$block->items[]="changepassword\">".get_string("changepassword")."...";
$block->icons[]="
pixpath/i/user.gif\" height=16 width=16 alt=\"\">";
}
if ($CFG->allowunenroll) {
$block->items[]="id\">".get_string("unenrolme", "", $course->shortname)."...";
$block->icons[]="
pixpath/i/user.gif\" height=16 width=16 alt=\"\">";
}
}
return $block;
}
*/
?>