本文整理汇总了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);
}