/** * Generate valuesAsHtml overview * * See {@link \ValidFormBuilder\ValidForm::valuesAsHtml()} * * @see \ValidFormBuilder\ValidForm::valuesAsHtml() */ public function valuesAsHtml($hideEmpty = false, $collection = null) { $strTable = "\t<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"validform\">\n"; $strTableOutput = ""; $collection = !is_null($collection) ? $collection : $this->__elements; foreach ($collection as $objPage) { if (get_class($objPage) === "ValidFormBuilder\\Page") { // Passing 'true' will return the optional 'short header' if available. $strHeader = $objPage->getShortHeader(); $strTableOutput .= "<tr><td colspan=\"3\" class=\"vf__page-header\">{$strHeader}</td></tr>"; foreach ($objPage->getFields() as $objFieldset) { $strSet = ""; $strTableOutput .= parent::fieldsetAsHtml($objFieldset, $strSet, $hideEmpty); } } } if (!empty($strTableOutput)) { return $strTable . $strTableOutput . "</table>"; } else { if (!empty($this->__novaluesmessage)) { return $strTable . "<tr><td colspan=\"3\">{$this->__novaluesmessage}</td></tr></table>"; } else { return ""; } } }
/** * Generate valuesAsHtml overview * * See {@link \ValidFormBuilder\ValidForm::valuesAsHtml()} * @see \ValidFormBuilder\ValidForm::valuesAsHtml() * * @param boolean $hideEmpty Set to true to hide empty field values from the overview. Defaults to false. * @param string $collection Optional - advanced usage only; a custom Collection of elements to parse * @return string Generated `table` with `label: value` pairs */ public function valuesAsHtml($hideEmpty = false, $collection = null) { $strTable = "\t<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"validform\">\n"; $strTableOutput = ""; $collection = !is_null($collection) ? $collection : $this->__elements; foreach ($collection as $objPage) { if (get_class($objPage) === "ValidFormBuilder\\Page") { // If this page was rendered invisible due to conditions, // don't show it on the valuesAsHtml overview either. if (!$this->elementShouldDisplay($objPage)) { continue; // Continue to the next page. } // Passing 'true' will return the optional 'short header' if available. $strHeader = $objPage->getShortHeader(); $strTableOutput .= "<tr><td colspan=\"3\" class=\"vf__page-header\">{$strHeader}</td></tr>"; foreach ($objPage->getFields() as $objFieldset) { $strSet = ""; $strTableOutput .= parent::fieldsetAsHtml($objFieldset, $strSet, $hideEmpty); } } } if (!empty($strTableOutput)) { return $strTable . $strTableOutput . "</table>"; } else { if (!empty($this->__novaluesmessage)) { return $strTable . "<tr><td colspan=\"3\">{$this->__novaluesmessage}</td></tr></table>"; } else { return ""; } } }