本文整理汇总了PHP中CustomField::LoadArrayByActiveFlagEntity方法的典型用法代码示例。如果您正苦于以下问题:PHP CustomField::LoadArrayByActiveFlagEntity方法的具体用法?PHP CustomField::LoadArrayByActiveFlagEntity怎么用?PHP CustomField::LoadArrayByActiveFlagEntity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CustomField
的用法示例。
在下文中一共展示了CustomField::LoadArrayByActiveFlagEntity方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Form_Create
protected function Form_Create()
{
if (QApplication::QueryString('intDownloadCsv')) {
$this->RenderBegin(false);
session_cache_limiter('must-revalidate');
// force a "no cache" effect
header("Pragma: hack");
// IE chokes on "no cache", so set to something, anything, else.
$ExpStr = "Expires: " . gmdate("D, d M Y H:i:s", time()) . " GMT";
header($ExpStr);
header('Content-Type: text/csv');
header('Content-Disposition: csv; filename=skipped_records.csv');
$file = fopen(sprintf("%s/%s_contact_skipped.csv", __TRACMOR_TMP__, $_SESSION['intUserAccountId']), "r");
ob_end_clean();
while ($row = fgets($file, 1000)) {
print $row;
@ob_flush();
flush();
}
QApplication::$JavaScriptArray = array();
QApplication::$JavaScriptArrayHighPriority = array();
$this->RenderEnd(false);
exit;
}
// Create the Header Menu
$this->ctlHeaderMenu_Create();
//$this->ctlShortcutMenu_Create();
$this->pnlMain_Create();
$this->pnlStepOne_Create();
$this->Buttons_Create();
$this->intStep = 1;
$this->intSkippedRecordCount = 0;
$this->blnImportEnd = true;
$this->btnRemoveArray = array();
$this->arrItemCustomField = array();
$this->Labels_Create();
$this->objDatabase = Asset::GetDatabase();
// Load Custom Field
foreach (CustomField::LoadArrayByActiveFlagEntity(1, EntityQtype::Contact) as $objCustomField) {
$this->arrItemCustomField[$objCustomField->CustomFieldId] = $objCustomField;
}
$this->blnError = true;
$intRoleId = QApplication::$objUserAccount->RoleId;
$objRoleEntityQtypeBuiltInAuthorization = RoleEntityQtypeBuiltInAuthorization::LoadByRoleIdEntityQtypeIdAuthorizationId($intRoleId, EntityQtype::Contact, 2);
// Check the user have edit permissions
if ($objRoleEntityQtypeBuiltInAuthorization && $objRoleEntityQtypeBuiltInAuthorization->AuthorizedFlag) {
$this->blnError = false;
}
if (isset($intCustomFieldIdArray) && count($intCustomFieldIdArray)) {
//QApplication::$Database[1]->EnableProfiling();
// Load restrict permisions for Custom Fields
$objConditions = QQ::AndCondition(QQ::Equal(QQN::RoleEntityQtypeCustomFieldAuthorization()->RoleId, (string) $intRoleId), QQ::In(QQN::RoleEntityQtypeCustomFieldAuthorization()->EntityQtypeCustomField->CustomFieldId, $intCustomFieldIdArray), QQ::Equal(QQN::RoleEntityQtypeCustomFieldAuthorization()->AuthorizedFlag, false));
$objClauses = array();
array_push($objClauses, QQ::Expand(QQN::RoleEntityQtypeCustomFieldAuthorization()->EntityQtypeCustomField->EntityQtypeCustomFieldId));
array_push($objClauses, QQ::OrderBy(QQN::RoleEntityQtypeCustomFieldAuthorization()->EntityQtypeCustomFieldId));
$arrRoleEntityQtypeCustomFieldAuthorization = RoleEntityQtypeCustomFieldAuthorization::QueryArray($objConditions, $objClauses);
if ($arrRoleEntityQtypeCustomFieldAuthorization) {
foreach ($arrRoleEntityQtypeCustomFieldAuthorization as $objRoleAuth) {
if (array_key_exists($objRoleAuth->EntityQtypeCustomField->CustomFieldId, $this->arrAssetCustomField)) {
unset($this->arrAssetCustomField[$objRoleAuth->EntityQtypeCustomField->CustomFieldId]);
}
}
}
//QApplication::$Database[1]->OutputProfiling();
}
$this->intUserArray = array();
// Load Users
foreach (UserAccount::LoadAll() as $objUser) {
$this->intUserArray[strtolower($objUser->Username)] = $objUser->UserAccountId;
}
$this->strAcceptibleMimeArray = array('text/plain' => 'txt', 'text/comma-separated-values' => 'csv', 'text/csv' => 'csv', 'text/x-comma-separated-values' => 'csv', 'application/vnd.ms-excel' => 'csv', 'application/csv' => 'csv', 'text/x-csv' => 'csv');
}
示例2: LoadObjCustomFieldArray
/**
* This loads the array of custom fields, and their selections and values if an existing entity
* If it is a new entity, it only loads the custom fields without values.
*
* @param integer $intEntityQtypeId e.g., 1 == Asset, 2 == Inventory
* @param bool $blnEditMode if creating a new entity or editing an existing one
* @param integer $intEntityId e.g., AssetId, InventoryId
* @return Array $objCustomFieldArray of CustomField objects
*/
public static function LoadObjCustomFieldArray($intEntityQtypeId, $blnEditMode, $intEntityId = null, $searchable = false, $intAssetModel = null)
{
$objExpansionMap[CustomField::ExpandDefaultCustomFieldValue] = true;
$objCustomFieldArray = CustomField::LoadArrayByActiveFlagEntity(true, $intEntityQtypeId, null, null, $objExpansionMap, $searchable);
if ($objCustomFieldArray && $blnEditMode) {
foreach ($objCustomFieldArray as $objCustomField) {
$objCustomField->LoadExpandedArrayByEntity($intEntityQtypeId, $intEntityId);
}
}
// Custom Fiedls load for Asset in asset_edit
if ($intAssetModel) {
$arrCustomFieldsForAssetModel = array();
// Select only
if (is_int($intAssetModel)) {
$arrAssetCustomFields = AssetCustomFieldAssetModel::LoadArrayByAssetModelId($intAssetModel);
foreach ($arrAssetCustomFields as $anAssetCustomField) {
$arrCustomFieldsForAssetModel[] = $anAssetCustomField->CustomField->CustomFieldId;
}
} elseif ($intAssetModel == 'all') {
$arrAssetCustomFields = EntityQtypeCustomField::LoadArrayByEntityQtypeId(1);
foreach ($arrAssetCustomFields as $anAssetCustomField) {
if ($anAssetCustomField->CustomField->AllAssetModelsFlag) {
$arrCustomFieldsForAssetModel[] = $anAssetCustomField->CustomField->CustomFieldId;
}
}
}
$arrForAssetModel = array();
foreach ($objCustomFieldArray as $objCustomField) {
if (in_array($objCustomField->CustomFieldId, $arrCustomFieldsForAssetModel) || $objCustomField->AllAssetModelsFlag == 1) {
$arrForAssetModel[] = $objCustomField;
}
}
$objCustomFieldArray = $arrForAssetModel;
}
if ($objCustomFieldArray) {
foreach ($objCustomFieldArray as $objCustomField) {
$objEntityQtypeCustomField = EntityQtypeCustomField::LoadByEntityQtypeIdCustomFieldId($intEntityQtypeId, $objCustomField->CustomFieldId);
if ($objEntityQtypeCustomField) {
$objRoleEntityQtypeCustomFieldAuthorization = RoleEntityQtypeCustomFieldAuthorization::LoadByRoleIdEntityQtypeCustomFieldIdAuthorizationId(QApplication::$objUserAccount->RoleId, $objEntityQtypeCustomField->EntityQtypeCustomFieldId, 1);
if ($objRoleEntityQtypeCustomFieldAuthorization) {
$objCustomField->objRoleAuthView = $objRoleEntityQtypeCustomFieldAuthorization;
}
$objRoleEntityQtypeCustomFieldAuthorization2 = RoleEntityQtypeCustomFieldAuthorization::LoadByRoleIdEntityQtypeCustomFieldIdAuthorizationId(QApplication::$objUserAccount->RoleId, $objEntityQtypeCustomField->EntityQtypeCustomFieldId, 2);
if ($objRoleEntityQtypeCustomFieldAuthorization2) {
$objCustomField->objRoleAuthEdit = $objRoleEntityQtypeCustomFieldAuthorization2;
}
}
}
}
return $objCustomFieldArray;
}
示例3: Form_Create
protected function Form_Create()
{
if (QApplication::QueryString('intDownloadCsv')) {
$this->RenderBegin(false);
session_cache_limiter('must-revalidate');
// force a "no cache" effect
header("Pragma: hack");
// IE chokes on "no cache", so set to something, anything, else.
$ExpStr = "Expires: " . gmdate("D, d M Y H:i:s", time()) . " GMT";
header($ExpStr);
header('Content-Type: text/csv');
header('Content-Disposition: csv; filename=skipped_records.csv');
$file = fopen(sprintf("%s%s/%s_skipped.csv", __DOCROOT__ . __SUBDIRECTORY__, __TRACMOR_TMP__, $_SESSION['intUserAccountId']), "r");
ob_end_clean();
while ($row = fgets($file, 1000)) {
print $row;
@ob_flush();
flush();
}
QApplication::$JavaScriptArray = array();
QApplication::$JavaScriptArrayHighPriority = array();
$this->RenderEnd(false);
exit;
}
// Create the Header Menu
$this->ctlHeaderMenu_Create();
$this->pnlMain_Create();
$this->pnlStepOne_Create();
$this->Buttons_Create();
$this->intStep = 1;
$this->intSkippedRecordCount = 0;
$this->blnImportEnd = true;
$this->btnRemoveArray = array();
$this->arrAssetCustomField = array();
$this->Labels_Create();
$this->objDatabase = Asset::GetDatabase();
// Load Asset Custom Field
foreach (CustomField::LoadArrayByActiveFlagEntity(1, 1) as $objCustomField) {
$this->arrAssetCustomField[$objCustomField->CustomFieldId] = $objCustomField;
}
$this->arrAssetModelCustomField = array();
// Load Asset Model Custom Field
foreach (CustomField::LoadArrayByActiveFlagEntity(1, 4) as $objCustomField) {
$this->arrAssetModelCustomField[$objCustomField->CustomFieldId] = $objCustomField;
}
$this->intUserArray = array();
// Load Users
foreach (UserAccount::LoadAll() as $objUser) {
$this->intUserArray[strtolower($objUser->Username)] = $objUser->UserAccountId;
}
$this->strAcceptibleMimeArray = array('text/plain' => 'txt', 'text/comma-separated-values' => 'csv', 'text/csv' => 'csv', 'text/x-comma-separated-values' => 'csv', 'application/vnd.ms-excel' => 'csv', 'application/csv' => 'csv', 'text/x-csv' => 'csv');
}
示例4: LoadObjCustomFieldArray
/**
* This loads the array of custom fields, and their selections and values if an existing entity
* If it is a new entity, it only loads the custom fields without values.
*
* @param integer $intEntityQtypeId e.g., 1 == Asset, 2 == Inventory
* @param bool $blnEditMode if creating a new entity or editing an existing one
* @param integer $intEntityId e.g., AssetId, InventoryId
* @return Array $objCustomFieldArray of CustomField objects
*/
public static function LoadObjCustomFieldArray($intEntityQtypeId, $blnEditMode, $intEntityId = null)
{
$objExpansionMap[CustomField::ExpandDefaultCustomFieldValue] = true;
$objCustomFieldArray = CustomField::LoadArrayByActiveFlagEntity(true, $intEntityQtypeId, null, null, $objExpansionMap);
if ($objCustomFieldArray && $blnEditMode) {
foreach ($objCustomFieldArray as $objCustomField) {
$objCustomField->LoadExpandedArrayByEntity($intEntityQtypeId, $intEntityId);
}
}
if ($objCustomFieldArray) {
foreach ($objCustomFieldArray as $objCustomField) {
$objEntityQtypeCustomField = EntityQtypeCustomField::LoadByEntityQtypeIdCustomFieldId($intEntityQtypeId, $objCustomField->CustomFieldId);
if ($objEntityQtypeCustomField) {
$objRoleEntityQtypeCustomFieldAuthorization = RoleEntityQtypeCustomFieldAuthorization::LoadByRoleIdEntityQtypeCustomFieldIdAuthorizationId(QApplication::$objUserAccount->RoleId, $objEntityQtypeCustomField->EntityQtypeCustomFieldId, 1);
if ($objRoleEntityQtypeCustomFieldAuthorization) {
$objCustomField->objRoleAuthView = $objRoleEntityQtypeCustomFieldAuthorization;
}
$objRoleEntityQtypeCustomFieldAuthorization2 = RoleEntityQtypeCustomFieldAuthorization::LoadByRoleIdEntityQtypeCustomFieldIdAuthorizationId(QApplication::$objUserAccount->RoleId, $objEntityQtypeCustomField->EntityQtypeCustomFieldId, 2);
if ($objRoleEntityQtypeCustomFieldAuthorization2) {
$objCustomField->objRoleAuthEdit = $objRoleEntityQtypeCustomFieldAuthorization2;
}
}
}
}
return $objCustomFieldArray;
}