public function btnEdit_Click($strFormId, $strControlId, $strParameter) { $strParameterArray = explode(',', $strParameter); $objAuthorizationLevel = AuthorizationLevel::Load($strParameterArray[0]); $objEditPanel = new AuthorizationLevelEditPanel($this, $this->strCloseEditPanelMethod, $objAuthorizationLevel); $strMethodName = $this->strSetEditPanelMethod; $this->objForm->{$strMethodName}($objEditPanel); }
protected function SetupAuthorizationLevel() { // Lookup Object PK information from Query String (if applicable) // Set mode to Edit or New depending on what's found $intAuthorizationLevelId = QApplication::QueryString('intAuthorizationLevelId'); if ($intAuthorizationLevelId) { $this->objAuthorizationLevel = AuthorizationLevel::Load($intAuthorizationLevelId); if (!$this->objAuthorizationLevel) { throw new Exception('Could not find a AuthorizationLevel object with PK arguments: ' . $intAuthorizationLevelId); } $this->strTitleVerb = QApplication::Translate('Edit'); $this->blnEditMode = true; } else { $this->objAuthorizationLevel = new AuthorizationLevel(); $this->strTitleVerb = QApplication::Translate('Create'); $this->blnEditMode = false; } }
/** * 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 'RoleTransactionTypeAuthorizationId': // Gets the value for intRoleTransactionTypeAuthorizationId (Read-Only PK) // @return integer return $this->intRoleTransactionTypeAuthorizationId; case 'RoleId': // Gets the value for intRoleId (Not Null) // @return integer return $this->intRoleId; case 'TransactionTypeId': // Gets the value for intTransactionTypeId (Not Null) // @return integer return $this->intTransactionTypeId; case 'AuthorizationLevelId': // Gets the value for intAuthorizationLevelId (Not Null) // @return integer return $this->intAuthorizationLevelId; case 'CreatedBy': // Gets the value for intCreatedBy // @return integer return $this->intCreatedBy; case 'CreationDate': // Gets the value for dttCreationDate // @return QDateTime return $this->dttCreationDate; case 'ModifiedBy': // Gets the value for intModifiedBy // @return integer return $this->intModifiedBy; case 'ModifiedDate': // Gets the value for strModifiedDate (Read-Only Timestamp) // @return string return $this->strModifiedDate; /////////////////// // Member Objects /////////////////// /////////////////// // Member Objects /////////////////// case 'Role': // Gets the value for the Role object referenced by intRoleId (Not Null) // @return Role try { if (!$this->objRole && !is_null($this->intRoleId)) { $this->objRole = Role::Load($this->intRoleId); } return $this->objRole; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'TransactionType': // Gets the value for the TransactionType object referenced by intTransactionTypeId (Not Null) // @return TransactionType try { if (!$this->objTransactionType && !is_null($this->intTransactionTypeId)) { $this->objTransactionType = TransactionType::Load($this->intTransactionTypeId); } return $this->objTransactionType; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'AuthorizationLevel': // Gets the value for the AuthorizationLevel object referenced by intAuthorizationLevelId (Not Null) // @return AuthorizationLevel try { if (!$this->objAuthorizationLevel && !is_null($this->intAuthorizationLevelId)) { $this->objAuthorizationLevel = AuthorizationLevel::Load($this->intAuthorizationLevelId); } return $this->objAuthorizationLevel; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'CreatedByObject': // Gets the value for the UserAccount object referenced by intCreatedBy // @return UserAccount try { if (!$this->objCreatedByObject && !is_null($this->intCreatedBy)) { $this->objCreatedByObject = UserAccount::Load($this->intCreatedBy); } return $this->objCreatedByObject; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'ModifiedByObject': // Gets the value for the UserAccount object referenced by intModifiedBy // @return UserAccount try { if (!$this->objModifiedByObject && !is_null($this->intModifiedBy)) { $this->objModifiedByObject = UserAccount::Load($this->intModifiedBy); } return $this->objModifiedByObject; } 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; } } }
/** * 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 AuthorizationLevelMetaControl * @param integer $intAuthorizationLevelId primary key value * @param QMetaControlCreateType $intCreateType rules governing AuthorizationLevel object creation - defaults to CreateOrEdit * @return AuthorizationLevelMetaControl */ public static function Create($objParentObject, $intAuthorizationLevelId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit) { // Attempt to Load from PK Arguments if (strlen($intAuthorizationLevelId)) { $objAuthorizationLevel = AuthorizationLevel::Load($intAuthorizationLevelId); // AuthorizationLevel was found -- return it! if ($objAuthorizationLevel) { return new AuthorizationLevelMetaControl($objParentObject, $objAuthorizationLevel); } else { if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound) { throw new QCallerException('Could not find a AuthorizationLevel object with PK arguments: ' . $intAuthorizationLevelId); } } // 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 AuthorizationLevelMetaControl($objParentObject, new AuthorizationLevel()); }
/** * 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 'RoleModuleAuthorizationId': /** * Gets the value for intRoleModuleAuthorizationId (Read-Only PK) * @return integer */ return $this->intRoleModuleAuthorizationId; case 'RoleModuleId': /** * Gets the value for intRoleModuleId * @return integer */ return $this->intRoleModuleId; case 'AuthorizationId': /** * Gets the value for intAuthorizationId * @return integer */ return $this->intAuthorizationId; case 'AuthorizationLevelId': /** * Gets the value for intAuthorizationLevelId * @return integer */ return $this->intAuthorizationLevelId; case 'CreatedBy': /** * Gets the value for intCreatedBy * @return integer */ return $this->intCreatedBy; case 'CreationDate': /** * Gets the value for dttCreationDate * @return QDateTime */ return $this->dttCreationDate; case 'ModifiedBy': /** * Gets the value for intModifiedBy * @return integer */ return $this->intModifiedBy; case 'ModifiedDate': /** * Gets the value for strModifiedDate (Read-Only Timestamp) * @return string */ return $this->strModifiedDate; /////////////////// // Member Objects /////////////////// /////////////////// // Member Objects /////////////////// case 'RoleModule': /** * Gets the value for the RoleModule object referenced by intRoleModuleId * @return RoleModule */ try { if (!$this->objRoleModule && !is_null($this->intRoleModuleId)) { $this->objRoleModule = RoleModule::Load($this->intRoleModuleId); } return $this->objRoleModule; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'Authorization': /** * Gets the value for the Authorization object referenced by intAuthorizationId * @return Authorization */ try { if (!$this->objAuthorization && !is_null($this->intAuthorizationId)) { $this->objAuthorization = Authorization::Load($this->intAuthorizationId); } return $this->objAuthorization; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'AuthorizationLevel': /** * Gets the value for the AuthorizationLevel object referenced by intAuthorizationLevelId * @return AuthorizationLevel */ try { if (!$this->objAuthorizationLevel && !is_null($this->intAuthorizationLevelId)) { $this->objAuthorizationLevel = AuthorizationLevel::Load($this->intAuthorizationLevelId); } return $this->objAuthorizationLevel; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'CreatedByObject': /** * Gets the value for the UserAccount object referenced by intCreatedBy * @return UserAccount */ try { if (!$this->objCreatedByObject && !is_null($this->intCreatedBy)) { $this->objCreatedByObject = UserAccount::Load($this->intCreatedBy); } return $this->objCreatedByObject; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'ModifiedByObject': /** * Gets the value for the UserAccount object referenced by intModifiedBy * @return UserAccount */ try { if (!$this->objModifiedByObject && !is_null($this->intModifiedBy)) { $this->objModifiedByObject = UserAccount::Load($this->intModifiedBy); } return $this->objModifiedByObject; } 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) //////////////////////////// default: try { return parent::__get($strName); } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } } }
/** * Reload this AuthorizationLevel 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 AuthorizationLevel object.'); } // Reload the Object $objReloaded = AuthorizationLevel::Load($this->intAuthorizationLevelId); // Update $this's local variables to match $this->strShortDescription = $objReloaded->strShortDescription; }