* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 * @author Icinga Development Team * */ // {{{ICINGA_LICENSE_HEADER}}} /** * Helper to render main and detail contents into a container */ use Icinga\Application\Icinga; class Zend_View_Helper_MainDetail extends Zend_View_Helper_Abstract { /** * HTML template * * @var string */ private static $tpl = <<<'EOT'
{{MAIN_CONTENT}}
{{DETAIL_CONTENT}}
EOT; /** * Css class map when detail pane is expanded * * @var array */ private static $expanded = array( 'xs' => 12, 'sm' => 12, 'md' => 12, 'lg' => 5 ); /** * Content render function * * @param string $mainContent HTML for main * @param string $detailContent HTML for detail * * @return string HTML all together */ public function mainDetail($mainContent, $detailContent = '') { $detailCls = 'hidden'; $mainCls = 'col-md-12 col-lg-12 col-xs-12 col-sm-12'; if ($detailContent != '') { $detailCls = ''; $mainCls = ''; foreach (self::$expanded as $type => $size) { $detailCls .= 'col-' . $type . '-' . ($size == 12 ? 'push-' : '') . $size . ' '; $mainCls .= 'col-' . $type . '-' . ($size == 12 ? 'pull-' : '') . ($size < 12 ? (12-$size) : 12). ' '; } } $html = str_replace('{{MAIN_CLASS}}', $mainCls, self::$tpl); $html = str_replace('{{DETAIL_CLASS}}', $detailCls, $html); $html = str_replace('{{MAIN_CONTENT}}', $mainContent, $html); $html = str_replace('{{DETAIL_CONTENT}}', $detailContent, $html); return $html; } } // @codingStandardsIgnoreEnd