mirror of
https://github.com/moodle/moodle.git
synced 2025-01-17 21:49:15 +01:00
MDL-74054 qbank: Miscellaneous coding style fixes
This commit is contained in:
parent
813c2441a1
commit
a3cfd50482
2
question/amd/build/filter.min.js
vendored
2
question/amd/build/filter.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -71,8 +71,9 @@ export const init = (
|
||||
const filterSet = document.querySelector(`#${filterRegionId}`);
|
||||
|
||||
const viewData = {
|
||||
view: view,
|
||||
cmid: cmid,
|
||||
extraparams,
|
||||
cmid,
|
||||
view,
|
||||
cat: defaultcategoryid,
|
||||
courseid: defaultcourseid,
|
||||
filter: {},
|
||||
@ -80,7 +81,6 @@ export const init = (
|
||||
qpage: 0,
|
||||
qperpage: perpage,
|
||||
sortdata: {},
|
||||
extraparams: extraparams,
|
||||
lastchanged: document.querySelector(SELECTORS.LASTCHANGED_FIELD)?.value ?? null,
|
||||
};
|
||||
|
||||
|
@ -1,3 +1,3 @@
|
||||
define("qbank_columnsortorder/repository",["exports","core/ajax"],(function(_exports,_ajax){Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.setHiddenColumns=_exports.setColumnbankOrder=_exports.setColumnSize=void 0;_exports.setHiddenColumns=function(columns){let global=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const responses=(0,_ajax.call)([{methodname:"qbank_columnsortorder_set_hidden_columns",args:{columns:columns,global:global}}]);return responses[0]};_exports.setColumnbankOrder=function(columns){let global=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return(0,_ajax.call)([{methodname:"qbank_columnsortorder_set_columnbank_order",args:{columns:columns,global:global}}])[0]};_exports.setColumnSize=function(sizes){let global=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return(0,_ajax.call)([{methodname:"qbank_columnsortorder_set_column_size",args:{sizes:sizes,global:global}}])[0]}}));
|
||||
define("qbank_columnsortorder/repository",["exports","core/ajax"],(function(_exports,_ajax){Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.setHiddenColumns=_exports.setColumnbankOrder=_exports.setColumnSize=void 0;_exports.setHiddenColumns=function(columns){let global=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return(0,_ajax.call)([{methodname:"qbank_columnsortorder_set_hidden_columns",args:{columns:columns,global:global}}])[0]};_exports.setColumnbankOrder=function(columns){let global=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return(0,_ajax.call)([{methodname:"qbank_columnsortorder_set_columnbank_order",args:{columns:columns,global:global}}])[0]};_exports.setColumnSize=function(sizes){let global=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return(0,_ajax.call)([{methodname:"qbank_columnsortorder_set_column_size",args:{sizes:sizes,global:global}}])[0]}}));
|
||||
|
||||
//# sourceMappingURL=repository.min.js.map
|
@ -1 +1 @@
|
||||
{"version":3,"file":"repository.min.js","sources":["../src/repository.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * External function calls for qbank_columnsortorder\n *\n * @module qbank_columnsortorder/repository\n * @copyright 2023 Catalyst IT Europe Ltd.\n * @author Mark Johnson <mark.johnson@catalyst-eu.net>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport {call as fetchMany} from 'core/ajax';\n\n/**\n * Save the list of hidden columns\n *\n * @param {String[]} columns List of hidden column names\n * @param {Boolean} global Set global config setting, rather than user preference\n * @return {Promise}\n */\nexport const setHiddenColumns = (columns, global = false) => {\n const responses = fetchMany([{\n methodname: 'qbank_columnsortorder_set_hidden_columns',\n args: {columns: columns, global: global},\n }]);\n return responses[0];\n};\n\n/**\n * Save the order of columns\n *\n * @param {String[]} columns List of column names in the desired order\n * @param {Boolean} global Set global config setting, rather than user preference\n * @return {Promise}\n */\nexport const setColumnbankOrder = (columns, global = false) => {\n return fetchMany([{\n methodname: 'qbank_columnsortorder_set_columnbank_order',\n args: {columns: columns, global: global},\n }])[0];\n};\n\n/**\n * Save the column widths\n *\n * @param {String} sizes JSON string encoding an array of objects with \"column\" and \"width\" properties.\n * @param {Boolean} global Set global config setting, rather than user preference\n * @return {Promise}\n */\nexport const setColumnSize = (sizes, global = false) => {\n return fetchMany([{\n methodname: 'qbank_columnsortorder_set_column_size',\n args: {sizes: sizes, global: global},\n }])[0];\n};\n"],"names":["columns","global","responses","methodname","args","sizes"],"mappings":"kQAiCgC,SAACA,aAASC,qEAChCC,WAAY,cAAU,CAAC,CACzBC,WAAY,2CACZC,KAAM,CAACJ,QAASA,QAASC,OAAQA,kBAE9BC,UAAU,gCAUa,SAACF,aAASC,sEACjC,cAAU,CAAC,CACdE,WAAY,6CACZC,KAAM,CAACJ,QAASA,QAASC,OAAQA,WACjC,2BAUqB,SAACI,WAAOJ,sEAC1B,cAAU,CAAC,CACdE,WAAY,wCACZC,KAAM,CAACC,MAAOA,MAAOJ,OAAQA,WAC7B"}
|
||||
{"version":3,"file":"repository.min.js","sources":["../src/repository.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * External function calls for qbank_columnsortorder\n *\n * @module qbank_columnsortorder/repository\n * @copyright 2023 Catalyst IT Europe Ltd.\n * @author Mark Johnson <mark.johnson@catalyst-eu.net>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport {call as fetchMany} from 'core/ajax';\n\n/**\n * Save the list of hidden columns\n *\n * @param {String[]} columns List of hidden column names\n * @param {Boolean} global Set global config setting, rather than user preference\n * @return {Promise}\n */\nexport const setHiddenColumns = (columns, global = false) => fetchMany([{\n methodname: 'qbank_columnsortorder_set_hidden_columns',\n args: {\n columns,\n global,\n },\n}])[0];\n\n/**\n * Save the order of columns\n *\n * @param {String[]} columns List of column names in the desired order\n * @param {Boolean} global Set global config setting, rather than user preference\n * @return {Promise}\n */\nexport const setColumnbankOrder = (columns, global = false) => fetchMany([{\n methodname: 'qbank_columnsortorder_set_columnbank_order',\n args: {\n columns,\n global,\n },\n}])[0];\n\n/**\n * Save the column widths\n *\n * @param {String} sizes JSON string encoding an array of objects with \"column\" and \"width\" properties.\n * @param {Boolean} global Set global config setting, rather than user preference\n * @return {Promise}\n */\nexport const setColumnSize = (sizes, global = false) => fetchMany([{\n methodname: 'qbank_columnsortorder_set_column_size',\n args: {\n sizes,\n global,\n },\n}])[0];\n"],"names":["columns","global","methodname","args","sizes"],"mappings":"kQAiCgC,SAACA,aAASC,sEAAmB,cAAU,CAAC,CACpEC,WAAY,2CACZC,KAAM,CACFH,QAAAA,QACAC,OAAAA,WAEJ,gCAS8B,SAACD,aAASC,sEAAmB,cAAU,CAAC,CACtEC,WAAY,6CACZC,KAAM,CACFH,QAAAA,QACAC,OAAAA,WAEJ,2BASyB,SAACG,WAAOH,sEAAmB,cAAU,CAAC,CAC/DC,WAAY,wCACZC,KAAM,CACFC,MAAAA,MACAH,OAAAA,WAEJ"}
|
@ -31,13 +31,13 @@ import {call as fetchMany} from 'core/ajax';
|
||||
* @param {Boolean} global Set global config setting, rather than user preference
|
||||
* @return {Promise}
|
||||
*/
|
||||
export const setHiddenColumns = (columns, global = false) => {
|
||||
const responses = fetchMany([{
|
||||
methodname: 'qbank_columnsortorder_set_hidden_columns',
|
||||
args: {columns: columns, global: global},
|
||||
}]);
|
||||
return responses[0];
|
||||
};
|
||||
export const setHiddenColumns = (columns, global = false) => fetchMany([{
|
||||
methodname: 'qbank_columnsortorder_set_hidden_columns',
|
||||
args: {
|
||||
columns,
|
||||
global,
|
||||
},
|
||||
}])[0];
|
||||
|
||||
/**
|
||||
* Save the order of columns
|
||||
@ -46,12 +46,13 @@ export const setHiddenColumns = (columns, global = false) => {
|
||||
* @param {Boolean} global Set global config setting, rather than user preference
|
||||
* @return {Promise}
|
||||
*/
|
||||
export const setColumnbankOrder = (columns, global = false) => {
|
||||
return fetchMany([{
|
||||
methodname: 'qbank_columnsortorder_set_columnbank_order',
|
||||
args: {columns: columns, global: global},
|
||||
}])[0];
|
||||
};
|
||||
export const setColumnbankOrder = (columns, global = false) => fetchMany([{
|
||||
methodname: 'qbank_columnsortorder_set_columnbank_order',
|
||||
args: {
|
||||
columns,
|
||||
global,
|
||||
},
|
||||
}])[0];
|
||||
|
||||
/**
|
||||
* Save the column widths
|
||||
@ -60,9 +61,10 @@ export const setColumnbankOrder = (columns, global = false) => {
|
||||
* @param {Boolean} global Set global config setting, rather than user preference
|
||||
* @return {Promise}
|
||||
*/
|
||||
export const setColumnSize = (sizes, global = false) => {
|
||||
return fetchMany([{
|
||||
methodname: 'qbank_columnsortorder_set_column_size',
|
||||
args: {sizes: sizes, global: global},
|
||||
}])[0];
|
||||
};
|
||||
export const setColumnSize = (sizes, global = false) => fetchMany([{
|
||||
methodname: 'qbank_columnsortorder_set_column_size',
|
||||
args: {
|
||||
sizes,
|
||||
global,
|
||||
},
|
||||
}])[0];
|
||||
|
@ -39,8 +39,12 @@ class set_column_size extends external_api {
|
||||
public static function execute_parameters(): external_function_parameters {
|
||||
return new external_function_parameters([
|
||||
'sizes' => new external_value(PARAM_TEXT, 'Size for each column', VALUE_REQUIRED),
|
||||
'global' => new external_value(PARAM_BOOL, 'Set global config setting, rather than user preference',
|
||||
VALUE_DEFAULT, false),
|
||||
'global' => new external_value(
|
||||
PARAM_BOOL,
|
||||
'Set global config setting, rather than user preference',
|
||||
VALUE_DEFAULT,
|
||||
false
|
||||
),
|
||||
]);
|
||||
}
|
||||
|
||||
@ -61,12 +65,13 @@ class set_column_size extends external_api {
|
||||
[
|
||||
'sizes' => $sizes,
|
||||
'global' => $global,
|
||||
]
|
||||
= self::validate_parameters(self::execute_parameters(),
|
||||
[
|
||||
'sizes' => $sizes,
|
||||
'global' => $global,
|
||||
]);
|
||||
] = self::validate_parameters(
|
||||
self::execute_parameters(),
|
||||
[
|
||||
'sizes' => $sizes,
|
||||
'global' => $global,
|
||||
]
|
||||
);
|
||||
|
||||
$context = context_system::instance();
|
||||
self::validate_context($context);
|
||||
|
@ -65,9 +65,7 @@ class set_columnbank_order extends external_api {
|
||||
[
|
||||
'columns' => $columns,
|
||||
'global' => $global,
|
||||
]
|
||||
= self::validate_parameters(self::execute_parameters(),
|
||||
[
|
||||
] = self::validate_parameters(self::execute_parameters(), [
|
||||
'columns' => $columns,
|
||||
'global' => $global,
|
||||
]);
|
||||
|
@ -42,8 +42,12 @@ class set_hidden_columns extends external_api {
|
||||
'columns' => new external_multiple_structure(
|
||||
new external_value(PARAM_TEXT, 'Plugin name for the hidden column', VALUE_REQUIRED)
|
||||
),
|
||||
'global' => new external_value(PARAM_BOOL, 'Set global config setting, rather than user preference',
|
||||
VALUE_DEFAULT, false),
|
||||
'global' => new external_value(
|
||||
PARAM_BOOL,
|
||||
'Set global config setting, rather than user preference',
|
||||
VALUE_DEFAULT,
|
||||
false
|
||||
),
|
||||
]);
|
||||
}
|
||||
|
||||
@ -65,12 +69,13 @@ class set_hidden_columns extends external_api {
|
||||
[
|
||||
'columns' => $columns,
|
||||
'global' => $global,
|
||||
]
|
||||
= self::validate_parameters(self::execute_parameters(),
|
||||
[
|
||||
'columns' => $columns,
|
||||
'global' => $global,
|
||||
]);
|
||||
] = self::validate_parameters(
|
||||
self::execute_parameters(),
|
||||
[
|
||||
'columns' => $columns,
|
||||
'global' => $global,
|
||||
]
|
||||
);
|
||||
|
||||
$context = context_system::instance();
|
||||
self::validate_context($context);
|
||||
|
@ -31,7 +31,6 @@ use core_question\local\bank\column_base;
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class column_action_move extends column_action_base {
|
||||
|
||||
/** @var string Label for the Move action. */
|
||||
protected string $move;
|
||||
|
||||
@ -41,13 +40,14 @@ class column_action_move extends column_action_base {
|
||||
|
||||
public function get_action_menu_link(column_base $column): ?\action_menu_link {
|
||||
return new \action_menu_link_secondary(
|
||||
new \moodle_url('/question/edit.php'),
|
||||
null,
|
||||
$this->move,
|
||||
[
|
||||
'title' => get_string('movecolumn', 'qbank_columnsortorder', $column->get_title()),
|
||||
'data-action' => 'move',
|
||||
'data-column' => get_class($column),
|
||||
]);
|
||||
new \moodle_url('/question/edit.php'),
|
||||
null,
|
||||
$this->move,
|
||||
[
|
||||
'title' => get_string('movecolumn', 'qbank_columnsortorder', $column->get_title()),
|
||||
'data-action' => 'move',
|
||||
'data-column' => get_class($column),
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,6 @@ use core_question\local\bank\column_base;
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class column_action_remove extends column_action_base {
|
||||
|
||||
/** @var bool True if we are changing global config, false for user preferences. */
|
||||
protected bool $global;
|
||||
|
||||
@ -65,14 +64,15 @@ class column_action_remove extends column_action_base {
|
||||
$actionurl->param('global', $this->global);
|
||||
}
|
||||
return new \action_menu_link_secondary(
|
||||
$actionurl,
|
||||
null,
|
||||
$this->remove,
|
||||
[
|
||||
'class' => 'action-link',
|
||||
'title' => get_string('removecolumn', 'qbank_columnsortorder', $column->get_title()),
|
||||
'data-action' => 'remove',
|
||||
'data-column' => $column->get_column_id(),
|
||||
]);
|
||||
$actionurl,
|
||||
null,
|
||||
$this->remove,
|
||||
[
|
||||
'class' => 'action-link',
|
||||
'title' => get_string('removecolumn', 'qbank_columnsortorder', $column->get_title()),
|
||||
'data-action' => 'remove',
|
||||
'data-column' => $column->get_column_id(),
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,6 @@ use core_question\local\bank\column_base;
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class column_action_resize extends column_action_base {
|
||||
|
||||
/** @var string Label for the resize action. */
|
||||
protected string $resize;
|
||||
|
||||
@ -48,6 +47,7 @@ class column_action_resize extends column_action_base {
|
||||
'title' => get_string('resizecolumn', 'qbank_columnsortorder', $column->get_title()),
|
||||
'data-action' => 'resize',
|
||||
'data-column' => get_class($column),
|
||||
]);
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,6 @@ use qbank_columnsortorder\column_manager;
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class preview_view extends view {
|
||||
|
||||
/**
|
||||
* Use global settings for the column manager.
|
||||
*
|
||||
|
@ -30,7 +30,6 @@ use renderer_base;
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class add_column implements \renderable, \templatable {
|
||||
|
||||
/** @var column_manager The column manager for getting the list of hidden columns. */
|
||||
protected column_manager $columnmanager;
|
||||
|
||||
|
@ -31,8 +31,7 @@ use qbank_columnsortorder\column_manager;
|
||||
* @author Mark Johnson <mark.johnson@catalyst-eu.net>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class column_sort_preview implements templatable, renderable {
|
||||
|
||||
class column_sort_preview implements renderable, templatable {
|
||||
/** @var string Rendered preview HTML. */
|
||||
protected string $preview;
|
||||
|
||||
|
@ -33,8 +33,7 @@ use templatable;
|
||||
* @author Mark Johnson <mark.johnson@catalyst-eu.net>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class column_sort_ui implements templatable, renderable {
|
||||
|
||||
class column_sort_ui implements renderable, templatable {
|
||||
/**
|
||||
* @var int The minimum custom width for a column.
|
||||
*/
|
||||
@ -88,7 +87,7 @@ class column_sort_ui implements templatable, renderable {
|
||||
|
||||
$params['urltomanageqbanks'] = get_string('qbankgotomanageqbanks', 'qbank_columnsortorder', $urltoredirect->out());
|
||||
$params['previewurl'] = new moodle_url('/question/bank/columnsortorder/sortcolumns.php', [
|
||||
'preview' => true
|
||||
'preview' => true,
|
||||
]);
|
||||
return $params;
|
||||
}
|
||||
|
@ -29,7 +29,6 @@ use renderer_base;
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class reset_columns implements \renderable, \templatable {
|
||||
|
||||
/** @var \moodle_url The current page URL to redirect back to. */
|
||||
protected \moodle_url $returnurl;
|
||||
|
||||
|
@ -40,7 +40,7 @@ class plugin_feature extends plugin_features_base {
|
||||
*
|
||||
* @return ?column_manager_base
|
||||
*/
|
||||
public function get_column_manager() : ?column_manager_base {
|
||||
public function get_column_manager(): ?column_manager_base {
|
||||
return new column_manager();
|
||||
}
|
||||
|
||||
@ -52,7 +52,7 @@ class plugin_feature extends plugin_features_base {
|
||||
* @param int $categoryid The current question category ID.
|
||||
* @return \renderable[]
|
||||
*/
|
||||
public function get_question_bank_controls(view $qbank, context $context, int $categoryid) : array {
|
||||
public function get_question_bank_controls(view $qbank, context $context, int $categoryid): array {
|
||||
global $PAGE;
|
||||
$PAGE->requires->js_call_amd('qbank_columnsortorder/user_actions', 'init');
|
||||
$returnurl = new \moodle_url($qbank->returnurl);
|
||||
|
@ -29,7 +29,6 @@ namespace qbank_columnsortorder\tests;
|
||||
* Class defining resuable tests methods for external functions
|
||||
*/
|
||||
abstract class external_function_testcase extends \advanced_testcase {
|
||||
|
||||
/**
|
||||
* @var string Fully-qualified external function class to test.
|
||||
*/
|
||||
|
@ -27,7 +27,6 @@ require_once(__DIR__ . '/../../../../../lib/behat/behat_base.php');
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class behat_qbank_columnsortorder extends behat_base {
|
||||
|
||||
public static function get_exact_named_selectors(): array {
|
||||
return [
|
||||
new behat_component_named_selector('column header', [
|
||||
|
@ -39,7 +39,6 @@ require_once($CFG->dirroot . '/question/classes/external.php');
|
||||
* @covers \qbank_columnsortorder\column_manager
|
||||
*/
|
||||
class column_manager_test extends advanced_testcase {
|
||||
|
||||
/** @var \stdClass course record. */
|
||||
protected $course;
|
||||
|
||||
@ -84,20 +83,20 @@ class column_manager_test extends advanced_testcase {
|
||||
'setting' => 'enabledcol',
|
||||
'function' => 'set_column_order',
|
||||
'dataproperty' => 'columns',
|
||||
'csv' => true
|
||||
'csv' => true,
|
||||
],
|
||||
'Test set_hidden_columns' => [
|
||||
'setting' => 'hiddencols',
|
||||
'function' => 'set_hidden_columns',
|
||||
'dataproperty' => 'columns',
|
||||
'csv' => true
|
||||
'csv' => true,
|
||||
],
|
||||
'Test set_column_size' => [
|
||||
'setting' => 'colsize',
|
||||
'function' => 'set_column_size',
|
||||
'dataproperty' => 'randomstring',
|
||||
'csv' => false
|
||||
]
|
||||
'csv' => false,
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
@ -252,8 +251,10 @@ class column_manager_test extends advanced_testcase {
|
||||
$randomplugin1 = $plugins[$randomplugins[0]];
|
||||
$randomplugin2 = $plugins[$randomplugins[1]];
|
||||
|
||||
$disabledcols = array_filter($this->columns,
|
||||
fn($column) => str_starts_with($column, $randomplugin1) || str_starts_with($column, $randomplugin2));
|
||||
$disabledcols = array_filter(
|
||||
$this->columns,
|
||||
fn($column) => str_starts_with($column, $randomplugin1) || str_starts_with($column, $randomplugin2)
|
||||
);
|
||||
$enabledcols = array_diff($this->columns, $disabledcols);
|
||||
|
||||
set_config('enabledcol', implode(',', $enabledcols), 'qbank_columnsortorder');
|
||||
|
@ -32,7 +32,6 @@ use qbank_columnsortorder\tests\external_function_testcase;
|
||||
* @covers \qbank_columnsortorder\external\set_column_size
|
||||
*/
|
||||
class set_column_size_test extends external_function_testcase {
|
||||
|
||||
/**
|
||||
* @var string Fully-qualified external function class to test.
|
||||
*/
|
||||
@ -60,7 +59,7 @@ class set_column_size_test extends external_function_testcase {
|
||||
foreach ($questionlistcolumns as $columnnobject) {
|
||||
$columnsizes[] = (object)[
|
||||
'column' => $columnnobject->name,
|
||||
'width' => rand(1, 100) . 'px'
|
||||
'width' => rand(1, 100) . 'px',
|
||||
];
|
||||
}
|
||||
return json_encode($columnsizes);
|
||||
|
@ -32,7 +32,6 @@ use qbank_columnsortorder\tests\external_function_testcase;
|
||||
* @covers \qbank_columnsortorder\external\set_hidden_columns
|
||||
*/
|
||||
class set_hidden_columns_test extends external_function_testcase {
|
||||
|
||||
/**
|
||||
* @var string Fully-qualified external function class to test.
|
||||
*/
|
||||
|
@ -27,8 +27,7 @@ use renderer_base;
|
||||
* @author Mark Johnson <mark.johnson@catalyst-eu.net>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class add_new_question implements \templatable, \renderable {
|
||||
|
||||
class add_new_question implements \renderable, \templatable {
|
||||
/** @var int $categoryid The ID of the category the quesiton will be added to. */
|
||||
protected int $categoryid;
|
||||
|
||||
@ -57,10 +56,12 @@ class add_new_question implements \templatable, \renderable {
|
||||
if ($this->canadd) {
|
||||
$this->params['category'] = $this->categoryid;
|
||||
$url = new \moodle_url('/question/bank/editquestion/addquestion.php', $this->params);
|
||||
$addquestiondisplay['buttonhtml'] = $output->single_button($url,
|
||||
get_string('createnewquestion', 'question'),
|
||||
'get');
|
||||
$addquestiondisplay['qtypeform'] = editquestion_helper::print_choose_qtype_to_add_form(array());
|
||||
$addquestiondisplay['buttonhtml'] = $output->single_button(
|
||||
$url,
|
||||
get_string('createnewquestion', 'question'),
|
||||
'get'
|
||||
);
|
||||
$addquestiondisplay['qtypeform'] = editquestion_helper::print_choose_qtype_to_add_form([]);
|
||||
}
|
||||
return $addquestiondisplay;
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
{"version":3,"file":"repository.min.js","sources":["../src/repository.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * External function calls for qbank_columnsortorder\n *\n * @module qbank_viewquestiontext/repository\n * @copyright 2023 Catalyst IT Europe Ltd.\n * @author Mark Johnson <mark.johnson@catalyst-eu.net>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport {call as fetchMany} from 'core/ajax';\n\n/**\n * Set the question text format.\n *\n * @param {Number} format The question text format.\n * @return {Promise}\n */\nexport const setQuestionTextFormat = (format) => {\n const responses = fetchMany([{\n methodname: 'qbank_viewquestiontext_set_question_text_format',\n args: {\n format\n },\n }]);\n return responses[0];\n};\n"],"names":["format","methodname","args"],"mappings":"0NAgCsCA,SAChB,cAAU,CAAC,CACzBC,WAAY,kDACZC,KAAM,CACFF,OAAAA,WAGS"}
|
||||
{"version":3,"file":"repository.min.js","sources":["../src/repository.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * External function calls for qbank_columnsortorder\n *\n * @module qbank_viewquestiontext/repository\n * @copyright 2023 Catalyst IT Europe Ltd.\n * @author Mark Johnson <mark.johnson@catalyst-eu.net>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport {call as fetchMany} from 'core/ajax';\n\n/**\n * Set the question text format.\n *\n * @param {Number} format The question text format.\n * @return {Promise}\n */\nexport const setQuestionTextFormat = (format) => fetchMany([{\n methodname: 'qbank_viewquestiontext_set_question_text_format',\n args: {\n format,\n },\n}])[0];\n"],"names":["format","methodname","args"],"mappings":"0NAgCsCA,SAAW,cAAU,CAAC,CACxDC,WAAY,kDACZC,KAAM,CACFF,OAAAA,WAEJ"}
|
@ -30,12 +30,9 @@ import {call as fetchMany} from 'core/ajax';
|
||||
* @param {Number} format The question text format.
|
||||
* @return {Promise}
|
||||
*/
|
||||
export const setQuestionTextFormat = (format) => {
|
||||
const responses = fetchMany([{
|
||||
methodname: 'qbank_viewquestiontext_set_question_text_format',
|
||||
args: {
|
||||
format
|
||||
},
|
||||
}]);
|
||||
return responses[0];
|
||||
};
|
||||
export const setQuestionTextFormat = (format) => fetchMany([{
|
||||
methodname: 'qbank_viewquestiontext_set_question_text_format',
|
||||
args: {
|
||||
format,
|
||||
},
|
||||
}])[0];
|
||||
|
@ -60,11 +60,12 @@ class set_question_text_format extends external_api {
|
||||
public static function execute(int $format): void {
|
||||
[
|
||||
'format' => $format,
|
||||
]
|
||||
= self::validate_parameters(self::execute_parameters(),
|
||||
[
|
||||
'format' => $format,
|
||||
]);
|
||||
] = self::validate_parameters(
|
||||
self::execute_parameters(),
|
||||
[
|
||||
'format' => $format,
|
||||
]
|
||||
);
|
||||
|
||||
if (!in_array($format, [question_text_format::OFF, question_text_format::PLAIN, question_text_format::FULL])) {
|
||||
throw new \invalid_parameter_exception('$format must be one of question_text_format::OFF, ::PLAIN or ::FULL.');
|
||||
|
@ -28,8 +28,7 @@ use renderer_base;
|
||||
* @author Mark Johnson <mark.johnson@catalyst-eu.net>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class question_text_format implements \templatable, \renderable {
|
||||
|
||||
class question_text_format implements \renderable, \templatable {
|
||||
/**
|
||||
* @var int Question text is off.
|
||||
*/
|
||||
|
@ -37,7 +37,7 @@ require_sesskey();
|
||||
$validformats = [
|
||||
\qbank_viewquestiontext\output\question_text_format::OFF,
|
||||
\qbank_viewquestiontext\output\question_text_format::PLAIN,
|
||||
\qbank_viewquestiontext\output\question_text_format::FULL
|
||||
\qbank_viewquestiontext\output\question_text_format::FULL,
|
||||
];
|
||||
if (!in_array($format, $validformats)) {
|
||||
throw new \invalid_parameter_exception('$format must be one of question_text_format::OFF, ::PLAIN or ::FULL.');
|
||||
|
@ -27,7 +27,6 @@ namespace core_question\local\bank;
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class column_manager_base {
|
||||
|
||||
/**
|
||||
* Sort the list of columns
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user