Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 1441
Línea 23... Línea 23...
23
 */
23
 */
Línea 24... Línea 24...
24
 
24
 
25
 
25
 
26
require_once(__DIR__ . '/../../../config.php');
-
 
27
require_once($CFG->dirroot . '/question/editlib.php');
26
require_once(__DIR__ . '/../../../config.php');
28
require_once($CFG->dirroot . '/question/bank/importquestions/classes/form/import_form.php');
27
require_once($CFG->dirroot . '/question/editlib.php');
Línea 29... Línea 28...
29
require_once($CFG->dirroot . '/question/format.php');
28
require_once($CFG->dirroot . '/question/format.php');
Línea 46... Línea 45...
46
    throw new moodle_exception('nocategory', 'question');
45
    throw new moodle_exception('nocategory', 'question');
47
}
46
}
Línea 48... Línea 47...
48
 
47
 
49
$categorycontext = context::instance_by_id($category->contextid);
48
$categorycontext = context::instance_by_id($category->contextid);
50
$category->context = $categorycontext;
49
$category->context = $categorycontext;
51
// This page can be called without courseid or cmid in which case.
50
// This page can be called without cmid in which case.
52
// We get the context from the category object.
51
// We get the context from the category object.
53
if ($contexts === null) { // Need to get the course from the chosen category.
52
if ($contexts === null) { // Need to get the course from the chosen category.
54
    $contexts = new core_question\local\bank\question_edit_contexts($categorycontext);
53
    $contexts = new core_question\local\bank\question_edit_contexts($categorycontext);
55
    $thiscontext = $contexts->lowest();
-
 
56
    if ($thiscontext->contextlevel == CONTEXT_COURSE) {
-
 
57
        require_login($thiscontext->instanceid, false);
-
 
58
    } else if ($thiscontext->contextlevel == CONTEXT_MODULE) {
54
    $thiscontext = $contexts->lowest();
59
        list($module, $cm) = get_module_from_cmid($thiscontext->instanceid);
55
    [$module, $cm] = get_module_from_cmid($thiscontext->instanceid);
60
        require_login($cm->course, false, $cm);
-
 
61
    }
56
    require_login($cm->course, false, $cm);
62
    $contexts->require_one_edit_tab_cap($edittab);
57
    $contexts->require_one_edit_tab_cap($edittab);
Línea 63... Línea 58...
63
}
58
}