You are here

function filedepot_getRecursiveCatIDs in filedepot 6

3 calls to filedepot_getRecursiveCatIDs()
filedepot::deleteFolder in ./filedepot.class.php
filedepot_views_pre_execute in views/filedepot.views.inc
template_preprocess_filedepot_activefolder_admin in ./lib-theme.php

File

./lib-common.php, line 208
lib-common.php Common library of functions for the applications

Code

function filedepot_getRecursiveCatIDs(&$list, $cid, $perms, $override = false) {
  $filedepot = filedepot_filedepot();
  $query = db_query("SELECT cid FROM {filedepot_categories} WHERE PID=%d ORDER BY cid", $cid);
  while ($A = db_fetch_array($query)) {

    // Check and see if this category has any sub categories - where a category record has this cid as it's parent
    if (db_result(db_query("SELECT count(pid) FROM {filedepot_categories} WHERE pid=%d", $A['cid'])) > 0) {
      if ($override === TRUE or $filedepot
        ->checkPermission($A['cid'], $perms)) {
        array_push($list, $A['cid']);
        filedepot_getRecursiveCatIDs($list, $A['cid'], $perms, $override);
      }
    }
    else {
      if ($override === TRUE or $filedepot
        ->checkPermission($A['cid'], $perms)) {
        array_push($list, $A['cid']);
      }
    }
  }
  return $list;
}