Moodle APIs 3.9
Moodle 3.9.13+ (Build: 20220325)
|
Subclass to customise the view of the question bank for the quiz editing screen. More...
Public Member Functions | |
__construct ($contexts, $pageurl, $course, $cm, $quiz) | |
Constructor. More... | |
add_searchcondition ($searchcondition) | |
Add another search control to this view. More... | |
add_to_quiz_url ($questionid) | |
base_url () | |
copy_question_moodle_url ($questionid) | |
Get the URL for duplicating a question as a moodle_url. More... | |
copy_question_url ($questionid) | |
Get the URL for duplicating a given question. More... | |
display ($tabname, $page, $perpage, $cat, $recurse, $showhidden, $showquestiontext, $tagids=[]) | |
Shows the question bank editing interface. More... | |
edit_question_moodle_url ($questionid) | |
Get the URL for editing a question as a moodle_url. More... | |
edit_question_url ($questionid) | |
Get the URL for editing a question as a HTML-escaped string. More... | |
get_column_count () | |
get_courseid () | |
get_most_specific_context () | |
Get the context we are displaying the question bank for. More... | |
get_primary_sort_order ($sort) | |
has_column ($colname) | |
new_sort_url ($sort, $newsortreverse) | |
Get a URL to redisplay the page with a new sort for the question bank. More... | |
preview_question_url ($question) | |
Get the URL to preview a question. More... | |
process_actions () | |
process_actions_needing_ui () | |
render ($tabname, $page, $perpage, $cat, $recurse, $showhidden, $showquestiontext, $tagids=[]) | |
Renders the html question bank (same as display, but returns the result). More... | |
set_quiz_has_attempts ($quizhasattempts) | |
Let the question bank display know whether the quiz has been attempted, hence whether some bits of UI, like the add this question to the quiz icon, should be displayed. More... | |
Public Attributes | |
const | MAX_SORTS = 3 |
int const | MAX_TEXT_LENGTH = 200 |
The maximum displayed length of the category info. | |
Protected Member Functions | |
build_query () | |
Create the SQL query to retrieve the indicated questions, based on core_question::bank::search::condition filters. | |
build_query_sql ($category, $recurse, $showhidden) | |
Create the SQL query to retrieve the indicated questions. More... | |
create_new_question_form ($category, $canadd) | |
default_sort () | |
display_advanced_search_form () | |
Print the "advanced" UI elements for the form to select which questions. More... | |
display_bottom_controls ($totalnumber, $recurse, $category, context $catcontext, array $addcontexts) | |
Display the controls at the bottom of the list of questions. More... | |
display_category_form ($contexts, $pageurl, $current) | |
Prints a form to choose categories. More... | |
display_category_form_checkbox ($name, $value, $label) | |
Print a single option checkbox. More... | |
display_options ($recurse, $showhidden, $showquestiontext) | |
Display the options form. More... | |
display_options_form ($showquestiontext, $scriptpath='/mod/quiz/edit.php', $showtextoption=false) | |
Display the form with options for which questions are displayed and how they are displayed. More... | |
display_question_bank_header () | |
Override the base implementation in core_question::bank::view because we don't want to print the headers in the fragment for the modal. More... | |
display_question_list ($contexts, $pageurl, $categoryandcontext, $cm=null, $recurse=1, $page=0, $perpage=100, $showhidden=false, $showquestiontext=false, $addcontexts=array()) | |
Prints the table of questions in a category with interactions. More... | |
display_showtext_checkbox ($showquestiontext) | |
Display the checkbox UI for toggling the display of the question text in the list. More... | |
end_table () | |
get_column_type ($columnname) | |
Get a column object from its name. More... | |
get_current_category ($categoryandcontext) | |
get_question_count () | |
get_row_classes ($question, $rowcount) | |
heading_column () | |
Specify the column heading. More... | |
init_columns ($wanted, $heading='') | |
Initializing table columns. More... | |
init_search_conditions () | |
Initialize search conditions from plugins local_*_get_question_bank_search_conditions() must return an array of core_question::bank::search::condition objects. | |
init_sort () | |
init_sort_from_params () | |
Override the base implementation in core_question::bank::view because we don't want it to read from the $_POST global variables for the sort parameters since they are not present in a fragment. More... | |
load_page_questions ($page, $perpage) | |
Load the questions we need to display. More... | |
parse_subsort ($sort) | |
Deal with a sort name of the form columnname, or colname_subsort by breaking it up, validating the bits that are present, and returning them. More... | |
print_category_info ($category) | |
prints category information More... | |
print_choose_category_message ($categoryandcontext) | |
Prints a form to choose categories. More... | |
print_table_headers () | |
print_table_row ($question, $rowcount) | |
sort_to_params ($sorts) | |
start_table () | |
wanted_columns () | |
Protected Attributes | |
moodle_url | $baseurl |
base URL for the current page. More... | |
object cm_info null | $cm |
if we are in a module context, the cm. | |
question_edit_contexts | $contexts |
string | $countsql |
SQL to count the number of questions matching the current search conditions. | |
object | $course |
the course we are within. | |
moodle_url | $editquestionurl |
used as a basis for URLs that edit a question. | |
question_bank_column_base[] | $extrarows |
these are the 'columns' that are actually displayed as an additional row (e.g. More... | |
int null | $lastchangedid |
id of the a question to highlight in the list (if present). | |
string | $loadsql |
SQL to actually load the question data to display. | |
stdClass | $quiz = false |
the quiz settings. | |
bool | $quizhasattempts = false |
whether the quiz this is used by has been attemptd. | |
question_bank_column_base[] | $requiredcolumns |
these are all the 'columns' that are part of the display. More... | |
condition[] | $searchconditions = array() |
search conditions. | |
array | $sort |
list of column class names for which columns to sort on. | |
array | $sqlparams |
params used by $countsql and $loadsql (which currently must be the same). | |
question_bank_column_base[] | $visiblecolumns |
these are the 'columns' that are actually displayed as a column, in order. More... | |
Subclass to customise the view of the question bank for the quiz editing screen.
mod_quiz\question\bank\custom_view::__construct | ( | $contexts, | |
$pageurl, | |||
$course, | |||
$cm, | |||
$quiz | |||
) |
Constructor.
question_edit_contexts | $contexts | |
moodle_url | $pageurl | |
stdClass | $course | course settings |
stdClass | $cm | activity settings. |
stdClass | $quiz | quiz settings. |
|
inherited |
Add another search control to this view.
condition | $searchcondition | the condition to add. |
|
protectedinherited |
Create the SQL query to retrieve the indicated questions.
stdClass | $category | no longer used. |
bool | $recurse | no longer used. |
bool | $showhidden | no longer used. |
|
inherited |
Get the URL for duplicating a question as a moodle_url.
int | $questionid | the question id. |
moodle_url | the URL. |
|
inherited |
Get the URL for duplicating a given question.
int | $questionid | the question id. |
string | the URL, HTML-escaped. |
|
protected |
Reimplemented from core_question\bank\view.
|
protected |
Reimplemented from core_question\bank\view.
|
inherited |
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
string | $tabname | question bank edit tab name, for permission checking. |
int | $page | the page number to show. |
int | $perpage | the number of questions per page to show. |
string | $cat | 'categoryid,contextid'. |
int | $recurse | Whether to include subcategories. |
bool | $showhidden | whether deleted questions should be displayed. |
bool | $showquestiontext | whether the text of each question should be shown in the list. Deprecated. |
array | $tagids | current list of selected tags. |
|
protectedinherited |
Print the "advanced" UI elements for the form to select which questions.
Hidden by default.
|
protected |
Display the controls at the bottom of the list of questions.
int | $totalnumber | Total number of questions that might be shown (if it was not for paging). |
bool | $recurse | Whether to include subcategories. |
stdClass | $category | The question_category row from the database. |
context | $catcontext | The context of the category being displayed. |
array | $addcontexts | contexts where the user is allowed to add new questions. |
Reimplemented from core_question\bank\view.
|
protectedinherited |
Prints a form to choose categories.
|
protectedinherited |
Print a single option checkbox.
|
protected |
Display the options form.
bool | $recurse | no longer used. |
bool | $showhidden | no longer used. |
bool | $showquestiontext | whether to show the question text. |
Reimplemented from core_question\bank\view.
|
protected |
Display the form with options for which questions are displayed and how they are displayed.
bool | $showquestiontext | Display the text of the question within the list. |
string | $scriptpath | path to the script displaying this page. |
bool | $showtextoption | whether to include the 'Show question text' checkbox. |
Reimplemented from core_question\bank\view.
|
protected |
Override the base implementation in core_question::bank::view because we don't want to print the headers in the fragment for the modal.
Reimplemented from core_question\bank\view.
|
protectedinherited |
Prints the table of questions in a category with interactions.
array | $contexts | Not used! |
moodle_url | $pageurl | The URL to reload this page. |
string | $categoryandcontext | 'categoryID,contextID'. |
stdClass | $cm | Not used! |
int | $recurse | Whether to include subcategories. |
int | $page | The number of the page to be displayed |
int | $perpage | Number of questions to show per page |
bool | $showhidden | Not used! This is now controlled in a different way. |
bool | $showquestiontext | Not used! This is now controlled in a different way. |
array | $addcontexts | contexts where the user is allowed to add new questions. |
|
protectedinherited |
Display the checkbox UI for toggling the display of the question text in the list.
bool | $showquestiontext | the current or default value for whether to display the text. |
|
inherited |
Get the URL for editing a question as a moodle_url.
int | $questionid | the question id. |
moodle_url | the URL, HTML-escaped. |
|
inherited |
Get the URL for editing a question as a HTML-escaped string.
int | $questionid | the question id. |
string | the URL, HTML-escaped. |
|
inherited |
int | The number of columns in the table. |
|
protectedinherited |
Get a column object from its name.
string | $columnname,. |
core_question::bank::column_base. |
|
inherited |
Get the context we are displaying the question bank for.
context | context object. |
|
inherited |
string | $sort | a column or column_subsort name. |
int | the current sort order for this column -1, 0, 1 |
|
inherited |
string | $colname | a column internal name. |
bool | is this column included in the output? |
|
protected |
Specify the column heading.
string | Column name for the heading |
Reimplemented from core_question\bank\view.
|
protectedinherited |
Initializing table columns.
array | $wanted | Collection of column names |
string | $heading | The name of column that is set as heading |
|
protected |
Override the base implementation in core_question::bank::view because we don't want it to read from the $_POST global variables for the sort parameters since they are not present in a fragment.
Unfortunately the best we can do is to look at the URL for those parameters (only marginally better really).
Reimplemented from core_question\bank\view.
|
protectedinherited |
Load the questions we need to display.
int | $page | page to display. |
int | $perpage | number of questions per page. |
moodle_recordset | questionid => data about each question. |
|
inherited |
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. |
string | The new URL. |
|
protectedinherited |
Deal with a sort name of the form columnname, or colname_subsort by breaking it up, validating the bits that are present, and returning them.
If there is no subsort, then $subsort is returned as ''.
string | $sort | the sort parameter to process. |
array | array($colname, $subsort). |
mod_quiz\question\bank\custom_view::preview_question_url | ( | $questiondata | ) |
Get the URL to preview a question.
stdClass | $questiondata | the data defining the question. |
moodle_url | the URL. |
Reimplemented from core_question\bank\view.
|
protected |
prints category information
stdClass | $category | the category row from the database. |
Reimplemented from core_question\bank\view.
|
protected |
Prints a form to choose categories.
string | $categoryandcontext | 'categoryID,contextID'. |
Reimplemented from core_question\bank\view.
mod_quiz\question\bank\custom_view::render | ( | $tabname, | |
$page, | |||
$perpage, | |||
$cat, | |||
$recurse, | |||
$showhidden, | |||
$showquestiontext, | |||
$tagids = [] |
|||
) |
Renders the html question bank (same as display, but returns the result).
Note that you can only output this rendered result once per page, as it contains IDs which must be unique.
string | HTML code for the form |
mod_quiz\question\bank\custom_view::set_quiz_has_attempts | ( | $quizhasattempts | ) |
Let the question bank display know whether the quiz has been attempted, hence whether some bits of UI, like the add this question to the quiz icon, should be displayed.
bool | $quizhasattempts | whether the quiz has attempts. |
|
protected |
Reimplemented from core_question\bank\view.
|
protectedinherited |
base URL for the current page.
Used as the basis for making URLs for actions that reload the page.
|
protectedinherited |
these are the 'columns' that are actually displayed as an additional row (e.g.
question text), in order. Array keys are the class name.
|
protectedinherited |
these are all the 'columns' that are part of the display.
Array keys are the class name.
|
protectedinherited |
these are the 'columns' that are actually displayed as a column, in order.
Array keys are the class name.