Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/message/lib.php File Reference

Go to the source code of this file.

Namespaces

namespace  message

Enumerations

enum  MESSAGE_SHORTLENGTH
enum  MESSAGE_DISCUSSION_WIDTH
enum  MESSAGE_DISCUSSION_HEIGHT
enum  MESSAGE_SHORTVIEW_LIMIT
enum  MESSAGE_HISTORY_SHORT
enum  MESSAGE_HISTORY_ALL
enum  MESSAGE_VIEW_UNREAD_MESSAGES
enum  MESSAGE_VIEW_RECENT_CONVERSATIONS
enum  MESSAGE_VIEW_RECENT_NOTIFICATIONS
enum  MESSAGE_VIEW_CONTACTS
enum  MESSAGE_VIEW_BLOCKED
enum  MESSAGE_VIEW_COURSE
enum  MESSAGE_VIEW_SEARCH
enum  MESSAGE_SEARCH_MAX_RESULTS
enum  MESSAGE_CONTACTS_PER_PAGE
enum  MESSAGE_MAX_COURSE_NAME_LENGTH
enum  MESSAGE_DEFAULT_LOGGEDIN
enum  MESSAGE_DEFAULT_LOGGEDOFF
enum  MESSAGE_DISALLOWED
enum  MESSAGE_PERMITTED
enum  MESSAGE_FORCED
enum  MESSAGE_PERMITTED_MASK
enum  MESSAGE_DEFAULT_PERMITTED

Functions

if(!isset($CFG->
message_contacts_refresh)) if(!isset($CFG->
message_chat_refresh)) if(!isset($CFG->
message_offline_time)) 
message_print_contact_selector ($countunreadtotal, $viewing, $user1, $user2, $blockedusers, $onlinecontacts, $offlinecontacts, $strangers, $showcontactactionlinks, $page=0)
 message_print_participants ($context, $courseid, $contactselecturl=null, $showactionlinks=true, $titletodisplay=null, $page=0, $user2=null)
 message_get_blocked_users ($user1=null, $user2=null)
 message_print_blocked_users ($blockedusers, $contactselecturl=null, $showactionlinks=true, $titletodisplay=null, $user2=null)
 message_get_contacts ($user1=null, $user2=null)
 message_print_contacts ($onlinecontacts, $offlinecontacts, $strangers, $contactselecturl=null, $minmessages=0, $showactionlinks=true, $titletodisplay=null, $user2=null)
 message_print_usergroup_selector ($viewing, $courses, $coursecontexts, $countunreadtotal, $countblocked, $strunreadmessages)
 message_get_course_contexts ($courses)
 message_remove_url_params ($moodleurl)
 message_count_messages ($messagearray, $field='', $value='')
 message_count_unread_messages ($user1=null, $user2=null)
 message_count_blocked_users ($user1=null)
 message_print_search ($advancedsearch=false, $user1=null)
 message_get_recent_conversations ($user, $limitfrom=0, $limitto=100)
 conversationsort ($a, $b)
 message_get_recent_notifications ($user, $limitfrom=0, $limitto=100)
 message_print_recent_conversations ($user=null, $showicontext=false)
 message_print_recent_notifications ($user=null)
 message_print_recent_messages_table ($messages, $user=null, $showotheruser=true, $showicontext=false)
 message_add_contact ($contactid, $blocked=0)
 message_remove_contact ($contactid)
 message_unblock_contact ($contactid)
 message_block_contact ($contactid)
 message_get_contact ($contactid)
 message_print_search_results ($frm, $showicontext=false, $currentuser=null)
 message_print_user ($user=false, $iscontact=false, $isblocked=false, $includeicontext=false)
 message_contact_link ($userid, $linktype='add', $return=false, $script=null, $text=false, $icon=true)
 message_history_link ($userid1, $userid2, $return=false, $keywords='', $position='', $linktext='')
 message_search_users ($courseid, $searchtext, $sort='', $exceptions='')
 message_search ($searchterms, $fromme=true, $tome=true, $courseid='none', $userid=0)
 message_shorten_message ($message, $minlength=0)
 message_get_fragment ($message, $keywords)
 message_get_history ($user1, $user2, $limitnum=0, $viewingnewmessages=false)
 message_print_message_history ($user1, $user2, $search='', $messagelimit=0, $messagehistorylink=false, $viewingnewmessages=false)
 message_format_message ($message, $format='', $keywords='', $class='other')
 message_format_contexturl ($message)
 message_post_message ($userfrom, $userto, $message, $format)
 message_get_participants ()
 message_print_contactlist_user ($contact, $incontactlist=true, $isblocked=false, $selectcontacturl=null, $showactionlinks=true, $selecteduser=null)
 message_get_contact_add_remove_link ($incontactlist, $isblocked, $contact, $script=null, $text=false, $icon=true)
 message_get_contact_block_link ($incontactlist, $isblocked, $contact, $script=null, $text=false, $icon=true)
 message_move_userfrom_unread2read ($userid)
 message_mark_messages_read ($touserid, $fromuserid)
 message_mark_message_read ($message, $timeread, $messageworkingempty=false)
 message_print_heading ($title, $colspan=3)
 get_message_processors ($ready=false)
 get_message_processor ($type)
 get_message_output_default_preferences ()
 translate_message_default_setting ($plugindefault, $processorname)
 message_page_type_list ($pagetype, $parentcontext, $currentcontext)

Enumeration Type Documentation

Definition at line 54 of file lib.php.

Define contants for messaging default settings population. For unambiguity of plugin developer intentions we use 4-bit value (LSB numbering): bit 0 - whether to send message when user is loggedin (MESSAGE_DEFAULT_LOGGEDIN) bit 1 - whether to send message when user is loggedoff (MESSAGE_DEFAULT_LOGGEDOFF) bit 2..3 - messaging permission (MESSAGE_DISALLOWED|MESSAGE_PERMITTED|MESSAGE_FORCED)

MESSAGE_PERMITTED_MASK contains the mask we use to distinguish permission setting

Definition at line 67 of file lib.php.

Definition at line 68 of file lib.php.

Set default value for default outputs permitted setting

Definition at line 79 of file lib.php.

Definition at line 70 of file lib.php.

Definition at line 37 of file lib.php.

Definition at line 36 of file lib.php.

Definition at line 72 of file lib.php.

Definition at line 42 of file lib.php.

Definition at line 41 of file lib.php.

Definition at line 55 of file lib.php.

Definition at line 71 of file lib.php.

Definition at line 74 of file lib.php.

Definition at line 52 of file lib.php.

Definition at line 28 of file lib.php.

Definition at line 39 of file lib.php.

Definition at line 48 of file lib.php.

Definition at line 47 of file lib.php.

Definition at line 49 of file lib.php.

Definition at line 45 of file lib.php.

Definition at line 46 of file lib.php.

Definition at line 50 of file lib.php.

Definition at line 44 of file lib.php.


Function Documentation

conversationsort ( a,
b 
)

Sort function used to order conversations

Parameters:
object$aA conversation object
object$bA conversation object
Returns:
integer

Definition at line 768 of file lib.php.

Get messaging outputs default (site) preferences

Returns:
object $processors object containing information on message processors

Definition at line 2349 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

get_message_processor ( type)

Get an instance of the message_output class for one of the output plugins.

Parameters:
string$typethe message output type. E.g. 'email' or 'jabber'.
Returns:
message_output message_output the requested class.

Definition at line 2321 of file lib.php.

Here is the caller graph for this function:

get_message_processors ( ready = false)

Get all message processors, validate corresponding plugin existance and system configuration

Parameters:
bool$readyonly return ready-to-use processors
Returns:
mixed $processors array of objects containing information on message processors

Definition at line 2269 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

message_add_contact ( contactid,
blocked = 0 
)

Add the selected user as a contact for the current user

Parameters:
int$contactidthe ID of the user to add as a contact
int$blocked1 if you wish to block the contact
Returns:
bool/int false if the $contactid isnt a valid user id. True if no changes made. Otherwise returns the result of update_record() or insert_record()

record already exists - we may be changing blocking status

change to blocking status

no changes to blocking status

new contact record

Definition at line 930 of file lib.php.

Here is the caller graph for this function:

message_block_contact ( contactid)

block a user

Parameters:
int$contactidthe user ID of the user to block

Definition at line 986 of file lib.php.

Here is the call graph for this function:

message_contact_link ( userid,
linktype = 'add',
return = false,
script = null,
text = false,
icon = true 
)

Print a message contact link

type $str

Parameters:
int$useridthe ID of the user to apply to action to
string$linktypecan be add, remove, block or unblock
bool$returnif true return the link as a string. If false echo the link.
string$scriptthe URL to send the user to when the link is clicked. If null, the current page.
bool$textinclude text next to the icons?
bool$iconinclude a graphical icon?
Returns:
string if $return is true otherwise bool

Definition at line 1335 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

message_count_blocked_users ( user1 = null)

Count the number of users blocked by $user1

Parameters:
object$user1user object
Returns:
int the number of blocked users

Definition at line 595 of file lib.php.

message_count_messages ( messagearray,
field = '',
value = '' 
)

Count the number of messages with a field having a specified value. if $field is empty then return count of the whole array if $field is non-existent then return 0

Parameters:
array$messagearrayarray of message objects
string$fieldthe field to inspect on the message objects
string$valuethe value to test the field against

Definition at line 555 of file lib.php.

message_count_unread_messages ( user1 = null,
user2 = null 
)

Returns the count of unread messages for user. Either from a specific user or from all users.

Parameters:
object$user1the first user. Defaults to $USER
object$user2the second user. If null this function will count all of user 1's unread messages.
Returns:
int the count of $user1's unread messages

Definition at line 573 of file lib.php.

message_format_contexturl ( message)

Format a the context url and context url name of a message for display

Parameters:
object$messagethe message object
Returns:
string the formatted string

Definition at line 1977 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

message_format_message ( message,
format = '',
keywords = '',
class = 'other' 
)

Format a message for display in the message history

Parameters:
object$messagethe message object
string$formatoptional date format
string$keywordskeywords to highlight
string$classCSS class to apply to the div around the message
Returns:
string the formatted message

Definition at line 1933 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

message_get_blocked_users ( user1 = null,
user2 = null 
)

Retrieve users blocked by $user1

Parameters:
object$user1the user whose messages are being viewed
object$user2the user $user1 is talking to. If they are being blocked they will have a variable called 'isblocked' added to their user object
Returns:
array the users blocked by $user1

Definition at line 221 of file lib.php.

Here is the call graph for this function:

message_get_contact ( contactid)

Load a user's contact record

Parameters:
int$contactidthe user ID of the user whose contact record you want
Returns:
array message contacts

Definition at line 996 of file lib.php.

message_get_contact_add_remove_link ( incontactlist,
isblocked,
contact,
script = null,
text = false,
icon = true 
)

Constructs the add/remove contact link to display next to other users

Parameters:
bool$incontactlistis the user a contact
bool$isblockedis the user blocked
type$contactcontact object
string$scriptthe URL to send the user to when the link is clicked. If null, the current page.
bool$textinclude text next to the icons?
bool$iconinclude a graphical icon?
Returns:
string

Definition at line 2144 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

message_get_contact_block_link ( incontactlist,
isblocked,
contact,
script = null,
text = false,
icon = true 
)

Constructs the block contact link to display next to other users

Parameters:
bool$incontactlistis the user a contact
bool$isblockedis the user blocked
type$contactcontact object
string$scriptthe URL to send the user to when the link is clicked. If null, the current page.
bool$textinclude text next to the icons?
bool$iconinclude a graphical icon?
Returns:
string

Definition at line 2169 of file lib.php.

Here is the caller graph for this function:

message_get_contacts ( user1 = null,
user2 = null 
)

Retrieve $user1's contacts (online, offline and strangers)

Parameters:
object$user1the user whose messages are being viewed
object$user2the user $user1 is talking to. If they are a contact they will have a variable called 'iscontact' added to their user object
Returns:
array containing 3 arrays. array($onlinecontacts, $offlinecontacts, $strangers)

Definition at line 302 of file lib.php.

Here is the call graph for this function:

Load the course contexts for all of the users courses

Parameters:
array$coursesarray of course objects. The courses the user is enrolled in.
Returns:
array of course contexts

Definition at line 524 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

message_get_fragment ( message,
keywords 
)

Given a string and an array of keywords, this function looks for the first keyword in the string, and then chops out a small section from the text that shows that word in context.

Parameters:
string$messagethe text to search
array$keywordsarray of keywords to find

Find the start of the fragment

Find the end of the fragment

Pull out the fragment and format it

Definition at line 1726 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

message_get_history ( user1,
user2,
limitnum = 0,
viewingnewmessages = false 
)

Retrieve the messages between two users

Parameters:
object$user1the current user
object$user2the other user
int$limitnumthe maximum number of messages to retrieve
bool$viewingnewmessagesare we currently viewing new messages?

Definition at line 1776 of file lib.php.

Here is the caller graph for this function:

Returns a list of all user ids who have used messaging in the site This was the simple way to code the SQL ... is it going to blow up on large datasets?

Todo:
: deprecated - to be deleted in 2.2
Returns:
array

Definition at line 2054 of file lib.php.

message_get_recent_conversations ( user,
limitfrom = 0,
limitto = 100 
)

Get the users recent conversations meaning all the people they've recently sent or received a message from plus the most recent message sent to or received from each other user

Parameters:
object$userthe current user
int$limitfromcan be used for paging
int$limittocan be used for paging
Returns:
array

Definition at line 677 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

message_get_recent_notifications ( user,
limitfrom = 0,
limitto = 100 
)

Get the users recent event notifications

Parameters:
object$userthe current user
int$limitfromcan be used for paging
int$limittocan be used for paging
Returns:
array

Definition at line 784 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

message_history_link ( userid1,
userid2,
return = false,
keywords = '',
position = '',
linktext = '' 
)

echo or return a link to take the user to the full message history between themselves and another user

type $strmessagehistory

Parameters:
int$userid1the ID of the user displayed on the left (usually the current user)
int$userid2the ID of the other user
bool$returntrue to return the link as a string. False to echo the link.
string$keywordsany keywords to highlight in the message history
string$positionanchor name to jump to within the message history
string$linktextoptionally specify the link text
Returns:
string|bool. Returns a string if $return is true. Otherwise returns a boolean.

Definition at line 1411 of file lib.php.

Here is the caller graph for this function:

message_mark_message_read ( message,
timeread,
messageworkingempty = false 
)

Mark a single message as read

Parameters:
messagean object with an object property ie $message->id which is an id in the message table
int$timereadthe timestamp for when the message should be marked read. Usually time().
bool$messageworkingemptyIs the message_working table already confirmed empty for this message?
Returns:
int the ID of the message in the message_read table

Definition at line 2232 of file lib.php.

Here is the caller graph for this function:

message_mark_messages_read ( touserid,
fromuserid 
)

marks ALL messages being sent from $fromuserid to $touserid as read

Parameters:
int$touseridthe id of the message recipient
int$fromuseridthe id of the message sender
Returns:
void

Definition at line 2211 of file lib.php.

Here is the call graph for this function:

Moves messages from a particular user from the message table (unread messages) to message_read This is typically only used when a user is deleted

Parameters:
object$useridUser id
Returns:
boolean success

Definition at line 2192 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

message_page_type_list ( pagetype,
parentcontext,
currentcontext 
)

Return a list of page types

Parameters:
string$pagetypecurrent page type
stdClass$parentcontextBlock's parent context
stdClass$currentcontextCurrent context of block

Definition at line 2407 of file lib.php.

message_post_message ( userfrom,
userto,
message,
format 
)

Send a message from one user to another. Will be delivered according to the message recipients messaging preferences

Parameters:
object$userfromthe message sender
object$usertothe message recipient
string$messagethe message
int$formatmessage format such as FORMAT_PLAIN or FORMAT_HTML
Returns:
int|false the ID of the new message or false

Definition at line 2004 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

message_print_blocked_users ( blockedusers,
contactselecturl = null,
showactionlinks = true,
titletodisplay = null,
user2 = null 
)

Print users blocked by $user1. Called by message_print_contact_selector()

Parameters:
array$blockedusersthe users blocked by $user1
string$contactselecturlthe url to send the user to when a contact's name is clicked
bool$showactionlinksshow action links (add/remove contact etc) next to the users
string$titletodisplayOptionally specify a title to display above the participants
object$user2the user $user1 is talking to. They will be highlighted if they appear in the list of blocked users
Returns:
void

Definition at line 266 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

if (!isset($CFG->message_contacts_refresh)) if (!isset($CFG->message_chat_refresh)) if (!isset($CFG->message_offline_time)) message_print_contact_selector ( countunreadtotal,
viewing,
user1,
user2,
blockedusers,
onlinecontacts,
offlinecontacts,
strangers,
showcontactactionlinks,
page = 0 
)

Print the selector that allows the user to view their contacts, course participants, their recent conversations etc

Parameters:
int$countunreadtotalhow many unread messages does the user have?
int$viewingWhat is the user viewing? ie MESSAGE_VIEW_UNREAD_MESSAGES, MESSAGE_VIEW_SEARCH etc
object$user1the user whose messages are being viewed
object$user2the user $user1 is talking to
array$blockedusersan array of users blocked by $user1
array$onlinecontactsan array of $user1's online contacts
array$offlinecontactsan array of $user1's offline contacts
array$strangersan array of users who have messaged $user1 who aren't contacts
bool$showcontactactionlinksshow action links (add/remove contact etc) next to the users in the contact selector
int$pageif there are so many users listed that they have to be split into pages what page are we viewing
Returns:
void

Definition at line 108 of file lib.php.

Here is the call graph for this function:

message_print_contactlist_user ( contact,
incontactlist = true,
isblocked = false,
selectcontacturl = null,
showactionlinks = true,
selecteduser = null 
)

Print a row of contactlist displaying user picture, messages waiting and block links etc

Parameters:
object$contactcontact object containing all fields required for $OUTPUT->user_picture()
bool$incontactlistis the user a contact of ours?
bool$isblockedis the user blocked?
string$selectcontacturlthe url to send the user to when a contact's name is clicked
bool$showactionlinksdisplay action links next to the other users (add contact, block user etc)
object$selecteduserthe user the current user is viewing (if any). They will be highlighted.
Returns:
void

are there any unread messages for this contact?

Definition at line 2077 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

message_print_contacts ( onlinecontacts,
offlinecontacts,
strangers,
contactselecturl = null,
minmessages = 0,
showactionlinks = true,
titletodisplay = null,
user2 = null 
)

Print $user1's contacts. Called by message_print_contact_selector()

Parameters:
array$onlinecontacts$user1's contacts which are online
array$offlinecontacts$user1's contacts which are offline
array$strangersusers which are not contacts but who have messaged $user1
string$contactselecturlthe url to send the user to when a contact's name is clicked
int$minmessagesThe minimum number of unread messages required from a user for them to be displayed Typically 0 (show all contacts) or 1 (only show contacts from whom we have a new message)
bool$showactionlinksshow action links (add/remove contact etc) next to the users
string$titletodisplayOptionally specify a title to display above the participants
object$user2the user $user1 is talking to. They will be highlighted if they appear in the list of contacts
Returns:
void

print out list of online contacts

print out list of offline contacts

print out list of incoming contacts

Definition at line 389 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

message_print_heading ( title,
colspan = 3 
)

A helper function that prints a formatted heading

Parameters:
string$titlethe heading to display
int$colspan
Returns:
void

Definition at line 2256 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

message_print_message_history ( user1,
user2,
search = '',
messagelimit = 0,
messagehistorylink = false,
viewingnewmessages = false 
)

Print the message history between two users

Parameters:
object$user1the current user
object$user2the other user
string$searchsearch terms to highlight
int$messagelimitmaximum number of messages to return
string$messagehistorylinkthe html for the message history link or false
bool$viewingnewmessagesare we currently viewing new messages?

Get all the messages and print them

Definition at line 1834 of file lib.php.

Here is the call graph for this function:

message_print_participants ( context,
courseid,
contactselecturl = null,
showactionlinks = true,
titletodisplay = null,
page = 0,
user2 = null 
)

Print course participants. Called by message_print_contact_selector()

Parameters:
object$contextthe course context
int$courseidthe course ID
string$contactselecturlthe url to send the user to when a contact's name is clicked
bool$showactionlinksshow action links (add/remove contact etc) next to the users
string$titletodisplayOptionally specify a title to display above the participants
int$pageif there are so many users listed that they have to be split into pages what page are we viewing
object$user2the user $user1 is talking to. They will be highlighted if they appear in the list of participants
Returns:
void

Definition at line 181 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

message_print_recent_conversations ( user = null,
showicontext = false 
)

Print the user's recent conversations

Parameters:
object$user1the current user
bool$showicontextflag indicating whether or not to show text next to the action icons
Returns:
void

Definition at line 806 of file lib.php.

Here is the call graph for this function:

message_print_recent_messages_table ( messages,
user = null,
showotheruser = true,
showicontext = false 
)

Print a list of recent messages

type $dateformat

Parameters:
array$messagesthe messages to display
object$userthe current user
bool$showotheruserdisplay information on the other user?
bool$showicontextshow text next to the action icons?
Returns:
void

not blocked

Definition at line 857 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

Print the user's recent notifications

Parameters:
object$user1the current user
Returns:
void

Definition at line 829 of file lib.php.

Here is the call graph for this function:

message_print_search ( advancedsearch = false,
user1 = null 
)

Print the search form and search results if a search has been performed

Parameters:
boolean$advancedsearchshow basic or advanced search form
object$user1the current user
Returns:
boolean true if a search was performed

Definition at line 617 of file lib.php.

Here is the call graph for this function:

message_print_search_results ( frm,
showicontext = false,
currentuser = null 
)

Print the results of a message search

Parameters:
mixed$frmsubmitted form data
bool$showicontextshow text next to action icons?
object$currentuserthe current user
Returns:
void

search for person

not blocked

get a list of contacts

print heading with number of results

print table headings

ignore messages to and from blocked users unless $frm->includeblocked is set

load up user to record

load up user from record

find date string for this message

print out message row

Definition at line 1009 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

message_print_user ( user = false,
iscontact = false,
isblocked = false,
includeicontext = false 
)

Print information on a user. Used when printing search results.

Parameters:
object/bool$user the user to display or false if you just want $USER
bool$iscontactis the user being displayed a contact?
bool$isblockedis the user being displayed blocked?
bool$includeicontextinclude text next to the action icons?
Returns:
void

Definition at line 1283 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

message_print_usergroup_selector ( viewing,
courses,
coursecontexts,
countunreadtotal,
countblocked,
strunreadmessages 
)

Print a select box allowing the user to choose to view new messages, course participants etc.

Called by message_print_contact_selector()

Parameters:
int$viewingWhat page is the user viewing ie MESSAGE_VIEW_UNREAD_MESSAGES, MESSAGE_VIEW_RECENT_CONVERSATIONS etc
array$coursesarray of course objects. The courses the user is enrolled in.
array$coursecontextsarray of course contexts. Keyed on course id.
int$countunreadtotalhow many unread messages does the user have?
int$countblockedhow many users has the current user blocked?
string$strunreadmessagesa preconstructed message about the number of unread messages the user has
Returns:
void

Definition at line 472 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

message_remove_contact ( contactid)

remove a contact

Parameters:
type$contactidthe user ID of the contact to remove
Returns:
bool returns the result of delete_records()

Definition at line 965 of file lib.php.

message_remove_url_params ( moodleurl)

strip off action parameters like 'removecontact'

Parameters:
moodle_url/string$moodleurl a URL. Typically the current page URL.
Returns:
string the URL minus parameters that perform actions (like adding/removing/blocking a contact).

Definition at line 540 of file lib.php.

Here is the caller graph for this function:

message_search ( searchterms,
fromme = true,
tome = true,
courseid = 'none',
userid = 0 
)

search a user's messages

Parameters:
array$searchtermsan array of search terms (strings)
bool$frommeinclude messages from the user?
bool$tomeinclude messages to the user?
mixed$courseidSITEID for admins searching all messages. Other behaviour not yet implemented
int$useridthe user ID of the current user
Returns:
mixed An array of messages or false if no matching messages were found

Returns a list of posts found using an array of search terms eg word +word -word

If no userid sent then assume current user

Some differences in SQL syntax

Initially we aren't going to perform NOT LIKE searches, only MSSQL and Oracle

Under Oracle and MSSQL, trim the + and - operators and perform simpler LIKE search

There are several possibilities 1. courseid = SITEID : The admin is searching messages by all users 2. courseid = ?? : A teacher is searching messages by users in one of their courses - currently disabled 3. courseid = none : User is searching their own messages; a. Messages from user b. Messages to user c. Messages to and from user

admin is searching all messages

This has not been implemented due to security concerns

The keys may be duplicated in $m_read and $m_unread so we can't do a simple concatenation

Definition at line 1532 of file lib.php.

Here is the caller graph for this function:

message_search_users ( courseid,
searchtext,
sort = '',
exceptions = '' 
)

Search through course users

If $coursid specifies the site course then this function searches through all undeleted and confirmed users

Parameters:
int$courseidThe course in question.
string$searchtextthe text to search for
string$sortthe column name to order by
string$exceptionscomma separated list of user IDs to exclude
Returns:
array An array of $USER records.

Definition at line 1472 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

message_shorten_message ( message,
minlength = 0 
)

Given a message object that we already know has a long message this function truncates the message nicely to the first sane place between $CFG->forum_longpost and $CFG->forum_shortpost

Parameters:
string$messagethe message
int$minlengththe minimum length to trim the message to
Returns:
string the shortened message

Definition at line 1671 of file lib.php.

Here is the caller graph for this function:

message_unblock_contact ( contactid)

Unblock a contact. Note that this reverts the previously blocked user back to a non-contact.

Parameters:
int$contactidthe user ID of the contact to unblock
Returns:
bool returns the result of delete_records()

Definition at line 976 of file lib.php.

translate_message_default_setting ( plugindefault,
processorname 
)

Translate message default settings from binary value to the array of string representing the settings to be stored. Also validate the provided value and use default if it is malformed.

Parameters:
int$plugindefaultDefault setting suggested by plugin
string$processornameThe name of processor
Returns:
array $settings array of strings in the order: $permitted, $loggedin, $loggedoff.

Definition at line 2362 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

 All Data Structures Namespaces Files Functions Variables Enumerations