original_string: public static function get_participant($assignid, $userid, $embeduser) {
          global $DB, $CFG;
          require_once($CFG->dirroot . "/mod/assign/locallib.php");
          require_once($CFG->dirroot . "/user/lib.php");
  
          $params = self::validate_parameters(self::get_participant_parameters(), array(
              'assignid' => $assignid,
              'userid' => $userid,
              'embeduser' => $embeduser
          ));
  
          list($assign, $course, $cm, $context) = self::validate_assign($params['assignid']);
          $assign->require_view_grades();
  
          $participant = $assign->get_participant($params['userid']);
  
          // Update assign with override information.
          $assign->update_effective_access($params['userid']);
  
          if (!$participant) {
              // No participant found so we can return early.
              throw new moodle_exception('usernotincourse');
          }
  
          $return = array(
              'id' => $participant->id,
              'fullname' => $participant->fullname,
              'submitted' => $participant->submitted,
              'requiregrading' => $participant->requiregrading,
              'grantedextension' => $participant->grantedextension,
              'blindmarking' => $assign->is_blind_marking(),
              'allowsubmissionsfromdate' => $assign->get_instance()->allowsubmissionsfromdate,
              'duedate' => $assign->get_instance()->duedate,
              'cutoffdate' => $assign->get_instance()->cutoffdate,
              'duedatestr' => userdate($assign->get_instance()->duedate, get_string('strftimedatetime', 'langconfig')),
          );
  
          if (!empty($participant->groupid)) {
              $return['groupid'] = $participant->groupid;
          }
          if (!empty($participant->groupname)) {
              $return['groupname'] = $participant->groupname;
          }
  
          // Skip the expensive lookup of user detail if we're blind marking or the caller
          // hasn't asked for user details to be embedded.
          if (!$assign->is_blind_marking() && $embeduser) {
              if ($userdetails = user_get_user_details($participant, $course)) {
                  $return['user'] = $userdetails;
              }
          }
  
          return $return;
      }
code: public static function get_participant($assignid, $userid, $embeduser) {
          global $DB, $CFG;
          require_once($CFG->dirroot . "/mod/assign/locallib.php");
          require_once($CFG->dirroot . "/user/lib.php");
  
          $params = self::validate_parameters(self::get_participant_parameters(), array(
              'assignid' => $assignid,
              'userid' => $userid,
              'embeduser' => $embeduser
          ));
  
          list($assign, $course, $cm, $context) = self::validate_assign($params['assignid']);
          $assign->require_view_grades();
  
          $participant = $assign->get_participant($params['userid']);
  
          // Update assign with override information.
          $assign->update_effective_access($params['userid']);
  
          if (!$participant) {
              // No participant found so we can return early.
              throw new moodle_exception('usernotincourse');
          }
  
          $return = array(
              'id' => $participant->id,
              'fullname' => $participant->fullname,
              'submitted' => $participant->submitted,
              'requiregrading' => $participant->requiregrading,
              'grantedextension' => $participant->grantedextension,
              'blindmarking' => $assign->is_blind_marking(),
              'allowsubmissionsfromdate' => $assign->get_instance()->allowsubmissionsfromdate,
              'duedate' => $assign->get_instance()->duedate,
              'cutoffdate' => $assign->get_instance()->cutoffdate,
              'duedatestr' => userdate($assign->get_instance()->duedate, get_string('strftimedatetime', 'langconfig')),
          );
  
          if (!empty($participant->groupid)) {
              $return['groupid'] = $participant->groupid;
          }
          if (!empty($participant->groupname)) {
              $return['groupname'] = $participant->groupname;
          }
  
          // Skip the expensive lookup of user detail if we're blind marking or the caller
          // hasn't asked for user details to be embedded.
          if (!$assign->is_blind_marking() && $embeduser) {
              if ($userdetails = user_get_user_details($participant, $course)) {
                  $return['user'] = $userdetails;
              }
          }
  
          return $return;
      }
code_tokens: public static function get_participant ( $ assignid , $ userid , $ embeduser ) { global $ DB , $ CFG ; require_once ( $ CFG -> dirroot . "/mod/assign/locallib.php" ) ; require_once ( $ CFG -> dirroot . "/user/lib.php" ) ; $ params = self :: validate_parameters ( self :: get_participant_parameters ( ) , array ( 'assignid' => $ assignid , 'userid' => $ userid , 'embeduser' => $ embeduser ) ) ; list ( $ assign , $ course , $ cm , $ context ) = self :: validate_assign ( $ params [ 'assignid' ] ) ; $ assign -> require_view_grades ( ) ; $ participant = $ assign -> get_participant ( $ params [ 'userid' ] ) ; // Update assign with override information. $ assign -> update_effective_access ( $ params [ 'userid' ] ) ; if ( ! $ participant ) { // No participant found so we can return early. throw new moodle_exception ( 'usernotincourse' ) ; } $ return = array ( 'id' => $ participant -> id , 'fullname' => $ participant -> fullname , 'submitted' => $ participant -> submitted , 'requiregrading' => $ participant -> requiregrading , 'grantedextension' => $ participant -> grantedextension , 'blindmarking' => $ assign -> is_blind_marking ( ) , 'allowsubmissionsfromdate' => $ assign -> get_instance ( ) -> allowsubmissionsfromdate , 'duedate' => $ assign -> get_instance ( ) -> duedate , 'cutoffdate' => $ assign -> get_instance ( ) -> cutoffdate , 'duedatestr' => userdate ( $ assign -> get_instance ( ) -> duedate , get_string ( 'strftimedatetime' , 'langconfig' ) ) , ) ; if ( ! empty ( $ participant -> groupid ) ) { $ return [ 'groupid' ] = $ participant -> groupid ; } if ( ! empty ( $ participant -> groupname ) ) { $ return [ 'groupname' ] = $ participant -> groupname ; } // Skip the expensive lookup of user detail if we're blind marking or the caller // hasn't asked for user details to be embedded. if ( ! $ assign -> is_blind_marking ( ) && $ embeduser ) { if ( $ userdetails = user_get_user_details ( $ participant , $ course ) ) { $ return [ 'user' ] = $ userdetails ; } } return $ return ; }
docstring: Get the user participating in the given assignment. An error with code 'usernotincourse'
  is thrown is the user isn't a participant of the given assignment.
  
  @param int $assignid the assign instance id
  @param int $userid the user id
  @param bool $embeduser return user details (only applicable if not blind marking)
  @return array of warnings and status result
  @since Moodle 3.1
  @throws moodle_exception
docstring_tokens: Get the user participating in the given assignment . An error with code usernotincourse is thrown is the user isn t a participant of the given assignment .