protected function Form_Create() { $this->objProvisionalPublicLogin = ProvisionalPublicLogin::Load(QApplication::PathInfo(0)); if (!$this->objProvisionalPublicLogin || $this->objProvisionalPublicLogin->UrlHash != QApplication::PathInfo(1)) { QApplication::Redirect('/register/'); } }
/** * This will save this object's PublicLogin instance, * updating only the fields which have had a control created for it. */ public function SavePublicLogin() { try { // Update any fields for controls that have been created if ($this->lstPerson) { $this->objPublicLogin->PersonId = $this->lstPerson->SelectedValue; } if ($this->chkActiveFlag) { $this->objPublicLogin->ActiveFlag = $this->chkActiveFlag->Checked; } if ($this->txtUsername) { $this->objPublicLogin->Username = $this->txtUsername->Text; } if ($this->txtPassword) { $this->objPublicLogin->Password = $this->txtPassword->Text; } if ($this->txtLostPasswordQuestion) { $this->objPublicLogin->LostPasswordQuestion = $this->txtLostPasswordQuestion->Text; } if ($this->txtLostPasswordAnswer) { $this->objPublicLogin->LostPasswordAnswer = $this->txtLostPasswordAnswer->Text; } if ($this->chkTemporaryPasswordFlag) { $this->objPublicLogin->TemporaryPasswordFlag = $this->chkTemporaryPasswordFlag->Checked; } if ($this->calDateRegistered) { $this->objPublicLogin->DateRegistered = $this->calDateRegistered->DateTime; } if ($this->calDateLastLogin) { $this->objPublicLogin->DateLastLogin = $this->calDateLastLogin->DateTime; } // Update any UniqueReverseReferences (if any) for controls that have been created for it if ($this->lstProvisionalPublicLogin) { $this->objPublicLogin->ProvisionalPublicLogin = ProvisionalPublicLogin::Load($this->lstProvisionalPublicLogin->SelectedValue); } // Save the PublicLogin object $this->objPublicLogin->Save(); // Finally, update any ManyToManyReferences (if any) } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } }
/** * Reload this ProvisionalPublicLogin 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 ProvisionalPublicLogin object.'); } // Reload the Object $objReloaded = ProvisionalPublicLogin::Load($this->intPublicLoginId); // Update $this's local variables to match $this->PublicLoginId = $objReloaded->PublicLoginId; $this->__intPublicLoginId = $this->intPublicLoginId; $this->strFirstName = $objReloaded->strFirstName; $this->strLastName = $objReloaded->strLastName; $this->strEmailAddress = $objReloaded->strEmailAddress; $this->strUrlHash = $objReloaded->strUrlHash; $this->strConfirmationCode = $objReloaded->strConfirmationCode; }
/** * 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 ProvisionalPublicLoginMetaControl * @param integer $intPublicLoginId primary key value * @param QMetaControlCreateType $intCreateType rules governing ProvisionalPublicLogin object creation - defaults to CreateOrEdit * @return ProvisionalPublicLoginMetaControl */ public static function Create($objParentObject, $intPublicLoginId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit) { // Attempt to Load from PK Arguments if (strlen($intPublicLoginId)) { $objProvisionalPublicLogin = ProvisionalPublicLogin::Load($intPublicLoginId); // ProvisionalPublicLogin was found -- return it! if ($objProvisionalPublicLogin) { return new ProvisionalPublicLoginMetaControl($objParentObject, $objProvisionalPublicLogin); } else { if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound) { throw new QCallerException('Could not find a ProvisionalPublicLogin object with PK arguments: ' . $intPublicLoginId); } } // 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 ProvisionalPublicLoginMetaControl($objParentObject, new ProvisionalPublicLogin()); }