mirror of
https://github.com/moodle/moodle.git
synced 2025-04-14 13:02:07 +02:00
Merge branch 'MDL-56811-master' of git://github.com/damyon/moodle
This commit is contained in:
commit
3ecf492a75
@ -2337,6 +2337,7 @@ function create_course($data, $editoroptions = NULL) {
|
||||
'other' => array('shortname' => $course->shortname,
|
||||
'fullname' => $course->fullname)
|
||||
));
|
||||
|
||||
$event->trigger();
|
||||
|
||||
// Setup the blocks
|
||||
|
@ -113,4 +113,40 @@ class mod_forum_observer {
|
||||
forum_instance_created($event->get_context(), $forum);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Observer for \core\event\course_created event.
|
||||
*
|
||||
* @param \core\event\course_created $event
|
||||
* @return void
|
||||
*/
|
||||
public static function course_created(\core\event\course_created $event) {
|
||||
global $CFG;
|
||||
|
||||
$course = $event->get_record_snapshot('course', $event->objectid);
|
||||
|
||||
if (!empty($course->newsitems)) {
|
||||
require_once($CFG->dirroot . '/mod/forum/lib.php');
|
||||
// Auto create the announcements forum.
|
||||
forum_get_course_forum($event->objectid, 'news');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Observer for \core\event\course_updated event.
|
||||
*
|
||||
* @param \core\event\course_updated $event
|
||||
* @return void
|
||||
*/
|
||||
public static function course_updated(\core\event\course_updated $event) {
|
||||
global $CFG;
|
||||
|
||||
$course = $event->get_record_snapshot('course', $event->objectid);
|
||||
|
||||
if (!empty($course->newsitems)) {
|
||||
require_once($CFG->dirroot . '/mod/forum/lib.php');
|
||||
// Auto create the announcements forum.
|
||||
forum_get_course_forum($event->objectid, 'news');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -40,4 +40,14 @@ $observers = array(
|
||||
'eventname' => '\core\event\course_module_created',
|
||||
'callback' => 'mod_forum_observer::course_module_created',
|
||||
),
|
||||
|
||||
array(
|
||||
'eventname' => '\core\event\course_created',
|
||||
'callback' => 'mod_forum_observer::course_created',
|
||||
),
|
||||
|
||||
array(
|
||||
'eventname' => '\core\event\course_updated',
|
||||
'callback' => 'mod_forum_observer::course_updated',
|
||||
),
|
||||
);
|
||||
|
@ -24,6 +24,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2016091201; // The current module version (Date: YYYYMMDDXX)
|
||||
$plugin->version = 2016111000; // The current module version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2016051900; // Requires this Moodle version
|
||||
$plugin->component = 'mod_forum'; // Full name of the plugin (used for diagnostics)
|
||||
|
Loading…
x
Reference in New Issue
Block a user