mirror of
https://github.com/moodle/moodle.git
synced 2025-01-31 20:53:53 +01:00
Activity module handler get_moduleid() replaced with get_cminfo()
This commit is contained in:
parent
6357693c8b
commit
8bcefb3254
@ -1094,18 +1094,30 @@ abstract class moodle1_plugin_handler extends moodle1_xml_handler {
|
||||
abstract class moodle1_mod_handler extends moodle1_plugin_handler {
|
||||
|
||||
/**
|
||||
* Returns course module id for the given instance id
|
||||
* Returns the name of the module, eg. 'forum'
|
||||
*
|
||||
* The mapping from instance id to course module id has been stashed by
|
||||
* @return string
|
||||
*/
|
||||
public function get_modname() {
|
||||
return $this->pluginname;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns course module information for the given instance id
|
||||
*
|
||||
* The information for this instance id has been stashed by
|
||||
* {@link moodle1_course_outline_handler::process_course_module()}
|
||||
*
|
||||
* @param int $instance the module instance id
|
||||
* @param string $modname the module type, defaults to $this->pluginname
|
||||
* @return int
|
||||
*/
|
||||
protected function get_moduleid($instance) {
|
||||
protected function get_cminfo($instance, $modname = null) {
|
||||
|
||||
$stashed = $this->converter->get_stash('cminfo_'.$this->pluginname, $instance);
|
||||
return $stashed['id'];
|
||||
if (is_null($modname)) {
|
||||
$modname = $this->pluginname;
|
||||
}
|
||||
return $this->converter->get_stash('cminfo_'.$modname, $instance);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -68,7 +68,8 @@ class moodle1_mod_assignment_handler extends moodle1_mod_handler {
|
||||
public function process_assignment($data) {
|
||||
// get the course module id and context id
|
||||
$instanceid = $data['id'];
|
||||
$moduleid = $this->get_moduleid($instanceid);
|
||||
$cminfo = $this->get_cminfo($instanceid);
|
||||
$moduleid = $cminfo['id'];
|
||||
$contextid = $this->converter->get_contextid(CONTEXT_MODULE, $moduleid);
|
||||
|
||||
// we now have all information needed to start writing into the file
|
||||
|
@ -73,7 +73,8 @@ class moodle1_mod_choice_handler extends moodle1_mod_handler {
|
||||
|
||||
// get the course module id and context id
|
||||
$instanceid = $data['id'];
|
||||
$moduleid = $this->get_moduleid($instanceid);
|
||||
$cminfo = $this->get_cminfo($instanceid);
|
||||
$moduleid = $cminfo['id'];
|
||||
$contextid = $this->converter->get_contextid(CONTEXT_MODULE, $moduleid);
|
||||
|
||||
// we now have all information needed to start writing into the file
|
||||
|
@ -69,7 +69,8 @@ class moodle1_mod_forum_handler extends moodle1_mod_handler {
|
||||
public function process_forum($data) {
|
||||
// get the course module id and context id
|
||||
$instanceid = $data['id'];
|
||||
$moduleid = $this->get_moduleid($instanceid);
|
||||
$cminfo = $this->get_cminfo($instanceid);
|
||||
$moduleid = $cminfo['id'];
|
||||
$contextid = $this->converter->get_contextid(CONTEXT_MODULE, $moduleid);
|
||||
|
||||
// we now have all information needed to start writing into the file
|
||||
|
Loading…
x
Reference in New Issue
Block a user