MDL-56656 messages: Proper multilang formating in messaging pages

This commit is contained in:
Ankit Agarwal 2016-11-21 15:19:08 +05:30
parent 873a7e1e86
commit 7597ab0b99
2 changed files with 12 additions and 6 deletions

View File

@ -56,9 +56,9 @@ class user_search_results implements templatable, renderable {
/**
* Constructor.
*
* @param array $contacts
* @param array $courses
* @param array $noncontacts
* @param array $contacts list of contacts.
* @param array $courses list of courses.
* @param array $noncontacts list of nonconcat users.
*/
public function __construct($contacts, $courses = array(), $noncontacts = array()) {
$this->contacts = $contacts;
@ -88,7 +88,13 @@ class user_search_results implements templatable, renderable {
// Check if there are any courses.
if (!empty($this->courses)) {
$data->hascourses = true;
$data->courses = $this->courses;
$data->courses = [];
foreach ($this->courses as $course) {
$coursecontext = \context_course::instance($course->id);
$course->shortname = external_format_string($course->shortname, $coursecontext->id, true);
$course->fullname = external_format_string($course->fullname, $coursecontext->id, true);
$data->courses[] = $course;
}
}
// Check if there are any non-contacts.

View File

@ -670,8 +670,8 @@ class core_message_external extends external_api {
new external_single_structure(
array(
'id' => new external_value(PARAM_INT, 'The course id'),
'shortname' => new external_value(PARAM_NOTAGS, 'The course shortname'),
'fullname' => new external_value(PARAM_NOTAGS, 'The course fullname'),
'shortname' => new external_value(PARAM_TEXT, 'The course shortname'),
'fullname' => new external_value(PARAM_TEXT, 'The course fullname'),
)
)
),