| Línea 44... |
Línea 44... |
| 44 |
$editingcontext = $args['context'];
|
44 |
$editingcontext = $args['context'];
|
| Línea 45... |
Línea 45... |
| 45 |
|
45 |
|
| 46 |
// Load the question and some related information.
|
46 |
// Load the question and some related information.
|
| Línea 47... |
Línea -... |
| 47 |
$question = $DB->get_record('question', ['id' => $id]);
|
- |
|
| 48 |
|
- |
|
| 49 |
if ($coursecontext = $editingcontext->get_course_context(false)) {
|
- |
|
| 50 |
$course = $DB->get_record('course', ['id' => $coursecontext->instanceid]);
|
- |
|
| 51 |
$filtercourses = [$course];
|
- |
|
| 52 |
} else {
|
- |
|
| 53 |
$filtercourses = null;
|
- |
|
| 54 |
}
|
47 |
$question = $DB->get_record('question', ['id' => $id]);
|
| 55 |
|
48 |
|
| 56 |
$sql = "SELECT qc.*
|
49 |
$sql = "SELECT qc.*
|
| 57 |
FROM {question} q
|
50 |
FROM {question} q
|
| 58 |
JOIN {question_versions} qv ON qv.questionid = q.id
|
51 |
JOIN {question_versions} qv ON qv.questionid = q.id
|
| Línea 66... |
Línea 59... |
| 66 |
// Load the question tags and filter the course tags by the current course.
|
59 |
// Load the question tags and filter the course tags by the current course.
|
| 67 |
if (core_tag_tag::is_enabled('core_question', 'question')) {
|
60 |
if (core_tag_tag::is_enabled('core_question', 'question')) {
|
| 68 |
$tagobjectsbyquestion = core_tag_tag::get_items_tags('core_question', 'question', [$question->id]);
|
61 |
$tagobjectsbyquestion = core_tag_tag::get_items_tags('core_question', 'question', [$question->id]);
|
| 69 |
if (!empty($tagobjectsbyquestion[$question->id])) {
|
62 |
if (!empty($tagobjectsbyquestion[$question->id])) {
|
| 70 |
$tagobjects = $tagobjectsbyquestion[$question->id];
|
63 |
$tagobjects = $tagobjectsbyquestion[$question->id];
|
| 71 |
$sortedtagobjects = question_sort_tags($tagobjects,
|
64 |
$sortedtagobjects = question_sort_tags($tagobjects, context::instance_by_id($category->contextid));
|
| 72 |
context::instance_by_id($category->contextid), $filtercourses);
|
- |
|
| 73 |
}
|
65 |
}
|
| 74 |
}
|
66 |
}
|
| 75 |
$formoptions = [
|
67 |
$formoptions = [
|
| 76 |
'editingcontext' => $editingcontext,
|
68 |
'editingcontext' => $editingcontext,
|
| 77 |
'questioncontext' => $questioncontext,
|
69 |
'questioncontext' => $questioncontext,
|