コード例 #1
0
 public function getMenuIcons()
 {
     $icons = array();
     if ($this->canRefresh()) {
         $icon = new CIcon(_('Menu'), 'iconmenu');
         $icon->setMenuPopup(CMenuPopupHelper::getRefresh($this->getID(), $this->getSetting('rf_rate', $this->defaultRefreshRate)));
         $icons[] = $icon;
     }
     return $icons;
 }
コード例 #2
0
    $dashboardGrid[$col][$row] = (new CCollapsibleUiWidget($widgetid, $widget['data']))->setExpanded((bool) CProfile::get('web.dashboard.widget.' . $widgetid . '.state', true))->setHeader($widget['header'], [$icon], true, 'zabbix.php?action=dashboard.widget')->setFooter($footer);
}
$widgets = [WIDGET_SYSTEM_STATUS => ['action' => 'widget.system.view', 'header' => _('System status'), 'defaults' => ['col' => 1, 'row' => 1]], WIDGET_HOST_STATUS => ['action' => 'widget.hosts.view', 'header' => _('Host status'), 'defaults' => ['col' => 1, 'row' => 2]], WIDGET_LAST_ISSUES => ['action' => 'widget.issues.view', 'header' => _n('Last %1$d issue', 'Last %1$d issues', DEFAULT_LATEST_ISSUES_CNT), 'defaults' => ['col' => 1, 'row' => 3]], WIDGET_WEB_OVERVIEW => ['action' => 'widget.web.view', 'header' => _('Web monitoring'), 'defaults' => ['col' => 1, 'row' => 4]]];
if ($data['show_status_widget']) {
    $widgets[WIDGET_ZABBIX_STATUS] = ['action' => 'widget.status.view', 'header' => _('Status of Zabbix'), 'defaults' => ['col' => 1, 'row' => 0]];
}
if ($data['show_discovery_widget']) {
    $widgets[WIDGET_DISCOVERY_STATUS] = ['action' => 'widget.discovery.view', 'header' => _('Discovery status'), 'defaults' => ['col' => 1, 'row' => 5]];
}
foreach ($widgets as $widgetid => $widget) {
    $profile = 'web.dashboard.widget.' . $widgetid;
    $rate = CProfile::get($profile . '.rf_rate', 60);
    $expanded = (bool) CProfile::get($profile . '.state', true);
    $col = CProfile::get($profile . '.col', $widget['defaults']['col']);
    $row = CProfile::get($profile . '.row', $widget['defaults']['row']);
    $icon = (new CButton(null))->addClass(ZBX_STYLE_BTN_WIDGET_ACTION)->setTitle(_('Action'))->setMenuPopup(CMenuPopupHelper::getRefresh($widgetid, $rate));
    $dashboardGrid[$col][$row] = (new CCollapsibleUiWidget($widgetid, (new CDiv())->addClass('preloader')))->setExpanded($expanded)->setHeader($widget['header'], [$icon], true, 'zabbix.php?action=dashboard.widget')->setFooter((new CList())->setId($widgetid . '_footer'));
    $widgetRefreshParams[$widgetid] = ['frequency' => $rate, 'url' => 'zabbix.php?action=' . $widget['action'], 'counter' => 0, 'darken' => 0, 'params' => ['widgetRefresh' => $widgetid]];
}
// sort dashboard grid
foreach ($dashboardGrid as $key => $val) {
    ksort($dashboardGrid[$key]);
}
$dashboardRow = (new CDiv([(new CDiv($dashboardGrid[0]))->addClass('cell'), (new CDiv($dashboardGrid[1]))->addClass('cell'), (new CDiv($dashboardGrid[2]))->addClass('cell')]))->addClass('row');
$dashboardTable = (new CDiv($dashboardRow))->addClass('table')->addClass('widget-placeholder');
$dashboard->addItem($dashboardTable)->show();
/*
 * Javascript
 */
// start refresh process
$this->addPostJS('initPMaster("dashboard", ' . CJs::encodeJson($widgetRefreshParams) . ');');
コード例 #3
0
** 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.
**/
$widget = (new CWidget())->setTitle(_('Slide shows'))->addItem((new CList())->addClass(ZBX_STYLE_OBJECT_GROUP)->addItem([(new CSpan())->addItem(new CLink(_('All slide shows'), 'slideconf.php')), '/', (new CSpan())->addClass(ZBX_STYLE_SELECTED)->addItem(new CLink($data['screen']['name'], 'slides.php?elementid=' . $data['screen']['slideshowid'] . '&fullscreen=' . $data['fullscreen']))]));
// Create header form.
$header = (new CForm('get'))->setName('slideHeaderForm');
$controls = (new CList())->addItem(new CComboBox('config', 'slides.php', 'redirect(this.options[this.selectedIndex].value);', ['screens.php' => _('Screens'), 'slides.php' => _('Slide shows')]));
$favourite_icon = $this->data['screen'] ? get_icon('favourite', ['fav' => 'web.favorite.screenids', 'elname' => 'slideshowid', 'elid' => $this->data['elementId']]) : (new CIcon(_('Favourites')))->addClass('iconplus');
$refresh_icon = get_icon('screenconf');
if ($this->data['screen']) {
    $refresh_icon->setMenuPopup(CMenuPopupHelper::getRefresh(WIDGET_SLIDESHOW, 'x' . $this->data['refreshMultiplier'], true, ['elementid' => $this->data['elementId']]));
}
$header->addVar('fullscreen', $this->data['fullscreen']);
if (isset($this->data['isDynamicItems'])) {
    $controls->addItem([SPACE, _('Group'), SPACE, $this->data['pageFilter']->getGroupsCB()]);
    $controls->addItem([SPACE, _('Host'), SPACE, $this->data['pageFilter']->getHostsCB()]);
}
$controls->addItem($data['screen']['editable'] ? (new CButton('edit', _('Edit slide show')))->onClick('redirect("slideconf.php?form=update&slideshowid=' . $data['screen']['slideshowid'] . '")') : null)->addItem($favourite_icon)->addItem($refresh_icon)->addItem(get_icon('fullscreen', ['fullscreen' => $this->data['fullscreen']]));
$header->addItem($controls);
$widget->setControls($header);
$filter = (new CFilter('web.slides.filter.state'))->addNavigator();
$widget->addItem($filter);
$widget->addItem((new CDiv((new CDiv())->addClass('preloader')))->setId(WIDGET_SLIDESHOW));
require_once dirname(__FILE__) . '/js/monitoring.slides.js.php';
return $widget;
コード例 #4
0
ファイル: dashboard.php プロジェクト: omidmt/zabbix-greenplum
$icon = new CIcon(_('Menu'), 'iconmenu');
$icon->setMenuPopup(CMenuPopupHelper::getRefresh(WIDGET_WEB_OVERVIEW, $rate));
$webMonitoring = new CCollapsibleUiWidget(WIDGET_WEB_OVERVIEW, new CSpan(_('Loading...'), 'textcolorstyles'));
$webMonitoring->open = (bool) CProfile::get('web.dashboard.widget.' . WIDGET_WEB_OVERVIEW . '.state', true);
$webMonitoring->setHeader(_('Web monitoring'), $icon);
$webMonitoring->setFooter(new CDiv(SPACE, 'textwhite', WIDGET_WEB_OVERVIEW . '_footer'));
$col = CProfile::get('web.dashboard.widget.' . WIDGET_WEB_OVERVIEW . '.col', 1);
$row = CProfile::get('web.dashboard.widget.' . WIDGET_WEB_OVERVIEW . '.row', 4);
$dashboardGrid[$col][$row] = $webMonitoring;
$widgetRefreshParams[WIDGET_WEB_OVERVIEW] = array('frequency' => $rate, 'url' => '?output=html', 'counter' => 0, 'darken' => 0, 'params' => array('widgetRefresh' => WIDGET_WEB_OVERVIEW));
// discovery rules
$dbDiscoveryRules = DBfetch(DBselect('SELECT COUNT(d.druleid) AS cnt' . ' FROM drules d' . ' WHERE d.status=' . DRULE_STATUS_ACTIVE));
if ($dbDiscoveryRules['cnt'] > 0 && check_right_on_discovery()) {
    $rate = CProfile::get('web.dashboard.widget.' . WIDGET_DISCOVERY_STATUS . '.rf_rate', 60);
    $icon = new CIcon(_('Menu'), 'iconmenu');
    $icon->setMenuPopup(CMenuPopupHelper::getRefresh(WIDGET_DISCOVERY_STATUS, $rate));
    $discoveryStatus = new CCollapsibleUiWidget(WIDGET_DISCOVERY_STATUS, new CSpan(_('Loading...'), 'textcolorstyles'));
    $discoveryStatus->open = (bool) CProfile::get('web.dashboard.widget.' . WIDGET_DISCOVERY_STATUS . '.state', true);
    $discoveryStatus->setHeader(_('Discovery status'), $icon);
    $discoveryStatus->setFooter(new CDiv(SPACE, 'textwhite', WIDGET_DISCOVERY_STATUS . '_footer'));
    $col = CProfile::get('web.dashboard.widget.' . WIDGET_DISCOVERY_STATUS . '.col', 1);
    $row = CProfile::get('web.dashboard.widget.' . WIDGET_DISCOVERY_STATUS . '.row', 5);
    $dashboardGrid[$col][$row] = $discoveryStatus;
    $widgetRefreshParams[WIDGET_DISCOVERY_STATUS] = array('frequency' => $rate, 'url' => '?output=html', 'counter' => 0, 'darken' => 0, 'params' => array('widgetRefresh' => WIDGET_DISCOVERY_STATUS));
}
// sort dashboard grid
foreach ($dashboardGrid as $key => $val) {
    ksort($dashboardGrid[$key]);
}
$dashboardTable = new CTable();
$dashboardTable->addRow(array(new CDiv($dashboardGrid[0], 'column'), new CDiv($dashboardGrid[1], 'column'), new CDiv($dashboardGrid[2], 'column')), 'top');