10 define(
"TITLE_FOLDER_PROPERTIES", _(
"Edit Folder Properties"));
20 $this->Name =
"folder_properties";
21 $this->Title = TITLE_FOLDER_PROPERTIES;
22 $this->MenuList =
"Organize::Folders::Edit Properties";
23 $this->Dependency = array();
25 parent::__construct();
26 $this->
dbManager = $GLOBALS[
'container']->get(
'db.manager');
35 function Edit($FolderId, $NewName, $NewDesc)
37 $sql =
'SELECT * FROM folder where folder_pk = $1;';
38 $Row = $this->
dbManager->getSingleRow($sql,array($FolderId),__METHOD__.
"Get");
40 if ($Row[
'folder_pk'] != $FolderId) {
43 $NewName =
trim($NewName);
44 if (! empty($FolderId)) {
46 if (empty($NewName)) {
47 $NewName = $Row[
'folder_name'];
50 if (empty($NewDesc)) {
51 $NewDesc = $Row[
'folder_desc'];
57 $sql =
'UPDATE folder SET folder_name = $1, folder_desc = $2 WHERE folder_pk = $3;';
58 $this->
dbManager->getSingleRow($sql,array($NewName, $NewDesc, $FolderId),__METHOD__.
"Set");
69 if (empty($FolderSelectId)) {
75 if (! empty($FolderId)) {
76 $FolderSelectId = $FolderId;
77 $rc = $this->
Edit($FolderId, $NewName, $NewDesc);
80 $text = _(
"Folder Properties changed");
81 $this->vars[
"message"] = $text;
85 $sql =
'SELECT * FROM folder WHERE folder_pk = $1;';
86 $Folder = $this->
dbManager->getSingleRow($sql,array($FolderSelectId),__METHOD__.
"getFolderRow");
89 $formVars[
"onchangeURI"] =
Traceback_uri() .
"?mod=" . $this->Name .
"&selectfolderid=";
91 $formVars[
"folder_name"] = $Folder[
'folder_name'];
92 $formVars[
"folder_desc"] = $Folder[
'folder_desc'];
93 return $this->
renderString(
"admin-folder-edit-form.html.twig",$formVars);
This is the Plugin class. All plugins should:
renderString($templateName, $vars=null)
Output()
Generate the text for this plugin.
Edit($FolderId, $NewName, $NewDesc)
Given a folder's ID and a name, alter the folder properties. Includes idiot checking since the input ...
__construct()
base constructor. Most plugins will just use this
FolderListOption($ParentFolder, $Depth, $IncludeTop=1, $SelectId=-1, $linkParent=false, $OldParent=0)
Create the folder tree, using OPTION tags.
FolderGetTop()
DEPRECATED! Find the top-of-tree folder_pk for the current user.
Traceback_uri()
Get the URI without query to this location.
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.
fo_dbManager * dbManager
fo_dbManager object