/** * Static Helper Method to Create using PK arguments * You must pass in the PK arguments on an object to load, or leave it blank to create a new one. * If you want to load via QueryString or PathInfo, use the CreateFromQueryString or CreateFromPathInfo * static helper methods. Finally, specify a CreateType to define whether or not we are only allowed to * edit, or if we are also allowed to create a new one, etc. * * @param mixed $objParentObject QForm or QPanel which will be using this PublicLoginMetaControl * @param integer $intId primary key value * @param QMetaControlCreateType $intCreateType rules governing PublicLogin object creation - defaults to CreateOrEdit * @return PublicLoginMetaControl */ public static function Create($objParentObject, $intId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit) { // Attempt to Load from PK Arguments if (strlen($intId)) { $objPublicLogin = PublicLogin::Load($intId); // PublicLogin was found -- return it! if ($objPublicLogin) { return new PublicLoginMetaControl($objParentObject, $objPublicLogin); } else { if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound) { throw new QCallerException('Could not find a PublicLogin object with PK arguments: ' . $intId); } } // If EditOnly is specified, throw an exception } else { if ($intCreateType == QMetaControlCreateType::EditOnly) { throw new QCallerException('No PK arguments specified'); } } // If we are here, then we need to create a new record return new PublicLoginMetaControl($objParentObject, new PublicLogin()); }
/** * 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 'PublicLoginId': // Gets the value for intPublicLoginId (PK) // @return integer return $this->intPublicLoginId; case 'FirstName': // Gets the value for strFirstName // @return string return $this->strFirstName; case 'LastName': // Gets the value for strLastName // @return string return $this->strLastName; case 'EmailAddress': // Gets the value for strEmailAddress // @return string return $this->strEmailAddress; case 'UrlHash': // Gets the value for strUrlHash // @return string return $this->strUrlHash; case 'ConfirmationCode': // Gets the value for strConfirmationCode // @return string return $this->strConfirmationCode; /////////////////// // Member Objects /////////////////// /////////////////// // Member Objects /////////////////// case 'PublicLogin': // Gets the value for the PublicLogin object referenced by intPublicLoginId (PK) // @return PublicLogin try { if (!$this->objPublicLogin && !is_null($this->intPublicLoginId)) { $this->objPublicLogin = PublicLogin::Load($this->intPublicLoginId); } return $this->objPublicLogin; } 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; } } }
/** * Reload this PublicLogin from the database. * @return void */ public function Reload() { // Make sure we are actually Restored from the database if (!$this->__blnRestored) { throw new QCallerException('Cannot call Reload() on a new, unsaved PublicLogin object.'); } // Reload the Object $objReloaded = PublicLogin::Load($this->intId); // Update $this's local variables to match $this->PersonId = $objReloaded->PersonId; $this->blnActiveFlag = $objReloaded->blnActiveFlag; $this->strUsername = $objReloaded->strUsername; $this->strPassword = $objReloaded->strPassword; $this->strLostPasswordQuestion = $objReloaded->strLostPasswordQuestion; $this->strLostPasswordAnswer = $objReloaded->strLostPasswordAnswer; $this->blnTemporaryPasswordFlag = $objReloaded->blnTemporaryPasswordFlag; $this->dttDateRegistered = $objReloaded->dttDateRegistered; $this->dttDateLastLogin = $objReloaded->dttDateLastLogin; }
/** * This will save this object's Person instance, * updating only the fields which have had a control created for it. */ public function SavePerson() { try { // Update any fields for controls that have been created if ($this->lstMembershipStatusType) { $this->objPerson->MembershipStatusTypeId = $this->lstMembershipStatusType->SelectedValue; } if ($this->lstMaritalStatusType) { $this->objPerson->MaritalStatusTypeId = $this->lstMaritalStatusType->SelectedValue; } if ($this->txtFirstName) { $this->objPerson->FirstName = $this->txtFirstName->Text; } if ($this->txtMiddleName) { $this->objPerson->MiddleName = $this->txtMiddleName->Text; } if ($this->txtLastName) { $this->objPerson->LastName = $this->txtLastName->Text; } if ($this->txtMailingLabel) { $this->objPerson->MailingLabel = $this->txtMailingLabel->Text; } if ($this->txtPriorLastNames) { $this->objPerson->PriorLastNames = $this->txtPriorLastNames->Text; } if ($this->txtNickname) { $this->objPerson->Nickname = $this->txtNickname->Text; } if ($this->txtTitle) { $this->objPerson->Title = $this->txtTitle->Text; } if ($this->txtSuffix) { $this->objPerson->Suffix = $this->txtSuffix->Text; } if ($this->txtGender) { $this->objPerson->Gender = $this->txtGender->Text; } if ($this->calDateOfBirth) { $this->objPerson->DateOfBirth = $this->calDateOfBirth->DateTime; } if ($this->chkDobYearApproximateFlag) { $this->objPerson->DobYearApproximateFlag = $this->chkDobYearApproximateFlag->Checked; } if ($this->chkDobGuessedFlag) { $this->objPerson->DobGuessedFlag = $this->chkDobGuessedFlag->Checked; } if ($this->txtAge) { $this->objPerson->Age = $this->txtAge->Text; } if ($this->chkDeceasedFlag) { $this->objPerson->DeceasedFlag = $this->chkDeceasedFlag->Checked; } if ($this->calDateDeceased) { $this->objPerson->DateDeceased = $this->calDateDeceased->DateTime; } if ($this->lstCurrentHeadShot) { $this->objPerson->CurrentHeadShotId = $this->lstCurrentHeadShot->SelectedValue; } if ($this->lstMailingAddress) { $this->objPerson->MailingAddressId = $this->lstMailingAddress->SelectedValue; } if ($this->lstStewardshipAddress) { $this->objPerson->StewardshipAddressId = $this->lstStewardshipAddress->SelectedValue; } if ($this->lstPrimaryPhone) { $this->objPerson->PrimaryPhoneId = $this->lstPrimaryPhone->SelectedValue; } if ($this->lstPrimaryEmail) { $this->objPerson->PrimaryEmailId = $this->lstPrimaryEmail->SelectedValue; } if ($this->chkCanMailFlag) { $this->objPerson->CanMailFlag = $this->chkCanMailFlag->Checked; } if ($this->chkCanPhoneFlag) { $this->objPerson->CanPhoneFlag = $this->chkCanPhoneFlag->Checked; } if ($this->chkCanEmailFlag) { $this->objPerson->CanEmailFlag = $this->chkCanEmailFlag->Checked; } if ($this->txtPrimaryAddressText) { $this->objPerson->PrimaryAddressText = $this->txtPrimaryAddressText->Text; } if ($this->txtPrimaryCityText) { $this->objPerson->PrimaryCityText = $this->txtPrimaryCityText->Text; } if ($this->txtPrimaryStateText) { $this->objPerson->PrimaryStateText = $this->txtPrimaryStateText->Text; } if ($this->txtPrimaryZipCodeText) { $this->objPerson->PrimaryZipCodeText = $this->txtPrimaryZipCodeText->Text; } if ($this->txtPrimaryPhoneText) { $this->objPerson->PrimaryPhoneText = $this->txtPrimaryPhoneText->Text; } if ($this->chkPublicCreationFlag) { $this->objPerson->PublicCreationFlag = $this->chkPublicCreationFlag->Checked; } if ($this->lstCoPrimaryObject) { $this->objPerson->CoPrimary = $this->lstCoPrimaryObject->SelectedValue; } // Update any UniqueReverseReferences (if any) for controls that have been created for it if ($this->lstHouseholdAsHead) { $this->objPerson->HouseholdAsHead = Household::Load($this->lstHouseholdAsHead->SelectedValue); } if ($this->lstPublicLogin) { $this->objPerson->PublicLogin = PublicLogin::Load($this->lstPublicLogin->SelectedValue); } // Save the Person object $this->objPerson->Save(); // Finally, update any ManyToManyReferences (if any) $this->lstCheckingAccountLookups_Update(); $this->lstCommunicationLists_Update(); $this->lstNameItems_Update(); } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } }