protected function SetupRoleModule()
 {
     // Lookup Object PK information from Query String (if applicable)
     // Set mode to Edit or New depending on what's found
     $intRoleModuleId = QApplication::QueryString('intRoleModuleId');
     if ($intRoleModuleId) {
         $this->objRoleModule = RoleModule::Load($intRoleModuleId);
         if (!$this->objRoleModule) {
             throw new Exception('Could not find a RoleModule object with PK arguments: ' . $intRoleModuleId);
         }
         $this->strTitleVerb = QApplication::Translate('Edit');
         $this->blnEditMode = true;
     } else {
         $this->objRoleModule = new RoleModule();
         $this->strTitleVerb = QApplication::Translate('Create');
         $this->blnEditMode = false;
     }
 }
 public function btnEdit_Click($strFormId, $strControlId, $strParameter)
 {
     $strParameterArray = explode(',', $strParameter);
     $objRoleModule = RoleModule::Load($strParameterArray[0]);
     $objEditPanel = new RoleModuleEditPanel($this, $this->strCloseEditPanelMethod, $objRoleModule);
     $strMethodName = $this->strSetEditPanelMethod;
     $this->objForm->{$strMethodName}($objEditPanel);
 }
 /**
  * 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;
             }
     }
 }
 /**
  * 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 RoleModuleMetaControl
  * @param integer $intRoleModuleId primary key value
  * @param QMetaControlCreateType $intCreateType rules governing RoleModule object creation - defaults to CreateOrEdit
  * @return RoleModuleMetaControl
  */
 public static function Create($objParentObject, $intRoleModuleId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit)
 {
     // Attempt to Load from PK Arguments
     if (strlen($intRoleModuleId)) {
         $objRoleModule = RoleModule::Load($intRoleModuleId);
         // RoleModule was found -- return it!
         if ($objRoleModule) {
             return new RoleModuleMetaControl($objParentObject, $objRoleModule);
         } else {
             if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound) {
                 throw new QCallerException('Could not find a RoleModule object with PK arguments: ' . $intRoleModuleId);
             }
         }
         // 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 RoleModuleMetaControl($objParentObject, new RoleModule());
 }
Ejemplo n.º 5
0
 /**
  * Reload this RoleModule 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 RoleModule object.');
     }
     // Reload the Object
     $objReloaded = RoleModule::Load($this->intRoleModuleId);
     // Update $this's local variables to match
     $this->RoleId = $objReloaded->RoleId;
     $this->ModuleId = $objReloaded->ModuleId;
     $this->blnAccessFlag = $objReloaded->blnAccessFlag;
     $this->CreatedBy = $objReloaded->CreatedBy;
     $this->dttCreationDate = $objReloaded->dttCreationDate;
     $this->ModifiedBy = $objReloaded->ModifiedBy;
     $this->strModifiedDate = $objReloaded->strModifiedDate;
 }