|
| | add_indented_names (array $categories, int $nochildrenof=-1) |
| | Format categories into an indented list reflecting the tree structure.
|
| |
| | export_for_template (renderer_base $output) |
| | Context for the question_category_selector.mustache template.
|
| |
| | flatten_category_tree (array &$categories, $id, int $depth=0, int $nochildrenof=-1) |
| | Only for the use of add_indented_names().
|
| |
| | get_categories_for_contexts (string $contexts, string $sortorder='parent, sortorder, name ASC', bool $top=false, int $showallversions=0,) |
| | Constructor.
|
| |
| | question_add_context_in_key (array $categories) |
| | Add context in categories key.
|
| |
| | question_category_options (array $contexts, bool $top=false, int $currentcat=0, bool $popupform=false, int $nochildrenof=-1, bool $escapecontextnames=true,) |
| | Output an array of question categories.
|
| |
| | question_fix_top_names (array $categories, bool $escape=true) |
| | Finds top categories in the given categories hierarchy and replace their name with a proper localised string.
|
| |
◆ add_indented_names()
| core_question\output\question_category_selector::add_indented_names |
( |
array | $categories, |
|
|
int | $nochildrenof = -1 ) |
Format categories into an indented list reflecting the tree structure.
- Parameters
-
| array | $categories | An array of category objects, keyed by ID. |
| int | $nochildrenof | If the category with this ID is in the list, don't include its children. |
- Return values
-
| array | The formatted list of categories. |
◆ export_for_template()
| core_question\output\question_category_selector::export_for_template |
( |
renderer_base | $output | ) |
|
Context for the question_category_selector.mustache template.
- Parameters
-
- Return values
-
| array[] | [ 'banks' => a 2-D array of question banks and categories, for a plain select list with optgroups. 'categories' => A flat list of categories, with bank names and disabled entries, for enhancing with an Autocomplete. ] |
Implements core\output\templatable.
◆ flatten_category_tree()
| core_question\output\question_category_selector::flatten_category_tree |
( |
array & | $categories, |
|
|
| $id, |
|
|
int | $depth = 0, |
|
|
int | $nochildrenof = -1 ) |
Only for the use of add_indented_names().
Recursively adds an indentedname field to each category, starting with the category with id $id, and dealing with that category and all its children, and return a new array, with those categories in the right order.
- Parameters
-
| array | $categories | an array of categories which has had childids fields added by flatten_category_tree(). Passed by reference for performance only. It is not modfied. |
| int | $id | the category to start the indenting process from. |
| int | $depth | the indent depth. Used in recursive calls. |
| int | $nochildrenof | If the category with this ID is in the list, don't recur to its children. |
- Return values
-
| array | a new array of categories, in the right order for the tree. |
◆ get_categories_for_contexts()
| core_question\output\question_category_selector::get_categories_for_contexts |
( |
string | $contexts, |
|
|
string | $sortorder = 'parent, |
|
|
sortorder | , |
|
|
name ASC' | , |
|
|
bool | $top = false, |
|
|
int | $showallversions = 0 ) |
Constructor.
- Parameters
-
| array | $contexts | |
| bool | $top | |
| string | $currentcat | |
| string | $selected | |
| int | $nochildrenof | |
| bool | $autocomplete | Get all the category objects, including a count of the number of questions in that category, for all the categories in the lists $contexts. |
| string | $contexts | comma separated list of contextids |
| string | $sortorder | used as the ORDER BY clause in the select statement. |
| bool | $top | Whether to return the top categories or not. |
| int | $showallversions | 1 to show all versions not only the latest. |
- Return values
-
| array | of category objects. |
- Exceptions
-
◆ question_add_context_in_key()
| core_question\output\question_category_selector::question_add_context_in_key |
( |
array | $categories | ) |
|
Add context in categories key.
- Parameters
-
| array | $categories | The list of categories, keyed by ID. |
- Return values
-
| array | The list with the context id added to each key, id, and parent attribute. |
◆ question_category_options()
| core_question\output\question_category_selector::question_category_options |
( |
array | $contexts, |
|
|
bool | $top = false, |
|
|
int | $currentcat = 0, |
|
|
bool | $popupform = false, |
|
|
int | $nochildrenof = -1, |
|
|
bool | $escapecontextnames = true ) |
Output an array of question categories.
- Parameters
-
| array | $contexts | The list of contexts. |
| bool | $top | Whether to return the top categories or not. |
| int | $currentcat | The current category, to exclude from the list. |
| bool | $popupform | Return each question bank's group in an additional nested array. |
| int | $nochildrenof | Don't include children of this category |
| bool | $escapecontextnames | Whether the returned name of the thing is to be HTML escaped or not. |
- Return values
-
- Exceptions
-
| coding_exception|dml_exception | |
◆ question_fix_top_names()
| core_question\output\question_category_selector::question_fix_top_names |
( |
array | $categories, |
|
|
bool | $escape = true ) |
Finds top categories in the given categories hierarchy and replace their name with a proper localised string.
- Parameters
-
| array | $categories | An array of question categories. |
| bool | $escape | Whether the returned name of the thing is to be HTML escaped or not. |
- Return values
-
| array | The same question category list given to the function, with the top category names being translated. |
- Exceptions
-
The documentation for this class was generated from the following file:
- question/classes/output/question_category_selector.php