Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Differences Between: [Versions 401 and 402] [Versions 401 and 403]

   1  <?php
   2  // This file is part of Moodle - http://moodle.org/
   3  //
   4  // Moodle is free software: you can redistribute it and/or modify
   5  // it under the terms of the GNU General Public License as published by
   6  // the Free Software Foundation, either version 3 of the License, or
   7  // (at your option) any later version.
   8  //
   9  // Moodle is distributed in the hope that it will be useful,
  10  // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12  // GNU General Public License for more details.
  13  //
  14  // You should have received a copy of the GNU General Public License
  15  // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
  16  
  17  /**
  18   * The assignsubmission_onlinetext assessable uploaded event.
  19   *
  20   * @package    assignsubmission_onlinetext
  21   * @copyright  2013 Frédéric Massart
  22   * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  23   */
  24  
  25  namespace assignsubmission_onlinetext\event;
  26  
  27  defined('MOODLE_INTERNAL') || die();
  28  
  29  /**
  30   * The assignsubmission_onlinetext assessable uploaded event class.
  31   *
  32   * @property-read array $other {
  33   *      Extra information about event.
  34   *
  35   *      - string format: (optional) content format.
  36   * }
  37   *
  38   * @package    assignsubmission_onlinetext
  39   * @since      Moodle 2.6
  40   * @copyright  2013 Frédéric Massart
  41   * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  42   */
  43  class assessable_uploaded extends \core\event\assessable_uploaded {
  44  
  45      /**
  46       * Returns description of what happened.
  47       *
  48       * @return string
  49       */
  50      public function get_description() {
  51          return "The user with id '$this->userid' has saved an online text submission with id '$this->objectid' " .
  52              "in the assignment activity with course module id '$this->contextinstanceid'.";
  53      }
  54  
  55      /**
  56       * Legacy event data if get_legacy_eventname() is not empty.
  57       *
  58       * @return stdClass
  59       */
  60      protected function get_legacy_eventdata() {
  61          $eventdata = new \stdClass();
  62          $eventdata->modulename = 'assign';
  63          $eventdata->cmid = $this->contextinstanceid;
  64          $eventdata->itemid = $this->objectid;
  65          $eventdata->courseid = $this->courseid;
  66          $eventdata->userid = $this->userid;
  67          $eventdata->content = $this->other['content'];
  68          if ($this->other['pathnamehashes']) {
  69              $eventdata->pathnamehashes = $this->other['pathnamehashes'];
  70          }
  71          return $eventdata;
  72      }
  73  
  74      /**
  75       * Return the legacy event name.
  76       *
  77       * @return string
  78       */
  79      public static function get_legacy_eventname() {
  80          return 'assessable_content_uploaded';
  81      }
  82  
  83      /**
  84       * Return localised event name.
  85       *
  86       * @return string
  87       */
  88      public static function get_name() {
  89          return get_string('eventassessableuploaded', 'assignsubmission_onlinetext');
  90      }
  91  
  92      /**
  93       * Get URL related to the action.
  94       *
  95       * @return \moodle_url
  96       */
  97      public function get_url() {
  98          return new \moodle_url('/mod/assign/view.php', array('id' => $this->contextinstanceid));
  99      }
 100  
 101      /**
 102       * Init method.
 103       *
 104       * @return void
 105       */
 106      protected function init() {
 107          parent::init();
 108          $this->data['objecttable'] = 'assign_submission';
 109      }
 110  
 111      public static function get_objectid_mapping() {
 112          return array('db' => 'assign_submission', 'restore' => 'submission');
 113      }
 114  }