protected function dtgAuthorization_Bind()
 {
     // Because we want to enable pagination AND sorting, we need to setup the $objClauses array to send to LoadAll()
     // Remember!  We need to first set the TotalItemCount, which will affect the calcuation of LimitClause below
     $this->dtgAuthorization->TotalItemCount = Authorization::CountAll();
     // Setup the $objClauses Array
     $objClauses = array();
     // If a column is selected to be sorted, and if that column has a OrderByClause set on it, then let's add
     // the OrderByClause to the $objClauses array
     if ($objClause = $this->dtgAuthorization->OrderByClause) {
         array_push($objClauses, $objClause);
     }
     // Add the LimitClause information, as well
     if ($objClause = $this->dtgAuthorization->LimitClause) {
         array_push($objClauses, $objClause);
     }
     // Set the DataSource to be the array of all Authorization objects, given the clauses above
     $this->dtgAuthorization->DataSource = Authorization::LoadAll($objClauses);
 }
 /**
  * Refresh this MetaControl with Data from the local RoleModuleAuthorization object.
  * @param boolean $blnReload reload RoleModuleAuthorization from the database
  * @return void
  */
 public function Refresh($blnReload = false)
 {
     if ($blnReload) {
         $this->objRoleModuleAuthorization->Reload();
     }
     if ($this->lblRoleModuleAuthorizationId) {
         if ($this->blnEditMode) {
             $this->lblRoleModuleAuthorizationId->Text = $this->objRoleModuleAuthorization->RoleModuleAuthorizationId;
         }
     }
     if ($this->lstRoleModule) {
         $this->lstRoleModule->RemoveAllItems();
         $this->lstRoleModule->AddItem(QApplication::Translate('- Select One -'), null);
         $objRoleModuleArray = RoleModule::LoadAll();
         if ($objRoleModuleArray) {
             foreach ($objRoleModuleArray as $objRoleModule) {
                 $objListItem = new QListItem($objRoleModule->__toString(), $objRoleModule->RoleModuleId);
                 if ($this->objRoleModuleAuthorization->RoleModule && $this->objRoleModuleAuthorization->RoleModule->RoleModuleId == $objRoleModule->RoleModuleId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstRoleModule->AddItem($objListItem);
             }
         }
     }
     if ($this->lblRoleModuleId) {
         $this->lblRoleModuleId->Text = $this->objRoleModuleAuthorization->RoleModule ? $this->objRoleModuleAuthorization->RoleModule->__toString() : null;
     }
     if ($this->lstAuthorization) {
         $this->lstAuthorization->RemoveAllItems();
         $this->lstAuthorization->AddItem(QApplication::Translate('- Select One -'), null);
         $objAuthorizationArray = Authorization::LoadAll();
         if ($objAuthorizationArray) {
             foreach ($objAuthorizationArray as $objAuthorization) {
                 $objListItem = new QListItem($objAuthorization->__toString(), $objAuthorization->AuthorizationId);
                 if ($this->objRoleModuleAuthorization->Authorization && $this->objRoleModuleAuthorization->Authorization->AuthorizationId == $objAuthorization->AuthorizationId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstAuthorization->AddItem($objListItem);
             }
         }
     }
     if ($this->lblAuthorizationId) {
         $this->lblAuthorizationId->Text = $this->objRoleModuleAuthorization->Authorization ? $this->objRoleModuleAuthorization->Authorization->__toString() : null;
     }
     if ($this->lstAuthorizationLevel) {
         $this->lstAuthorizationLevel->RemoveAllItems();
         $this->lstAuthorizationLevel->AddItem(QApplication::Translate('- Select One -'), null);
         $objAuthorizationLevelArray = AuthorizationLevel::LoadAll();
         if ($objAuthorizationLevelArray) {
             foreach ($objAuthorizationLevelArray as $objAuthorizationLevel) {
                 $objListItem = new QListItem($objAuthorizationLevel->__toString(), $objAuthorizationLevel->AuthorizationLevelId);
                 if ($this->objRoleModuleAuthorization->AuthorizationLevel && $this->objRoleModuleAuthorization->AuthorizationLevel->AuthorizationLevelId == $objAuthorizationLevel->AuthorizationLevelId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstAuthorizationLevel->AddItem($objListItem);
             }
         }
     }
     if ($this->lblAuthorizationLevelId) {
         $this->lblAuthorizationLevelId->Text = $this->objRoleModuleAuthorization->AuthorizationLevel ? $this->objRoleModuleAuthorization->AuthorizationLevel->__toString() : null;
     }
     if ($this->lstCreatedByObject) {
         $this->lstCreatedByObject->RemoveAllItems();
         $this->lstCreatedByObject->AddItem(QApplication::Translate('- Select One -'), null);
         $objCreatedByObjectArray = UserAccount::LoadAll();
         if ($objCreatedByObjectArray) {
             foreach ($objCreatedByObjectArray as $objCreatedByObject) {
                 $objListItem = new QListItem($objCreatedByObject->__toString(), $objCreatedByObject->UserAccountId);
                 if ($this->objRoleModuleAuthorization->CreatedByObject && $this->objRoleModuleAuthorization->CreatedByObject->UserAccountId == $objCreatedByObject->UserAccountId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstCreatedByObject->AddItem($objListItem);
             }
         }
     }
     if ($this->lblCreatedBy) {
         $this->lblCreatedBy->Text = $this->objRoleModuleAuthorization->CreatedByObject ? $this->objRoleModuleAuthorization->CreatedByObject->__toString() : null;
     }
     if ($this->calCreationDate) {
         $this->calCreationDate->DateTime = $this->objRoleModuleAuthorization->CreationDate;
     }
     if ($this->lblCreationDate) {
         $this->lblCreationDate->Text = sprintf($this->objRoleModuleAuthorization->CreationDate) ? $this->objRoleModuleAuthorization->__toString($this->strCreationDateDateTimeFormat) : null;
     }
     if ($this->lstModifiedByObject) {
         $this->lstModifiedByObject->RemoveAllItems();
         $this->lstModifiedByObject->AddItem(QApplication::Translate('- Select One -'), null);
         $objModifiedByObjectArray = UserAccount::LoadAll();
         if ($objModifiedByObjectArray) {
             foreach ($objModifiedByObjectArray as $objModifiedByObject) {
                 $objListItem = new QListItem($objModifiedByObject->__toString(), $objModifiedByObject->UserAccountId);
                 if ($this->objRoleModuleAuthorization->ModifiedByObject && $this->objRoleModuleAuthorization->ModifiedByObject->UserAccountId == $objModifiedByObject->UserAccountId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstModifiedByObject->AddItem($objListItem);
             }
         }
     }
     if ($this->lblModifiedBy) {
         $this->lblModifiedBy->Text = $this->objRoleModuleAuthorization->ModifiedByObject ? $this->objRoleModuleAuthorization->ModifiedByObject->__toString() : null;
     }
     if ($this->lblModifiedDate) {
         if ($this->blnEditMode) {
             $this->lblModifiedDate->Text = $this->objRoleModuleAuthorization->ModifiedDate;
         }
     }
 }
Ejemplo n.º 3
0
 protected function Form_Create()
 {
     //QApplication::$Database[1]->EnableProfiling();
     // Call SetupRole to either Load/Edit Existing or Create New
     $this->SetupRole();
     // Create the Header Menu
     $this->ctlHeaderMenu_Create();
     // Create/Setup Controls for Role's Data Fields
     $this->txtShortDescription_Create();
     $this->txtLongDescription_Create();
     $this->lblHeaderRole_Create();
     // Load an array of all modules
     //$this->objModuleArray = Module::LoadAll();
     $this->objModuleArray = Module::LoadAllButHome();
     // Load an array of all Authorization types
     $this->objAuthorizationArray = Authorization::LoadAll();
     // Create/Setup Controls for Authorizations
     $this->arrControls_Create();
     // Create/Setup Button Action controls
     $this->btnSave_Create();
     $this->btnCancel_Create();
     $this->btnDelete_Create();
     // Create/Setup Panel controls
     //Each Entity will have it's own Feld Level Authorization Grid.
     // The Field Level Authorization Grid will be a composite control instantiated 8 times.
     // The param is ModuleId
     $this->pnlAssets_Create(2);
     $this->pnlAssetModel_Create(2);
     $this->pnlInventory_Create(3);
     $this->pnlContact_Create(4);
     $this->pnlCompany_Create(4);
     $this->pnlAddress_Create(4);
     $this->pnlShipping_Create(5);
     $this->pnlReceiving_Create(6);
     //creation of advance labels
     $this->lblAssetsAdvanced_Create();
     $this->lblInventoryAdvanced_Create();
     $this->lblContactsAdvanced_Create();
     $this->lblShippingAdvanced_Create();
     $this->lblReceivingAdvanced_Create();
 }
 protected function lstAuthorization_Create()
 {
     $this->lstAuthorization = new QListBox($this);
     $this->lstAuthorization->Name = QApplication::Translate('Authorization');
     $this->lstAuthorization->AddItem(QApplication::Translate('- Select One -'), null);
     $objAuthorizationArray = Authorization::LoadAll();
     if ($objAuthorizationArray) {
         foreach ($objAuthorizationArray as $objAuthorization) {
             $objListItem = new QListItem($objAuthorization->__toString(), $objAuthorization->AuthorizationId);
             if ($this->objRoleModuleAuthorization->Authorization && $this->objRoleModuleAuthorization->Authorization->AuthorizationId == $objAuthorization->AuthorizationId) {
                 $objListItem->Selected = true;
             }
             $this->lstAuthorization->AddItem($objListItem);
         }
     }
 }
 public function dtgAuthorization_Bind()
 {
     // Get Total Count b/c of Pagination
     $this->dtgAuthorization->TotalItemCount = Authorization::CountAll();
     $objClauses = array();
     if ($objClause = $this->dtgAuthorization->OrderByClause) {
         array_push($objClauses, $objClause);
     }
     if ($objClause = $this->dtgAuthorization->LimitClause) {
         array_push($objClauses, $objClause);
     }
     $this->dtgAuthorization->DataSource = Authorization::LoadAll($objClauses);
 }
 /**
  * Refresh this MetaControl with Data from the local RoleEntityQtypeCustomFieldAuthorization object.
  * @param boolean $blnReload reload RoleEntityQtypeCustomFieldAuthorization from the database
  * @return void
  */
 public function Refresh($blnReload = false)
 {
     if ($blnReload) {
         $this->objRoleEntityQtypeCustomFieldAuthorization->Reload();
     }
     if ($this->lblRoleEntityQtypeCustomFieldAuthorizationId) {
         if ($this->blnEditMode) {
             $this->lblRoleEntityQtypeCustomFieldAuthorizationId->Text = $this->objRoleEntityQtypeCustomFieldAuthorization->RoleEntityQtypeCustomFieldAuthorizationId;
         }
     }
     if ($this->lstRole) {
         $this->lstRole->RemoveAllItems();
         if (!$this->blnEditMode) {
             $this->lstRole->AddItem(QApplication::Translate('- Select One -'), null);
         }
         $objRoleArray = Role::LoadAll();
         if ($objRoleArray) {
             foreach ($objRoleArray as $objRole) {
                 $objListItem = new QListItem($objRole->__toString(), $objRole->RoleId);
                 if ($this->objRoleEntityQtypeCustomFieldAuthorization->Role && $this->objRoleEntityQtypeCustomFieldAuthorization->Role->RoleId == $objRole->RoleId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstRole->AddItem($objListItem);
             }
         }
     }
     if ($this->lblRoleId) {
         $this->lblRoleId->Text = $this->objRoleEntityQtypeCustomFieldAuthorization->Role ? $this->objRoleEntityQtypeCustomFieldAuthorization->Role->__toString() : null;
     }
     if ($this->lstEntityQtypeCustomField) {
         $this->lstEntityQtypeCustomField->RemoveAllItems();
         if (!$this->blnEditMode) {
             $this->lstEntityQtypeCustomField->AddItem(QApplication::Translate('- Select One -'), null);
         }
         $objEntityQtypeCustomFieldArray = EntityQtypeCustomField::LoadAll();
         if ($objEntityQtypeCustomFieldArray) {
             foreach ($objEntityQtypeCustomFieldArray as $objEntityQtypeCustomField) {
                 $objListItem = new QListItem($objEntityQtypeCustomField->__toString(), $objEntityQtypeCustomField->EntityQtypeCustomFieldId);
                 if ($this->objRoleEntityQtypeCustomFieldAuthorization->EntityQtypeCustomField && $this->objRoleEntityQtypeCustomFieldAuthorization->EntityQtypeCustomField->EntityQtypeCustomFieldId == $objEntityQtypeCustomField->EntityQtypeCustomFieldId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstEntityQtypeCustomField->AddItem($objListItem);
             }
         }
     }
     if ($this->lblEntityQtypeCustomFieldId) {
         $this->lblEntityQtypeCustomFieldId->Text = $this->objRoleEntityQtypeCustomFieldAuthorization->EntityQtypeCustomField ? $this->objRoleEntityQtypeCustomFieldAuthorization->EntityQtypeCustomField->__toString() : null;
     }
     if ($this->lstAuthorization) {
         $this->lstAuthorization->RemoveAllItems();
         if (!$this->blnEditMode) {
             $this->lstAuthorization->AddItem(QApplication::Translate('- Select One -'), null);
         }
         $objAuthorizationArray = Authorization::LoadAll();
         if ($objAuthorizationArray) {
             foreach ($objAuthorizationArray as $objAuthorization) {
                 $objListItem = new QListItem($objAuthorization->__toString(), $objAuthorization->AuthorizationId);
                 if ($this->objRoleEntityQtypeCustomFieldAuthorization->Authorization && $this->objRoleEntityQtypeCustomFieldAuthorization->Authorization->AuthorizationId == $objAuthorization->AuthorizationId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstAuthorization->AddItem($objListItem);
             }
         }
     }
     if ($this->lblAuthorizationId) {
         $this->lblAuthorizationId->Text = $this->objRoleEntityQtypeCustomFieldAuthorization->Authorization ? $this->objRoleEntityQtypeCustomFieldAuthorization->Authorization->__toString() : null;
     }
     if ($this->chkAuthorizedFlag) {
         $this->chkAuthorizedFlag->Checked = $this->objRoleEntityQtypeCustomFieldAuthorization->AuthorizedFlag;
     }
     if ($this->lblAuthorizedFlag) {
         $this->lblAuthorizedFlag->Text = $this->objRoleEntityQtypeCustomFieldAuthorization->AuthorizedFlag ? QApplication::Translate('Yes') : QApplication::Translate('No');
     }
     if ($this->lstCreatedByObject) {
         $this->lstCreatedByObject->RemoveAllItems();
         $this->lstCreatedByObject->AddItem(QApplication::Translate('- Select One -'), null);
         $objCreatedByObjectArray = UserAccount::LoadAll();
         if ($objCreatedByObjectArray) {
             foreach ($objCreatedByObjectArray as $objCreatedByObject) {
                 $objListItem = new QListItem($objCreatedByObject->__toString(), $objCreatedByObject->UserAccountId);
                 if ($this->objRoleEntityQtypeCustomFieldAuthorization->CreatedByObject && $this->objRoleEntityQtypeCustomFieldAuthorization->CreatedByObject->UserAccountId == $objCreatedByObject->UserAccountId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstCreatedByObject->AddItem($objListItem);
             }
         }
     }
     if ($this->lblCreatedBy) {
         $this->lblCreatedBy->Text = $this->objRoleEntityQtypeCustomFieldAuthorization->CreatedByObject ? $this->objRoleEntityQtypeCustomFieldAuthorization->CreatedByObject->__toString() : null;
     }
     if ($this->calCreationDate) {
         $this->calCreationDate->DateTime = $this->objRoleEntityQtypeCustomFieldAuthorization->CreationDate;
     }
     if ($this->lblCreationDate) {
         $this->lblCreationDate->Text = sprintf($this->objRoleEntityQtypeCustomFieldAuthorization->CreationDate) ? $this->objRoleEntityQtypeCustomFieldAuthorization->__toString($this->strCreationDateDateTimeFormat) : null;
     }
     if ($this->lstModifiedByObject) {
         $this->lstModifiedByObject->RemoveAllItems();
         $this->lstModifiedByObject->AddItem(QApplication::Translate('- Select One -'), null);
         $objModifiedByObjectArray = UserAccount::LoadAll();
         if ($objModifiedByObjectArray) {
             foreach ($objModifiedByObjectArray as $objModifiedByObject) {
                 $objListItem = new QListItem($objModifiedByObject->__toString(), $objModifiedByObject->UserAccountId);
                 if ($this->objRoleEntityQtypeCustomFieldAuthorization->ModifiedByObject && $this->objRoleEntityQtypeCustomFieldAuthorization->ModifiedByObject->UserAccountId == $objModifiedByObject->UserAccountId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstModifiedByObject->AddItem($objListItem);
             }
         }
     }
     if ($this->lblModifiedBy) {
         $this->lblModifiedBy->Text = $this->objRoleEntityQtypeCustomFieldAuthorization->ModifiedByObject ? $this->objRoleEntityQtypeCustomFieldAuthorization->ModifiedByObject->__toString() : null;
     }
     if ($this->lblModifiedDate) {
         if ($this->blnEditMode) {
             $this->lblModifiedDate->Text = $this->objRoleEntityQtypeCustomFieldAuthorization->ModifiedDate;
         }
     }
 }
 /**
  * Refresh this MetaControl with Data from the local Shortcut object.
  * @param boolean $blnReload reload Shortcut from the database
  * @return void
  */
 public function Refresh($blnReload = false)
 {
     if ($blnReload) {
         $this->objShortcut->Reload();
     }
     if ($this->lblShortcutId) {
         if ($this->blnEditMode) {
             $this->lblShortcutId->Text = $this->objShortcut->ShortcutId;
         }
     }
     if ($this->lstModule) {
         $this->lstModule->RemoveAllItems();
         if (!$this->blnEditMode) {
             $this->lstModule->AddItem(QApplication::Translate('- Select One -'), null);
         }
         $objModuleArray = Module::LoadAll();
         if ($objModuleArray) {
             foreach ($objModuleArray as $objModule) {
                 $objListItem = new QListItem($objModule->__toString(), $objModule->ModuleId);
                 if ($this->objShortcut->Module && $this->objShortcut->Module->ModuleId == $objModule->ModuleId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstModule->AddItem($objListItem);
             }
         }
     }
     if ($this->lblModuleId) {
         $this->lblModuleId->Text = $this->objShortcut->Module ? $this->objShortcut->Module->__toString() : null;
     }
     if ($this->lstAuthorization) {
         $this->lstAuthorization->RemoveAllItems();
         $this->lstAuthorization->AddItem(QApplication::Translate('- Select One -'), null);
         $objAuthorizationArray = Authorization::LoadAll();
         if ($objAuthorizationArray) {
             foreach ($objAuthorizationArray as $objAuthorization) {
                 $objListItem = new QListItem($objAuthorization->__toString(), $objAuthorization->AuthorizationId);
                 if ($this->objShortcut->Authorization && $this->objShortcut->Authorization->AuthorizationId == $objAuthorization->AuthorizationId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstAuthorization->AddItem($objListItem);
             }
         }
     }
     if ($this->lblAuthorizationId) {
         $this->lblAuthorizationId->Text = $this->objShortcut->Authorization ? $this->objShortcut->Authorization->__toString() : null;
     }
     if ($this->lstTransactionType) {
         $this->lstTransactionType->RemoveAllItems();
         $this->lstTransactionType->AddItem(QApplication::Translate('- Select One -'), null);
         $objTransactionTypeArray = TransactionType::LoadAll();
         if ($objTransactionTypeArray) {
             foreach ($objTransactionTypeArray as $objTransactionType) {
                 $objListItem = new QListItem($objTransactionType->__toString(), $objTransactionType->TransactionTypeId);
                 if ($this->objShortcut->TransactionType && $this->objShortcut->TransactionType->TransactionTypeId == $objTransactionType->TransactionTypeId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstTransactionType->AddItem($objListItem);
             }
         }
     }
     if ($this->lblTransactionTypeId) {
         $this->lblTransactionTypeId->Text = $this->objShortcut->TransactionType ? $this->objShortcut->TransactionType->__toString() : null;
     }
     if ($this->txtShortDescription) {
         $this->txtShortDescription->Text = $this->objShortcut->ShortDescription;
     }
     if ($this->lblShortDescription) {
         $this->lblShortDescription->Text = $this->objShortcut->ShortDescription;
     }
     if ($this->txtLink) {
         $this->txtLink->Text = $this->objShortcut->Link;
     }
     if ($this->lblLink) {
         $this->lblLink->Text = $this->objShortcut->Link;
     }
     if ($this->txtImagePath) {
         $this->txtImagePath->Text = $this->objShortcut->ImagePath;
     }
     if ($this->lblImagePath) {
         $this->lblImagePath->Text = $this->objShortcut->ImagePath;
     }
     if ($this->lstEntityQtype) {
         $this->lstEntityQtype->SelectedValue = $this->objShortcut->EntityQtypeId;
     }
     if ($this->lblEntityQtypeId) {
         $this->lblEntityQtypeId->Text = $this->objShortcut->EntityQtypeId ? EntityQtype::$NameArray[$this->objShortcut->EntityQtypeId] : null;
     }
     if ($this->chkCreateFlag) {
         $this->chkCreateFlag->Checked = $this->objShortcut->CreateFlag;
     }
     if ($this->lblCreateFlag) {
         $this->lblCreateFlag->Text = $this->objShortcut->CreateFlag ? QApplication::Translate('Yes') : QApplication::Translate('No');
     }
 }