You are here

function template_preprocess_filedepot_activefolder in filedepot 6

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

File

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

Code

function template_preprocess_filedepot_activefolder(&$variables) {
  $filedepot = filedepot_filedepot();
  $variables['show_activefolder'] = 'none';
  $variables['show_reportmodeheader'] = 'none';
  $variables['show_nonadmin'] = 'none';
  $variables['show_breadcrumbs'] = 'none';
  if ($filedepot->cid == 0) {
    if (in_array($filedepot->activeview, $filedepot->validReportingModes)) {
      $variables['report_heading'] = t($filedepot->activeview);
      $variables['show_reportmodeheader'] = '';
    }
  }
  else {
    $variables['show_activefolder'] = '';
    $pid = db_result(db_query("SELECT pid FROM {filedepot_categories} WHERE cid=%d", $filedepot->cid));
    if ($pid != 0) {
      $parent = $pid;
      $rootfolder = $filedepot->cid;
      while ($parent != 0) {

        // Determine the rootfolder
        $rootfolder = $parent;
        $parent = db_result(db_query("SELECT pid FROM {filedepot_categories} WHERE cid=%d", $parent));
      }
      $variables['folder_breadcrumb_links'] = theme('filedepot_folder_breadcrumb', $rootfolder, 0);
      if ($rootfolder != $pid) {
        $query = db_query("SELECT cid from {filedepot_categories} WHERE cid=%d", $pid);
        $A = db_fetch_array($query);
        $variables['folder_breadcrumb_links'] .= theme('filedepot_folder_breadcrumb', $A['cid'], 5);
      }
      $variables['show_breadcrumbs'] = 'block';
    }
    if ($filedepot
      ->checkPermission($filedepot->cid, 'admin')) {
      $variables['active_folder_admin'] = theme('filedepot_activefolder_admin');
    }
    else {
      $variables['show_nonadmin'] = '';
      $variables['active_folder_admin'] = theme('filedepot_activefolder_nonadmin');
    }
  }
  $variables['ajaxstatus'] = theme('filedepot_ajaxstatus');
  $variables['ajaxactivity'] = theme('filedepot_ajaxactivity', $variables['layout_url']);
}