Moodle PHP Documentation 4.1
Moodle 4.1dev (Build: 20220512) (5e5e12e0)
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
qbank_history\question_history_view Class Reference
Inheritance diagram for qbank_history\question_history_view:
core_question\local\bank\view

Public Member Functions

 __construct (question_edit_contexts $contexts, moodle_url $pageurl, stdClass $course, int $entryid, string $returnurl)
 Constructor for the history. More...
 
 add_searchcondition ($searchcondition)
 Add another search control to this view. More...
 
 base_url ()
 Returns the 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 ($pagevars, $tabname)
 Shows the question bank interface. More...
 
 display_question_bank_header ()
 Display the header for the question bank in the history page to include question name and type. 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 the count of the columns. More...
 
 get_courseid ()
 Get course id. More...
 
 get_most_specific_context ()
 Get the context we are displaying the question bank for. More...
 
 get_primary_sort_order ($sort)
 Gets the primary sort order according to the default sort. More...
 
 get_visiblecolumns ()
 Gets visible columns. More...
 
 has_column ($colname)
 Checks if the column included in the output. More...
 
 new_sort_url ($sort, $newsortreverse)
 Get a URL to redisplay the page with a new sort for the question bank. More...
 
 preview_question_url ($questiondata)
 Get the URL to preview a question. More...
 
 process_actions ()
 Process actions for the selected action. More...
 
 process_actions_needing_ui ()
 Process actions with ui. More...
 
 wanted_filters ($cat, $tagids, $showhidden, $recurse, $editcontexts, $showquestiontext)
 The filters for the question bank. More...
 

Public Attributes

array $bulkactions = []
 $bulkactions to identify the bulk actions for the api.
 
object cm_info null $cm
 if we are in a module context, the cm.
 
object $course
 the course we are within.
 
array $customfilterobjects = null
 to pass custom filters instead of the specified ones.
 
bool $enablefilters = true
 enable or disable filters while calling the API.
 
string $returnurl
 url of the new question page.
 
const MAX_SORTS = 3
 Maximum number of sorts allowed.
 

Protected Member Functions

 build_query ()
 Create the SQL query to retrieve the indicated questions, based on core_question::bank::search::condition filters. More...
 
 create_new_question_form ($category, $canadd)
 Create a new question form. More...
 
 default_sort ()
 Default sort for question data. More...
 
 display_advanced_search_form ($advancedsearch)
 Print the "advanced" UI elements for the form to select which questions. More...
 
 display_bottom_controls (\context $catcontext)
 Display the controls at the bottom of the list of questions. More...
 
 display_bottom_pagination ($pagination, $totalnumber, $perpage, $pageurl)
 Display bottom pagination bar. More...
 
 display_options_form ($showquestiontext)
 Display the form with options for which questions are displayed and how they are displayed. More...
 
 display_question_list ($pageurl, $categoryandcontext, $recurse=1, $page=0, $perpage=null, $addcontexts=[])
 Prints the table of questions in a category with interactions. More...
 
 display_questions ($questions)
 Display the questions. More...
 
 display_showtext_checkbox ($showquestiontext)
 Display the checkbox UI for toggling the display of the question text in the list. More...
 
 display_top_pagnation ($pagination)
 Display the top pagination bar. More...
 
 end_table ()
 End of the table html. More...
 
 get_column_type ($columnname)
 Check a column object from its name and get the object for sort. More...
 
 get_current_category ($categoryandcontext)
 Gets current selected category. More...
 
 get_question_bank_plugins ()
 Get the list of qbank plugins with available objects for features. More...
 
 get_question_count ()
 Get the number of questions. More...
 
 get_row_classes ($question, $rowcount)
 Gets the classes for the row. More...
 
 heading_column ()
 Specify the column heading. More...
 
 init_bulk_actions ()
 Initialize bulk actions.
 
 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 ()
 Initialise sorting.
 
 init_sort_from_params ()
 Initialise sort from parameters. 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_choose_category_message ()
 Print the text if category id not available.
 
 print_table ($questions)
 Prints the actual table with question. More...
 
 print_table_headers ()
 Print table headers from child classes.
 
 print_table_row ($question, $rowcount)
 Prints the table row from child classes. More...
 
 sort_to_params ($sorts)
 Sort to parameters. More...
 
 start_table ()
 Start of the table html. More...
 
 wanted_columns ()
 Loads all the available columns. More...
 

Protected Attributes

moodle_url $basereturnurl
 Base url for the return. More...
 
moodle_url $baseurl
 base URL for the current page. More...
 
core_question local bank question_edit_contexts $contexts
 
string $countsql
 SQL to count the number of questions matching the current search conditions.
 
moodle_url $editquestionurl
 used as a basis for URLs that edit a question.
 
int $entryid
 Entry id to get the versions. More...
 
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.
 
int $pagesize = DEFAULT_QUESTIONS_PER_PAGE
 page size to use (when we are not showing all questions).
 
question_bank_column_base[] $requiredcolumns
 these are all the 'columns' that are part of the display. More...
 
condition[] $searchconditions = []
 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...
 

Constructor & Destructor Documentation

◆ __construct()

qbank_history\question_history_view::__construct ( question_edit_contexts  $contexts,
moodle_url  $pageurl,
stdClass  $course,
int  $entryid,
string  $returnurl 
)

Constructor for the history.

Parameters
question_edit_contexts$contextsthe contexts of api call
moodle_url$pageurlurl of the page
stdClass$coursecourse settings
int$entryidquiz settings
string$returnurlurl to return to

Member Function Documentation

◆ add_searchcondition()

core_question\local\bank\view::add_searchcondition (   $searchcondition)
inherited

Add another search control to this view.

Parameters
condition$searchconditionthe condition to add.

◆ build_query()

qbank_history\question_history_view::build_query ( )
protected

Create the SQL query to retrieve the indicated questions, based on core_question::bank::search::condition filters.

Reimplemented from core_question\local\bank\view.

◆ copy_question_moodle_url()

core_question\local\bank\view::copy_question_moodle_url (   $questionid)
inherited

Get the URL for duplicating a question as a moodle url.

Parameters
int$questionidthe question id.
Return values
moodle_urlthe URL.

◆ copy_question_url()

core_question\local\bank\view::copy_question_url (   $questionid)
inherited

Get the URL for duplicating a given question.

Parameters
int$questionidthe question id.
Return values
stringthe URL, HTML-escaped.

◆ create_new_question_form()

qbank_history\question_history_view::create_new_question_form (   $category,
  $canadd 
)
protected

Create a new question form.

Parameters
false | mixed | stdClass$category
bool$canadd

Reimplemented from core_question\local\bank\view.

◆ default_sort()

qbank_history\question_history_view::default_sort ( )
protected

Default sort for question data.

Return values
array

Reimplemented from core_question\local\bank\view.

◆ display()

core_question\local\bank\view::display (   $pagevars,
  $tabname 
)
inherited

Shows the question bank 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 params: $tabname question bank edit tab name, for permission checking $pagevars current list of page variables

Parameters
string$tabname
array$pagevars

◆ display_advanced_search_form()

qbank_history\question_history_view::display_advanced_search_form (   $advancedsearch)
protected

Print the "advanced" UI elements for the form to select which questions.

Hidden by default.

Parameters
array$advancedsearch

Reimplemented from core_question\local\bank\view.

◆ display_bottom_controls()

core_question\local\bank\view::display_bottom_controls ( \context  $catcontext)
protectedinherited

Display the controls at the bottom of the list of questions.

Parameters
context$catcontextThe context of the category being displayed.

Reimplemented in mod_quiz\question\bank\custom_view.

◆ display_bottom_pagination()

core_question\local\bank\view::display_bottom_pagination (   $pagination,
  $totalnumber,
  $perpage,
  $pageurl 
)
protectedinherited

Display bottom pagination bar.

Parameters
string$pagination
int$totalnumber
int$perpage
moodle_url$pageurl

◆ display_options_form()

core_question\local\bank\view::display_options_form (   $showquestiontext)
protectedinherited

Display the form with options for which questions are displayed and how they are displayed.

Parameters
bool$showquestiontextDisplay the text of the question within the list.

◆ display_question_bank_header()

qbank_history\question_history_view::display_question_bank_header ( )

Display the header for the question bank in the history page to include question name and type.

Reimplemented from core_question\local\bank\view.

◆ display_question_list()

core_question\local\bank\view::display_question_list (   $pageurl,
  $categoryandcontext,
  $recurse = 1,
  $page = 0,
  $perpage = null,
  $addcontexts = [] 
)
protectedinherited

Prints the table of questions in a category with interactions.

Parameters
moodle_url$pageurlThe URL to reload this page.
string$categoryandcontext'categoryID,contextID'.
int$recurseWhether to include subcategories.
int$pageThe number of the page to be displayed
int | null$perpageNumber of questions to show per page
array$addcontextscontexts where the user is allowed to add new questions.

◆ display_questions()

core_question\local\bank\view::display_questions (   $questions)
protectedinherited

Display the questions.

Parameters
array$questions

◆ display_showtext_checkbox()

core_question\local\bank\view::display_showtext_checkbox (   $showquestiontext)
protectedinherited

Display the checkbox UI for toggling the display of the question text in the list.

Parameters
bool$showquestiontextthe current or default value for whether to display the text.

◆ display_top_pagnation()

core_question\local\bank\view::display_top_pagnation (   $pagination)
protectedinherited

Display the top pagination bar.

Parameters
object$pagination

◆ edit_question_moodle_url()

core_question\local\bank\view::edit_question_moodle_url (   $questionid)
inherited

Get the URL for editing a question as a moodle url.

Parameters
int$questionidthe question id.
Return values
moodle_urlthe URL, HTML-escaped.

◆ edit_question_url()

core_question\local\bank\view::edit_question_url (   $questionid)
inherited

Get the URL for editing a question as a HTML-escaped string.

Parameters
int$questionidthe question id.
Return values
stringthe URL, HTML-escaped.

◆ end_table()

core_question\local\bank\view::end_table ( )
protectedinherited

End of the table html.

Deprecated:
since Moodle 4.0
See also
print_table()
Todo:
Final deprecation on Moodle 4.4 MDL-72438

◆ get_column_count()

core_question\local\bank\view::get_column_count ( )
inherited

Get the count of the columns.

Return values
intThe number of columns in the table.

◆ get_column_type()

core_question\local\bank\view::get_column_type (   $columnname)
protectedinherited

Check a column object from its name and get the object for sort.

Parameters
string$columnname

◆ get_courseid()

core_question\local\bank\view::get_courseid ( )
inherited

Get course id.

Return values
mixed

◆ get_current_category()

core_question\local\bank\view::get_current_category (   $categoryandcontext)
protectedinherited

Gets current selected category.

Parameters
string$categoryandcontext
Return values
false|mixed|stdClass

◆ get_most_specific_context()

core_question\local\bank\view::get_most_specific_context ( )
inherited

Get the context we are displaying the question bank for.

Return values
contextcontext object.

◆ get_primary_sort_order()

core_question\local\bank\view::get_primary_sort_order (   $sort)
inherited

Gets the primary sort order according to the default sort.

Parameters
string$sorta column or column_subsort name.
Return values
intthe current sort order for this column -1, 0, 1

◆ get_question_bank_plugins()

core_question\local\bank\view::get_question_bank_plugins ( )
protectedinherited

Get the list of qbank plugins with available objects for features.

Return values
array

Reimplemented in mod_quiz\question\bank\custom_view.

◆ get_question_count()

core_question\local\bank\view::get_question_count ( )
protectedinherited

Get the number of questions.

Return values
int

◆ get_row_classes()

core_question\local\bank\view::get_row_classes (   $question,
  $rowcount 
)
protectedinherited

Gets the classes for the row.

Parameters
stdClass$question
int$rowcount
Return values
array

◆ get_visiblecolumns()

core_question\local\bank\view::get_visiblecolumns ( )
inherited

Gets visible columns.

Return values
arrayVisible columns.

◆ has_column()

core_question\local\bank\view::has_column (   $colname)
inherited

Checks if the column included in the output.

Parameters
string$colnamea column internal name.
Return values
boolis this column included in the output?

◆ heading_column()

core_question\local\bank\view::heading_column ( )
protectedinherited

Specify the column heading.

Return values
stringColumn name for the heading

Reimplemented in mod_quiz\question\bank\custom_view.

◆ init_columns()

core_question\local\bank\view::init_columns (   $wanted,
  $heading = '' 
)
protectedinherited

Initializing table columns.

Parameters
array$wantedCollection of column names
string$headingThe name of column that is set as heading

◆ init_sort_from_params()

core_question\local\bank\view::init_sort_from_params ( )
protectedinherited

Initialise sort from parameters.

Reimplemented in mod_quiz\question\bank\custom_view.

◆ load_page_questions()

core_question\local\bank\view::load_page_questions (   $page,
  $perpage 
)
protectedinherited

Load the questions we need to display.

Parameters
int$pagepage to display.
int$perpagenumber of questions per page.
Return values
moodle_recordsetquestionid => data about each question.

◆ new_sort_url()

core_question\local\bank\view::new_sort_url (   $sort,
  $newsortreverse 
)
inherited

Get a URL to redisplay the page with a new sort for the question bank.

Parameters
string$sortthe column, or column_subsort to sort on.
bool$newsortreversewhether to sort in reverse order.
Return values
stringThe new URL.

◆ parse_subsort()

core_question\local\bank\view::parse_subsort (   $sort)
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 ''.

Parameters
string$sortthe sort parameter to process.
Return values
array[$colname, $subsort].

◆ preview_question_url()

core_question\local\bank\view::preview_question_url (   $questiondata)
inherited

Get the URL to preview a question.

Parameters
stdClass$questiondatathe data defining the question.
Return values
moodle_urlthe URL.
Deprecated:
since Moodle 4.0
See also
qbank_previewquestion::helper::question_preview_url()
Todo:
Final deprecation on Moodle 4.4 MDL-72438

Reimplemented in mod_quiz\question\bank\custom_view.

◆ print_table()

core_question\local\bank\view::print_table (   $questions)
protectedinherited

Prints the actual table with question.

Parameters
array$questions

◆ print_table_row()

core_question\local\bank\view::print_table_row (   $question,
  $rowcount 
)
protectedinherited

Prints the table row from child classes.

Parameters
stdClass$question
int$rowcount

◆ process_actions()

core_question\local\bank\view::process_actions ( )
inherited

Process actions for the selected action.

Deprecated:
since Moodle 4.0
Todo:
Final deprecation on Moodle 4.4 MDL-72438

◆ process_actions_needing_ui()

core_question\local\bank\view::process_actions_needing_ui ( )
inherited

Process actions with ui.

Return values
bool
Deprecated:
since Moodle 4.0
Todo:
Final deprecation on Moodle 4.4 MDL-72438

◆ sort_to_params()

core_question\local\bank\view::sort_to_params (   $sorts)
protectedinherited

Sort to parameters.

Parameters
array$sorts
Return values
array

◆ start_table()

core_question\local\bank\view::start_table ( )
protectedinherited

Start of the table html.

Deprecated:
since Moodle 4.0
See also
print_table()
Todo:
Final deprecation on Moodle 4.4 MDL-72438

◆ wanted_columns()

qbank_history\question_history_view::wanted_columns ( )
protected

Loads all the available columns.

Return values
array

Reimplemented from core_question\local\bank\view.

◆ wanted_filters()

qbank_history\question_history_view::wanted_filters (   $cat,
  $tagids,
  $showhidden,
  $recurse,
  $editcontexts,
  $showquestiontext 
)

The filters for the question bank.

Parameters
string$cat'categoryid,contextid'
array$tagidscurrent list of selected tags
bool$showhiddenwhether deleted questions should be displayed
int$recurseWhether to include subcategories
array$editcontextsparent contexts
bool$showquestiontextwhether the text of each question should be shown in the list

Reimplemented from core_question\local\bank\view.

Member Data Documentation

◆ $basereturnurl

moodle_url qbank_history\question_history_view::$basereturnurl
protected

Base url for the return.

$basereturnurl

◆ $baseurl

moodle_url core_question\local\bank\view::$baseurl
protectedinherited

base URL for the current page.

Used as the basis for making URLs for actions that reload the page.

◆ $entryid

int qbank_history\question_history_view::$entryid
protected

Entry id to get the versions.

$entryid

◆ $extrarows

question_bank_column_base [] core_question\local\bank\view::$extrarows
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.

◆ $requiredcolumns

question_bank_column_base [] core_question\local\bank\view::$requiredcolumns
protectedinherited

these are all the 'columns' that are part of the display.

Array keys are the class name.

◆ $visiblecolumns

question_bank_column_base [] core_question\local\bank\view::$visiblecolumns
protectedinherited

these are the 'columns' that are actually displayed as a column, in order.

Array keys are the class name.


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