Moodle APIs 3.9
Moodle 3.9.13+ (Build: 20220325)
Public Member Functions | Public Attributes | Protected Attributes | List of all members
user_filter_checkbox Class Reference

Generic filter based for checkbox and can be used for disabling items. More...

Inheritance diagram for user_filter_checkbox:
user_filter_type

Public Member Functions

 __construct ($name, $label, $advanced, $field, $disableelements=null)
 Constructor, initalize user_filter_type and sets $disableelements array with list of elements to be diabled by checkbox. More...
 
 check_data ($formdata)
 Retrieves data from the form data. More...
 
 get_label ($data)
 Returns a human friendly description of the filter used as label. More...
 
 get_sql_filter ($data)
 Returns the condition to be used with SQL where. More...
 
 setupForm (&$mform)
 Adds controls specific to this filter in the form. More...
 
 user_filter_type ($name, $label, $advanced)
 Old syntax of class constructor. More...
 

Public Attributes

bool $_advanced
 Advanced form element flag.
 
string $_label
 The label of this filter instance.
 
string $_name
 The name of this filter instance.
 

Protected Attributes

array $disableelements = array()
 list of all the fields which needs to be disabled, if checkbox is checked
 
mixed $field
 name of user table field/fields on which data needs to be compared
 

Detailed Description

Generic filter based for checkbox and can be used for disabling items.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Constructor & Destructor Documentation

◆ __construct()

user_filter_checkbox::__construct (   $name,
  $label,
  $advanced,
  $field,
  $disableelements = null 
)

Constructor, initalize user_filter_type and sets $disableelements array with list of elements to be diabled by checkbox.

Parameters
string$namethe name of the filter instance
string$labelthe label of the filter instance
boolean$advancedadvanced form element flag
mixed$fielduser table field/fields name for comparison
array$disableelementsname of fields which should be disabled if this checkbox is checked.

Member Function Documentation

◆ check_data()

user_filter_checkbox::check_data (   $formdata)

Retrieves data from the form data.

Parameters
object$formdatadata submited with the form
Return values
mixedarray filter data or false when filter not set

Reimplemented from user_filter_type.

◆ get_label()

user_filter_checkbox::get_label (   $data)

Returns a human friendly description of the filter used as label.

Parameters
array$datafilter settings
Return values
stringactive filter label

Reimplemented from user_filter_type.

◆ get_sql_filter()

user_filter_checkbox::get_sql_filter (   $data)

Returns the condition to be used with SQL where.

Parameters
array$datafilter settings
Return values
arraysql string and $params

Reimplemented from user_filter_type.

◆ setupForm()

user_filter_checkbox::setupForm ( $mform)

Adds controls specific to this filter in the form.

Parameters
moodleform$mforma MoodleQuickForm object in which element will be added

Reimplemented from user_filter_type.

◆ user_filter_type()

user_filter_type::user_filter_type (   $name,
  $label,
  $advanced 
)
inherited

Old syntax of class constructor.

Deprecated in PHP7.

Deprecated:
since Moodle 3.1

The documentation for this class was generated from the following file: