Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 1441
Línea 31... Línea 31...
31
     *
31
     *
32
     * @param string $movequestionselected comma separated string of questions to be moved.
32
     * @param string $movequestionselected comma separated string of questions to be moved.
33
     * @param \stdClass $tocategory the category where the questions will be moved to.
33
     * @param \stdClass $tocategory the category where the questions will be moved to.
34
     */
34
     */
35
    public static function bulk_move_questions(string $movequestionselected, \stdClass $tocategory): void {
35
    public static function bulk_move_questions(string $movequestionselected, \stdClass $tocategory): void {
36
        global $DB;
36
        global $DB, $CFG;
-
 
37
        require_once($CFG->libdir .'/questionlib.php');
37
        if ($questionids = explode(',', $movequestionselected)) {
38
        if ($questionids = explode(',', $movequestionselected)) {
38
            list($usql, $params) = $DB->get_in_or_equal($questionids);
39
            [$usql, $params] = $DB->get_in_or_equal($questionids);
39
            $sql = "SELECT q.*, c.contextid
40
            $sql = "SELECT q.*, c.contextid
40
                      FROM {question} q
41
                      FROM {question} q
41
                      JOIN {question_versions} qv ON qv.questionid = q.id
42
                      JOIN {question_versions} qv ON qv.questionid = q.id
42
                      JOIN {question_bank_entries} qbe ON qbe.id = qv.questionbankentryid
43
                      JOIN {question_bank_entries} qbe ON qbe.id = qv.questionbankentryid
43
                      JOIN {question_categories} c ON c.id = qbe.questioncategoryid
44
                      JOIN {question_categories} c ON c.id = qbe.questioncategoryid
Línea 56... Línea 57...
56
     *
57
     *
57
     * @param array $addcontexts the array of contexts to be considered in order to render the category select menu.
58
     * @param array $addcontexts the array of contexts to be considered in order to render the category select menu.
58
     * @param \moodle_url $moveurl the url where the move script will point to.
59
     * @param \moodle_url $moveurl the url where the move script will point to.
59
     * @param \moodle_url $returnurl return url in case the form is cancelled.
60
     * @param \moodle_url $returnurl return url in case the form is cancelled.
60
     * @return array the data to be rendered in the mustache where it contains the dropdown, move url and return url.
61
     * @return array the data to be rendered in the mustache where it contains the dropdown, move url and return url.
-
 
62
     * @deprecated since Moodle 5.0.
-
 
63
     * @todo MDL-82413 Final deprecation in Moodle 6.0.
61
     */
64
     */
-
 
65
    #[\core\attribute\deprecated(
-
 
66
        replacement: 'replaced by a modal and webservice.
-
 
67
        See qbank_bulkmove/modal_question_bank_bulkmove and core_question_external\move_questions',
-
 
68
        since: '5.0',
-
 
69
        mdl: 'MDL-71378'
-
 
70
    )]
62
    public static function get_displaydata(array $addcontexts, \moodle_url $moveurl, \moodle_url $returnurl): array {
71
    public static function get_displaydata(array $addcontexts, \moodle_url $moveurl, \moodle_url $returnurl): array {
-
 
72
        \core\deprecation::emit_deprecation([self::class, __FUNCTION__]);
63
        $displaydata = [];
73
        $displaydata = [];
64
        $displaydata ['categorydropdown'] = \qbank_managecategories\helper::question_category_select_menu($addcontexts,
74
        $displaydata ['categorydropdown'] = \qbank_managecategories\helper::question_category_select_menu($addcontexts,
65
            false, 0, '', -1, true);
75
            false, 0, '', -1, true);
66
        $displaydata ['moveurl'] = $moveurl;
76
        $displaydata ['moveurl'] = $moveurl;
67
        $displaydata['returnurl'] = $returnurl;
77
        $displaydata['returnurl'] = $returnurl;