Permalink
Browse files

MDL-29189 mutlilang Reviewed the uses of course shortname and ensured…

… things are being formatted consistently
  • Loading branch information...
1 parent 22e8ad6 commit 34c46428f1ba9125c812ce4c3a3f963074241399 Sam Hemelryk committed Sep 6, 2011
Showing with 292 additions and 165 deletions.
  1. +1 −1 backup/backup_scheduled.php
  2. +2 −0 backup/util/dbops/backup_plan_dbops.class.php
  3. +1 −1 backup/util/helper/backup_cron_helper.class.php
  4. +2 −2 backup/util/ui/renderer.php
  5. +6 −3 blocks/course_list/block_course_list.php
  6. +37 −23 blog/lib.php
  7. +2 −1 calendar/export_execute.php
  8. +2 −1 calendar/renderer.php
  9. +5 −4 course/delete.php
  10. +1 −1 course/info.php
  11. +17 −8 course/lib.php
  12. +6 −4 course/publish/index.php
  13. +3 −1 course/publish/metadata.php
  14. +4 −2 course/report/completion/index.php
  15. +2 −2 course/report/log/graph.php
  16. +4 −1 course/report/progress/index.php
  17. +1 −1 course/report/stats/report.php
  18. +4 −2 enrol/authorize/localfuncs.php
  19. +10 −5 enrol/authorize/locallib.php
  20. +4 −2 enrol/flatfile/lib.php
  21. +3 −2 enrol/ldap/lib.php
  22. +1 −1 enrol/meta/addinstance_form.php
  23. +5 −3 enrol/paypal/ipn.php
  24. +4 −3 enrol/paypal/lib.php
  25. +3 −1 grade/export/ods/grade_export_ods.php
  26. +2 −1 grade/export/txt/grade_export_txt.php
  27. +2 −1 grade/export/xls/grade_export_xls.php
  28. +2 −1 grade/export/xml/grade_export_xml.php
  29. +4 −2 grade/report/overview/lib.php
  30. +1 −1 group/index.php
  31. +1 −1 group/overview.php
  32. +1 −1 lib/accesslib.php
  33. +4 −2 lib/enrollib.php
  34. +6 −3 lib/navigationlib.php
  35. +1 −1 lib/outputrenderers.php
  36. +5 −4 message/lib.php
  37. +17 −10 mod/assignment/lib.php
  38. +3 −3 mod/chat/gui_ajax/index.php
  39. +2 −1 mod/chat/gui_header_js/index.php
  40. +3 −1 mod/chat/gui_sockets/index.php
  41. +2 −1 mod/chat/view.php
  42. +4 −1 mod/choice/view.php
  43. +2 −2 mod/data/edit.php
  44. +4 −2 mod/data/rsslib.php
  45. +4 −2 mod/data/view.php
  46. +11 −10 mod/feedback/analysis_course.php
  47. +3 −2 mod/feedback/analysis_to_excel.php
  48. +4 −2 mod/feedback/item/info/lib.php
  49. +7 −2 mod/feedback/lib.php
  50. +3 −1 mod/feedback/mapcourse.php
  51. +1 −1 mod/forum/discuss.php
  52. +3 −2 mod/forum/index.php
  53. +12 −7 mod/forum/lib.php
  54. +1 −1 mod/forum/view.php
  55. +1 −1 mod/glossary/view.php
  56. +8 −2 mod/quiz/report/overview/report.php
  57. +8 −2 mod/quiz/report/responses/report.php
  58. +3 −1 mod/quiz/report/statistics/report.php
  59. +5 −2 mod/scorm/player.php
  60. +5 −3 mod/survey/download.php
  61. +6 −2 mod/url/locallib.php
  62. +1 −1 notes/index.php
  63. +1 −1 repository/coursefiles/lib.php
  64. +1 −1 tag/coursetags_edit.php
  65. +2 −1 tag/coursetags_more.php
  66. +3 −2 user/index.php
  67. +2 −1 user/lib.php
  68. +1 −1 user/view.php
@@ -194,7 +194,7 @@ function schedule_backup_cron() {
//Build the message subject
$site = get_site();
- $prefix = $site->shortname.": ";
+ $prefix = format_string($site->shortname, true, array('context' => get_context_instance(CONTEXT_COURSE, SITEID))).": ";
if ($count_error != 0 || $count_unfinished != 0) {
$prefix .= "[".strtoupper(get_string('error'))."] ";
}
@@ -214,6 +214,8 @@ public static function get_default_backup_filename($format, $type, $id, $users,
switch ($type) {
case backup::TYPE_1COURSE:
$shortname = $DB->get_field('course', 'shortname', array('id' => $id));
+ $context = get_context_instance(CONTEXT_COURSE, $id);
+ $shortname = format_string($shortname, true, array('context' => $context));
break;
case backup::TYPE_1SECTION:
if (!$shortname = $DB->get_field('course_sections', 'name', array('id' => $id))) {
@@ -197,7 +197,7 @@ public static function run_automated_backup($rundirective = self::RUN_ON_SCHEDUL
//Build the message subject
$site = get_site();
- $prefix = $site->shortname.": ";
+ $prefix = format_string($site->shortname, true, array('context' => get_context_instance(CONTEXT_COURSE, SITEID))).": ";
if ($haserrors) {
$prefix .= "[".strtoupper(get_string('error'))."] ";
}
@@ -523,7 +523,7 @@ public function render_restore_course_search(restore_course_search $component) {
}
$row->cells = array(
html_writer::empty_tag('input', array('type'=>'radio', 'name'=>'targetid', 'value'=>$course->id)),
- $course->shortname,
+ format_string($course->shortname, true, array('context' => get_context_instance(CONTEXT_COURSE, $course->id))),
$course->fullname
);
$table->data[] = $row;
@@ -587,7 +587,7 @@ public function render_import_course_search(import_course_search $component) {
}
$row->cells = array(
html_writer::empty_tag('input', array('type'=>'radio', 'name'=>'importid', 'value'=>$course->id)),
- $course->shortname,
+ format_string($course->shortname, true, array('context' => get_context_instance(CONTEXT_COURSE, $course->id))),
$course->fullname
);
$table->data[] = $row;
@@ -36,8 +36,9 @@ function get_content() {
!(has_capability('moodle/course:update', get_context_instance(CONTEXT_SYSTEM)) and $adminseesall)) { // Just print My Courses
if ($courses = enrol_get_my_courses(NULL, 'visible DESC, fullname ASC')) {
foreach ($courses as $course) {
+ $coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
$linkcss = $course->visible ? "" : " class=\"dimmed\" ";
- $this->content->items[]="<a $linkcss title=\"" . format_string($course->shortname) . "\" ".
+ $this->content->items[]="<a $linkcss title=\"" . format_string($course->shortname, true, array('context' => $coursecontext)) . "\" ".
"href=\"$CFG->wwwroot/course/view.php?id=$course->id\">".$icon.format_string($course->fullname). "</a>";
}
$this->title = get_string('mycourses');
@@ -70,10 +71,11 @@ function get_content() {
if ($courses) {
foreach ($courses as $course) {
+ $coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
$linkcss = $course->visible ? "" : " class=\"dimmed\" ";
$this->content->items[]="<a $linkcss title=\""
- . format_string($course->shortname)."\" ".
+ . format_string($course->shortname, true, array('context' => $coursecontext))."\" ".
"href=\"$CFG->wwwroot/course/view.php?id=$course->id\">"
.$icon. format_string($course->fullname) . "</a>";
}
@@ -117,7 +119,8 @@ function get_remote_courses() {
$this->content->items[] = get_string('remotecourses','mnet');
$this->content->icons[] = '';
foreach ($courses as $course) {
- $this->content->items[]="<a title=\"" . format_string($course->shortname) . "\" ".
+ $coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
+ $this->content->items[]="<a title=\"" . format_string($course->shortname, true, array('context' => $coursecontext)) . "\" ".
"href=\"{$CFG->wwwroot}/auth/mnet/jump.php?hostid={$course->hostid}&amp;wantsurl=/course/view.php?id={$course->remoteid}\">"
.$icon. format_string($course->fullname) . "</a>";
}
View
@@ -748,10 +748,11 @@ function blog_get_headers($courseid=null, $groupid=null, $userid=null, $tagid=nu
// Case 1: No entry, mod, course or user params: all site entries to be shown (filtered by search and tag/tagid)
// Note: if action is set to 'add' or 'edit', we do this at the end
if (empty($entryid) && empty($modid) && empty($courseid) && empty($userid) && !in_array($action, array('edit', 'add'))) {
+ $shortname = format_string($site->shortname, true, array('context' => get_context_instance(CONTEXT_COURSE, SITEID)));
$PAGE->navbar->add($strblogentries, $blogurl);
- $PAGE->set_title("$site->shortname: " . get_string('blog', 'blog'));
- $PAGE->set_heading("$site->shortname: " . get_string('blog', 'blog'));
- $headers['heading'] = get_string('siteblog', 'blog', $site->shortname);
+ $PAGE->set_title("$shortname: " . get_string('blog', 'blog'));
+ $PAGE->set_heading("$shortname: " . get_string('blog', 'blog'));
+ $headers['heading'] = get_string('siteblog', 'blog', $shortname);
// $headers['strview'] = get_string('viewsiteentries', 'blog');
}
@@ -770,14 +771,14 @@ function blog_get_headers($courseid=null, $groupid=null, $userid=null, $tagid=nu
} else {
$mycourseid = $site->id;
}
+ $shortname = format_string($site->shortname, true, array('context' => get_context_instance(CONTEXT_COURSE, SITEID)));
$PAGE->navbar->add($strblogentries, $blogurl);
$blogurl->remove_params('userid');
$PAGE->navbar->add($entry->subject, $blogurl);
-
- $PAGE->set_title("$site->shortname: " . fullname($user) . ": $entry->subject");
- $PAGE->set_heading("$site->shortname: " . fullname($user) . ": $entry->subject");
+ $PAGE->set_title("$shortname: " . fullname($user) . ": $entry->subject");
+ $PAGE->set_heading("$shortname: " . fullname($user) . ": $entry->subject");
$headers['heading'] = get_string('blogentrybyuser', 'blog', fullname($user));
// We ignore tag and search params
@@ -789,23 +790,26 @@ function blog_get_headers($courseid=null, $groupid=null, $userid=null, $tagid=nu
// Case 3: A user's blog entries
if (!empty($userid) && empty($entryid) && ((empty($courseid) && empty($modid)) || !$CFG->useblogassociations)) {
+ $shortname = format_string($site->shortname, true, array('context' => get_context_instance(CONTEXT_COURSE, SITEID)));
$blogurl->param('userid', $userid);
- $PAGE->set_title("$site->shortname: " . fullname($user) . ": " . get_string('blog', 'blog'));
- $PAGE->set_heading("$site->shortname: " . fullname($user) . ": " . get_string('blog', 'blog'));
+ $PAGE->set_title("$shortname: " . fullname($user) . ": " . get_string('blog', 'blog'));
+ $PAGE->set_heading("$shortname: " . fullname($user) . ": " . get_string('blog', 'blog'));
$headers['heading'] = get_string('userblog', 'blog', fullname($user));
$headers['strview'] = get_string('viewuserentries', 'blog', fullname($user));
} else
// Case 4: No blog associations, no userid
if (!$CFG->useblogassociations && empty($userid) && !in_array($action, array('edit', 'add'))) {
- $PAGE->set_title("$site->shortname: " . get_string('blog', 'blog'));
- $PAGE->set_heading("$site->shortname: " . get_string('blog', 'blog'));
- $headers['heading'] = get_string('siteblog', 'blog', $site->shortname);
+ $shortname = format_string($site->shortname, true, array('context' => get_context_instance(CONTEXT_COURSE, SITEID)));
+ $PAGE->set_title("$shortname: " . get_string('blog', 'blog'));
+ $PAGE->set_heading("$shortname: " . get_string('blog', 'blog'));
+ $headers['heading'] = get_string('siteblog', 'blog', $shortname);
} else
// Case 5: Blog entries associated with an activity by a specific user (courseid ignored)
if (!empty($userid) && !empty($modid) && empty($entryid)) {
+ $shortname = format_string($site->shortname, true, array('context' => get_context_instance(CONTEXT_COURSE, SITEID)));
$blogurl->param('userid', $userid);
$blogurl->param('modid', $modid);
@@ -814,8 +818,8 @@ function blog_get_headers($courseid=null, $groupid=null, $userid=null, $tagid=nu
$PAGE->navbar->add(fullname($user), "$CFG->wwwroot/user/view.php?id=$user->id");
$PAGE->navbar->add($strblogentries, $blogurl);
- $PAGE->set_title("$site->shortname: $cm->name: " . fullname($user) . ': ' . get_string('blogentries', 'blog'));
- $PAGE->set_heading("$site->shortname: $cm->name: " . fullname($user) . ': ' . get_string('blogentries', 'blog'));
+ $PAGE->set_title("$shortname: $cm->name: " . fullname($user) . ': ' . get_string('blogentries', 'blog'));
+ $PAGE->set_heading("$shortname: $cm->name: " . fullname($user) . ': ' . get_string('blogentries', 'blog'));
$a = new stdClass();
$a->user = fullname($user);
@@ -828,13 +832,15 @@ function blog_get_headers($courseid=null, $groupid=null, $userid=null, $tagid=nu
// Case 6: Blog entries associated with a course by a specific user
if (!empty($userid) && !empty($courseid) && empty($modid) && empty($entryid)) {
+ $siteshortname = format_string($site->shortname, true, array('context' => get_context_instance(CONTEXT_COURSE, SITEID)));
+ $courseshortname = format_string($course->shortname, true, array('context' => get_context_instance(CONTEXT_COURSE, $course->id)));
$blogurl->param('userid', $userid);
$blogurl->param('courseid', $courseid);
$PAGE->navbar->add($strblogentries, $blogurl);
- $PAGE->set_title("$site->shortname: $course->shortname: " . fullname($user) . ': ' . get_string('blogentries', 'blog'));
- $PAGE->set_heading("$site->shortname: $course->shortname: " . fullname($user) . ': ' . get_string('blogentries', 'blog'));
+ $PAGE->set_title("$siteshortname: $courseshortname: " . fullname($user) . ': ' . get_string('blogentries', 'blog'));
+ $PAGE->set_heading("$siteshortname: $courseshortname: " . fullname($user) . ': ' . get_string('blogentries', 'blog'));
$a = new stdClass();
$a->user = fullname($user);
@@ -850,15 +856,17 @@ function blog_get_headers($courseid=null, $groupid=null, $userid=null, $tagid=nu
// Case 7: Blog entries by members of a group, associated with that group's course
if (!empty($groupid) && empty($modid) && empty($entryid)) {
+ $siteshortname = format_string($site->shortname, true, array('context' => get_context_instance(CONTEXT_COURSE, SITEID)));
+ $courseshortname = format_string($course->shortname, true, array('context' => get_context_instance(CONTEXT_COURSE, $course->id)));
$blogurl->param('courseid', $course->id);
$PAGE->navbar->add($strblogentries, $blogurl);
$blogurl->remove_params(array('courseid'));
$blogurl->param('groupid', $groupid);
$PAGE->navbar->add($group->name, $blogurl);
- $PAGE->set_title("$site->shortname: $course->shortname: " . get_string('blogentries', 'blog') . ": $group->name");
- $PAGE->set_heading("$site->shortname: $course->shortname: " . get_string('blogentries', 'blog') . ": $group->name");
+ $PAGE->set_title("$siteshortname: $courseshortname: " . get_string('blogentries', 'blog') . ": $group->name");
+ $PAGE->set_heading("$siteshortname: $courseshortname: " . get_string('blogentries', 'blog') . ": $group->name");
$a = new stdClass();
$a->group = $group->name;
@@ -871,15 +879,17 @@ function blog_get_headers($courseid=null, $groupid=null, $userid=null, $tagid=nu
// Case 8: Blog entries by members of a group, associated with an activity in that course
if (!empty($groupid) && !empty($modid) && empty($entryid)) {
+ $siteshortname = format_string($site->shortname, true, array('context' => get_context_instance(CONTEXT_COURSE, SITEID)));
+ $courseshortname = format_string($course->shortname, true, array('context' => get_context_instance(CONTEXT_COURSE, $course->id)));
$headers['cm'] = $cm;
$blogurl->param('modid', $modid);
$PAGE->navbar->add($strblogentries, $blogurl);
$blogurl->param('groupid', $groupid);
$PAGE->navbar->add($group->name, $blogurl);
- $PAGE->set_title("$site->shortname: $course->shortname: $cm->name: " . get_string('blogentries', 'blog') . ": $group->name");
- $PAGE->set_heading("$site->shortname: $course->shortname: $cm->name: " . get_string('blogentries', 'blog') . ": $group->name");
+ $PAGE->set_title("$siteshortname: $courseshortname: $cm->name: " . get_string('blogentries', 'blog') . ": $group->name");
+ $PAGE->set_heading("$siteshortname: $courseshortname: $cm->name: " . get_string('blogentries', 'blog') . ": $group->name");
$a = new stdClass();
$a->group = $group->name;
@@ -893,11 +903,13 @@ function blog_get_headers($courseid=null, $groupid=null, $userid=null, $tagid=nu
// Case 9: All blog entries associated with an activity
if (!empty($modid) && empty($userid) && empty($groupid) && empty($entryid)) {
+ $siteshortname = format_string($site->shortname, true, array('context' => get_context_instance(CONTEXT_COURSE, SITEID)));
+ $courseshortname = format_string($course->shortname, true, array('context' => get_context_instance(CONTEXT_COURSE, $course->id)));
$PAGE->set_cm($cm, $course);
$blogurl->param('modid', $modid);
$PAGE->navbar->add($strblogentries, $blogurl);
- $PAGE->set_title("$site->shortname: $course->shortname: $cm->name: " . get_string('blogentries', 'blog'));
- $PAGE->set_heading("$site->shortname: $course->shortname: $cm->name: " . get_string('blogentries', 'blog'));
+ $PAGE->set_title("$siteshortname: $courseshortname: $cm->name: " . get_string('blogentries', 'blog'));
+ $PAGE->set_heading("$siteshortname: $courseshortname: $cm->name: " . get_string('blogentries', 'blog'));
$headers['heading'] = get_string('blogentriesabout', 'blog', $cm->name);
$a = new stdClass();
$a->type = get_string('modulename', $cm->modname);
@@ -907,10 +919,12 @@ function blog_get_headers($courseid=null, $groupid=null, $userid=null, $tagid=nu
// Case 10: All blog entries associated with a course
if (!empty($courseid) && empty($userid) && empty($groupid) && empty($modid) && empty($entryid)) {
+ $siteshortname = format_string($site->shortname, true, array('context' => get_context_instance(CONTEXT_COURSE, SITEID)));
+ $courseshortname = format_string($course->shortname, true, array('context' => get_context_instance(CONTEXT_COURSE, $course->id)));
$blogurl->param('courseid', $courseid);
$PAGE->navbar->add($strblogentries, $blogurl);
- $PAGE->set_title("$site->shortname: $course->shortname: " . get_string('blogentries', 'blog'));
- $PAGE->set_heading("$site->shortname: $course->shortname: " . get_string('blogentries', 'blog'));
+ $PAGE->set_title("$siteshortname: $courseshortname: " . get_string('blogentries', 'blog'));
+ $PAGE->set_heading("$siteshortname: $courseshortname: " . get_string('blogentries', 'blog'));
$a = new stdClass();
$a->type = get_string('course');
$headers['heading'] = get_string('blogentriesabout', 'blog', $course->fullname);
@@ -140,7 +140,8 @@
$ev->add_property('dtend', Bennu::timestamp_to_datetime($event->timestart + $event->timeduration));
}
if ($event->courseid != 0) {
- $ev->add_property('categories', $courses[$event->courseid]->shortname);
+ $coursecontext = get_context_instance(CONTEXT_COURSE, $event->courseid);
+ $ev->add_property('categories', format_string($courses[$event->courseid]->shortname, true, array('context' => $coursecontext)));
}
$ical->add_component($ev);
}
View
@@ -692,7 +692,8 @@ protected function course_filter_selector(moodle_url $returnurl, $label=null) {
$courseoptions = array();
$courseoptions[SITEID] = get_string('fulllistofcourses');
foreach ($courses as $course) {
- $courseoptions[$course->id] = format_string($course->shortname);
+ $coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
+ $courseoptions[$course->id] = format_string($course->shortname, true, array('context' => $coursecontext));
}
if ($this->page->course->id !== SITEID) {
View
@@ -30,20 +30,21 @@
}
$category = $DB->get_record("course_categories", array("id"=>$course->category));
+ $courseshortname = format_string($course->shortname, true, array('context' => get_context_instance(CONTEXT_COURSE, $course->id)));
$PAGE->navbar->add($stradministration, new moodle_url('/admin/index.php/'));
$PAGE->navbar->add($strcategories, new moodle_url('/course/index.php'));
$PAGE->navbar->add($category->name, new moodle_url('/course/category.php', array('id'=>$course->category)));
if (! $delete) {
- $strdeletecheck = get_string("deletecheck", "", $course->shortname);
+ $strdeletecheck = get_string("deletecheck", "", $courseshortname);
$strdeletecoursecheck = get_string("deletecoursecheck");
$PAGE->navbar->add($strdeletecheck);
$PAGE->set_title("$site->shortname: $strdeletecheck");
$PAGE->set_heading($site->fullname);
echo $OUTPUT->header();
- $message = "$strdeletecoursecheck<br /><br />" . format_string($course->fullname) . " (" . format_string($course->shortname) . ")";
+ $message = "$strdeletecoursecheck<br /><br />" . format_string($course->fullname) . " (" . $courseshortname . ")";
echo $OUTPUT->confirm($message, "delete.php?id=$course->id&delete=".md5($course->timemodified), "category.php?id=$course->category");
echo $OUTPUT->footer();
@@ -62,7 +63,7 @@
add_to_log(SITEID, "course", "delete", "view.php?id=$course->id", "$course->fullname (ID $course->id)");
- $strdeletingcourse = get_string("deletingcourse", "", format_string($course->shortname));
+ $strdeletingcourse = get_string("deletingcourse", "", $courseshortname);
$PAGE->navbar->add($strdeletingcourse);
$PAGE->set_title("$site->shortname: $strdeletingcourse");
@@ -73,7 +74,7 @@
delete_course($course);
fix_course_sortorder(); //update course count in catagories
- echo $OUTPUT->heading( get_string("deletedcourse", "", format_string($course->shortname)) );
+ echo $OUTPUT->heading( get_string("deletedcourse", "", $courseshortname) );
echo $OUTPUT->continue_button("category.php?id=$course->category");
Oops, something went wrong.

0 comments on commit 34c4642

Please sign in to comment.