original_string: public function download_rewrite_pluginfile_urls($text, $user, $plugin) {
          // The groupname prefix for the urls doesn't depend on the group mode of the assignment instance.
          // Rather, it should be determined by checking the group submission settings of the instance,
          // which is what download_submission() does when generating the file name prefixes.
          $groupname = '';
          if ($this->get_instance()->teamsubmission) {
              $submissiongroup = $this->get_submission_group($user->id);
              if ($submissiongroup) {
                  $groupname = $submissiongroup->name . '-';
              } else {
                  $groupname = get_string('defaultteam', 'assign') . '-';
              }
          }
  
          if ($this->is_blind_marking()) {
              $prefix = $groupname . get_string('participant', 'assign');
              $prefix = str_replace('_', ' ', $prefix);
              $prefix = clean_filename($prefix . '_' . $this->get_uniqueid_for_user($user->id) . '_');
          } else {
              $prefix = $groupname . fullname($user);
              $prefix = str_replace('_', ' ', $prefix);
              $prefix = clean_filename($prefix . '_' . $this->get_uniqueid_for_user($user->id) . '_');
          }
  
          // Only prefix files if downloadasfolders user preference is NOT set.
          if (!get_user_preferences('assign_downloadasfolders', 1)) {
              $subtype = $plugin->get_subtype();
              $type = $plugin->get_type();
              $prefix = $prefix . $subtype . '_' . $type . '_';
          } else {
              $prefix = "";
          }
          $result = str_replace('@@PLUGINFILE@@/', $prefix, $text);
  
          return $result;
      }
code: public function download_rewrite_pluginfile_urls($text, $user, $plugin) {
          // The groupname prefix for the urls doesn't depend on the group mode of the assignment instance.
          // Rather, it should be determined by checking the group submission settings of the instance,
          // which is what download_submission() does when generating the file name prefixes.
          $groupname = '';
          if ($this->get_instance()->teamsubmission) {
              $submissiongroup = $this->get_submission_group($user->id);
              if ($submissiongroup) {
                  $groupname = $submissiongroup->name . '-';
              } else {
                  $groupname = get_string('defaultteam', 'assign') . '-';
              }
          }
  
          if ($this->is_blind_marking()) {
              $prefix = $groupname . get_string('participant', 'assign');
              $prefix = str_replace('_', ' ', $prefix);
              $prefix = clean_filename($prefix . '_' . $this->get_uniqueid_for_user($user->id) . '_');
          } else {
              $prefix = $groupname . fullname($user);
              $prefix = str_replace('_', ' ', $prefix);
              $prefix = clean_filename($prefix . '_' . $this->get_uniqueid_for_user($user->id) . '_');
          }
  
          // Only prefix files if downloadasfolders user preference is NOT set.
          if (!get_user_preferences('assign_downloadasfolders', 1)) {
              $subtype = $plugin->get_subtype();
              $type = $plugin->get_type();
              $prefix = $prefix . $subtype . '_' . $type . '_';
          } else {
              $prefix = "";
          }
          $result = str_replace('@@PLUGINFILE@@/', $prefix, $text);
  
          return $result;
      }
code_tokens: public function download_rewrite_pluginfile_urls ( $ text , $ user , $ plugin ) { // The groupname prefix for the urls doesn't depend on the group mode of the assignment instance. // Rather, it should be determined by checking the group submission settings of the instance, // which is what download_submission() does when generating the file name prefixes. $ groupname = '' ; if ( $ this -> get_instance ( ) -> teamsubmission ) { $ submissiongroup = $ this -> get_submission_group ( $ user -> id ) ; if ( $ submissiongroup ) { $ groupname = $ submissiongroup -> name . '-' ; } else { $ groupname = get_string ( 'defaultteam' , 'assign' ) . '-' ; } } if ( $ this -> is_blind_marking ( ) ) { $ prefix = $ groupname . get_string ( 'participant' , 'assign' ) ; $ prefix = str_replace ( '_' , ' ' , $ prefix ) ; $ prefix = clean_filename ( $ prefix . '_' . $ this -> get_uniqueid_for_user ( $ user -> id ) . '_' ) ; } else { $ prefix = $ groupname . fullname ( $ user ) ; $ prefix = str_replace ( '_' , ' ' , $ prefix ) ; $ prefix = clean_filename ( $ prefix . '_' . $ this -> get_uniqueid_for_user ( $ user -> id ) . '_' ) ; } // Only prefix files if downloadasfolders user preference is NOT set. if ( ! get_user_preferences ( 'assign_downloadasfolders' , 1 ) ) { $ subtype = $ plugin -> get_subtype ( ) ; $ type = $ plugin -> get_type ( ) ; $ prefix = $ prefix . $ subtype . '_' . $ type . '_' ; } else { $ prefix = "" ; } $ result = str_replace ( '@@PLUGINFILE@@/' , $ prefix , $ text ) ; return $ result ; }
docstring: Rewrite plugin file urls so they resolve correctly in an exported zip.
  
  @param string $text - The replacement text
  @param stdClass $user - The user record
  @param assign_plugin $plugin - The assignment plugin
docstring_tokens: Rewrite plugin file urls so they resolve correctly in an exported zip .