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;
 }
Exemplo n.º 2
0
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
**/
$slideshowWidget = new CWidget('hat_slides');
// create header form
$slideHeaderForm = new CForm('get');
$slideHeaderForm->setName('slideHeaderForm');
$configComboBox = new CComboBox('config', 'slides.php', 'javascript: redirect(this.options[this.selectedIndex].value);');
$configComboBox->addItem('screens.php', _('Screens'));
$configComboBox->addItem('slides.php', _('Slide shows'));
$slideHeaderForm->addItem($configComboBox);
if ($this->data['slideshows']) {
    $favouriteIcon = $this->data['screen'] ? get_icon('favourite', array('fav' => 'web.favorite.screenids', 'elname' => 'slideshowid', 'elid' => $this->data['elementId'])) : new CIcon(_('Favourites'), 'iconplus');
    $refreshIcon = new CIcon(_('Menu'), 'iconmenu');
    if ($this->data['screen']) {
        $refreshIcon->setMenuPopup(CMenuPopupHelper::getRefresh(WIDGET_SLIDESHOW, 'x' . $this->data['refreshMultiplier'], true, array('elementid' => $this->data['elementId'])));
    }
    $slideshowWidget->addPageHeader(_('SLIDE SHOWS'), array($slideHeaderForm, SPACE, $favouriteIcon, SPACE, $refreshIcon, SPACE, get_icon('fullscreen', array('fullscreen' => $this->data['fullscreen']))));
    $slideshowForm = new CForm('get');
    $slideshowForm->setName('slideForm');
    $slideshowForm->addVar('fullscreen', $this->data['fullscreen']);
    $slideshowsComboBox = new CComboBox('elementid', $this->data['elementId'], 'submit()');
    foreach ($this->data['slideshows'] as $slideshow) {
        $slideshowsComboBox->addItem($slideshow['slideshowid'], $slideshow['name']);
    }
    $slideshowForm->addItem(array(_('Slide show') . SPACE, $slideshowsComboBox));
    $slideshowWidget->addHeader($this->data['slideshows'][$this->data['elementId']]['name'], $slideshowForm);
    if ($this->data['screen']) {
        if (isset($this->data['isDynamicItems'])) {
            $slideshowForm->addItem(array(SPACE, _('Group'), SPACE, $this->data['pageFilter']->getGroupsCB()));
            $slideshowForm->addItem(array(SPACE, _('Host'), SPACE, $this->data['pageFilter']->getHostsCB()));
    } else {
        $triggerInfo = SPACE;
    }
    // if item type is 'Log' we must show log menu
    if (in_array($item['value_type'], array(ITEM_VALUE_TYPE_LOG, ITEM_VALUE_TYPE_STR, ITEM_VALUE_TYPE_TEXT))) {
        $triggers = array();
        foreach ($item['triggers'] as $trigger) {
            foreach ($trigger['functions'] as $function) {
                if (!str_in_array($function['function'], array('regexp', 'iregexp'))) {
                    continue 2;
                }
            }
            $triggers[] = array('id' => $trigger['triggerid'], 'name' => $trigger['description']);
        }
        $menuIcon = new CIcon(_('Menu'), 'iconmenu_b');
        $menuIcon->setMenuPopup(CMenuPopupHelper::getTriggerLog($item['itemid'], $item['name'], $triggers));
    } else {
        $menuIcon = SPACE;
    }
    $checkBox = new CCheckBox('group_itemid[' . $item['itemid'] . ']', null, null, $item['itemid']);
    $checkBox->setEnabled(empty($item['discoveryRule']));
    $itemTable->addRow(array($checkBox, $menuIcon, empty($this->data['filter_hostid']) ? $item['host'] : null, $description, $triggerInfo, CHtml::encode($item['key_']), $item['type'] == ITEM_TYPE_TRAPPER || $item['type'] == ITEM_TYPE_SNMPTRAP ? '' : $item['delay'], $item['history'], in_array($item['value_type'], array(ITEM_VALUE_TYPE_STR, ITEM_VALUE_TYPE_LOG, ITEM_VALUE_TYPE_TEXT)) ? '' : $item['trends'], item_type2str($item['type']), new CCol(CHtml::encode($item['applications_list']), 'wraptext'), $status, $infoIcons));
}
// create go buttons
$goComboBox = new CComboBox('action');
$goOption = new CComboItem('item.massenable', _('Enable selected'));
$goOption->setAttribute('confirm', _('Enable selected items?'));
$goComboBox->addItem($goOption);
$goOption = new CComboItem('item.massdisable', _('Disable selected'));
$goOption->setAttribute('confirm', _('Disable selected items?'));
$goComboBox->addItem($goOption);
Exemplo n.º 4
0
$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');