diff --git a/admin/settings/appearance.php b/admin/settings/appearance.php
index 789241c9361..ae14f00ed75 100644
--- a/admin/settings/appearance.php
+++ b/admin/settings/appearance.php
@@ -123,6 +123,10 @@ $temp = new admin_settingpage('gradebook', get_string('gradebook', 'admin'));
$temp->add(new admin_setting_special_gradebookroles());
$ADMIN->add('appearance', $temp);
+// new CFG variable for coursemanager (what roles to display)
+$temp = new admin_settingpage('coursemanager', get_string('coursemanager', 'admin'));
+$temp->add(new admin_setting_special_coursemanager());
+$ADMIN->add('appearance', $temp);
$ADMIN->add('appearance', new admin_externalpage('stickyblocks', get_string('stickyblocks', 'admin'), "$CFG->wwwroot/$CFG->admin/stickyblocks.php"));
diff --git a/course/lib.php b/course/lib.php
index 9a1541d6283..3793b1c14cf 100644
--- a/course/lib.php
+++ b/course/lib.php
@@ -1550,21 +1550,21 @@ function print_course($course, $width="100%") {
$linkcss.' href="'.$CFG->wwwroot.'/course/view.php?id='.$course->id.'">'.
$course->fullname.' ';
- if ($teachers = get_users_by_capability($context, 'moodle/course:update',
- 'u.*, ul.timeaccess as lastaccess, ra.hidden',
- 'r.sortorder ASC', '','','','', false)) {
- $canseehidden = has_capability('moodle/role:viewhiddenassigns', $context);
- $namesarray = array();
- foreach ($teachers as $teacher) {
- if (!$teacher->hidden || $canseehidden) {
- $roles = get_user_roles($context, $teacher->id, true, 'r.sortorder ASC');
- $role = array_shift($roles); // First one
- $fullname = fullname($teacher, has_capability('moodle/site:viewfullnames', $context));
- $namesarray[] = format_string($role->name).': '.$fullname.'';
- }
+ /// first find all roles that are supposed to be displayed
+ if ($managerroles = get_config('', 'coursemanager')) {
+ $coursemanagerroles = split(',', $managerroles->value);
+ foreach ($coursemanagerroles as $roleid) {
+ $role = get_record('role','id',$roleid);
+ if ($users = get_role_users($roleid, $context, true, '', 'u.lastname ASC', true)) {
+ foreach ($users as $teacher) {
+ $fullname = fullname($teacher, has_capability('moodle/site:viewfullnames', $context));
+ $namesarray[] = format_string($role->name).': '.$fullname.'';
+ }
+ }
}
- if ($namesarray) {
+
+ if (!empty($namesarray)) {
echo "
\n
";
echo implode('
', $namesarray);
echo "
";
diff --git a/lang/en_utf8/admin.php b/lang/en_utf8/admin.php
index 0d65680c316..ff189d981e1 100644
--- a/lang/en_utf8/admin.php
+++ b/lang/en_utf8/admin.php
@@ -58,6 +58,7 @@ $string['configclamactlikevirus'] = 'Treat files like viruses';
$string['configclamdonothing'] = 'Treat files as OK';
$string['configclamfailureonupload'] = 'If you have configured clam to scan uploaded files, but it is configured incorrectly or fails to run for some unknown reason, how should it behave? If you choose \'Treat files like viruses\', they\'ll be moved into the quarantine area, or deleted. If you choose \'Treat files as OK\', the files will be moved to the desination directory like normal. Either way, admins will be alerted that clam has failed. If you choose \'Treat files like viruses\' and for some reason clam fails to run (usually because you have entered an invalid pathtoclam), ALL files that are uploaded will be moved to the given quarantine area, or deleted. Be careful with this setting.';
$string['configcountry'] = 'If you set a country here, then this country will be selected by default on new user accounts. To force users to choose a country, just leave this unset.';
+$string['configcoursemanager'] = 'This setting allows you to control who appears on the course description. Users need to have at least one of these roles in a course to be shown on the course description for that course.';$string['coursemanager'] = 'Course managers';
$string['configcoursesperpage'] = 'Enter the number of courses to be display per page in a course listing.';
$string['configdbsessions'] = 'If enabled, this setting will use the database to store information about current sessions. This is especially useful for large/busy sites or sites built on cluster of servers. For most sites this should probably be left disabled so that the server disk is used instead. Note that changing this setting now will log out all current users (including you). If you are using MySQL please make sure that \'max_allowed_packet\' in my.cnf (or my.ini) is at least 4M.';
$string['configdebug'] = 'If you turn this on, then PHP\'s error_reporting will be increased so that more warnings are printed. This is only useful for developers.';
@@ -176,6 +177,7 @@ $string['configzip'] = 'Indicate the location of your zip program (Unix only, op
$string['confirmation'] = 'Confirmation';
$string['confirminstall'] = 'You are about to install language pack ($a), are you sure?';
$string['country'] = 'Default country';
+$string['coursemanager'] = 'Course managers';
$string['coursemgmt'] = 'Add/edit courses';
$string['courseoverview'] = 'Course overview';
$string['courserequests'] = 'Course Requests';
diff --git a/lib/adminlib.php b/lib/adminlib.php
index bec93756b04..4598c891cb0 100644
--- a/lib/adminlib.php
+++ b/lib/adminlib.php
@@ -2361,6 +2361,79 @@ class admin_setting_special_gradebookroles extends admin_setting {
}
+/*
+ * this is used in config->appearance->coursemanager
+ * (which roles to show on course decription page)
+ */
+class admin_setting_special_coursemanager extends admin_setting {
+
+ function admin_setting_special_coursemanager() {
+ $name = 'coursemanager';
+ $visiblename = get_string('coursemanager', 'admin');
+ $description = get_string('configcoursemanager', 'admin');
+ $default = array(3=>'1'); // The teahcer role in a default install
+ parent::admin_setting($name, $visiblename, $description, $default);
+ }
+
+ function get_setting() {
+
+ global $CFG;
+ if (!empty($CFG->{$this->name})) {
+ $result = explode(',', $CFG->{$this->name});
+ foreach ($result as $roleid) {
+ $array[$roleid] = 1;
+ }
+ return $array;
+ } else {
+ return null;
+ }
+ }
+
+ function write_setting($data) {
+
+ if (!empty($data)) {
+ $str = '';
+ foreach ($data as $key => $value) {
+ if ($value) {
+ $str .= $key.',';
+ }
+ }
+ return set_config($this->name, rtrim($str, ","))?'':get_string('errorsetting', 'admin') . $this->visiblename . ' ';
+ } else {
+ return set_config($this->name, '')?'':get_string('errorsetting', 'admin') . $this->visiblename . ' ';
+ }
+ }
+
+ function output_html() {
+
+ if ($this->get_setting() === NULL) {
+ $currentsetting = $this->defaultsetting;
+ } else {
+ $currentsetting = $this->get_setting();
+ }
+ // from to process which roles to display
+ if ($roles = get_records('role')) {
+ $return = '
';
+ }
+ return format_admin_setting($this->name, $this->visiblename, $return, $this->description, false);
+ }
+}
+
class admin_setting_special_perfdebug extends admin_setting_configcheckbox {
function admin_setting_special_perfdebug() {
diff --git a/version.php b/version.php
index 6c5664f9c08..44c14493bdb 100644
--- a/version.php
+++ b/version.php
@@ -6,7 +6,7 @@
// This is compared against the values stored in the database to determine
// whether upgrades should be performed (see lib/db/*.php)
- $version = 2006101010; // YYYYMMDD = date of the 1.7 branch (don't change)
+ $version = 2006101011; // YYYYMMDD = date of the 1.7 branch (don't change)
// X = release number 1.7.[0,1,2,3...]
// Y = micro-increments between releases