本文整理匯總了PHP中ArrayData::iteratorProperties方法的典型用法代碼示例。如果您正苦於以下問題:PHP ArrayData::iteratorProperties方法的具體用法?PHP ArrayData::iteratorProperties怎麽用?PHP ArrayData::iteratorProperties使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ArrayData
的用法示例。
在下文中一共展示了ArrayData::iteratorProperties方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: Fields
/**
*
* @param bool $xmlSafe
* @return ArrayList
*/
public function Fields($xmlSafe = true)
{
$list = $this->parent->FieldList();
$counter = 0;
foreach ($list as $fieldName => $fieldTitle) {
$value = "";
// TODO Delegates that to DataList
// This supports simple FieldName syntax
if (strpos($fieldName, '.') === false) {
$value = $this->item->XML_val($fieldName) && $xmlSafe ? $this->item->XML_val($fieldName) : $this->item->RAW_val($fieldName);
// This support the syntax fieldName = Relation.RelatedField
} else {
$fieldNameParts = explode('.', $fieldName);
$tmpItem = $this->item;
for ($j = 0; $j < sizeof($fieldNameParts); $j++) {
$relationMethod = $fieldNameParts[$j];
$idField = $relationMethod . 'ID';
if ($j == sizeof($fieldNameParts) - 1) {
if ($tmpItem) {
$value = $tmpItem->{$relationMethod};
}
} else {
if ($tmpItem) {
$tmpItem = $tmpItem->{$relationMethod}();
}
}
}
}
// casting
if (array_key_exists($fieldName, $this->parent->fieldCasting)) {
$value = $this->parent->getCastedValue($value, $this->parent->fieldCasting[$fieldName]);
} elseif (is_object($value) && method_exists($value, 'Nice')) {
$value = $value->Nice();
}
// formatting
$item = $this->item;
if (array_key_exists($fieldName, $this->parent->fieldFormatting)) {
$format = str_replace('$value', "__VAL__", $this->parent->fieldFormatting[$fieldName]);
$format = preg_replace('/\\$([A-Za-z0-9-_]+)/', '$item->$1', $format);
$format = str_replace('__VAL__', '$value', $format);
eval('$value = "' . $format . '";');
}
//escape
if ($escape = $this->parent->getDatagrid()->fieldEscape) {
foreach ($escape as $search => $replace) {
$value = str_replace($search, $replace, $value);
}
}
$arrayData = new ArrayData(array("Name" => $fieldName, "Title" => $fieldTitle, "Value" => $value));
$arrayData->iteratorProperties($counter++, count($list));
$fields[] = $arrayData;
}
return new ArrayList($fields);
}