From b4d7002e66802c309ae251cbbfb742005a4adb89 Mon Sep 17 00:00:00 2001 From: martin Date: Sun, 8 Sep 2002 03:24:38 +0000 Subject: [PATCH] Changes to allow much better control over what "teachers" are called in a course. Firstly, the course settings page now allows the teachers to specify the word they want to use in place of "teachers" and "students" as well as "teacher" and "student". Secondly, a new teacher admin tool allows any teacher to modify the order and displayed role of teachers in that course. This affects the display on the course listings, the participants page and so on. --- course/edit.html | 12 ++++++++++++ course/edit.php | 2 ++ course/lib.php | 32 +++++++++++++++++++++----------- course/social.php | 2 +- course/topics.php | 2 +- course/weeks.php | 2 +- lang/en/moodle.php | 11 +++++++++-- lib/db/mysql.sql | 5 ++++- lib/moodlelib.php | 2 +- user/index.php | 4 ++-- version.php | 12 +++++++++++- 11 files changed, 65 insertions(+), 21 deletions(-) diff --git a/course/edit.html b/course/edit.html index f830feacb07..8c9bf9c9d09 100644 --- a/course/edit.html +++ b/course/edit.html @@ -104,12 +104,24 @@ () + +

: + + () + +

: () + +

: + + () + + "> diff --git a/course/edit.php b/course/edit.php index cea61961025..a6704dd503c 100644 --- a/course/edit.php +++ b/course/edit.php @@ -84,7 +84,9 @@ $form->fullname = get_string("defaultcoursefullname"); $form->shortname = get_string("defaultcourseshortname"); $form->teacher = get_string("defaultcourseteacher"); + $form->teachers = get_string("defaultcourseteachers"); $form->student = get_string("defaultcoursestudent"); + $form->students = get_string("defaultcoursestudents"); $form->summary = get_string("defaultcoursesummary"); $form->format = "weeks"; $form->numsections = 10; diff --git a/course/lib.php b/course/lib.php index 829e1279ee3..148e01c7a93 100644 --- a/course/lib.php +++ b/course/lib.php @@ -221,7 +221,10 @@ function print_course($course) { echo "

\n"; foreach ($teachers as $teacher) { if ($teacher->authority > 0) { - echo "$course->teacher: wwwroot/user/view.php?id=$teacher->id&course=$site->id\">$teacher->firstname $teacher->lastname
"; + if (!$teacher->role) { + $teacher->role = $course->teacher; + } + echo "$teacher->role: wwwroot/user/view.php?id=$teacher->id&course=$site->id\">$teacher->firstname $teacher->lastname
"; } } echo "

"; @@ -531,28 +534,35 @@ function print_admin_links ($siteid, $width=180) { echo "wwwroot/pix/spacer.gif\" WIDTH=\"$width\" HEIGHT=1>
"; } -function print_course_admin_links($courseid, $width=180) { +function print_course_admin_links($course, $width=180) { global $THEME, $CFG; echo "
"; $adminicon[]="wwwroot/pix/i/edit.gif\" HEIGHT=16 WIDTH=16 ALT=\"\">"; - if (isediting($courseid)) { - $admindata[]="".get_string("turneditingoff").""; + if (isediting($course->id)) { + $admindata[]="id&edit=off\">".get_string("turneditingoff").""; } else { - $admindata[]="".get_string("turneditingon").""; + $admindata[]="id&edit=on\">".get_string("turneditingon").""; } - $admindata[]="".get_string("settings")."..."; + $admindata[]="id\">".get_string("settings")."..."; $adminicon[]="wwwroot/pix/i/settings.gif\" HEIGHT=16 WIDTH=16 ALT=\"\">"; - $admindata[]="".get_string("logs")."..."; + if (!$course->teachers) { + $course->teachers = get_string("defaultcourseteachers"); + } + $admindata[]="id\">$course->teachers..."; + $adminicon[]="wwwroot/pix/i/settings.gif\" HEIGHT=16 WIDTH=16 ALT=\"\">"; + + $admindata[]="id\">".get_string("logs")."..."; $adminicon[]="wwwroot/pix/i/log.gif\" HEIGHT=16 WIDTH=16 ALT=\"\">"; - $admindata[]="wwwroot/files/index.php?id=$courseid\">".get_string("files")."..."; + $admindata[]="wwwroot/files/index.php?id=$course->id\">".get_string("files")."..."; $adminicon[]="wwwroot/files/pix/files.gif\" HEIGHT=16 WIDTH=16 ALT=\"\">"; - $admindata[]="wwwroot/doc/view.php?id=$courseid&file=teacher.html\">".get_string("help")."..."; + $admindata[]="wwwroot/doc/view.php?id=$course->id&file=teacher.html\">".get_string("help")."..."; $adminicon[]="wwwroot/mod/reading/icon.gif\" HEIGHT=16 WIDTH=16 ALT=\"\">"; - if ($teacherforum = forum_get_course_forum($courseid, "teacher")) { - $admindata[]="wwwroot/mod/forum/view.php?f=$teacherforum->id\">".get_string("teacherforum").""; + + if ($teacherforum = forum_get_course_forum($course->id, "teacher")) { + $admindata[]="wwwroot/mod/forum/view.php?f=$teacherforum->id\">".get_string("nameteacher", "forum").""; $adminicon[]="wwwroot/mod/forum/icon.gif\" HEIGHT=16 WIDTH=16 ALT=\"\">"; } diff --git a/course/social.php b/course/social.php index 3d2a5a97541..c5958048fee 100644 --- a/course/social.php +++ b/course/social.php @@ -51,7 +51,7 @@ // Admin links and controls if (isteacher($course->id)) { - print_course_admin_links($course->id); + print_course_admin_links($course); } echo ""; diff --git a/course/topics.php b/course/topics.php index d7a5628af37..39535e39ea6 100644 --- a/course/topics.php +++ b/course/topics.php @@ -79,7 +79,7 @@ // Admin links and controls if (isteacher($course->id)) { - print_course_admin_links($course->id); + print_course_admin_links($course); } // Start main column diff --git a/course/weeks.php b/course/weeks.php index d714f5113b2..d9261992813 100644 --- a/course/weeks.php +++ b/course/weeks.php @@ -66,7 +66,7 @@ // Admin links and controls if (isteacher($course->id)) { - print_course_admin_links($course->id); + print_course_admin_links($course); } // Start main column diff --git a/lang/en/moodle.php b/lang/en/moodle.php index 8c66bbb9349..6629c158a7b 100644 --- a/lang/en/moodle.php +++ b/lang/en/moodle.php @@ -63,8 +63,10 @@ $string[databaseupgrades] = "Upgrading database"; $string[defaultcoursefullname] = "Course Fullname 101"; $string[defaultcourseshortname] = "CF101"; $string[defaultcoursestudent] = "Student"; +$string[defaultcoursestudents] = "Students"; $string[defaultcoursesummary] = "Write a concise and interesting paragraph here that explains what this course is about"; -$string[defaultcourseteacher] = "Facilitator"; +$string[defaultcourseteacher] = "Teacher"; +$string[defaultcourseteachers] = "Teachers"; $string[delete] = "Delete"; $string[deletecheck] = "Delete \$a ?"; $string[deletecheckfull] = "Are you absolutely sure you want to completely delete \$a ?"; @@ -300,6 +302,7 @@ $string[numviews] = "\$a views"; $string[ok] = "OK"; $string[opentoguests] = "Guest access"; $string[optional] = "optional"; +$string[order] = "Order"; $string[outline] = "Outline"; $string[participants] = "Participants"; $string[password] = "Password"; @@ -326,6 +329,7 @@ $string[resources] = "Resources"; $string[returningtosite] = "Returning to this web site?"; $string[requireskey] = "This course requires an enrolment key"; $string[revert] = "Revert"; +$string[role] = "Role"; $string[savechanges] = "Save changes"; $string[search] = "Search"; $string[searchagain] = "Search again"; @@ -360,7 +364,6 @@ $string[success] = "Success"; $string[summary] = "Summary"; $string[summaryof] = "Summary of \$a"; $string[supplyinfo] = "Please supply some information about yourself"; -$string[teacherforum] = "Teacher forum"; $string[teacheronly] = "for the \$a only"; $string[textformat] = "Plain text format"; $string[timezone] = "Timezone"; @@ -408,8 +411,12 @@ within the course so that we can learn more about you: $string[withchosenfiles] = "With chosen files"; $string[wordforteacher] = "Your word for Teacher"; $string[wordforteachereg] = "eg Teacher, Tutor, Facilitator etc"; +$string[wordforteachers] = "Your word for Teachers"; +$string[wordforteacherseg] = "eg Teachers, Tutors, Facilitators etc"; $string[wordforstudent] = "Your word for Student"; $string[wordforstudenteg] = "eg Student, Participant etc"; +$string[wordforstudents] = "Your word for Students"; +$string[wordforstudentseg] = "eg Students, Participants etc"; $string[wrongpassword] = "Incorrect password for this username"; $string[yes] = "Yes"; $string[yourlastlogin] = "Your last login was"; diff --git a/lib/db/mysql.sql b/lib/db/mysql.sql index 20d8602a8a7..c135dc346e2 100644 --- a/lib/db/mysql.sql +++ b/lib/db/mysql.sql @@ -37,7 +37,9 @@ CREATE TABLE `course` ( `format` enum('weeks','social','topics') NOT NULL default 'weeks', `newsitems` smallint(5) unsigned NOT NULL default '1', `teacher` varchar(100) NOT NULL default 'Teacher', + `teachers` varchar(100) NOT NULL default 'Teachers', `student` varchar(100) NOT NULL default 'Student', + `students` varchar(100) NOT NULL default 'Students', `guest` tinyint(2) unsigned NOT NULL default '0', `startdate` int(10) unsigned NOT NULL default '0', `numsections` smallint(5) unsigned NOT NULL default '1', @@ -214,7 +216,8 @@ CREATE TABLE `user_teachers` ( `id` int(10) unsigned NOT NULL auto_increment, `user` int(10) unsigned NOT NULL default '0', `course` int(10) unsigned NOT NULL default '0', - `authority` tinyint(3) NOT NULL default '3', + `authority` int(10) NOT NULL default '3', + `role` varchar(40) NOT NULL default '', PRIMARY KEY (`id`), UNIQUE KEY `id` (`id`) ) TYPE=MyISAM COMMENT='One record per teacher per course'; diff --git a/lib/moodlelib.php b/lib/moodlelib.php index 5703f82f775..4abba59cdb4 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -1164,7 +1164,7 @@ function get_course_students($courseid, $sort="u.lastaccess DESC") { } function get_course_teachers($courseid, $sort="t.authority ASC") { - return get_records_sql("SELECT u.*,t.authority FROM user u, user_teachers t + return get_records_sql("SELECT u.*,t.authority,t.role FROM user u, user_teachers t WHERE t.course = '$courseid' AND t.user = u.id ORDER BY $sort"); } diff --git a/user/index.php b/user/index.php index 632d0194be2..9e20894c07c 100644 --- a/user/index.php +++ b/user/index.php @@ -34,7 +34,7 @@ $string->fullprofile = get_string("fullprofile"); if ( $teachers = get_course_teachers($course->id)) { - echo "

".$course->teacher."s

"; + echo "

$course->teachers

"; foreach ($teachers as $teacher) { if ($teacher->authority > 0) { // Don't print teachers with no authority print_user($teacher, $course, $string); @@ -43,7 +43,7 @@ } if ($students = get_course_students($course->id)) { - echo "

".$course->student."s

"; + echo "

$course->students

"; foreach ($students as $student) { print_user($student, $course, $string); } diff --git a/version.php b/version.php index e6c70e9fdb1..ecde90fb671 100644 --- a/version.php +++ b/version.php @@ -18,7 +18,7 @@ // If there's something it cannot do itself, it // will tell you what you need to do. -$version = 2002090501; // The current version is a date (YYYYMMDDXX) where +$version = 2002090800; // The current version is a date (YYYYMMDDXX) where // XX is a number that increments during the day $release = "1.0.4 beta"; // For humans only, not used for the upgrade process @@ -62,6 +62,16 @@ function upgrade_moodle($oldversion=0) { execute_sql(" ALTER TABLE `course_sections` CHANGE `summary` `summary` TEXT NOT NULL "); } + if ($oldversion < 2002090701) { + execute_sql(" ALTER TABLE `user_teachers` CHANGE `authority` `authority` TINYINT( 10 ) DEFAULT '3' NOT NULL "); + execute_sql(" ALTER TABLE `user_teachers` ADD `role` VARCHAR(40) NOT NULL AFTER `authority` "); + } + + if ($oldversion < 2002090800) { + execute_sql(" ALTER TABLE `course` ADD `teachers` VARCHAR( 100 ) DEFAULT 'Teachers' NOT NULL AFTER `teacher` "); + execute_sql(" ALTER TABLE `course` ADD `students` VARCHAR( 100 ) DEFAULT 'Students' NOT NULL AFTER `student` "); + } + return true; }