Commit 164558408611bb4318c5b2bdf4146aef58f8dbb6

Authored by nbm
1 parent b95af0da

Add bRestrictDocumentTypes, which tells if this folder restricts the

document types of the documents put in it (defaults to no).


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@3679 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing 1 changed file with 18 additions and 6 deletions
lib/foldermanagement/Folder.inc
... ... @@ -51,10 +51,12 @@ class Folder extends KTEntity {
51 51 var $iPermissionObjectID;
52 52 /** lookup accelerator id */
53 53 var $iPermissionLookupID;
  54 + /** whether to restrict to only certain document types */
  55 + var $bRestrictDocumentTypes;
54 56  
55 57 // {{{ KTEntity stuff
56 58 var $_aFieldToSelect = array(
57   - 'iID' => 'id',
  59 + 'iId' => 'id',
58 60 'sName' => 'name',
59 61 'sDescription' => 'description',
60 62 'iParentID' => 'parent_id',
... ... @@ -65,6 +67,7 @@ class Folder extends KTEntity {
65 67 'sParentFolderIDs' => 'parent_folder_ids',
66 68 'iPermissionObjectID' => 'permission_object_id',
67 69 'iPermissionLookupID' => 'permission_lookup_id',
  70 + 'bRestrictDocumentTypes' => 'restrict_document_types',
68 71 );
69 72 // }}}
70 73  
... ... @@ -111,6 +114,9 @@ class Folder extends KTEntity {
111 114 function getPermissionLookupID() { return $this->iPermissionLookupID; }
112 115 function setPermissionLookupID($iPermissionLookupID) { $this->iPermissionLookupID = $iPermissionLookupID; }
113 116  
  117 + function getRestrictDocumentTypes() { return $this->bRestrictDocumentTypes; }
  118 + function setRestrictDocumentTypes($bRestrictDocumentTypes) { $this->bRestrictDocumentTypes = $bRestrictDocumentTypes; }
  119 +
114 120 // {{{ create()
115 121 function create () {
116 122 $oParentFolder =& Folder::get($this->iParentID);
... ... @@ -181,6 +187,7 @@ class Folder extends KTEntity {
181 187 function _fieldValues () {
182 188 $this->sFullPath = $this->generateFolderPath($this->iParentID);
183 189 $this->sParentFolderIDs = $this->generateFolderIDs($this->iParentID);
  190 + return parent::_fieldValues();
184 191 return array(
185 192 'name' => $this->sName,
186 193 'description' => $this->sDescription,
... ... @@ -226,11 +233,11 @@ class Folder extends KTEntity {
226 233 * the paths of the children in the database
227 234 *
228 235 */
229   - function updateChildPaths($iID) {
  236 + function updateChildPaths($iId) {
230 237 global $default;
231 238 //get the direct children
232 239 $sql = $default->db;
233   - $sql->query(array("SELECT id from $default->folders_table WHERE parent_id = ?", $iID));/*ok*/
  240 + $sql->query(array("SELECT id from $default->folders_table WHERE parent_id = ?", $iId));/*ok*/
234 241 while ($sql->next_record()) {
235 242 //force an update, this will cause this child's children to be updated
236 243 $oFolder = Folder::get($sql->f("id"));
... ... @@ -246,8 +253,8 @@ class Folder extends KTEntity {
246 253 * update().
247 254 */
248 255  
249   - function updateDocumentPaths($iID) {
250   - $aDocuments = Document::getList(array('folder_id = ?', $iID));
  256 + function updateDocumentPaths($iId) {
  257 + $aDocuments = Document::getList(array('folder_id = ?', $iId));
251 258 if (PEAR::isError($aDocuments)) {
252 259 return $aDocuments;
253 260 }
... ... @@ -303,10 +310,11 @@ class Folder extends KTEntity {
303 310 *
304 311 * @return Folder folder object on successful retrieval, false otherwise and set $_SESSION["errorMessage"]
305 312 */
  313 + /*
306 314 function get($iFolderID) {
307 315 global $default, $lang_err_object_not_exist;
308 316 $sql = $default->db;
309   - $sql->query(array("SELECT * FROM " . $default->folders_table . " WHERE id = ?", $iFolderID));/*ok*/
  317 + $sql->query(array("SELECT * FROM " . $default->folders_table . " WHERE id = ?", $iFolderID));
310 318 if ($sql->next_record()) {
311 319 $oFolder = & new Folder($sql->f("name"), $sql->f("description"), $sql->f("parent_id"), $sql->f("creator_id"), $sql->f("unit_id"), $sql->f("is_public"));
312 320 $oFolder->iId = $iFolderID;
... ... @@ -319,6 +327,10 @@ class Folder extends KTEntity {
319 327 $_SESSION["errorMessage"] = $lang_err_object_not_exist . "id = " . $iFolderID . " table = folders";
320 328 return false;
321 329 }
  330 + */
  331 + function &get($iFolderID) {
  332 + return KTEntityUtil::get('Folder', $iFolderID);
  333 + }
322 334  
323 335 /**
324 336 * Checks if a folder with the same name and parent exists in the database already
... ...