Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 1441
Línea 14... Línea 14...
14
// You should have received a copy of the GNU General Public License
14
// You should have received a copy of the GNU General Public License
15
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
15
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
Línea 16... Línea 16...
16
 
16
 
Línea -... Línea 17...
-
 
17
namespace qbank_bulkmove;
-
 
18
 
17
namespace qbank_bulkmove;
19
use moodle_exception;
18
 
20
 
19
/**
21
/**
20
 * Class bulk_move_action is the base class for moving questions.
22
 * Class bulk_move_action is the base class for moving questions.
21
 *
23
 *
Línea 42... Línea 44...
42
        return [
44
        return [
43
            'moodle/question:moveall',
45
            'moodle/question:moveall',
44
            'moodle/question:add',
46
            'moodle/question:add',
45
        ];
47
        ];
46
    }
48
    }
-
 
49
 
-
 
50
    /**
-
 
51
     * Initialise the modal js with the current bank context id and question category id.
-
 
52
     * @return void
-
 
53
     */
-
 
54
    public function initialise_javascript(): void {
-
 
55
        global $PAGE;
-
 
56
 
-
 
57
        $category = $this->qbank->get_pagevars('cat');
-
 
58
 
-
 
59
        if (!empty($category)) {
-
 
60
            [$categoryid, $contextid] = explode(',', $category);
-
 
61
        } else {
-
 
62
            $defaultcategory = question_get_default_category($this->qbank->cm->context->id, true);
-
 
63
            $categoryid = $defaultcategory->id;
-
 
64
            $contextid = $defaultcategory->contextid;
-
 
65
        }
-
 
66
 
-
 
67
        $PAGE->requires->js_call_amd(
-
 
68
            'qbank_bulkmove/modal_question_bank_bulkmove',
-
 
69
            'init',
-
 
70
            [
-
 
71
                'contextid' => $contextid,
-
 
72
                'categoryid' => $categoryid,
-
 
73
            ]
-
 
74
        );
-
 
75
    }
47
}
76
}