Commit 6183bb831f99186277c9bc0789decb42cc576c5d
1 parent
2a247e67
Move Folder class over to support the standard KTEntity functions like
createFromArray git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@3570 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
24 additions
and
2 deletions
lib/foldermanagement/Folder.inc
| @@ -51,6 +51,22 @@ class Folder extends KTEntity { | @@ -51,6 +51,22 @@ class Folder extends KTEntity { | ||
| 51 | var $iPermissionObjectID; | 51 | var $iPermissionObjectID; |
| 52 | /** lookup accelerator id */ | 52 | /** lookup accelerator id */ |
| 53 | var $iPermissionLookupID; | 53 | var $iPermissionLookupID; |
| 54 | + | ||
| 55 | + // {{{ KTEntity stuff | ||
| 56 | + var $_aFieldToSelect = array( | ||
| 57 | + 'iID' => 'id', | ||
| 58 | + 'sName' => 'name', | ||
| 59 | + 'sDescription' => 'description', | ||
| 60 | + 'iParentID' => 'parent_id', | ||
| 61 | + 'iCreatorID' => 'creator_id', | ||
| 62 | + 'iUnitID' => 'unit_id', | ||
| 63 | + 'bIsPublic' => 'is_public', | ||
| 64 | + 'sFullPath' => 'full_path', | ||
| 65 | + 'sParentFolderIDs' => 'parent_folder_ids', | ||
| 66 | + 'iPermissionObjectID' => 'permission_object_id', | ||
| 67 | + 'iPermissionLookupID' => 'permission_lookup_id', | ||
| 68 | + ); | ||
| 69 | + // }}} | ||
| 54 | 70 | ||
| 55 | /** | 71 | /** |
| 56 | * Folder class constructor | 72 | * Folder class constructor |
| @@ -63,7 +79,7 @@ class Folder extends KTEntity { | @@ -63,7 +79,7 @@ class Folder extends KTEntity { | ||
| 63 | * @param $iNewUnitID Primary key of unit to which folder belongs | 79 | * @param $iNewUnitID Primary key of unit to which folder belongs |
| 64 | * @param $bNewIsPublic Folder public status (is the folder public or not?) | 80 | * @param $bNewIsPublic Folder public status (is the folder public or not?) |
| 65 | */ | 81 | */ |
| 66 | - function Folder($sNewName, $sNewDescription, $iNewParentID, $iNewCreatorID, $iNewUnitID, $bNewIsPublic = false) { | 82 | + function Folder($sNewName = null, $sNewDescription = null, $iNewParentID = null, $iNewCreatorID = null, $iNewUnitID = null, $bNewIsPublic = false) { |
| 67 | //id of -1 means that the object has not yet been stored in the database | 83 | //id of -1 means that the object has not yet been stored in the database |
| 68 | $this->iId = -1; | 84 | $this->iId = -1; |
| 69 | $this->sName = $sNewName; | 85 | $this->sName = $sNewName; |
| @@ -97,7 +113,7 @@ class Folder extends KTEntity { | @@ -97,7 +113,7 @@ class Folder extends KTEntity { | ||
| 97 | 113 | ||
| 98 | // {{{ create() | 114 | // {{{ create() |
| 99 | function create () { | 115 | function create () { |
| 100 | - $oParentFolder = Folder::get($this->iParentID); | 116 | + $oParentFolder =& Folder::get($this->iParentID); |
| 101 | $this->iPermissionObjectID = $oParentFolder->getPermissionObjectID(); | 117 | $this->iPermissionObjectID = $oParentFolder->getPermissionObjectID(); |
| 102 | $res = parent::create(); | 118 | $res = parent::create(); |
| 103 | if ($res === true) { | 119 | if ($res === true) { |
| @@ -610,6 +626,12 @@ class Folder extends KTEntity { | @@ -610,6 +626,12 @@ class Folder extends KTEntity { | ||
| 610 | 'permission_lookup_id' => $iLookupID, | 626 | 'permission_lookup_id' => $iLookupID, |
| 611 | ), array('multi' => true)); | 627 | ), array('multi' => true)); |
| 612 | } | 628 | } |
| 629 | + | ||
| 630 | + // STATIC | ||
| 631 | + function &createFromArray($aOptions) { | ||
| 632 | + return KTEntityUtil::createFromArray('Folder', $aOptions); | ||
| 633 | + } | ||
| 634 | + | ||
| 613 | } | 635 | } |
| 614 | 636 | ||
| 615 | ?> | 637 | ?> |