For something that has been deprecated for over two years, they were still used in a lot of places!
$newsite->numsections = 0;
$newsite->category = 0;
$newsite->format = 'site'; // Only for this course
- $newsite->teacher = get_string("defaultcourseteacher");
- $newsite->teachers = get_string("defaultcourseteachers");
- $newsite->student = get_string("defaultcoursestudent");
- $newsite->students = get_string("defaultcoursestudents");
$newsite->timemodified = time();
if ($newid = $DB->insert_record('course', $newsite)) {
echo "<td align=\"right\" valign=\"top\" colspan=\"2\"><b>";
echo get_string("backuproleassignments");
echo "</b></td><td colspan=\"2\">";
- $roles = $DB->get_records('role', null, 'sortorder');
+ $roles = get_all_roles();
foreach ($roles as $role) {
print_checkbox('backupassignments_' . $role->shortname, 1, true, strip_tags(format_string($role->name, true)));
echo "<br />";
$preferences->keep_name = $keep_name;
//Roleasignments
- $roles = $DB->get_records('role', null, 'sortorder');
+ $roles = get_all_roles();
foreach ($roles as $role) {
$preferences->backuproleassignments[$role->id] = $role;
}
fwrite ($bf,full_tag("FORMAT",3,false,$course->format));
fwrite ($bf,full_tag("SHOWGRADES",3,false,$course->showgrades));
fwrite ($bf,full_tag("NEWSITEMS",3,false,$course->newsitems));
- fwrite ($bf,full_tag("TEACHER",3,false,$course->teacher));
- fwrite ($bf,full_tag("TEACHERS",3,false,$course->teachers));
- fwrite ($bf,full_tag("STUDENT",3,false,$course->student));
- fwrite ($bf,full_tag("STUDENTS",3,false,$course->students));
fwrite ($bf,full_tag("GUEST",3,false,$course->guest));
fwrite ($bf,full_tag("STARTDATE",3,false,$course->startdate));
fwrite ($bf,full_tag("NUMSECTIONS",3,false,$course->numsections));
$preferences->backup_name = required_param('backup_name',PARAM_FILE);
$preferences->backup_unique_code = required_param('backup_unique_code');
- $roles = $DB->get_records('role', null, 'sortorder');
+ $roles = get_all_roles();
$preferences->backuproleassignments = array();
foreach ($roles as $role) {
if (optional_param('backupassignments_' . $role->shortname, 0, PARAM_INT)) {
// fix for MDL-9068, front page course is just a normal course
$siterolesarray = get_assignable_roles(get_context_instance(CONTEXT_COURSE, $course->id), ROLENAME_ORIGINALANDSHORT);
-$allroles = $DB->get_records('role');
+$allroles = get_all_roles();
echo ('<table width="100%" class="restore-form-instances">');
echo ('<tr><td align="right" style="width:50%"><b>'.get_string('sourcerole').'</b></td><td align="left" style="width:50%"><b>'.get_string('targetrole').'</b></td></tr>');
$course->format = $course_header->course_format;
$course->showgrades = $course_header->course_showgrades;
$course->newsitems = $course_header->course_newsitems;
- $course->teacher = $course_header->course_teacher;
- $course->teachers = $course_header->course_teachers;
- $course->student = $course_header->course_student;
- $course->students = $course_header->course_students;
$course->guest = $course_header->course_guest;
$course->startdate = $course_header->course_startdate;
$course->startdate += $restore->course_startdateoffset;
case "NEWSITEMS":
$this->info->course_newsitems = $this->getContents();
break;
- case "TEACHER":
- $this->info->course_teacher = $this->getContents();
- break;
- case "TEACHERS":
- $this->info->course_teachers = $this->getContents();
- break;
- case "STUDENT":
- $this->info->course_student = $this->getContents();
- break;
- case "STUDENTS":
- $this->info->course_students = $this->getContents();
- break;
case "GUEST":
$this->info->course_guest = $this->getContents();
break;
foreach($best as $userid => $gradeid) {
switch($nameformat) {
case B_QUIZRESULTS_NAME_FORMAT_ID:
- $thisname = $course->student.' '.intval($users[$userid]->idnumber);
+ $thisname = get_string('user').' '.intval($users[$userid]->idnumber);
break;
case B_QUIZRESULTS_NAME_FORMAT_ANON:
- $thisname = $course->student;
+ $thisname = get_string('user');
break;
default:
case B_QUIZRESULTS_NAME_FORMAT_FULL:
foreach($worst as $userid => $gradeid) {
switch($nameformat) {
case B_QUIZRESULTS_NAME_FORMAT_ID:
- $thisname = $course->student.' '.intval($users[$userid]->idnumber);
+ $thisname = get_string('user').' '.intval($users[$userid]->idnumber);
break;
case B_QUIZRESULTS_NAME_FORMAT_ANON:
- $thisname = $course->student;
+ $thisname = get_string('user');
break;
default:
case B_QUIZRESULTS_NAME_FORMAT_FULL:
unset($course); // To avoid unwanted language effects later
$courses = get_courses_page($category->id, 'c.sortorder ASC',
- 'c.id,c.sortorder,c.shortname,c.fullname,c.summary,c.visible,c.teacher,c.guest,c.password',
+ 'c.id,c.sortorder,c.shortname,c.fullname,c.summary,c.visible,c.guest,c.password',
$totalcount, $page*$perpage, $perpage);
$numcourses = count($courses);
if ($roles = get_all_roles()) {
if ($coursecontext) {
- $roles = role_fix_names($roles, $coursecontext,ROLENAME_ALIAS_RAW);
+ $roles = role_fix_names($roles, $coursecontext, ROLENAME_ALIAS_RAW);
}
$assignableroles = get_roles_for_contextlevels(CONTEXT_COURSE);
foreach ($roles as $role) {
$editing = $PAGE->user_is_editing();
if ($editing) {
- $strstudents = moodle_strtolower($course->students);
- $strtopichide = get_string('topichide', '', $strstudents);
- $strtopicshow = get_string('topicshow', '', $strstudents);
- $strmarkthistopic = get_string('markthistopic');
- $strmarkedthistopic = get_string('markedthistopic');
+ $strtopichide = get_string('hidetopicfromothers');
+ $strtopicshow = get_string('showtopicfromothers');
+ $strmarkthistopic = get_string('markthistopic');
+ $strmarkedthistopic = get_string('markedthistopic');
$strmoveup = get_string('moveup');
$strmovedown = get_string('movedown');
}
$editing = $PAGE->user_is_editing();
if ($editing) {
- $strstudents = moodle_strtolower($course->students);
- $strweekhide = get_string('weekhide', '', $strstudents);
- $strweekshow = get_string('weekshow', '', $strstudents);
+ $strweekhide = get_string('hideweekfromothers');
+ $strweekshow = get_string('showweekfromothers');
$strmoveup = get_string('moveup');
$strmovedown = get_string('movedown');
}
unset($course->id);
$teacherid = $course->requester;
unset($course->requester);
- $course->teacher = get_string("defaultcourseteacher");
- $course->teachers = get_string("defaultcourseteachers");
- $course->student = get_string("defaultcoursestudent");
- $course->students = get_string("defaultcoursestudents");
if (!empty($CFG->restrictmodulesfor) && $CFG->restrictmodulesfor != 'none' && !empty($CFG->restrictbydefault)) {
$course->restrictmodules = 1;
}
$user = $DB->get_record('user', array('id'=>$teacherid));
$a->name = $course->fullname;
$a->url = $CFG->wwwroot.'/course/view.php?id='.$courseid;
- $a->teacher = $course->teacher;
-
+
$eventdata = new object();
$eventdata->modulename = 'moodle';
$eventdata->userfrom = $USER;
// we execute the below code for every role type. Otherwise we just
// execute it once with null (hence the dummy array).
$roles = !empty($CFG->enrol_db_remoterolefield) && !empty($CFG->enrol_db_localrolefield)
- ? $DB->get_records('role')
+ ? get_all_roles()
: array(null);
//error_log('[ENROL_DB] found ' . count($roles) . ' roles:');
'showgrades' => 1,
'groupmode' => 0,
'groupmodeforce' => 0,
- 'student' => $site->student,
- 'students' => $site->students,
- 'teacher' => $site->teacher,
- 'teachers' => $site->teachers,
);
}
// overlay template
// role and update it. Otherwise, just got through once (with no role
// specified).
$roles = !empty($CFG->enrol_db_remoterolefield) && !empty($CFG->enrol_db_localrolefield)
- ? $DB->get_records('role')
+ ? get_all_roles()
: array(null);
foreach ($roles as $role) {
$course->visible = 0;
// Insert default names for teachers/students, from the current language
$site = get_site();
- if (current_language() == $CFG->lang) {
- $course->teacher = $site->teacher;
- $course->teachers = $site->teachers;
- $course->student = $site->student;
- $course->students = $site->students;
- } else {
- $course->teacher = get_string("defaultcourseteacher");
- $course->teachers = get_string("defaultcourseteachers");
- $course->student = get_string("defaultcoursestudent");
- $course->students = get_string("defaultcoursestudents");
- }
// Handle course categorisation (taken from the group.org.orgunit field if present)
if(strlen($group->category)>0){
}
// Roles
-$roles = $DB->get_records('role');
+$roles = get_all_roles();
foreach($roles as $role) {
if (!isset($frm->{'enrol_ldap_contexts_role'.$role->id})) {
$frm->{'enrol_ldap_contexts_role'.$role->id} = '';
// we are connected OK, continue...
// Get all the possible roles
- $roles = $DB->get_records('role');
+ $roles = get_all_roles();
// Make sure the config settings have been upgraded.
$this->check_legacy_config();
}
set_config('enrol_ldap_autocreate', $config->enrol_ldap_autocreate);
- $roles = $DB->get_records('role');
+ $roles = get_all_roles();
foreach ($roles as $role) {
if (!isset($config->{'enrol_ldap_contexts_role'.$role->id})) {
$config->{'enrol_ldap_contexts_role'.$role->id} = '';
} else {
// set defaults
$course = new object();
- $course->student = get_string('defaultcoursestudent');
- $course->students = get_string('defaultcoursestudents');
- $course->teacher = get_string('defaultcourseteacher');
- $course->teachers = get_string('defaultcourseteachers');
$course->format = 'topics';
}
$enrol->check_legacy_config();
- $roles = $DB->get_records('role');
+ $roles = get_all_roles();
foreach ($roles as $role) {
$enrol->sync_enrolments($role->shortname, true);
}
if (!empty($teacher)) {
$teachername = "<a href=\"../user/view.php?id=$teacher->id&course=".SITEID."\">".fullname($teacher)."</a>.";
} else {
- $teachername = strtolower( get_string('defaultcourseteacher') ); //get_string('yourteacher', '', $course->teacher);
+ $teachername = strtolower( get_string('defaultcourseteacher') );
}
// guest user has a slightly different message
} else { /// Somehow they aren't enrolled yet! :-(
print_header();
- notice(get_string('paymentsorry', '', $course), $destination);
+ notice(get_string('paymentsorry', '', get_string('defaultcourseteacher')), $destination);
}
?>
$string['ratingeveryone'] = 'Everyone can rate entries';
$string['ratingno'] = 'No ratings';
$string['ratingonlyteachers'] = 'Only $a can rate entries';
+$string['ratingonlywithpermissions'] = 'Only people with permission to rate entries';
$string['ratings'] = 'Ratings';
$string['ratingssaved'] = 'Ratings saved';
$string['ratingsuse'] = 'Use ratings';
$string['eolstudentoutoftimenoanswers'] = 'You did not answer any questions. You have received a 0 for this lesson.';
$string['essay'] = 'Essay';
$string['essayemailmessage'] = '<p>Essay prompt:<blockquote>$a->question</blockquote></p><p>Your response:<blockquote><em>$a->response</em></blockquote></p><p>$a->teacher\'s comments:<blockquote><em>$a->comment</em></blockquote></p><p>You have received $a->earned out of $a->outof for this essay question.</p><p>Your grade for the lesson has been changed to $a->newgrade%.</p>';
+$string['essayemailmessage2'] = '<p>Essay prompt:<blockquote>$a->question</blockquote></p><p>Your response:<blockquote><em>$a->response</em></blockquote></p><p>Grader\'s comments:<blockquote><em>$a->comment</em></blockquote></p><p>You have received $a->earned out of $a->outof for this essay question.</p><p>Your grade for the lesson has been changed to $a->newgrade%.</p>';
$string['essayemailsubject'] = 'Your grade for $a question';
$string['essays'] = 'Essays';
$string['essayscore'] = 'Essay score';
$string['lessonformating'] = 'Lesson formatting';
$string['lessonmenu'] = 'Lesson menu';
$string['lessonnotready'] = 'This lesson is not ready to be taken. Please contact your $a.';
+$string['lessonnotready2'] = 'This lesson is not ready to be taken.';
$string['lessonopen'] = 'This lesson will be open on $a.';
$string['lessonopens'] = 'Lesson opens';
$string['lessonpagelinkingbroken'] = 'First page not found. Lesson page linking must be broken. Please contact an admin.';
$string['previouspage'] = 'Previous page';
$string['progressbar'] = 'Progress Bar';
$string['progressbarteacherwarning'] = 'Progress Bar does not display for $a';
+$string['progressbarteacherwarning2'] = 'You will not see the progress bar because you can edit this lesson';
$string['deleteallattempts'] = 'Delete all lesson attempts';
$string['qtype'] = 'Page type';
$string['question'] = 'Question';
$string['report'] = 'Report';
$string['reports'] = 'Reports';
$string['response'] = 'Response';
+$string['retakesallowed'] = 'Re-takes allowed';
$string['returnto'] = 'Return to $a';
$string['returntocourse'] = 'Return to the course';
$string['review'] = 'Review';
$string['viewgrades'] = 'View grades';
$string['viewhighscores'] = 'View high scores list';
$string['viewreports'] = 'View $a->attempts completed $a->student attempts';
+$string['viewreports2'] = 'View $a completed attempts';
$string['welldone'] = 'Well done!';
$string['whatdofirst'] = 'What would you like to do first?';
$string['wronganswerjump'] = 'Wrong answer jump';
$string['country'] = 'Country';
$string['course'] = 'Course';
$string['courseapprovedemail'] = 'Your requested course, $a->name, has been approved and you have been made a $a->teacher. To access your new course, go to $a->url';
+$string['courseapprovedemail2'] = 'Your requested course, $a->name, has been approved. To access your new course, go to $a->url';
$string['courseapprovedfailed'] = 'Failed to save the course as approved!';
$string['courseapprovedsubject'] = 'Your course has been approved!';
$string['courseavailable'] = 'This course is available to students';
$string['hidepicture'] = 'Hide picture';
$string['hidesection'] = 'Hide section $a';
$string['hidesettings'] = 'Hide settings';
+$string['hidetopicfromothers'] = 'Hide topic from others';
+$string['hideweekfromothers'] = 'Hide week from others';
$string['hits'] = 'Hits';
$string['hitsoncourse'] = 'Hits on $a->coursename by $a->username';
$string['hitsoncoursetoday'] = 'Today\'s hits on $a->coursename by $a->username';
$string['showreports'] = 'Show activity reports';
$string['showsettings'] = 'Show settings';
$string['showtheselogs'] = 'Show these logs';
+$string['showtopicfromothers'] = 'Show topic from others';
+$string['showweekfromothers'] = 'Show week from others';
$string['since'] = 'Since';
$string['sincelast'] = 'since last login';
$string['site'] = 'Site';
$string['yourlastlogin'] = 'Your last login was';
$string['yourself'] = 'yourself';
$string['yourteacher'] = 'your $a';
+$string['yourwordforx'] = 'Your word for \'$a\'';
$string['zippingbackup'] = 'Zipping backup';
$string['authenticationplugins'] = 'Authentication Plugins';
$string['choose'] = 'Choose';
$string['chooseafile'] = 'Choose or upload a file';
$string['chooseparameter'] = 'Choose parameter';
+$string['chooseaparameter'] = 'Choose a parameter...';
$string['clicktoopen'] = 'To open this document, click on this link: ';
$string['configallowlocalfiles'] = 'When creating a new file resource, allow links to files on a local file system such as a CD drive or a hard drive. This may be useful in a classroom where all students have access to a common network drive or where files on a CD need to be accessed. Use of this feature may require changes to your browser\'s security settings.';
$string['configautofilerenamesettings'] = 'Automatically update references to files and directories when renamed in file manager.';
if (is_array($this->choices)) {
return true;
}
- if ($roles = $DB->get_records('role')) {
+ if ($roles = get_all_roles()) {
$this->choices = array();
foreach($roles as $role) {
$this->choices[$role->id] = format_string($role->name);
$basefields = array('id', 'category', 'sortorder',
'shortname', 'fullname', 'idnumber',
- 'teacher', 'teachers', 'student', 'students',
'guest', 'startdate', 'visible',
'newsitems', 'cost', 'enrol',
'groupmode', 'groupmodeforce');
$basefields = array('id', 'category', 'sortorder',
'shortname', 'fullname', 'idnumber',
- 'teacher', 'teachers', 'student', 'students',
'guest', 'startdate', 'visible',
'newsitems', 'cost', 'enrol',
'groupmode', 'groupmodeforce');
<?xml version="1.0" encoding="UTF-8" ?>
-<XMLDB PATH="lib/db" VERSION="20081022" COMMENT="XMLDB file for core Moodle tables"
+<XMLDB PATH="lib/db" VERSION="20081111" COMMENT="XMLDB file for core Moodle tables"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../lib/xmldb/xmldb.xsd"
>
<FIELD NAME="format" TYPE="char" LENGTH="10" NOTNULL="true" DEFAULT="topics" SEQUENCE="false" ENUM="false" PREVIOUS="summary" NEXT="showgrades"/>
<FIELD NAME="showgrades" TYPE="int" LENGTH="2" NOTNULL="true" UNSIGNED="true" DEFAULT="1" SEQUENCE="false" ENUM="false" PREVIOUS="format" NEXT="modinfo"/>
<FIELD NAME="modinfo" TYPE="text" LENGTH="big" NOTNULL="false" SEQUENCE="false" ENUM="false" PREVIOUS="showgrades" NEXT="newsitems"/>
- <FIELD NAME="newsitems" TYPE="int" LENGTH="5" NOTNULL="true" UNSIGNED="true" DEFAULT="1" SEQUENCE="false" ENUM="false" PREVIOUS="modinfo" NEXT="teacher"/>
- <FIELD NAME="teacher" TYPE="char" LENGTH="100" NOTNULL="true" DEFAULT="Teacher" SEQUENCE="false" ENUM="false" PREVIOUS="newsitems" NEXT="teachers"/>
- <FIELD NAME="teachers" TYPE="char" LENGTH="100" NOTNULL="true" DEFAULT="Teachers" SEQUENCE="false" ENUM="false" PREVIOUS="teacher" NEXT="student"/>
- <FIELD NAME="student" TYPE="char" LENGTH="100" NOTNULL="true" DEFAULT="Student" SEQUENCE="false" ENUM="false" PREVIOUS="teachers" NEXT="students"/>
- <FIELD NAME="students" TYPE="char" LENGTH="100" NOTNULL="true" DEFAULT="Students" SEQUENCE="false" ENUM="false" PREVIOUS="student" NEXT="guest"/>
- <FIELD NAME="guest" TYPE="int" LENGTH="2" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="students" NEXT="startdate"/>
+ <FIELD NAME="newsitems" TYPE="int" LENGTH="5" NOTNULL="true" UNSIGNED="true" DEFAULT="1" SEQUENCE="false" ENUM="false" PREVIOUS="modinfo" NEXT="guest"/>
+ <FIELD NAME="guest" TYPE="int" LENGTH="2" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="newsitems" NEXT="startdate"/>
<FIELD NAME="startdate" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="guest" NEXT="enrolperiod"/>
<FIELD NAME="enrolperiod" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="startdate" NEXT="numsections"/>
<FIELD NAME="numsections" TYPE="int" LENGTH="5" NOTNULL="true" UNSIGNED="true" DEFAULT="1" SEQUENCE="false" ENUM="false" PREVIOUS="enrolperiod" NEXT="marker"/>
upgrade_main_savepoint($result, 2008110603);
}
+ /// Drop the deprecated teacher, teachers, student and students columns from the course table.
+ if ($result && $oldversion < 2008111200) {
+ $table = new xmldb_table('course');
+
+ /// Conditionally launch drop field teacher
+ $field = new xmldb_field('teacher');
+ if ($dbman->field_exists($table, $field)) {
+ $dbman->drop_field($table, $field);
+ }
+
+ /// Conditionally launch drop field teacher
+ $field = new xmldb_field('teachers');
+ if ($dbman->field_exists($table, $field)) {
+ $dbman->drop_field($table, $field);
+ }
+
+ /// Conditionally launch drop field teacher
+ $field = new xmldb_field('student');
+ if ($dbman->field_exists($table, $field)) {
+ $dbman->drop_field($table, $field);
+ }
+
+ /// Conditionally launch drop field teacher
+ $field = new xmldb_field('students');
+ if ($dbman->field_exists($table, $field)) {
+ $dbman->drop_field($table, $field);
+ }
+
+ /// Main savepoint reached
+ upgrade_main_savepoint($result, 2008111200);
+ }
+
return $result;
}
$output .= '<td class="content">';
$output .= '<div class="username">'.fullname($user, has_capability('moodle/site:viewfullnames', $context)).'</div>';
$output .= '<div class="info">';
- if (!empty($user->role) and ($user->role <> $course->teacher)) {
+ if (!empty($user->role)) {
$output .= $string->role .': '. $user->role .'<br />';
}
if ($user->maildisplay == 1 or ($user->maildisplay == 2 and ($course->id != SITEID) and !isguest()) or
}
/// Print the feedback
- print_heading(get_string('feedbackfromteacher', 'assignment', $this->course->teacher)); // TODO: fix teacher string
+ print_heading(get_string('feedbackfromteacher', 'assignment', fullname($teacher)));
echo '<table cellspacing="0" class="feedback">';
get_string('fullname'),
get_string('grade'),
get_string('comment', 'assignment'),
- get_string('lastmodified').' ('.$course->student.')',
- get_string('lastmodified').' ('.$course->teacher.')',
+ get_string('lastmodified').' ('.get_string('submission', 'assignment').')',
+ get_string('lastmodified').' ('.get_string('grade').')',
get_string('status'),
get_string('finalgrade', 'grades'));
if ($uses_outcomes) {
if (empty($submission->timemarked)) { /// Nothing to show, so print nothing
if ($this->count_responsefiles($USER->id)) {
- print_heading(get_string('responsefiles', 'assignment', $this->course->teacher), '', 3);
+ print_heading(get_string('responsefiles', 'assignment'), '', 3);
$responsefiles = $this->print_responsefiles($USER->id, true);
print_simple_box($responsefiles, 'center');
}
$mform->addElement('checkbox', 'userating', get_string('allowratings', 'glossary') , get_string('ratingsuse', 'glossary'));
$options=array();
- $options[2] = get_string('ratingonlyteachers', 'glossary', moodle_strtolower($COURSE->teachers));
+ $options[2] = get_string('ratingonlywithpermissions', 'glossary');
$options[1] = get_string('ratingeveryone', 'glossary');
$mform->addElement('select', 'assessed', get_string('users'), $options);
$mform->disabledIf('assessed', 'userating');
$a->earned = $essayinfo->score;
$a->outof = 1;
}
-
+
// Set rest of the message values
$a->question = format_text($pages[$attempt->pageid]->contents, FORMAT_MOODLE, $options);
$a->response = s($essayinfo->answer);
- $a->teacher = $course->teacher;
$a->comment = s($essayinfo->response);
-
-
+
// Fetch message HTML and plain text formats
- $message = get_string('essayemailmessage', 'lesson', $a);
+ $message = get_string('essayemailmessage2', 'lesson', $a);
$plaintxt = format_text_email($message, FORMAT_HTML);
// Subject
// Setup table
$table = new stdClass;
- $table->head = array($course->students, get_string('essays', 'lesson'), get_string('email', 'lesson'));
+ $table->head = array(get_string('name'), get_string('essays', 'lesson'), get_string('email', 'lesson'));
$table->align = array('left', 'left', 'left');
$table->wrap = array('nowrap', 'nowrap', 'nowrap');
$table->cellspacing = '10px';
$table->size = array('*', '*', '*');
- $table->head = array(get_string("rank", "lesson"), $course->students, get_string("scores", "lesson"));
+ $table->head = array(get_string("rank", "lesson"), get_string('name'), get_string("scores", "lesson"));
$printed = 0;
while (true) {
// catch teachers
if (has_capability('mod/lesson:manage', $context)) {
- notify(get_string('progressbarteacherwarning', 'lesson', $course->teachers));
+ notify(get_string('progressbarteacherwarning2', 'lesson'));
return false;
}
if (!isset($USER->modattempts[$lesson->id])) {
$mform->setDefault('grade', 0);
$mform->setHelpButton('grade', array('grade', get_string('maximumgrade'), 'lesson'));
- $mform->addElement('selectyesno', 'retake', get_string('canretake', 'lesson', $COURSE->student));
- $mform->setHelpButton('retake', array('retake', get_string('canretake', 'lesson', $COURSE->student), 'lesson'));
+ $mform->addElement('selectyesno', 'retake', get_string('retakesallowed', 'lesson'));
+ $mform->setHelpButton('retake', array('retake', get_string('retakesallowed', 'lesson'), 'lesson'));
$mform->setDefault('retake', 0);
$options = array();
$table = new stdClass;
// set up the table object
- $table->head = array(get_string('studentname', 'lesson', $course->student), get_string('attempts', 'lesson'), get_string('highscore', 'lesson'));
+ $table->head = array(get_string('name'), get_string('attempts', 'lesson'), get_string('highscore', 'lesson'));
$table->align = array("center", "left", "left");
$table->wrap = array("nowrap", "nowrap", "nowrap");
$table->width = "90%";
$gradeinfo = lesson_grade($lesson, $try, $user->id);
- $table->data[] = array($course->student.':', print_user_picture($user->id, $course->id, $user->picture, 0, true).fullname($user, true));
+ $table->data[] = array(get_string('name').':', print_user_picture($user->id, $course->id, $user->picture, 0, true).fullname($user, true));
$table->data[] = array(get_string("timetaken", "lesson").":", format_time($timetotake));
$table->data[] = array(get_string("completed", "lesson").":", userdate($completed));
$table->data[] = array(get_string('rawgrade', 'lesson').':', $gradeinfo->earned.'/'.$gradeinfo->total);
$tabs = $row = $inactive = $activated = array();
/// user attempt count for reports link hover (completed attempts - much faster)
- $counts = new stdClass;
- $counts->attempts = $DB->count_records('lesson_grades', array('lessonid'=>$lesson->id));
- $counts->student = $course->student;
+ $attemptscount = $DB->count_records('lesson_grades', array('lessonid'=>$lesson->id));
$row[] = new tabobject('view', "$CFG->wwwroot/mod/lesson/view.php?id=$cm->id", get_string('preview', 'lesson'), get_string('previewlesson', 'lesson', format_string($lesson->name)));
$row[] = new tabobject('edit', "$CFG->wwwroot/mod/lesson/edit.php?id=$cm->id", get_string('edit', 'lesson'), get_string('edit', 'moodle', format_string($lesson->name)));
- $row[] = new tabobject('reports', "$CFG->wwwroot/mod/lesson/report.php?id=$cm->id", get_string('reports', 'lesson'), get_string('viewreports', 'lesson', $counts));
+ $row[] = new tabobject('reports', "$CFG->wwwroot/mod/lesson/report.php?id=$cm->id", get_string('reports', 'lesson'), get_string('viewreports2', 'lesson', $attemptscount));
if (has_capability('mod/lesson:edit', $context)) {
$row[] = new tabobject('essay', "$CFG->wwwroot/mod/lesson/essay.php?id=$cm->id", get_string('manualgrading', 'lesson'));
}
// make sure there are pages to view
if (!$DB->get_field('lesson_pages', 'id', array('lessonid' => $lesson->id, 'prevpageid' => 0))) {
if (!has_capability('mod/lesson:manage', $context)) {
- lesson_set_message(get_string('lessonnotready', 'lesson', $course->teacher)); // a nice message to the student
+ lesson_set_message(get_string('lessonnotready2', 'lesson')); // a nice message to the student
} else {
if (!$DB->count_records('lesson_pages', array('lessonid'=>$lesson->id))) {
redirect("$CFG->wwwroot/mod/lesson/edit.php?id=$cm->id"); // no pages - redirect to add pages
$line = new graph(800,600);
$line->parameter['title'] = '';
-$line->parameter['y_label_left'] = $course->students;
+$line->parameter['y_label_left'] = get_string('participants');
$line->parameter['x_label'] = get_string('grade');
$line->parameter['y_label_angle'] = 90;
$line->parameter['x_label_angle'] = 0;
$mform->addElement('header', 'preferencespage', get_string('preferencespage', 'quiz_overview'));
if (!$this->_customdata['currentgroup']){
- $studentsstring = "'".$COURSE->students."'";
+ $studentsstring = get_string('participants');
} else {
$a = new object();
- $a->coursestudent = $COURSE->students;
+ $a->coursestudent = get_string('participants');
$a->groupname = groups_get_group_name($this->_customdata['currentgroup']);
if (20 < strlen($a->groupname)){
$studentsstring = get_string('studentingrouplong', 'quiz_overview', $a);
if ($currentgroup){
$a= new object();
$a->groupname = groups_get_group_name($currentgroup);
- $a->coursestudents = $COURSE->students;
+ $a->coursestudents = get_string('participants');
$a->countregradeneeded = $countregradeneeded;
$regradealldrydolabel = get_string('regradealldrydogroup', 'quiz_overview', $a);
$regradealldrylabel = get_string('regradealldrygroup', 'quiz_overview', $a);
$mform->addElement('header', 'preferencespage', get_string('preferencespage', 'quiz_overview'));
if (!$this->_customdata['currentgroup']){
- $studentsstring = "'".$COURSE->students."'";
+ $studentsstring = get_string('participants');
} else {
$a = new object();
- $a->coursestudent = $COURSE->students;
+ $a->coursestudent = get_string('participants');
$a->groupname = groups_get_group_name($this->_customdata['currentgroup']);
if (20 < strlen($a->groupname)){
$studentsstring = get_string('studentingrouplong', 'quiz_overview', $a);
$littlecfg->wwwroot = $CFG->wwwroot;
- $this->parameters = array(
- 'label2' => array('langstr' => "",
- 'value' =>'/optgroup'),
+ $courseparameters = array(
'label3' => array('langstr' => get_string('course'),
'value' => 'optgroup'),
'value' => $this->course->summary),
'courseformat' => array('langstr' => get_string('format'),
'value' => $this->course->format),
- 'courseteacher' => array('langstr' => get_string('wordforteacher'),
- 'value' => $this->course->teacher),
- 'courseteachers' => array('langstr' => get_string('wordforteachers'),
- 'value' => $this->course->teachers),
- 'coursestudent' => array('langstr' => get_string('wordforstudent'),
- 'value' => $this->course->student),
- 'coursestudents' => array('langstr' => get_string('wordforstudents'),
- 'value' => $this->course->students),
-
- 'label4' => array('langstr' => "",
- 'value' =>'/optgroup'),
+ );
+
+ $roles = get_all_roles();
+ $coursecontext = get_context_instance(CONTEXT_COURSE, $this->course->id);
+ $roles = role_fix_names($roles, $coursecontext, ROLENAME_ALIAS);
+ foreach ($roles as $role) {
+ $courseparameters['course' . $role->shortname] = array(
+ 'langstr' => get_string('yourwordforx', '', $role->name),
+ 'value' => $role->localname);
+ }
+ $courseparameters['label4'] = array('langstr' => '', 'value' =>'/optgroup');
+
+ $miscparameters = array(
'label5' => array('langstr' => get_string('miscellaneous'),
'value' => 'optgroup'),
'value' => $this->set_encrypted_parameter()),
'label6' => array('langstr' => "",
- 'value' =>'/optgroup')
+ 'value' =>'/optgroup'),
);
+ $userparameters = array();
if (!empty($USER->id)) {
-
$userparameters = array(
-
'label1' => array('langstr' => get_string('user'),
'value' => 'optgroup'),
'usertimezone' => array('langstr' => get_string('timezone'),
'value' => get_user_timezone_offset()),
'userurl' => array('langstr' => get_string('webpage'),
- 'value' => $USER->url)
- );
+ 'value' => $USER->url),
- $this->parameters = $userparameters + $this->parameters;
+ 'label2' => array('langstr' => "",
+ 'value' =>'/optgroup'),
+ );
}
+ $this->parameters = array_merge($userparameters, $courseparameters, $miscparameters);
}
function add_instance($resource) {
$parray = explode(',', $resource->alltext);
foreach ($parray as $fieldstring) {
$field = explode('=', $fieldstring);
+ // Backwards compatibility. This is not ideal, but we no longer
+ // store plural role names, so the best we can do is send the
+ // singular instead.
+ if ($field[0] == 'courseteachers') {
+ $field[0] = 'courseeditingteacher';
+ } else if ($field[0] == 'coursestudents') {
+ $field[0] = 'coursestudent';
+ }
$querys[] = urlencode($field[1]).'='.urlencode($this->parameters[$field[0]]['value']);
}
if ($isteamspeak) {
$mform->addElement('header', 'parameters', get_string('parameters', 'resource'));
- $options = array();
- $options['-'] = get_string('chooseparameter', 'resource').'...';
- $optgroup = '';
+ $optiongroups = array();
+ $optiongroups[''] = array('-' => get_string('chooseaparameter', 'resource'));
+ $addto = &$optiongroups[''];
foreach ($this->parameters as $pname=>$param) {
if ($param['value']=='/optgroup') {
- $optgroup = '';
continue;
}
if ($param['value']=='optgroup') {
- $optgroup = $param['langstr'];
+ $optiongroups[$param['langstr']] = array();
+ $addto = &$optiongroups[$param['langstr']];
continue;
}
- $options[$pname] = $optgroup.' - '.$param['langstr'];
+ $addto[$pname] = $param['langstr'];
}
for ($i = 0; $i < $this->maxparameters; $i++) {
$parametername = "parameter$i";
$parsename = "parse$i";
$group = array();
- $group[] =& $mform->createElement('text', $parsename, '', array('size'=>'12'));//TODO: accessiblity
- $group[] =& $mform->createElement('select', $parametername, '', $options);//TODO: accessiblity
+ $group[] =& $mform->createElement('text', $parsename, '', array('size'=>'12'));
+ $group[] =& $mform->createElement('selectgroups', $parametername, '', $optiongroups);
$mform->addGroup($group, 'pargroup'.$i, get_string('variablename', 'resource').'='.get_string('parameter', 'resource'), ' ', false);
$mform->setAdvanced('pargroup'.$i);
$site = get_site();
$this->parameters = array(
- 'label2' => array('langstr' => "",
- 'value' =>'/optgroup'),
'label3' => array('langstr' => get_string('course'),
'value' => 'optgroup'),
'value' => $this->course->summary),
'courseformat' => array('langstr' => get_string('format'),
'value' => $this->course->format),
- 'courseteacher' => array('langstr' => get_string('wordforteacher'),
- 'value' => $this->course->teacher),
- 'courseteachers' => array('langstr' => get_string('wordforteachers'),
- 'value' => $this->course->teachers),
- 'coursestudent' => array('langstr' => get_string('wordforstudent'),
- 'value' => $this->course->student),
- 'coursestudents' => array('langstr' => get_string('wordforstudents'),
- 'value' => $this->course->students),
'label4' => array('langstr' => "",
'value' =>'/optgroup'),
'value' => $this->set_encrypted_parameter()),
'label6' => array('langstr' => "",
- 'value' =>'/optgroup')
+ 'value' =>'/optgroup'),
);
if (!empty($USER->id)) {
'usertimezone' => array('langstr' => get_string('timezone'),
'value' => get_user_timezone_offset()),
'userurl' => array('langstr' => get_string('webpage'),
- 'value' => $USER->url)
- );
+ 'value' => $USER->url),
+ 'label2' => array('langstr' => "",
+ 'value' =>'/optgroup'),
+ );
$this->parameters = $userparameters + $this->parameters;
}
print_error('coursemisconf');
}
+ if ($sid) {
+ if (!$user = $DB->get_record("user", array("id"=>$sid))) {
+ print_error('invaliduserid');
+ }
+ }
+
require_login($course->id, false, $cm);
$groupmode = groups_get_activity_groupmode($cm); // Groups are being used
$stractual = get_string("actual", "survey");
$stractualclass = get_string("actualclass", "survey");
- $stractualstudent = get_string("actualstudent", "survey", $course->student);
+ $stractualstudent = get_string("actualstudent", "survey", fullname($user));
$strpreferred = get_string("preferred", "survey");
$strpreferredclass = get_string("preferredclass", "survey");
- $strpreferredstudent = get_string("preferredstudent", "survey", $course->student);
+ $strpreferredstudent = get_string("preferredstudent", "survey", fullname($user));
$virtualscales = false; //set default value for case clauses
echo "<a href=\"report.php?action=summary&id=$id\">$strsummary</a>";
echo " <a href=\"report.php?action=scales&id=$id\">$strscales</a>";
echo " <a href=\"report.php?action=questions&id=$id\">$strquestions</a>";
- echo " <a href=\"report.php?action=students&id=$id\">$course->students</a>";
+ echo " <a href=\"report.php?action=students&id=$id\">".get_string('participants')."</a>";
if (has_capability('mod/survey:download', $context)) {
echo " <a href=\"report.php?action=download&id=$id\">$strdownload</a>";
}
}
} else {
echo "<a href=\"report.php?action=questions&id=$id\">$strquestions</a>";
- echo " <a href=\"report.php?action=students&id=$id\">$course->students</a>";
+ echo " <a href=\"report.php?action=students&id=$id\">".get_string('participants')."</a>";
if (has_capability('mod/survey:download', $context)) {
echo " <a href=\"report.php?action=download&id=$id\">$strdownload</a>";
}
case "students":
- print_heading(get_string("analysisof", "survey", "$course->students"));
+ print_heading(get_string("analysisof", "survey", get_string('participants')));
if (! $results = survey_get_responses($survey->id, $currentgroup, $groupingid) ) {
notify(get_string("nobodyyet","survey"));
switch ($wiki->wtype) {
case 'teacher':
- $wtype = $site->teacher;
+ $wtype = get_string('defaultcoursestudent');
break;
case 'student':
- $wtype = $site->student;
+ $wtype = get_string('defaultcoursestudent');
break;
case 'group':
<table align="center"><tr><th colspan="4" scope="row"><?php print_string('currentlyselectedusers'); ?></th></tr>
<?php
if (count($SESSION->emailto[$id])) {
- if (!$course->teacher) {
- $course->teacher = get_string('defaultcourseteacher');
- }
foreach ($SESSION->emailto[$id] as $user) {
echo '<tr><td>'.fullname($user,true).'</td><td>'.$user->email.'</td><td>';
- if ($user->teacher) {
- echo '<img src="'.$CFG->pixpath.'/t/user.gif" alt="'.$course->teacher.'" title="'.$course->teacher.'"/>';
- }
if ($user->emailstop) {
$error = get_string('emaildisable');
} elseif (empty($user->email)) {
$id = required_param('id',PARAM_INT);
$messagebody = optional_param('messagebody','',PARAM_CLEANHTML);
- $send = optional_param('send','',PARAM_RAW); // Content is actually treated as boolean
- $preview = optional_param('preview','',PARAM_RAW); // Content is actually treated as boolean
- $edit = optional_param('edit','',PARAM_RAW); // Content is actually treated as boolean
+ $send = optional_param('send','',PARAM_BOOL);
+ $preview = optional_param('preview','',PARAM_BOOL);
+ $edit = optional_param('edit','',PARAM_BOOL);
$returnto = optional_param('returnto','',PARAM_LOCALURL);
$format = optional_param('format',FORMAT_MOODLE,PARAM_INT);
$deluser = optional_param('deluser',0,PARAM_INT);
if (!array_key_exists($m[2],$SESSION->emailto[$id])) {
if ($user = $DB->get_record_select('user', "id = ?", array($m[2]), 'id,firstname,lastname,idnumber,email,emailstop,mailformat,lastaccess')) {
$SESSION->emailto[$id][$m[2]] = $user;
- $SESSION->emailto[$id][$m[2]]->teacher = ($m[1] == 'teacher');
$count++;
}
}
echo "\n</form>";
} else if (!empty($send)) {
$good = 1;
- $teachers = array();
foreach ($SESSION->emailto[$id] as $user) {
$good = $good && message_post_message($USER,$user,$messagebody,$format,'direct');
- if ($user->teacher) {
- $teachers[] = $user->id;
- }
}
if (!empty($good)) {
print_heading(get_string('messagedselectedusers'));
// This is compared against the values stored in the database to determine
// whether upgrades should be performed (see lib/db/*.php)
- $version = 2008111100; // YYYYMMDD = date of the last version bump
+ $version = 2008111200; // YYYYMMDD = date of the last version bump
// XX = daily increments
$release = '2.0 dev (Build: 20081113)'; // Human-friendly version name