original_string: protected function notify_graders(stdClass $submission) {
          global $DB, $USER;
  
          $instance = $this->get_instance();
  
          $late = $instance->duedate && ($instance->duedate < time());
  
          if (!$instance->sendnotifications && !($late && $instance->sendlatenotifications)) {
              // No need to do anything.
              return;
          }
  
          if ($submission->userid) {
              $user = $DB->get_record('user', array('id'=>$submission->userid), '*', MUST_EXIST);
          } else {
              $user = $USER;
          }
  
          if ($notifyusers = $this->get_notifiable_users($user->id)) {
              foreach ($notifyusers as $notifyuser) {
                  $this->send_notification($user,
                                           $notifyuser,
                                           'gradersubmissionupdated',
                                           'assign_notification',
                                           $submission->timemodified);
              }
          }
      }
code: protected function notify_graders(stdClass $submission) {
          global $DB, $USER;
  
          $instance = $this->get_instance();
  
          $late = $instance->duedate && ($instance->duedate < time());
  
          if (!$instance->sendnotifications && !($late && $instance->sendlatenotifications)) {
              // No need to do anything.
              return;
          }
  
          if ($submission->userid) {
              $user = $DB->get_record('user', array('id'=>$submission->userid), '*', MUST_EXIST);
          } else {
              $user = $USER;
          }
  
          if ($notifyusers = $this->get_notifiable_users($user->id)) {
              foreach ($notifyusers as $notifyuser) {
                  $this->send_notification($user,
                                           $notifyuser,
                                           'gradersubmissionupdated',
                                           'assign_notification',
                                           $submission->timemodified);
              }
          }
      }
code_tokens: protected function notify_graders ( stdClass $ submission ) { global $ DB , $ USER ; $ instance = $ this -> get_instance ( ) ; $ late = $ instance -> duedate && ( $ instance -> duedate < time ( ) ) ; if ( ! $ instance -> sendnotifications && ! ( $ late && $ instance -> sendlatenotifications ) ) { // No need to do anything. return ; } if ( $ submission -> userid ) { $ user = $ DB -> get_record ( 'user' , array ( 'id' => $ submission -> userid ) , '*' , MUST_EXIST ) ; } else { $ user = $ USER ; } if ( $ notifyusers = $ this -> get_notifiable_users ( $ user -> id ) ) { foreach ( $ notifyusers as $ notifyuser ) { $ this -> send_notification ( $ user , $ notifyuser , 'gradersubmissionupdated' , 'assign_notification' , $ submission -> timemodified ) ; } } }
docstring: Send notifications to graders upon student submissions.
  
  @param stdClass $submission
  @return void
docstring_tokens: Send notifications to graders upon student submissions .