22 function __construct()
24 $this->Name =
"folder_create";
25 $this->Title = _(
"Create a new Fossology folder");
26 $this->MenuList =
"Organize::Folders::Create";
27 $this->Dependency = array ();
29 parent::__construct();
44 public function create($parentId, $newFolder, $desc)
46 $folderName =
trim($newFolder);
47 if (empty($folderName)) {
52 $folderDao = $GLOBALS[
'container']->get(
'dao.folder');
54 $parentExists = $folderDao->getFolder($parentId);
55 if (! $parentExists) {
59 $folderWithSameNameUnderParent = $folderDao->getFolderId($folderName, $parentId);
60 if (! empty($folderWithSameNameUnderParent)) {
64 $folderDao->createFolder($folderName, $desc, $parentId);
77 if (! empty($ParentId) && ! empty($NewFolder)) {
78 $rc = $this->
create($ParentId, $NewFolder, $Desc);
82 $text1 = _(
"Created");
83 $this->vars[
'message'] =
"$text " . htmlentities($NewFolder) .
" $text1";
84 }
else if ($rc == 4) {
87 $this->vars[
'message'] =
"$text " . htmlentities($NewFolder) .
" $text1";
94 return $this->
renderString(
"admin-folder-create-form.html.twig",$formVars);
99 $NewPlugin->Initialize();
Output()
Generate the text for this plugin.
FolderListOption($ParentFolder, $Depth, $IncludeTop=1, $SelectId=-1, $linkParent=false, $OldParent=0)
Create the folder tree, using OPTION tags.
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.
GetParm($parameterName, $parameterType)
This function will retrieve the variables and check data types.
renderString($templateName, $vars=null)
#define PLUGIN_DB_WRITE
Plugin requires write permission on DB.
This is the Plugin class. All plugins should:
char * trim(char *ptext)
Trimming whitespace.