| Línea 467... |
Línea 467... |
| 467 |
* @param bool $mergeself whether to include self-conversations (true) or ONLY private conversations (false)
|
467 |
* @param bool $mergeself whether to include self-conversations (true) or ONLY private conversations (false)
|
| 468 |
* when private conversations are requested.
|
468 |
* when private conversations are requested.
|
| 469 |
* @return array the array of conversations
|
469 |
* @return array the array of conversations
|
| 470 |
* @throws \moodle_exception
|
470 |
* @throws \moodle_exception
|
| 471 |
*/
|
471 |
*/
|
| 472 |
public static function get_conversations($userid, $limitfrom = 0, $limitnum = 20, int $type = null,
|
472 |
public static function get_conversations($userid, $limitfrom = 0, $limitnum = 20, ?int $type = null,
|
| 473 |
bool $favourites = null, bool $mergeself = false) {
|
473 |
?bool $favourites = null, bool $mergeself = false) {
|
| 474 |
global $DB;
|
474 |
global $DB;
|
| Línea 475... |
Línea 475... |
| 475 |
|
475 |
|
| 476 |
if (!is_null($type) && !in_array($type, [self::MESSAGE_CONVERSATION_TYPE_INDIVIDUAL,
|
476 |
if (!is_null($type) && !in_array($type, [self::MESSAGE_CONVERSATION_TYPE_INDIVIDUAL,
|
| 477 |
self::MESSAGE_CONVERSATION_TYPE_GROUP, self::MESSAGE_CONVERSATION_TYPE_SELF])) {
|
477 |
self::MESSAGE_CONVERSATION_TYPE_GROUP, self::MESSAGE_CONVERSATION_TYPE_SELF])) {
|
| Línea 1166... |
Línea 1166... |
| 1166 |
* @param int $userid The user id of who we want to delete the messages for (this may be done by the admin
|
1166 |
* @param int $userid The user id of who we want to delete the messages for (this may be done by the admin
|
| 1167 |
* but will still seem as if it was by the user)
|
1167 |
* but will still seem as if it was by the user)
|
| 1168 |
* @param int $conversationid The id of the conversation
|
1168 |
* @param int $conversationid The id of the conversation
|
| 1169 |
* @return bool Returns true if a user can delete the conversation, false otherwise.
|
1169 |
* @return bool Returns true if a user can delete the conversation, false otherwise.
|
| 1170 |
*/
|
1170 |
*/
|
| 1171 |
public static function can_delete_conversation(int $userid, int $conversationid = null): bool {
|
1171 |
public static function can_delete_conversation(int $userid, ?int $conversationid = null): bool {
|
| 1172 |
global $USER;
|
1172 |
global $USER;
|
| Línea 1173... |
Línea 1173... |
| 1173 |
|
1173 |
|
| 1174 |
if (is_null($conversationid)) {
|
1174 |
if (is_null($conversationid)) {
|
| 1175 |
debugging('\core_message\api::can_delete_conversation() now expects a \'conversationid\' to be passed.',
|
1175 |
debugging('\core_message\api::can_delete_conversation() now expects a \'conversationid\' to be passed.',
|
| Línea 2087... |
Línea 2087... |
| 2087 |
* @param string|null $itemtype Defines the type of the component
|
2087 |
* @param string|null $itemtype Defines the type of the component
|
| 2088 |
* @param int|null $itemid The id of the component
|
2088 |
* @param int|null $itemid The id of the component
|
| 2089 |
* @param int|null $contextid The id of the context
|
2089 |
* @param int|null $contextid The id of the context
|
| 2090 |
* @return \stdClass
|
2090 |
* @return \stdClass
|
| 2091 |
*/
|
2091 |
*/
|
| 2092 |
public static function create_conversation(int $type, array $userids, string $name = null,
|
2092 |
public static function create_conversation(int $type, array $userids, ?string $name = null,
|
| 2093 |
int $enabled = self::MESSAGE_CONVERSATION_ENABLED, string $component = null,
|
2093 |
int $enabled = self::MESSAGE_CONVERSATION_ENABLED, ?string $component = null,
|
| 2094 |
string $itemtype = null, int $itemid = null, int $contextid = null) {
|
2094 |
?string $itemtype = null, ?int $itemid = null, ?int $contextid = null) {
|
| Línea 2095... |
Línea 2095... |
| 2095 |
|
2095 |
|
| Línea 2096... |
Línea 2096... |
| 2096 |
global $DB;
|
2096 |
global $DB;
|
| 2097 |
|
2097 |
|