MDL-29189 mutlilang Reviewed the uses of course shortname and ensured things are being formatted consistently

This commit is contained in:
Sam Hemelryk 2011-09-07 11:46:28 +12:00
parent 5d2db8acc8
commit 8ebbb06adf
70 changed files with 295 additions and 166 deletions

View File

@ -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 File

@ -214,6 +214,8 @@ abstract class backup_plan_dbops extends backup_dbops {
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 File

@ -197,7 +197,7 @@ abstract class backup_cron_automated_helper {
//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 File

@ -523,7 +523,7 @@ class core_backup_renderer extends plugin_renderer_base {
}
$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 @@ class core_backup_renderer extends plugin_renderer_base {
}
$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 File

@ -36,8 +36,9 @@ class block_course_list extends block_list {
!(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 @@ class block_course_list extends block_list {
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 @@ class block_course_list extends block_list {
$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 File

@ -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,9 +790,10 @@ 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));
@ -799,13 +801,15 @@ function blog_get_headers($courseid=null, $groupid=null, $userid=null, $tagid=nu
// 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,6 +856,8 @@ 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);
@ -857,8 +865,8 @@ function blog_get_headers($courseid=null, $groupid=null, $userid=null, $tagid=nu
$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,6 +879,8 @@ 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);
@ -878,8 +888,8 @@ function blog_get_headers($courseid=null, $groupid=null, $userid=null, $tagid=nu
$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 File

@ -140,7 +140,8 @@ foreach($events as $event) {
$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 File

@ -692,7 +692,8 @@ class core_calendar_renderer extends plugin_renderer_base {
$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 File

@ -30,12 +30,13 @@
}
$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);
@ -43,7 +44,7 @@
$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 File

@ -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 File

@ -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);
@ -3254,7 +3260,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 (strlen($str) <= $max) {
return $str;
}

View File

@ -37,6 +37,8 @@ $huburl = optional_param('huburl', 0, PARAM_URL);
$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 @@ if (!extension_loaded('xmlrpc')) {
$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 @@ if (has_capability('moodle/course:publish', get_context_instance(CONTEXT_COURSE,
} 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 @@ if (has_capability('moodle/course:publish', get_context_instance(CONTEXT_COURSE,
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 File

@ -53,8 +53,10 @@ $PAGE->set_heading($course->fullname);
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 File

@ -143,8 +143,10 @@ if (!$csv) {
* 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 @@ if(!$csv) {
// 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 File

@ -120,7 +120,7 @@ switch ($type) {
$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 @@ switch ($type) {
$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 File

@ -108,8 +108,11 @@ if ($total) {
}
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 File

@ -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 File

@ -232,6 +232,7 @@ 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';
@ -239,7 +240,7 @@ function send_welcome_messages($orderdata) {
$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 File

@ -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_USER, $USER->id);
$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);
@ -61,11 +63,11 @@ function authorize_print_orders($courseid, $userid) {
$buttons .= "<input type='submit' value='$strs->search' />";
$buttons .= "</div></form>";
if (has_capability('enrol/authorize:uploadcsv', get_context_instance(CONTEXT_USER, $USER->id))) {
if (has_capability('enrol/authorize:uploadcsv', $coursecontext)) {
$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 File

@ -276,6 +276,7 @@ class enrol_flatfile_plugin extends enrol_plugin {
$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';
@ -283,7 +284,7 @@ class enrol_flatfile_plugin extends enrol_plugin {
$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,6 +299,7 @@ class enrol_flatfile_plugin extends enrol_plugin {
$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';
@ -305,7 +307,7 @@ class enrol_flatfile_plugin extends enrol_plugin {
$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 File

@ -448,19 +448,20 @@ class enrol_ldap_plugin extends enrol_plugin {
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 File

@ -54,7 +54,7 @@ class enrol_meta_addinstance_form extends moodleform {
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 File

@ -228,6 +228,8 @@ while (!feof($fp)) {
$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 @@ while (!feof($fp)) {
$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 @@ while (!feof($fp)) {
$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 @@ while (!feof($fp)) {
$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 File

@ -151,11 +151,12 @@ class enrol_paypal_plugin extends enrol_plugin {
}
$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 @@ class enrol_paypal_plugin extends enrol_plugin {
} 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 File

@ -32,8 +32,10 @@ class grade_export_ods extends grade_export {
$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 File

@ -66,7 +66,8 @@ class grade_export_txt extends grade_export {
@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 File

@ -33,7 +33,8 @@ class grade_export_xls extends grade_export {
$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 File

@ -38,7 +38,8 @@ class grade_export_xml extends grade_export {
$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_upload_directory('temp/gradeexport');
$tempfilename = $CFG->dataroot .'/temp/gradeexport/'. md5(sesskey().microtime().$downloadfilename);

View File

@ -119,8 +119,10 @@ class grade_report_overview extends grade_report {
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 File

@ -155,7 +155,7 @@ if (ajaxenabled()) {
$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 File

@ -114,7 +114,7 @@ $currenttab = 'overview';
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 File

@ -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 File

@ -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 File

@ -2030,7 +2030,8 @@ class global_navigation extends navigation_node {
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 @@ class global_navigation extends navigation_node {
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 File

@ -545,7 +545,7 @@ class core_renderer extends renderer_base {
} 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 File

@ -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 File

@ -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 @@ class assignment_base {
} 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' => $coursecontext));
if ($assignment) {
$this->assignment = $assignment;
@ -133,7 +137,7 @@ class assignment_base {
$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 @@ class assignment_base {
* @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 @@ class assignment_base {
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 File

@ -44,7 +44,7 @@ if (!file_exists(dirname(__FILE__) . '/theme/'.$theme.'/chat.css')) {
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 @@ $modulecfg = array(
'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 File

@ -59,6 +59,7 @@ if (!empty($CFG->chat_normal_updatemode)) {
$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">
@ -66,7 +67,7 @@ if (!empty($CFG->chat_normal_updatemode)) {
<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 File

@ -25,6 +25,7 @@ if (!$cm = get_coursemodule_from_instance('chat', $chat->id, $course->id)) {
}
require_login($course, false, $cm);
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
if (isguestuser()) {
print_error('noguests', 'chat');
@ -52,13 +53,14 @@ if (!$chat_sid = chat_login_user($chat->id, 'sockets', $groupid, $course)) {
}
$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 File

@ -77,7 +77,8 @@ $stridle = get_string('idle', 'chat');
$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 File

@ -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 File

@ -107,8 +107,8 @@ if ($cancel) {
/// 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 File

@ -78,11 +78,13 @@
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 File

@ -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 File

@ -120,16 +120,17 @@ if ($courseitemfilter > 0) {
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');
$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>';
}
foreach ($courses as $c) {
$shortname = format_string($course->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 File

@ -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 File

@ -183,7 +183,8 @@ class feedback_item_info extends feedback_item_base {
$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 @@ class feedback_item_info extends feedback_item_base {
$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 File

@ -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 File

@ -115,8 +115,10 @@ if($coursemap = feedback_get_courses_from_sitecourse_map($feedback->id)) {
$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' => $coursecontext));
$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 File

@ -60,7 +60,7 @@
if (!empty($CFG->enablerssfeeds) && !empty($CFG->forum_enablerssfeeds) && $forum->rsstype && $forum->rssarticles) {
require_once("$CFG->libdir/rsslib.php");
$rsstitle = format_string($course->shortname) . ': %fullname%';
$rsstitle = format_string($course->shortname, true, array('context' => get_context_instance(CONTEXT_COURSE, $course->id))) . ': %fullname%';
rss_add_http_header($modcontext, 'mod_forum', $forum, $rsstitle);
}

View File

@ -175,12 +175,13 @@ if (!is_null($subscribe) and !isguestuser()) {
}
}
$returnto = forum_go_back_to("index.php?id=$course->id");
$shortname = format_string($course->shortname, true, array('context' => get_context_instance(CONTEXT_COURSE, $course->id)));
if ($subscribe) {
add_to_log($course->id, 'forum', 'subscribeall', "index.php?id=$course->id", $course->id);
redirect($returnto, get_string('nowallsubscribed', 'forum', format_string($course->shortname)), 1);
redirect($returnto, get_string('nowallsubscribed', 'forum', $shortname), 1);
} else {
add_to_log($course->id, 'forum', 'unsubscribeall', "index.php?id=$course->id", $course->id);
redirect($returnto, get_string('nowallunsubscribed', 'forum', format_string($course->shortname)), 1);
redirect($returnto, get_string('nowallunsubscribed', 'forum', $shortname), 1);
}
}

View File

@ -610,7 +610,9 @@ function forum_cron() {
$userfrom->customheaders[] = 'References: <moodlepost'.$post->parent.'@'.$hostname.'>';
}
$postsubject = "$course->shortname: ".format_string($post->subject,true);
$shortname = format_string($course->shortname, true, array('context' => get_context_instance(CONTEXT_COURSE, $course->id)));
$postsubject = "$shortname: ".format_string($post->subject,true);
$posttext = forum_make_mail_text($course, $cm, $forum, $discussion, $post, $userfrom, $userto);
$posthtml = forum_make_mail_html($course, $cm, $forum, $discussion, $post, $userfrom, $userto);
@ -631,7 +633,7 @@ function forum_cron() {
$smallmessagestrings = new stdClass();
$smallmessagestrings->user = fullname($userfrom);
$smallmessagestrings->forumname = "{$course->shortname}: ".format_string($forum->name,true).": ".$discussion->name;
$smallmessagestrings->forumname = "$shortname: ".format_string($forum->name,true).": ".$discussion->name;
$smallmessagestrings->message = $post->message;
//make sure strings are in message recipients language
$eventdata->smallmessage = get_string_manager()->get_string('smallmessage', 'forum', $smallmessagestrings, $userto->lang);
@ -833,18 +835,19 @@ function forum_cron() {
$strforums = get_string('forums', 'forum');
$canunsubscribe = ! forum_is_forcesubscribed($forum);
$canreply = $userto->canpost[$discussion->id];
$shortname = format_string($course->shortname, true, array('context' => get_context_instance(CONTEXT_COURSE, $course->id)));
$posttext .= "\n \n";
$posttext .= '=====================================================================';
$posttext .= "\n \n";
$posttext .= "$course->shortname -> $strforums -> ".format_string($forum->name,true);
$posttext .= "$shortname -> $strforums -> ".format_string($forum->name,true);
if ($discussion->name != $forum->name) {
$posttext .= " -> ".format_string($discussion->name,true);
}
$posttext .= "\n";
$posthtml .= "<p><font face=\"sans-serif\">".
"<a target=\"_blank\" href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</a> -> ".
"<a target=\"_blank\" href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$shortname</a> -> ".
"<a target=\"_blank\" href=\"$CFG->wwwroot/mod/forum/index.php?id=$course->id\">$strforums</a> -> ".
"<a target=\"_blank\" href=\"$CFG->wwwroot/mod/forum/view.php?f=$forum->id\">".format_string($forum->name,true)."</a>";
if ($discussion->name == $forum->name) {
@ -1005,7 +1008,8 @@ function forum_make_mail_text($course, $cm, $forum, $discussion, $post, $userfro
$posttext = '';
if (!$bare) {
$posttext = "$course->shortname -> $strforums -> ".format_string($forum->name,true);
$shortname = format_string($course->shortname, true, array('context' => get_context_instance(CONTEXT_COURSE, $course->id)));
$posttext = "$shortname -> $strforums -> ".format_string($forum->name,true);
if ($discussion->name != $forum->name) {
$posttext .= " -> ".format_string($discussion->name,true);
@ -1028,7 +1032,7 @@ function forum_make_mail_text($course, $cm, $forum, $discussion, $post, $userfro
if (!$bare && $canreply) {
$posttext .= "---------------------------------------------------------------------\n";
$posttext .= get_string("postmailinfo", "forum", $course->shortname)."\n";
$posttext .= get_string("postmailinfo", "forum", $shortname)."\n";
$posttext .= "$CFG->wwwroot/mod/forum/post.php?reply=$post->id\n";
}
if (!$bare && $canunsubscribe) {
@ -1068,6 +1072,7 @@ function forum_make_mail_html($course, $cm, $forum, $discussion, $post, $userfro
$strforums = get_string('forums', 'forum');
$canunsubscribe = ! forum_is_forcesubscribed($forum);
$shortname = format_string($course->shortname, true, array('context' => get_context_instance(CONTEXT_COURSE, $course->id)));
$posthtml = '<head>';
/* foreach ($CFG->stylesheets as $stylesheet) {
@ -1078,7 +1083,7 @@ function forum_make_mail_html($course, $cm, $forum, $discussion, $post, $userfro
$posthtml .= "\n<body id=\"email\">\n\n";
$posthtml .= '<div class="navbar">'.
'<a target="_blank" href="'.$CFG->wwwroot.'/course/view.php?id='.$course->id.'">'.$course->shortname.'</a> &raquo; '.
'<a target="_blank" href="'.$CFG->wwwroot.'/course/view.php?id='.$course->id.'">'.$shortname.'</a> &raquo; '.
'<a target="_blank" href="'.$CFG->wwwroot.'/mod/forum/index.php?id='.$course->id.'">'.$strforums.'</a> &raquo; '.
'<a target="_blank" href="'.$CFG->wwwroot.'/mod/forum/view.php?f='.$forum->id.'">'.format_string($forum->name,true).'</a>';
if ($discussion->name == $forum->name) {

View File

@ -96,7 +96,7 @@
if (!empty($CFG->enablerssfeeds) && !empty($CFG->forum_enablerssfeeds) && $forum->rsstype && $forum->rssarticles) {
require_once("$CFG->libdir/rsslib.php");
$rsstitle = format_string($course->shortname) . ': %fullname%';
$rsstitle = format_string($course->shortname, true, array('context' => get_context_instance(CONTEXT_COURSE, $course->id))) . ': %fullname%';
rss_add_http_header($context, 'mod_forum', $forum, $rsstitle);
}

View File

@ -248,7 +248,7 @@ $PAGE->set_url($url);
if (!empty($CFG->enablerssfeeds) && !empty($CFG->glossary_enablerssfeeds)
&& $glossary->rsstype && $glossary->rssarticles) {
$rsstitle = format_string($course->shortname) . ': %fullname%';
$rsstitle = format_string($course->shortname, true, array('context' => get_context_instance(CONTEXT_COURSE, $course->id))) . ': %fullname%';
rss_add_http_header($context, 'mod_glossary', $glossary, $rsstitle);
}

View File

@ -116,6 +116,12 @@ class quiz_overview_report extends quiz_attempt_report {
$allowed = array();
}
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
$courseshortname = format_string($course->shortname, true, array('context' => $coursecontext));
$displaycoursecontext = get_context_instance(CONTEXT_COURSE, $COURSE->id);
$displaycourseshortname = format_string($COURSE->shortname, true, array('context' => $displaycoursecontext));
// Load the required questions.
$questions = quiz_report_get_significant_questions($quiz);
@ -123,9 +129,9 @@ class quiz_overview_report extends quiz_attempt_report {
$groupstudents, $students, $detailedmarks, $questions, $candelete,
$reporturl, $displayoptions);
$filename = quiz_report_download_filename(get_string('overviewfilename', 'quiz_overview'),
$course->shortname, $quiz->name);
$courseshortname, $quiz->name);
$table->is_downloading($download, $filename,
$COURSE->shortname . ' ' . format_string($quiz->name, true));
$displaycourseshortname . ' ' . format_string($quiz->name, true));
if ($table->is_downloading()) {
raise_memory_limit(MEMORY_EXTRA);
}

View File

@ -133,12 +133,18 @@ class quiz_responses_report extends quiz_attempt_report {
// Load the required questions.
$questions = quiz_report_get_significant_questions($quiz);
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
$courseshortname = format_string($course->shortname, true, array('context' => $coursecontext));
$displaycoursecontext = get_context_instance(CONTEXT_COURSE, $COURSE->id);
$displaycourseshortname = format_string($COURSE->shortname, true, array('context' => $displaycoursecontext));
$table = new quiz_report_responses_table($quiz, $this->context, $qmsubselect,
$groupstudents, $students, $questions, $candelete, $reporturl, $displayoptions);
$filename = quiz_report_download_filename(get_string('responsesfilename', 'quiz_responses'),
$course->shortname, $quiz->name);
$courseshortname, $quiz->name);
$table->is_downloading($download, $filename,
$COURSE->shortname . ' ' . format_string($quiz->name, true));
$displaycourseshortname . ' ' . format_string($quiz->name, true));
if ($table->is_downloading()) {
raise_memory_limit(MEMORY_EXTRA);
}

View File

@ -115,7 +115,9 @@ class quiz_statistics_report extends quiz_default_report {
} else {
$report = get_string('questionstatsfilename', 'quiz_statistics');
}
$filename = quiz_report_download_filename($report, $course->shortname, $quiz->name);
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
$courseshortname = format_string($course->shortname, true, array('context' => $coursecontext));
$filename = quiz_report_download_filename($report, $courseshortname, $quiz->name);
$this->table->is_downloading($download, $filename,
get_string('quizstructureanalysis', 'quiz_statistics'));

View File

@ -81,15 +81,17 @@ $strscorm = get_string('modulename', 'scorm');
$strpopup = get_string('popup', 'scorm');
$strexit = get_string('exitactivity', 'scorm');
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
if ($displaymode == 'popup') {
$PAGE->set_pagelayout('popup');
} else {
$pagetitle = strip_tags("$course->shortname: ".format_string($scorm->name));
$shortname = format_string($course->shortname, true, array('context' => $coursecontext));
$pagetitle = strip_tags("$shortname: ".format_string($scorm->name));
$PAGE->set_title($pagetitle);
$PAGE->set_heading($course->fullname);
}
if (!$cm->visible and !has_capability('moodle/course:viewhiddenactivities', get_context_instance(CONTEXT_COURSE, $course->id))) {
if (!$cm->visible and !has_capability('moodle/course:viewhiddenactivities', $coursecontext)) {
echo $OUTPUT->header();
notice(get_string("activityiscurrentlyhidden"));
echo $OUTPUT->footer();

View File

@ -99,7 +99,9 @@ class scorm_basic_report extends scorm_default_report {
if ( !$nostudents ) {
// Now check if asked download of data
if ($download) {
$filename = clean_filename("$course->shortname ".format_string($scorm->name, true));
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
$shortname = format_string($course->shortname, true, array('context' => $coursecontext));
$filename = clean_filename("$shortname ".format_string($scorm->name, true));
}
// Define table columns

View File

@ -67,7 +67,8 @@ if (isset($SESSION->scorm_scoid)) {
$strscorms = get_string("modulenameplural", "scorm");
$strscorm = get_string("modulename", "scorm");
$pagetitle = strip_tags($course->shortname.': '.format_string($scorm->name));
$shortname = format_string($course->shortname, true, array('context' => $context));
$pagetitle = strip_tags($shortname.': '.format_string($scorm->name));
add_to_log($course->id, 'scorm', 'pre-view', 'view.php?id='.$cm->id, "$scorm->id", $cm->id);

View File

@ -146,12 +146,14 @@ foreach ($surveyanswers as $surveyanswer) {
}
// Output the file as a valid ODS spreadsheet if required
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
$courseshortname = format_string($course->shortname, true, array('context' => $coursecontext));
if ($type == "ods") {
require_once("$CFG->libdir/odslib.class.php");
/// Calculate file name
$downloadfilename = clean_filename("$course->shortname ".strip_tags(format_string($survey->name,true))).'.ods';
$downloadfilename = clean_filename(strip_tags($courseshortname.' '.format_string($survey->name, true))).'.ods';
/// Creating a workbook
$workbook = new MoodleODSWorkbook("-");
/// Sending HTTP headers
@ -226,7 +228,7 @@ if ($type == "xls") {
require_once("$CFG->libdir/excellib.class.php");
/// Calculate file name
$downloadfilename = clean_filename("$course->shortname ".strip_tags(format_string($survey->name,true))).'.xls';
$downloadfilename = clean_filename(strip_tags($courseshortname.' '.format_string($survey->name,true))).'.xls';
/// Creating a workbook
$workbook = new MoodleExcelWorkbook("-");
/// Sending HTTP headers
@ -304,7 +306,7 @@ if ($type == "xls") {
header("Content-Type: application/download\n");
$downloadfilename = clean_filename("$course->shortname ".strip_tags(format_string($survey->name,true)));
$downloadfilename = clean_filename(strip_tags($courseshortname.' '.format_string($survey->name,true)));
header("Content-Disposition: attachment; filename=\"$downloadfilename.txt\"");
// Print names of all the fields

View File

@ -152,7 +152,9 @@ function url_display_frame($url, $cm, $course) {
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
$exteurl = url_get_full_url($url, $cm, $course, $config);
$navurl = "$CFG->wwwroot/mod/url/view.php?id=$cm->id&amp;frameset=top";
$title = strip_tags(format_string($course->shortname.': '.$url->name));
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
$courseshortname = format_string($course->shortname, true, array('context' => $coursecontext));
$title = strip_tags($courseshortname.': '.format_string($url->name));
$framesize = $config->framesize;
$modulename = s(get_string('modulename','url'));
$dir = get_string('thisdirection', 'langconfig');
@ -405,10 +407,12 @@ function url_get_variable_values($url, $cm, $course, $config) {
$site = get_site();
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
$values = array (
'courseid' => $course->id,
'coursefullname' => format_string($course->fullname),
'courseshortname' => $course->shortname,
'courseshortname' => format_string($course->shortname, true, array('context' => $coursecontext)),
'courseidnumber' => $course->idnumber,
'coursesummary' => $course->summary,
'courseformat' => $course->format,

View File

@ -96,7 +96,7 @@ echo $OUTPUT->header();
if ($userid) {
echo $OUTPUT->heading(fullname($user).': '.$strnotes);
} else {
echo $OUTPUT->heading($course->shortname.': '.$strnotes);
echo $OUTPUT->heading(format_string($course->shortname, true, array('context' => $coursecontext)).': '.$strnotes);
}
$strsitenotes = get_string('sitenotes', 'notes');

View File

@ -160,7 +160,7 @@ class repository_coursefiles extends repository {
public function get_name() {
list($context, $course, $cm) = get_context_info_array($this->context->id);
if (!empty($course)) {
return get_string('courselegacyfiles') . $course->shortname;
return get_string('courselegacyfiles') . format_string($course->shortname, true, array('context' => get_course_context($context)));
} else {
return get_string('courselegacyfiles');
}

View File

@ -67,7 +67,7 @@ if ($data = data_submitted()) {
// The title and breadcrumb
$title = get_string('edittitle', $tagslang);
$coursefullname = format_string($course->fullname);
$courseshortname = format_string($course->shortname);
$courseshortname = format_string($course->shortname, true, array('context' => get_context_instance(CONTEXT_COURSE, $course->id)));
$PAGE->navbar->add($title);
$PAGE->set_title($title);
$PAGE->set_heading($course->fullname);

View File

@ -67,7 +67,8 @@ $welcome = get_string('morewelcome', $tagslang);
// The title and breadcrumb
if ($courseid) {
$PAGE->navbar->add(format_string($course->shortname), new moodle_url('/course/view.php', array('id'=>$courseid)));
$courseshortname = format_string($course->shortname, true, array('context' => get_context_instance(CONTEXT_COURSE, $courseid)));
$PAGE->navbar->add($courseshortname, new moodle_url('/course/view.php', array('id'=>$courseid)));
}
$PAGE->navbar->add($title);
$PAGE->set_title($title);

View File

@ -203,11 +203,12 @@
$courselist = array();
$popupurl = new moodle_url('/user/index.php?roleid='.$roleid.'&sifirst=&silast=');
foreach ($mycourses as $mycourse) {
$courselist[$mycourse->id] = format_string($mycourse->shortname);
$coursecontext = get_context_instance(CONTEXT_COURSE, $mycourse->id);
$courselist[$mycourse->id] = format_string($mycourse->shortname, true, array('context' => $coursecontext));
}
if (has_capability('moodle/site:viewparticipants', $systemcontext)) {
unset($courselist[SITEID]);
$courselist = array(SITEID => format_string($SITE->shortname)) + $courselist;
$courselist = array(SITEID => format_string($SITE->shortname, true, array('context' => $systemcontext))) + $courselist;
}
$select = new single_select($popupurl, 'id', $courselist, $course->id, array(''=>'choosedots'), 'courseform');
$select->set_label(get_string('mycourses'));

View File

@ -316,10 +316,11 @@ function user_get_user_details($user, $course = null) {
if ($mycourses = enrol_get_users_courses($user->id, true)) {
foreach ($mycourses as $mycourse) {
if ($mycourse->category) {
$coursecontext = get_context_instance(CONTEXT_COURSE, $mycourse->id);
$enrolledcourse = array();
$enrolledcourse['id'] = $mycourse->id;
$enrolledcourse['fullname'] = $mycourse->fullname;
$enrolledcourse['shortname'] = $mycourse->shortname;
$enrolledcourse['shortname'] = format_string($mycourse->shortname, true, array('context' => $coursecontext));
$enrolledcourses[] = $enrolledcourse;
}
}

View File

@ -174,7 +174,7 @@ echo $OUTPUT->header();
echo '<div class="userprofile">';
echo $OUTPUT->heading(fullname($user).' ('.$course->shortname.')');
echo $OUTPUT->heading(fullname($user).' ('.format_string($course->shortname, true, array('context' => $coursecontext)).')');
if ($user->deleted) {
echo $OUTPUT->heading(get_string('userdeleted'));