function filedepot::getAllowableCategories in filedepot 7
Same name and namespace in other branches
- 6 filedepot.class.php \filedepot::getAllowableCategories()
Return list of repository categories user has permission to access to be used in SQL statements
Parameters
mixed array or string - permission(s) you want to test for:
boolean return format - if FALSE, return an array:
Return value
mixed - comma separated list of categories, or array
1 call to filedepot::getAllowableCategories()
File
- ./
filedepot.class.php, line 384 - filedepot.class.php Main class for the Filedepot module
Class
- filedepot
- @file filedepot.class.php Main class for the Filedepot module
Code
function getAllowableCategories($perm = 'view', $returnstring = TRUE) {
global $user;
$categories = array();
$sql = "SELECT distinct catid FROM {filedepot_access} ";
$query = db_query($sql);
while ($A = $query
->fetchAssoc()) {
if ($this
->checkPermission($A['catid'], $perm, $user->uid)) {
$categories[] = $A['catid'];
}
}
watchdog('filedepot', "Recreate folder index for user: {$user->uid}");
$this
->getRecursiveCatIDs($categories, 0, 'view', FALSE, TRUE);
if ($returnstring and count($categories) > 0) {
$retval = implode(',', $categories);
}
else {
$retval = $categories;
}
return $retval;
}