Commit f9fc355e authored by Safat Shahin's avatar Safat Shahin
Browse files

MDL-71679 mod_quiz: Updates for new qbank api

This implementation will introduct changes to
the mod_quiz to implement the new qbank api
for view. Major changes are introduced in
the custom view and also all the legacy points
to the old qbank are changed to qbank plugins
where needed. It also deprecated and deletes
classes and scripts which were kept not to
break mod_quiz for the new api implementation.
parent 1a9bee69
......@@ -137,7 +137,7 @@ abstract class base extends area_base {
}
// Default to SITEID if courseid is null, i.e. system or category level questions.
$thiscourseid = ($componentinfo->courseid !== null) ? $componentinfo->courseid : SITEID;
return new \moodle_url('/question/question.php', ['courseid' => $thiscourseid, 'id' => $questionid]);
return new \moodle_url('/question/bank/editquestion/question.php', ['courseid' => $thiscourseid, 'id' => $questionid]);
}
/**
......
......@@ -692,23 +692,6 @@ $CFG->admin = 'admin';
// $CFG->uninstallclionly = true;
//
//
// Customise question bank display
//
// The display of Moodle's question bank is made up of a number of columns.
// You can customise this display by giving a comma-separated list of column class
// names here. Each class must be a subclass of \core_question\bank\column_base.
// For example you might define a class like
// class \local_qbank_extensions\my_column extends \core_question\bank\column_base
// in a local plugin, then add it to the list here. At the time of writing,
// the default question bank display is equivalent to the following, but you might like
// to check the latest default in question/classes/bank/view.php before setting this.
//
// $CFG->questionbankcolumns = 'checkbox_column,question_type_column,'
// . 'question_name_idnumber_tags_column,edit_menu_column,'
// . 'tags_action_column,edit_action_column,copy_action_column,'
// . 'preview_action_column,delete_action_column,export_xml_action_column,'
// . 'creator_name_column,modifier_name_column';
//
// Forum summary report
//
// In order for the forum summary report to calculate word count and character count data, those details are now stored
......
......@@ -77,11 +77,11 @@ class question_created extends question_base {
public function get_url() {
if ($this->courseid) {
if ($this->contextlevel == CONTEXT_MODULE) {
return new \moodle_url('/question/preview.php', ['cmid' => $this->contextinstanceid, 'id' => $this->objectid]);
return new \moodle_url('/question/bank/previewquestion/preview.php', ['cmid' => $this->contextinstanceid, 'id' => $this->objectid]);
}
return new \moodle_url('/question/preview.php', ['courseid' => $this->courseid, 'id' => $this->objectid]);
return new \moodle_url('/question/bank/previewquestion/preview.php', ['courseid' => $this->courseid, 'id' => $this->objectid]);
}
// Lets try editing from the frontpage for contexts above course.
return new \moodle_url('/question/preview.php', ['courseid' => SITEID, 'id' => $this->objectid]);
return new \moodle_url('/question/bank/previewquestion/preview.php', ['courseid' => SITEID, 'id' => $this->objectid]);
}
}
......@@ -25,8 +25,6 @@
namespace core\plugininfo;
defined('MOODLE_INTERNAL') || die();
/**
* Base class for qbank plugins.
*
......@@ -38,6 +36,9 @@ defined('MOODLE_INTERNAL') || die();
class qbank extends base {
public function is_uninstall_allowed(): bool {
if (in_array($this->name, \core_plugin_manager::standard_plugins_list('qbank'))) {
return false;
}
return true;
}
......
......@@ -35,17 +35,51 @@ defined('MOODLE_INTERNAL') || die();
// Like other files in the db directory this file uses an array.
// The old class name is the key, the new class name is the value.
// The array must be called $renamedclasses.
$renamedclasses = array(
$renamedclasses = [
// Since Moodle 3.7.
'core\\analytics\\target\\course_dropout' => 'core_course\\analytics\\target\\course_dropout',
'core\\analytics\\target\\course_competencies' => 'core_course\\analytics\\target\\course_competencies',
'core\\analytics\\target\\course_completion' => 'core_course\\analytics\\target\\course_completion',
'core\\analytics\\target\\course_gradetopass' => 'core_course\\analytics\\target\\course_gradetopass',
'core\\analytics\\target\\no_teaching' => 'core_course\\analytics\\target\\no_teaching',
// Since Moodle 4.0.
'format_base' => 'core_courseformat\\base',
'format_topics_renderer' => 'format_topics\\output\\renderer',
'format_section_renderer_base' => 'core_courseformat\\output\\section_renderer',
'format_singleactivity_renderer' => 'format_singleactivity\\output\\renderer',
'format_site_renderer' => 'core_courseformat\\output\\site_renderer',
'format_weeks_renderer' => 'format_weeks\\output\\renderer',
);
'core_question\\bank\\action_column_base' => 'core_question\\local\\bank\\action_column_base',
'core_question\\bank\\checkbox_column' => 'core_question\\local\\bank\\checkbox_column',
'core_question\\bank\\column_base' => 'core_question\\local\\bank\\column_base',
'core_question\\bank\\edit_menu_column' => 'core_question\\local\\bank\\edit_menu_column',
'core_question\\bank\\menu_action_column_base' => 'core_question\\local\\bank\\menu_action_column_base',
'core_question\\bank\\menuable_action' => 'core_question\\local\\bank\\menuable_action',
'core_question\\bank\\random_question_loader' => 'core_question\\local\\bank\\random_question_loader',
'core_question\\bank\\row_base' => 'core_question\\local\\bank\\row_base',
'core_question\\bank\\view' => 'core_question\\local\\bank\\view',
'core_question\\bank\\copy_action_column' => 'qbank_editquestion\\copy_action_column',
'core_question\\bank\\edit_action_column' => 'qbank_editquestion\\edit_action_column',
'core_question\\bank\\creator_name_column' => 'qbank_viewcreator\\creator_name_column',
'core_question\\bank\\modifier_name_column' => 'qbank_viewcreator\\modifier_name_column',
'core_question\\bank\\question_name_column' => 'qbank_viewquestionname\\viewquestionname_column_helper',
'core_question\\bank\\question_name_idnumber_tags_column' => 'qbank_viewquestionname\\question_name_idnumber_tags_column',
'core_question\\bank\\delete_action_column' => 'qbank_deletequestion\\delete_action_column',
'core_question\\bank\\export_xml_action_column' => 'qbank_exporttoxml\\export_xml_action_column',
'core_question\\bank\\preview_action_column' => 'qbank_previewquestion\\preview_action_column',
'core_question\\bank\\question_text_row' => 'qbank_viewquestiontext\\question_text_row',
'core_question\\bank\\question_type_column' => 'qbank_viewquestiontype\\question_type_column',
'core_question\\bank\\tags_action_column' => 'qbank_tagquestion\\tags_action_column',
'core_question\\output\\qbank_chooser' => 'qbank_editquestion\\qbank_chooser',
'core_question\\output\\qbank_chooser_item' => 'qbank_editquestion\\qbank_chooser_item',
'question_move_form' => 'qbank_managecategories\\form\\question_move_form',
'question_import_form' => 'qbank_importquestions\\form\\question_import_form',
'question_category_list' => 'qbank_managecategories\\question_category_list',
'question_category_list_item' => 'qbank_managecategories\\question_category_list_item',
'question_category_object' => 'qbank_managecategories\\question_category_object',
'category_form' => 'qbank_managecategories\\form\\category_form',
'export_form' => 'qbank_exportquestions\\form\\export_form',
'preview_options_form' => 'qbank_previewquestion\\form\\preview_options_form',
'question_preview_options' => 'qbank_previewquestion\\output\\question_preview_options',
'core_question\\form\\tags' => '\qbank_tagquestion\\form\\tags_form'
];
......@@ -759,14 +759,12 @@ function question_move_category_to_context($categoryid, $oldcontextid, $newconte
* @return moodle_url the URL.
* @deprecated since Moodle 4.0
* @see qbank_previewquestion\helper::question_preview_url()
* @todo MDL-71679 uncomment the debug messages after implementing the changes in mod_quiz.
* @todo Final deprecation on Moodle 4.4 MDL-72438
*/
function question_preview_url($questionid, $preferredbehaviour = null,
$maxmark = null, $displayoptions = null, $variant = null, $context = null) {
// Debugging message will be re-added after implementing the changes in mod_quiz.
// ...debugging('Function question_preview_url() has been deprecated and moved to qbank_previewquestion plugin,
// Please use qbank_previewquestion\helper::question_preview_url() instead.', DEBUG_DEVELOPER);.
debugging('Function question_preview_url() has been deprecated and moved to qbank_previewquestion plugin,
Please use qbank_previewquestion\helper::question_preview_url() instead.', DEBUG_DEVELOPER);
return \qbank_previewquestion\helper::question_preview_url($questionid, $preferredbehaviour = null,
$maxmark = null, $displayoptions = null, $variant = null, $context = null);
......@@ -776,13 +774,11 @@ function question_preview_url($questionid, $preferredbehaviour = null,
* @return array that can be passed as $params to the {@link popup_action} constructor.
* @deprecated since Moodle 4.0
* @see qbank_previewquestion\helper::question_preview_popup_params()
* @todo MDL-71679 uncomment the debug messages after implementing the changes to mod_quiz.
* @todo Final deprecation on Moodle 4.4 MDL-72438
*/
function question_preview_popup_params() {
// Debugging message will be re-added after implementing the changes in mod_quiz.
// ...debugging('Function question_preview_popup_params() has been deprecated and moved to qbank_previewquestion plugin,
// Please use qbank_previewquestion\helper::question_preview_popup_params() instead.', DEBUG_DEVELOPER);.
debugging('Function question_preview_popup_params() has been deprecated and moved to qbank_previewquestion plugin,
Please use qbank_previewquestion\helper::question_preview_popup_params() instead.', DEBUG_DEVELOPER);
return \qbank_previewquestion\helper::question_preview_popup_params();
}
......@@ -1656,18 +1652,9 @@ function question_extend_settings_navigation(navigation_node $navigationnode, $c
'title' => get_string('questions', 'question'),
'url' => new moodle_url($baseurl)
],
'categories' => [
'title' => get_string('categories', 'question'),
'url' => new moodle_url('/question/category.php')
],
'import' => [
'title' => get_string('import', 'question'),
'url' => new moodle_url('/question/import.php')
],
'export' => [
'title' => get_string('export', 'question'),
'url' => new moodle_url('/question/export.php')
]
'categories' => [],
'import' => [],
'export' => []
];
$plugins = \core_component::get_plugin_list_with_class('qbank', 'plugin_feature', 'plugin_feature.php');
......@@ -1692,16 +1679,23 @@ function question_extend_settings_navigation(navigation_node $navigationnode, $c
];
}
}
}
// Mitigate the risk of regression.
foreach ($corenavigations as $node => $corenavigation) {
if (empty($corenavigation)) {
unset($corenavigations[$node]);
}
}
// Community/additional plugins have navigation node.
$pluginnavigations = [];
foreach ($plugins as $componentname => $plugin) {
$pluginentrypoin = new $plugin();
$pluginentrypointobject = $pluginentrypoin->get_navigation_node();
if (!\core\plugininfo\qbank::is_plugin_enabled($componentname)) {
unset($corenavigations[$key]);
$pluginentrypoint = new $plugin();
$pluginentrypointobject = $pluginentrypoint->get_navigation_node();
// Don't need the plugins without navigation node.
if ($pluginentrypointobject === null || !\core\plugininfo\qbank::is_plugin_enabled($componentname)) {
unset($plugins[$componentname]);
continue;
}
$pluginnavigations[$pluginentrypointobject->get_navigation_key()] = [
......
......@@ -69,6 +69,11 @@ information provided here is intended especially for developers.
rendered. The default icon for "select" types has also changed to a dropdown caret ("t/expanded").
* The function message_send() in messagelib.php now returns false if there is an error sending the message to the
message processor (MDL-70046).
* Following methods are now deprecated in questionlib and moved to the new qbank_previewquestion plugin:
- question_preview_url() is moved to qbank_previewquestion\helper::question_preview_url()
- question_preview_popup_params() is moved to \qbank_previewquestion\helper::question_preview_popup_params()
Calling these functions in the question will point to the plugin.
The deprecated codes are removed from the questionlib for those two methods.
* The following functions are deprecated in questionlib.php and moved to the new location.
These are marked for final deprecation on 4.4:
- question_remove_stale_questions_from_category() =>
......
......@@ -2107,7 +2107,7 @@ class quiz_attempt {
} else {
$tagids = quiz_retrieve_slot_tag_ids($this->slots[$slot]->id);
$randomloader = new \core_question\bank\random_question_loader($qubaids, array());
$randomloader = new \core_question\local\bank\random_question_loader($qubaids, array());
$newqusetionid = $randomloader->get_next_question_id($questiondata->category,
(bool) $questiondata->questiontext, $tagids);
if ($newqusetionid === null) {
......
......@@ -651,7 +651,7 @@ class edit_renderer extends \plugin_renderer_base {
'addonpage' => $page, 'appendqnumstring' => 'addquestion');
$actions['addaquestion'] = new \action_menu_link_secondary(
new \moodle_url('/question/addquestion.php', $params),
new \moodle_url('/question/bank/editquestion/addquestion.php', $params),
new \pix_icon('t/add', $str->addaquestion, 'moodle', array('class' => 'iconsmall', 'title' => '')),
$str->addaquestion, array('class' => 'cm-edit-action addquestion', 'data-action' => 'addquestion')
);
......@@ -722,7 +722,7 @@ class edit_renderer extends \plugin_renderer_base {
return html_writer::tag('form', html_writer::div($output),
array('class' => 'addnewquestion', 'method' => 'post',
'action' => new \moodle_url('/question/addquestion.php')));
'action' => new \moodle_url('/question/bank/editquestion/addquestion.php')));
}
/**
......@@ -836,7 +836,7 @@ class edit_renderer extends \plugin_renderer_base {
$image = $this->pix_icon('t/preview', $strpreviewquestion);
$action = new \popup_action('click', $url, 'questionpreview',
question_preview_popup_params());
\qbank_previewquestion\helper::question_preview_popup_params());
return $this->action_link($url, $image . $strpreviewlabel, $action,
array('title' => $strpreviewquestion, 'class' => 'preview'));
......@@ -946,7 +946,7 @@ class edit_renderer extends \plugin_renderer_base {
$output = '';
$question = $structure->get_question_in_slot($slot);
$editurl = new \moodle_url('/question/question.php', array(
$editurl = new \moodle_url('/question/bank/editquestion/question.php', array(
'returnurl' => $pageurl->out_as_local_url(),
'cmid' => $structure->get_cmid(), 'id' => $question->id));
......@@ -1252,9 +1252,7 @@ class edit_renderer extends \plugin_renderer_base {
*/
public function question_bank_contents(\mod_quiz\question\bank\custom_view $questionbank, array $pagevars) {
$qbank = $questionbank->render('editq', $pagevars['qpage'], $pagevars['qperpage'],
$pagevars['cat'], $pagevars['recurse'], $pagevars['showhidden'], $pagevars['qbshowtext'],
$pagevars['qtagids']);
$qbank = $questionbank->render($pagevars, 'editq');
return html_writer::div(html_writer::div($qbank, 'bd'), 'questionbankformforpopup');
}
}
......@@ -32,5 +32,5 @@ defined('MOODLE_INTERNAL') || die();
* @copyright 2016 Frédéric Massart - FMCorz.net
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class question_chooser extends \core_question\output\qbank_chooser {
class question_chooser extends \qbank_editquestion\qbank_chooser {
}
......@@ -14,30 +14,23 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* A column type for the add this question to the quiz action.
*
* @package mod_quiz
* @category question
* @copyright 2009 Tim Hunt
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace mod_quiz\question\bank;
defined('MOODLE_INTERNAL') || die();
/**
* A column type for the add this question to the quiz action.
*
* @package mod_quiz
* @category question
* @copyright 2009 Tim Hunt
* @author 2021 Safat Shahin <safatshahin@catalyst-au.net>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class add_action_column extends \core_question\bank\action_column_base {
class add_action_column extends \core_question\local\bank\action_column_base {
/** @var string caches a lang string used repeatedly. */
protected $stradd;
public function init() {
public function init(): void {
parent::init();
$this->stradd = get_string('addtoquiz', 'quiz');
}
......
......@@ -31,18 +31,22 @@ use coding_exception;
* Subclass to customise the view of the question bank for the quiz editing screen.
*
* @copyright 2009 Tim Hunt
* @author 2021 Safat Shahin <safatshahin@catalyst-au.net>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class custom_view extends \core_question\bank\view {
/** @var bool whether the quiz this is used by has been attemptd. */
class custom_view extends \core_question\local\bank\view {
/** @var bool $quizhasattempts whether the quiz this is used by has been attemptd. */
protected $quizhasattempts = false;
/** @var \stdClass the quiz settings. */
/** @var \stdClass $quiz the quiz settings. */
protected $quiz = false;
/** @var int The maximum displayed length of the category info. */
const MAX_TEXT_LENGTH = 200;
/**
* Constructor
* Constructor for custom_view.
* @param \question_edit_contexts $contexts
* @param \moodle_url $pageurl
* @param \stdClass $course course settings
......@@ -54,76 +58,66 @@ class custom_view extends \core_question\bank\view {
$this->quiz = $quiz;
}
protected function wanted_columns() {
global $CFG;
if (empty($CFG->quizquestionbankcolumns)) {
$quizquestionbankcolumns = array(
'add_action_column',
'checkbox_column',
'question_type_column',
'question_name_text_column',
'preview_action_column',
);
} else {
$quizquestionbankcolumns = explode(',', $CFG->quizquestionbankcolumns);
}
protected function wanted_columns(): array {
$quizquestionbankcolumns = [
'mod_quiz\\question\\bank\\add_action_column',
'core_question\\local\\bank\\checkbox_column',
'qbank_viewquestiontype\\question_type_column',
'mod_quiz\\question\\bank\\question_name_text_column',
'qbank_previewquestion\\preview_action_column',
];
foreach ($quizquestionbankcolumns as $fullname) {
if (!class_exists($fullname)) {
if (class_exists('mod_quiz\\question\\bank\\' . $fullname)) {
$fullname = 'mod_quiz\\question\\bank\\' . $fullname;
} else if (class_exists('core_question\\bank\\' . $fullname)) {
$fullname = 'core_question\\bank\\' . $fullname;
} else if (class_exists('question_bank_' . $fullname)) {
debugging('Legacy question bank column class question_bank_' .
$fullname . ' should be renamed to mod_quiz\\question\\bank\\' .
$fullname, DEBUG_DEVELOPER);
$fullname = 'question_bank_' . $fullname;
} else {
throw new coding_exception('Invalid quiz question bank column', $fullname);
}
throw new coding_exception('Invalid quiz question bank column', $fullname);
}
$this->requiredcolumns[$fullname] = new $fullname($this);
}
return $this->requiredcolumns;
}
/**
* Specify the column heading
*
* @return string Column name for the heading
*/
protected function heading_column() {
protected function heading_column(): string {
return 'mod_quiz\\question\\bank\\question_name_text_column';
}
protected function default_sort() {
return array(
'core_question\\bank\\question_type_column' => 1,
protected function default_sort(): array {
return [
'qbank_viewquestiontype\\question_type_column' => 1,
'mod_quiz\\question\\bank\\question_name_text_column' => 1,
);
];
}
/**
* 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.
*
* @param bool $quizhasattempts whether the quiz has attempts.
*/
public function set_quiz_has_attempts($quizhasattempts) {
public function set_quiz_has_attempts($quizhasattempts): void {
$this->quizhasattempts = $quizhasattempts;
if ($quizhasattempts && isset($this->visiblecolumns['addtoquizaction'])) {
unset($this->visiblecolumns['addtoquizaction']);
}
}
/**
* Question preview url.
*
* @param \stdClass $question
* @return \moodle_url
*/
public function preview_question_url($question) {
return quiz_question_preview_url($this->quiz, $question);
}
/**
* URL of add to quiz.
*
* @param $questionid
* @return \moodle_url
*/
public function add_to_quiz_url($questionid) {
global $CFG;
$params = $this->baseurl->params();
$params['addquestion'] = $questionid;
$params['sesskey'] = sesskey();
......@@ -136,34 +130,26 @@ class custom_view extends \core_question\bank\view {
* Note that you can only output this rendered result once per page, as
* it contains IDs which must be unique.
*
* @param array $pagevars
* @param string $tabname
* @return string HTML code for the form
*/
public function render($tabname, $page, $perpage, $cat, $recurse, $showhidden,
$showquestiontext, $tagids = []) {
public function render($pagevars, $tabname): string {
ob_start();
$this->display($tabname, $page, $perpage, $cat, $recurse, $showhidden, $showquestiontext, $tagids);
$this->display($pagevars, $tabname);
$out = ob_get_contents();
ob_end_clean();
return $out;
}
/**
* Display the controls at the bottom of the list of questions.
* @param int $totalnumber Total number of questions that might be shown (if it was not for paging).
* @param bool $recurse Whether to include subcategories.
* @param \stdClass $category The question_category row from the database.
* @param \context $catcontext The context of the category being displayed.
* @param array $addcontexts contexts where the user is allowed to add new questions.
*/
protected function display_bottom_controls($totalnumber, $recurse, $category, \context $catcontext, array $addcontexts) {
protected function display_bottom_controls($totalnumber, $recurse, $category, \context $catcontext, array $addcontexts): void {
$cmoptions = new \stdClass();
$cmoptions->hasattempts = !empty($this->quizhasattempts);
$canuseall = has_capability('moodle/question:useall', $catcontext);
echo '<div class="modulespecificbuttonscontainer">';
echo \html_writer::start_tag('div', ['class' => 'modulespecificbuttonscontainer']);
if ($canuseall) {
// Add selected questions to the quiz.
$params = array(
'type' => 'submit',
......@@ -177,75 +163,19 @@ class custom_view extends \core_question\bank\view {
);
echo \html_writer::empty_tag('input', $params);
}
echo "</div>\n";
}
/**
* Prints a form to choose categories.
* @param string $categoryandcontext 'categoryID,contextID'.
* @deprecated since Moodle 2.6 MDL-40313.
* @see \core_question\bank\search\category_condition
* @todo MDL-41978 This will be deleted in Moodle 2.8
*/
protected function print_choose_category_message($categoryandcontext) {
global $OUTPUT;
debugging('print_choose_category_message() is deprecated, ' .
'please use \core_question\bank\search\category_condition instead.', DEBUG_DEVELOPER);
echo $OUTPUT->box_start('generalbox questionbank');
$this->display_category_form($this->contexts->having_one_edit_tab_cap('edit'),
$this->baseurl, $categoryandcontext);
echo "<p style=\"text-align:center;\"><b>";
print_string('selectcategoryabove', 'question');
echo "</b></p>";
echo $OUTPUT->box_end();
echo \html_writer::end_tag('div');
}
protected function display_options_form($showquestiontext, $scriptpath = '/mod/quiz/edit.php',
$showtextoption = false) {
// Overridden just to change the default values of the arguments.
parent::display_options_form($showquestiontext, $scriptpath, $showtextoption);
}
protected function print_category_info($category) {
$formatoptions = new \stdClass();
$formatoptions->noclean = true;
$strcategory = get_string('category', 'quiz');
echo '<div class="categoryinfo"><div class="categorynamefieldcontainer">' .
$strcategory;
echo ': <span class="categorynamefield">';
echo shorten_text(strip_tags(format_string($category->name)), 60);
echo '</span></div><div class="categoryinfofieldcontainer">' .
'<span class="categoryinfofield">';
echo shorten_text(strip_tags(format_text($category->info, $category->infoformat,
$formatoptions, $this->course->id)), 200);
echo '</span></div></div>';
}
protected function display_options($recurse, $showhidden, $showquestiontext) {
debugging('display_options() is deprecated, see display_options_form() instead.', DEBUG_DEVELOPER);
echo '<form method="get" action="edit.php" id="displayoptions">';
echo "<fieldset class='invisiblefieldset'>";
echo \html_writer::input_hidden_params($this->baseurl,
array('recurse', 'showhidden', 'qbshowtext'));
$this->display_category_form_checkbox('recurse', $recurse,
get_string('includesubcategories', 'question'));
$this->display_category_form_checkbox('showhidden', $showhidden,
get_string('showhidden', 'question'));
echo '<noscript><div class="centerpara"><input type="submit" value="' .
get_string('go') . '" />';
echo '</div></noscript></fieldset></form>';
}
protected function create_new_question_form($category, $canadd) {
protected function create_new_question_form($category, $canadd): void {
// Don't display this.
}
/**
* Override the base implementation in \core_question\bank\view
* Override the base implementation in \core_question\local\bank\view
* because we don't want to print the headers in the fragment
* for the modal.
*/
protected function display_question_bank_header() {
protected function display_question_bank_header(): void {
}
/**
......@@ -256,7 +186,7 @@ class custom_view extends \core_question\bank\view {
* Unfortunately the best we can do is to look at the URL for
* those parameters (only marginally better really).
*/
protected function init_sort_from_params() {
protected function init_sort_from_params(): void {
$this->sort = [];
for ($i = 1; $i <= self::MAX_SORTS; $i++) {
if (!$sort = $this->baseurl->param('qbs' . $i)) {
......@@ -272,8 +202,8 @@ class custom_view extends \core_question\bank\view {
}
}
// Deal with subsorts.
list($colname, $subsort) = $this->parse_subsort($sort);
$this->requiredcolumns[$colname] = $this->get_column_type($colname);
list($colname) = $this->parse_subsort($sort);
$this->get_column_type($colname);
$this->sort[$sort] = $order;
}
}
......
......@@ -14,39 +14,35 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* A column type for the name of the question name.
*
* @package core_question
* @copyright 2009 Tim Hunt
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace mod_quiz\question\bank;