Ejemplo n.º 1
0
function make_sorting_header($obj, $tabfield, $sortField, $sortOrder)
{
    global $page;
    $sortorder = $sortField == $tabfield && $sortOrder == ZBX_SORT_UP ? ZBX_SORT_DOWN : ZBX_SORT_UP;
    $link = CUrlFactory::getContextUrl();
    $link->setArgument('sort', $tabfield);
    $link->setArgument('sortorder', $sortorder);
    $url = $link->getUrl();
    if ($page['type'] != PAGE_TYPE_HTML && defined('ZBX_PAGE_MAIN_HAT')) {
        $script = "javascript: return updater.onetime_update('" . ZBX_PAGE_MAIN_HAT . "', '" . $url . "');";
    } else {
        $script = 'javascript: redirect("' . $url . '");';
    }
    zbx_value2array($obj);
    $cont = new CSpan();
    foreach ($obj as $el) {
        if (is_object($el) || $el === SPACE) {
            $cont->addItem($el);
        } else {
            $cont->addItem(new CSpan($el, 'underline'));
        }
    }
    $cont->addItem(SPACE);
    $img = null;
    if ($tabfield == $sortField) {
        if ($sortorder == ZBX_SORT_UP) {
            $img = new CSpan(SPACE, 'icon_sortdown');
        } else {
            $img = new CSpan(SPACE, 'icon_sortup');
        }
    }
    $col = new CCol(array($cont, $img), 'nowrap hover_grey');
    $col->setAttribute('onclick', $script);
    return $col;
}
Ejemplo n.º 2
0
            $colorComboBox->addItem(MARK_COLOR_GREEN, _('as Green'));
            $colorComboBox->addItem(MARK_COLOR_BLUE, _('as Blue'));
            $tasks[] = SPACE;
            $tasks[] = $colorComboBox;
        }
        $filterForm->addRow(_('Selected'), $tasks);
        $filterForm->addItemToBottomRow(new CSubmit('select', _('Filter')));
    }
}
// create history screen
$screen = CScreenBuilder::getScreen(array('resourcetype' => SCREEN_RESOURCE_HISTORY, 'action' => $this->data['action'], 'items' => $this->data['items'], 'item' => $this->data['item'], 'itemids' => $this->data['itemids'], 'profileIdx' => 'web.item.graph', 'profileIdx2' => reset($this->data['itemids']), 'period' => $this->data['period'], 'stime' => $this->data['stime'], 'filter' => get_request('filter'), 'filter_task' => get_request('filter_task'), 'mark_color' => get_request('mark_color'), 'plaintext' => $this->data['plaintext']));
// append plaintext to widget
if ($this->data['plaintext']) {
    $plaintextSpan = new CSpan(null, 'textblackwhite');
    foreach ($headerPlaintext as $text) {
        $plaintextSpan->addItem(array(new CJSscript($text), BR()));
    }
    $screen = $screen->get();
    $pre = new CTag('pre', true);
    foreach ($screen as $text) {
        $pre->addItem(new CJSscript($text));
    }
    $plaintextSpan->addItem($pre);
    $historyWidget->addItem($plaintextSpan);
} else {
    $right = new CTable();
    $right->addRow($header['right']);
    $historyWidget->addPageHeader($header['left'], $right);
    $historyWidget->addItem(SPACE);
    if (isset($this->data['iv_string'][$this->data['item']['value_type']])) {
        $historyWidget->addFlicker($filterForm, CProfile::get('web.history.filter.state', 1));
Ejemplo n.º 3
0
    if (isset($iv_string[$item['value_type']])) {
        $historyWidget->addFlicker($filterForm, CProfile::get('web.history.filter.state', 1));
    }
    $historyWidget->addItem($table);
    if (str_in_array($_REQUEST['action'], array('showvalues', 'showgraph'))) {
        zbx_add_post_js('timeControl.addObject("' . $dom_graph_id . '",' . zbx_jsvalue($timeline) . ',' . zbx_jsvalue($objData) . ');');
        zbx_add_post_js('timeControl.processObjects();');
        $scroll_div = new CDiv();
        $scroll_div->setAttribute('id', 'scrollbar_cntr');
        $historyWidget->addFlicker($scroll_div, CProfile::get('web.history.filter.state', 1));
    }
    $historyWidget->show();
} else {
    $span = new CSpan(null, 'textblackwhite');
    foreach ($ptData['header'] as $bnum => $text) {
        $span->addItem(array(new CJSscript($text), BR()));
    }
    $pre = new CTag('pre', true);
    foreach ($ptData['body'] as $bnum => $text) {
        $pre->addItem(new CJSscript($text));
    }
    $span->addItem($pre);
    $span->show();
}
?>
<script type="text/javascript">
//<!--<![CDATA[
function addPopupValues(list){
	if(!isset('object', list)){
		throw("Error hash attribute 'list' doesn't contain 'object' index");
		return false;
Ejemplo n.º 4
0
 private function makeCell($id)
 {
     $td = new CCol();
     $caption = new CSpan();
     if ($id != 0 && array_key_exists('childnodes', $this->tree[$id])) {
         $caption->addItem((new CDiv((new CSpan())->addClass('arrow-right')))->addClass('treeview')->onClick($this->treename . '.closeSNodeX("' . $id . '", this.getElementsByTagName(\'span\')[0]);')->setId('idi_' . $id));
     }
     $caption->addItem($this->tree[$id]['caption']);
     if ($this->tree[$id]['Level'] != 0) {
         $level = $this->tree[$id]['Level'];
         $caption->setAttribute('style', 'padding-left:' . 2 * $level . 'em;');
     }
     $td->addItem($caption);
     return $td;
 }
Ejemplo n.º 5
0
     $hostName = new CSpan($triggerHost['name'], 'link_menu');
     $hostName->setMenuPopup(CMenuPopupHelper::getHost($hosts[$triggerHost['hostid']], $scripts));
     // add maintenance icon with hint if host is in maintenance
     if ($triggerHost['maintenance_status']) {
         $maintenanceIcon = new CDiv(null, 'icon-maintenance-inline');
         $maintenances = API::Maintenance()->get(array('maintenanceids' => $triggerHost['maintenanceid'], 'output' => API_OUTPUT_EXTEND, 'limit' => 1));
         if ($maintenance = reset($maintenances)) {
             $hint = $maintenance['name'] . ' [' . ($triggerHost['maintenance_type'] ? _('Maintenance without data collection') : _('Maintenance with data collection')) . ']';
             if (isset($maintenance['description'])) {
                 // double quotes mandatory
                 $hint .= "\n" . $maintenance['description'];
             }
             $maintenanceIcon->setHint($hint);
             $maintenanceIcon->addClass('pointer');
         }
         $hostName->addItem($maintenanceIcon);
     }
     $hostList[] = $hostName;
     $hostList[] = ', ';
 }
 array_pop($hostList);
 // host
 $hostColumn = new CCol($hostList);
 $hostColumn->addStyle('white-space: normal;');
 // status
 $statusSpan = new CSpan(trigger_value2str($trigger['value']));
 // add colors and blinking to span depending on configuration and trigger parameters
 addTriggerValueStyle($statusSpan, $trigger['value'], $trigger['lastchange'], $config['event_ack_enable'] ? $trigger['event_count'] == 0 : false);
 $lastChangeDate = zbx_date2str(DATE_TIME_FORMAT_SECONDS, $trigger['lastchange']);
 $lastChange = empty($trigger['lastchange']) ? $lastChangeDate : new CLink($lastChangeDate, 'events.php?filter_set=1&triggerid=' . $trigger['triggerid'] . '&source=' . EVENT_SOURCE_TRIGGERS . '&stime=' . date(TIMESTAMP_FORMAT, $trigger['lastchange']) . '&period=' . ZBX_PERIOD_DEFAULT);
 // acknowledge