Moodle  2.2.1
http://www.collinsharper.com
question_bank_view Class Reference
Inheritance diagram for question_bank_view:

Public Member Functions

 __construct ($contexts, $pageurl, $course, $cm=null)
 has_column ($colname)
 get_column_count ()
 get_courseid ()
 get_primary_sort_order ($sort)
 new_sort_url ($sort, $newsortreverse)
 base_url ()
 edit_question_url ($questionid)
 move_question_url ($questionid)
 preview_question_url ($question)
 display ($tabname, $page, $perpage, $cat, $recurse, $showhidden, $showquestiontext)
 process_actions ()
 process_actions_needing_ui ()

Data Fields

const MAX_SORTS = 3

Protected Member Functions

 wanted_columns ()
 known_field_types ()
 init_column_types ()
 init_columns ($wanted)
 init_sort ()
 parse_subsort ($sort)
 init_sort_from_params ()
 sort_to_params ($sorts)
 default_sort ()
 build_query_sql ($category, $recurse, $showhidden)
 get_question_count ()
 load_page_questions ($page, $perpage)
 print_choose_category_message ($categoryandcontext)
 get_current_category ($categoryandcontext)
 print_category_info ($category)
 display_category_form ($contexts, $pageurl, $current)
 display_options ($recurse, $showhidden, $showquestiontext)
 display_category_form_checkbox ($name, $value, $label)
 create_new_question_form ($category, $canadd)
 display_question_list ($contexts, $pageurl, $categoryandcontext, $cm=null, $recurse=1, $page=0, $perpage=100, $showhidden=false, $showquestiontext=false, $addcontexts=array())
 start_table ()
 end_table ()
 print_table_headers ()
 get_row_classes ($question, $rowcount)
 print_table_row ($question, $rowcount)

Protected Attributes

 $baseurl
 $editquestionurl
 $quizorcourseid
 $contexts
 $cm
 $course
 $knowncolumntypes
 $visiblecolumns
 $extrarows
 $requiredcolumns
 $sort
 $lastchangedid
 $countsql
 $loadsql
 $sqlparams

Detailed Description

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.


Constructor & Destructor Documentation

__construct ( contexts,
pageurl,
course,
cm = null 
)

Constructor

Parameters:
question_edit_contexts$contexts
moodle_url$pageurl
object$coursecourse settings
object$cm(optional) activity settings.

Definition at line 859 of file editlib.php.

Here is the call graph for this function:


Member Function Documentation

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.

Here is the call graph for this function:

Here is the caller graph for this function:

create_new_question_form ( category,
canadd 
) [protected]

Definition at line 1280 of file editlib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

default_sort ( ) [protected]

Reimplemented in quiz_question_bank_view.

Definition at line 1033 of file editlib.php.

Here is the caller graph for this function:

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.

Here is the call graph for this function:

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.

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Here is the caller graph for this function:

display_options ( recurse,
showhidden,
showquestiontext 
) [protected]

Reimplemented in quiz_question_bank_view.

Definition at line 1255 of file editlib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

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

Parameters:
object$courseThe course object
int$categoryidThe id of the question category to be displayed
int$cmThe course module record if we are in the context of a particular module, 0 otherwise
int$recurseThis is 1 if subcategories should be included, 0 otherwise
int$pageThe number of the page to be displayed
int$perpageNumber of questions to show per page
bool$showhiddenTrue if also hidden questions should be displayed
bool$showquestiontextwhether the text of each question should be shown in the list

Definition at line 1304 of file editlib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

edit_question_url ( questionid)

Definition at line 1151 of file editlib.php.

end_table ( ) [protected]

Definition at line 1412 of file editlib.php.

Here is the caller graph for this function:

Returns:
int The number of columns in the table.

Definition at line 952 of file editlib.php.

Definition at line 956 of file editlib.php.

get_current_category ( categoryandcontext) [protected]

Definition at line 1211 of file editlib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

Parameters:
$sorta column or column_subsort name.
Returns:
int the current sort order for this column -1, 0, 1

Definition at line 1041 of file editlib.php.

get_question_count ( ) [protected]

Definition at line 1132 of file editlib.php.

Here is the caller graph for this function:

get_row_classes ( question,
rowcount 
) [protected]

Definition at line 1425 of file editlib.php.

Here is the caller graph for this function:

has_column ( colname)
Parameters:
string$colnamea column internal name.
Returns:
bool is this column included in the output?

Definition at line 945 of file editlib.php.

init_column_types ( ) [protected]

Definition at line 917 of file editlib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

init_columns ( wanted) [protected]

Definition at line 924 of file editlib.php.

Here is the caller graph for this function:

init_sort ( ) [protected]

Definition at line 960 of file editlib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

init_sort_from_params ( ) [protected]

Definition at line 998 of file editlib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

known_field_types ( ) [protected]

Reimplemented in quiz_question_bank_view.

Definition at line 902 of file editlib.php.

Here is the caller graph for this function:

load_page_questions ( page,
perpage 
) [protected]

No questions on this page. Reset to page 0.

Definition at line 1137 of file editlib.php.

Here is the caller graph for this function:

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.

Parameters:
string$sortthe column, or column_subsort to sort on.
bool$newsortreversewhether to sort in reverse order.
Returns:
string The new URL.

Definition at line 1057 of file editlib.php.

Here is the call graph for this function:

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 ''.

Returns:
array array($colname, $subsort).

Do the parsing.

Validate the column name.

Validate the subsort, if present.

Definition at line 973 of file editlib.php.

Here is the caller graph for this function:

preview_question_url ( question)

Reimplemented in quiz_question_bank_view.

Definition at line 1159 of file editlib.php.

Here is the call graph for this function:

print_category_info ( category) [protected]

Reimplemented in quiz_question_bank_view.

Definition at line 1230 of file editlib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

print_choose_category_message ( categoryandcontext) [protected]

Reimplemented in quiz_question_bank_view.

Definition at line 1205 of file editlib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

print_table_headers ( ) [protected]

Definition at line 1417 of file editlib.php.

Here is the caller graph for this function:

print_table_row ( question,
rowcount 
) [protected]

Definition at line 1439 of file editlib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

Now, check for commands on this page and modify variables as necessary

Definition at line 1455 of file editlib.php.

Here is the call graph for this function:

Definition at line 1523 of file editlib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

sort_to_params ( sorts) [protected]

Definition at line 1020 of file editlib.php.

Here is the caller graph for this function:

start_table ( ) [protected]

Definition at line 1404 of file editlib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

wanted_columns ( ) [protected]

Reimplemented in quiz_question_bank_view.

Definition at line 892 of file editlib.php.

Here is the call graph for this function:

Here is the caller graph for this function:


Field Documentation

$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.


The documentation for this class was generated from the following file:
 All Data Structures Namespaces Files Functions Variables Enumerations