You are here

function _uc_file_sort_names in Ubercart 6.2

Same name and namespace in other branches
  1. 8.4 uc_file/uc_file.module \_uc_file_sort_names()
  2. 7.3 uc_file/uc_file.module \_uc_file_sort_names()

Takes a list of file ids and sort the list by the associated filenames.

Parameters

$fids: The array of file ids.

Return value

The sorted array of file ids.

2 calls to _uc_file_sort_names()
uc_file_admin_files_form_action in uc_file/uc_file.admin.inc
Performs file action (upload, delete, hooked in actions).
_uc_file_build_js_file_display in uc_file/uc_file.admin.inc
Shows all possible files in selectable list.

File

uc_file/uc_file.module, line 1486

Code

function _uc_file_sort_names($fids) {
  $result = $aggregate = array();
  foreach ($fids as $fid) {
    $file = uc_file_get_by_id($fid);
    $aggregate[] = array(
      'filename' => $file->filename,
      'fid' => $file->fid,
    );
  }
  usort($aggregate, '_uc_file_sort_by_name');
  foreach ($aggregate as $file) {
    $result[] = $file['fid'];
  }
  return $result;
}