Permalink
Browse files

Merge branch MDL-29189-master of git://github.com/samhemelryk/moodle

 - resolved conflicts.
  • Loading branch information...
2 parents 62b214d + eb38d45 commit 5433da6064002e1389e94ac06107a167b27ed19c @nebgor nebgor committed Sep 13, 2011
Showing with 325 additions and 169 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. +9 −4 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. +2 −2 lib/db/install.xml
  34. +27 −0 lib/db/upgrade.php
  35. +4 −2 lib/enrollib.php
  36. +6 −3 lib/navigationlib.php
  37. +1 −1 lib/outputrenderers.php
  38. +5 −4 message/lib.php
  39. +17 −10 mod/assignment/lib.php
  40. +3 −3 mod/chat/gui_ajax/index.php
  41. +2 −1 mod/chat/gui_header_js/index.php
  42. +3 −1 mod/chat/gui_sockets/index.php
  43. +2 −1 mod/chat/view.php
  44. +4 −1 mod/choice/view.php
  45. +2 −2 mod/data/edit.php
  46. +4 −2 mod/data/rsslib.php
  47. +4 −2 mod/data/view.php
  48. +11 −10 mod/feedback/analysis_course.php
  49. +3 −2 mod/feedback/analysis_to_excel.php
  50. +4 −2 mod/feedback/item/info/lib.php
  51. +7 −2 mod/feedback/lib.php
  52. +3 −1 mod/feedback/mapcourse.php
  53. +1 −1 mod/forum/discuss.php
  54. +3 −2 mod/forum/index.php
  55. +12 −7 mod/forum/lib.php
  56. +1 −1 mod/forum/view.php
  57. +1 −1 mod/glossary/view.php
  58. +8 −2 mod/quiz/report/overview/report.php
  59. +8 −2 mod/quiz/report/responses/report.php
  60. +3 −1 mod/quiz/report/statistics/report.php
  61. +4 −2 mod/scorm/player.php
  62. +3 −1 mod/scorm/report/basic/report.php
  63. +2 −1 mod/scorm/view.php
  64. +5 −3 mod/survey/download.php
  65. +6 −2 mod/url/locallib.php
  66. +1 −1 notes/index.php
  67. +1 −1 repository/coursefiles/lib.php
  68. +1 −1 tag/coursetags_edit.php
  69. +2 −1 tag/coursetags_more.php
  70. +3 −2 user/index.php
  71. +2 −1 user/lib.php
  72. +1 −1 user/view.php
  73. +1 −1 version.php
View
2 backup/backup_scheduled.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'))."] ";
}
View
2 backup/util/dbops/backup_plan_dbops.class.php
@@ -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))) {
View
2 backup/util/helper/backup_cron_helper.class.php
@@ -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'))."] ";
}
View
4 backup/util/ui/renderer.php
@@ -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;
View
9 blocks/course_list/block_course_list.php
@@ -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
60 blog/lib.php
@@ -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);
View
3 calendar/export_execute.php
@@ -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
3 calendar/renderer.php
@@ -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
9 course/delete.php
@@ -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");
View
2 course/info.php
@@ -42,7 +42,7 @@
$PAGE->navbar->add(get_string('summary'));
echo $OUTPUT->header();
- echo $OUTPUT->heading('<a href="view.php?id='.$course->id.'">'.format_string($course->fullname) . '</a><br />(' . format_string($course->shortname) . ')');
+ echo $OUTPUT->heading('<a href="view.php?id='.$course->id.'">'.format_string($course->fullname) . '</a><br />(' . format_string($course->shortname, true, array('context' => $context)) . ')');
// print enrol info
if ($texts = enrol_get_course_description_texts($course)) {
View
25 course/lib.php
@@ -498,8 +498,9 @@ function print_mnet_log($hostid, $course, $user=0, $date=0, $order="l.time ASC",
echo '<tr class="r'.$row.'">';
if ($course->id == SITEID) {
+ $courseshortname = format_string($courses[$log->course], true, array('context' => get_context_instance(CONTEXT_COURSE, SITEID)));
echo "<td class=\"r$row c0\" >\n";
- echo " <a href=\"{$CFG->wwwroot}/course/view.php?id={$log->course}\">".$courses[$log->course]."</a>\n";
+ echo " <a href=\"{$CFG->wwwroot}/course/view.php?id={$log->course}\">".$courseshortname."</a>\n";
echo "</td>\n";
}
echo "<td class=\"r$row c1\" align=\"right\">".userdate($log->time, '%a').
@@ -591,8 +592,9 @@ function print_log_csv($course, $user, $date, $order='l.time DESC', $modname,
$log->info = format_string($log->info);
$log->info = strip_tags(urldecode($log->info)); // Some XSS protection
- $firstField = $courses[$log->course];
- $fullname = fullname($log, has_capability('moodle/site:viewfullnames', get_context_instance(CONTEXT_COURSE, $course->id)));
+ $coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
+ $firstField = format_string($courses[$log->course], true, array('context' => $coursecontext));
+ $fullname = fullname($log, has_capability('moodle/site:viewfullnames', $coursecontext));
$row = array($firstField, userdate($log->time, $strftimedatetime), $log->ip, $fullname, $log->module.' '.$log->action, $log->info);
$text = implode("\t", $row);
echo $text." \n";
@@ -697,10 +699,12 @@ function print_log_xls($course, $user, $date, $order='l.time DESC', $modname,
}
}
- $myxls->write($row, 0, $courses[$log->course], '');
+ $coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
+
+ $myxls->write($row, 0, format_string($courses[$log->course], true, array('context' => $coursecontext)), '');
$myxls->write_date($row, 1, $log->time, $formatDate); // write_date() does conversion/timezone support. MDL-14934
$myxls->write($row, 2, $log->ip, '');
- $fullname = fullname($log, has_capability('moodle/site:viewfullnames', get_context_instance(CONTEXT_COURSE, $course->id)));
+ $fullname = fullname($log, has_capability('moodle/site:viewfullnames', $coursecontext));
$myxls->write($row, 3, $fullname, '');
$myxls->write($row, 4, $log->module.' '.$log->action, '');
$myxls->write($row, 5, $log->info, '');
@@ -808,10 +812,12 @@ function print_log_ods($course, $user, $date, $order='l.time DESC', $modname,
}
}
- $myxls->write_string($row, 0, $courses[$log->course]);
+ $coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
+
+ $myxls->write_string($row, 0, format_string($courses[$log->course], true, array('context' => $context)));
$myxls->write_date($row, 1, $log->time);
$myxls->write_string($row, 2, $log->ip);
- $fullname = fullname($log, has_capability('moodle/site:viewfullnames', get_context_instance(CONTEXT_COURSE, $course->id)));
+ $fullname = fullname($log, has_capability('moodle/site:viewfullnames', $coursecontext));
$myxls->write_string($row, 3, $fullname);
$myxls->write_string($row, 4, $log->module.' '.$log->action);
$myxls->write_string($row, 5, $log->info);
@@ -3263,7 +3269,10 @@ function make_editing_buttons(stdClass $mod, $absolute = true, $moveselect = tru
*/
function course_format_name ($course,$max=100) {
- $str = $course->shortname.': '. $course->fullname;
+ $context = get_context_instance(CONTEXT_COURSE, $course->id);
+ $shortname = format_string($course->shortname, true, array('context' => $context));
+
+ $str = $shortname.': '. $course->fullname;
if (textlib::strlen($str) <= $max) {
return $str;
}
View
10 course/publish/index.php
@@ -37,6 +37,8 @@
$course = $DB->get_record('course', array('id'=>$id), '*', MUST_EXIST);
require_login($course);
+$context = get_context_instance(CONTEXT_COURSE, $course->id);
+$shortname = format_string($course->shortname, true, array('context' => $context));
$PAGE->set_url('/course/publish/index.php', array('id' => $course->id));
$PAGE->set_pagelayout('course');
@@ -48,7 +50,7 @@
$notificationerror = $OUTPUT->doc_link('admin/environment/php_extension/xmlrpc', '');
$notificationerror .= get_string('xmlrpcdisabledpublish', 'hub');
echo $OUTPUT->header();
- echo $OUTPUT->heading(get_string('publishcourse', 'hub', $course->shortname), 3, 'main');
+ echo $OUTPUT->heading(get_string('publishcourse', 'hub', $shortname), 3, 'main');
echo $OUTPUT->notification($notificationerror);
echo $OUTPUT->footer();
die();
@@ -144,9 +146,9 @@
} else {
//display confirmation page for unpublishing
-
+
echo $OUTPUT->header();
- echo $OUTPUT->heading(get_string('unpublishcourse', 'hub', $course->shortname), 3, 'main');
+ echo $OUTPUT->heading(get_string('unpublishcourse', 'hub', $shortname), 3, 'main');
echo $renderer->confirmunpublishing($publication);
echo $OUTPUT->footer();
die();
@@ -164,7 +166,7 @@
echo $OUTPUT->header();
echo $confirmmessage;
- echo $OUTPUT->heading(get_string('publishcourse', 'hub', $course->shortname), 3, 'main');
+ echo $OUTPUT->heading(get_string('publishcourse', 'hub', $shortname), 3, 'main');
echo $renderer->publicationselector($course->id);
$publications = $publicationmanager->get_course_publications($course->id);
View
4 course/publish/metadata.php
@@ -53,8 +53,10 @@
if (!extension_loaded('xmlrpc')) {
$errornotification = $OUTPUT->doc_link('admin/environment/php_extension/xmlrpc', '');
$errornotification .= get_string('xmlrpcdisabledpublish', 'hub');
+ $context = get_context_instance(CONTEXT_COURSE, $course->id);
+ $shortname = format_string($course->shortname, true, array('context' => $context));
echo $OUTPUT->header();
- echo $OUTPUT->heading(get_string('publishcourse', 'hub', $course->shortname), 3, 'main');
+ echo $OUTPUT->heading(get_string('publishcourse', 'hub', $shortname), 3, 'main');
echo $OUTPUT->notification($errornotification);
echo $OUTPUT->footer();
die();
View
6 course/report/completion/index.php
@@ -143,8 +143,10 @@ function csv_quote($value) {
* Setup page header
*/
if ($csv) {
+ $shortname = format_string($course->shortname, true, array('context' => $context));
+ $textlib = textlib_get_instance();
header('Content-Disposition: attachment; filename=progress.'.
- preg_replace('/[^a-z0-9-]/','_',strtolower($course->shortname)).'.csv');
+ preg_replace('/[^a-z0-9-]/','_',$textlib->strtolower(strip_tags($shortname))).'.csv');
// Unicode byte-order mark for Excel
if($excel) {
header('Content-Type: text/csv; charset=UTF-16LE');
@@ -486,7 +488,7 @@ function csv_quote($value) {
// Display icon
$iconlink = $CFG->wwwroot.'/course/view.php?id='.$criterion->courseinstance;
$icontitle = $crs->fullname;
- $iconalt = $crs->shortname;
+ $iconalt = format_string($crs->shortname, true, array('context' => get_context_instance(CONTEXT_COURSE, $crs->id)));
break;
case COMPLETION_CRITERIA_TYPE_ROLE:
View
4 course/report/log/graph.php
@@ -120,7 +120,7 @@
$graph = new graph(750, 400);
- $a->coursename = $course->shortname;
+ $a->coursename = format_string($course->shortname, true, array('context' => $context));
$a->username = fullname($user, true);
$graph->parameter['title'] = get_string("hitsoncourse", "", $a);
@@ -183,7 +183,7 @@
$graph = new graph(750, 400);
- $a->coursename = $course->shortname;
+ $a->coursename = format_string($course->shortname, true, array('context' => $context));
$a->username = fullname($user, true);
$graph->parameter['title'] = get_string("hitsoncoursetoday", "", $a);
View
5 course/report/progress/index.php
@@ -108,8 +108,11 @@ function csv_quote($value) {
}
if($csv && $grandtotal && count($activities)>0) { // Only show CSV if there are some users/actvs
+
+ $shortname = format_string($course->shortname, true, array('context' => $context));
+ $textlib = textlib_get_instance();
header('Content-Disposition: attachment; filename=progress.'.
- preg_replace('/[^a-z0-9-]/','_',strtolower($course->shortname)).'.csv');
+ preg_replace('/[^a-z0-9-]/','_',$textlib->strtolower(strip_tags($shortname))).'.csv');
// Unicode byte-order mark for Excel
if($excel) {
header('Content-Type: text/csv; charset=UTF-16LE');
View
2 course/report/stats/report.php
@@ -11,7 +11,7 @@
$context = get_context_instance(CONTEXT_COURSE, $c->id);
if (has_capability('coursereport/stats:view', $context)) {
- $courseoptions[$c->id] = $c->shortname;
+ $courseoptions[$c->id] = format_string($c->shortname, true, array('context' => $context));
}
}
View
6 enrol/authorize/localfuncs.php
@@ -232,14 +232,15 @@ function send_welcome_messages($orderdata) {
$a->profileurl = "$CFG->wwwroot/user/view.php?id=$lastuserid";
$a->paymenturl = "$CFG->wwwroot/enrol/authorize/index.php?user=$lastuserid";
$emailmessage = get_string('welcometocoursesemail', 'enrol_authorize', $a);
+ $subject = get_string("enrolmentnew", '', format_string($SITE->shortname, true, array('context' => get_context_instance(CONTEXT_COURSE, SITEID))));
$eventdata = new stdClass();
$eventdata->modulename = 'moodle';
$eventdata->component = 'enrol_authorize';
$eventdata->name = 'authorize_enrolment';
$eventdata->userfrom = $sender;
$eventdata->userto = $user;
- $eventdata->subject = get_string("enrolmentnew", '', $SITE->shortname);
+ $eventdata->subject = $subject;
$eventdata->fullmessage = $emailmessage;
$eventdata->fullmessageformat = FORMAT_PLAIN;
$eventdata->fullmessagehtml = '';
@@ -267,6 +268,7 @@ function authorize_verify_account() {
$original_antest = $plugin->get_config('an_test');
$plugin->set_config('an_test', 1); // Test mode
+ $shortname = format_string($SITE->shortname, true, array('context' => get_context_instance(CONTEXT_COURSE, SITEID)));
$order = new stdClass();
$order->id = -1;
@@ -293,7 +295,7 @@ function authorize_verify_account() {
$extra->x_country = $USER->country;
$extra->x_invoice_num = $order->id;
- $extra->x_description = $SITE->shortname . ' - Authorize.net Merchant Account Verification Test';
+ $extra->x_description = $shortname . ' - Authorize.net Merchant Account Verification Test';
$ret = '';
$message = '';
View
13 enrol/authorize/locallib.php
@@ -54,6 +54,8 @@ function authorize_print_orders($courseid, $userid) {
$searchtype = optional_param('searchtype', 'orderid', PARAM_ALPHA);
$status = optional_param('status', AN_STATUS_NONE, PARAM_INT);
+ $coursecontext = get_context_instance(CONTEXT_COURSE, $courseid);
+
$searchmenu = array('orderid' => $authstrs->orderid, 'transid' => $authstrs->transid, 'cclastfour' => $authstrs->cclastfour);
$buttons = "<form method='post' action='index.php' autocomplete='off'><div>";
$buttons .= html_writer::select($searchmenu, 'searchtype', $searchtype, false);
@@ -65,7 +67,7 @@ function authorize_print_orders($courseid, $userid) {
$buttons .= "<form method='get' action='uploadcsv.php'><div><input type='submit' value='".get_string('uploadcsv', 'enrol_authorize')."' /></div></form>";
}
- $canmanagepayments = has_capability('enrol/authorize:managepayments', get_context_instance(CONTEXT_COURSE, $courseid));
+ $canmanagepayments = has_capability('enrol/authorize:managepayments', $coursecontext);
if ($showonlymy || !$canmanagepayments) {
$userid = $USER->id;
}
@@ -104,7 +106,8 @@ function authorize_print_orders($courseid, $userid) {
}
if (SITEID != $courseid) {
- $PAGE->navbar->add($course->shortname, new moodle_url('/course/view.php', array('id'=>$course->id)));
+ $shortname = format_string($course->shortname, true, array('context' => $coursecontext));
+ $PAGE->navbar->add($shortname, new moodle_url('/course/view.php', array('id'=>$course->id)));
}
$PAGE->navbar->add($authstrs->paymentmanagement, 'index.php');
$PAGE->set_title("$course->shortname: $authstrs->paymentmanagement");
@@ -297,7 +300,8 @@ function authorize_print_order($orderid)
}
if (SITEID != $course->id) {
- $PAGE->navbar->add($course->shortname, new moodle_url('/course/view.php', array('id'=>$course->id)));
+ $shortname = format_string($course->shortname, true, array('context' => $coursecontext));
+ $PAGE->navbar->add($shortname, new moodle_url('/course/view.php', array('id'=>$course->id)));
}
$PAGE->navbar->add($authstrs->paymentmanagement, 'index.php?course='.$course->id);
$PAGE->navbar->add($authstrs->orderid . ': ' . $orderid, 'index.php');
@@ -343,7 +347,8 @@ function authorize_print_order($orderid)
redirect("$CFG->wwwroot/enrol/authorize/index.php?order=$orderid");
}
else {
- redirect("$CFG->wwwroot/enrol/authorize/index.php?order=$orderid", "Error while trying to enrol ".fullname($user)." in '" . format_string($course->shortname) . "'", 20);
+ $shortname = format_string($course->shortname, true, array('context' => $coursecontext));
+ redirect("$CFG->wwwroot/enrol/authorize/index.php?order=$orderid", "Error while trying to enrol ".fullname($user)." in '" . $shortname . "'", 20);
}
}
else {
View
6 enrol/flatfile/lib.php
@@ -276,14 +276,15 @@ private function process_records($action, $roleid, $user, $course, $timestart, $
$a = new stdClass();
$a->coursename = "$course->fullname";
$a->profileurl = "$CFG->wwwroot/user/view.php?id=$user->id&amp;course=$course->id";
+ $subject = get_string("enrolmentnew", 'enrol', format_string($course->shortname, true, array('context' => $context)));
$eventdata = new stdClass();
$eventdata->modulename = 'moodle';
$eventdata->component = 'course';
$eventdata->name = 'flatfile_enrolment';
$eventdata->userfrom = $teacher;
$eventdata->userto = $user;
- $eventdata->subject = get_string("enrolmentnew", 'enrol', $course->shortname);
+ $eventdata->subject = $subject;
$eventdata->fullmessage = get_string('welcometocoursetext', '', $a);
$eventdata->fullmessageformat = FORMAT_PLAIN;
$eventdata->fullmessagehtml = '';
@@ -298,14 +299,15 @@ private function process_records($action, $roleid, $user, $course, $timestart, $
$a = new stdClass();
$a->course = "$course->fullname";
$a->user = fullname($user);
+ $subject = get_string("enrolmentnew", 'enrol', format_string($course->shortname, true, array('context' => $context)));
$eventdata = new stdClass();
$eventdata->modulename = 'moodle';
$eventdata->component = 'course';
$eventdata->name = 'flatfile_enrolment';
$eventdata->userfrom = $user;
$eventdata->userto = $teacher;
- $eventdata->subject = get_string("enrolmentnew", 'enrol', $course->shortname);
+ $eventdata->subject = $subject;
$eventdata->fullmessage = get_string('enrolmentnewuser', 'enrol', $a);
$eventdata->fullmessageformat = FORMAT_PLAIN;
$eventdata->fullmessagehtml = '';
View
5 enrol/ldap/lib.php
@@ -448,19 +448,20 @@ public function sync_enrolments() {
JOIN {enrol} e ON (e.id = ue.enrolid)
WHERE u.deleted = 0 AND e.courseid = :courseid ";
$params = array('roleid'=>$role->id, 'courseid'=>$course_obj->id);
+ $context = get_context_instance(CONTEXT_COURSE, $course_obj->id);
if (!empty($ldapmembers)) {
list($ldapml, $params2) = $DB->get_in_or_equal($ldapmembers, SQL_PARAMS_NAMED, 'm', false);
$sql .= "AND u.idnumber $ldapml";
$params = array_merge($params, $params2);
unset($params2);
} else {
+ $shortname = format_string($course_obj->shortname, true, array('context' => $context));
print_string('emptyenrolment', 'enrol_ldap',
array('role_shortname'=> $role->shortname,
- 'course_shortname'=>$course_obj->shortname));
+ 'course_shortname' => $shortname));
}
$todelete = $DB->get_records_sql($sql, $params);
- $context = get_context_instance(CONTEXT_COURSE, $course_obj->id);
if (!empty($todelete)) {
$transaction = $DB->start_delegated_transaction();
foreach ($todelete as $row) {
View
2 enrol/meta/addinstance_form.php
@@ -54,7 +54,7 @@ function definition() {
if (!has_capability('enrol/meta:selectaslinked', $coursecontext)) {
continue;
}
- $courses[$c->id] = format_string($c->fullname). ' ['.$c->shortname.']';
+ $courses[$c->id] = format_string($c->fullname). ' ['.format_string($c->shortname, true, array('context' => $coursecontext)).']';
}
$rs->close();
View
8 enrol/paypal/ipn.php
@@ -228,6 +228,8 @@
$mailstudents = $plugin->get_config('mailstudents');
$mailteachers = $plugin->get_config('mailteachers');
$mailadmins = $plugin->get_config('mailadmins');
+ $shortname = format_string($course->shortname, true, array('context' => $context));
+
if (!empty($mailstudents)) {
$a->coursename = $course->fullname;
@@ -239,7 +241,7 @@
$eventdata->name = 'paypal_enrolment';
$eventdata->userfrom = $teacher;
$eventdata->userto = $user;
- $eventdata->subject = get_string("enrolmentnew", '', $course->shortname);
+ $eventdata->subject = get_string("enrolmentnew", '', $shortname);
$eventdata->fullmessage = get_string('welcometocoursetext', '', $a);
$eventdata->fullmessageformat = FORMAT_PLAIN;
$eventdata->fullmessagehtml = '';
@@ -258,7 +260,7 @@
$eventdata->name = 'paypal_enrolment';
$eventdata->userfrom = $user;
$eventdata->userto = $teacher;
- $eventdata->subject = get_string("enrolmentnew", '', $course->shortname);
+ $eventdata->subject = get_string("enrolmentnew", '', $shortname);
$eventdata->fullmessage = get_string('enrolmentnewuser', '', $a);
$eventdata->fullmessageformat = FORMAT_PLAIN;
$eventdata->fullmessagehtml = '';
@@ -277,7 +279,7 @@
$eventdata->name = 'paypal_enrolment';
$eventdata->userfrom = $user;
$eventdata->userto = $admin;
- $eventdata->subject = get_string("enrolmentnew", '', $course->shortname);
+ $eventdata->subject = get_string("enrolmentnew", '', $shortname);
$eventdata->fullmessage = get_string('enrolmentnewuser', '', $a);
$eventdata->fullmessageformat = FORMAT_PLAIN;
$eventdata->fullmessagehtml = '';
View
7 enrol/paypal/lib.php
@@ -151,11 +151,12 @@ function enrol_page_hook(stdClass $instance) {
}
$course = $DB->get_record('course', array('id'=>$instance->courseid));
+ $context = get_context_instance(CONTEXT_COURSE, $course->id);
- $strloginto = get_string("loginto", "", $course->shortname);
+ $shortname = format_string($course->shortname, true, array('context' => $context));
+ $strloginto = get_string("loginto", "", $shortname);
$strcourses = get_string("courses");
- $context = get_context_instance(CONTEXT_COURSE, $course->id);
// Pass $view=true to filter hidden caps if the user cannot see them
if ($users = get_users_by_capability($context, 'moodle/course:update', 'u.*', 'u.id ASC',
'', '', '', '', false, true)) {
@@ -190,7 +191,7 @@ function enrol_page_hook(stdClass $instance) {
} else {
//Sanitise some fields before building the PayPal form
$coursefullname = format_string($course->fullname, true, array('context'=>$context));
- $courseshortname = $course->shortname;
+ $courseshortname = $shortname;
$userfullname = fullname($USER);
$userfirstname = $USER->firstname;
$userlastname = $USER->lastname;
View
4 grade/export/ods/grade_export_ods.php
@@ -32,8 +32,10 @@ function print_grades() {
$strgrades = get_string('grades');
+ $shortname = format_string($this->course->shortname, true, array('context' => get_context_instance(CONTEXT_COURSE, $this->course->id)));
+
/// Calculate file name
- $downloadfilename = clean_filename("{$this->course->shortname} $strgrades.ods");
+ $downloadfilename = clean_filename("$shortname $strgrades.ods");
/// Creating a workbook
$workbook = new MoodleODSWorkbook("-");
/// Sending HTTP headers
View
3 grade/export/txt/grade_export_txt.php
@@ -66,7 +66,8 @@ public function print_grades() {
@header('Pragma: no-cache');
}
header("Content-Type: application/download\n");
- $downloadfilename = clean_filename("{$this->course->shortname} $strgrades");
+ $shortname = format_string($this->course->shortname, true, array('context' => get_context_instance(CONTEXT_COURSE, $this->course->id)));
+ $downloadfilename = clean_filename("$shortname $strgrades");
header("Content-Disposition: attachment; filename=\"$downloadfilename.txt\"");
/// Print names of all the fields
View
3 grade/export/xls/grade_export_xls.php
@@ -33,7 +33,8 @@ public function print_grades() {
$strgrades = get_string('grades');
/// Calculate file name
- $downloadfilename = clean_filename("{$this->course->shortname} $strgrades.xls");
+ $shortname = format_string($this->course->shortname, true, array('context' => get_context_instance(CONTEXT_COURSE, $this->course->id)));
+ $downloadfilename = clean_filename("$shortname $strgrades.xls");
/// Creating a workbook
$workbook = new MoodleExcelWorkbook("-");
/// Sending HTTP headers
View
3 grade/export/xml/grade_export_xml.php
@@ -38,7 +38,8 @@ public function print_grades($feedback = false) {
$strgrades = get_string('grades');
/// Calculate file name
- $downloadfilename = clean_filename("{$this->course->shortname} $strgrades.xml");
+ $shortname = format_string($this->course->shortname, true, array('context' => get_context_instance(CONTEXT_COURSE, $this->course->id)));
+ $downloadfilename = clean_filename("$shortname $strgrades.xml");
make_temp_directory('gradeexport');
$tempfilename = $CFG->tempdir .'/gradeexport/'. md5(sesskey().microtime().$downloadfilename);
View
6 grade/report/overview/lib.php
@@ -119,8 +119,10 @@ public function fill_table() {
if (!$course->showgrades) {
continue;
}
- $courselink = '<a href="'.$CFG->wwwroot.'/grade/report/user/index.php?id='.$course->id.'&userid='.$this->user->id.'">'.$course->shortname.'</a>';
- $canviewhidden = has_capability('moodle/grade:viewhidden', get_context_instance(CONTEXT_COURSE, $course->id));
+ $coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
+ $courseshortname = format_string($course->shortname, true, array('context' => $coursecontext));
+ $courselink = html_writer::link(new moodle_url('/grade/report/user/index.php', array('id' => $course->id, 'userid' => $this->user->id)), $courseshortname);
+ $canviewhidden = has_capability('moodle/grade:viewhidden', $coursecontext);
// Get course grade_item
$course_item = grade_item::fetch_course_item($course->id);
View
2 group/index.php
@@ -155,7 +155,7 @@
$deletegroup_disabled = '';
}
-echo $OUTPUT->heading(format_string($course->shortname) .' '.$strgroups, 3);
+echo $OUTPUT->heading(format_string($course->shortname, true, array('context' => $context)) .' '.$strgroups, 3);
echo '<form id="groupeditform" action="index.php" method="post">'."\n";
echo '<div>'."\n";
echo '<input type="hidden" name="id" value="' . $courseid . '" />'."\n";
View
2 group/overview.php
@@ -114,7 +114,7 @@
require('tabs.php');
/// Print overview
-echo $OUTPUT->heading(format_string($course->shortname) .' '.$stroverview, 3);
+echo $OUTPUT->heading(format_string($course->shortname, true, array('context' => $context)) .' '.$stroverview, 3);
echo $strfiltergroups;
View
2 lib/accesslib.php
@@ -3597,7 +3597,7 @@ function print_context_name($context, $withprefix = true, $short = false) {
$name = get_string('course').': ';
}
if ($short){
- $name .= format_string($course->shortname);
+ $name .= format_string($course->shortname, true, array('context' => $context));
} else {
$name .= format_string($course->fullname);
}
View
4 lib/db/install.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<XMLDB PATH="lib/db" VERSION="20110821" COMMENT="XMLDB file for core Moodle tables"
+<XMLDB PATH="lib/db" VERSION="20110907" COMMENT="XMLDB file for core Moodle tables"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../lib/xmldb/xmldb.xsd"
>
@@ -73,7 +73,7 @@
<FIELD NAME="category" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="id" NEXT="sortorder"/>
<FIELD NAME="sortorder" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="category" NEXT="fullname"/>
<FIELD NAME="fullname" TYPE="char" LENGTH="254" NOTNULL="true" SEQUENCE="false" PREVIOUS="sortorder" NEXT="shortname"/>
- <FIELD NAME="shortname" TYPE="char" LENGTH="100" NOTNULL="true" SEQUENCE="false" PREVIOUS="fullname" NEXT="idnumber"/>
+ <FIELD NAME="shortname" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" PREVIOUS="fullname" NEXT="idnumber"/>
<FIELD NAME="idnumber" TYPE="char" LENGTH="100" NOTNULL="true" SEQUENCE="false" PREVIOUS="shortname" NEXT="summary"/>
<FIELD NAME="summary" TYPE="text" LENGTH="small" NOTNULL="false" SEQUENCE="false" PREVIOUS="idnumber" NEXT="summaryformat"/>
<FIELD NAME="summaryformat" TYPE="int" LENGTH="2" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="summary" NEXT="format"/>
View
27 lib/db/upgrade.php
@@ -6719,6 +6719,33 @@ function xmldb_main_upgrade($oldversion) {
upgrade_main_savepoint(true, 2011091200.00);
}
+ if ($oldversion < 2011091300.00) {
+ // Increase the length of the of the course shortname field as it is now going
+ // to be consistently filtered and 100 characters is practically useless for
+ // things like the multilang filter.
+
+ $table = new xmldb_table('course');
+ $field = new xmldb_field('shortname', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null, 'fullname');
+ $index = new xmldb_index('shortname', XMLDB_INDEX_NOTUNIQUE, array('shortname'));
+
+ // First check the shortname field exists... pretty heavy mod if it doesnt!
+ if ($dbman->field_exists($table, $field)) {
+ // Conditionally launch drop index shortname, this is required to happen
+ // before we can edit the field.
+ if ($dbman->index_exists($table, $index)) {
+ $dbman->drop_index($table, $index);
+ }
+
+ // Launch change of precision for field shortname
+ $dbman->change_field_precision($table, $field);
+ // Add the index back to the table now that we're finished our mods
+ $dbman->add_index($table, $index);
+ }
+
+ // Main savepoint reached
+ upgrade_main_savepoint(true, 2011091300.00);
+ }
+
return true;
}
View
6 lib/enrollib.php
@@ -434,7 +434,8 @@ function enrol_add_course_navigation(navigation_node $coursenode, $course) {
}
$plugin = $plugins[$instance->enrol];
if ($unenrollink = $plugin->get_unenrolself_link($instance)) {
- $coursenode->add(get_string('unenrolme', 'core_enrol', format_string($course->shortname)), $unenrollink, navigation_node::TYPE_SETTING, null, 'unenrolself', new pix_icon('i/user', ''));
+ $shortname = format_string($course->shortname, true, array('context' => $coursecontext));
+ $coursenode->add(get_string('unenrolme', 'core_enrol', $shortname), $unenrollink, navigation_node::TYPE_SETTING, null, 'unenrolself', new pix_icon('i/user', ''));
break;
//TODO. deal with multiple unenrol links - not likely case, but still...
}
@@ -450,7 +451,8 @@ function enrol_add_course_navigation(navigation_node $coursenode, $course) {
$plugin = $plugins[$instance->enrol];
if ($plugin->show_enrolme_link($instance)) {
$url = new moodle_url('/enrol/index.php', array('id'=>$course->id));
- $coursenode->add(get_string('enrolme', 'core_enrol', format_string($course->shortname)), $url, navigation_node::TYPE_SETTING, null, 'enrolself', new pix_icon('i/user', ''));
+ $shortname = format_string($course->shortname, true, array('context' => $coursecontext));
+ $coursenode->add(get_string('enrolme', 'core_enrol', $shortname), $url, navigation_node::TYPE_SETTING, null, 'enrolself', new pix_icon('i/user', ''));
break;
}
}
View
9 lib/navigationlib.php
@@ -2030,7 +2030,8 @@ protected function load_for_user($user=null, $forceforcontext=false) {
foreach ($userscourses as $usercourse) {
$usercoursecontext = get_context_instance(CONTEXT_COURSE, $usercourse->id);
- $usercoursenode = $userscoursesnode->add($usercourse->shortname, new moodle_url('/user/view.php', array('id'=>$user->id, 'course'=>$usercourse->id)), self::TYPE_CONTAINER);
+ $usercourseshortname = format_string($usercourse->shortname, true, array('context' => $usercoursecontext));
+ $usercoursenode = $userscoursesnode->add($usercourseshortname, new moodle_url('/user/view.php', array('id'=>$user->id, 'course'=>$usercourse->id)), self::TYPE_CONTAINER);
$gradeavailable = has_capability('moodle/grade:viewall', $usercoursecontext);
if (!$gradeavailable && !empty($usercourse->showgrades) && is_array($reports) && !empty($reports)) {
@@ -2140,17 +2141,19 @@ public function add_course(stdClass $course, $forcegeneric = false, $ismycourse
return $this->addedcourses[$course->id];
}
+ $coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
+
if ($course->id != SITEID && !$course->visible) {
if (is_role_switched($course->id)) {
// user has to be able to access course in order to switch, let's skip the visibility test here
- } else if (!has_capability('moodle/course:viewhiddencourses', get_context_instance(CONTEXT_COURSE, $course->id))) {
+ } else if (!has_capability('moodle/course:viewhiddencourses', $coursecontext)) {
return false;
}
}
$issite = ($course->id == SITEID);
$ismycourse = ($ismycourse && !$forcegeneric);
- $shortname = $course->shortname;
+ $shortname = format_string($course->shortname, true, array('context' => $coursecontext));
if ($issite) {
$parent = $this;
View
2 lib/outputrenderers.php
@@ -545,7 +545,7 @@ public function home_link() {
} else {
return '<div class="homelink"><a href="' . $CFG->wwwroot . '/course/view.php?id=' . $this->page->course->id . '">' .
- format_string($this->page->course->shortname) . '</a></div>';
+ format_string($this->page->course->shortname, true, array('context' => $this->page->context)) . '</a></div>';
}
}
View
9 message/lib.php
@@ -487,10 +487,11 @@ function message_print_usergroup_selector($viewing, $courses, $coursecontexts, $
foreach($courses as $course) {
if (has_capability('moodle/course:viewparticipants', $coursecontexts[$course->id])) {
//Not using short_text() as we want the end of the course name. Not the beginning.
- if ($textlib->strlen($course->shortname) > MESSAGE_MAX_COURSE_NAME_LENGTH) {
- $courses_options[MESSAGE_VIEW_COURSE.$course->id] = '...'.$textlib->substr($course->shortname, -MESSAGE_MAX_COURSE_NAME_LENGTH);
+ $shortname = format_string($course->shortname, true, array('context' => $coursecontexts[$course->id]));
+ if ($textlib->strlen($shortname) > MESSAGE_MAX_COURSE_NAME_LENGTH) {
+ $courses_options[MESSAGE_VIEW_COURSE.$course->id] = '...'.$textlib->substr($shortname, -MESSAGE_MAX_COURSE_NAME_LENGTH);
} else {
- $courses_options[MESSAGE_VIEW_COURSE.$course->id] = $course->shortname;
+ $courses_options[MESSAGE_VIEW_COURSE.$course->id] = $shortname;
}
}
}
@@ -2021,7 +2022,7 @@ function message_post_message($userfrom, $userto, $message, $format) {
$eventdata->smallmessage = $message;//store the message unfiltered. Clean up on output.
$s = new stdClass();
- $s->sitename = $SITE->shortname;
+ $s->sitename = format_string($SITE->shortname, true, array('context' => get_context_instance(CONTEXT_COURSE, SITEID)));
$s->url = $CFG->wwwroot.'/message/index.php?user='.$userto->id.'&id='.$userfrom->id;
$emailtagline = get_string_manager()->get_string('emailtagline', 'message', $s, $userto->lang);
View
27 mod/assignment/lib.php
@@ -54,6 +54,8 @@ class assignment_base {
var $cm;
/** @var object */
var $course;
+ /** @var stdClass */
+ var $coursecontext;
/** @var object */
var $assignment;
/** @var string */
@@ -119,6 +121,8 @@ function assignment_base($cmid='staticonly', $assignment=NULL, $cm=NULL, $course
} else if (! $this->course = $DB->get_record('course', array('id'=>$this->cm->course))) {
print_error('invalidid', 'assignment');
}
+ $this->coursecontext = get_context_instance(CONTEXT_COURSE, $this->course->id);
+ $courseshortname = format_text($this->course->shortname, true, array('context' => $this->coursecontext));
if ($assignment) {
$this->assignment = $assignment;
@@ -133,7 +137,7 @@ function assignment_base($cmid='staticonly', $assignment=NULL, $cm=NULL, $course
$this->strassignments = get_string('modulenameplural', 'assignment');
$this->strsubmissions = get_string('submissions', 'assignment');
$this->strlastmodified = get_string('lastmodified');
- $this->pagetitle = strip_tags($this->course->shortname.': '.$this->strassignment.': '.format_string($this->assignment->name,true));
+ $this->pagetitle = strip_tags($courseshortname.': '.$this->strassignment.': '.format_string($this->assignment->name, true, array('context' => $this->context)));
// visibility handled by require_login() with $cm parameter
// get current group only when really needed
@@ -1849,8 +1853,9 @@ function get_graders($user) {
* @return string
*/
function email_teachers_text($info) {
- $posttext = format_string($this->course->shortname).' -> '.$this->strassignments.' -> '.
- format_string($this->assignment->name)."\n";
+ $posttext = format_string($this->course->shortname, true, array('context' => $this->coursecontext)).' -> '.
+ $this->strassignments.' -> '.
+ format_string($this->assignment->name, true, array('context' => $this->context))."\n";
$posttext .= '---------------------------------------------------------------------'."\n";
$posttext .= get_string("emailteachermail", "assignment", $info)."\n";
$posttext .= "\n---------------------------------------------------------------------\n";
@@ -1866,9 +1871,9 @@ function email_teachers_text($info) {
function email_teachers_html($info) {
global $CFG;
$posthtml = '<p><font face="sans-serif">'.
- '<a href="'.$CFG->wwwroot.'/course/view.php?id='.$this->course->id.'">'.format_string($this->course->shortname).'</a> ->'.
+ '<a href="'.$CFG->wwwroot.'/course/view.php?id='.$this->course->id.'">'.format_string($this->course->shortname, true, array('context' => $this->coursecontext)).'</a> ->'.
'<a href="'.$CFG->wwwroot.'/mod/assignment/index.php?id='.$this->course->id.'">'.$this->strassignments.'</a> ->'.
- '<a href="'.$CFG->wwwroot.'/mod/assignment/view.php?id='.$this->cm->id.'">'.format_string($this->assignment->name).'</a></font></p>';
+ '<a href="'.$CFG->wwwroot.'/mod/assignment/view.php?id='.$this->cm->id.'">'.format_string($this->assignment->name, true, array('context' => $this->context)).'</a></font></p>';
$posthtml .= '<hr /><font face="sans-serif">';
$posthtml .= '<p>'.get_string('emailteachermailhtml', 'assignment', $info).'</p>';
$posthtml .= '</font><hr />';
@@ -2589,8 +2594,10 @@ function assignment_cron () {
/// mail is customised for the receiver.
cron_setup_user($user, $course);
- if (!is_enrolled(get_context_instance(CONTEXT_COURSE, $submission->course), $user->id)) {
- echo fullname($user)." not an active participant in " . format_string($course->shortname) . "\n";
+ $coursecontext = get_context_instance(CONTEXT_COURSE, $submission->course);
+ $courseshortname = format_string($course->shortname, true, array('context' => $coursecontext));
+ if (!is_enrolled($coursecontext, $user->id)) {
+ echo fullname($user)." not an active participant in " . $courseshortname . "\n";
continue;
}
@@ -2616,15 +2623,15 @@ function assignment_cron () {
$assignmentinfo->assignment = format_string($submission->name,true);
$assignmentinfo->url = "$CFG->wwwroot/mod/assignment/view.php?id=$mod->id";
- $postsubject = "$course->shortname: $strassignments: ".format_string($submission->name,true);
- $posttext = "$course->shortname -> $strassignments -> ".format_string($submission->name,true)."\n";
+ $postsubject = "$courseshortname: $strassignments: ".format_string($submission->name,true);
+ $posttext = "$courseshortname -> $strassignments -> ".format_string($submission->name,true)."\n";
$posttext .= "---------------------------------------------------------------------\n";
$posttext .= get_string("assignmentmail", "assignment", $assignmentinfo)."\n";
$posttext .= "---------------------------------------------------------------------\n";
if ($user->mailformat == 1) { // HTML
$posthtml = "<p><font face=\"sans-serif\">".
- "<a href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</a> ->".
+ "<a href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$courseshortname</a> ->".
"<a href=\"$CFG->wwwroot/mod/assignment/index.php?id=$course->id\">$strassignments</a> ->".
"<a href=\"$CFG->wwwroot/mod/assignment/view.php?id=$mod->id\">".format_string($submission->name,true)."</a></font></p>";
$posthtml .= "<hr /><font face=\"sans-serif\">";
View
6 mod/chat/gui_ajax/index.php
@@ -44,7 +44,7 @@
if (!$chat_sid = chat_login_user($chat->id, 'ajax', $groupid, $course)) {
print_error('cantlogin', 'chat');
}
-
+$courseshortname = format_string($course->shortname, true, array('context' => get_context_instance(CONTEXT_COURSE, $course->id)));
$module = array(
'name' => 'mod_chat_ajax', // chat gui's are not real plugins, we have to break the naming standards for JS modules here :-(
'fullpath' => '/mod/chat/gui_ajax/module.js',
@@ -61,11 +61,11 @@
'timer'=>3000,
'chat_lasttime'=>0,
'chat_lastrow'=>null,
- 'chatroom_name'=>format_string($course->shortname) . ": ".format_string($chat->name,true).$groupname
+ 'chatroom_name' => $courseshortname . ": " . format_string($chat->name, true) . $groupname
);
$PAGE->requires->js_init_call('M.mod_chat_ajax.init', array($modulecfg), false, $module);
-$PAGE->set_title(get_string('modulename', 'chat').": $course->shortname: ".format_string($chat->name,true)."$groupname");
+$PAGE->set_title(get_string('modulename', 'chat').": $courseshortname: ".format_string($chat->name,true)."$groupname");
$PAGE->add_body_class('yui-skin-sam');
$PAGE->set_pagelayout('embedded');
$PAGE->requires->css('/mod/chat/gui_ajax/theme/'.$theme.'/chat.css');
View
3 mod/chat/gui_header_js/index.php
@@ -59,14 +59,15 @@
$updatemode = $CFG->chat_normal_updatemode;
}
+$courseshortname = format_string($course->shortname, true, array('context' => get_context_instance(CONTEXT_COURSE, $course->id)));
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>
- <?php echo "$strchat: " . format_string($course->shortname) . ": ".format_string($chat->name,true)."$groupname" ?>
+ <?php echo "$strchat: " . $courseshortname . ": " . format_string($chat->name, true, array('context' => $context)) . "$groupname" ?>
</title>
</head>
<frameset cols="*,200" border="5" framespacing="no" frameborder="yes" marginwidth="2" marginheight="1">
View
4 mod/chat/gui_sockets/index.php
@@ -25,6 +25,7 @@
}
require_login($course, false, $cm);
+$context = get_context_instance(CONTEXT_MODULE, $cm->id);
if (isguestuser()) {
print_error('noguests', 'chat');
@@ -52,13 +53,14 @@
}
$params = "chat_sid=$chat_sid";
+$courseshortname = format_string($course->shortname, true, array('context' => get_context_instance(CONTEXT_COURSE, $course->id)));
?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>
- <?php echo "$strchat: " . format_string($course->shortname) . ": ".format_string($chat->name,true)."$groupname" ?>
+ <?php echo "$strchat: " . $courseshortname . ": " . format_string($chat->name, true, array('context' => $context)) . "$groupname" ?>
</title>
</head>
<frameset cols="*,200" border="5" framespacing="no" frameborder="yes" marginwidth="2" marginheight="1">
View
3 mod/chat/view.php
@@ -77,7 +77,8 @@
$strcurrentusers = get_string('currentusers', 'chat');
$strnextsession = get_string('nextsession', 'chat');
-$title = $course->shortname . ': ' . format_string($chat->name);
+$courseshortname = format_string($course->shortname, true, array('context' => get_context_instance(CONTEXT_COURSE, $course->id)));
+$title = $courseshortname . ': ' . format_string($chat->name);
// Mark viewed by user (if required)
$completion = new completion_info($course);
View
5 mod/choice/view.php
@@ -144,10 +144,13 @@
$SESSION->wantsurl = $FULLME;
$SESSION->enrolcancel = (!empty($_SERVER['HTTP_REFERER'])) ? $_SERVER['HTTP_REFERER'] : '';
+ $coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
+ $courseshortname = format_string($course->shortname, true, array('context' => $coursecontext));
+
echo $OUTPUT->box_start('generalbox', 'notice');
echo '<p align="center">'. get_string('notenrolledchoose', 'choice') .'</p>';
echo $OUTPUT->container_start('continuebutton');
- echo $OUTPUT->single_button(new moodle_url('/enrol/index.php?', array('id'=>$course->id)), get_string('enrolme', 'core_enrol', format_string($course->shortname)));
+ echo $OUTPUT->single_button(new moodle_url('/enrol/index.php?', array('id'=>$course->id)), get_string('enrolme', 'core_enrol', $courseshortname));
echo $OUTPUT->container_end();
echo $OUTPUT->box_end();
View
4 mod/data/edit.php
@@ -107,8 +107,8 @@
/// RSS and CSS and JS meta
if (!empty($CFG->enablerssfeeds) && !empty($CFG->data_enablerssfeeds) && $data->rssarticles > 0) {
$rsspath = rss_get_url($context->id, $USER->id, 'mod_data', $data->id);
- $PAGE->add_alternate_version(format_string($course->shortname) . ': %fullname%',
- $rsspath, 'application/rss+xml');
+ $courseshortname = format_string($course->shortname, true, array('context' => get_context_instance(CONTEXT_COURSE, $course->id)));
+ $PAGE->add_alternate_version($courseshortname . ': %fullname%', $rsspath, 'application/rss+xml');
}
if ($data->csstemplate) {
$PAGE->requires->css('/mod/data/css.php?d='.$data->id);
View
6 mod/data/rsslib.php
@@ -78,11 +78,13 @@ function data_rss_get_feed($context, $args) {
array_push($items, $item);
}
$course = $DB->get_record('course', array('id'=>$data->course));
+ $coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
+ $courseshortname = format_string($course->shortname, true, array('context' => $coursecontext));
// First all rss feeds common headers.
- $header = rss_standard_header($course->shortname.': '.format_string($data->name,true),
+ $header = rss_standard_header($courseshortname . ': ' . format_string($data->name, true, array('context' => $context)),
$CFG->wwwroot."/mod/data/view.php?d=".$data->id,
- format_string($data->intro,true)); //TODO: fix format
+ format_text($data->intro, $data->introformat, array('context' => $context)));
if (!empty($header)) {
$articles = rss_add_items($items);
View
6 mod/data/view.php
@@ -276,10 +276,12 @@
$USER->editing = $edit;
}
+ $courseshortname = format_string($course->shortname, true, array('context' => get_context_instance(CONTEXT_COURSE, $course->id)));
+
/// RSS and CSS and JS meta
$meta = '';
if (!empty($CFG->enablerssfeeds) && !empty($CFG->data_enablerssfeeds) && $data->rssarticles > 0) {
- $rsstitle = format_string($course->shortname) . ': %fullname%';
+ $rsstitle = $courseshortname . ': %fullname%';
rss_add_http_header($context, 'mod_data', $data, $rsstitle);
}
if ($data->csstemplate) {
@@ -296,7 +298,7 @@
/// Print the page header
// Note: MDL-19010 there will be further changes to printing header and blocks.
// The code will be much nicer than this eventually.
- $title = $course->shortname.': ' . format_string($data->name);
+ $title = $courseshortname.': ' . format_string($data->name);
if ($PAGE->user_allowed_editing()) {
$buttons = '<table><tr><td><form method="get" action="view.php"><div>'.
View
21 mod/feedback/analysis_course.php
@@ -120,16 +120,17 @@
GROUP BY course_id, shortname
ORDER BY avgvalue desc",
array($courseitemfiltertyp, $courseitemfilter))) {
- $item = $DB->get_record('feedback_item', array('id'=>$courseitemfilter));
- echo '<tr><th colspan="2">'.$item->name.'</th></tr>';
- echo '<tr><td><table align="left">';
- echo '<tr><th>Course</th><th>Average</th></tr>';
- $sep_dec = get_string('separator_decimal', 'feedback');
- $sep_thous = get_string('separator_thousand', 'feedback');
-
- foreach ($courses as $c) {
- echo '<tr><td>'.$c->shortname.'</td><td align="right">'.number_format(($c->avgvalue), 2, $sep_dec, $sep_thous).'</td></tr>';
- }
+ $item = $DB->get_record('feedback_item', array('id'=>$courseitemfilter));
+ echo '<tr><th colspan="2">'.$item->name.'</th></tr>';
+ echo '<tr><td><table align="left">';
+ echo '<tr><th>Course</th><th>Average</th></tr>';
+ $sep_dec = get_string('separator_decimal', 'feedback');
+ $sep_thous = get_string('separator_thousand', 'feedback');
+
+ foreach ($courses as $c) {
+ $shortname = format_string($c->shortname, true, array('context' => get_context_instance(CONTEXT_COURSE, $c->course_id)));
+ echo '<tr><td>'.$shortname.'</td><td align="right">'.number_format(($c->avgvalue), 2, $sep_dec, $sep_thous).'</td></tr>';
+ }
echo '</table></td></tr>';
} else {
echo '<tr><td>'.get_string('noresults').'</td></tr>';
View
5 mod/feedback/analysis_to_excel.php
@@ -310,8 +310,9 @@ function feedback_excelprint_detailed_items(&$worksheet, $xlsFormats, $completed
}
$worksheet->write_number($rowOffset, $colOffset, $courseid, $xlsFormats->default);
$colOffset++;
- if(isset($courseid) AND $course = $DB->get_record('course', array('id'=>$courseid))) {
- $worksheet->write_string($rowOffset, $colOffset, $course->shortname, $xlsFormats->default);
+ if (isset($courseid) AND $course = $DB->get_record('course', array('id' => $courseid))) {
+ $shortname = format_string($course->shortname, true, array('context' => get_context_instance(CONTEXT_COURSE, $courseid)));
+ $worksheet->write_string($rowOffset, $colOffset, $shortname, $xlsFormats->default);
}
return $rowOffset + 1;
}
View
6 mod/feedback/item/info/lib.php
@@ -183,7 +183,8 @@ function print_item_preview($item) {
$itemshowvalue = UserDate($itemvalue);
break;
case 2:
- $itemvalue = $course->shortname;
+ $coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
+ $itemvalue = format_string($course->shortname, true, array('context' => $coursecontext));
$itemshowvalue = $itemvalue;
break;
case 3:
@@ -239,7 +240,8 @@ function print_item_complete($item, $value = '', $highlightrequire = false) {
$itemshowvalue = UserDate($itemvalue);
break;
case 2:
- $itemvalue = $course->shortname;
+ $coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
+ $itemvalue = format_string($course->shortname, true, array('context' => $coursecontext));
$itemshowvalue = $itemvalue;
break;
case 3:
View
9 mod/feedback/lib.php
@@ -2684,7 +2684,9 @@ function feedback_send_email_anonym($cm, $feedback, $course) {
* @return string the text you want to post
*/
function feedback_send_email_text($info, $course) {
- $posttext = $course->shortname.' -> '.get_string('modulenameplural', 'feedback').' -> '.
+ $coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
+ $courseshortname = format_string($course->shortname, true, array('context' => $coursecontext));
+ $posttext = $courseshortname.' -> '.get_string('modulenameplural', 'feedback').' -> '.
$info->feedback."\n";
$posttext .= '---------------------------------------------------------------------'."\n";
$posttext .= get_string("emailteachermail", "feedback", $info)."\n";
@@ -2703,8 +2705,11 @@ function feedback_send_email_text($info, $course) {
*/
function feedback_send_email_html($info, $course, $cm) {
global $CFG;
+ $coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
+ $courseshortname = format_string($course->shortname, true, array('context' => $coursecontext));
+
$posthtml = '<p><font face="sans-serif">'.
- '<a href="'.$CFG->wwwroot.'/course/view.php?id='.$course->id.'">'.$course->shortname.'</a> ->'.
+ '<a href="'.$CFG->wwwroot.'/course/view.php?id='.$course->id.'">'.$courseshortname.'</a> ->'.
'<a href="'.$CFG->wwwroot.'/mod/feedback/index.php?id='.$course->id.'">'.get_string('modulenameplural', 'feedback').'</a> ->'.
'<a href="'.$CFG->wwwroot.'/mod/feedback/view.php?id='.$cm->id.'">'.$info->feedback.'</a></font></p>';
$posthtml .= '<hr /><font face="sans-serif">';
View
4 mod/feedback/mapcourse.php
@@ -115,8 +115,10 @@
$unmapurl = new moodle_url('/mod/feedback/unmapcourse.php');
foreach ($coursemap as $cmap) {
+ $cmapcontext = get_context_instance(CONTEXT_COURSE, $cmap->id);
+ $cmapshortname = format_string($cmap->shortname, true, array('context' => $cmapcontext));
$unmapurl->params(array('id'=>$id, 'cmapid'=>$cmap->id));
- $table->add_data(array('<a href="'.$unmapurl->out().'"><img src="'.$OUTPUT->pix_url('t/delete') . '" alt="Delete" /></a> ('.$cmap->shortname.') '.$cmap->fullname));
+ $table->add_data(array('<a href="'.$unmapurl->out().'"><img src="'.$OUTPUT->pix_url('t/delete') . '" alt="Delete" /></a> ('.$cmapshortname.') '.$cmap->fullname));
}
$table->print_html();
View
2 mod/forum/discuss.php