105 lines
3.2 KiB
PHP
105 lines
3.2 KiB
PHP
<?php
|
|
// @codingStandardsIgnoreStart
|
|
|
|
// {{{ICINGA_LICENSE_HEADER}}}
|
|
/**
|
|
* This file is part of Icinga Web 2.
|
|
*
|
|
* Icinga Web 2 - Head for multiple monitoring backends.
|
|
* Copyright (C) 2013 Icinga Development Team
|
|
*
|
|
* This program is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU General Public License
|
|
* as published by the Free Software Foundation; either version 2
|
|
* of the License, or (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, write to the Free Software
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
*
|
|
* @copyright 2013 Icinga Development Team <info@icinga.org>
|
|
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
|
|
* @author Icinga Development Team <info@icinga.org>
|
|
*
|
|
*/
|
|
// {{{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'
|
|
<div id='icingamain' class='{{MAIN_CLASS}}'>
|
|
{{MAIN_CONTENT}}
|
|
</div>
|
|
|
|
<p id="icingadetailClose" align="right" class="hidden">
|
|
<a
|
|
rel="tooltip"
|
|
title="Close"
|
|
class="button btn-common btn-small"
|
|
>
|
|
<i class="icinga-icon-remove"></i>
|
|
</a>
|
|
</p>
|
|
<div id='icingadetail' class='{{DETAIL_CLASS}}'>
|
|
{{DETAIL_CONTENT}}
|
|
</div>
|
|
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
|