]> git.mjollnir.org Git - moodle.git/commitdiff
Changes to allow much better control over what "teachers" are called
authormartin <martin>
Sun, 8 Sep 2002 03:24:38 +0000 (03:24 +0000)
committermartin <martin>
Sun, 8 Sep 2002 03:24:38 +0000 (03:24 +0000)
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
course/edit.php
course/lib.php
course/social.php
course/topics.php
course/weeks.php
lang/en/moodle.php
lib/db/mysql.sql
lib/moodlelib.php
user/index.php
version.php

index f830feacb07fa7c9981c34fd7c5cff1271729441..8c9bf9c9d095318e4a551ca7b38081433337cac5 100644 (file)
        (<? print_string("wordforteachereg") ?>) <? formerr($err["teacher"]) ?>
        </td>
 </tr>
+<tr valign=top>
+       <td><P><? print_string("wordforteachers") ?>:</td>
+       <td><input type="text" name="teachers" size=25 value="<? p($form->teachers) ?>">
+       (<? print_string("wordforteacherseg") ?>) <? formerr($err["teachers"]) ?>
+       </td>
+</tr>
 <tr valign=top>
        <td><P><? print_string("wordforstudent") ?>:</td>
        <td><input type="text" name="student" size=25 value="<? p($form->student) ?>">
        (<? print_string("wordforstudenteg") ?>) <? formerr($err["student"]) ?>
        </td>
 </tr>
+<tr valign=top>
+       <td><P><? print_string("wordforstudents") ?>:</td>
+       <td><input type="text" name="students" size=25 value="<? p($form->students) ?>">
+       (<? print_string("wordforstudentseg") ?>) <? formerr($err["students"]) ?>
+       </td>
+</tr>
 <tr>
        <td></td>
        <td><input type="submit" value="<? print_string("savechanges") ?>"></td>
index cea61961025d2d2826fc1bf438870523fabdf4b9..a6704dd503cbf206a7135fb938a1b85c76336e9b 100644 (file)
@@ -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;
index 829e1279ee3c14e035cbc6bd89e005627001c4ab..148e01c7a93a05217a75b3af71be06dbc74ccc55 100644 (file)
@@ -221,7 +221,10 @@ function print_course($course) {
         echo "<P><FONT SIZE=1>\n";
         foreach ($teachers as $teacher) {
             if ($teacher->authority > 0) {
-                echo "$course->teacher: <A HREF=\"$CFG->wwwroot/user/view.php?id=$teacher->id&course=$site->id\">$teacher->firstname $teacher->lastname</A><BR>";
+                if (!$teacher->role) {
+                    $teacher->role = $course->teacher;
+                }
+                echo "$teacher->role: <A HREF=\"$CFG->wwwroot/user/view.php?id=$teacher->id&course=$site->id\">$teacher->firstname $teacher->lastname</A><BR>";
             }
         }
         echo "</FONT></P>";
@@ -531,28 +534,35 @@ function print_admin_links ($siteid, $width=180) {
     echo "<IMG SRC=\"$CFG->wwwroot/pix/spacer.gif\" WIDTH=\"$width\" HEIGHT=1><BR>";
 }
 
-function print_course_admin_links($courseid, $width=180) {
+function print_course_admin_links($course, $width=180) {
     global $THEME, $CFG;
 
     echo "<BR>";
     $adminicon[]="<IMG SRC=\"$CFG->wwwroot/pix/i/edit.gif\" HEIGHT=16 WIDTH=16 ALT=\"\">";
-    if (isediting($courseid)) {
-        $admindata[]="<A HREF=\"view.php?id=$courseid&edit=off\">".get_string("turneditingoff")."</A>";
+    if (isediting($course->id)) {
+        $admindata[]="<A HREF=\"view.php?id=$course->id&edit=off\">".get_string("turneditingoff")."</A>";
     } else {
-        $admindata[]="<A HREF=\"view.php?id=$courseid&edit=on\">".get_string("turneditingon")."</A>";
+        $admindata[]="<A HREF=\"view.php?id=$course->id&edit=on\">".get_string("turneditingon")."</A>";
+    }
+    $admindata[]="<A HREF=\"edit.php?id=$course->id\">".get_string("settings")."...</A>";
+    $adminicon[]="<IMG SRC=\"$CFG->wwwroot/pix/i/settings.gif\" HEIGHT=16 WIDTH=16 ALT=\"\">";
+    if (!$course->teachers) {
+        $course->teachers = get_string("defaultcourseteachers");
     }
-    $admindata[]="<A HREF=\"edit.php?id=$courseid\">".get_string("settings")."...</A>";
+    $admindata[]="<A HREF=\"teachers.php?id=$course->id\">$course->teachers...</A>";
     $adminicon[]="<IMG SRC=\"$CFG->wwwroot/pix/i/settings.gif\" HEIGHT=16 WIDTH=16 ALT=\"\">";
-    $admindata[]="<A HREF=\"log.php?id=$courseid\">".get_string("logs")."...</A>";
+
+    $admindata[]="<A HREF=\"log.php?id=$course->id\">".get_string("logs")."...</A>";
     $adminicon[]="<IMG SRC=\"$CFG->wwwroot/pix/i/log.gif\" HEIGHT=16 WIDTH=16 ALT=\"\">";
-    $admindata[]="<A HREF=\"$CFG->wwwroot/files/index.php?id=$courseid\">".get_string("files")."...</A>";
+    $admindata[]="<A HREF=\"$CFG->wwwroot/files/index.php?id=$course->id\">".get_string("files")."...</A>";
     $adminicon[]="<IMG SRC=\"$CFG->wwwroot/files/pix/files.gif\" HEIGHT=16 WIDTH=16 ALT=\"\">";
 
-    $admindata[]="<A HREF=\"$CFG->wwwroot/doc/view.php?id=$courseid&file=teacher.html\">".get_string("help")."...</A>";
+    $admindata[]="<A HREF=\"$CFG->wwwroot/doc/view.php?id=$course->id&file=teacher.html\">".get_string("help")."...</A>";
     $adminicon[]="<IMG SRC=\"$CFG->wwwroot/mod/reading/icon.gif\" HEIGHT=16 WIDTH=16 ALT=\"\">";
 
-    if ($teacherforum = forum_get_course_forum($courseid, "teacher")) {
-        $admindata[]="<A HREF=\"$CFG->wwwroot/mod/forum/view.php?f=$teacherforum->id\">".get_string("teacherforum")."</A>";
+
+    if ($teacherforum = forum_get_course_forum($course->id, "teacher")) {
+        $admindata[]="<A HREF=\"$CFG->wwwroot/mod/forum/view.php?f=$teacherforum->id\">".get_string("nameteacher", "forum")."</A>";
         $adminicon[]="<IMG SRC=\"$CFG->wwwroot/mod/forum/icon.gif\" HEIGHT=16 WIDTH=16 ALT=\"\">";
     }
 
index 3d2a5a97541edaee6e7855a06caea443ce39fe0c..c5958048fee3d91e8f9c41212fa21a7abb0b7796 100644 (file)
@@ -51,7 +51,7 @@
 
       // Admin links and controls
       if (isteacher($course->id)) {
-          print_course_admin_links($course->id);
+          print_course_admin_links($course);
       }
 
       echo "</TD>";
index d7a5628af37d6f2a24e2faecea44d3e0ed236aba..39535e39ea6e173219426c2ea793681d05ac86c4 100644 (file)
@@ -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
index d714f5113b2bf50cc22be2f11043cedbc9c2b874..d9261992813075c068cffe6a4cef1d0e83bc1dac 100644 (file)
@@ -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
index 8c66bbb9349c722230b2029053303e8fefd17bd8..6629c158a7b152bea7627e521f879a64d46ef711 100644 (file)
@@ -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";
index 20d8602a8a7e4e9974b5f567125f40d04807b0e4..c135dc346e29ea56ad6435d9d314b043faad2014 100644 (file)
@@ -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';
index 5703f82f7757fdc8877242cb1036f45125a1e659..4abba59cdb4fa40839c7423015a5b6a7d7fd38d1 100644 (file)
@@ -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");
 }
index 632d0194be25ce2496ac841b913a3914b3a59c8d..9e20894c07c2809714dce30ceb22edd1ff156b11 100644 (file)
@@ -34,7 +34,7 @@
     $string->fullprofile = get_string("fullprofile");
 
     if ( $teachers = get_course_teachers($course->id)) {
-        echo "<H2 align=center>".$course->teacher."s</H2>";
+        echo "<H2 align=center>$course->teachers</H2>";
         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 "<H2 align=center>".$course->student."s</H2>";
+        echo "<H2 align=center>$course->students</H2>";
         foreach ($students as $student) {
             print_user($student, $course, $string);
         }
index e6c70e9fdb1f726979b25ce0440f650cf961b5ec..ecde90fb6712cd64d999079833afeb87d8698d2a 100644 (file)
@@ -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;
 }