Differences Between: [Versions 310 and 311] [Versions 310 and 400] [Versions 310 and 401] [Versions 310 and 402] [Versions 310 and 403] [Versions 39 and 310]
Contains helper class for the message area.
Copyright: | 2016 Mark Nelson <markn@moodle.com> |
License: | http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
File Size: | 709 lines (28 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
helper:: (20 methods):
get_messages()
get_conversation_messages()
format_conversation_messages()
create_messages()
create_contact()
show_online_status()
is_online()
get_providers_preferences()
togglecontact_requirejs()
togglecontact_link_params()
messageuser_requirejs()
messageuser_link_params()
get_conversation_hash()
get_last_message_time_created_cache_key()
legacy_messages_exist()
get_member_info()
get_conversations_legacy_formatter()
render_messaging_widget()
search_get_user_details()
prevent_unclosed_html_tags()
get_messages() X-Ref |
get_conversation_messages(int $userid, int $convid, int $timedeleted = 0, int $limitfrom = 0,int $limitnum = 0, string $sort = 'timecreated ASC', int $timefrom = 0,int $timeto = 0) X-Ref |
Helper function to retrieve conversation messages. param: int $userid The current user. param: int $convid The conversation identifier. param: int $timedeleted The time the message was deleted param: int $limitfrom Return a subset of records, starting at this point (optional). param: int $limitnum Return a subset comprising this many records in total (optional, required if $limitfrom is set). param: string $sort The column name to order by including optionally direction. param: int $timefrom The time from the message being sent. param: int $timeto The time up until the message being sent. return: array of messages |
format_conversation_messages(int $userid, int $convid, array $messages) X-Ref |
Helper function to return a conversation messages with the involved members (only the ones who have sent any of these messages). param: int $userid The current userid. param: int $convid The conversation id. param: array $messages The formated array messages. return: array A conversation array with the messages and the involved members. |
create_messages() X-Ref |
create_contact($contact, $prefix = '') X-Ref |
Helper function for creating a contact object. param: \stdClass $contact param: string $prefix return: \stdClass |
show_online_status($user) X-Ref |
Helper function for checking if we should show the user's online status. param: \stdClass $user return: boolean |
is_online($lastaccess) X-Ref |
Helper function for checking the time meets the 'online' condition. param: int $lastaccess return: boolean |
get_providers_preferences($providers, $userid) X-Ref |
Get providers preferences. param: array $providers param: int $userid return: \stdClass |
togglecontact_requirejs() X-Ref |
Requires the JS libraries for the toggle contact button. return: void |
togglecontact_link_params($user, $iscontact = false) X-Ref |
Returns the attributes to place on a contact button. param: object $user User object. param: bool $iscontact return: array |
messageuser_requirejs() X-Ref |
Requires the JS libraries for the message user button. return: void |
messageuser_link_params(int $useridto) X-Ref |
Returns the attributes to place on the message user button. param: int $useridto return: array |
get_conversation_hash(array $userids) X-Ref |
Returns the conversation hash between users for easy look-ups in the DB. param: array $userids return: string |
get_last_message_time_created_cache_key(int $convid) X-Ref |
Returns the cache key for the time created value of the last message of this conversation. param: int $convid The conversation identifier. return: string The key. |
legacy_messages_exist($userid) X-Ref |
Checks if legacy messages exist for a given user. param: int $userid return: bool |
get_member_info(int $referenceuserid, array $userids, bool $includecontactrequests = false,bool $includeprivacyinfo = false) X-Ref |
Returns conversation member info for the supplied users, relative to the supplied referenceuserid. This is the basic structure used when returning members, and includes information about the relationship between each member and the referenceuser, such as a whether the referenceuser has marked the member as a contact, or has blocked them. param: int $referenceuserid the id of the user which check contact and blocked status. param: array $userids param: bool $includecontactrequests Do we want to include contact requests with this data? param: bool $includeprivacyinfo Do we want to include whether the user can message another, and if the user return: array the array of objects containing member info, indexed by userid. |
get_conversations_legacy_formatter() X-Ref |
render_messaging_widget(bool $isdrawer,int $sendtouser = null,int $conversationid = null,string $view = null) X-Ref |
Renders the messaging widget. param: bool $isdrawer Are we are rendering the drawer or is this on a full page? param: int|null $sendtouser The ID of the user we want to send a message to param: int|null $conversationid The ID of the conversation we want to load param: string|null $view The first view to load in the message widget return: string The HTML. |
search_get_user_details(\stdClass $user) X-Ref |
Returns user details for a user, if they are visible to the current user in the message search. This method checks the visibility of a user specifically for the purpose of inclusion in the message search results. Visibility depends on the site-wide messaging setting 'messagingallusers': If enabled, visibility depends only on the core notion of visibility; a visible site or course profile. If disabled, visibility requires that the user be sharing a course with the searching user, and have a visible profile there. The current user is always returned. param: \stdClass $user return: array the array of userdetails, if visible, or an empty array otherwise. |
prevent_unclosed_html_tags(string $message,bool $removebody = false) X-Ref |
Prevent unclosed HTML elements in a message. param: string $message The html message. param: bool $removebody True if we want to remove tag body. return: string The html properly structured. |