function filedepot::getAllowableCategories in filedepot 6
Same name and namespace in other branches
- 7 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 302 - 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 = db_fetch_array($query)) {
if ($this
->checkPermission($A['catid'], $perm, $user->uid)) {
$categories[] = $A['catid'];
}
}
if ($returnstring and count($categories) > 0) {
$retval = implode(',', $categories);
}
else {
$retval = $categories;
}
return $retval;
}