Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
|
Public Member Functions | |
display ($question, $rowclasses) | |
Output this column. | |
display_header (array $columnactions=[], string $width='') | |
Output the column header cell. | |
display_preview (\stdClass $question, string $rowclasses) | |
Output the column with an example value. | |
get_column_id () | |
Return a unique ID for this column object. | |
get_column_name () | |
Get the name of this column. | |
get_default_width () | |
Return the default column width in pixels. | |
get_extra_classes () | |
Any extra class names you would like applied to every cell in this column. | |
get_extra_joins () | |
Return an array 'table_alias' => 'JOIN clause' to bring in any data that this feature requires. | |
get_menu_position () | |
Return an integer to indicate the desired position in the menu for this link, smaller at the top. | |
get_name () | |
Get the internal name for this column. | |
get_preference () | |
Get if the preference of the row. | |
get_preference_key () | |
Get if the preference key of the row. | |
get_required_fields () | |
Use table alias 'q' for the question table, or one of the ones from get_extra_joins. | |
get_required_statistics_fields () | |
If this column requires any aggregated statistics, it should declare that here. | |
get_title () | |
Title for this column. | |
get_title_tip () | |
Use this when get_title() returns something very short, and you want a longer version as a tool tip. | |
has_preference () | |
Check if the row has an extra preference to view/hide. | |
help_icon () | |
If you return a help icon here, it is shown in the column header after the title. | |
is_extra_row () | |
Check if the column is an extra row of not. | |
is_sortable () | |
Can this column be sorted on? You can return either: | |
load_additional_data (array $questions) | |
If this column needs extra data (e.g. | |
load_question_tags (array $questions) | |
Load the tags for each question. | |
set_as_heading () | |
Set the column as heading. | |
sort_expression ($reverse, $subsort) | |
Sorts the expressions. | |
Static Public Member Functions | |
static | from_column_name (view $view, string $columnname, bool $ingoremissing=false) |
Return an instance of this column, based on the column name. | |
Public Attributes | |
bool | $isvisible = true |
determine whether the column is visible | |
string const | ID_SEPARATOR = '-' |
A separator for joining column attributes together into a unique ID string. | |
int const | MENU_POSITION_NOT_SET = 6666 |
value we return from get_menu_position here. | |
Protected Member Functions | |
display_content ($question, $rowclasses) | |
Output the contents of this column. | |
display_end ($question, $rowclasses) | |
Output the closing column tag. | |
display_start ($question, $rowclasses) | |
Output the opening column tag. | |
get_classes () | |
The CSS classes to apply to every cell in this column. | |
get_sort_icon ($reverse) | |
Get an icon representing the corrent sort state. | |
init () | |
A chance for subclasses to initialise themselves, for example to load lang strings, without having to override the constructor. | |
make_sort_link ($sortname, $title, $tip, $defaultreverse=false) | |
Get a link that changes the sort order, and indicates the current sort state. | |
sortorder ($reverse) | |
Helper method for building sort clauses. | |
Protected Attributes | |
bool | $isheading = false |
determine whether the column is td or th. | |
view | $qbank |
$qbank the question bank view we are helping to render. | |
|
inherited |
Output this column.
object | $question | the row from the $question table, augmented with extra information. |
string | $rowclasses | CSS class names that should be applied to this row of output. |
|
protected |
Output the contents of this column.
object | $question | the row from the $question table, augmented with extra information. |
string | $rowclasses | CSS class names that should be applied to this row of output. |
Reimplemented from core_question\local\bank\column_base.
|
protectedinherited |
Output the closing column tag.
object | $question | |
string | $rowclasses |
Reimplemented in core_question\local\bank\row_base.
|
inherited |
Output the column header cell.
column_action_base[] | $columnactions | A list of column actions to include in the header. |
string | $width | A CSS width property value. |
Reimplemented in core_question\local\bank\checkbox_column.
|
inherited |
Output the column with an example value.
By default, this will call $this->display() using whatever dummy data is passed in. Columns can override this to provide example output without requiring valid data.
stdClass | $question | the row from the $question table, augmented with extra information. |
string | $rowclasses | CSS class names that should be applied to this row of output. |
Reimplemented in qbank_statistics\columns\discrimination_index, qbank_statistics\columns\discriminative_efficiency, and qbank_statistics\columns\facility_index.
|
protectedinherited |
Output the opening column tag.
If it is set as heading, it will use
tag instead of
stdClass | $question | |
string | $rowclasses |
Reimplemented in core_question\local\bank\row_base.
|
staticinherited |
Return an instance of this column, based on the column name.
In the case of the base class, we don't actually use the column name since the class represents one specific column. However, sub-classes may use the column name as an additional constructor to the parameter.
view | $view | Question bank view |
string | $columnname | The column name for this instance, as returned by { |
bool | $ingoremissing | Whether to ignore if the class does not exist. |
column_base|null | An instance of this class. |
Reimplemented in qbank_customfields\custom_field_column.
|
protectedinherited |
The CSS classes to apply to every cell in this column.
string |
|
finalinherited |
Return a unique ID for this column object.
This is constructed using the class name and get_column_name(), which must be unique.
The combination of these attributes allows the object to be reconstructed, by splitting the ID into its constituent parts then calling {
string | The column ID. |
|
inherited |
Get the name of this column.
This must be unique. When using the inherited class to make many columns from one parent, ensure each instance returns a unique value.
string | The unique name; |
Reimplemented in qbank_customfields\custom_field_column.
mod_quiz\question\bank\preview_action_column::get_default_width | ( | ) |
Return the default column width in pixels.
int |
Reimplemented from core_question\local\bank\column_base.
mod_quiz\question\bank\preview_action_column::get_extra_classes | ( | ) |
Any extra class names you would like applied to every cell in this column.
array |
Reimplemented from core_question\local\bank\column_base.
|
inherited |
Return an array 'table_alias' => 'JOIN clause' to bring in any data that this feature requires.
The return values for all the features will be checked. It is OK if two features join in the same table with the same alias and identical JOIN clauses. If two features try to use the same alias with different joins, you get an error. Tables included by default are question (alias q) and those defined in {
It is importnat that your join simply adds additional data (or NULLs) to the existing rows of the query. It must not cause additional rows.
string[] | 'table_alias' => 'JOIN clause' |
Reimplemented from core_question\local\bank\view_component.
Reimplemented in core_question\local\bank\action_column_base, qbank_viewcreator\creator_name_column, and qbank_viewcreator\modifier_name_column.
|
inherited |
Return an integer to indicate the desired position in the menu for this link, smaller at the top.
The standard menu items in Moodle core return these numbers: 100 preview_action 200 edit_action 250 copy_action 300 tags_action 400 delete_action 500 history_action 600 export_xml_action (So, if you want your action at a particular place in the order, there should be space.)
If two actions get the same order number, then the tie-break on the sort is plugin name, then the order returned by get_question_actions for that plugin.
int | desired position. Smallest at the top. |
Reimplemented in qbank_deletequestion\delete_action, qbank_editquestion\copy_action, qbank_editquestion\edit_action, qbank_exporttoxml\export_xml_action, qbank_history\history_action, qbank_previewquestion\preview_action, and qbank_tagquestion\tags_action.
mod_quiz\question\bank\preview_action_column::get_name | ( | ) |
Get the internal name for this column.
Used as a CSS class name, and to store information about the current sort. Must match PARAM_ALPHA.
string | column name. |
Reimplemented from core_question\local\bank\column_base.
|
inherited |
Get if the preference key of the row.
Reimplemented in qbank_viewquestiontext\question_text_row.
|
inherited |
Use table alias 'q' for the question table, or one of the ones from get_extra_joins.
Every field requested must specify a table prefix.
string[] | fields required. |
Reimplemented from core_question\local\bank\view_component.
Reimplemented in core_question\local\bank\action_column_base, core_question\local\bank\checkbox_column, core_question\local\bank\edit_menu_column, mod_quiz\question\bank\question_name_column, mod_quiz\question\bank\question_name_text_column, qbank_viewcreator\creator_name_column, qbank_viewcreator\modifier_name_column, qbank_viewquestionname\question_name_idnumber_tags_column, qbank_viewquestionname\viewquestionname_column_helper, qbank_viewquestiontext\question_text_row, and qbank_viewquestiontype\question_type_column.
|
inherited |
If this column requires any aggregated statistics, it should declare that here.
This is those statistics can be efficiently loaded in bulk.
The statistics are all loaded just before load_additional_data is called on each column. The values are then available from $this->qbank->get_aggregate_statistic(...);
string[] | the names of the required statistics fields. E.g. ['facility']. |
Reimplemented in qbank_statistics\columns\discrimination_index, qbank_statistics\columns\discriminative_efficiency, and qbank_statistics\columns\facility_index.
|
protectedinherited |
Get an icon representing the corrent sort state.
bool | $reverse | sort is descending, not ascending. |
string | HTML image tag. |
mod_quiz\question\bank\preview_action_column::get_title | ( | ) |
Title for this column.
Not used if is_sortable returns an array.
Reimplemented from core_question\local\bank\column_base.
|
inherited |
Use this when get_title() returns something very short, and you want a longer version as a tool tip.
string | a fuller version of the name. |
Reimplemented in core_question\local\bank\checkbox_column, and qbank_viewquestiontype\question_type_column.
|
inherited |
Check if the row has an extra preference to view/hide.
Reimplemented in qbank_viewquestiontext\question_text_row.
|
inherited |
If you return a help icon here, it is shown in the column header after the title.
help_icon|null | help icon to show, if required. |
Reimplemented in qbank_statistics\columns\discrimination_index, qbank_statistics\columns\discriminative_efficiency, qbank_statistics\columns\facility_index, qbank_usage\question_last_used_column, and qbank_usage\question_usage_column.
|
protectedinherited |
A chance for subclasses to initialise themselves, for example to load lang strings, without having to override the constructor.
Reimplemented in core_question\local\bank\column_action_base, mod_quiz\question\bank\add_action_column, qbank_columnsortorder\local\bank\column_action_move, qbank_columnsortorder\local\bank\column_action_remove, qbank_columnsortorder\local\bank\column_action_resize, qbank_comment\comment_count_column, qbank_deletequestion\delete_action, qbank_editquestion\copy_action, qbank_editquestion\edit_action, qbank_exporttoxml\export_xml_action, qbank_history\history_action, qbank_previewquestion\preview_action, qbank_tagquestion\tags_action, qbank_usage\question_usage_column, and qbank_viewquestiontext\question_text_row.
|
inherited |
Check if the column is an extra row of not.
Reimplemented in core_question\local\bank\row_base.
|
inherited |
Can this column be sorted on? You can return either:
mixed | as above. |
Reimplemented in mod_quiz\question\bank\question_name_column, qbank_viewcreator\creator_name_column, qbank_viewcreator\modifier_name_column, qbank_viewquestionname\question_name_idnumber_tags_column, qbank_viewquestionname\viewquestionname_column_helper, and qbank_viewquestiontype\question_type_column.
|
inherited |
If this column needs extra data (e.g.
tags) then load that here.
The extra data should be added to the question object in the array. Probably a good idea to check that another column has not already loaded the data you want.
stdClass[] | $questions | the questions that will be displayed, indexed by question id. |
Reimplemented in mod_quiz\question\bank\question_name_text_column, and qbank_viewquestionname\question_name_idnumber_tags_column.
|
inherited |
Load the tags for each question.
Helper that can be used from {
array | $questions |
|
protectedinherited |
Get a link that changes the sort order, and indicates the current sort state.
string | $sortname | the column to sort on. |
string | $title | the link text. |
string | $tip | the link tool-tip text. If empty, defaults to title. |
bool | $defaultreverse | whether the default sort order for this column is descending, rather than ascending. |
string |
|
inherited |
Sorts the expressions.
bool | $reverse | Whether to sort in the reverse of the default sort order. |
string | $subsort | if is_sortable returns an array of subnames, then this will be one of those. Otherwise will be empty. |
string | some SQL to go in the order by clause. |
|
protectedinherited |
Helper method for building sort clauses.
bool | $reverse | whether the normal direction should be reversed. |
string | 'ASC' or 'DESC' |
|
inherited |
value we return from get_menu_position here.
Subclasses should override this.