Moodle APIs 4.3
Moodle 4.3.6 (Build: 20240812)
lib.php File Reference

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.
 
 chat_calculate_next_chat_time (int $schedule, int $chattime)
 Calculate next chat session time based on schedule.
 
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.
 
object chat_delete_old_users ()
 Delete the old and in the way.
 
 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.
 
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.
 
object chat_format_message_manually ($message, $courseid, $sender, $currentuser, $chatlastrow=null)
 @global object
 
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
 
 chat_get_coursemodule_info ($coursemodule)
 Add a get_coursemodule_info function in case chat instance wants to add 'extra' information for the course (see resource).
 
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.
 
 chat_get_post_actions ()
 List the actions that correspond to a post of this module.
 
 chat_get_session_messages ($chatid, $group=false, $start=0, $end=0, $sort='')
 Return the messages of the given chat session.
 
 chat_get_sessions ($messages, $showall=false)
 Given a set of messages for a chat, return the completed chat sessions (including optionally not completed ones).
 
object chat_get_users ($chatid, $groupid=0, $groupingid=0)
 
 chat_get_view_actions ()
 List the actions that correspond to a view of this module.
 
object chat_login_user ($chatid, $version, $groupid, $course)
 login if not already logged in
 
 chat_page_type_list ($pagetype, $parentcontext, $currentcontext)
 Return a list of page types.
 
 chat_prepare_update_events ($chat, $cm=null)
 Updates both the normal and completion calendar events for chat.
 
 chat_print_error ($level, $msg)
 Print json format error.
 
 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.
 
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.
 
 chat_reset_course_form_defaults ($course)
 Course reset form defaults.
 
 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.
 
object chat_reset_userdata ($data)
 Actual implementation of the reset course functionality, delete all the chat messages for course $data->courseid.
 
 chat_send_chatmessage ($chatuser, $messagetext, $issystem=false, $cm=null)
 Send a message on the chat.
 
 chat_supports ($feature)
 
object chat_update_chat_times ($chatid=0)
 Updates chat records so that the next chat time is correct.
 
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.
 
 chat_user_logout (\core\event\user_loggedout $event)
 user logout event handler
 
 chat_view ($chat, $course, $cm, $context)
 Mark the activity completed (if required) and trigger the course_module_viewed event.
 
 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.
 
 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_SCHEDULE_DAILY 2
 
const CHAT_SCHEDULE_NONE 0
 
const CHAT_SCHEDULE_SINGLE 1
 
const CHAT_SCHEDULE_WEEKLY 3
 
const CHAT_SESSION_GAP 300