本文整理汇总了PHP中Fieldset::getFields方法的典型用法代码示例。如果您正苦于以下问题:PHP Fieldset::getFields方法的具体用法?PHP Fieldset::getFields怎么用?PHP Fieldset::getFields使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fieldset
的用法示例。
在下文中一共展示了Fieldset::getFields方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fieldsetAsHtml
/**
* Generates HTML output for all fieldsets and their children elements.
*
* This method is hardly used in the public API. The only reason why this is a public method is to enable
* customization through class extension.
*
* @param Fieldset $objFieldset The Fieldset object to parse
* @param string $strSet Previously generated HTML
* @param boolean $hideEmpty Set to true to hide empty field values from the overview. Defaults to false.
* @return string Generated HTML
*/
public function fieldsetAsHtml($objFieldset, &$strSet, $hideEmpty = false)
{
$strTableOutput = "";
foreach ($objFieldset->getFields() as $objField) {
if (is_object($objField) && get_class($objField) !== "ValidFormBuilder\\Hidden") {
//*** Get the string value. If it's an array, implode with ','
$strValue = $objField->getValue();
if (is_array($strValue)) {
$strValue = implode(", ", $strValue);
}
if (!empty($strValue) && $hideEmpty || !$hideEmpty && !is_null($strValue)) {
if ($objField->hasFields()) {
switch (get_class($objField)) {
case "ValidFormBuilder\\MultiField":
$strSet .= $this->multiFieldAsHtml($objField, $hideEmpty);
break;
default:
$strSet .= $this->areaAsHtml($objField, $hideEmpty);
}
} else {
$strSet .= $this->fieldAsHtml($objField, $hideEmpty);
}
}
if ($objField->isDynamic()) {
$intDynamicCount = $objField->getDynamicCount();
if ($intDynamicCount > 0) {
for ($intCount = 1; $intCount <= $intDynamicCount; $intCount++) {
switch (get_class($objField)) {
case "ValidFormBuilder\\MultiField":
$strSet .= $this->multiFieldAsHtml($objField, $hideEmpty, $intCount);
break;
case "ValidFormBuilder\\Area":
$strSet .= $this->areaAsHtml($objField, $hideEmpty, $intCount);
break;
default:
$strSet .= $this->fieldAsHtml($objField, $hideEmpty, $intCount);
}
}
}
}
}
}
$strHeader = $objFieldset->getHeader();
if (!empty($strHeader) && !empty($strSet)) {
$strTableOutput .= "<tr>";
$strTableOutput .= "<td colspan=\"3\"> </td>\n";
$strTableOutput .= "</tr>";
$strTableOutput .= "<tr>";
$strTableOutput .= "<td colspan=\"3\"><b>{$strHeader}</b></td>\n";
$strTableOutput .= "</tr>";
}
if (!empty($strSet)) {
$strTableOutput .= $strSet;
}
return $strTableOutput;
}