[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/mod/chat/ -> lib.php (summary)

Library of functions and constants for module chat

Copyright: 1999 onwards Martin Dougiamas {@link http://moodle.com}
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 1357 lines (47 kb)
Included or required: 11 times
Referenced: 4 times
Includes or requires: 0 files

Defines 34 functions

  move()
  empty_field_and_submit()
  padding()
  chat_add_instance()
  chat_update_instance()
  chat_delete_instance()
  chat_print_recent_activity()
  chat_cron()
  chat_refresh_events()
  chat_get_users()
  chat_get_latest_message()
  chat_login_user()
  chat_delete_old_users()
  chat_update_chat_times()
  chat_send_chatmessage()
  chat_format_message_manually()
  chat_format_message()
  chat_format_message_theme()
  chat_format_userlist()
  chat_print_error()
  chat_get_view_actions()
  chat_get_post_actions()
  chat_print_overview()
  chat_reset_course_form_definition()
  chat_reset_course_form_defaults()
  chat_reset_userdata()
  chat_get_extra_capabilities()
  chat_supports()
  chat_extend_navigation()
  chat_extend_settings_navigation()
  chat_user_logout()
  chat_page_type_list()
  chat_get_latest_messages()
  chat_view()

Functions
Functions that are not part of a class:

move()   X-Ref
No description

empty_field_and_submit()   X-Ref
No description

padding($n)   X-Ref

param: int $n
return: string

chat_add_instance($chat)   X-Ref
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.

param: object $chat
return: int

chat_update_instance($chat)   X-Ref
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.

param: object $chat
return: bool

chat_delete_instance($id)   X-Ref
Given an ID of an instance of this module,
this function will permanently delete the instance
and any data that depends on it.

param: int $id
return: bool

chat_print_recent_activity($course, $viewfullnames, $timestart)   X-Ref
Given a course and a date, prints a summary of all chat rooms past and present
This function is called from block_recent_activity

param: object $course
param: bool $viewfullnames
param: int|string $timestart Timestamp
return: bool

chat_cron()   X-Ref
Function to be run periodically according to the moodle cron
This function searches for things that need to be done, such
as sending out mail, toggling flags etc ...

return: bool

chat_refresh_events($courseid = 0)   X-Ref
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()

param: int $courseid
return: bool

chat_get_users($chatid, $groupid=0, $groupingid=0)   X-Ref

param: int $chatid
param: int $groupid
param: int $groupingid
return: array

chat_get_latest_message($chatid, $groupid=0)   X-Ref

param: int $chatid
param: int $groupid
return: array

chat_login_user($chatid, $version, $groupid, $course)   X-Ref
login if not already logged in

param: int $chatid
param: string $version
param: int $groupid
param: object $course
return: bool|int Returns the chat users sid or false

chat_delete_old_users()   X-Ref
Delete the old and in the way


chat_update_chat_times($chatid=0)   X-Ref
Updates chat records so that the next chat time is correct

param: int $chatid
return: void

chat_send_chatmessage($chatuser, $messagetext, $system = false, $cm = null)   X-Ref
Send a message on the chat.

param: object $chatuser The chat user record.
param: string $messagetext The message to be sent.
param: bool $system False for non-system messages, true for system messages.
param: object $cm The course module object, pass it to save a database query when we trigger the event.
return: int The message ID.

chat_format_message_manually($message, $courseid, $sender, $currentuser, $chatlastrow = null)   X-Ref

param: object $message
param: int $courseid
param: object $sender
param: object $currentuser
param: string $chatlastrow
return: bool|string Returns HTML or false

chat_format_message($message, $courseid, $currentuser, $chatlastrow=null)   X-Ref
Given a message object this function formats it appropriately into text and html then returns the formatted data

param: object $message
param: int $courseid
param: object $currentuser
param: string $chatlastrow
return: bool|string Returns HTML or false

chat_format_message_theme($message, $chatuser, $currentuser, $groupingid, $theme = 'bubble')   X-Ref

param: object $message message to be displayed.
param: mixed $chatuser user chat data
param: object $currentuser current user for whom the message should be displayed.
param: int $groupingid course module grouping id
param: string $theme name of the chat theme.
return: bool|string Returns HTML or false

chat_format_userlist($users, $course)   X-Ref

param: object $users
param: object $course
return: array return formatted user list

chat_print_error($level, $msg)   X-Ref
Print json format error

param: string $level
param: string $msg

chat_get_view_actions()   X-Ref
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.

return: array

chat_get_post_actions()   X-Ref
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.

return: array

chat_print_overview($courses, &$htmlarray)   X-Ref

param: array $courses
param: array $htmlarray Passed by reference

chat_reset_course_form_definition(&$mform)   X-Ref
Implementation of the function for printing the form elements that control
whether the course reset functionality affects the chat.

param: object $mform form passed by reference

chat_reset_course_form_defaults($course)   X-Ref
Course reset form defaults.

param: object $course
return: array

chat_reset_userdata($data)   X-Ref
Actual implementation of the reset course functionality, delete all the
chat messages for course $data->courseid.

param: object $data the data submitted from the reset course.
return: array status array

chat_get_extra_capabilities()   X-Ref
Returns all other caps used in module

return: array

chat_supports($feature)   X-Ref

param: string $feature FEATURE_xx constant for requested feature
return: mixed True if module supports feature, null if doesn't know

chat_extend_navigation($navigation, $course, $module, $cm)   X-Ref
No description

chat_extend_settings_navigation(settings_navigation $settings, navigation_node $chatnode)   X-Ref
Adds module specific settings to the settings block

param: settings_navigation $settings The settings navigation object
param: navigation_node $chatnode The node to add module settings to

chat_user_logout(\core\event\user_loggedout $event)   X-Ref
user logout event handler

param: \core\event\user_loggedout $event The event.
return: void

chat_page_type_list($pagetype, $parentcontext, $currentcontext)   X-Ref
Return a list of page types

param: string $pagetype current page type
param: stdClass $parentcontext Block's parent context
param: stdClass $currentcontext Current context of block

chat_get_latest_messages($chatuser, $chatlasttime)   X-Ref
Return a list of the latest messages in the given chat session.

param: stdClass $chatuser     chat user session data
param: int      $chatlasttime last time messages were retrieved
return: array    list of messages

chat_view($chat, $course, $cm, $context)   X-Ref
Mark the activity completed (if required) and trigger the course_module_viewed event.

param: stdClass $chat       chat object
param: stdClass $course     course object
param: stdClass $cm         course module object
param: stdClass $context    context object



Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1