FOSSology
4.4.0
Open Source License Compliance by Open Source Software
|
Common Folder Functions Design note: Folders could be stored in a menu listing (using menu_insert). However, since menu_insert() runs a usort() during each insert, this can be really slow. For speed, folders are handled separately. More...
Go to the source code of this file.
Functions | |
FolderGetTop () | |
DEPRECATED! Find the top-of-tree folder_pk for the current user. More... | |
GetUserRootFolder () | |
Get the top-of-tree folder_pk for the current user. Fail if there is no user session. More... | |
Folder2Path ($folder_pk) | |
Return an array of folder_pk, folder_name from the users.root_folder_fk to $folder_pk. More... | |
GetFolderFromItem ($upload_pk="", $uploadtree_pk="") | |
Find what folder an item is in. More... | |
FolderListOption ($ParentFolder, $Depth, $IncludeTop=1, $SelectId=-1, $linkParent=false, $OldParent=0) | |
Create the folder tree, using OPTION tags. More... | |
FolderGetName ($FolderPk, $Top=-1) | |
Given a folder_pk, return the full path to this folder. More... | |
FolderGetFromUpload ($Uploadpk, $Folder=-1, $Stop=-1) | |
DEPRECATED! Given an upload number, return the folder path in an array containing folder_pk and name. More... | |
FolderListUploads_perm ($ParentFolder, $perm) | |
Returns an array of uploads in a folder. More... | |
FolderListUploadsRecurse ($ParentFolder=-1, $FolderPath='', $perm=Auth::PERM_READ) | |
Get uploads and folder info, starting from $ParentFolder. More... | |
GetFolderArray ($RootFolder, &$FolderArray) | |
Get an array of all the folders from a $RootFolder on down. More... | |
ContainExcludeString ($FilePath, $ExcludingText) | |
Check if one file path contains an excluding text. More... | |
Common Folder Functions Design note: Folders could be stored in a menu listing (using menu_insert). However, since menu_insert() runs a usort() during each insert, this can be really slow. For speed, folders are handled separately.
Definition in file common-folders.php.
ContainExcludeString | ( | $FilePath, | |
$ExcludingText | |||
) |
Check if one file path contains an excluding text.
string | $FilePath | File path |
string | $ExcludingText | Excluding text |
Definition at line 573 of file common-folders.php.
Folder2Path | ( | $folder_pk | ) |
Return an array of folder_pk, folder_name from the users.root_folder_fk to $folder_pk.
Array is in top down order. If you need to know the folder_pk of an upload or uploadtree, use GetFolderFromItem()
int | $folder_pk |
Definition at line 90 of file common-folders.php.
FolderGetFromUpload | ( | $Uploadpk, | |
$Folder = -1 , |
|||
$Stop = -1 |
|||
) |
DEPRECATED! Given an upload number, return the folder path in an array containing folder_pk and name.
Definition at line 294 of file common-folders.php.
FolderGetName | ( | $FolderPk, | |
$Top = -1 |
|||
) |
Given a folder_pk, return the full path to this folder.
int | $FolderPk | Folder id |
int | $Top | Optional, default is user's top folder. folder_pk of top of desired path. |
Definition at line 263 of file common-folders.php.
FolderGetTop | ( | ) |
DEPRECATED! Find the top-of-tree folder_pk for the current user.
Definition at line 26 of file common-folders.php.
FolderListOption | ( | $ParentFolder, | |
$Depth, | |||
$IncludeTop = 1 , |
|||
$SelectId = -1 , |
|||
$linkParent = false , |
|||
$OldParent = 0 |
|||
) |
Create the folder tree, using OPTION tags.
int | $ParentFolder | Parents folder_fk |
int | $Depth | Tree depth to create |
bool | $IncludeTop | True to include fossology root folder |
int | $SelectId | folder_fk of selected folder |
bool | $linkParent | If true, the option tag will have $OldParent and $ParentFolder as the value |
int | $OldParent | Parent of the parent folder |
Definition at line 178 of file common-folders.php.
FolderListUploads_perm | ( | $ParentFolder, | |
$perm | |||
) |
Returns an array of uploads in a folder.
Only uploads for which the user has permission >= $perm are returned. This does NOT recurse. The returned array is sorted by ufile_name and upload_pk.
int | $ParentFolder | Optional folder_pk, default is users root folder. |
int | $perm | Minimum permission |
array{upload_pk, upload_desc, upload_ts, ufile_name}
for all uploads in a given folder. Definition at line 361 of file common-folders.php.
FolderListUploadsRecurse | ( | $ParentFolder = -1 , |
|
$FolderPath = '' , |
|||
$perm = Auth::PERM_READ |
|||
) |
Get uploads and folder info, starting from $ParentFolder.
The array is sorted by folder and upload name. Folders that are empty do not show up.
int | $ParentFolder | folder_pk, -1 for users root folder |
string | $FolderPath | Used for recursion, caller should not specify. |
Auth::PERM_READ | Auth::PERM_WRITE | $perm | Permission required |
{upload_pk, upload_desc, name, folder}
Definition at line 428 of file common-folders.php.
GetFolderArray | ( | $RootFolder, | |
& | $FolderArray | ||
) |
Get an array of all the folders from a $RootFolder on down.
Recursive. This is typically used to build a select list of folder names.
int | $RootFolder | Default is entire software repository | |
[out] | array | $FolderArray | Returned array of folder_pk=>folder_name's |
{folder_pk=>folder_name, folder_pk=>folder_name, ...}
in folder order. If no folders are in the list, an empty array is returned.Definition at line 525 of file common-folders.php.
GetFolderFromItem | ( | $upload_pk = "" , |
|
$uploadtree_pk = "" |
|||
) |
Find what folder an item is in.
int | $upload_pk | NULL if $uploadtree_pk is passed in |
int | $uploadtree_pk | NULL if $upload_pk is passed in |
Definition at line 138 of file common-folders.php.
GetUserRootFolder | ( | ) |
Get the top-of-tree folder_pk for the current user. Fail if there is no user session.
Definition at line 50 of file common-folders.php.