mirror of
https://github.com/moodle/moodle.git
synced 2025-04-19 07:25:30 +02:00
Merge branch 'MDL-65994-master' of git://github.com/junpataleta/moodle
This commit is contained in:
commit
8b9c0616b3
@ -1259,7 +1259,14 @@ function question_category_select_menu($contexts, $top = false, $currentcat = 0,
|
||||
$options[] = array($group => $opts);
|
||||
}
|
||||
echo html_writer::label(get_string('questioncategory', 'core_question'), 'id_movetocategory', false, array('class' => 'accesshide'));
|
||||
$attrs = array('id' => 'id_movetocategory', 'class' => 'custom-select');
|
||||
$attrs = array(
|
||||
'id' => 'id_movetocategory',
|
||||
'class' => 'custom-select',
|
||||
'data-action' => 'toggle',
|
||||
'data-togglegroup' => 'qbank',
|
||||
'data-toggle' => 'action',
|
||||
'disabled' => true,
|
||||
);
|
||||
echo html_writer::select($options, 'category', $selected, $choose, $attrs);
|
||||
}
|
||||
|
||||
|
@ -166,14 +166,15 @@ class custom_view extends \core_question\bank\view {
|
||||
|
||||
// Add selected questions to the quiz.
|
||||
$params = array(
|
||||
'type' => 'submit',
|
||||
'name' => 'add',
|
||||
'class' => 'btn btn-primary',
|
||||
'value' => get_string('addselectedquestionstoquiz', 'quiz'),
|
||||
'type' => 'submit',
|
||||
'name' => 'add',
|
||||
'class' => 'btn btn-primary',
|
||||
'value' => get_string('addselectedquestionstoquiz', 'quiz'),
|
||||
'data-action' => 'toggle',
|
||||
'data-togglegroup' => 'qbank',
|
||||
'data-toggle' => 'action',
|
||||
'disabled' => true,
|
||||
);
|
||||
if ($cmoptions->hasattempts) {
|
||||
$params['disabled'] = 'disabled';
|
||||
}
|
||||
echo \html_writer::empty_tag('input', $params);
|
||||
}
|
||||
echo "</div>\n";
|
||||
|
2
question/amd/build/qbankmanager.min.js
vendored
2
question/amd/build/qbankmanager.min.js
vendored
@ -1,2 +0,0 @@
|
||||
define ("core_question/qbankmanager",["jquery","core/pubsub","core/checkbox-toggleall"],function(a,b,c){var d=function(){b.subscribe(c.events.checkboxToggled,e)},e=function(a){if("qbank"!==a.toggleGroupName){return}f(a.anyChecked)},f=function(b){var c=a(".modulespecificbuttonscontainer").find("input, select, link");c.attr("disabled",!b)};return{init:function init(){f(!1);d()}}});
|
||||
//# sourceMappingURL=qbankmanager.min.js.map
|
@ -1 +0,0 @@
|
||||
{"version":3,"sources":["../src/qbankmanager.js"],"names":["define","$","PubSub","ToggleAll","registerListeners","subscribe","events","checkboxToggled","toggleButtonStates","data","toggleGroupName","setButtonState","anyChecked","state","buttons","find","attr","init"],"mappings":"AAwBAA,OAAM,8BAAC,CAAC,QAAD,CAAW,aAAX,CAA0B,yBAA1B,CAAD,CAAuD,SAASC,CAAT,CAAYC,CAAZ,CAAoBC,CAApB,CAA+B,IAEpFC,CAAAA,CAAiB,CAAG,UAAW,CAC/BF,CAAM,CAACG,SAAP,CAAiBF,CAAS,CAACG,MAAV,CAAiBC,eAAlC,CAAmDC,CAAnD,CACH,CAJuF,CAMpFA,CAAkB,CAAG,SAASC,CAAT,CAAe,CACpC,GAAI,UAAYA,CAAI,CAACC,eAArB,CAAsC,CAClC,MACH,CAEDC,CAAc,CAACF,CAAI,CAACG,UAAN,CACjB,CAZuF,CAcpFD,CAAc,CAAG,SAASE,CAAT,CAAgB,CACjC,GAAIC,CAAAA,CAAO,CAAGb,CAAC,CAAC,iCAAD,CAAD,CAAqCc,IAArC,CAA0C,qBAA1C,CAAd,CACAD,CAAO,CAACE,IAAR,CAAa,UAAb,CAAyB,CAACH,CAA1B,CACH,CAjBuF,CAmBxF,MAAO,CAMHI,IAAI,CAAE,eAAW,CACbN,CAAc,IAAd,CACAP,CAAiB,EACpB,CATE,CAWV,CA9BK,CAAN","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 * A javascript module to handle question ajax actions.\n *\n * @module core_question/qbankmanager\n * @class qbankmanager\n * @package core_question\n * @copyright 2018 The Open University\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine(['jquery', 'core/pubsub', 'core/checkbox-toggleall'], function($, PubSub, ToggleAll) {\n\n var registerListeners = function() {\n PubSub.subscribe(ToggleAll.events.checkboxToggled, toggleButtonStates);\n };\n\n var toggleButtonStates = function(data) {\n if ('qbank' !== data.toggleGroupName) {\n return;\n }\n\n setButtonState(data.anyChecked);\n };\n\n var setButtonState = function(state) {\n var buttons = $('.modulespecificbuttonscontainer').find('input, select, link');\n buttons.attr('disabled', !state);\n };\n\n return {\n /**\n * Set up the Question Bank Manager.\n *\n * @method init\n */\n init: function() {\n setButtonState(false);\n registerListeners();\n },\n };\n});\n"],"file":"qbankmanager.min.js"}
|
@ -1,55 +0,0 @@
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* A javascript module to handle question ajax actions.
|
||||
*
|
||||
* @module core_question/qbankmanager
|
||||
* @class qbankmanager
|
||||
* @package core_question
|
||||
* @copyright 2018 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
define(['jquery', 'core/pubsub', 'core/checkbox-toggleall'], function($, PubSub, ToggleAll) {
|
||||
|
||||
var registerListeners = function() {
|
||||
PubSub.subscribe(ToggleAll.events.checkboxToggled, toggleButtonStates);
|
||||
};
|
||||
|
||||
var toggleButtonStates = function(data) {
|
||||
if ('qbank' !== data.toggleGroupName) {
|
||||
return;
|
||||
}
|
||||
|
||||
setButtonState(data.anyChecked);
|
||||
};
|
||||
|
||||
var setButtonState = function(state) {
|
||||
var buttons = $('.modulespecificbuttonscontainer').find('input, select, link');
|
||||
buttons.attr('disabled', !state);
|
||||
};
|
||||
|
||||
return {
|
||||
/**
|
||||
* Set up the Question Bank Manager.
|
||||
*
|
||||
* @method init
|
||||
*/
|
||||
init: function() {
|
||||
setButtonState(false);
|
||||
registerListeners();
|
||||
},
|
||||
};
|
||||
});
|
@ -16,6 +16,8 @@
|
||||
|
||||
namespace core_question\bank;
|
||||
|
||||
use core\output\checkbox_toggleall;
|
||||
|
||||
/**
|
||||
* A column with a checkbox for each question with name q{questionid}.
|
||||
*
|
||||
@ -23,37 +25,23 @@ namespace core_question\bank;
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class checkbox_column extends column_base {
|
||||
protected $strselect;
|
||||
|
||||
public function init() {
|
||||
global $PAGE;
|
||||
|
||||
$PAGE->requires->js_call_amd('core/checkbox-toggleall', 'init');
|
||||
}
|
||||
|
||||
public function get_name() {
|
||||
return 'checkbox';
|
||||
}
|
||||
|
||||
protected function get_title() {
|
||||
$input = \html_writer::empty_tag('input', [
|
||||
global $OUTPUT;
|
||||
|
||||
$mastercheckbox = new checkbox_toggleall('qbank', true, [
|
||||
'id' => 'qbheadercheckbox',
|
||||
'name' => 'qbheadercheckbox',
|
||||
'type' => 'checkbox',
|
||||
'value' => '1',
|
||||
'data-action' => 'toggle',
|
||||
'data-toggle' => 'master',
|
||||
'data-togglegroup' => 'qbank',
|
||||
'data-toggle-selectall' => get_string('selectall', 'moodle'),
|
||||
'data-toggle-deselectall' => get_string('deselectall', 'moodle'),
|
||||
'label' => get_string('selectall'),
|
||||
'labelclasses' => 'accesshide',
|
||||
]);
|
||||
|
||||
$label = \html_writer::tag('label', get_string('selectall', 'moodle'), [
|
||||
'class' => 'accesshide',
|
||||
'for' => 'qbheadercheckbox',
|
||||
]);
|
||||
|
||||
return $input . $label;
|
||||
return $OUTPUT->render($mastercheckbox);
|
||||
}
|
||||
|
||||
protected function get_title_tip() {
|
||||
@ -61,16 +49,17 @@ class checkbox_column extends column_base {
|
||||
}
|
||||
|
||||
protected function display_content($question, $rowclasses) {
|
||||
echo \html_writer::empty_tag('input', [
|
||||
'title' => get_string('select'),
|
||||
'type' => 'checkbox',
|
||||
'name' => "q{$question->id}",
|
||||
global $OUTPUT;
|
||||
|
||||
$checkbox = new checkbox_toggleall('qbank', false, [
|
||||
'id' => "checkq{$question->id}",
|
||||
'name' => "q{$question->id}",
|
||||
'value' => '1',
|
||||
'data-action' => 'toggle',
|
||||
'data-toggle' => 'slave',
|
||||
'data-togglegroup' => 'qbank',
|
||||
'label' => get_string('select'),
|
||||
'labelclasses' => 'accesshide',
|
||||
]);
|
||||
|
||||
echo $OUTPUT->render($checkbox);
|
||||
}
|
||||
|
||||
public function get_required_fields() {
|
||||
|
@ -703,9 +703,6 @@ class view {
|
||||
|
||||
$category = $this->get_current_category($categoryandcontext);
|
||||
|
||||
$strselectall = get_string('selectall');
|
||||
$strselectnone = get_string('deselectall');
|
||||
|
||||
list($categoryid, $contextid) = explode(',', $categoryandcontext);
|
||||
$catcontext = \context::instance_by_id($contextid);
|
||||
|
||||
@ -764,8 +761,6 @@ class view {
|
||||
}
|
||||
echo '</div>';
|
||||
|
||||
$PAGE->requires->js_call_amd('core_question/qbankmanager', 'init');
|
||||
|
||||
$this->display_bottom_controls($totalnumber, $recurse, $category, $catcontext, $addcontexts);
|
||||
|
||||
echo '</fieldset>';
|
||||
@ -791,11 +786,29 @@ class view {
|
||||
|
||||
// Print delete and move selected question.
|
||||
if ($caneditall) {
|
||||
echo '<input type="submit" class="btn btn-secondary" name="deleteselected" value="' . get_string('delete') . "\" />\n";
|
||||
echo \html_writer::empty_tag('input', [
|
||||
'type' => 'submit',
|
||||
'class' => 'btn btn-secondary mr-1',
|
||||
'name' => 'deleteselected',
|
||||
'value' => get_string('delete'),
|
||||
'data-action' => 'toggle',
|
||||
'data-togglegroup' => 'qbank',
|
||||
'data-toggle' => 'action',
|
||||
'disabled' => true,
|
||||
]);
|
||||
}
|
||||
|
||||
if ($canmoveall && count($addcontexts)) {
|
||||
echo '<input type="submit" class="btn btn-secondary" name="move" value="' . get_string('moveto', 'question') . "\" />\n";
|
||||
echo \html_writer::empty_tag('input', [
|
||||
'type' => 'submit',
|
||||
'class' => 'btn btn-secondary mr-1',
|
||||
'name' => 'move',
|
||||
'value' => get_string('moveto', 'question'),
|
||||
'data-action' => 'toggle',
|
||||
'data-togglegroup' => 'qbank',
|
||||
'data-toggle' => 'action',
|
||||
'disabled' => true,
|
||||
]);
|
||||
question_category_select_menu($addcontexts, false, 0, "{$category->id},{$category->contextid}");
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user