mirror of
https://github.com/moodle/moodle.git
synced 2025-03-14 12:40:01 +01:00
MDL-55942 core_message: renamed the term 'people' to 'user'
This commit is contained in:
parent
66e1bdda3f
commit
48e8bdba13
@ -152,8 +152,8 @@ $string['removefromyourcontacts'] = 'Remove from your contacts';
|
||||
$string['requiresconfiguration'] = 'Requires configuration';
|
||||
$string['savemysettings'] = 'Save my settings';
|
||||
$string['search'] = 'Search';
|
||||
$string['searchforperson'] = 'Search for a person';
|
||||
$string['searchforpersonorcourse'] = 'Search for a person or course';
|
||||
$string['searchforuser'] = 'Search for a user';
|
||||
$string['searchforuserorcourse'] = 'Search for a user or course';
|
||||
$string['searchmessages'] = 'Search messages';
|
||||
$string['searchcombined'] = 'Search people and messages';
|
||||
$string['selectmessagestodelete'] = 'Select messages to delete';
|
||||
|
@ -659,17 +659,17 @@ $functions = array(
|
||||
'type' => 'read',
|
||||
'ajax' => true,
|
||||
),
|
||||
'core_message_data_for_messagearea_search_people' => array(
|
||||
'core_message_data_for_messagearea_search_users' => array(
|
||||
'classname' => 'core_message_external',
|
||||
'methodname' => 'data_for_messagearea_search_people',
|
||||
'methodname' => 'data_for_messagearea_search_users',
|
||||
'classpath' => 'message/externallib.php',
|
||||
'description' => 'Retrieve the template data for searching for people',
|
||||
'type' => 'read',
|
||||
'ajax' => true,
|
||||
),
|
||||
'core_message_data_for_messagearea_search_people_in_course' => array(
|
||||
'core_message_data_for_messagearea_search_users_in_course' => array(
|
||||
'classname' => 'core_message_external',
|
||||
'methodname' => 'data_for_messagearea_search_people_in_course',
|
||||
'methodname' => 'data_for_messagearea_search_users_in_course',
|
||||
'classpath' => 'message/externallib.php',
|
||||
'description' => 'Retrieve the template data for searching for people in a course',
|
||||
'type' => 'read',
|
||||
|
@ -74,9 +74,9 @@ define(['jquery', 'core_message/message_area_contacts', 'core_message/message_ar
|
||||
SEARCHBOX: "[data-region='search-box']",
|
||||
SEARCHFILTER: "[data-region='search-filter']",
|
||||
SEARCHFILTERAREA: "[data-region='search-filter-area']",
|
||||
SEARCHPEOPLEINCOURSE: "[data-action='search-people-in-course']",
|
||||
SEARCHRESULTSAREA: "[data-region='search-results-area']",
|
||||
SEARCHTEXTAREA: "[data-region='search-text-area']",
|
||||
SEARCHUSERSINCOURSE: "[data-action='search-users-in-course']",
|
||||
SELECTEDVIEWPROFILE: "[data-action='view-contact-profile'].selected",
|
||||
SELECTEDVIEWCONVERSATION: "[data-action='view-contact-msg'].selected",
|
||||
SENDMESSAGE: "[data-action='send-message']",
|
||||
@ -106,8 +106,8 @@ define(['jquery', 'core_message/message_area_contacts', 'core_message/message_ar
|
||||
MESSAGESDELETED: 'messages-deleted',
|
||||
MESSAGESEARCHCANCELED: 'message-search-canceled',
|
||||
MESSAGESENT: 'message-sent',
|
||||
PEOPLESEARCHCANCELED: 'people-search-canceled',
|
||||
SENDMESSAGE: 'message-send'
|
||||
SENDMESSAGE: 'message-send',
|
||||
USERSSEARCHCANCELED: 'users-search-canceled'
|
||||
};
|
||||
|
||||
/** @type {jQuery} The jQuery node for the page region containing the message area. */
|
||||
|
@ -74,7 +74,7 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/notification', 'core/cust
|
||||
]);
|
||||
|
||||
this.messageArea.onCustomEvent(this.messageArea.EVENTS.MESSAGESEARCHCANCELED, this._viewConversations.bind(this));
|
||||
this.messageArea.onCustomEvent(this.messageArea.EVENTS.PEOPLESEARCHCANCELED, this._viewContacts.bind(this));
|
||||
this.messageArea.onCustomEvent(this.messageArea.EVENTS.USERSSEARCHCANCELED, this._viewContacts.bind(this));
|
||||
this.messageArea.onCustomEvent(this.messageArea.EVENTS.CONTACTSSELECTED, this._viewContacts.bind(this));
|
||||
this.messageArea.onCustomEvent(this.messageArea.EVENTS.CONVERSATIONDELETED, this._deleteConversation.bind(this));
|
||||
this.messageArea.onCustomEvent(this.messageArea.EVENTS.CONVERSATIONSSELECTED, this._viewConversations.bind(this));
|
||||
|
@ -52,17 +52,17 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/notification', 'core/str'
|
||||
/** @type {String} The number of messages to retrieve. */
|
||||
Search.prototype._numMessagesToRetrieve = 20;
|
||||
|
||||
/** @type {String} The number of people displayed. */
|
||||
Search.prototype._numPeopleDisplayed = 0;
|
||||
/** @type {String} The number of users displayed. */
|
||||
Search.prototype._numUsersDisplayed = 0;
|
||||
|
||||
/** @type {String} The number of people to retrieve. */
|
||||
Search.prototype._numPeopleToRetrieve = 20;
|
||||
/** @type {String} The number of users to retrieve. */
|
||||
Search.prototype._numUsersToRetrieve = 20;
|
||||
|
||||
/** @type {Array} The type of available search areas. **/
|
||||
Search.prototype._searchAreas = {
|
||||
MESSAGES: 'messages',
|
||||
PEOPLE: 'people',
|
||||
PEOPLEINCOURSE: 'peopleincourse'
|
||||
USERS: 'users',
|
||||
USERSINCOURSE: 'usersincourse'
|
||||
};
|
||||
|
||||
/** @type {int} The timeout before performing an ajax search */
|
||||
@ -77,24 +77,24 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/notification', 'core/str'
|
||||
// Handle searching for text.
|
||||
this.messageArea.find(this.messageArea.SELECTORS.SEARCHTEXTAREA).on('input', this._searchRequest.bind(this));
|
||||
|
||||
// Handle clicking on a course in the list of people.
|
||||
this.messageArea.onDelegateEvent('click', this.messageArea.SELECTORS.SEARCHPEOPLEINCOURSE, function(e) {
|
||||
// Handle clicking on a course in the list of users.
|
||||
this.messageArea.onDelegateEvent('click', this.messageArea.SELECTORS.SEARCHUSERSINCOURSE, function(e) {
|
||||
this._setFilter($(e.currentTarget).html());
|
||||
this._setPlaceholderText('searchforperson');
|
||||
this._setPlaceholderText('searchforuser');
|
||||
this._clearSearchArea();
|
||||
this._searchArea = this._searchAreas.PEOPLEINCOURSE;
|
||||
this._searchArea = this._searchAreas.USERSINCOURSE;
|
||||
this._courseid = $(e.currentTarget).data('courseid');
|
||||
this._searchPeopleInCourse();
|
||||
this._searchUsersInCourse();
|
||||
}.bind(this));
|
||||
|
||||
// Handle deleting the search filter.
|
||||
this.messageArea.onDelegateEvent('click', this.messageArea.SELECTORS.DELETESEARCHFILTER, function() {
|
||||
this._hideSearchResults();
|
||||
// Filter has been removed, so we don't want to be searching in a course anymore.
|
||||
this._searchArea = this._searchAreas.PEOPLE;
|
||||
this._setPlaceholderText('searchforpersonorcourse');
|
||||
this._searchArea = this._searchAreas.USERS;
|
||||
this._setPlaceholderText('searchforuserorcourse');
|
||||
// Go back the contacts.
|
||||
this.messageArea.trigger(this.messageArea.EVENTS.PEOPLESEARCHCANCELED);
|
||||
this.messageArea.trigger(this.messageArea.EVENTS.USERSSEARCHCANCELED);
|
||||
}.bind(this));
|
||||
|
||||
// Handle events that occur outside this module.
|
||||
@ -105,8 +105,8 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/notification', 'core/str'
|
||||
}.bind(this));
|
||||
this.messageArea.onCustomEvent(this.messageArea.EVENTS.CONTACTSSELECTED, function() {
|
||||
this._hideSearchResults();
|
||||
this._searchArea = this._searchAreas.PEOPLE;
|
||||
this._setPlaceholderText('searchforpersonorcourse');
|
||||
this._searchArea = this._searchAreas.USERS;
|
||||
this._setPlaceholderText('searchforuserorcourse');
|
||||
}.bind(this));
|
||||
this.messageArea.onCustomEvent(this.messageArea.EVENTS.MESSAGESENT, function() {
|
||||
this._hideSearchResults();
|
||||
@ -126,7 +126,7 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/notification', 'core/str'
|
||||
this._enableSearching();
|
||||
}.bind(this));
|
||||
|
||||
// Event listeners for scrolling through messages and people in courses.
|
||||
// Event listeners for scrolling through messages and users in courses.
|
||||
customEvents.define(this.messageArea.find(this.messageArea.SELECTORS.SEARCHRESULTSAREA), [
|
||||
customEvents.events.scrollBottom
|
||||
]);
|
||||
@ -134,8 +134,8 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/notification', 'core/str'
|
||||
function() {
|
||||
if (this._searchArea == this._searchAreas.MESSAGES) {
|
||||
this._searchMessages();
|
||||
} else if (this._searchArea == this._searchAreas.PEOPLEINCOURSE) {
|
||||
this._searchPeopleInCourse();
|
||||
} else if (this._searchArea == this._searchAreas.USERSINCOURSE) {
|
||||
this._searchUsersInCourse();
|
||||
}
|
||||
}.bind(this)
|
||||
);
|
||||
@ -161,13 +161,13 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/notification', 'core/str'
|
||||
if (this._searchArea == this._searchAreas.MESSAGES) {
|
||||
this._hideSearchResults();
|
||||
this.messageArea.trigger(this.messageArea.EVENTS.MESSAGESEARCHCANCELED);
|
||||
} else if (this._searchArea == this._searchAreas.PEOPLE) {
|
||||
} else if (this._searchArea == this._searchAreas.USERS) {
|
||||
this._hideSearchResults();
|
||||
this.messageArea.trigger(this.messageArea.EVENTS.PEOPLESEARCHCANCELED);
|
||||
} else if (this._searchArea == this._searchAreas.PEOPLEINCOURSE) {
|
||||
// We are still searching in a course, so need to list all the people again.
|
||||
this.messageArea.trigger(this.messageArea.EVENTS.USERSSEARCHCANCELED);
|
||||
} else if (this._searchArea == this._searchAreas.USERSINCOURSE) {
|
||||
// We are still searching in a course, so need to list all the users again.
|
||||
this._clearSearchArea();
|
||||
this._searchPeopleInCourse();
|
||||
this._searchUsersInCourse();
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -182,17 +182,17 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/notification', 'core/str'
|
||||
this._numMessagesDisplayed = 0;
|
||||
this._searchMessages();
|
||||
}.bind(this), 300);
|
||||
} else if (this._searchArea == this._searchAreas.PEOPLEINCOURSE) {
|
||||
} else if (this._searchArea == this._searchAreas.USERSINCOURSE) {
|
||||
this._requestTimeout = setTimeout(function() {
|
||||
this._clearSearchArea();
|
||||
this._numPeopleDisplayed = 0;
|
||||
this._searchPeopleInCourse();
|
||||
this._numUsersDisplayed = 0;
|
||||
this._searchUsersInCourse();
|
||||
}.bind(this), 300);
|
||||
} else { // Must be searching for people and courses
|
||||
} else { // Must be searching for users and courses
|
||||
this._requestTimeout = setTimeout(function() {
|
||||
this._clearSearchArea();
|
||||
this._numPeopleDisplayed = 0;
|
||||
this._searchPeople();
|
||||
this._numUsersDisplayed = 0;
|
||||
this._searchUsers();
|
||||
}.bind(this), 300);
|
||||
}
|
||||
};
|
||||
@ -233,7 +233,7 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/notification', 'core/str'
|
||||
return promises[0];
|
||||
}.bind(this)).then(function(data) {
|
||||
numberreceived = data.contacts.length;
|
||||
return templates.render('core_message/message_area_message_search_results', data);
|
||||
return templates.render('core_message/message_area_messages_search_results', data);
|
||||
}).then(function(html, js) {
|
||||
// Remove the loading icon.
|
||||
this.messageArea.find(this.messageArea.SELECTORS.SEARCHRESULTSAREA + " " +
|
||||
@ -254,21 +254,21 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/notification', 'core/str'
|
||||
};
|
||||
|
||||
/**
|
||||
* Handles searching for people.
|
||||
* Handles searching for users.
|
||||
*
|
||||
* @private
|
||||
* @return {Promise} The promise resolved when the search area has been rendered
|
||||
*/
|
||||
Search.prototype._searchPeople = function() {
|
||||
Search.prototype._searchUsers = function() {
|
||||
var str = this.messageArea.find(this.messageArea.SELECTORS.SEARCHBOX).val();
|
||||
|
||||
// Call the web service to get our data.
|
||||
var promises = ajax.call([{
|
||||
methodname: 'core_message_data_for_messagearea_search_people',
|
||||
methodname: 'core_message_data_for_messagearea_search_users',
|
||||
args: {
|
||||
userid: this.messageArea.getCurrentUserId(),
|
||||
search: str,
|
||||
limitnum: this._numPeopleToRetrieve
|
||||
limitnum: this._numUsersToRetrieve
|
||||
}
|
||||
}]);
|
||||
|
||||
@ -278,19 +278,19 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/notification', 'core/str'
|
||||
"<div style='text-align:center'>" + html + "</div>", js);
|
||||
return promises[0];
|
||||
}.bind(this)).then(function(data) {
|
||||
return templates.render('core_message/message_area_people_search_results', data);
|
||||
return templates.render('core_message/message_area_users_search_results', data);
|
||||
}).then(function(html, js) {
|
||||
templates.replaceNodeContents(this.messageArea.find(this.messageArea.SELECTORS.SEARCHRESULTSAREA), html, js);
|
||||
}.bind(this)).fail(notification.exception);
|
||||
};
|
||||
|
||||
/**
|
||||
* Handles searching for people in a course.
|
||||
* Handles searching for users in a course.
|
||||
*
|
||||
* @private
|
||||
* @return {Promise|boolean} The promise resolved when the search area has been rendered
|
||||
*/
|
||||
Search.prototype._searchPeopleInCourse = function() {
|
||||
Search.prototype._searchUsersInCourse = function() {
|
||||
if (this._isLoading) {
|
||||
return false;
|
||||
}
|
||||
@ -302,13 +302,13 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/notification', 'core/str'
|
||||
|
||||
// Call the web service to get our data.
|
||||
var promises = ajax.call([{
|
||||
methodname: 'core_message_data_for_messagearea_search_people_in_course',
|
||||
methodname: 'core_message_data_for_messagearea_search_users_in_course',
|
||||
args: {
|
||||
userid: this.messageArea.getCurrentUserId(),
|
||||
courseid: this._courseid,
|
||||
search: str,
|
||||
limitfrom: this._numPeopleDisplayed,
|
||||
limitnum: this._numPeopleToRetrieve
|
||||
limitfrom: this._numUsersDisplayed,
|
||||
limitnum: this._numUsersToRetrieve
|
||||
}
|
||||
}]);
|
||||
|
||||
@ -321,7 +321,7 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/notification', 'core/str'
|
||||
return promises[0];
|
||||
}.bind(this)).then(function(data) {
|
||||
numberreceived = data.contacts.length;
|
||||
return templates.render('core_message/message_area_people_search_results', data);
|
||||
return templates.render('core_message/message_area_users_search_results', data);
|
||||
}).then(function(html, js) {
|
||||
// Remove the loading icon.
|
||||
this.messageArea.find(this.messageArea.SELECTORS.SEARCHRESULTSAREA + " " +
|
||||
@ -331,8 +331,8 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/notification', 'core/str'
|
||||
// Show the new content.
|
||||
templates.appendNodeContents(this.messageArea.find(this.messageArea.SELECTORS.SEARCHRESULTSAREA), html, js);
|
||||
// Increment the number of contacts displayed.
|
||||
this._numPeopleDisplayed += numberreceived;
|
||||
} else if (this._numPeopleDisplayed == 0) { // Must have nothing to begin with.
|
||||
this._numUsersDisplayed += numberreceived;
|
||||
} else if (this._numUsersDisplayed == 0) { // Must have nothing to begin with.
|
||||
// Replace the new content.
|
||||
templates.replaceNodeContents(this.messageArea.find(this.messageArea.SELECTORS.SEARCHRESULTSAREA), html, js);
|
||||
}
|
||||
@ -409,8 +409,8 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/notification', 'core/str'
|
||||
|
||||
if (this._searchArea == this._searchAreas.MESSAGES) {
|
||||
this.messageArea.trigger(this.messageArea.EVENTS.MESSAGESEARCHCANCELED);
|
||||
} else if (this._searchArea == this._searchAreas.PEOPLE) {
|
||||
this.messageArea.trigger(this.messageArea.EVENTS.PEOPLESEARCHCANCELED);
|
||||
} else if (this._searchArea == this._searchAreas.USERS) {
|
||||
this.messageArea.trigger(this.messageArea.EVENTS.USERSSEARCHCANCELED);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -116,16 +116,16 @@ class api {
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles searching for people in a particular course in the message area.
|
||||
* Handles searching for user in a particular course in the message area.
|
||||
*
|
||||
* @param int $userid The user id doing the searching
|
||||
* @param int $courseid The id of the course we are searching in
|
||||
* @param string $search The string the user is searching
|
||||
* @param int $limitfrom
|
||||
* @param int $limitnum
|
||||
* @return \core_message\output\messagearea\people_search_results
|
||||
* @return \core_message\output\messagearea\user_search_results
|
||||
*/
|
||||
public static function search_people_in_course($userid, $courseid, $search, $limitfrom = 0, $limitnum = 0) {
|
||||
public static function search_users_in_course($userid, $courseid, $search, $limitfrom = 0, $limitnum = 0) {
|
||||
global $DB;
|
||||
|
||||
// Get all the users in the course.
|
||||
@ -152,18 +152,18 @@ class api {
|
||||
}
|
||||
}
|
||||
|
||||
return new \core_message\output\messagearea\people_search_results($contacts);
|
||||
return new \core_message\output\messagearea\user_search_results($contacts);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles searching for people in the message area.
|
||||
* Handles searching for user in the message area.
|
||||
*
|
||||
* @param int $userid The user id doing the searching
|
||||
* @param string $search The string the user is searching
|
||||
* @param int $limitnum
|
||||
* @return \core_message\output\messagearea\people_search_results
|
||||
* @return \core_message\output\messagearea\user_search_results
|
||||
*/
|
||||
public static function search_people($userid, $search, $limitnum = 0) {
|
||||
public static function search_users($userid, $search, $limitnum = 0) {
|
||||
global $CFG, $DB;
|
||||
|
||||
require_once($CFG->dirroot . '/lib/coursecatlib.php');
|
||||
@ -228,7 +228,7 @@ class api {
|
||||
}
|
||||
}
|
||||
|
||||
return new \core_message\output\messagearea\people_search_results($contacts, $courses, $noncontacts);
|
||||
return new \core_message\output\messagearea\user_search_results($contacts, $courses, $noncontacts);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -15,7 +15,7 @@
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Contains class used to display people search results.
|
||||
* Contains class used to display user search results.
|
||||
*
|
||||
* @package core_message
|
||||
* @copyright 2016 Mark Nelson <markn@moodle.com>
|
||||
@ -30,13 +30,13 @@ use renderable;
|
||||
use templatable;
|
||||
|
||||
/**
|
||||
* Class used to display people search results.
|
||||
* Class used to display user search results.
|
||||
*
|
||||
* @package core_message
|
||||
* @copyright 2016 Mark Nelson <markn@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class people_search_results implements templatable, renderable {
|
||||
class user_search_results implements templatable, renderable {
|
||||
|
||||
/**
|
||||
* @var \core_message\output\messagearea\contact[] The list of contacts.
|
@ -469,12 +469,12 @@ class core_message_external extends external_api {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get messagearea search people parameters.
|
||||
* Get messagearea search users in course parameters.
|
||||
*
|
||||
* @return external_function_parameters
|
||||
* @since 3.2
|
||||
*/
|
||||
public static function data_for_messagearea_search_people_in_course_parameters() {
|
||||
public static function data_for_messagearea_search_users_in_course_parameters() {
|
||||
return new external_function_parameters(
|
||||
array(
|
||||
'userid' => new external_value(PARAM_INT, 'The id of the user who is performing the search'),
|
||||
@ -487,7 +487,7 @@ class core_message_external extends external_api {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get messagearea search people results.
|
||||
* Get messagearea search users in course results.
|
||||
*
|
||||
* @param int $userid The id of the user who is performing the search
|
||||
* @param int $courseid The id of the course
|
||||
@ -498,7 +498,7 @@ class core_message_external extends external_api {
|
||||
* @throws moodle_exception
|
||||
* @since 3.2
|
||||
*/
|
||||
public static function data_for_messagearea_search_people_in_course($userid, $courseid, $search, $limitfrom = 0,
|
||||
public static function data_for_messagearea_search_users_in_course($userid, $courseid, $search, $limitfrom = 0,
|
||||
$limitnum = 0) {
|
||||
global $CFG, $PAGE, $USER;
|
||||
|
||||
@ -516,26 +516,26 @@ class core_message_external extends external_api {
|
||||
'limitfrom' => $limitfrom,
|
||||
'limitnum' => $limitnum
|
||||
);
|
||||
self::validate_parameters(self::data_for_messagearea_search_people_in_course_parameters(), $params);
|
||||
self::validate_parameters(self::data_for_messagearea_search_users_in_course_parameters(), $params);
|
||||
self::validate_context($systemcontext);
|
||||
|
||||
if (($USER->id != $userid) && !has_capability('moodle/site:readallmessages', $systemcontext)) {
|
||||
throw new moodle_exception('You do not have permission to perform this action.');
|
||||
}
|
||||
|
||||
$search = \core_message\api::search_people_in_course($userid, $courseid, $search, $limitfrom, $limitnum);
|
||||
$search = \core_message\api::search_users_in_course($userid, $courseid, $search, $limitfrom, $limitnum);
|
||||
|
||||
$renderer = $PAGE->get_renderer('core_message');
|
||||
return $search->export_for_template($renderer);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get messagearea search people returns.
|
||||
* Get messagearea search users in course returns.
|
||||
*
|
||||
* @return external_single_structure
|
||||
* @since 3.2
|
||||
*/
|
||||
public static function data_for_messagearea_search_people_in_course_returns() {
|
||||
public static function data_for_messagearea_search_users_in_course_returns() {
|
||||
return new external_single_structure(
|
||||
array(
|
||||
'hascontacts' => new external_value(PARAM_BOOL, 'Are there contacts?'),
|
||||
@ -547,12 +547,12 @@ class core_message_external extends external_api {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get messagearea search people parameters.
|
||||
* Get messagearea search users parameters.
|
||||
*
|
||||
* @return external_function_parameters
|
||||
* @since 3.2
|
||||
*/
|
||||
public static function data_for_messagearea_search_people_parameters() {
|
||||
public static function data_for_messagearea_search_users_parameters() {
|
||||
return new external_function_parameters(
|
||||
array(
|
||||
'userid' => new external_value(PARAM_INT, 'The id of the user who is performing the search'),
|
||||
@ -563,7 +563,7 @@ class core_message_external extends external_api {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get messagearea search people results.
|
||||
* Get messagearea search users results.
|
||||
*
|
||||
* @param int $userid The id of the user who is performing the search
|
||||
* @param string $search The string being searched
|
||||
@ -572,7 +572,7 @@ class core_message_external extends external_api {
|
||||
* @throws moodle_exception
|
||||
* @since 3.2
|
||||
*/
|
||||
public static function data_for_messagearea_search_people($userid, $search, $limitnum = 0) {
|
||||
public static function data_for_messagearea_search_users($userid, $search, $limitnum = 0) {
|
||||
global $CFG, $PAGE, $USER;
|
||||
|
||||
// Check if messaging is enabled.
|
||||
@ -587,26 +587,26 @@ class core_message_external extends external_api {
|
||||
'search' => $search,
|
||||
'limitnum' => $limitnum
|
||||
);
|
||||
self::validate_parameters(self::data_for_messagearea_search_people_parameters(), $params);
|
||||
self::validate_parameters(self::data_for_messagearea_search_users_parameters(), $params);
|
||||
self::validate_context($systemcontext);
|
||||
|
||||
if (($USER->id != $userid) && !has_capability('moodle/site:readallmessages', $systemcontext)) {
|
||||
throw new moodle_exception('You do not have permission to perform this action.');
|
||||
}
|
||||
|
||||
$search = \core_message\api::search_people($userid, $search, $limitnum);
|
||||
$search = \core_message\api::search_users($userid, $search, $limitnum);
|
||||
|
||||
$renderer = $PAGE->get_renderer('core_message');
|
||||
return $search->export_for_template($renderer);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get messagearea search people returns.
|
||||
* Get messagearea search users returns.
|
||||
*
|
||||
* @return external_single_structure
|
||||
* @since 3.2
|
||||
*/
|
||||
public static function data_for_messagearea_search_people_returns() {
|
||||
public static function data_for_messagearea_search_users_returns() {
|
||||
return new external_single_structure(
|
||||
array(
|
||||
'hascontacts' => new external_value(PARAM_BOOL, 'Are there contacts?'),
|
||||
|
@ -6,7 +6,7 @@
|
||||
{{#hascourses}}
|
||||
<div class="heading">{{#str}}courses{{/str}}</div>
|
||||
{{#courses}}
|
||||
<div class="course" data-action="search-people-in-course" data-courseid="{{id}}">
|
||||
<div class="course" data-action="search-users-in-course" data-courseid="{{id}}">
|
||||
{{fullname}}
|
||||
</div>
|
||||
{{/courses}}
|
Loading…
x
Reference in New Issue
Block a user