original_string: protected static function get_downloadable_feedback_filename($assignment, $userid, $attemptnumber) {
          global $DB;
  
          $assignment = self::get_assignment_from_param($assignment);
  
          $groupmode = groups_get_activity_groupmode($assignment->get_course_module());
          $groupname = '';
          if ($groupmode) {
              $groupid = groups_get_activity_group($assignment->get_course_module(), true);
              $groupname = groups_get_group_name($groupid).'-';
          }
          if ($groupname == '-') {
              $groupname = '';
          }
          $grade = $assignment->get_user_grade($userid, true, $attemptnumber);
          $user = $DB->get_record('user', array('id'=>$userid), '*', MUST_EXIST);
  
          if ($assignment->is_blind_marking()) {
              $prefix = $groupname . get_string('participant', 'assign');
              $prefix = str_replace('_', ' ', $prefix);
              $prefix = clean_filename($prefix . '_' . $assignment->get_uniqueid_for_user($userid) . '_');
          } else {
              $prefix = $groupname . fullname($user);
              $prefix = str_replace('_', ' ', $prefix);
              $prefix = clean_filename($prefix . '_' . $assignment->get_uniqueid_for_user($userid) . '_');
          }
          $prefix .= $grade->attemptnumber;
  
          return $prefix . '.pdf';
      }
code: protected static function get_downloadable_feedback_filename($assignment, $userid, $attemptnumber) {
          global $DB;
  
          $assignment = self::get_assignment_from_param($assignment);
  
          $groupmode = groups_get_activity_groupmode($assignment->get_course_module());
          $groupname = '';
          if ($groupmode) {
              $groupid = groups_get_activity_group($assignment->get_course_module(), true);
              $groupname = groups_get_group_name($groupid).'-';
          }
          if ($groupname == '-') {
              $groupname = '';
          }
          $grade = $assignment->get_user_grade($userid, true, $attemptnumber);
          $user = $DB->get_record('user', array('id'=>$userid), '*', MUST_EXIST);
  
          if ($assignment->is_blind_marking()) {
              $prefix = $groupname . get_string('participant', 'assign');
              $prefix = str_replace('_', ' ', $prefix);
              $prefix = clean_filename($prefix . '_' . $assignment->get_uniqueid_for_user($userid) . '_');
          } else {
              $prefix = $groupname . fullname($user);
              $prefix = str_replace('_', ' ', $prefix);
              $prefix = clean_filename($prefix . '_' . $assignment->get_uniqueid_for_user($userid) . '_');
          }
          $prefix .= $grade->attemptnumber;
  
          return $prefix . '.pdf';
      }
code_tokens: protected static function get_downloadable_feedback_filename ( $ assignment , $ userid , $ attemptnumber ) { global $ DB ; $ assignment = self :: get_assignment_from_param ( $ assignment ) ; $ groupmode = groups_get_activity_groupmode ( $ assignment -> get_course_module ( ) ) ; $ groupname = '' ; if ( $ groupmode ) { $ groupid = groups_get_activity_group ( $ assignment -> get_course_module ( ) , true ) ; $ groupname = groups_get_group_name ( $ groupid ) . '-' ; } if ( $ groupname == '-' ) { $ groupname = '' ; } $ grade = $ assignment -> get_user_grade ( $ userid , true , $ attemptnumber ) ; $ user = $ DB -> get_record ( 'user' , array ( 'id' => $ userid ) , '*' , MUST_EXIST ) ; if ( $ assignment -> is_blind_marking ( ) ) { $ prefix = $ groupname . get_string ( 'participant' , 'assign' ) ; $ prefix = str_replace ( '_' , ' ' , $ prefix ) ; $ prefix = clean_filename ( $ prefix . '_' . $ assignment -> get_uniqueid_for_user ( $ userid ) . '_' ) ; } else { $ prefix = $ groupname . fullname ( $ user ) ; $ prefix = str_replace ( '_' , ' ' , $ prefix ) ; $ prefix = clean_filename ( $ prefix . '_' . $ assignment -> get_uniqueid_for_user ( $ userid ) . '_' ) ; } $ prefix .= $ grade -> attemptnumber ; return $ prefix . '.pdf' ; }
docstring: This function returns sensible filename for a feedback file.
  @param int|\assign $assignment
  @param int $userid
  @param int $attemptnumber (-1 means latest attempt)
  @return string
docstring_tokens: This function returns sensible filename for a feedback file .