コード例 #1
0
 /**
  * This will save this object's Marriage instance,
  * updating only the fields which have had a control created for it.
  */
 public function SaveMarriage()
 {
     try {
         // Update any fields for controls that have been created
         if ($this->lstLinkedMarriage) {
             $this->objMarriage->LinkedMarriageId = $this->lstLinkedMarriage->SelectedValue;
         }
         if ($this->lstPerson) {
             $this->objMarriage->PersonId = $this->lstPerson->SelectedValue;
         }
         if ($this->lstMarriedToPerson) {
             $this->objMarriage->MarriedToPersonId = $this->lstMarriedToPerson->SelectedValue;
         }
         if ($this->lstMarriageStatusType) {
             $this->objMarriage->MarriageStatusTypeId = $this->lstMarriageStatusType->SelectedValue;
         }
         if ($this->calDateStart) {
             $this->objMarriage->DateStart = $this->calDateStart->DateTime;
         }
         if ($this->calDateEnd) {
             $this->objMarriage->DateEnd = $this->calDateEnd->DateTime;
         }
         // Update any UniqueReverseReferences (if any) for controls that have been created for it
         if ($this->lstMarriageAsLinked) {
             $this->objMarriage->MarriageAsLinked = Marriage::Load($this->lstMarriageAsLinked->SelectedValue);
         }
         // Save the Marriage object
         $this->objMarriage->Save();
         // Finally, update any ManyToManyReferences (if any)
     } catch (QCallerException $objExc) {
         $objExc->IncrementOffset();
         throw $objExc;
     }
 }
コード例 #2
0
ファイル: MarriageGen.class.php プロジェクト: alcf/chms
 /**
  * Override method to perform a property "Get"
  * This will get the value of $strName
  *
  * @param string $strName Name of the property to get
  * @return mixed
  */
 public function __get($strName)
 {
     switch ($strName) {
         ///////////////////
         // Member Variables
         ///////////////////
         case 'Id':
             // Gets the value for intId (Read-Only PK)
             // @return integer
             return $this->intId;
         case 'LinkedMarriageId':
             // Gets the value for intLinkedMarriageId (Unique)
             // @return integer
             return $this->intLinkedMarriageId;
         case 'PersonId':
             // Gets the value for intPersonId (Not Null)
             // @return integer
             return $this->intPersonId;
         case 'MarriedToPersonId':
             // Gets the value for intMarriedToPersonId
             // @return integer
             return $this->intMarriedToPersonId;
         case 'MarriageStatusTypeId':
             // Gets the value for intMarriageStatusTypeId (Not Null)
             // @return integer
             return $this->intMarriageStatusTypeId;
         case 'DateStart':
             // Gets the value for dttDateStart
             // @return QDateTime
             return $this->dttDateStart;
         case 'DateEnd':
             // Gets the value for dttDateEnd
             // @return QDateTime
             return $this->dttDateEnd;
             ///////////////////
             // Member Objects
             ///////////////////
         ///////////////////
         // Member Objects
         ///////////////////
         case 'LinkedMarriage':
             // Gets the value for the Marriage object referenced by intLinkedMarriageId (Unique)
             // @return Marriage
             try {
                 if (!$this->objLinkedMarriage && !is_null($this->intLinkedMarriageId)) {
                     $this->objLinkedMarriage = Marriage::Load($this->intLinkedMarriageId);
                 }
                 return $this->objLinkedMarriage;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'Person':
             // Gets the value for the Person object referenced by intPersonId (Not Null)
             // @return Person
             try {
                 if (!$this->objPerson && !is_null($this->intPersonId)) {
                     $this->objPerson = Person::Load($this->intPersonId);
                 }
                 return $this->objPerson;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'MarriedToPerson':
             // Gets the value for the Person object referenced by intMarriedToPersonId
             // @return Person
             try {
                 if (!$this->objMarriedToPerson && !is_null($this->intMarriedToPersonId)) {
                     $this->objMarriedToPerson = Person::Load($this->intMarriedToPersonId);
                 }
                 return $this->objMarriedToPerson;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'MarriageAsLinked':
             // Gets the value for the Marriage object that uniquely references this Marriage
             // by objMarriageAsLinked (Unique)
             // @return Marriage
             try {
                 if ($this->objMarriageAsLinked === false) {
                     // We've attempted early binding -- and the reverse reference object does not exist
                     return null;
                 }
                 if (!$this->objMarriageAsLinked) {
                     $this->objMarriageAsLinked = Marriage::LoadByLinkedMarriageId($this->intId);
                 }
                 return $this->objMarriageAsLinked;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
             ////////////////////////////
             // Virtual Object References (Many to Many and Reverse References)
             // (If restored via a "Many-to" expansion)
             ////////////////////////////
         ////////////////////////////
         // Virtual Object References (Many to Many and Reverse References)
         // (If restored via a "Many-to" expansion)
         ////////////////////////////
         case '__Restored':
             return $this->__blnRestored;
         default:
             try {
                 return parent::__get($strName);
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
     }
 }
コード例 #3
0
 protected function SetupPanel()
 {
     // Get and Validate the Marriage Object
     $this->objMarriage = Marriage::Load($this->strUrlHashArgument);
     if (!$this->objMarriage) {
         // Trying to create a NEW marriage
         // Let's make sure this person doesn't have a current marriage
         $this->objPerson->RefreshMaritalStatusTypeId();
         switch ($this->objPerson->MaritalStatusTypeId) {
             case MaritalStatusType::Married:
             case MaritalStatusType::Separated:
                 return $this->ReturnTo('#general/view_marriage');
         }
         $this->objMarriage = new Marriage();
         $this->objMarriage->Person = $this->objPerson;
         $this->blnEditMode = false;
         $this->btnSave->Text = 'Create';
     } else {
         // Ensure the Membership object belongs to the person
         if ($this->objMarriage->PersonId != $this->objPerson->Id) {
             return $this->ReturnTo('#general/view_marriage');
         }
         $this->blnEditMode = true;
         $this->btnSave->Text = 'Update';
         $this->btnDelete = new QLinkButton($this);
         $this->btnDelete->Text = 'Delete';
         $this->btnDelete->CssClass = 'delete';
         $this->btnDelete->AddAction(new QClickEvent(), new QConfirmAction('Are you SURE you want to permenantly DELETE this record?  (This should only be done if this record is a mistake/error.)'));
         $this->btnDelete->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnDelete_Click'));
         $this->btnDelete->AddAction(new QClickEvent(), new QTerminateAction());
     }
     // Create Controls
     $this->dtxDateStart = new QDateTimeTextBox($this);
     $this->dtxDateStart->Name = 'Marriage Started';
     $this->dtxDateStart->Text = $this->objMarriage->DateStart ? $this->objMarriage->DateStart->__toString() : null;
     $this->calDateStart = new QCalendar($this, $this->dtxDateStart);
     $this->dtxDateEnd = new QDateTimeTextBox($this);
     $this->dtxDateEnd->Name = 'Marriage Ended';
     $this->dtxDateEnd->Text = $this->objMarriage->DateEnd ? $this->objMarriage->DateEnd->__toString() : null;
     $this->calDateEnd = new QCalendar($this, $this->dtxDateEnd);
     $this->dtxDateStart->RemoveAllActions(QClickEvent::EventName);
     $this->dtxDateEnd->RemoveAllActions(QClickEvent::EventName);
     $this->lstStatus = new QListBox($this);
     $this->lstStatus->Name = 'Status';
     if (!$this->objMarriage->MarriageStatusTypeId) {
         $this->lstStatus->AddItem('- Select One -', null);
     }
     $this->lstStatus->Required = true;
     foreach (MarriageStatusType::$NameArray as $intId => $strName) {
         $this->lstStatus->AddItem($strName, $intId, $intId == $this->objMarriage->MarriageStatusTypeId);
     }
     // Create "Married To" Controls
     if ($this->objMarriage->MarriedToPerson) {
         $this->lblMarriedTo = new QLabel($this);
         $this->lblMarriedTo->Name = 'Married To';
         $this->lblMarriedTo->HtmlEntities = false;
         $this->lblMarriedTo->Text = $this->objMarriage->MarriedToPerson->LinkHtml;
     } else {
         $this->pnlMarriedTo = new SelectPersonPanel($this);
         $this->pnlMarriedTo->Name = 'Married To';
         $this->pnlMarriedTo->AllowCreate = true;
         switch ($this->objPerson->Gender) {
             case 'M':
                 $this->pnlMarriedTo->ForceAsMaleFlag = false;
             case 'F':
                 $this->pnlMarriedTo->ForceAsMaleFlag = true;
             default:
                 $this->pnlMarriedTo->ForceAsMaleFlag = null;
         }
     }
 }