21 define(
"TITLE_FOLDER_PROPERTIES", _(
"Edit Folder Properties"));
29 function __construct()
31 $this->Name =
"folder_properties";
32 $this->Title = TITLE_FOLDER_PROPERTIES;
33 $this->MenuList =
"Organize::Folders::Edit Properties";
34 $this->Dependency = array();
36 parent::__construct();
37 $this->
dbManager = $GLOBALS[
'container']->get(
'db.manager');
46 function Edit($FolderId, $NewName, $NewDesc)
48 $sql =
'SELECT * FROM folder where folder_pk = $1;';
49 $Row = $this->
dbManager->getSingleRow($sql,array($FolderId),__METHOD__.
"Get");
51 if ($Row[
'folder_pk'] != $FolderId) {
54 $NewName =
trim($NewName);
55 if (! empty($FolderId)) {
57 if (empty($NewName)) {
58 $NewName = $Row[
'folder_name'];
61 if (empty($NewDesc)) {
62 $NewDesc = $Row[
'folder_desc'];
68 $sql =
'UPDATE folder SET folder_name = $1, folder_desc = $2 WHERE folder_pk = $3;';
69 $this->
dbManager->getSingleRow($sql,array($NewName, $NewDesc, $FolderId),__METHOD__.
"Set");
80 if (empty($FolderSelectId)) {
86 if (! empty($FolderId)) {
87 $FolderSelectId = $FolderId;
88 $rc = $this->
Edit($FolderId, $NewName, $NewDesc);
91 $text = _(
"Folder Properties changed");
92 $this->vars[
"message"] = $text;
96 $sql =
'SELECT * FROM folder WHERE folder_pk = $1;';
97 $Folder = $this->
dbManager->getSingleRow($sql,array($FolderSelectId),__METHOD__.
"getFolderRow");
100 $formVars[
"onchangeURI"] =
Traceback_uri() .
"?mod=" . $this->Name .
"&selectfolderid=";
101 $formVars[
"folderListOption"] =
FolderListOption(-1, 0, 1, $FolderSelectId);
102 $formVars[
"folder_name"] = $Folder[
'folder_name'];
103 $formVars[
"folder_desc"] = $Folder[
'folder_desc'];
104 return $this->
renderString(
"admin-folder-edit-form.html.twig",$formVars);
Traceback_uri()
Get the URI without query to this location.
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.
Edit($FolderId, $NewName, $NewDesc)
Given a folder's ID and a name, alter the folder properties. Includes idiot checking since the input ...
FolderGetTop()
DEPRECATED! Find the top-of-tree folder_pk for the current user.
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.
fo_dbManager * dbManager
fo_dbManager object
This is the Plugin class. All plugins should:
char * trim(char *ptext)
Trimming whitespace.