本文整理汇总了PHP中CustomFields::getCustomField方法的典型用法代码示例。如果您正苦于以下问题:PHP CustomFields::getCustomField方法的具体用法?PHP CustomFields::getCustomField怎么用?PHP CustomFields::getCustomField使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CustomFields
的用法示例。
在下文中一共展示了CustomFields::getCustomField方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: perform
/**
* Carries out the specified action
*/
function perform()
{
// fetch the field information
$this->_fieldId = $this->_request->getValue("fieldId");
$fields = new CustomFields();
$field = $fields->getCustomField($this->_fieldId);
// show an error if we couldn't fetch the link
if (!$field) {
$this->_view = new AdminCustomFieldsListView($this->_blogInfo);
$this->_view->setErrorMessage($this->_locale->tr("error_fetching_custom_field"));
} else {
// fire the field loaded event, in case any plugin wants to do anything with it...
$this->notifyEvent(EVENT_CUSTOM_FIELD_LOADED, array("field" => &$field));
$this->_view = new AdminTemplatedView($this->_blogInfo, "editcustomfield");
$this->_view->setValue("fieldName", $field->getName());
$this->_view->setValue("fieldDescription", $field->getDescription());
$this->_view->setValue("fieldId", $field->getId());
$this->_view->setValue("fieldType", $field->getType());
$this->_view->setValue("fieldSearchable", true);
$this->_view->setValue("fieldHidden", $field->isHidden());
}
$this->setCommonData();
// better to return true if everything fine
return true;
}
示例2: getCustomFieldValueByFieldId
/**
* returns the right CustomFieldValuexxx object but this method can be used
* in those occasions when we know the fieldId but we do not know its type so what we need to do
* is first load the field definition and then work on creating the right object type
*
* @param fieldId
* @param row An array
* @see getCustomFieldValueObject
*/
function getCustomFieldValueByFieldId($fieldId, $row)
{
// load the field definition first
$customFields = new CustomFields();
$customField = $customFields->getCustomField($fieldId);
if (!$customField) {
return false;
}
// if everything went fine, then continue
$row["field_id"] = $fieldId;
$row["field_type"] = $customField->getType();
$row["field_description"] = $customField->getDescription();
$row["field_name"] = $customField->getName();
$fieldValueObject = CustomFieldValueFactory::getCustomFieldValueObject($row);
return $fieldValueObject;
}
示例3: CustomFields
/**
* @private
*/
function _deleteFields()
{
// otherwise, go through all the selected fields and remove them one by one,
// also removing the rows that contain the values
$customFields = new CustomFields();
$errorMessage = "";
$successMessage = "";
$totalOk = 0;
$this->_view = new AdminCustomFieldsListView($this->_blogInfo);
foreach ($this->_fieldIds as $fieldId) {
$field = $customFields->getCustomField($fieldId);
if ($field) {
// fire the pre-event
$this->notifyEvent(EVENT_PRE_CUSTOM_FIELD_DELETE, array("field" => &$field));
$result = $customFields->removeCustomField($fieldId);
if ($result) {
$totalOk++;
if ($totalOk > 1) {
$successMessage = $this->_locale->pr("fields_deleted_ok", $totalOk);
} else {
$successMessage = $this->_locale->pr("field_deleted_ok", $field->getName());
}
// fire the post-event
$this->notifyEvent(EVENT_POST_CUSTOM_FIELD_DELETE, array("field" => &$field));
} else {
$errorMessage .= $this->_locale->pr("error_deleting_field", $field->getName()) . "<br/>";
}
} else {
$errorMessage .= $this->_locale->pr("error_deleting_field2", $fieldId) . "<br/>";
}
}
if ($errorMessage != "") {
$this->_view->setErrorMessage($errorMessage);
}
if ($successMessage != "") {
$this->_view->setSuccessMessage($successMessage);
}
$this->setCommonData();
return true;
}
示例4: perform
/**
* Carries out the specified action
*/
function perform()
{
// fetch the fields from the request
$this->_fieldId = $this->_request->getValue("fieldId");
$this->_fieldName = Textfilter::filterAllHTML($this->_request->getValue("fieldName"));
$this->_fieldDescription = Textfilter::filterAllHTML($this->_request->getValue("fieldDescription"));
$this->_fieldType = $this->_request->getValue("fieldType");
$this->_fieldSearchable = $this->_request->getValue("fieldSearchable");
$this->_fieldHidden = $this->_request->getValue("fieldHidden");
// and start to update the field
$fields = new CustomFields();
$field = $fields->getCustomField($this->_fieldId);
// view that we're going to use for all different flows...
$this->_view = new AdminCustomFieldsListView($this->_blogInfo);
// field couldn't be loaded...
if (!$field) {
$this->_view->setErrorMessage($this->_locale->tr("error_updating_custom_field"));
return false;
}
// ...update its information...
$field->setName($this->_fieldName);
$field->setDescription($this->_fieldDescription);
$field->setType($this->_fieldType);
$field->setHidden($this->_fieldHidden);
// fire the pre-event
$this->notifyEvent(EVENT_PRE_CUSTOM_FIELD_UPDATE, array("field" => &$field));
// ...and finally the data in the database
$result = $fields->updateCustomField($field);
// check the result
if (!$result) {
$this->_view->setErrorMessage($this->_locale->tr("error_updating_custom_field"));
} else {
$this->_view->setSuccessMessage($this->_locale->pr("custom_field_updated_ok", $field->getName()));
// fire the post-event
$this->notifyEvent(EVENT_POST_CUSTOM_FIELD_UPDATE, array("field" => &$field));
}
$this->setCommonData();
return true;
}
示例5: reDirect
//.........这里部分代码省略.........
$province = new ProvinceInfo();
$district = new DistrictInfo();
$tabArr = $geninfo->filterGenInfo();
$genInfoKeys = explode('|', $tabArr[0][0]);
$genInfoValues = explode('|', $tabArr[0][1]);
for ($c = 0; $genInfoKeys && count($genInfoKeys) > $c; $c++) {
$editArr[$genInfoKeys[$c]] = $genInfoValues[$c];
}
$form_creator->popArr['editArr'] = $editArr;
$form_creator->popArr['cntlist'] = $country->getCountryCodes();
if (isset($editArr['COUNTRY'])) {
$form_creator->popArr['provlist'] = $province->getProvinceCodes($editArr['COUNTRY']);
}
if (isset($editArr['STATE'])) {
$form_creator->popArr['districtlist'] = $district->getDistrictCodes($editArr['STATE']);
}
//Finding the numer of employees
$empInfo = new EmpInfo();
$form_creator->popArr['empcount'] = $empInfo->countEmployee();
break;
case 'CUS':
$form_creator->formPath = '/templates/eimadmin/customer.php';
$customer = new Customer();
if ($getArr['capturemode'] == 'updatemode') {
$form_creator->popArr['editArr'] = $customer->fetchCustomer($getArr['id']);
} else {
$form_creator->popArr['editArr'] = new Customer();
}
break;
case 'CTM':
$form_creator->formPath = '/templates/eimadmin/customFields.php';
$form_creator->popArr['available'] = CustomFields::getAvailableFieldNumbers();
if ($getArr['capturemode'] == 'updatemode') {
$form_creator->popArr['editArr'] = CustomFields::getCustomField($getArr['id']);
} else {
$form_creator->popArr['editArr'] = new CustomFields();
}
break;
case 'CEX':
$form_creator->formPath = '/templates/eimadmin/customExportDefine.php';
$form_creator->popArr['customExportList'] = CustomExport::getCustomExportList();
if ($getArr['capturemode'] == 'updatemode') {
$customExport = CustomExport::getCustomExport($getArr['id']);
$form_creator->popArr['headings'] = $customExport->getHeadings();
$form_creator->popArr['available'] = $customExport->getAvailableFields();
$form_creator->popArr['assigned'] = $customExport->getAssignedFields();
$form_creator->popArr['exportName'] = $customExport->getName();
$form_creator->popArr['id'] = $customExport->getId();
} else {
$form_creator->popArr['headings'] = array();
$form_creator->popArr['available'] = CustomExport::getAllFields();
$form_creator->popArr['assigned'] = array();
$form_creator->popArr['exportName'] = null;
$form_creator->popArr['id'] = null;
}
break;
case 'CIM':
$form_creator->formPath = '/templates/eimadmin/customImportDefine.php';
$form_creator->popArr['customImportList'] = CustomImport::getCustomImportList();
if ($getArr['capturemode'] == 'updatemode') {
$customImport = CustomImport::getCustomImport($getArr['id']);
$form_creator->popArr['has_heading'] = $customImport->getContainsHeader();
$form_creator->popArr['available'] = $customImport->getAvailableFields();
$form_creator->popArr['assigned'] = $customImport->getAssignedFields();
$form_creator->popArr['importName'] = $customImport->getName();
$form_creator->popArr['id'] = $customImport->getId();