You are here

function template_preprocess_filedepot_activefolder_nonadmin in filedepot 7

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

File

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

Code

function template_preprocess_filedepot_activefolder_nonadmin(&$variables) {
  global $user;
  $filedepot = filedepot_filedepot();
  $foldername = db_query("SELECT name FROM {filedepot_categories} WHERE cid=:cid", array(
    ':cid' => $filedepot->cid,
  ))
    ->fetchField();
  $variables['active_category_id'] = $filedepot->cid;
  $variables['active_folder_name'] = filter_xss($foldername);
  $variables['LANG_folderoptions'] = t('Folder Notification Options');
  $variables['LANG_newfiles'] = t('Alert me if new files are added');
  $variables['LANG_filechanges'] = t('Alert me if files are changed');
  $variables['chk_fileadded'] = '';
  $variables['chk_filechanged'] = '';
  $query = db_query("SELECT cid_newfiles,cid_changes FROM {filedepot_notifications} WHERE cid=:cid AND uid=:uid", array(
    ':cid' => $filedepot->cid,
    ':uid' => $user->uid,
  ));
  if ($query) {
    $B = $query
      ->fetchAssoc();
    if ($B['cid_newfiles'] == 1) {
      $variables['chk_fileadded'] = "CHECKED=checked";
    }
    if ($B['cid_changes'] == 1) {
      $variables['chk_filechanged'] = "CHECKED=checked";
    }
  }
}