本文整理汇总了PHP中CustomField::Load方法的典型用法代码示例。如果您正苦于以下问题:PHP CustomField::Load方法的具体用法?PHP CustomField::Load怎么用?PHP CustomField::Load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CustomField
的用法示例。
在下文中一共展示了CustomField::Load方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: SetupCustomField
protected function SetupCustomField()
{
// Lookup Object PK information from Query String (if applicable)
// Set mode to Edit or New depending on what's found
$intCustomFieldId = QApplication::QueryString('intCustomFieldId');
if ($intCustomFieldId) {
$this->objCustomField = CustomField::Load($intCustomFieldId);
if (!$this->objCustomField) {
throw new Exception('Could not find a CustomField object with PK arguments: ' . $intCustomFieldId);
}
$this->strTitleVerb = QApplication::Translate('Edit');
$this->blnEditMode = true;
} else {
$this->objCustomField = new CustomField();
$this->strTitleVerb = QApplication::Translate('Create');
$this->blnEditMode = false;
}
}
示例2: __get
/**
* 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 'AssetCustomFieldAssetModelId':
// Gets the value for intAssetCustomFieldAssetModelId (Read-Only PK)
// @return integer
return $this->intAssetCustomFieldAssetModelId;
case 'AssetModelId':
// Gets the value for intAssetModelId (Not Null)
// @return integer
return $this->intAssetModelId;
case 'CustomFieldId':
// Gets the value for intCustomFieldId (Not Null)
// @return integer
return $this->intCustomFieldId;
///////////////////
// Member Objects
///////////////////
///////////////////
// Member Objects
///////////////////
case 'AssetModel':
// Gets the value for the AssetModel object referenced by intAssetModelId (Not Null)
// @return AssetModel
try {
if (!$this->objAssetModel && !is_null($this->intAssetModelId)) {
$this->objAssetModel = AssetModel::Load($this->intAssetModelId);
}
return $this->objAssetModel;
} catch (QCallerException $objExc) {
$objExc->IncrementOffset();
throw $objExc;
}
case 'CustomField':
// Gets the value for the CustomField object referenced by intCustomFieldId (Not Null)
// @return CustomField
try {
if (!$this->objCustomField && !is_null($this->intCustomFieldId)) {
$this->objCustomField = CustomField::Load($this->intCustomFieldId);
}
return $this->objCustomField;
} 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;
}
}
}
示例3: __get
/**
* 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 'EntityQtypeCustomFieldId':
/**
* Gets the value for intEntityQtypeCustomFieldId (Read-Only PK)
* @return integer
*/
return $this->intEntityQtypeCustomFieldId;
case 'EntityQtypeId':
/**
* Gets the value for intEntityQtypeId (Not Null)
* @return integer
*/
return $this->intEntityQtypeId;
case 'CustomFieldId':
/**
* Gets the value for intCustomFieldId (Not Null)
* @return integer
*/
return $this->intCustomFieldId;
///////////////////
// Member Objects
///////////////////
///////////////////
// Member Objects
///////////////////
case 'CustomField':
/**
* Gets the value for the CustomField object referenced by intCustomFieldId (Not Null)
* @return CustomField
*/
try {
if (!$this->objCustomField && !is_null($this->intCustomFieldId)) {
$this->objCustomField = CustomField::Load($this->intCustomFieldId);
}
return $this->objCustomField;
} 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 '_RoleEntityQtypeCustomFieldAuthorization':
/**
* Gets the value for the private _objRoleEntityQtypeCustomFieldAuthorization (Read-Only)
* if set due to an expansion on the role_entity_qtype_custom_field_authorization.entity_qtype_custom_field_id reverse relationship
* @return RoleEntityQtypeCustomFieldAuthorization
*/
return $this->_objRoleEntityQtypeCustomFieldAuthorization;
case '_RoleEntityQtypeCustomFieldAuthorizationArray':
/**
* Gets the value for the private _objRoleEntityQtypeCustomFieldAuthorizationArray (Read-Only)
* if set due to an ExpandAsArray on the role_entity_qtype_custom_field_authorization.entity_qtype_custom_field_id reverse relationship
* @return RoleEntityQtypeCustomFieldAuthorization[]
*/
return (array) $this->_objRoleEntityQtypeCustomFieldAuthorizationArray;
default:
try {
return parent::__get($strName);
} catch (QCallerException $objExc) {
$objExc->IncrementOffset();
throw $objExc;
}
}
}
示例4: LoadExpandedArray
/**
* This loads an expanded array of CustomFieldSelections and their associated values
* The values for each selection can be accessed by looping through: $CustomFieldSelections[$i]->CustomFieldValue->ShortDescription
*
* @param integer $intAssetId
* @param integer $intCustomAssetFieldId
* @param string $strOrderBy
* @param string $strLimit
* @param ExpansionMap Object $objExpansionMap
* @return CustomAssetFieldSelection
*/
public static function LoadExpandedArray($intEntityId, $intEntityQtypeId, $intCustomFieldId, $strOrderBy = null, $strLimit = null, $objExpansionMap = null)
{
switch ($intEntityQtypeId) {
case 1:
$strPrimaryKey = 'asset_id';
$strId = 'asset`.`asset_id';
$strHelperTable = '`asset_custom_field_helper`';
break;
case 2:
$strPrimaryKey = 'inventory_model_id';
$strId = 'inventory_model`.`inventory_model_id';
$strHelperTable = '`inventory_model_custom_field_helper`';
break;
case 4:
$strPrimaryKey = 'asset_model_id';
$strId = 'asset_model`.`asset_model_id';
$strHelperTable = '`asset_model_custom_field_helper`';
break;
case 5:
$strPrimaryKey = 'manufacturer_id';
$strId = 'manufacturer`.`manufacturer_id';
$strHelperTable = '`manufacturer_custom_field_helper`';
break;
case 6:
$strPrimaryKey = 'category_id';
$strId = 'category`.`category_id';
$strHelperTable = '`category_custom_field_helper`';
break;
case 7:
$strPrimaryKey = 'company_id';
$strId = 'company`.`company_id';
$strHelperTable = '`company_custom_field_helper`';
break;
case 8:
$strPrimaryKey = 'contact_id';
$strId = 'contact`.`contact_id';
$strHelperTable = '`contact_custom_field_helper`';
break;
case 9:
$strPrimaryKey = 'address_id';
$strId = 'address`.`address_id';
$strHelperTable = '`address_custom_field_helper`';
break;
case 10:
$strPrimaryKey = 'shipment_id';
$strId = 'shipment`.`shipment_id';
$strHelperTable = '`shipment_custom_field_helper`';
break;
case 11:
$strPrimaryKey = 'receipt_id';
$strId = 'receipt`.`receipt_id';
$strHelperTable = '`receipt_custom_field_helper`';
break;
}
$objDatabase = CustomField::GetDatabase();
$strQuery = sprintf("SELECT * FROM %s WHERE %s = %s", $strHelperTable, $strPrimaryKey, $intEntityId);
$objDbResult = $objDatabase->Query($strQuery);
$objToReturn = array();
$objDbRow = $objDbResult->GetNextRow();
$strShortDescription = $objDbRow->GetColumn('cfv_' . $intCustomFieldId, 'String');
$objCustomFieldSelection = new CustomFieldSelection();
$objCustomFieldSelection->intEntityQtypeId = $intEntityQtypeId;
$objCustomFieldSelection->intEntityId = $intEntityId;
$objCustomFieldSelection->CustomFieldSelectionId = 0;
$objCustomField = CustomField::Load($intCustomFieldId);
// If it is a select custom field
if ($objCustomField->CustomFieldQtypeId == 2 && !empty($strShortDescription)) {
@($objCustomFieldValue = CustomFieldValue::LoadByCustomFieldShortDescription($intCustomFieldId, $strShortDescription));
if ($objCustomFieldValue) {
$objCustomFieldSelection->CustomFieldValueId = $objCustomFieldValue->CustomFieldValueId;
}
} else {
$objCustomFieldSelection->CustomFieldValueId = 0;
$objCustomFieldValue = new CustomFieldValue();
$objCustomFieldValue->CustomFieldValueId = 0;
$objCustomFieldValue->CustomFieldId = $intCustomFieldId;
//$objCustomFieldValue->ShortDescription = $objDbRow->GetColumn('cfv_' . $intCustomFieldId, 'String');
$objCustomFieldValue->ShortDescription = $strShortDescription;
}
$objCustomFieldSelection->CustomFieldValue = $objCustomFieldValue;
$objToReturn = $objCustomFieldSelection;
return $objToReturn;
/* // Expand to include Values
$objExpansionMap[CustomFieldSelection::ExpandCustomFieldValue] = true;
// Call to ArrayQueryHelper to Get Database Object and Get SQL Clauses
CustomFieldSelection::ArrayQueryHelper($strOrderBy, $strLimit, $strLimitPrefix, $strLimitSuffix, $strExpandSelect, $strExpandFrom, $objExpansionMap, $objDatabase);
// Properly Escape All Input Parameters using Database->SqlVariable()
//.........这里部分代码省略.........
示例5: btnEdit_Click
public function btnEdit_Click($strFormId, $strControlId, $strParameter)
{
$strParameterArray = explode(',', $strParameter);
$objCustomField = CustomField::Load($strParameterArray[0]);
$objEditPanel = new CustomFieldEditPanel($this, $this->strCloseEditPanelMethod, $objCustomField);
$strMethodName = $this->strSetEditPanelMethod;
$this->objForm->{$strMethodName}($objEditPanel);
}
示例6: Reload
/**
* Reload this CustomField 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 CustomField object.');
}
// Reload the Object
$objReloaded = CustomField::Load($this->intCustomFieldId);
// Update $this's local variables to match
$this->CustomFieldQtypeId = $objReloaded->CustomFieldQtypeId;
$this->DefaultCustomFieldValueId = $objReloaded->DefaultCustomFieldValueId;
$this->strShortDescription = $objReloaded->strShortDescription;
$this->blnActiveFlag = $objReloaded->blnActiveFlag;
$this->blnRequiredFlag = $objReloaded->blnRequiredFlag;
$this->blnAllAssetModelsFlag = $objReloaded->blnAllAssetModelsFlag;
$this->blnSearchableFlag = $objReloaded->blnSearchableFlag;
$this->CreatedBy = $objReloaded->CreatedBy;
$this->dttCreationDate = $objReloaded->dttCreationDate;
$this->ModifiedBy = $objReloaded->ModifiedBy;
$this->strModifiedDate = $objReloaded->strModifiedDate;
}
示例7: getLstKeys
public function getLstKeys()
{
$arrToReturn = array();
foreach ($this->lstMapHeaderArray as $item) {
if (get_class($item) == 'QListBox') {
if (is_numeric(str_replace('asset_', '', $item->SelectedValue))) {
$arrToReturn[] = CustomField::Load(str_replace('asset_', '', $item->SelectedValue))->ShortDescription;
} else {
$arrToReturn[] = $item->SelectedValue;
}
}
}
return $arrToReturn;
}
示例8: __get
/**
* 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 'CustomFieldValueId':
/**
* Gets the value for intCustomFieldValueId (Read-Only PK)
* @return integer
*/
return $this->intCustomFieldValueId;
case 'CustomFieldId':
/**
* Gets the value for intCustomFieldId (Not Null)
* @return integer
*/
return $this->intCustomFieldId;
case 'ShortDescription':
/**
* Gets the value for strShortDescription
* @return string
*/
return $this->strShortDescription;
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 'CustomField':
/**
* Gets the value for the CustomField object referenced by intCustomFieldId (Not Null)
* @return CustomField
*/
try {
if (!$this->objCustomField && !is_null($this->intCustomFieldId)) {
$this->objCustomField = CustomField::Load($this->intCustomFieldId);
}
return $this->objCustomField;
} 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) {
//.........这里部分代码省略.........
示例9: Create
/**
* 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 CustomFieldMetaControl
* @param integer $intCustomFieldId primary key value
* @param QMetaControlCreateType $intCreateType rules governing CustomField object creation - defaults to CreateOrEdit
* @return CustomFieldMetaControl
*/
public static function Create($objParentObject, $intCustomFieldId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit)
{
// Attempt to Load from PK Arguments
if (strlen($intCustomFieldId)) {
$objCustomField = CustomField::Load($intCustomFieldId);
// CustomField was found -- return it!
if ($objCustomField) {
return new CustomFieldMetaControl($objParentObject, $objCustomField);
} else {
if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound) {
throw new QCallerException('Could not find a CustomField object with PK arguments: ' . $intCustomFieldId);
}
}
// 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 CustomFieldMetaControl($objParentObject, new CustomField());
}