Moodle  2.2.1
http://www.collinsharper.com
comment Class Reference

Public Member Functions

 __construct (stdClass $options)
 set_component ($component)
 set_view_permission ($value)
 set_post_permission ($value)
 get_nojslink (moodle_page $page=null)
 set_notoggle ($newvalue=true)
 set_autostart ($newvalue=true)
 set_displaycancel ($newvalue=true)
 set_displaytotalcount ($newvalue=true)
 initialise_javascript (moodle_page $page)
 output ($return=true)
 get_comments ($page= '')
 count ()
 get_pagination ($page=0)
 add ($content, $format=FORMAT_MOODLE)
 delete_comments ($param)
 reset_course_page_comments ($context)
 delete ($commentid)
 print_comments ($page=0, $return=true, $nonjs=true)
 print_comment ($cmt, $nonjs=true)
 can_view ()
 can_post ()
 can_delete ($commentid)
 get_compontent ()
 get_context ()
 get_courseid ()
 get_cm ()
 get_itemid ()
 get_commentarea ()

Static Public Member Functions

static init (moodle_page $page=null)

Protected Member Functions

 validate ($params=array())

Protected Attributes

 $notoggle = false
 $autostart = false
 $displaytotalcount = false
 $displaycancel = false
 $totalcommentcount = null

Detailed Description

Definition at line 27 of file lib.php.


Constructor & Destructor Documentation

__construct ( stdClass $  options)

#@- Construct function of comment class, initialise class members

Parameters:
stdClass$options
object$options{ context => context context to use for the comment [required] component => string which plugin will comment being added to [required] itemid => int the id of the associated item (forum post, glossary item etc) [required] area => string comment area cm => stdClass course module course => course course object client_id => string an unique id to identify comment area autostart => boolean automatically expend comments showcount => boolean display the number of comments displaycancel => boolean display cancel button notoggle => boolean don't show/hide button linktext => string title of show/hide button }

Definition at line 160 of file lib.php.

Here is the call graph for this function:


Member Function Documentation

add ( content,
format = FORMAT_MOODLE 
)

Add a new comment

moodle_database $DB

Parameters:
string$content
Returns:
mixed

Definition at line 651 of file lib.php.

Here is the call graph for this function:

can_delete ( commentid)

Returns true if the user can delete this comment

Parameters:
int$commentid
Returns:
bool

Definition at line 881 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

can_post ( )

Returns true if the user can add comments against this comment description

Returns:
bool

Definition at line 871 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

can_view ( )

Returns true if the user is able to view comments

Returns:
bool

Definition at line 862 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

count ( )

Returns the number of comments associated with the details of this object

moodle_database $DB

Returns:
int

Definition at line 600 of file lib.php.

Here is the caller graph for this function:

delete ( commentid)

Delete a comment

Parameters:
int$commentid
Returns:
mixed

Definition at line 726 of file lib.php.

Here is the call graph for this function:

delete_comments ( param)

delete by context, commentarea and itemid

Parameters:
stdClass | array$param{ contextid => int the context in which the comments exist [required] commentarea => string the comment area [optional] itemid => int comment itemid [optional] }
Returns:
boolean

Definition at line 693 of file lib.php.

Here is the caller graph for this function:

get_cm ( )

Returns the course module associated with the comment

Returns:
stdClass

Definition at line 915 of file lib.php.

Returns the comment area associated with the commentarea

Returns:
stdClass

Definition at line 933 of file lib.php.

get_comments ( page = '')

Return matched comments

Parameters:
int$page
Returns:
mixed

Definition at line 541 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

Returns the component associated with the comment

Returns:
string

Definition at line 890 of file lib.php.

Returns the context associated with the comment

Returns:
stdClass

Definition at line 898 of file lib.php.

Returns the course id associated with the comment

Returns:
int

Definition at line 906 of file lib.php.

Returns the item id associated with the comment

Returns:
int

Definition at line 924 of file lib.php.

get_nojslink ( moodle_page page = null)

Gets a link for this page that will work with JS disabled.

moodle_page $PAGE

Parameters:
moodle_page$page
Returns:
moodle_url

Definition at line 355 of file lib.php.

Here is the caller graph for this function:

get_pagination ( page = 0)

Returns HTML to display a pagination bar

stdClass $CFG core_renderer $OUTPUT

Parameters:
int$page
Returns:
string

Definition at line 616 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

static init ( moodle_page page = null) [static]

Receive nonjs comment parameters

Parameters:
moodle_page$pageThe page object to initialise comments within If not provided the global $PAGE is used

Definition at line 277 of file lib.php.

Here is the call graph for this function:

Initialises the JavaScript that enchances the comment API.

Parameters:
moodle_page$pageThe moodle page object that the JavaScript should be initialised for.

Definition at line 425 of file lib.php.

Here is the caller graph for this function:

output ( return = true)

Prepare comment code in html

Parameters:
boolean$return
Returns:
mixed

Definition at line 448 of file lib.php.

Here is the call graph for this function:

print_comment ( cmt,
nonjs = true 
)

Returns an array containing comments in HTML format.

core_renderer $OUTPUT

Parameters:
stdClass$cmt{ id => int comment id content => string comment content format => int comment text format timecreated => int comment's timecreated profileurl => string link to user profile fullname => comment author's full name avatar => string user's avatar delete => boolean does user have permission to delete comment? }
bool$nonjs
Returns:
array

Definition at line 817 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

print_comments ( page = 0,
return = true,
nonjs = true 
)

Print comments

Parameters:
int$page
boolean$returnreturn comments list string or print it out
boolean$nonjsprint nonjs comments list or not?
Returns:
mixed

Definition at line 747 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

Delete page_comments in whole course, used by course reset

Parameters:
stdClass$contextcourse context

Definition at line 708 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

set_autostart ( newvalue = true)

Sets the value of the autostart option.

If set to true then the comments will be loaded during page load. Normally this happens only once the user expands the comment section.

Parameters:
bool$newvalue

Definition at line 391 of file lib.php.

Here is the caller graph for this function:

set_component ( component)

Sets the component.

This method shouldn't be public, changing the component once it has been set potentially invalidates permission checks. A coding_error is now thrown if code attempts to change the component.

Parameters:
string$component
Returns:
void

Definition at line 306 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

set_displaycancel ( newvalue = true)

Sets the displaycancel option

If set to true then a cancel button will be shown when using the form to post comments.

Parameters:
bool$newvalue

Definition at line 403 of file lib.php.

Here is the caller graph for this function:

set_displaytotalcount ( newvalue = true)

Sets the displaytotalcount option

If set to true then the total number of comments will be displayed when printing comments.

Parameters:
bool$newvalue

Definition at line 415 of file lib.php.

Here is the caller graph for this function:

set_notoggle ( newvalue = true)

Sets the value of the notoggle option.

If set to true then the user will not be able to expand and collase the comment section.

Parameters:
bool$newvalue

Definition at line 379 of file lib.php.

Here is the caller graph for this function:

set_post_permission ( value)

Determines if the user can post a comment

Parameters:
bool$value

Definition at line 328 of file lib.php.

set_view_permission ( value)

Determines if the user can view the comment.

Parameters:
bool$value

Definition at line 319 of file lib.php.

validate ( params = array()) [protected]

Revoke validate callbacks

Parameters:
stdClass$paramsaddtionall parameters need to add to callbacks

Definition at line 848 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:


Field Documentation

$autostart = false [protected]

Definition at line 113 of file lib.php.

$displaycancel = false [protected]

Definition at line 123 of file lib.php.

$displaytotalcount = false [protected]

Definition at line 118 of file lib.php.

$notoggle = false [protected]

Definition at line 107 of file lib.php.

$totalcommentcount = null [protected]

Definition at line 128 of file lib.php.


The documentation for this class was generated from the following file:
 All Data Structures Namespaces Files Functions Variables Enumerations