2 * The question bank popup to show question bank ccontents for mod_quiz.
5 * @moodle-mod_quiz-questionbank
9 PAGECONTENT : 'div#page-content',
10 SELECTALL : '', // TODO:
11 DESELECTALL : '', // TODO:
12 HEADERCHECKBOX : '', // TODO:
13 FIRSTCHECKBOX : '' // TODO:
16 var QUESTIONBANK = 'question-questionbank';
24 // Button variables for question bank.
25 var createanewquestionbutton = Y.one('#buttonid'); // TODO: Findout the real id
26 var addtoquizbutton = Y.one('#addtoquiziid'); // TODO: find the new id
27 var deletbutton = Y.one('#deletebuttonid'); // TODO: find the real id
28 var movetobutton = Y.one('#movetiid'); // TODO: find the new id
29 var addrandomquestionstoquizbutton = Y.one('#movetiid'); // TODO: find the new id
31 addtoquizbutton.on('click', function(e)) {
32 // Add the selected questions to the quiz.
36 createanewquestionbutton.on('click', function(e)) {
37 // Call Create a new question popup window.
41 deletbutton.on('click', function(e)) {
42 // Delete selected questions.
46 movetobutton.on('click', function(e)) {
47 // Move selected question to the chosen category..
51 init_checkbox_column: function(Y, strselectall, strdeselectall, firstcbid) {
52 question_bank.strselectall = strselectall;
53 question_bank.strdeselectall = strdeselectall;
55 // Find the header checkbox, and initialise it.
56 question_bank.headercheckbox = document.getElementById('qbheadercheckbox');
57 question_bank.headercheckbox.disabled = false;
58 question_bank.headercheckbox.title = strselectall;
60 // Find the first real checkbox.
61 question_bank.firstcheckbox = document.getElementById(firstcbid);
63 // Add the event handler.
64 Y.YUI2.util.Event.addListener(question_bank.headercheckbox, 'click', question_bank.header_checkbox_click);
67 header_checkbox_click: function() {
68 if (question_bank.firstcheckbox.checked) {
69 select_all_in_element_with_id('categoryquestions', '');
70 question_bank.headercheckbox.title = question_bank.strselectall;
72 select_all_in_element_with_id('categoryquestions', 'checked');
73 question_bank.headercheckbox.title = question_bank.strdeselectall;
75 question_bank.headercheckbox.checked = false;
81 * The activity chooser dialogue for courses.
84 * @class M.mod_quiz.questionbank
85 * @extends M.core.chooserdialogue
87 var QUESTIONBANK = function() {
88 QUESTIONBANK.superclass.constructor.apply(this, arguments);
100 M.question = M.question || {};
101 M.question.init_qbank = function(config) {
102 return new QUESTIONBANK(config);