iassign_updated.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. /**
  3. * The mod_iassign updated event.
  4. *
  5. * @author Patricia Alves Rodrigues
  6. * @author Leônidas O. Brandão
  7. * @version v 1.0 2015/07/12
  8. * @package mod_iassign
  9. * @since 2015/07/12
  10. * @copyright iMatica (<a href="http://www.matematica.br">iMath</a>) - Computer Science Dep. of IME-USP (Brazil)
  11. * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  12. */
  13. namespace mod_iassign\event;
  14. defined('MOODLE_INTERNAL') || die();
  15. class iassign_updated extends \core\event\base {
  16. /// Init method.
  17. protected function init () {
  18. $this->data['crud'] = 'u'; // c(reate), r(ead), u(pdate), d(elete)
  19. $this->data['edulevel'] = self::LEVEL_TEACHING; // LEVEL_TEACHING , LEVEL_PARTICIPATING, LEVEL_OTHER
  20. $this->data['objecttable'] = 'iassign';
  21. }
  22. /// Returns localised general event name.
  23. // @return string
  24. public static function get_name () {
  25. return get_string('eventiassignupdated', 'mod_iassign');
  26. }
  27. /// Returns non-localised event description with id's for admin use only.
  28. // @return string
  29. public function get_description () {
  30. return "The user with id '$this->userid' has updated the iAssign with id '$this->objectid' in " .
  31. "the iAssign activity with course module id '$this->contextinstanceid'.";
  32. }
  33. /// Get URL related to the action.
  34. // @return \moodle_url
  35. public function get_url () {
  36. return new \moodle_url('/mod/iassign/view.php', array('id' => $this->contextinstanceid));
  37. }
  38. /// Return the legacy event log data.
  39. // @return array|null
  40. public function get_legacy_logdata () {
  41. return array($this->courseid, 'iassign', 'update',
  42. "view.php?id={$this->contextinstanceid}", $this->objectid, $this->contextinstanceid);
  43. }
  44. /// Custom validation.
  45. // @throws \coding_exception
  46. // @return void
  47. protected function validate_data () {
  48. parent::validate_data();
  49. // Make sure this class is never used without proper object details.
  50. if (!$this->contextlevel === CONTEXT_MODULE) {
  51. throw new \coding_exception('Context level must be CONTEXT_MODULE.');
  52. }
  53. }
  54. }