Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 1441
Línea 27... Línea 27...
27
 
27
 
Línea 28... Línea 28...
28
use qbank_editquestion\editquestion_helper;
28
use qbank_editquestion\editquestion_helper;
29
 
29
 
30
// Read URL parameters.
30
// Read URL parameters.
31
$categoryid = required_param('category', PARAM_INT);
-
 
32
$cmid = optional_param('cmid', 0, PARAM_INT);
31
$categoryid = required_param('category', PARAM_INT);
33
$courseid = optional_param('courseid', 0, PARAM_INT);
32
$cmid = required_param('cmid', PARAM_INT);
34
$returnurl = optional_param('returnurl', 0, PARAM_LOCALURL);
33
$returnurl = optional_param('returnurl', 0, PARAM_LOCALURL);
Línea 35... Línea 34...
35
$appendqnumstring = optional_param('appendqnumstring', '', PARAM_ALPHA);
34
$appendqnumstring = optional_param('appendqnumstring', '', PARAM_ALPHA);
Línea 43... Línea 42...
43
// Validate params.
42
// Validate params.
44
if (!$category = $DB->get_record('question_categories', array('id' => $categoryid))) {
43
if (!$category = $DB->get_record('question_categories', array('id' => $categoryid))) {
45
    throw new moodle_exception('categorydoesnotexist', 'question', $returnurl);
44
    throw new moodle_exception('categorydoesnotexist', 'question', $returnurl);
46
}
45
}
Línea 47... Línea -...
47
 
-
 
48
if ($cmid) {
46
 
49
    list($module, $cm) = get_module_from_cmid($cmid);
47
list($module, $cm) = get_module_from_cmid($cmid);
50
    require_login($cm->course, false, $cm);
48
require_login($cm->course, false, $cm);
51
    $thiscontext = context_module::instance($cmid);
49
$thiscontext = context_module::instance($cmid);
52
    $hiddenparams['cmid'] = $cmid;
-
 
53
} else if ($courseid) {
-
 
54
    require_login($courseid, false);
-
 
55
    $thiscontext = context_course::instance($courseid);
-
 
56
    $module = null;
-
 
57
    $cm = null;
-
 
58
    $hiddenparams['courseid'] = $courseid;
-
 
59
} else {
-
 
60
    throw new moodle_exception('missingcourseorcmid', 'question');
-
 
Línea 61... Línea 50...
61
}
50
$hiddenparams['cmid'] = $cmid;
62
 
51
 
63
// Check permissions.
52
// Check permissions.
Línea 71... Línea 60...
71
if (!empty($appendqnumstring)) {
60
if (!empty($appendqnumstring)) {
72
    $hiddenparams['appendqnumstring'] = $appendqnumstring;
61
    $hiddenparams['appendqnumstring'] = $appendqnumstring;
73
}
62
}
Línea 74... Línea 63...
74
 
63
 
75
$PAGE->set_url('/question/bank/editquestion/addquestion.php', $hiddenparams);
-
 
76
if ($cmid) {
-
 
77
    $questionbankurl = new moodle_url('/question/edit.php', array('cmid' => $cmid));
64
$PAGE->set_url('/question/bank/editquestion/addquestion.php', $hiddenparams);
78
} else {
65
 
79
    $questionbankurl = new moodle_url('/question/edit.php', array('courseid' => $courseid));
66
$questionbankurl = new moodle_url('/question/edit.php', ['cmid' => $cmid]);
80
}
67
 
Línea 81... Línea 68...
81
navigation_node::override_active_url($questionbankurl);
68
navigation_node::override_active_url($questionbankurl);
82
 
69
 
83
$chooseqtype = get_string('chooseqtypetoadd', 'question');
70
$chooseqtype = get_string('chooseqtypetoadd', 'question');