protected function SetupEntityQtypeCustomField() { // Lookup Object PK information from Query String (if applicable) // Set mode to Edit or New depending on what's found $intEntityQtypeCustomFieldId = QApplication::QueryString('intEntityQtypeCustomFieldId'); if ($intEntityQtypeCustomFieldId) { $this->objEntityQtypeCustomField = EntityQtypeCustomField::Load($intEntityQtypeCustomFieldId); if (!$this->objEntityQtypeCustomField) { throw new Exception('Could not find a EntityQtypeCustomField object with PK arguments: ' . $intEntityQtypeCustomFieldId); } $this->strTitleVerb = QApplication::Translate('Edit'); $this->blnEditMode = true; } else { $this->objEntityQtypeCustomField = new EntityQtypeCustomField(); $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 'RoleEntityQtypeCustomFieldAuthorizationId': // Gets the value for intRoleEntityQtypeCustomFieldAuthorizationId (Read-Only PK) // @return integer return $this->intRoleEntityQtypeCustomFieldAuthorizationId; case 'RoleId': // Gets the value for intRoleId (Not Null) // @return integer return $this->intRoleId; case 'EntityQtypeCustomFieldId': // Gets the value for intEntityQtypeCustomFieldId (Not Null) // @return integer return $this->intEntityQtypeCustomFieldId; case 'AuthorizationId': // Gets the value for intAuthorizationId (Not Null) // @return integer return $this->intAuthorizationId; case 'AuthorizedFlag': // Gets the value for blnAuthorizedFlag (Not Null) // @return boolean return $this->blnAuthorizedFlag; 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 'EntityQtypeCustomField': // Gets the value for the EntityQtypeCustomField object referenced by intEntityQtypeCustomFieldId (Not Null) // @return EntityQtypeCustomField try { if (!$this->objEntityQtypeCustomField && !is_null($this->intEntityQtypeCustomFieldId)) { $this->objEntityQtypeCustomField = EntityQtypeCustomField::Load($this->intEntityQtypeCustomFieldId); } return $this->objEntityQtypeCustomField; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'Authorization': // Gets the value for the Authorization object referenced by intAuthorizationId (Not Null) // @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 '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; } } }
/** * Reload this EntityQtypeCustomField 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 EntityQtypeCustomField object.'); } // Reload the Object $objReloaded = EntityQtypeCustomField::Load($this->intEntityQtypeCustomFieldId); // Update $this's local variables to match $this->EntityQtypeId = $objReloaded->EntityQtypeId; $this->CustomFieldId = $objReloaded->CustomFieldId; }
public function btnEdit_Click($strFormId, $strControlId, $strParameter) { $strParameterArray = explode(',', $strParameter); $objEntityQtypeCustomField = EntityQtypeCustomField::Load($strParameterArray[0]); $objEditPanel = new EntityQtypeCustomFieldEditPanel($this, $this->strCloseEditPanelMethod, $objEntityQtypeCustomField); $strMethodName = $this->strSetEditPanelMethod; $this->objForm->{$strMethodName}($objEditPanel); }
/** * 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 EntityQtypeCustomFieldMetaControl * @param integer $intEntityQtypeCustomFieldId primary key value * @param QMetaControlCreateType $intCreateType rules governing EntityQtypeCustomField object creation - defaults to CreateOrEdit * @return EntityQtypeCustomFieldMetaControl */ public static function Create($objParentObject, $intEntityQtypeCustomFieldId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit) { // Attempt to Load from PK Arguments if (strlen($intEntityQtypeCustomFieldId)) { $objEntityQtypeCustomField = EntityQtypeCustomField::Load($intEntityQtypeCustomFieldId); // EntityQtypeCustomField was found -- return it! if ($objEntityQtypeCustomField) { return new EntityQtypeCustomFieldMetaControl($objParentObject, $objEntityQtypeCustomField); } else { if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound) { throw new QCallerException('Could not find a EntityQtypeCustomField object with PK arguments: ' . $intEntityQtypeCustomFieldId); } } // 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 EntityQtypeCustomFieldMetaControl($objParentObject, new EntityQtypeCustomField()); }