Moodle PHP Documentation 4.3
Moodle 4.3.5 (Build: 20240610) (7dcfaa79f78)
|
Namespaces | |
namespace | mod_chat |
| |
namespace | mod_chat\analytics\indicator |
| |
namespace | mod_chat\event |
| |
namespace | mod_chat\external |
| |
namespace | mod_chat\privacy |
| |
namespace | mod_chat\search |
| |
namespace | mod_chat\task |
| |
Classes | |
class | backup_chat_activity_structure_step |
Define all the backup steps that will be used by the backup_chat_activity_task. More... | |
class | backup_chat_activity_task |
Provides the steps to perform one complete backup of the Chat instance. More... | |
class | behat_mod_chat |
Steps definitions related to mod_chat. More... | |
class | chat_portfolio_caller |
class | event_message |
A chat event such a user entering or leaving a chat activity. More... | |
class | mod_chat\analytics\indicator\activity_base |
Activity base class. More... | |
class | mod_chat\analytics\indicator\cognitive_depth |
Cognitive depth indicator - chat. More... | |
class | mod_chat\analytics\indicator\social_breadth |
Social breadth indicator - chat. More... | |
class | mod_chat\dates |
Class for fetching the important dates in mod_chat for a given module instance and a user. More... | |
class | mod_chat\event\course_module_instance_list_viewed |
The mod_chat instance list viewed event class. More... | |
class | mod_chat\event\course_module_viewed |
The mod_chat course module viewed event class. More... | |
class | mod_chat\event\sessions_viewed |
class | mod_chat\external\chat_message_exporter |
Class for exporting a chat message. More... | |
class | mod_chat\external\view_sessions |
class | mod_chat\privacy\provider |
Data provider class. More... | |
class | mod_chat\search\activity |
Search area for mod_chat activities. More... | |
class | mod_chat\task\cron_task |
The main schedule task for the chat module. More... | |
class | mod_chat_external |
Chat external functions. More... | |
class | mod_chat_renderer |
Chat module renderer class. More... | |
class | moodle1_mod_chat_handler |
Chat conversion handler. More... | |
class | restore_chat_activity_structure_step |
Define all the restore steps that will be used by the restore_chat_activity_task. More... | |
class | restore_chat_activity_task |
chat restore task that provides all the settings and steps to perform one complete restore of the activity More... | |
class | user_message |
A chat message from a user. 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. | |
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) | |
xmldb_chat_upgrade ($oldversion) | |
Variables | |
$capabilities | |
global | $CHAT_DUMMY_DATA = padding(200) |
global | $CHAT_HTMLHEAD |
$CHAT_HTMLHEAD_JS = | |
$CHAT_HTMLHEAD_MSGINPUT | |
$CHAT_HTMLHEAD_MSGINPUT_JS = | |
global | $CHAT_HTMLHEAD_OUT |
$functions | |
$logs | |
$observers | |
$plugin = 2023100400 | |
$tasks | |
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 |
$plugin | component = 'mod_chat' |
$plugin | version = 2023100900 |
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.
object | $chat |
int |
chat_calculate_next_chat_time | ( | int | $schedule, |
int | $chattime ) |
Calculate next chat session time based on schedule.
int | $schedule | |
int | $chattime |
int | timestamp |
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.
int | $id |
bool |
object chat_delete_old_users | ( | ) |
Delete the old and in the way.
@global object
chat_extend_settings_navigation | ( | settings_navigation | $settings, |
navigation_node | $chatnode ) |
Adds module specific settings to the settings block.
settings_navigation | $settings | The settings navigation object |
navigation_node | $chatnode | The node to add module settings to |
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 | $message | |
int | $courseid | |
object | $currentuser | |
string | $chatlastrow |
bool|string | Returns HTML or false |
object chat_format_message_manually | ( | $message, | |
$courseid, | |||
$sender, | |||
$currentuser, | |||
$chatlastrow = null ) |
@global object
object | $message | |
int | $courseid | |
object | $sender | |
object | $currentuser | |
string | $chatlastrow |
bool|string | Returns HTML or false |
object chat_format_message_theme | ( | $message, | |
$chatuser, | |||
$currentuser, | |||
$groupingid, | |||
$theme = 'bubble' ) |
object | $message | message to be displayed. |
mixed | $chatuser | user chat data |
object | $currentuser | current user for whom the message should be displayed. |
int | $groupingid | course module grouping id |
string | $theme | name of the chat theme. |
bool|string | Returns HTML or false |
object chat_format_userlist | ( | $users, | |
$course ) |
$DB @global object $CFG @global object $COURSE @global object $OUTPUT
object | $users | |
object | $course |
array | return formatted user list |
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).
Given a course_module object, this function returns any "extra" information that may be needed when printing this activity in a course listing. See get_array_of_activities() in course/lib.php.
stdClass | $coursemodule | The coursemodule object (record). |
cached_cm_info | An object on information that the courses will know about (most noticeably, an icon). |
object chat_get_latest_message | ( | $chatid, | |
$groupid = 0 ) |
int | $chatid | |
int | $groupid |
array |
chat_get_latest_messages | ( | $chatuser, | |
$chatlasttime ) |
Return a list of the latest messages in the given chat session.
stdClass | $chatuser | chat user session data |
int | $chatlasttime | last time messages were retrieved |
array | list of messages |
chat_get_post_actions | ( | ) |
List the actions that correspond to a post of this module.
This is used by the participation report.
Note: This is not used by new logging system. Event with crud = ('c' || 'u' || 'd') and edulevel = LEVEL_PARTICIPATING will be considered as post action.
array |
chat_get_session_messages | ( | $chatid, | |
$group = false, | |||
$start = 0, | |||
$end = 0, | |||
$sort = '' ) |
Return the messages of the given chat session.
int | $chatid | the chat id |
mixed | $group | false if groups not used, int if groups used, 0 means all groups |
int | $start | the session start timestamp (0 to not filter by time) |
int | $end | the session end timestamp (0 to not filter by time) |
string | $sort | an order to sort the results in (optional, a valid SQL ORDER BY parameter) |
array | session messages |
chat_get_sessions | ( | $messages, | |
$showall = false ) |
Given a set of messages for a chat, return the completed chat sessions (including optionally not completed ones).
array | $messages | list of messages from a chat. It is assumed that these are sorted by timestamp in DESCENDING order. |
bool | $showall | whether to include incomplete sessions or not |
array | the list of sessions |
object chat_get_users | ( | $chatid, | |
$groupid = 0, | |||
$groupingid = 0 ) |
int | $chatid | |
int | $groupid | |
int | $groupingid |
array |
chat_get_view_actions | ( | ) |
List the actions that correspond to a view of this module.
This is used by the participation report.
Note: This is not used by new logging system. Event with crud = 'r' and edulevel = LEVEL_PARTICIPATING will be considered as view action.
array |
object chat_login_user | ( | $chatid, | |
$version, | |||
$groupid, | |||
$course ) |
login if not already logged in
@global object
int | $chatid | |
string | $version | |
int | $groupid | |
object | $course |
bool|int | Returns the chat users sid or false |
chat_page_type_list | ( | $pagetype, | |
$parentcontext, | |||
$currentcontext ) |
Return a list of page types.
string | $pagetype | current page type |
stdClass | $parentcontext | Block's parent context |
stdClass | $currentcontext | Current context of block |
chat_prepare_update_events | ( | $chat, | |
$cm = null ) |
Updates both the normal and completion calendar events for chat.
stdClass | $chat | The chat object (from the DB) |
stdClass | $cm | The course module object. |
chat_print_error | ( | $level, | |
$msg ) |
Print json format error.
string | $level | |
string | $msg |
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.
@global object @global object
object | $course | |
bool | $viewfullnames | |
int | string | $timestart | Timestamp |
bool |
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.
If courseid = 0, then every chat event in the site is checked, else only chat events belonging to the course specified are checked. This function is used, in its new format, by restore_refresh_events()
int | $courseid | |
int | stdClass | $instance | Chat module instance or ID. |
int | stdClass | $cm | Course module object or ID. |
bool |
chat_reset_course_form_defaults | ( | $course | ) |
Course reset form defaults.
object | $course |
array |
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.
MoodleQuickForm | $mform | form passed by reference |
object chat_reset_userdata | ( | $data | ) |
Actual implementation of the reset course functionality, delete all the chat messages for course $data->courseid.
@global object
object | $data | the data submitted from the reset course. |
array | status array |
chat_send_chatmessage | ( | $chatuser, | |
$messagetext, | |||
$issystem = false, | |||
$cm = null ) |
Send a message on the chat.
object | $chatuser | The chat user record. |
string | $messagetext | The message to be sent. |
bool | $issystem | False for non-system messages, true for system messages. |
object | $cm | The course module object, pass it to save a database query when we trigger the event. |
int | The message ID. |
chat_supports | ( | $feature | ) |
string | $feature | FEATURE_xx constant for requested feature |
mixed | True if module supports feature, false if not, null if doesn't know or string for the module purpose. |
object chat_update_chat_times | ( | $chatid = 0 | ) |
Updates chat records so that the next chat time is correct.
int | $chatid |
void |
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.
object | $chat |
bool |
chat_user_logout | ( | \core\event\user_loggedout | $event | ) |
chat_view | ( | $chat, | |
$course, | |||
$cm, | |||
$context ) |
Mark the activity completed (if required) and trigger the course_module_viewed event.
stdClass | $chat | chat object |
stdClass | $course | course object |
stdClass | $cm | course module object |
stdClass | $context | context object |
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.
This is used by block_myoverview in order to display the event appropriately. If null is returned then the event is not displayed on the block.
calendar_event | $event | |
core_calendar\action_factory | $factory | |
int | $userid | User id to use for all capability checks, etc. Set to 0 for current user (default). |
core_calendar\local\event\entities\action_interface|null |
padding | ( | $n | ) |
int | $n |
string |
$CHAT_HTMLHEAD |
$CHAT_HTMLHEAD_MSGINPUT |
$CHAT_HTMLHEAD_OUT |
$logs |
$observers |
$tasks |