mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 14:27:22 +01:00
Merge branch 'w17_MDL-45080_m27_questioncreate' of https://github.com/skodak/moodle
This commit is contained in:
commit
1bdedfb880
@ -46,7 +46,7 @@ defined('MOODLE_INTERNAL') || die();
|
|||||||
* @property-read int $contextlevel
|
* @property-read int $contextlevel
|
||||||
* @property-read int $contextinstanceid
|
* @property-read int $contextinstanceid
|
||||||
* @property-read int $userid who did this?
|
* @property-read int $userid who did this?
|
||||||
* @property-read int $courseid
|
* @property-read int $courseid the courseid of the event context, 0 for contexts above course
|
||||||
* @property-read int $relateduserid
|
* @property-read int $relateduserid
|
||||||
* @property-read int $anonymous 1 means event should not be visible in reports, 0 means normal event,
|
* @property-read int $anonymous 1 means event should not be visible in reports, 0 means normal event,
|
||||||
* create() argument may be also true/false.
|
* create() argument may be also true/false.
|
||||||
|
@ -61,20 +61,31 @@ class question_category_created extends base {
|
|||||||
* @return \moodle_url
|
* @return \moodle_url
|
||||||
*/
|
*/
|
||||||
public function get_url() {
|
public function get_url() {
|
||||||
if ($this->contextlevel == CONTEXT_MODULE) {
|
if ($this->courseid) {
|
||||||
return new \moodle_url('/question/category.php', array('cmid' => $this->contextinstanceid));
|
$cat = $this->objectid . ',' . $this->contextid;
|
||||||
} else {
|
if ($this->contextlevel == CONTEXT_MODULE) {
|
||||||
return new \moodle_url('/question/category.php', array('courseid' => $this->courseid));
|
return new \moodle_url('/question/edit.php', array('cmid' => $this->contextinstanceid, 'cat' => $cat));
|
||||||
|
}
|
||||||
|
return new \moodle_url('/question/edit.php', array('courseid' => $this->courseid, 'cat' => $cat));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Bad luck, there does not seem to be any simple intelligent way
|
||||||
|
// to go to specific question category in context above course,
|
||||||
|
// let's try to edit it from frontpage which may surprisingly work.
|
||||||
|
return new \moodle_url('/question/category.php', array('courseid' => SITEID, 'edit' => $this->objectid));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the legacy event log data.
|
* Return the legacy event log data.
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array|null
|
||||||
*/
|
*/
|
||||||
protected function get_legacy_logdata() {
|
protected function get_legacy_logdata() {
|
||||||
return array($this->courseid, 'quiz', 'addcategory', 'view.php?id=' . $this->contextinstanceid,
|
if ($this->contextlevel == CONTEXT_MODULE) {
|
||||||
$this->objectid, $this->contextinstanceid);
|
return array($this->courseid, 'quiz', 'addcategory', 'view.php?id=' . $this->contextinstanceid,
|
||||||
|
$this->objectid, $this->contextinstanceid);
|
||||||
|
}
|
||||||
|
// This is not related to individual quiz at all.
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user