Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 1441
Línea 80... Línea 80...
80
    /**
80
    /**
81
     * Return an array of area objects that contain content at the site and system levels only. This would be question content from
81
     * Return an array of area objects that contain content at the site and system levels only. This would be question content from
82
     * question categories at the system context, or course category context.
82
     * question categories at the system context, or course category context.
83
     *
83
     *
84
     * @return mixed
84
     * @return mixed
-
 
85
     * @deprecated since Moodle 5.0.
-
 
86
     * @todo MDL-82413 Final deprecation in Moodle 6.0.
85
     */
87
     */
-
 
88
    #[\core\attribute\deprecated(null, since: '5.0', reason: 'This method should not be used', mdl: 'MDL-71378')]
86
    public function find_system_areas(): ?\moodle_recordset {
89
    public function find_system_areas(): ?\moodle_recordset {
-
 
90
        \core\deprecation::emit_deprecation([self::class, __FUNCTION__]);
87
        global $DB;
91
        global $DB;
88
        $params = [
92
        $params = [
89
            'syscontext' => CONTEXT_SYSTEM,
93
            'syscontext' => CONTEXT_SYSTEM,
90
            'coursecat' => CONTEXT_COURSECAT,
94
            'coursecat' => CONTEXT_COURSECAT,
91
            'coursecat2' => CONTEXT_COURSECAT,
95
            'coursecat2' => CONTEXT_COURSECAT,
Línea 130... Línea 134...
130
    public function find_course_areas(int $courseid): ?\moodle_recordset {
134
    public function find_course_areas(int $courseid): ?\moodle_recordset {
131
        global $DB;
135
        global $DB;
Línea 132... Línea 136...
132
 
136
 
133
        $coursecontext = \context_course::instance($courseid);
137
        $coursecontext = \context_course::instance($courseid);
134
        $param = [
-
 
135
            'ctxcourse' => CONTEXT_COURSE,
-
 
136
            'courseid' => $courseid,
138
        $param = [
137
            'module' => CONTEXT_MODULE,
139
            'module' => CONTEXT_MODULE,
138
            'coursecontextpath' => $DB->sql_like_escape($coursecontext->path) . '/%',
140
            'coursecontextpath' => $DB->sql_like_escape($coursecontext->path) . '/%',
Línea 139... Línea 141...
139
        ];
141
        ];
Línea 155... Línea 157...
155
                    ON qbe.id = qv.questionbankentryid
157
                    ON qbe.id = qv.questionbankentryid
156
            INNER JOIN {question_categories} qc
158
            INNER JOIN {question_categories} qc
157
                    ON qc.id = qbe.questioncategoryid
159
                    ON qc.id = qbe.questioncategoryid
158
            INNER JOIN {context} ctx
160
            INNER JOIN {context} ctx
159
                    ON ctx.id = qc.contextid
161
                    ON ctx.id = qc.contextid
160
                 WHERE (ctx.contextlevel = :ctxcourse
-
 
161
                   AND ctx.id = qc.contextid
-
 
162
                   AND ctx.instanceid = :courseid)
-
 
163
                    OR (ctx.contextlevel = :module
162
                 WHERE ctx.contextlevel = :module
164
                   AND {$DB->sql_like('ctx.path', ':coursecontextpath')})
163
                   AND {$DB->sql_like('ctx.path', ':coursecontextpath')}
165
              ORDER BY a.id ASC";
164
              ORDER BY a.id ASC";
Línea 166... Línea 165...
166
 
165
 
167
        return $DB->get_recordset_sql($sql, $param);
166
        return $DB->get_recordset_sql($sql, $param);
168
    }
167
    }