13 $this->Name =
"folder_create";
14 $this->Title = _(
"Create a new Fossology folder");
15 $this->MenuList =
"Organize::Folders::Create";
16 $this->Dependency = array ();
18 parent::__construct();
33 public function create($parentId, $newFolder, $desc)
35 $folderName =
trim($newFolder);
36 if (empty($folderName)) {
41 $folderDao = $GLOBALS[
'container']->get(
'dao.folder');
43 $parentExists = $folderDao->getFolder($parentId);
44 if (! $parentExists) {
48 $folderWithSameNameUnderParent = $folderDao->getFolderId($folderName, $parentId);
49 if (! empty($folderWithSameNameUnderParent)) {
53 $folderDao->createFolder($folderName, $desc, $parentId);
66 if (! empty($ParentId) && ! empty($NewFolder)) {
67 $rc = $this->
create($ParentId, $NewFolder, $Desc);
71 $text1 = _(
"Created");
72 $this->vars[
'message'] =
"$text " . htmlentities($NewFolder) .
" $text1";
73 }
else if ($rc == 4) {
76 $this->vars[
'message'] =
"$text " . htmlentities($NewFolder) .
" $text1";
83 return $this->
renderString(
"admin-folder-create-form.html.twig",$formVars);
88 $NewPlugin->Initialize();
This is the Plugin class. All plugins should:
renderString($templateName, $vars=null)
Output()
Generate the text for this plugin.
__construct()
base constructor. Most plugins will just use this
create($parentId, $newFolder, $desc)
Given a parent folder ID, a name and description, create the named folder under the parent.
GetUserRootFolder()
Get the top-of-tree folder_pk for the current user. Fail if there is no user session.
FolderListOption($ParentFolder, $Depth, $IncludeTop=1, $SelectId=-1, $linkParent=false, $OldParent=0)
Create the folder tree, using OPTION tags.
GetParm($parameterName, $parameterType)
This function will retrieve the variables and check data types.
char * trim(char *ptext)
Trimming whitespace.
#define PLUGIN_DB_WRITE
Plugin requires write permission on DB.