Moodle APIs  3.8
Moodle 3.8.6 (Build: 20201109)
Functions | Variables
lib.php File Reference

Library of functions and constants for module chat. More...

Functions

object chat_add_instance ($chat)
 Given an object containing all the necessary data, (defined by the form in mod_form.php) this function will create a new instance and return the id number of the new instance. More...
 
object chat_delete_instance ($id)
 Given an ID of an instance of this module, this function will permanently delete the instance and any data that depends on it. More...
 
object chat_delete_old_users ()
 Delete the old and in the way. More...
 
 chat_extend_navigation ($navigation, $course, $module, $cm)
 
 chat_extend_settings_navigation (settings_navigation $settings, navigation_node $chatnode)
 Adds module specific settings to the settings block. More...
 
object chat_format_message ($message, $courseid, $currentuser, $chatlastrow=null)
 Given a message object this function formats it appropriately into text and html then returns the formatted data. More...
 
object chat_format_message_manually ($message, $courseid, $sender, $currentuser, $chatlastrow=null)
 @global object More...
 
object chat_format_message_theme ($message, $chatuser, $currentuser, $groupingid, $theme='bubble')
 
object chat_format_userlist ($users, $course)
 $DB @global object $CFG @global object $COURSE @global object $OUTPUT More...
 
object chat_get_latest_message ($chatid, $groupid=0)
 
 chat_get_latest_messages ($chatuser, $chatlasttime)
 Return a list of the latest messages in the given chat session. More...
 
 chat_get_post_actions ()
 List the actions that correspond to a post of this module. More...
 
 chat_get_session_messages ($chatid, $group=false, $start=0, $end=0, $sort='')
 Return the messages of the given chat session. More...
 
 chat_get_sessions ($messages, $showall=false)
 Given a set of messages for a chat, return the completed chat sessions (including optionally not completed ones). More...
 
object chat_get_users ($chatid, $groupid=0, $groupingid=0)
 
 chat_get_view_actions ()
 List the actions that correspond to a view of this module. More...
 
object chat_login_user ($chatid, $version, $groupid, $course)
 login if not already logged in More...
 
 chat_page_type_list ($pagetype, $parentcontext, $currentcontext)
 Return a list of page types. More...
 
 chat_prepare_update_events ($chat, $cm=null)
 Updates both the normal and completion calendar events for chat. More...
 
 chat_print_error ($level, $msg)
 Print json format error. More...
 
 chat_print_overview ()
 
object chat_print_recent_activity ($course, $viewfullnames, $timestart)
 Given a course and a date, prints a summary of all chat rooms past and present This function is called from block_recent_activity. More...
 
object chat_refresh_events ($courseid=0, $instance=null, $cm=null)
 This standard function will check all instances of this module and make sure there are up-to-date events created for each of them. More...
 
 chat_reset_course_form_defaults ($course)
 Course reset form defaults. More...
 
 chat_reset_course_form_definition (&$mform)
 Implementation of the function for printing the form elements that control whether the course reset functionality affects the chat. More...
 
object chat_reset_userdata ($data)
 Actual implementation of the reset course functionality, delete all the chat messages for course $data->courseid. More...
 
 chat_send_chatmessage ($chatuser, $messagetext, $issystem=false, $cm=null)
 Send a message on the chat. More...
 
 chat_supports ($feature)
 
object chat_update_chat_times ($chatid=0)
 Updates chat records so that the next chat time is correct. More...
 
object chat_update_instance ($chat)
 Given an object containing all the necessary data, (defined by the form in mod_form.php) this function will update an existing instance with new data. More...
 
 chat_user_logout (\core\event\user_loggedout $event)
 user logout event handler More...
 
 chat_view ($chat, $course, $cm, $context)
 Mark the activity completed (if required) and trigger the course_module_viewed event. More...
 
 mod_chat_core_calendar_provide_event_action (calendar_event $event, core_calendar\action_factory $factory, int $userid=0)
 This function receives a calendar event and returns the action associated with it, or null if there is none. More...
 
 padding ($n)
 

Variables

global $CHAT_DUMMY_DATA = padding(200)
 
global $CHAT_HTMLHEAD
 
 $CHAT_HTMLHEAD_JS =
 
 $CHAT_HTMLHEAD_MSGINPUT
 
 $CHAT_HTMLHEAD_MSGINPUT_JS =
 
global $CHAT_HTMLHEAD_OUT
 
const CHAT_EVENT_TYPE_CHATTIME 'chattime'
 
const CHAT_SESSION_GAP 300
 

Detailed Description

Library of functions and constants for module chat.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later