You are here

function template_preprocess_filedepot_folderlisting in filedepot 7

Same name and namespace in other branches
  1. 6 lib-theme.php \template_preprocess_filedepot_folderlisting()

File

./lib-theme.php, line 230
lib-theme.php Theme support functions for the module

Code

function template_preprocess_filedepot_folderlisting(&$variables) {
  $filedepot = filedepot_filedepot();
  $rec = $variables['folderrec'];

  // cid,pid,name,description,folderorder,last_modified_date
  $level = $variables['level'];
  $variables['padding_right'] = 0;
  $variables['folder_desc_padding_left'] = 23 + $level * 30;

  // Version 3.0 - not presently used
  $variables['folder_id'] = $rec['cid'];
  $variables['parent_folder_id'] = $rec['pid'];
  $variables['folder_name'] = filter_xss($rec['name']);
  $variables['folder_description'] = filter_xss($rec['description']);
  if (variable_get('filedepot_show_index_enabled', 1) == 1) {

    // Check admin config setting
    $variables['folder_number'] = "{$variables['folderprefix']}.0";
  }
  else {
    $variables['folder_number'] = '';
  }
  if ($rec['last_modified_date'] > 0) {
    $variables['last_modified_date'] = strftime($filedepot->shortdate, $rec['last_modified_date']);
  }
  else {
    $variables['last_modified_date'] = '';
  }

  // For the checkall files - need to set the inline files
  // and can't be done in filedepot_displayFileListing since a folder can have subfolders
  // and template var in parent folder is being over-written
  $query_files = db_query("SELECT fid from {filedepot_files} WHERE cid=:cid", array(
    ':cid' => $rec['cid'],
  ));
  $files = array();
  while ($A = $query_files
    ->fetchAssoc()) {
    $files[] = $A['fid'];
  }
  $variables['folder_files'] = implode(',', $files);
  if ($filedepot
    ->checkPermission($rec['cid'], 'admin')) {
    $variables['onhover_move_options'] = theme('filedepot_folder_moveoptions', array(
      'folderid' => $rec['cid'],
      'order' => $rec['folderorder'],
      'maxorder' => $variables['maxorder'],
    ));
  }
  else {
    $variables['onhover_move_options'] = '';
  }
  $variables['folder_padding_left'] = $level * $filedepot->listingpadding;
}