当前位置: 首页>>代码示例>>PHP>>正文


PHP Fieldset::getHeader方法代码示例

本文整理汇总了PHP中Fieldset::getHeader方法的典型用法代码示例。如果您正苦于以下问题:PHP Fieldset::getHeader方法的具体用法?PHP Fieldset::getHeader怎么用?PHP Fieldset::getHeader使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Fieldset的用法示例。


在下文中一共展示了Fieldset::getHeader方法的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\">&nbsp;</td>\n";
         $strTableOutput .= "</tr>";
         $strTableOutput .= "<tr>";
         $strTableOutput .= "<td colspan=\"3\"><b>{$strHeader}</b></td>\n";
         $strTableOutput .= "</tr>";
     }
     if (!empty($strSet)) {
         $strTableOutput .= $strSet;
     }
     return $strTableOutput;
 }
开发者ID:SLivio,项目名称:validformbuilder,代码行数:67,代码来源:ValidForm.php


注:本文中的Fieldset::getHeader方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。