Commit 419602e69a138bf4f3f6fbc11557225b25924d7d

Authored by nbm
1 parent 68921d90

Add is_complete and is_complex to Fieldset, as well as a mechanism to

look up a fieldset based on a document field.


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@3804 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing 1 changed file with 19 additions and 3 deletions
lib/metadata/fieldset.inc.php
... ... @@ -17,11 +17,15 @@ class KTFieldset extends KTEntity {
17 17 /** document fieldset namespace */
18 18 var $sNamespace;
19 19 /** document fieldset mandatory flag*/
20   - var $bMandatory;
21   - var $bIsConditional;
  20 + var $bMandatory = false;
  21 + var $bIsConditional = false;
22 22 var $iMasterFieldId;
23 23  
24   - var $bIsGeneric;
  24 + var $bIsGeneric = false;
  25 + // By default, we're complete. When we become conditional, then we
  26 + // become incomplete until made complete.
  27 + var $bIsComplete = true;
  28 + var $bIsComplex = false;
25 29  
26 30 var $_bUsePearError = true;
27 31  
... ... @@ -39,6 +43,10 @@ class KTFieldset extends KTEntity {
39 43 function setMasterFieldId ($iNewValue) { $this->iMasterFieldId = $iNewValue; }
40 44 function getIsGeneric () { return $this->bIsGeneric; }
41 45 function setIsGeneric ($bNewValue) { $this->bIsGeneric = $bNewValue; }
  46 + function getIsComplete () { return $this->bIsComplete; }
  47 + function setIsComplete ($bNewValue) { $this->bIsComplete = $bNewValue; }
  48 + function getIsComplex () { return $this->bIsComplex; }
  49 + function setIsComplex ($bNewValue) { $this->bIsComplex = $bNewValue; }
42 50  
43 51 var $_aFieldToSelect = array(
44 52 "iId" => "id",
... ... @@ -48,6 +56,8 @@ class KTFieldset extends KTEntity {
48 56 "bIsConditional" => "is_conditional",
49 57 "iMasterFieldId" => "master_field",
50 58 "bIsGeneric" => "is_generic",
  59 + "bIsComplete" => "is_complete",
  60 + "bIsComplex" => "is_complex",
51 61 );
52 62  
53 63 // returns TRUE if all children are lookup enabled, false otherwise.
... ... @@ -109,6 +119,12 @@ class KTFieldset extends KTEntity {
109 119 function &getFields() {
110 120 return DocumentField::getByFieldset($this);
111 121 }
  122 +
  123 + function &getByField($oField) {
  124 + $oField =& KTUtil::getObject('DocumentField', $oField);
  125 + $iFieldsetId = $oField->getParentFieldsetId();
  126 + return KTFieldset::get($iFieldsetId);
  127 + }
112 128 }
113 129  
114 130 ?>
... ...