当前位置: 首页>>代码示例>>PHP>>正文


PHP Role::LoadAll方法代码示例

本文整理汇总了PHP中Role::LoadAll方法的典型用法代码示例。如果您正苦于以下问题:PHP Role::LoadAll方法的具体用法?PHP Role::LoadAll怎么用?PHP Role::LoadAll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Role的用法示例。


在下文中一共展示了Role::LoadAll方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: CreateRoleTransactionTypeAuthorizations

function CreateRoleTransactionTypeAuthorizations()
{
    $intRoleTransactionTypeAuthorizationArray = RoleTransactionTypeAuthorization::CountAll();
    if (count($intRoleTransactionTypeAuthorizationArray)) {
        foreach (Role::LoadAll() as $objRole) {
            // Archive
            $objRoleTransactionTypeAuthorization = new RoleTransactionTypeAuthorization();
            $objRoleTransactionTypeAuthorization->RoleId = $objRole->RoleId;
            $objRoleTransactionTypeAuthorization->TransactionTypeId = 10;
            $objRoleTransactionTypeAuthorization->AuthorizationLevelId = 1;
            $objRoleTransactionTypeAuthorization->Save();
            // Unarchive
            $objRoleTransactionTypeAuthorization = new RoleTransactionTypeAuthorization();
            $objRoleTransactionTypeAuthorization->RoleId = $objRole->RoleId;
            $objRoleTransactionTypeAuthorization->TransactionTypeId = 11;
            $objRoleTransactionTypeAuthorization->AuthorizationLevelId = 1;
            $objRoleTransactionTypeAuthorization->Save();
        }
    }
}
开发者ID:brustj,项目名称:tracmor,代码行数:20,代码来源:asset_archive_update.php

示例2: Form_PreRender

 protected function Form_PreRender()
 {
     $objExpansionMap[Role::ExpandCreatedByObject] = true;
     // Get Total Count b/c of Pagination
     $this->dtgRole->TotalItemCount = Role::CountAll();
     if ($this->dtgRole->TotalItemCount == 0) {
         $this->dtgRole->ShowHeader = false;
     } else {
         $objClauses = array();
         if ($objClause = $this->dtgRole->OrderByClause) {
             array_push($objClauses, $objClause);
         }
         if ($objClause = $this->dtgRole->LimitClause) {
             array_push($objClauses, $objClause);
         }
         if ($objClause = QQ::Expand(QQN::Role()->CreatedByObject)) {
             array_push($objClauses, $objClause);
         }
         $this->dtgRole->DataSource = Role::LoadAll($objClauses);
         $this->dtgRole->ShowHeader = true;
     }
 }
开发者ID:brustj,项目名称:tracmor,代码行数:22,代码来源:role_list.php

示例3: dtgRole_Bind

 protected function dtgRole_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->dtgRole->TotalItemCount = Role::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->dtgRole->OrderByClause) {
         array_push($objClauses, $objClause);
     }
     // Add the LimitClause information, as well
     if ($objClause = $this->dtgRole->LimitClause) {
         array_push($objClauses, $objClause);
     }
     // Set the DataSource to be the array of all Role objects, given the clauses above
     $this->dtgRole->DataSource = Role::LoadAll($objClauses);
 }
开发者ID:brustj,项目名称:tracmor,代码行数:19,代码来源:RoleListFormBase.class.php

示例4: UpdateEntityQtypeCustomFields

 protected function UpdateEntityQtypeCustomFields()
 {
     // Delete any EntityQtypeCustomFields that were selected but are no longer selected
     $objEntityQtypeCustomFieldArray = EntityQtypeCustomField::LoadArrayByCustomFieldId($this->objCustomField->CustomFieldId);
     if ($objEntityQtypeCustomFieldArray) {
         foreach ($objEntityQtypeCustomFieldArray as $objEntityQtypeCustomField) {
             // Determines whether or not a entityqtypecustomfield can stay or gets deleted
             $blnKeep = false;
             if ($this->chkEntityQtype->SelectedItems) {
                 foreach ($this->chkEntityQtype->SelectedItems as $objEntityQtypeItem) {
                     if ($objEntityQtypeCustomField->EntityQtypeId == $objEntityQtypeItem->Value) {
                         $blnKeep = true;
                     }
                 }
             }
             // If the EntityQtype needs to be deleted, you must delete the CustomFieldValues for text and textarea, and CustomFieldSelections for all types
             if (!$blnKeep) {
                 /*$objAndCondition = QQ::AndCondition(QQ::Equal(QQN::CustomFieldSelection()->EntityQtypeId, $objEntityQtypeCustomField->EntityQtypeId), QQ::Equal(QQN::CustomFieldSelection()->CustomFieldValue->CustomFieldId, $this->objCustomField->CustomFieldId));
                 		$objClauses = QQ::Clause(QQ::Expand(QQN::CustomFieldSelection()->CustomFieldValue));
                 		// Select all CustomFieldSelections (and expanded CustomFieldValues) by EntityQtypeId and CustomFieldId
                 		$objCustomFieldSelectionArray = CustomFieldSelection::QueryArray($objAndCondition, $objClauses);
                 		if ($objCustomFieldSelectionArray) {
                 			foreach ($objCustomFieldSelectionArray as $objCustomFieldSelection) {
                 				if ($this->objCustomField->CustomFieldQtypeId != 2) {
                 					// Deleting the CustomFieldValue will MySQL CASCADE to delete the CustomFieldSelection also
                 					$objCustomFieldSelection->CustomFieldValue->Delete();
                 				}
                 				else {
                 					// If it is a select box, only delete the CustomFieldSelection (the CustomFieldValue stays unless it is removed as a selection entirely)
                 					$objCustomFieldSelection->Delete();
                 				}
                 			}
                 		}*/
                 // If the EntityQtype needs to be deleted, you must delete EntityQtypeId for all roles in RoleEntityQTypeCustomFieldAuthorization
                 $objRoleEntityCustomAuthArray = RoleEntityQtypeCustomFieldAuthorization::LoadArrayByEntityQtypeCustomFieldId($objEntityQtypeCustomField->EntityQtypeCustomFieldId);
                 if ($objRoleEntityCustomAuthArray) {
                     foreach ($objRoleEntityCustomAuthArray as $objRoleEntityCustomAuth) {
                         $objRoleEntityCustomAuth->Delete();
                     }
                 }
                 // If the helper table exists for that EntityQtype then will delete the column in the helper table
                 if ($strHelperTableArray = CustomFieldValue::GetHelperTableByEntityQtypeId($objEntityQtypeCustomField->EntityQtypeId)) {
                     $strHelperTable = $strHelperTableArray[0];
                     $objDatabase = CustomField::GetDatabase();
                     $strQuery = sprintf("ALTER TABLE %s DROP `cfv_%s`;", $strHelperTable, $this->objCustomField->CustomFieldId);
                     $objDatabase->NonQuery($strQuery);
                 }
                 if ($objEntityQtypeCustomField->EntityQtypeId == 1) {
                     $this->DeleteAssetCustomFieldAssetModels();
                 }
                 // Delete the EntityQtypeCustomField last
                 $objEntityQtypeCustomField->Delete();
             } else {
                 if ($objEntityQtypeCustomField->EntityQtypeId == 1) {
                     $this->UpadateAssetModels();
                 }
             }
         }
     }
     // Insert the new EntityQtypeCustomFields
     if ($this->lstCustomFieldQtype->SelectedItems) {
         foreach ($this->chkEntityQtype->SelectedItems as $objEntityQtypeItem) {
             // If the field doesn't already exist, then it needs to be created
             if (!($objEntityQtypeCustomField = EntityQtypeCustomField::LoadByEntityQtypeIdCustomFieldId($objEntityQtypeItem->Value, $this->objCustomField->CustomFieldId))) {
                 // add asset models
                 if ($objEntityQtypeItem->Value == 1) {
                     $this->AppendAssetModels();
                 }
                 $objEntityQtypeCustomField = new EntityQtypeCustomField();
                 $objEntityQtypeCustomField->CustomFieldId = $this->objCustomField->CustomFieldId;
                 $objEntityQtypeCustomField->EntityQtypeId = $objEntityQtypeItem->Value;
                 $objEntityQtypeCustomField->Save();
                 // If the helper table exists for that EntityQtype then create new column in the helper table
                 if ($strHelperTableArray = CustomFieldValue::GetHelperTableByEntityQtypeId($objEntityQtypeItem->Value)) {
                     $strHelperTable = $strHelperTableArray[0];
                     $objDatabase = CustomField::GetDatabase();
                     $strQuery = sprintf("ALTER TABLE %s ADD `cfv_%s` TEXT DEFAULT NULL;", $strHelperTable, $this->objCustomField->CustomFieldId);
                     $objDatabase->NonQuery($strQuery);
                     // If the helper table exists and have no values (empty).
                     // It happens when the QtypeItem does not yet have the custom fields.
                     // Uses SQL-hack to fix this issue.
                     $strParentTableName = $strHelperTableArray[1];
                     $strHelperTableItemId = sprintf("%s_id", $strParentTableName);
                     $strQuery = sprintf("INSERT INTO %s (`%s`) (SELECT `%s` FROM `%s` WHERE `%s` NOT IN (SELECT `%s` FROM %s));", $strHelperTable, $strHelperTableItemId, $strHelperTableItemId, $strParentTableName, $strHelperTableItemId, $strHelperTableItemId, $strHelperTable);
                     $objDatabase->NonQuery($strQuery);
                 }
                 // Insert the new EntityQtypeCustomField to the RoleEntityQTypeCustomFieldAuthorization table, to all the roles, with authorized_flag set to true, one for View Auth and another for Edit Auth
                 foreach (Role::LoadAll() as $objRole) {
                     //Insert the view Auth
                     $objRoleEntityQtypeCustomFieldAuth = new RoleEntityQtypeCustomFieldAuthorization();
                     $objRoleEntityQtypeCustomFieldAuth->RoleId = $objRole->RoleId;
                     $objRoleEntityQtypeCustomFieldAuth->EntityQtypeCustomFieldId = $objEntityQtypeCustomField->EntityQtypeCustomFieldId;
                     $objRoleEntityQtypeCustomFieldAuth->AuthorizationId = 1;
                     $objRoleEntityQtypeCustomFieldAuth->AuthorizedFlag = 1;
                     $objRoleEntityQtypeCustomFieldAuth->Save();
                     //Insert the Edit Auth
                     $objRoleEntityQtypeCustomFieldAuth = new RoleEntityQtypeCustomFieldAuthorization();
                     $objRoleEntityQtypeCustomFieldAuth->RoleId = $objRole->RoleId;
                     $objRoleEntityQtypeCustomFieldAuth->EntityQtypeCustomFieldId = $objEntityQtypeCustomField->EntityQtypeCustomFieldId;
                     $objRoleEntityQtypeCustomFieldAuth->AuthorizationId = 2;
//.........这里部分代码省略.........
开发者ID:proxymoron,项目名称:tracmor,代码行数:101,代码来源:custom_field_edit.php

示例5: lstRole_Create

 protected function lstRole_Create()
 {
     $this->lstRole = new QListBox($this);
     $this->lstRole->Name = QApplication::Translate('Role');
     $this->lstRole->Required = true;
     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);
         }
     }
 }
开发者ID:heshuai64,项目名称:einv2,代码行数:19,代码来源:RoleEntityQtypeCustomFieldAuthorizationEditFormBase.class.php

示例6: dtgRole_Bind

 public function dtgRole_Bind()
 {
     // Get Total Count b/c of Pagination
     $this->dtgRole->TotalItemCount = Role::CountAll();
     $objClauses = array();
     if ($objClause = $this->dtgRole->OrderByClause) {
         array_push($objClauses, $objClause);
     }
     if ($objClause = $this->dtgRole->LimitClause) {
         array_push($objClauses, $objClause);
     }
     $this->dtgRole->DataSource = Role::LoadAll($objClauses);
 }
开发者ID:heshuai64,项目名称:einv2,代码行数:13,代码来源:RoleListPanelBase.class.php

示例7: Refresh

 /**
  * 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;
//.........这里部分代码省略.........
开发者ID:proxymoron,项目名称:tracmor,代码行数:101,代码来源:RoleEntityQtypeCustomFieldAuthorizationMetaControlGen.class.php

示例8: Refresh

 /**
  * Refresh this MetaControl with Data from the local UserAccount object.
  * @param boolean $blnReload reload UserAccount from the database
  * @return void
  */
 public function Refresh($blnReload = false)
 {
     if ($blnReload) {
         $this->objUserAccount->Reload();
     }
     if ($this->lblUserAccountId) {
         if ($this->blnEditMode) {
             $this->lblUserAccountId->Text = $this->objUserAccount->UserAccountId;
         }
     }
     if ($this->txtFirstName) {
         $this->txtFirstName->Text = $this->objUserAccount->FirstName;
     }
     if ($this->lblFirstName) {
         $this->lblFirstName->Text = $this->objUserAccount->FirstName;
     }
     if ($this->txtLastName) {
         $this->txtLastName->Text = $this->objUserAccount->LastName;
     }
     if ($this->lblLastName) {
         $this->lblLastName->Text = $this->objUserAccount->LastName;
     }
     if ($this->txtUsername) {
         $this->txtUsername->Text = $this->objUserAccount->Username;
     }
     if ($this->lblUsername) {
         $this->lblUsername->Text = $this->objUserAccount->Username;
     }
     if ($this->txtPasswordHash) {
         $this->txtPasswordHash->Text = $this->objUserAccount->PasswordHash;
     }
     if ($this->lblPasswordHash) {
         $this->lblPasswordHash->Text = $this->objUserAccount->PasswordHash;
     }
     if ($this->txtEmailAddress) {
         $this->txtEmailAddress->Text = $this->objUserAccount->EmailAddress;
     }
     if ($this->lblEmailAddress) {
         $this->lblEmailAddress->Text = $this->objUserAccount->EmailAddress;
     }
     if ($this->chkActiveFlag) {
         $this->chkActiveFlag->Checked = $this->objUserAccount->ActiveFlag;
     }
     if ($this->lblActiveFlag) {
         $this->lblActiveFlag->Text = $this->objUserAccount->ActiveFlag ? QApplication::Translate('Yes') : QApplication::Translate('No');
     }
     if ($this->chkAdminFlag) {
         $this->chkAdminFlag->Checked = $this->objUserAccount->AdminFlag;
     }
     if ($this->lblAdminFlag) {
         $this->lblAdminFlag->Text = $this->objUserAccount->AdminFlag ? QApplication::Translate('Yes') : QApplication::Translate('No');
     }
     if ($this->chkPortableAccessFlag) {
         $this->chkPortableAccessFlag->Checked = $this->objUserAccount->PortableAccessFlag;
     }
     if ($this->lblPortableAccessFlag) {
         $this->lblPortableAccessFlag->Text = $this->objUserAccount->PortableAccessFlag ? QApplication::Translate('Yes') : QApplication::Translate('No');
     }
     if ($this->txtPortableUserPin) {
         $this->txtPortableUserPin->Text = $this->objUserAccount->PortableUserPin;
     }
     if ($this->lblPortableUserPin) {
         $this->lblPortableUserPin->Text = $this->objUserAccount->PortableUserPin;
     }
     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->objUserAccount->Role && $this->objUserAccount->Role->RoleId == $objRole->RoleId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstRole->AddItem($objListItem);
             }
         }
     }
     if ($this->lblRoleId) {
         $this->lblRoleId->Text = $this->objUserAccount->Role ? $this->objUserAccount->Role->__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->objUserAccount->CreatedByObject && $this->objUserAccount->CreatedByObject->UserAccountId == $objCreatedByObject->UserAccountId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstCreatedByObject->AddItem($objListItem);
             }
//.........这里部分代码省略.........
开发者ID:proxymoron,项目名称:tracmor,代码行数:101,代码来源:UserAccountMetaControlGen.class.php

示例9: Refresh

 /**
  * Refresh this MetaControl with Data from the local RoleTransactionTypeAuthorization object.
  * @param boolean $blnReload reload RoleTransactionTypeAuthorization from the database
  * @return void
  */
 public function Refresh($blnReload = false)
 {
     if ($blnReload) {
         $this->objRoleTransactionTypeAuthorization->Reload();
     }
     if ($this->lblRoleTransactionTypeAuthorizationId) {
         if ($this->blnEditMode) {
             $this->lblRoleTransactionTypeAuthorizationId->Text = $this->objRoleTransactionTypeAuthorization->RoleTransactionTypeAuthorizationId;
         }
     }
     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->objRoleTransactionTypeAuthorization->Role && $this->objRoleTransactionTypeAuthorization->Role->RoleId == $objRole->RoleId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstRole->AddItem($objListItem);
             }
         }
     }
     if ($this->lblRoleId) {
         $this->lblRoleId->Text = $this->objRoleTransactionTypeAuthorization->Role ? $this->objRoleTransactionTypeAuthorization->Role->__toString() : null;
     }
     if ($this->lstTransactionType) {
         $this->lstTransactionType->RemoveAllItems();
         if (!$this->blnEditMode) {
             $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->objRoleTransactionTypeAuthorization->TransactionType && $this->objRoleTransactionTypeAuthorization->TransactionType->TransactionTypeId == $objTransactionType->TransactionTypeId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstTransactionType->AddItem($objListItem);
             }
         }
     }
     if ($this->lblTransactionTypeId) {
         $this->lblTransactionTypeId->Text = $this->objRoleTransactionTypeAuthorization->TransactionType ? $this->objRoleTransactionTypeAuthorization->TransactionType->__toString() : null;
     }
     if ($this->lstAuthorizationLevel) {
         $this->lstAuthorizationLevel->RemoveAllItems();
         if (!$this->blnEditMode) {
             $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->objRoleTransactionTypeAuthorization->AuthorizationLevel && $this->objRoleTransactionTypeAuthorization->AuthorizationLevel->AuthorizationLevelId == $objAuthorizationLevel->AuthorizationLevelId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstAuthorizationLevel->AddItem($objListItem);
             }
         }
     }
     if ($this->lblAuthorizationLevelId) {
         $this->lblAuthorizationLevelId->Text = $this->objRoleTransactionTypeAuthorization->AuthorizationLevel ? $this->objRoleTransactionTypeAuthorization->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->objRoleTransactionTypeAuthorization->CreatedByObject && $this->objRoleTransactionTypeAuthorization->CreatedByObject->UserAccountId == $objCreatedByObject->UserAccountId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstCreatedByObject->AddItem($objListItem);
             }
         }
     }
     if ($this->lblCreatedBy) {
         $this->lblCreatedBy->Text = $this->objRoleTransactionTypeAuthorization->CreatedByObject ? $this->objRoleTransactionTypeAuthorization->CreatedByObject->__toString() : null;
     }
     if ($this->calCreationDate) {
         $this->calCreationDate->DateTime = $this->objRoleTransactionTypeAuthorization->CreationDate;
     }
     if ($this->lblCreationDate) {
         $this->lblCreationDate->Text = sprintf($this->objRoleTransactionTypeAuthorization->CreationDate) ? $this->objRoleTransactionTypeAuthorization->__toString($this->strCreationDateDateTimeFormat) : null;
     }
     if ($this->lstModifiedByObject) {
         $this->lstModifiedByObject->RemoveAllItems();
         $this->lstModifiedByObject->AddItem(QApplication::Translate('- Select One -'), null);
         $objModifiedByObjectArray = UserAccount::LoadAll();
         if ($objModifiedByObjectArray) {
//.........这里部分代码省略.........
开发者ID:proxymoron,项目名称:tracmor,代码行数:101,代码来源:RoleTransactionTypeAuthorizationMetaControlGen.class.php

示例10: UpdateEntityQtypeCustomFields

 protected function UpdateEntityQtypeCustomFields()
 {
     // Delete any EntityQtypeCustomFields that were selected but are no longer selected
     $objEntityQtypeCustomFieldArray = EntityQtypeCustomField::LoadArrayByCustomFieldId($this->objCustomField->CustomFieldId);
     if ($objEntityQtypeCustomFieldArray) {
         foreach ($objEntityQtypeCustomFieldArray as $objEntityQtypeCustomField) {
             // Determines whether or not a entityqtypecustomfield can stay or gets deleted
             $blnKeep = false;
             if ($this->lstEntityQtype->SelectedItems) {
                 foreach ($this->lstEntityQtype->SelectedItems as $objEntityQtypeItem) {
                     if ($objEntityQtypeCustomField->EntityQtypeId == $objEntityQtypeItem->Value) {
                         $blnKeep = true;
                     }
                 }
             }
             // If the EntityQtype needs to be deleted, you must delete the CustomFieldValues for text and textarea, and CustomFieldSelections for all types
             if (!$blnKeep) {
                 $objAndCondition = QQ::AndCondition(QQ::Equal(QQN::CustomFieldSelection()->EntityQtypeId, $objEntityQtypeCustomField->EntityQtypeId), QQ::Equal(QQN::CustomFieldSelection()->CustomFieldValue->CustomFieldId, $this->objCustomField->CustomFieldId));
                 $objClauses = QQ::Clause(QQ::Expand(QQN::CustomFieldSelection()->CustomFieldValue));
                 // Select all CustomFieldSelections (and expanded CustomFieldValues) by EntityQtypeId and CustomFieldId
                 $objCustomFieldSelectionArray = CustomFieldSelection::QueryArray($objAndCondition, $objClauses);
                 if ($objCustomFieldSelectionArray) {
                     foreach ($objCustomFieldSelectionArray as $objCustomFieldSelection) {
                         if ($this->objCustomField->CustomFieldQtypeId != 2) {
                             // Deleting the CustomFieldValue will MySQL CASCADE to delete the CustomFieldSelection also
                             $objCustomFieldSelection->CustomFieldValue->Delete();
                         } else {
                             // If it is a select box, only delete the CustomFieldSelection (the CustomFieldValue stays unless it is removed as a selection entirely)
                             $objCustomFieldSelection->Delete();
                         }
                     }
                 }
                 // If the EntityQtype needs to be deleted, you must delete EntityQtypeId for all roles in RoleEntityQTypeCustomFieldAuthorization
                 $objRoleEntityCustomAuthArray = RoleEntityQtypeCustomFieldAuthorization::LoadArrayByEntityQtypeCustomFieldId($objEntityQtypeCustomField->EntityQtypeCustomFieldId);
                 if ($objRoleEntityCustomAuthArray) {
                     foreach ($objRoleEntityCustomAuthArray as $objRoleEntityCustomAuth) {
                         $objRoleEntityCustomAuth->Delete();
                     }
                 }
                 // Delete the EntityQtypeCustomField last
                 $objEntityQtypeCustomField->Delete();
             }
         }
     }
     // Insert the new EntityQtypeCustomFields
     if ($this->lstCustomFieldQtype->SelectedItems) {
         foreach ($this->lstEntityQtype->SelectedItems as $objEntityQtypeItem) {
             // If the field doesn't already exist, then it needs to be created
             if (!($objEntityQtypeCustomField = EntityQtypeCustomField::LoadByEntityQtypeIdCustomFieldId($objEntityQtypeItem->Value, $this->objCustomField->CustomFieldId))) {
                 $objEntityQtypeCustomField = new EntityQtypeCustomField();
                 $objEntityQtypeCustomField->CustomFieldId = $this->objCustomField->CustomFieldId;
                 $objEntityQtypeCustomField->EntityQtypeId = $objEntityQtypeItem->Value;
                 $objEntityQtypeCustomField->Save();
                 //// Insert the new EntityQtypeCustomField to the RoleEntityQTypeCustomFieldAuthorization table, to all the roles, with authorized_flag set to true, one for View Auth and another for Edit Auth
                 foreach (Role::LoadAll() as $objRole) {
                     //Insert the view Auth
                     $objRoleEntityQtypeCustomFieldAuth = new RoleEntityQtypeCustomFieldAuthorization();
                     $objRoleEntityQtypeCustomFieldAuth->RoleId = $objRole->RoleId;
                     $objRoleEntityQtypeCustomFieldAuth->EntityQtypeCustomFieldId = $objEntityQtypeCustomField->EntityQtypeCustomFieldId;
                     $objRoleEntityQtypeCustomFieldAuth->AuthorizationId = 1;
                     $objRoleEntityQtypeCustomFieldAuth->AuthorizedFlag = 1;
                     $objRoleEntityQtypeCustomFieldAuth->Save();
                     //Insert the Edit Auth
                     $objRoleEntityQtypeCustomFieldAuth = new RoleEntityQtypeCustomFieldAuthorization();
                     $objRoleEntityQtypeCustomFieldAuth->RoleId = $objRole->RoleId;
                     $objRoleEntityQtypeCustomFieldAuth->EntityQtypeCustomFieldId = $objEntityQtypeCustomField->EntityQtypeCustomFieldId;
                     $objRoleEntityQtypeCustomFieldAuth->AuthorizationId = 2;
                     $objRoleEntityQtypeCustomFieldAuth->AuthorizedFlag = 1;
                     $objRoleEntityQtypeCustomFieldAuth->Save();
                 }
             }
         }
     }
 }
开发者ID:heshuai64,项目名称:einv2,代码行数:74,代码来源:custom_field_edit.php


注:本文中的Role::LoadAll方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。