|
Moodle
2.2.1
http://www.collinsharper.com
|

This class prints a view of the question bank, including + Some controls to allow users to to select what is displayed. + A list of questions as a table. + Further controls to do things with the questions.
This class gives a basic view, and provides plenty of hooks where subclasses can override parts of the display.
The list of questions presented as a table is generated by creating a list of question_bank_column objects, one for each 'column' to be displayed. These manage + outputting the contents of that column, given a $question object, but also + generating the right fragments of SQL to ensure the necessary data is present, and sorted in the right order. + outputting table headers.
Definition at line 833 of file editlib.php.
| __construct | ( | $ | contexts, |
| $ | pageurl, | ||
| $ | course, | ||
| $ | cm = null |
||
| ) |
Constructor
| question_edit_contexts | $contexts | |
| moodle_url | $pageurl | |
| object | $course | course settings |
| object | $cm | (optional) activity settings. |
Definition at line 859 of file editlib.php.

| base_url | ( | ) |
Definition at line 1147 of file editlib.php.
| build_query_sql | ( | $ | category, |
| $ | recurse, | ||
| $ | showhidden | ||
| ) | [protected] |
Get the required tables.
Get the required fields.
Build the order by clause.
Build the where clause.
Build the SQL.
Definition at line 1076 of file editlib.php.


| create_new_question_form | ( | $ | category, |
| $ | canadd | ||
| ) | [protected] |
Definition at line 1280 of file editlib.php.


| default_sort | ( | ) | [protected] |
Reimplemented in quiz_question_bank_view.
Definition at line 1033 of file editlib.php.

| display | ( | $ | tabname, |
| $ | page, | ||
| $ | perpage, | ||
| $ | cat, | ||
| $ | recurse, | ||
| $ | showhidden, | ||
| $ | showquestiontext | ||
| ) |
Shows the question bank editing interface.
The function also processes a number of actions:
Actions affecting the question pool: move Moves a question to a different category deleteselected Deletes the selected questions from the category Other actions: category Chooses the category displayoptions Sets display options
Reimplemented in quiz_question_bank_view.
Definition at line 1176 of file editlib.php.

| display_category_form | ( | $ | contexts, |
| $ | pageurl, | ||
| $ | current | ||
| ) | [protected] |
prints a form to choose categories
Get all the existing categories now
Definition at line 1242 of file editlib.php.


| display_category_form_checkbox | ( | $ | name, |
| $ | value, | ||
| $ | label | ||
| ) | [protected] |
Print a single option checkbox. Used by the preceeding.
Definition at line 1269 of file editlib.php.

| display_options | ( | $ | recurse, |
| $ | showhidden, | ||
| $ | showquestiontext | ||
| ) | [protected] |
Reimplemented in quiz_question_bank_view.
Definition at line 1255 of file editlib.php.


| display_question_list | ( | $ | contexts, |
| $ | pageurl, | ||
| $ | categoryandcontext, | ||
| $ | cm = null, |
||
| $ | recurse = 1, |
||
| $ | page = 0, |
||
| $ | perpage = 100, |
||
| $ | showhidden = false, |
||
| $ | showquestiontext = false, |
||
| $ | addcontexts = array() |
||
| ) | [protected] |
Prints the table of questions in a category with interactions
| object | $course | The course object |
| int | $categoryid | The id of the question category to be displayed |
| int | $cm | The course module record if we are in the context of a particular module, 0 otherwise |
| int | $recurse | This is 1 if subcategories should be included, 0 otherwise |
| int | $page | The number of the page to be displayed |
| int | $perpage | Number of questions to show per page |
| bool | $showhidden | True if also hidden questions should be displayed |
| bool | $showquestiontext | whether the text of each question should be shown in the list |
Definition at line 1304 of file editlib.php.


| edit_question_url | ( | $ | questionid | ) |
Definition at line 1151 of file editlib.php.
| end_table | ( | ) | [protected] |
| get_column_count | ( | ) |
Definition at line 952 of file editlib.php.
| get_courseid | ( | ) |
Definition at line 956 of file editlib.php.
| get_current_category | ( | $ | categoryandcontext | ) | [protected] |
Definition at line 1211 of file editlib.php.


| get_primary_sort_order | ( | $ | sort | ) |
| $sort | a column or column_subsort name. |
Definition at line 1041 of file editlib.php.
| get_question_count | ( | ) | [protected] |
| get_row_classes | ( | $ | question, |
| $ | rowcount | ||
| ) | [protected] |
| has_column | ( | $ | colname | ) |
| string | $colname | a column internal name. |
Definition at line 945 of file editlib.php.
| init_column_types | ( | ) | [protected] |
Definition at line 917 of file editlib.php.


| init_columns | ( | $ | wanted | ) | [protected] |
| init_sort | ( | ) | [protected] |
Definition at line 960 of file editlib.php.


| init_sort_from_params | ( | ) | [protected] |
Definition at line 998 of file editlib.php.


| known_field_types | ( | ) | [protected] |
Reimplemented in quiz_question_bank_view.
Definition at line 902 of file editlib.php.

| load_page_questions | ( | $ | page, |
| $ | perpage | ||
| ) | [protected] |
No questions on this page. Reset to page 0.
Definition at line 1137 of file editlib.php.

| move_question_url | ( | $ | questionid | ) |
Definition at line 1155 of file editlib.php.
| new_sort_url | ( | $ | sort, |
| $ | newsortreverse | ||
| ) |
Get a URL to redisplay the page with a new sort for the question bank.
| string | $sort | the column, or column_subsort to sort on. |
| bool | $newsortreverse | whether to sort in reverse order. |
Definition at line 1057 of file editlib.php.

| parse_subsort | ( | $ | sort | ) | [protected] |
Deal with a sort name of the form columnname, or colname_subsort by breaking it up, validating the bits that are presend, and returning them. If there is no subsort, then $subsort is returned as ''.
Do the parsing.
Validate the column name.
Validate the subsort, if present.
Definition at line 973 of file editlib.php.

| preview_question_url | ( | $ | question | ) |
Reimplemented in quiz_question_bank_view.
Definition at line 1159 of file editlib.php.

| print_category_info | ( | $ | category | ) | [protected] |
Reimplemented in quiz_question_bank_view.
Definition at line 1230 of file editlib.php.


| print_choose_category_message | ( | $ | categoryandcontext | ) | [protected] |
Reimplemented in quiz_question_bank_view.
Definition at line 1205 of file editlib.php.


| print_table_headers | ( | ) | [protected] |
| print_table_row | ( | $ | question, |
| $ | rowcount | ||
| ) | [protected] |
Definition at line 1439 of file editlib.php.


| process_actions | ( | ) |
Now, check for commands on this page and modify variables as necessary
Definition at line 1455 of file editlib.php.

Definition at line 1523 of file editlib.php.


| sort_to_params | ( | $ | sorts | ) | [protected] |
| start_table | ( | ) | [protected] |
Definition at line 1404 of file editlib.php.


| wanted_columns | ( | ) | [protected] |
Reimplemented in quiz_question_bank_view.
Definition at line 892 of file editlib.php.


$baseurl [protected] |
Definition at line 836 of file editlib.php.
$cm [protected] |
Definition at line 840 of file editlib.php.
$contexts [protected] |
Definition at line 839 of file editlib.php.
$countsql [protected] |
Definition at line 848 of file editlib.php.
$course [protected] |
Definition at line 841 of file editlib.php.
$editquestionurl [protected] |
Definition at line 837 of file editlib.php.
$extrarows [protected] |
Definition at line 844 of file editlib.php.
$knowncolumntypes [protected] |
Definition at line 842 of file editlib.php.
$lastchangedid [protected] |
Definition at line 847 of file editlib.php.
$loadsql [protected] |
Definition at line 849 of file editlib.php.
$quizorcourseid [protected] |
Definition at line 838 of file editlib.php.
$requiredcolumns [protected] |
Definition at line 845 of file editlib.php.
$sort [protected] |
Definition at line 846 of file editlib.php.
$sqlparams [protected] |
Definition at line 850 of file editlib.php.
$visiblecolumns [protected] |
Definition at line 843 of file editlib.php.
| const MAX_SORTS = 3 |
Definition at line 834 of file editlib.php.