/**
  * Process screen.
  *
  * @return CDiv (screen inside container)
  */
 public function get()
 {
     $image = new CImg('map.php?noedit=1&sysmapid=' . $this->screenitem['resourceid'] . '&width=' . $this->screenitem['width'] . '&height=' . $this->screenitem['height'] . '&curtime=' . time());
     $image->setAttribute('id', 'map_' . $this->screenitem['screenitemid']);
     if ($this->mode == SCREEN_MODE_PREVIEW) {
         $sysmap = API::Map()->get(array('sysmapids' => $this->screenitem['resourceid'], 'output' => API_OUTPUT_EXTEND, 'selectSelements' => API_OUTPUT_EXTEND, 'selectLinks' => API_OUTPUT_EXTEND, 'expandUrls' => true, 'nopermissions' => true, 'preservekeys' => true));
         $sysmap = reset($sysmap);
         $actionMap = getActionMapBySysmap($sysmap);
         $image->setMap($actionMap->getName());
         $output = array($actionMap, $image);
     } elseif ($this->mode == SCREEN_MODE_EDIT) {
         $output = array($image, BR(), new CLink(_('Change'), $this->action));
     } else {
         $output = array($image);
     }
     $this->insertFlickerfreeJs();
     $div = new CDiv($output, 'map-container flickerfreescreen', $this->getScreenId());
     $div->setAttribute('data-timestamp', $this->timestamp);
     $div->addStyle('position: relative;');
     return $div;
 }
Esempio n. 2
0
    define('ZBX_PAGE_NO_MENU', 1);
}
$refresh_rate = 30;
//seconds
$fields = array('warning_msg' => array(T_ZBX_STR, O_OPT, NULL, NULL, NULL), 'message' => array(T_ZBX_STR, O_OPT, NULL, NULL, NULL), 'retry' => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, NULL, NULL), 'cancel' => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, NULL, NULL));
check_fields($fields, false);
if (isset($_REQUEST['cancel'])) {
    zbx_unsetcookie('ZBX_CONFIG');
    redirect('index.php');
}
//	clear_messages();
$USER_DETAILS['refresh'] = $refresh_rate;
include_once 'include/page_header.php';
unset($USER_DETAILS);
$table = new CTable(null, 'warning');
$table->setAlign('center');
$table->setAttribute('style', 'width: 480px; margin-top: 100px;');
$table->setHeader(array(new CCol(S_ZABBIX . SPACE . ZABBIX_VERSION, 'left')), 'header');
$table->addRow(SPACE);
$warning_msg = isset($_REQUEST['warning_msg']) ? $_REQUEST['warning_msg'] : S_ZABBIX_IS_UNAVAILABLE . '!';
$img = new CImg('./images/general/warning16r.gif', 'warning', 16, 16, 'img');
$img->setAttribute('style', 'border-width: 0px; vertical-align: bottom;');
$msg = new CSpan(bold(SPACE . $warning_msg));
$msg->setAttribute('style', 'line-height: 20px; vertical-align: top;');
$table->addRow(new CCol(array($img, $msg), 'center'));
$table->addRow(SPACE);
$table->setFooter(new CCol(new CButton('retry', S_RETRY, 'javascript: document.location.reload();'), 'left'), 'footer');
$table->show();
zbx_add_post_js('setTimeout("document.location.reload();",' . $refresh_rate * 1000 . ');');
echo SBR;
include_once 'include/page_footer.php';
 /**
  * Process screen with particular screen objects.
  *
  * @return CTable
  */
 public function show()
 {
     if (empty($this->screen)) {
         return new CTableInfo(_('No screens defined.'));
     }
     $skipedFields = array();
     $screenitems = array();
     $emptyScreenColumns = array();
     // calculate table columns and rows
     foreach ($this->screen['screenitems'] as $screenitem) {
         $screenitems[] = $screenitem;
         for ($i = 0; $i < $screenitem['rowspan'] || $i == 0; $i++) {
             for ($j = 0; $j < $screenitem['colspan'] || $j == 0; $j++) {
                 if ($i != 0 || $j != 0) {
                     if (!isset($skipedFields[$screenitem['y'] + $i])) {
                         $skipedFields[$screenitem['y'] + $i] = array();
                     }
                     $skipedFields[$screenitem['y'] + $i][$screenitem['x'] + $j] = 1;
                 }
             }
         }
     }
     // create screen table
     $screenTable = new CTable();
     $screenTable->setAttribute('class', in_array($this->mode, array(SCREEN_MODE_PREVIEW, SCREEN_MODE_SLIDESHOW)) ? 'screen_view' : 'screen_edit');
     $screenTable->setAttribute('id', 'iframe');
     // action top row
     if ($this->mode == SCREEN_MODE_EDIT) {
         $newColumns = array(new CCol(new CImg('images/general/zero.png', 'zero', 1, 1)));
         for ($i = 0, $size = $this->screen['hsize'] + 1; $i < $size; $i++) {
             $icon = new CImg('images/general/plus.png', null, null, null, 'pointer');
             $icon->addAction('onclick', 'javascript: location.href = "screenedit.php?config=1&screenid=' . $this->screen['screenid'] . '&add_col=' . $i . '";');
             array_push($newColumns, new CCol($icon));
         }
         $screenTable->addRow($newColumns);
     }
     for ($r = 0; $r < $this->screen['vsize']; $r++) {
         $newColumns = array();
         $emptyScreenRow = true;
         // action left cell
         if ($this->mode == SCREEN_MODE_EDIT) {
             $icon = new CImg('images/general/plus.png', null, null, null, 'pointer');
             $icon->addAction('onclick', 'javascript: location.href = "screenedit.php?config=1&screenid=' . $this->screen['screenid'] . '&add_row=' . $r . '";');
             array_push($newColumns, new CCol($icon));
         }
         for ($c = 0; $c < $this->screen['hsize']; $c++) {
             if (isset($skipedFields[$r][$c])) {
                 continue;
             }
             // screen item
             $isEditForm = false;
             $screenitem = array();
             foreach ($screenitems as $tmprow) {
                 if ($tmprow['x'] == $c && $tmprow['y'] == $r) {
                     $screenitem = $tmprow;
                     break;
                 }
             }
             if (empty($screenitem)) {
                 $screenitem = array('screenitemid' => 0, 'resourcetype' => 0, 'resourceid' => 0, 'width' => 0, 'height' => 0, 'colspan' => 1, 'rowspan' => 1, 'elements' => 0, 'valign' => VALIGN_DEFAULT, 'halign' => HALIGN_DEFAULT, 'style' => 0, 'url' => '', 'dynamic' => 0, 'sort_triggers' => SCREEN_SORT_TRIGGERS_DATE_DESC);
             }
             if (!empty($screenitem['screenitemid'])) {
                 $emptyScreenRow = false;
                 $emptyScreenColumns[$c] = 1;
             }
             // action
             if ($this->mode == SCREEN_MODE_EDIT && $screenitem['screenitemid'] != 0) {
                 $action = 'screenedit.php?form=update' . url_param('screenid') . '&screenitemid=' . $screenitem['screenitemid'];
             } elseif ($this->mode == SCREEN_MODE_EDIT && $screenitem['screenitemid'] == 0) {
                 $action = 'screenedit.php?form=update' . url_param('screenid') . '&x=' . $c . '&y=' . $r;
             } else {
                 $action = null;
             }
             // edit form cell
             if ($this->mode == SCREEN_MODE_EDIT && (isset($_REQUEST['form']) && $_REQUEST['form'] == 'update') && (isset($_REQUEST['x']) && $_REQUEST['x'] == $c && isset($_REQUEST['y']) && $_REQUEST['y'] == $r || isset($_REQUEST['screenitemid']) && bccomp($_REQUEST['screenitemid'], $screenitem['screenitemid']) == 0)) {
                 $screenView = new CView('configuration.screen.constructor.edit', array('screen' => $this->screen));
                 $item = $screenView->render();
                 $isEditForm = true;
             } elseif (!empty($screenitem['screenitemid']) && isset($screenitem['resourcetype'])) {
                 $screenBase = CScreenBuilder::getScreen(array('isFlickerfree' => $this->isFlickerfree, 'pageFile' => $this->pageFile, 'mode' => $this->mode, 'timestamp' => $this->timestamp, 'hostid' => $this->hostid, 'profileIdx' => $this->profileIdx, 'profileIdx2' => $this->profileIdx2, 'updateProfile' => $this->updateProfile, 'timeline' => $this->timeline, 'resourcetype' => $screenitem['resourcetype'], 'screenitem' => $screenitem));
                 if (!empty($screenBase)) {
                     if ($this->mode == SCREEN_MODE_EDIT && !empty($screenitem['screenitemid'])) {
                         $screenBase->action = 'screenedit.php?form=update' . url_param('screenid') . '&screenitemid=' . $screenitem['screenitemid'];
                     } elseif ($this->mode == SCREEN_MODE_EDIT && empty($screenitem['screenitemid'])) {
                         $screenBase->action = 'screenedit.php?form=update' . url_param('screenid') . '&x=' . $c . '&y=' . $r;
                     }
                     $item = $screenBase->get();
                 } else {
                     $item = null;
                 }
             } else {
                 $item = array(SPACE);
                 if ($this->mode == SCREEN_MODE_EDIT) {
                     array_push($item, BR(), new CLink(_('Change'), $action, 'empty_change_link'));
                 }
             }
             // align
             $halign = 'def';
             if ($screenitem['halign'] == HALIGN_CENTER) {
                 $halign = 'cntr';
             }
             if ($screenitem['halign'] == HALIGN_LEFT) {
                 $halign = 'left';
             }
             if ($screenitem['halign'] == HALIGN_RIGHT) {
                 $halign = 'right';
             }
             $valign = 'def';
             if ($screenitem['valign'] == VALIGN_MIDDLE) {
                 $valign = 'mdl';
             }
             if ($screenitem['valign'] == VALIGN_TOP) {
                 $valign = 'top';
             }
             if ($screenitem['valign'] == VALIGN_BOTTOM) {
                 $valign = 'bttm';
             }
             if ($this->mode == SCREEN_MODE_EDIT && !$isEditForm) {
                 $item = new CDiv($item, 'draggable');
                 $item->setAttribute('id', 'position_' . $r . '_' . $c);
                 $item->setAttribute('data-xcoord', $c);
                 $item->setAttribute('data-ycoord', $r);
             }
             // colspan/rowspan
             $newColumn = new CCol($item, $halign . '_' . $valign . ' screenitem');
             if (!empty($screenitem['colspan'])) {
                 $newColumn->setColSpan($screenitem['colspan']);
             }
             if (!empty($screenitem['rowspan'])) {
                 $newColumn->setRowSpan($screenitem['rowspan']);
             }
             array_push($newColumns, $newColumn);
         }
         // action right cell
         if ($this->mode == SCREEN_MODE_EDIT) {
             $icon = new CImg('images/general/minus.png', null, null, null, 'pointer');
             if ($emptyScreenRow) {
                 $removeRowLink = 'javascript: location.href = "screenedit.php?screenid=' . $this->screen['screenid'] . '&rmv_row=' . $r . '";';
             } else {
                 $removeRowLink = 'javascript: if (Confirm("' . _('This screen-row is not empty. Delete it?') . '")) {' . ' location.href = "screenedit.php?screenid=' . $this->screen['screenid'] . '&rmv_row=' . $r . '"; }';
             }
             $icon->addAction('onclick', $removeRowLink);
             array_push($newColumns, new CCol($icon));
         }
         $screenTable->addRow(new CRow($newColumns));
     }
     // action bottom row
     if ($this->mode == SCREEN_MODE_EDIT) {
         $icon = new CImg('images/general/plus.png', null, null, null, 'pointer');
         $icon->addAction('onclick', 'javascript: location.href = "screenedit.php?screenid=' . $this->screen['screenid'] . '&add_row=' . $this->screen['vsize'] . '";');
         $newColumns = array(new CCol($icon));
         for ($i = 0; $i < $this->screen['hsize']; $i++) {
             $icon = new CImg('images/general/minus.png', null, null, null, 'pointer');
             if (isset($emptyScreenColumns[$i])) {
                 $removeColumnLink = 'javascript: if (Confirm("' . _('This screen-column is not empty. Delete it?') . '")) {' . ' location.href = "screenedit.php?screenid=' . $this->screen['screenid'] . '&rmv_col=' . $i . '"; }';
             } else {
                 $removeColumnLink = 'javascript: location.href = "screenedit.php?config=1&screenid=' . $this->screen['screenid'] . '&rmv_col=' . $i . '";';
             }
             $icon->addAction('onclick', $removeColumnLink);
             array_push($newColumns, new CCol($icon));
         }
         array_push($newColumns, new CCol(new CImg('images/general/zero.png', 'zero', 1, 1)));
         $screenTable->addRow($newColumns);
     }
     return $screenTable;
 }
Esempio n. 4
0
function bar_report_form3()
{
    global $USER_DETAILS;
    $available_hosts = get_accessible_hosts_by_user($USER_DETAILS, PERM_READ_ONLY);
    $config = get_request('config', 1);
    $title = get_request('title', S_REPORT . ' 3');
    $xlabel = get_request('xlabel', '');
    $ylabel = get_request('ylabel', '');
    $sorttype = get_request('sorttype', 0);
    $scaletype = get_request('scaletype', TIMEPERIOD_TYPE_WEEKLY);
    $avgperiod = get_request('avgperiod', TIMEPERIOD_TYPE_DAILY);
    $report_timesince = get_request('report_timesince', date('YmdHis', time() - 86400));
    $report_timetill = get_request('report_timetill', date('YmdHis'));
    $captions = get_request('captions', array());
    $items = get_request('items', array());
    $hostids = get_request('hostids', array());
    $hostids = zbx_toHash($hostids);
    $showlegend = get_request('showlegend', 0);
    $palette = get_request('palette', 0);
    $palettetype = get_request('palettetype', 0);
    $reportForm = new CFormTable(null, null, 'get');
    //,'events.php?report_set=1','POST',null,'sform');
    $reportForm->setAttribute('name', 'zbx_report');
    $reportForm->setAttribute('id', 'zbx_report');
    //	$reportForm->setMethod('post');
    if (isset($_REQUEST['report_show']) && !empty($items)) {
        $reportForm->addVar('report_show', 'show');
    }
    $reportForm->addVar('config', $config);
    $reportForm->addVar('report_timesince', date('YmdHis', $report_timesince));
    $reportForm->addVar('report_timetill', date('YmdHis', $report_timetill));
    //	$reportForm->addVar('items',$items); 				//params are set later!!
    //	$reportForm->addVar('periods',$periods);
    $reportForm->addRow(S_TITLE, new CTextBox('title', $title, 40));
    $reportForm->addRow(S_X . SPACE . S_LABEL, new CTextBox('xlabel', $xlabel, 40));
    $reportForm->addRow(S_Y . SPACE . S_LABEL, new CTextBox('ylabel', $ylabel, 40));
    $reportForm->addRow(S_LEGEND, new CCheckBox('showlegend', $showlegend, null, 1));
    $reportForm->addVar('sortorder', 0);
    // GROUPS
    $groupids = get_request('groupids', array());
    $group_tb = new CTweenBox($reportForm, 'groupids', $groupids, 10);
    $options = array('real_hosts' => 1, 'output' => 'extend');
    $db_groups = CHostGroup::get($options);
    order_result($db_groups, 'name');
    foreach ($db_groups as $gnum => $group) {
        $groupids[$group['groupid']] = $group['groupid'];
        $group_tb->addItem($group['groupid'], $group['name']);
    }
    $reportForm->addRow(S_GROUPS, $group_tb->Get(S_SELECTED_GROUPS, S_OTHER . SPACE . S_GROUPS));
    // ----------
    // HOSTS
    //	validate_group(PERM_READ_ONLY,array('real_hosts'),'web.last.conf.groupid');
    $groupid = get_request('groupid', 0);
    $cmbGroups = new CComboBox('groupid', $groupid, 'submit()');
    $cmbGroups->addItem(0, S_ALL_S);
    foreach ($db_groups as $gnum => $group) {
        $cmbGroups->addItem($group['groupid'], $group['name']);
    }
    $td_groups = new CCol(array(S_GROUP, SPACE, $cmbGroups));
    $td_groups->setAttribute('style', 'text-align: right;');
    $host_tb = new CTweenBox($reportForm, 'hostids', $hostids, 10);
    $options = array('real_hosts' => 1, 'output' => array('hostid', 'host'));
    if ($groupid > 0) {
        $options['groupids'] = $groupid;
    }
    $db_hosts = CHost::get($options);
    $db_hosts = zbx_toHash($db_hosts, 'hostid');
    order_result($db_hosts, 'host');
    foreach ($db_hosts as $hnum => $host) {
        $host_tb->addItem($host['hostid'], $host['host']);
    }
    $options = array('real_hosts' => 1, 'output' => array('hostid', 'host'), 'hostids' => $hostids);
    $db_hosts2 = CHost::get($options);
    order_result($db_hosts2, 'host');
    foreach ($db_hosts2 as $hnum => $host) {
        if (!isset($db_hosts[$host['hostid']])) {
            $host_tb->addItem($host['hostid'], $host['host']);
        }
    }
    $reportForm->addRow(S_HOSTS, $host_tb->Get(S_SELECTED_HOSTS, array(S_OTHER . SPACE . S_HOSTS . SPACE . '|' . SPACE . S_GROUP . SPACE, $cmbGroups)));
    // ----------
    //*/
    // PERIOD
    $clndr_icon = new CImg('images/general/bar/cal.gif', 'calendar', 16, 12, 'pointer');
    $clndr_icon->addAction('onclick', 'javascript: ' . 'var pos = getPosition(this); ' . 'pos.top+=10; ' . 'pos.left+=16; ' . "CLNDR['avail_report_since'].clndr.clndrshow(pos.top,pos.left);");
    $reporttimetab = new CTable(null, 'calendar');
    $reporttimetab->setAttribute('width', '10%');
    $reporttimetab->setCellPadding(0);
    $reporttimetab->setCellSpacing(0);
    $reporttimetab->addRow(array(S_FROM, new CNumericBox('report_since_day', $report_timesince > 0 ? date('d', $report_timesince) : '', 2), '/', new CNumericBox('report_since_month', $report_timesince > 0 ? date('m', $report_timesince) : '', 2), '/', new CNumericBox('report_since_year', $report_timesince > 0 ? date('Y', $report_timesince) : '', 4), SPACE, new CNumericBox('report_since_hour', $report_timesince > 0 ? date('H', $report_timesince) : '', 2), ':', new CNumericBox('report_since_minute', $report_timesince > 0 ? date('i', $report_timesince) : '', 2), $clndr_icon));
    zbx_add_post_js('create_calendar(null,' . '["report_since_day","report_since_month","report_since_year","report_since_hour","report_since_minute"],' . '"avail_report_since",' . '"report_timesince");');
    $clndr_icon->addAction('onclick', 'javascript: ' . 'var pos = getPosition(this); ' . 'pos.top+=10; ' . 'pos.left+=16; ' . "CLNDR['avail_report_till'].clndr.clndrshow(pos.top,pos.left);");
    $reporttimetab->addRow(array(S_TILL, new CNumericBox('report_till_day', $report_timetill > 0 ? date('d', $report_timetill) : '', 2), '/', new CNumericBox('report_till_month', $report_timetill > 0 ? date('m', $report_timetill) : '', 2), '/', new CNumericBox('report_till_year', $report_timetill > 0 ? date('Y', $report_timetill) : '', 4), SPACE, new CNumericBox('report_till_hour', $report_timetill > 0 ? date('H', $report_timetill) : '', 2), ':', new CNumericBox('report_till_minute', $report_timetill > 0 ? date('i', $report_timetill) : '', 2), $clndr_icon));
    zbx_add_post_js('create_calendar(null,' . '["report_till_day","report_till_month","report_till_year","report_till_hour","report_till_minute"],' . '"avail_report_till",' . '"report_timetill");');
    zbx_add_post_js('addListener($("filter_icon"),' . '"click",' . 'CLNDR[\'avail_report_since\'].clndr.clndrhide.bindAsEventListener(CLNDR[\'avail_report_since\'].clndr));' . 'addListener($("filter_icon"),' . '"click",' . 'CLNDR[\'avail_report_till\'].clndr.clndrhide.bindAsEventListener(CLNDR[\'avail_report_till\'].clndr));');
    $reportForm->addRow(S_PERIOD, $reporttimetab);
    //-----------
    $scale = new CComboBox('scaletype', $scaletype);
    $scale->addItem(TIMEPERIOD_TYPE_HOURLY, S_HOURLY);
    $scale->addItem(TIMEPERIOD_TYPE_DAILY, S_DAILY);
    $scale->addItem(TIMEPERIOD_TYPE_WEEKLY, S_WEEKLY);
    $scale->addItem(TIMEPERIOD_TYPE_MONTHLY, S_MONTHLY);
    $scale->addItem(TIMEPERIOD_TYPE_YEARLY, S_YEARLY);
    $reportForm->addRow(S_SCALE, $scale);
    $avgcmb = new CComboBox('avgperiod', $avgperiod);
    $avgcmb->addItem(TIMEPERIOD_TYPE_HOURLY, S_HOURLY);
    $avgcmb->addItem(TIMEPERIOD_TYPE_DAILY, S_DAILY);
    $avgcmb->addItem(TIMEPERIOD_TYPE_WEEKLY, S_WEEKLY);
    $avgcmb->addItem(TIMEPERIOD_TYPE_MONTHLY, S_MONTHLY);
    $avgcmb->addItem(TIMEPERIOD_TYPE_YEARLY, S_YEARLY);
    $reportForm->addRow(S_AVERAGE_BY, $avgcmb);
    // ITEMS
    $itemid = 0;
    $description = '';
    if (count($items) && $items[0]['itemid'] > 0) {
        $itemid = $items[0]['itemid'];
        $description = get_item_by_itemid($itemid);
        $description = item_description($description);
    }
    $reportForm->addVar('items[0][itemid]', $itemid);
    $txtCondVal = new CTextBox('items[0][description]', $description, 50, 'yes');
    $btnSelect = new CButton('btn1', S_SELECT, "return PopUp('popup.php?dstfrm=" . $reportForm->GetName() . "&dstfld1=items[0][itemid]&dstfld2=items[0][description]&" . "srctbl=items&srcfld1=itemid&srcfld2=description&monitored_hosts=1');", 'T');
    $reportForm->addRow(S_ITEM, array($txtCondVal, $btnSelect));
    $paletteCmb = new CComboBox('palette', $palette);
    $paletteCmb->addItem(0, S_PALETTE . ' #1');
    $paletteCmb->addItem(1, S_PALETTE . ' #2');
    $paletteCmb->addItem(2, S_PALETTE . ' #3');
    $paletteCmb->addItem(3, S_PALETTE . ' #4');
    $paletteTypeCmb = new CComboBox('palettetype', $palettetype);
    $paletteTypeCmb->addItem(0, S_MIDDLE);
    $paletteTypeCmb->addItem(1, S_DARKEN);
    $paletteTypeCmb->addItem(2, S_BRIGHTEN);
    $reportForm->addRow(S_PALETTE, array($paletteCmb, $paletteTypeCmb));
    //--------------
    $reportForm->addItemToBottomRow(new CButton('report_show', S_SHOW));
    $reset = new CButton('reset', S_RESET);
    $reset->setType('reset');
    $reportForm->addItemToBottomRow($reset);
    return $reportForm;
}
Esempio n. 5
0
 private function makeSImgStr($id)
 {
     $tr = new CRow();
     $count = isset($this->tree[$id]['nodeimg']) ? strlen($this->tree[$id]['nodeimg']) : 0;
     for ($i = 0; $i < $count; $i++) {
         $td = new CCol();
         $img = null;
         switch ($this->tree[$id]['nodeimg'][$i]) {
             case 'O':
                 $img = new CImg('images/general/tree/zero.gif', 'o', '22', '14');
                 break;
             case 'I':
                 $td->setAttribute('style', 'background-image: url(images/general/tree/pointc.gif);');
                 $img = new CImg('images/general/tree/zero.gif', 'i', '22', '14');
                 break;
             case 'L':
                 $td->setAttribute('valign', 'top');
                 $div = new CTag('div', 'yes');
                 $div->setAttribute('style', 'height: 10px; background-image: url(images/general/tree/pointc.gif);');
                 if ($this->tree[$id]['nodetype'] == 2) {
                     $img = new CImg('images/general/tree/plus.gif', 'y', '22', '14');
                     $img->setAttribute('onclick', $this->treename . '.closeSNodeX("' . $id . '", this);');
                     $img->setAttribute('id', 'idi_' . $id);
                     $img->setAttribute('class', 'pointer');
                 } else {
                     $img = new CImg('images/general/tree/pointl.gif', 'y', '22', '14');
                 }
                 $div->addItem($img);
                 $img = $div;
                 break;
             case 'T':
                 $td->setAttribute('valign', 'top');
                 if ($this->tree[$id]['nodetype'] == 2) {
                     $td->setAttribute('style', 'background-image: url(images/general/tree/pointc.gif);');
                     $img = new CImg('images/general/tree/plus.gif', 't', '22', '14');
                     $img->setAttribute('onclick', $this->treename . '.closeSNodeX("' . $id . '", this);');
                     $img->setAttribute('id', 'idi_' . $id);
                     $img->setAttribute('class', 'pointer');
                     $img->setAttribute('style', 'top: 1px; position: relative;');
                 } else {
                     $td->setAttribute('style', 'background-image: url(images/general/tree/pointc.gif);');
                     $img = new CImg('images/general/tree/pointl.gif', 't', '22', '14');
                 }
                 break;
         }
         $td->addItem($img);
         $tr->addItem($td);
     }
     return $tr;
 }
Esempio n. 6
0
    $cmbResource->addItem(AUDIT_RESOURCE_VALUE_MAP, S_VALUE_MAP);
    $cmbResource->addItem(AUDIT_RESOURCE_IT_SERVICE, S_IT_SERVICE);
    $cmbResource->addItem(AUDIT_RESOURCE_MAP, S_MAP);
    $cmbResource->addItem(AUDIT_RESOURCE_SCREEN, S_SCREEN);
    $cmbResource->addItem(AUDIT_RESOURCE_NODE, S_NODE);
    $cmbResource->addItem(AUDIT_RESOURCE_SCENARIO, S_SCENARIO);
    $cmbResource->addItem(AUDIT_RESOURCE_DISCOVERY_RULE, S_DISCOVERY_RULE);
    $cmbResource->addItem(AUDIT_RESOURCE_SLIDESHOW, S_SLIDESHOW);
    $cmbResource->addItem(AUDIT_RESOURCE_SCRIPT, S_SCRIPT);
    $cmbResource->addItem(AUDIT_RESOURCE_PROXY, S_PROXY);
    $cmbResource->addItem(AUDIT_RESOURCE_MAINTENANCE, S_MAINTENANCE);
    $cmbResource->addItem(AUDIT_RESOURCE_REGEXP, S_REGULAR_EXPRESSION);
    $filterForm->addRow(S_RESOURCE, $cmbResource);
}
//*
$clndr_icon = new CImg('images/general/bar/cal.gif', 'calendar', 16, 12, 'pointer');
$clndr_icon->addAction('onclick', "javascript: var pos = getPosition(this); pos.top+=10; pos.left+=16; CLNDR['audit_since'].clndr.clndrshow(pos.top,pos.left);");
$clndr_icon->setAttribute('style', 'vertical-align: middle;');
$nav_clndr = array(new CNumericBox('nav_day', $_REQUEST['nav_time'] > 0 ? date('d', $_REQUEST['nav_time']) : '', 2), new CNumericBox('nav_month', $_REQUEST['nav_time'] > 0 ? date('m', $_REQUEST['nav_time']) : '', 2), new CNumericBox('nav_year', $_REQUEST['nav_time'] > 0 ? date('Y', $_REQUEST['nav_time']) : '', 4), new CNumericBox('nav_hour', $_REQUEST['nav_time'] > 0 ? date('H', $_REQUEST['nav_time']) : '', 2), ':', new CNumericBox('nav_minute', $_REQUEST['nav_time'] > 0 ? date('i', $_REQUEST['nav_time']) : '', 2), $clndr_icon);
$filterForm->addRow(S_ACTIONS_BEFORE, $nav_clndr);
zbx_add_post_js('create_calendar(null,' . '["nav_day","nav_month","nav_year","nav_hour","nav_minute"],' . '"audit_since");');
zbx_add_post_js('addListener($("filter_icon"),' . '"click",CLNDR[\'audit_since\'].clndr.clndrhide.bindAsEventListener(CLNDR[\'audit_since\'].clndr));');
//*/
$reset = new CButton('filter_rst', S_RESET);
$reset->setType('button');
$reset->setAction('javascript: var uri = new Curl(location.href); uri.setArgument("filter_rst",1); location.href = uri.getUrl();');
$filterForm->addItemToBottomRow(new CButton("filter_set", S_FILTER));
$filterForm->addItemToBottomRow($reset);
$audit_wdgt->addFlicker($filterForm, get_profile('web.audit.filter.state', 1));
//-------
$nav = get_thin_table_header($navigation);
$gridAutoAlign = new CSpan($sysmap['grid_align'] == SYSMAP_GRID_ALIGN_ON ? _('On') : _('Off'), 'whitelink');
$gridAutoAlign->setAttribute('id', 'gridautoalign');
$possibleGridSizes = array(20 => '20x20', 40 => '40x40', 50 => '50x50', 75 => '75x75', 100 => '100x100');
$gridSize = new CComboBox('gridsize', $sysmap['grid_size']);
$gridSize->addItems($possibleGridSizes);
$gridAlignAll = new CSubmit('gridalignall', _('Align icons'));
$gridAlignAll->setAttribute('id', 'gridalignall');
$gridForm = new CDiv(array($gridSize, $gridAlignAll));
$gridForm->setAttribute('id', 'gridalignblock');
$saveButton = new CSubmit('save', _('Save'));
$saveButton->setAttribute('id', 'sysmap_save');
$menuRow = array(_s('Map "%s"', $sysmap['name']), SPACE . SPACE, _('Icon'), SPACE, $el_add, SPACE, $el_rmv, SPACE . SPACE, _('Link'), SPACE, $cn_add, SPACE, $cn_rmv, SPACE . SPACE, _('Expand macros') . ' [ ', $expandMacros, ' ]', SPACE . SPACE, _('Grid') . SPACE . '[', $gridShow, '|', $gridAutoAlign, ']', SPACE, $gridForm, SPACE . '|' . SPACE, $saveButton);
$elcn_tab = new CTable(null, 'textwhite');
$elcn_tab->addRow($menuRow);
show_table_header($elcn_tab);
$sysmap_img = new CImg('images/general/tree/zero.gif', 'Sysmap');
$sysmap_img->setAttribute('id', 'sysmap_img', $sysmap['width'], $sysmap['height']);
$table = new CTable();
$table->addRow($sysmap_img);
$table->Show();
$container = new CDiv();
$container->setAttribute('id', 'sysmap_cnt');
$container->Show();
insert_show_color_picker_javascript();
add_elementNames($sysmap['selements']);
foreach ($sysmap['links'] as &$link) {
    foreach ($link['linktriggers'] as $lnum => $linktrigger) {
        $dbTrigger = API::Trigger()->get(array('triggerids' => $linktrigger['triggerid'], 'output' => array('description', 'expression'), 'selectHosts' => API_OUTPUT_EXTEND, 'preservekeys' => true, 'expandDescription' => true));
        $dbTrigger = reset($dbTrigger);
        $host = reset($dbTrigger['hosts']);
        $link['linktriggers'][$lnum]['desc_exp'] = $host['name'] . ':' . $dbTrigger['description'];
Esempio n. 8
0
function get_timeperiod_form()
{
    $tblPeriod = new CTableInfo();
    /* init new_timeperiod variable */
    $new_timeperiod = get_request('new_timeperiod', array());
    if (is_array($new_timeperiod) && isset($new_timeperiod['id'])) {
        $tblPeriod->addItem(new Cvar('new_timeperiod[id]', $new_timeperiod['id']));
    }
    if (!is_array($new_timeperiod)) {
        $new_timeperiod = array();
        $new_timeperiod['timeperiod_type'] = TIMEPERIOD_TYPE_ONETIME;
    }
    if (!isset($new_timeperiod['every'])) {
        $new_timeperiod['every'] = 1;
    }
    if (!isset($new_timeperiod['day'])) {
        $new_timeperiod['day'] = 1;
    }
    if (!isset($new_timeperiod['hour'])) {
        $new_timeperiod['hour'] = 12;
    }
    if (!isset($new_timeperiod['minute'])) {
        $new_timeperiod['minute'] = 0;
    }
    if (!isset($new_timeperiod['date'])) {
        $new_timeperiod['date'] = 0;
    }
    if (!isset($new_timeperiod['period_days'])) {
        $new_timeperiod['period_days'] = 0;
    }
    if (!isset($new_timeperiod['period_hours'])) {
        $new_timeperiod['period_hours'] = 1;
    }
    if (!isset($new_timeperiod['month_date_type'])) {
        $new_timeperiod['month_date_type'] = !(bool) $new_timeperiod['day'];
    }
    // START TIME
    if (isset($new_timeperiod['start_time'])) {
        $new_timeperiod['hour'] = floor($new_timeperiod['start_time'] / 3600);
        $new_timeperiod['minute'] = floor(($new_timeperiod['start_time'] - $new_timeperiod['hour'] * 3600) / 60);
    }
    //--
    // PERIOD
    if (isset($new_timeperiod['period'])) {
        $new_timeperiod['period_days'] = floor($new_timeperiod['period'] / 86400);
        $new_timeperiod['period_hours'] = floor(($new_timeperiod['period'] - $new_timeperiod['period_days'] * 86400) / 3600);
    }
    //--
    // DAYSOFWEEK
    $dayofweek = '';
    $dayofweek .= !isset($new_timeperiod['dayofweek_mo']) ? '0' : '1';
    $dayofweek .= !isset($new_timeperiod['dayofweek_tu']) ? '0' : '1';
    $dayofweek .= !isset($new_timeperiod['dayofweek_we']) ? '0' : '1';
    $dayofweek .= !isset($new_timeperiod['dayofweek_th']) ? '0' : '1';
    $dayofweek .= !isset($new_timeperiod['dayofweek_fr']) ? '0' : '1';
    $dayofweek .= !isset($new_timeperiod['dayofweek_sa']) ? '0' : '1';
    $dayofweek .= !isset($new_timeperiod['dayofweek_su']) ? '0' : '1';
    if (isset($new_timeperiod['dayofweek'])) {
        $dayofweek = zbx_num2bitstr($new_timeperiod['dayofweek'], true);
    }
    $new_timeperiod['dayofweek_mo'] = $dayofweek[0];
    $new_timeperiod['dayofweek_tu'] = $dayofweek[1];
    $new_timeperiod['dayofweek_we'] = $dayofweek[2];
    $new_timeperiod['dayofweek_th'] = $dayofweek[3];
    $new_timeperiod['dayofweek_fr'] = $dayofweek[4];
    $new_timeperiod['dayofweek_sa'] = $dayofweek[5];
    $new_timeperiod['dayofweek_su'] = $dayofweek[6];
    //--
    // MONTHS
    $month = '';
    $month .= !isset($new_timeperiod['month_jan']) ? '0' : '1';
    $month .= !isset($new_timeperiod['month_feb']) ? '0' : '1';
    $month .= !isset($new_timeperiod['month_mar']) ? '0' : '1';
    $month .= !isset($new_timeperiod['month_apr']) ? '0' : '1';
    $month .= !isset($new_timeperiod['month_may']) ? '0' : '1';
    $month .= !isset($new_timeperiod['month_jun']) ? '0' : '1';
    $month .= !isset($new_timeperiod['month_jul']) ? '0' : '1';
    $month .= !isset($new_timeperiod['month_aug']) ? '0' : '1';
    $month .= !isset($new_timeperiod['month_sep']) ? '0' : '1';
    $month .= !isset($new_timeperiod['month_oct']) ? '0' : '1';
    $month .= !isset($new_timeperiod['month_nov']) ? '0' : '1';
    $month .= !isset($new_timeperiod['month_dec']) ? '0' : '1';
    if (isset($new_timeperiod['month'])) {
        $month = zbx_num2bitstr($new_timeperiod['month'], true);
    }
    $new_timeperiod['month_jan'] = $month[0];
    $new_timeperiod['month_feb'] = $month[1];
    $new_timeperiod['month_mar'] = $month[2];
    $new_timeperiod['month_apr'] = $month[3];
    $new_timeperiod['month_may'] = $month[4];
    $new_timeperiod['month_jun'] = $month[5];
    $new_timeperiod['month_jul'] = $month[6];
    $new_timeperiod['month_aug'] = $month[7];
    $new_timeperiod['month_sep'] = $month[8];
    $new_timeperiod['month_oct'] = $month[9];
    $new_timeperiod['month_nov'] = $month[10];
    $new_timeperiod['month_dec'] = $month[11];
    //--
    $bit_dayofweek = zbx_str_revert($dayofweek);
    $bit_month = zbx_str_revert($month);
    $cmbType = new CComboBox('new_timeperiod[timeperiod_type]', $new_timeperiod['timeperiod_type'], 'submit()');
    $cmbType->addItem(TIMEPERIOD_TYPE_ONETIME, S_ONE_TIME_ONLY);
    $cmbType->addItem(TIMEPERIOD_TYPE_DAILY, S_DAILY);
    $cmbType->addItem(TIMEPERIOD_TYPE_WEEKLY, S_WEEKLY);
    $cmbType->addItem(TIMEPERIOD_TYPE_MONTHLY, S_MONTHLY);
    $tblPeriod->addRow(array(S_PERIOD_TYPE, $cmbType));
    if ($new_timeperiod['timeperiod_type'] == TIMEPERIOD_TYPE_DAILY) {
        $tblPeriod->addItem(new Cvar('new_timeperiod[dayofweek]', bindec($bit_dayofweek)));
        $tblPeriod->addItem(new Cvar('new_timeperiod[month]', bindec($bit_month)));
        $tblPeriod->addItem(new Cvar('new_timeperiod[day]', $new_timeperiod['day']));
        $tblPeriod->addItem(new Cvar('new_timeperiod[date]', $new_timeperiod['date']));
        $tblPeriod->addItem(new Cvar('new_timeperiod[month_date_type]', $new_timeperiod['month_date_type']));
        $tblPeriod->addRow(array(S_EVERY_DAY_S, new CNumericBox('new_timeperiod[every]', $new_timeperiod['every'], 3)));
    } else {
        if ($new_timeperiod['timeperiod_type'] == TIMEPERIOD_TYPE_WEEKLY) {
            $tblPeriod->addItem(new Cvar('new_timeperiod[month]', bindec($bit_month)));
            $tblPeriod->addItem(new Cvar('new_timeperiod[day]', $new_timeperiod['day']));
            $tblPeriod->addItem(new Cvar('new_timeperiod[date]', $new_timeperiod['date']));
            $tblPeriod->addItem(new Cvar('new_timeperiod[month_date_type]', $new_timeperiod['month_date_type']));
            $tblPeriod->addRow(array(S_EVERY_WEEK_S, new CNumericBox('new_timeperiod[every]', $new_timeperiod['every'], 2)));
            $tabDays = new CTable();
            $tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_mo]', $dayofweek[0], null, 1), S_MONDAY));
            $tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_tu]', $dayofweek[1], null, 1), S_TUESDAY));
            $tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_we]', $dayofweek[2], null, 1), S_WEDNESDAY));
            $tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_th]', $dayofweek[3], null, 1), S_THURSDAY));
            $tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_fr]', $dayofweek[4], null, 1), S_FRIDAY));
            $tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_sa]', $dayofweek[5], null, 1), S_SATURDAY));
            $tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_su]', $dayofweek[6], null, 1), S_SUNDAY));
            $tblPeriod->addRow(array(S_DAY_OF_WEEK, $tabDays));
        } else {
            if ($new_timeperiod['timeperiod_type'] == TIMEPERIOD_TYPE_MONTHLY) {
                $tblPeriod->addItem(new Cvar('new_timeperiod[date]', $new_timeperiod['date']));
                $tabMonths = new CTable();
                $tabMonths->addRow(array(new CCheckBox('new_timeperiod[month_jan]', $month[0], null, 1), S_JANUARY, SPACE, SPACE, new CCheckBox('new_timeperiod[month_jul]', $month[6], null, 1), S_JULY));
                $tabMonths->addRow(array(new CCheckBox('new_timeperiod[month_feb]', $month[1], null, 1), S_FEBRUARY, SPACE, SPACE, new CCheckBox('new_timeperiod[month_aug]', $month[7], null, 1), S_AUGUST));
                $tabMonths->addRow(array(new CCheckBox('new_timeperiod[month_mar]', $month[2], null, 1), S_MARCH, SPACE, SPACE, new CCheckBox('new_timeperiod[month_sep]', $month[8], null, 1), S_SEPTEMBER));
                $tabMonths->addRow(array(new CCheckBox('new_timeperiod[month_apr]', $month[3], null, 1), S_APRIL, SPACE, SPACE, new CCheckBox('new_timeperiod[month_oct]', $month[9], null, 1), S_OCTOBER));
                $tabMonths->addRow(array(new CCheckBox('new_timeperiod[month_may]', $month[4], null, 1), S_MAY, SPACE, SPACE, new CCheckBox('new_timeperiod[month_nov]', $month[10], null, 1), S_NOVEMBER));
                $tabMonths->addRow(array(new CCheckBox('new_timeperiod[month_jun]', $month[5], null, 1), S_JUNE, SPACE, SPACE, new CCheckBox('new_timeperiod[month_dec]', $month[11], null, 1), S_DECEMBER));
                $tblPeriod->addRow(array(S_MONTH, $tabMonths));
                $radioDaily = new CTag('input');
                $radioDaily->addOption('type', 'radio');
                $radioDaily->addOption('name', 'new_timeperiod[month_date_type]');
                $radioDaily->addOption('value', '0');
                $radioDaily->addOption('onclick', 'submit()');
                $radioDaily2 = new CTag('input');
                $radioDaily2->addOption('type', 'radio');
                $radioDaily2->addOption('name', 'new_timeperiod[month_date_type]');
                $radioDaily2->addOption('value', '1');
                $radioDaily2->addOption('onclick', 'submit()');
                if ($new_timeperiod['month_date_type']) {
                    $radioDaily2->addOption('checked', 'checked');
                } else {
                    $radioDaily->addOption('checked', 'checked');
                }
                $tblPeriod->addRow(array(S_DATE, array($radioDaily, S_DAY, SPACE, SPACE, $radioDaily2, S_DAY_OF_WEEK)));
                if ($new_timeperiod['month_date_type'] > 0) {
                    $tblPeriod->addItem(new Cvar('new_timeperiod[day]', $new_timeperiod['day']));
                    $cmbCount = new CComboBox('new_timeperiod[every]', $new_timeperiod['every']);
                    $cmbCount->addItem(1, S_FIRST);
                    $cmbCount->addItem(2, S_SECOND);
                    $cmbCount->addItem(3, S_THIRD);
                    $cmbCount->addItem(4, S_FOURTH);
                    $cmbCount->addItem(5, S_LAST);
                    $td = new CCol($cmbCount);
                    $td->setColSpan(2);
                    $tabDays = new CTable();
                    $tabDays->addRow($td);
                    $tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_mo]', $dayofweek[0], null, 1), S_MONDAY));
                    $tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_tu]', $dayofweek[1], null, 1), S_TUESDAY));
                    $tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_we]', $dayofweek[2], null, 1), S_WEDNESDAY));
                    $tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_th]', $dayofweek[3], null, 1), S_THURSDAY));
                    $tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_fr]', $dayofweek[4], null, 1), S_FRIDAY));
                    $tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_sa]', $dayofweek[5], null, 1), S_SATURDAY));
                    $tabDays->addRow(array(new CCheckBox('new_timeperiod[dayofweek_su]', $dayofweek[6], null, 1), S_SUNDAY));
                    $tblPeriod->addRow(array(S_DAY_OF_WEEK, $tabDays));
                } else {
                    $tblPeriod->addItem(new Cvar('new_timeperiod[dayofweek]', bindec($bit_dayofweek)));
                    $tblPeriod->addRow(array(S_DAY_OF_MONTH, new CNumericBox('new_timeperiod[day]', $new_timeperiod['day'], 2)));
                }
            } else {
                $tblPeriod->addItem(new Cvar('new_timeperiod[every]', $new_timeperiod['every']));
                $tblPeriod->addItem(new Cvar('new_timeperiod[dayofweek]', bindec($bit_dayofweek)));
                $tblPeriod->addItem(new Cvar('new_timeperiod[month]', bindec($bit_month)));
                $tblPeriod->addItem(new Cvar('new_timeperiod[day]', $new_timeperiod['day']));
                $tblPeriod->addItem(new Cvar('new_timeperiod[hour]', $new_timeperiod['hour']));
                $tblPeriod->addItem(new Cvar('new_timeperiod[minute]', $new_timeperiod['minute']));
                $tblPeriod->addItem(new Cvar('new_timeperiod[month_date_type]', $new_timeperiod['month_date_type']));
                /***********************************************************/
                $tblPeriod->addItem(new Cvar('new_timeperiod[date]', $new_timeperiod['date']));
                $clndr_icon = new CImg('images/general/bar/cal.gif', 'calendar', 16, 12, 'pointer');
                $clndr_icon->addAction('onclick', 'javascript: ' . 'var pos = getPosition(this); ' . 'pos.top+=10; ' . 'pos.left+=16; ' . "CLNDR['new_timeperiod_date'].clndr.clndrshow(pos.top,pos.left);");
                $filtertimetab = new CTable(null, 'calendar');
                $filtertimetab->addOption('width', '10%');
                $filtertimetab->SetCellPadding(0);
                $filtertimetab->SetCellSpacing(0);
                $filtertimetab->addRow(array(new CNumericBox('new_timeperiod_day', $new_timeperiod['date'] > 0 ? date('d', $new_timeperiod['date']) : '', 2), '/', new CNumericBox('new_timeperiod_month', $new_timeperiod['date'] > 0 ? date('m', $new_timeperiod['date']) : '', 2), '/', new CNumericBox('new_timeperiod_year', $new_timeperiod['date'] > 0 ? date('Y', $new_timeperiod['date']) : '', 4), SPACE, new CNumericBox('new_timeperiod_hour', $new_timeperiod['date'] > 0 ? date('H', $new_timeperiod['date']) : '', 2), ':', new CNumericBox('new_timeperiod_minute', $new_timeperiod['date'] > 0 ? date('i', $new_timeperiod['date']) : '', 2), $clndr_icon));
                zbx_add_post_js('create_calendar(null,' . '["new_timeperiod_day","new_timeperiod_month","new_timeperiod_year","new_timeperiod_hour","new_timeperiod_minute"],' . '"new_timeperiod_date",' . '"new_timeperiod[date]");');
                $clndr_icon->addAction('onclick', 'javascript: ' . 'var pos = getPosition(this); ' . 'pos.top+=10; ' . 'pos.left+=16; ' . "CLNDR['mntc_active_till'].clndr.clndrshow(pos.top,pos.left);");
                $tblPeriod->addRow(array(S_DATE, $filtertimetab));
                zbx_add_post_js('if("undefined" != typeof(CLNDR["new_timeperiod_date"]))' . ' addListener($("hat_new_timeperiod_icon"),' . '"click",' . 'CLNDR["new_timeperiod_date"].clndr.clndrhide.bindAsEventListener(CLNDR["new_timeperiod_date"].clndr));');
                //-------
            }
        }
    }
    if ($new_timeperiod['timeperiod_type'] != TIMEPERIOD_TYPE_ONETIME) {
        $tabTime = new CTable(null, 'calendar');
        $tabTime->addRow(array(new CNumericBox('new_timeperiod[hour]', $new_timeperiod['hour'], 2), ':', new CNumericBox('new_timeperiod[minute]', $new_timeperiod['minute'], 2)));
        $tblPeriod->addRow(array(S_AT . SPACE . '(' . S_HOUR . ':' . S_MINUTE . ')', $tabTime));
    }
    $perHours = new CComboBox('new_timeperiod[period_hours]', $new_timeperiod['period_hours']);
    for ($i = 0; $i < 25; $i++) {
        $perHours->addItem($i, $i . SPACE);
    }
    $tblPeriod->addRow(array(S_MAINTENANCE_PERIOD_LENGTH, array(new CNumericBox('new_timeperiod[period_days]', $new_timeperiod['period_days'], 3), S_DAYS . SPACE . SPACE, $perHours, SPACE . S_HOURS)));
    //			$tabPeriod = new CTable();
    //			$tabPeriod->addRow(S_DAYS)
    //			$tblPeriod->addRow(array(S_AT.SPACE.'('.S_HOUR.':'.S_MINUTE.')', $tabTime));
    $td = new CCol(array(new CButton('add_timeperiod', S_SAVE), SPACE, new CButton('cancel_new_timeperiod', S_CANCEL)));
    $td->addOption('colspan', '3');
    $td->addOption('style', 'text-align: right;');
    $tblPeriod->SetFooter($td);
    return $tblPeriod;
}
Esempio n. 9
0
 $maxid = 0;
 $bExprResult = true;
 $expressionData = new CTriggerExpression();
 if (isset($_REQUEST['triggerid']) && !isset($_REQUEST['save_trigger']) && !$expressionData->parse(empty($expressions) ? '' : construct_expression($itemid, $expressions)) && !isset($_REQUEST['form_refresh'])) {
     info($expressionData->error);
     unset($expressions);
     $expressions[0]['value'] = $expr_incase;
     $expressions[0]['type'] = 0;
     $expressions[0]['view'] = $expr_incase;
     $bExprResult = false;
 }
 foreach ($expressions as $id => $expr) {
     $imgup = new CImg('images/general/arrow_up.png', 'up', 12, 14);
     $imgup->setAttribute('onclick', 'javascript:  element_up("logtr' . $id . '");');
     $imgup->setAttribute('onmouseover', 'javascript: this.style.cursor = "pointer";');
     $imgdn = new CImg('images/general/arrow_down.png', 'down', 12, 14);
     $imgdn->setAttribute('onclick', 'javascript:  element_down("logtr' . $id . '");');
     $imgdn->setAttribute('onmouseover', 'javascript: this.style.cursor = "pointer";');
     $del_url = new CSpan(_('Delete'), 'link');
     $del_url->setAttribute('onclick', 'javascript: if(confirm("' . _('Delete expression?') . '")) remove_expression("logtr' . $id . '"); return false;');
     $row = new CRow(array(htmlspecialchars($expr['view']), $expr['type'] == REGEXP_INCLUDE ? _('Include') : _('Exclude'), array($imgup, SPACE, $imgdn), $del_url));
     $row->setAttribute('id', 'logtr' . $id);
     $table->addRow($row);
     $frmTRLog->addVar('expressions[' . $id . '][value]', $expr['value']);
     $frmTRLog->addVar('expressions[' . $id . '][type]', $expr['type']);
     $frmTRLog->addVar('expressions[' . $id . '][view]', $expr['view']);
     $maxid = $maxid < $id ? $id : $maxid;
 }
 zbx_add_post_js('logexpr_count=' . ($maxid + 1));
 $maxid = 0;
 foreach ($keys as $id => $val) {
$iconsComboBox->addItems($this->data['iconList']);
$iconsComboBox->setAttribute('disabled', 'disabled');
$iconPreviewImage = new CImg('imgstore.php?iconid=' . $firstIconId . '&width=' . ZBX_ICON_PREVIEW_WIDTH . '&height=' . ZBX_ICON_PREVIEW_HEIGHT, _('Preview'), null, null, 'pointer preview');
$iconPreviewImage->setAttribute('data-image-full', 'imgstore.php?iconid=' . $firstIconId);
// row template
$hiddenRowTemplate = new CRow(array(new CSpan(null, 'ui-icon ui-icon-arrowthick-2-n-s move'), $numSpan, $profileLinksComboBox, $expressionTextBox, $iconsComboBox, $iconPreviewImage, new CButton('remove', _('Remove'), '', 'link_menu removeMapping')), 'hidden');
$hiddenRowTemplate->setAttribute('id', 'rowTpl');
$iconMapTable->addRow($hiddenRowTemplate);
// add row button
$iconMapTable->addRow(new CCol(new CButton('addMapping', _('Add'), '', 'link_menu'), null, 7));
// <default icon row>
$numSpan = new CSpan($i++ . ':');
$numSpan->addClass('rowNum');
$iconsComboBox = new CComboBox('iconmap[default_iconid]', $this->data['iconmap']['default_iconid']);
$iconsComboBox->addClass('mappingIcon');
$iconsComboBox->addItems($this->data['iconList']);
$iconPreviewImage = new CImg('imgstore.php?iconid=' . $this->data['iconmap']['default_iconid'] . '&width=' . ZBX_ICON_PREVIEW_WIDTH . '&height=' . ZBX_ICON_PREVIEW_HEIGHT, _('Preview'), null, null, 'pointer preview');
$iconPreviewImage->setAttribute('data-image-full', 'imgstore.php?iconid=' . $this->data['iconmap']['default_iconid']);
$iconMapTable->addRow(array(new CCol(_('Default'), null, 4), $iconsComboBox, $iconPreviewImage));
// </default icon row>
$iconMapTab->addRow(_('Mappings'), new CDiv($iconMapTable, 'objectgroup inlineblock border_dotted ui-corner-all'));
$iconMapView = new CTabView();
$iconMapView->addTab('iconmap', _('Icon map'), $iconMapTab);
$iconMapForm->addItem($iconMapView);
// footer
$secondaryActions = array(new CButtonCancel());
if (isset($this->data['iconmapid'])) {
    array_unshift($secondaryActions, new CSubmit('clone', _('Clone')), new CButtonDelete(_('Delete icon map?'), url_param('form') . url_param('iconmapid')));
}
$iconMapForm->addItem(makeFormFooter(new CSubmit('save', _('Save')), $secondaryActions));
return $iconMapForm;
Esempio n. 11
0
        $form->addItem($cmbMaps);
        $map_wdgt->addHeader($maps[$_REQUEST['sysmapid']]['name'], $form);
        // GET MAP PARENT MAPS {{{
        $parent_maps = array();
        foreach ($maps as $sysmapid => $map) {
            foreach ($map['selements'] as $enum => $selement) {
                if ($selement['elementid'] == $_REQUEST['sysmapid'] && $selement['elementtype'] == SYSMAP_ELEMENT_TYPE_MAP) {
                    $parent_maps[] = SPACE . SPACE;
                    $parent_maps[] = new Clink($map['name'], 'maps.php?sysmapid=' . $map['sysmapid'] . '&fullscreen=' . $_REQUEST['fullscreen']);
                    break;
                }
            }
        }
        if (!empty($parent_maps)) {
            array_unshift($parent_maps, S_UPPER_LEVEL_MAPS . ':');
            $map_wdgt->addHeader($parent_maps);
        }
        // }}} GET MAP PARENT MAPS
        $action_map = getActionMapBySysmap($maps[$_REQUEST['sysmapid']]);
        $table->addRow($action_map);
        $imgMap = new CImg('map.php?sysmapid=' . $_REQUEST['sysmapid']);
        $imgMap->setMap($action_map->getName());
        $table->addRow($imgMap);
        $icon = get_icon('favourite', array('fav' => 'web.favorite.sysmapids', 'elname' => 'sysmapid', 'elid' => $_REQUEST['sysmapid']));
        $fs_icon = get_icon('fullscreen', array('fullscreen' => $_REQUEST['fullscreen']));
    }
    $map_wdgt->addItem($table);
    $map_wdgt->addPageHeader(S_NETWORK_MAPS_BIG, array($icon, $fs_icon));
    $map_wdgt->show();
}
include_once 'include/page_footer.php';
Esempio n. 12
0
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Module Album photo</title>
<link href="css/style.css" rel="stylesheet" type="text/css" />
<script src="prototype/prototype.js" type="text/javascript"></script>
<script src="dw_scroll/js/dw_event.js" type="text/javascript"></script>
<script src="dw_scroll/js/dw_event.js" type="text/javascript"></script>
<script src="dw_scroll/js/dw_scroll.js" type="text/javascript"></script>
<script src="dw_scroll/js/dw_scrollbar.js" type="text/javascript"></script>
<script src="dw_scroll/js/scroll_controls.js" type="text/javascript"></script>
<script src="inc/script.js" type="text/javascript"></script>
</head>
<?php
include("inc/init.php");
if(!empty($_GET['url_album'])) $url_album = $_GET['url_album'];
$liste_photo = CFile::get_file($url_album);
$url_vue 	 = @CImg::get_img_rand($url_album);
?>
</head>

<body>
<div id="album_photo">
  <div id="vue"><img  src="load_vue.php?url_file=<?php echo $url_vue ?>" id="img_vue" alt="vue"/></div>
  <div id="wn">
    <div id="lyr1">
      <table id="t1">
        <tr>
          <?php foreach ($liste_photo as $url_file) { ?>
          <td><img src="load_vignette.php?url_file=<?php echo $url_file ?>" onmouseover="show_vue('<?php echo $url_file ?>')" alt=""  width="40"  height="30"/></td>
          <?php } ?>
        </tr>
      </table>
 if (!empty($this->data['eHTMLTree'])) {
     foreach ($this->data['eHTMLTree'] as $i => $e) {
         if (!$this->data['limited']) {
             $deleteUrl = new CSpan(_('Delete'), 'link');
             $deleteUrl->setAttribute('onclick', 'javascript:' . ' if (confirm(' . CJs::encodeJson(_('Delete expression?')) . ')) {' . ' delete_expression("' . $e['id'] . '");' . ' document.forms["' . $triggersForm->getName() . '"].submit();' . ' }');
             $triggerCheckbox = new CCheckBox('expr_target_single', $i == 0 ? 'yes' : 'no', 'check_target(this);', $e['id']);
         } else {
             $triggerCheckbox = null;
         }
         if (empty($this->data['parent_discoveryid'])) {
             if (!isset($e['expression']['levelErrors'])) {
                 $errorImg = new CImg('images/general/ok_icon.png', 'expression_no_errors');
                 $errorImg->setHint(_('No errors found.'));
             } else {
                 $allowedTesting = false;
                 $errorImg = new CImg('images/general/error2.png', 'expression_errors');
                 $errorTexts = array();
                 if (is_array($e['expression']['levelErrors'])) {
                     foreach ($e['expression']['levelErrors'] as $expVal => $errTxt) {
                         if (count($errorTexts) > 0) {
                             array_push($errorTexts, BR());
                         }
                         array_push($errorTexts, $expVal, ':', $errTxt);
                     }
                 }
                 $errorImg->setHint($errorTexts, 'left');
             }
             $errorColumn = new CCol($errorImg, 'center');
         } else {
             $errorColumn = null;
         }
    $row = new CRow(array(array($type, new CVar('times[' . $i . '][type]', $serviceTime['type']), new CVar('times[' . $i . '][ts_from]', $serviceTime['ts_from']), new CVar('times[' . $i . '][ts_to]', $serviceTime['ts_to']), new CVar('times[' . $i . '][note]', $serviceTime['note'])), $from . ' - ' . $to, htmlspecialchars($serviceTime['note']), new CButton('remove', _('Remove'), 'javascript: removeTime(\'' . $i . '\');', 'link_menu')));
    $row->setAttribute('id', 'times_' . $i);
    $servicesTimeTable->addRow($row);
    $i++;
}
$servicesTimeFormList->addRow(_('Service times'), new CDiv($servicesTimeTable, 'objectgroup inlineblock border_dotted ui-corner-all'));
// create service time table
$serviceTimeTable = new CTable(null, 'formElementTable');
if ($this->data['new_service_time']['type'] == SERVICE_TIME_TYPE_ONETIME_DOWNTIME) {
    $downtimeSince = date('YmdHis');
    $downtimeTill = date('YmdHis', time() + 86400);
    $downtimeSince = zbxDateToTime($downtimeSince);
    $downtimeTill = zbxDateToTime($downtimeTill);
    // create calendar table
    $timeCalendarTable = new CTable();
    $calendarIcon = new CImg('images/general/bar/cal.gif', 'calendar', 16, 12, 'pointer');
    $calendarIcon->addAction('onclick', "javascript: var pos = getPosition(this); pos.top -= 203; pos.left += 16; CLNDR['downtime_since'].clndr.clndrshow(pos.top, pos.left); CLNDR['downtime_till'].clndr.clndrhide();");
    // downtime since
    if (isset($_REQUEST['new_service_time']['from'])) {
        $year = get_request('downtime_since_year');
        $month = get_request('downtime_since_month');
        $day = get_request('downtime_since_day');
        $hours = get_request('downtime_since_hour');
        $minutes = get_request('downtime_since_minute');
    } elseif ($downtimeSince > 0) {
        $year = date('Y', $downtimeSince);
        $month = date('m', $downtimeSince);
        $day = date('d', $downtimeSince);
        $hours = date('H', $downtimeSince);
        $minutes = date('i', $downtimeSince);
    } else {
Esempio n. 15
0
/**
 * Creates and returns a trigger status cell for the trigger overview table.
 *
 * @see getTriggersOverview()
 *
 * @param array  $trigger
 * @param string $pageFile		the page where the element is displayed
 * @param string $screenId
 *
 * @return CCol
 */
function getTriggerOverviewCells($trigger, $pageFile, $screenId = null)
{
    $ack = $css = $style = null;
    $desc = $triggerItems = $acknowledge = array();
    // for how long triggers should blink on status change (set by user in administration->general)
    $config = select_config();
    if ($trigger) {
        $style = 'cursor: pointer; ';
        // problem trigger
        if ($trigger['value'] == TRIGGER_VALUE_TRUE) {
            $css = getSeverityStyle($trigger['priority']);
            $ack = null;
            if ($config['event_ack_enable'] == 1) {
                if ($event = get_last_event_by_triggerid($trigger['triggerid'])) {
                    if ($screenId) {
                        $acknowledge = array('eventid' => $event['eventid'], 'screenid' => $screenId, 'backurl' => $pageFile);
                    } else {
                        $acknowledge = array('eventid' => $event['eventid'], 'backurl' => 'overview.php');
                    }
                    if ($event['acknowledged'] == 1) {
                        $ack = new CImg('images/general/tick.png', 'ack');
                    }
                }
            }
        } else {
            $css = 'normal';
        }
        $dbItems = DBfetchArray(DBselect('SELECT DISTINCT i.itemid,i.hostid,i.name,i.key_,i.value_type' . ' FROM items i,functions f' . ' WHERE f.itemid=i.itemid' . ' AND f.triggerid=' . zbx_dbstr($trigger['triggerid'])));
        $dbItems = CMacrosResolverHelper::resolveItemNames($dbItems);
        foreach ($dbItems as $dbItem) {
            $triggerItems[] = array('name' => $dbItem['name_expanded'], 'params' => array('action' => in_array($dbItem['value_type'], array(ITEM_VALUE_TYPE_FLOAT, ITEM_VALUE_TYPE_UINT64)) ? HISTORY_GRAPH : HISTORY_VALUES, 'itemid' => $dbItem['itemid'], 'period' => 3600));
        }
        // dependency: triggers on which depends this
        $triggerId = empty($trigger['triggerid']) ? 0 : $trigger['triggerid'];
        // trigger dependency DOWN
        $dependencyTable = new CTableInfo();
        $dependencyTable->setAttribute('style', 'width: 200px;');
        $dependencyTable->addRow(bold(_('Depends on') . NAME_DELIMITER));
        $isDependencyFound = false;
        $dbDependencies = DBselect('SELECT td.* FROM trigger_depends td WHERE td.triggerid_down=' . zbx_dbstr($triggerId));
        while ($dbDependency = DBfetch($dbDependencies)) {
            $dependencyTable->addRow(SPACE . '-' . SPACE . CMacrosResolverHelper::resolveTriggerNameById($dbDependency['triggerid_up']));
            $isDependencyFound = true;
        }
        if ($isDependencyFound) {
            $icon = new CImg('images/general/arrow_down2.png', 'DEP_DOWN');
            $icon->setAttribute('style', 'vertical-align: middle; border: 0px;');
            $icon->setHint($dependencyTable, '', false);
            $desc[] = $icon;
        }
        // trigger dependency UP
        $dependencyTable = new CTableInfo();
        $dependencyTable->setAttribute('style', 'width: 200px;');
        $dependencyTable->addRow(bold(_('Dependent') . NAME_DELIMITER));
        $isDependencyFound = false;
        $dbDependencies = DBselect('SELECT td.* FROM trigger_depends td WHERE td.triggerid_up=' . zbx_dbstr($triggerId));
        while ($dbDependency = DBfetch($dbDependencies)) {
            $dependencyTable->addRow(SPACE . '-' . SPACE . CMacrosResolverHelper::resolveTriggerNameById($dbDependency['triggerid_down']));
            $isDependencyFound = true;
        }
        if ($isDependencyFound) {
            $icon = new CImg('images/general/arrow_up2.png', 'DEP_UP');
            $icon->setAttribute('style', 'vertical-align: middle; border: none;');
            $icon->setHint($dependencyTable, '', false);
            $desc[] = $icon;
        }
    }
    $column = is_array($desc) && count($desc) > 0 || $ack ? new CCol(array($desc, $ack), $css . ' hosts') : new CCol(SPACE, $css . ' hosts');
    $column->setAttribute('style', $style);
    if ($trigger && $config['blink_period'] > 0 && time() - $trigger['lastchange'] < $config['blink_period']) {
        $column->addClass('blink');
        $column->setAttribute('data-toggle-class', $css);
    }
    if ($trigger) {
        $column->setMenuPopup(CMenuPopupHelper::getTrigger($trigger, $triggerItems, $acknowledge));
    }
    return $column;
}
Esempio n. 16
0
}
//*/
$navForm->addItem(array($prev_page, SPACE, $next_page));
$navigation = $navForm;
//------------
/************************* FILTER **************************/
/***********************************************************/
$filterForm = new CFormTable();
//,'events.php?filter_set=1','POST',null,'sform');
$filterForm->setAttribute('name', 'zbx_filter');
$filterForm->setAttribute('id', 'zbx_filter');
//	$filterForm->setMethod('get');
$filterForm->addVar('nav_time', $_REQUEST['nav_time']);
$script = new CScript("javascript: if(CLNDR['nav_time'].clndr.setSDateFromOuterObj()){" . "\$('nav_time').value = parseInt(CLNDR['nav_time'].clndr.sdt.getTime()/1000); }");
$filterForm->addAction('onsubmit', $script);
$clndr_icon = new CImg('images/general/bar/cal.gif', 'calendar', 16, 12, 'pointer');
$clndr_icon->addAction('onclick', "javascript: var pos = getPosition(this); pos.top+=14; pos.left-=174; CLNDR['nav_time'].clndr.clndrshow(pos.top,pos.left);");
$clndr_icon->setAttribute('style', 'vertical-align: middle;');
$nav_clndr = array(new CNumericBox('nav_day', $_REQUEST['nav_time'] > 0 ? date('d', $_REQUEST['nav_time']) : '', 2), new CNumericBox('nav_month', $_REQUEST['nav_time'] > 0 ? date('m', $_REQUEST['nav_time']) : '', 2), new CNumericBox('nav_year', $_REQUEST['nav_time'] > 0 ? date('Y', $_REQUEST['nav_time']) : '', 4), SPACE, new CNumericBox('nav_hour', $_REQUEST['nav_time'] > 0 ? date('H', $_REQUEST['nav_time']) : '', 2), ':', new CNumericBox('nav_minute', $_REQUEST['nav_time'] > 0 ? date('i', $_REQUEST['nav_time']) : '', 2), $clndr_icon);
zbx_add_post_js('create_calendar(null,["nav_day","nav_month","nav_year","nav_hour","nav_minute"],"nav_time");');
$filterForm->addRow(S_EVENTS_BEFORE, $nav_clndr);
if (EVENT_SOURCE_TRIGGERS == $source) {
    $filterForm->addVar('triggerid', $_REQUEST['triggerid']);
    if (isset($_REQUEST['triggerid']) && $_REQUEST['triggerid'] > 0) {
        $trigger = expand_trigger_description($_REQUEST['triggerid']);
    } else {
        $trigger = "";
    }
    $row = new CRow(array(new CCol(S_TRIGGER, 'form_row_l'), new CCol(array(new CTextBox("trigger", $trigger, 96, 'yes'), new CButton("btn1", S_SELECT, "return PopUp('popup.php?" . "dstfrm=" . $filterForm->GetName() . "&dstfld1=triggerid&dstfld2=trigger" . "&srctbl=triggers&srcfld1=triggerid&srcfld2=description&real_hosts=1');", 'T')), 'form_row_r')));
    $filterForm->addRow($row);
    $filterForm->addVar('show_unknown', $show_unknown);
Esempio n. 17
0
 /**
  * Returns output for preview of graph prototype.
  *
  * @return CTag
  */
 protected function getPreviewOutput()
 {
     $graphPrototype = $this->getGraphPrototype();
     switch ($graphPrototype['graphtype']) {
         case GRAPH_TYPE_NORMAL:
         case GRAPH_TYPE_STACKED:
             $url = 'chart3.php';
             break;
         case GRAPH_TYPE_EXPLODED:
         case GRAPH_TYPE_3D_EXPLODED:
         case GRAPH_TYPE_3D:
         case GRAPH_TYPE_PIE:
             $url = 'chart7.php';
             break;
         case GRAPH_TYPE_BAR:
         case GRAPH_TYPE_COLUMN:
         case GRAPH_TYPE_BAR_STACKED:
         case GRAPH_TYPE_COLUMN_STACKED:
             $url = 'chart_bar.php';
             break;
         default:
             show_error_message(_('Graph prototype not found.'));
             exit;
     }
     $graphPrototypeItems = API::GraphItem()->get(array('output' => array('gitemid', 'itemid', 'sortorder', 'flags', 'type', 'calc_fnc', 'drawtype', 'yaxisside', 'color'), 'graphids' => array($graphPrototype['graphid'])));
     $queryParams = array('items' => $graphPrototypeItems, 'graphtype' => $graphPrototype['graphtype'], 'period' => 3600, 'legend' => $graphPrototype['show_legend'], 'graph3d' => $graphPrototype['show_3d'], 'width' => $this->screenitem['width'], 'height' => $this->screenitem['height'], 'name' => $graphPrototype['name']);
     $url .= '?' . http_build_query($queryParams);
     $img = new CImg($url);
     $img->preload();
     return new CSpan($img);
 }
Esempio n. 18
0
 } else {
     $mname = get_request('mname', '');
     $maintenance_type = get_request('maintenance_type', 0);
     $active_since = zbxDateToTime(get_request('active_since', date('YmdHis')));
     $active_till = zbxDateToTime(get_request('active_till', date('YmdHis', time() + 86400)));
     $description = get_request('description', '');
 }
 $tblMntc = new CTable(null, 'formElementTable');
 $tblMntc->addRow(array(S_NAME, new CTextBox('mname', $mname, 50)));
 $cmbType = new CComboBox('maintenance_type', $maintenance_type);
 $cmbType->addItem(MAINTENANCE_TYPE_NORMAL, S_WITH_DATA_COLLECTION);
 $cmbType->addItem(MAINTENANCE_TYPE_NODATA, S_NO_DATA_COLLECTION);
 $tblMntc->addRow(array(S_MAINTENANCE_TYPE, $cmbType));
 $tblMntc->addItem(new Cvar('active_since', date('YmdHis', $active_since)));
 $tblMntc->addItem(new Cvar('active_till', date('YmdHis', $active_till)));
 $clndr_icon = new CImg('images/general/bar/cal.gif', 'calendar', 16, 12, 'pointer');
 $clndr_icon->addAction('onclick', 'javascript: var pos = getPosition(this); ' . 'pos.top+=10; pos.left+=16; CLNDR["mntc_active_since"].clndr.clndrshow(pos.top,pos.left);');
 zbx_add_post_js('create_calendar(null, ["mntc_since_day","mntc_since_month","mntc_since_year",' . '"mntc_since_hour","mntc_since_minute"],"mntc_active_since","active_since");');
 $tblMntc->addRow(array(S_ACTIVE_SINCE, array(new CNumericBox('mntc_since_day', $active_since > 0 ? date('d', $active_since) : '', 2), '/', new CNumericBox('mntc_since_month', $active_since > 0 ? date('m', $active_since) : '', 2), '/', new CNumericBox('mntc_since_year', $active_since > 0 ? date('Y', $active_since) : '', 4), SPACE, new CNumericBox('mntc_since_hour', $active_since > 0 ? date('H', $active_since) : '', 2), ':', new CNumericBox('mntc_since_minute', $active_since > 0 ? date('i', $active_since) : '', 2), $clndr_icon)));
 $clndr_icon->addAction('onclick', 'javascript: var pos = getPosition(this); ' . 'pos.top+=10; pos.left+=16; CLNDR["mntc_active_till"].clndr.clndrshow(pos.top,pos.left);');
 zbx_add_post_js('create_calendar(null,["mntc_till_day","mntc_till_month","mntc_till_year",' . '"mntc_till_hour","mntc_till_minute"],"mntc_active_till","active_till");');
 $tblMntc->addRow(array(S_ACTIVE_TILL, array(new CNumericBox('mntc_till_day', $active_till > 0 ? date('d', $active_till) : '', 2), '/', new CNumericBox('mntc_till_month', $active_till > 0 ? date('m', $active_till) : '', 2), '/', new CNumericBox('mntc_till_year', $active_till > 0 ? date('Y', $active_till) : '', 4), SPACE, new CNumericBox('mntc_till_hour', $active_till > 0 ? date('H', $active_till) : '', 2), ':', new CNumericBox('mntc_till_minute', $active_till > 0 ? date('i', $active_till) : '', 2), $clndr_icon)));
 $tblMntc->addRow(array(S_DESCRIPTION, new CTextArea('description', $description, 66, 5)));
 $footer = array(new CButton('save', S_SAVE));
 if (isset($_REQUEST['maintenanceid'])) {
     $footer[] = new CButton('clone', S_CLONE);
     $footer[] = new CButtonDelete(S_DELETE_MAINTENANCE_PERIOD_Q, url_param('form') . url_param('maintenanceid'));
 }
 $footer[] = new CButtonCancel();
 $left_tab->addRow(new CFormElement(S_MAINTENANCE, $tblMntc, $footer));
 // }}} MAINTENANCE FORM
Esempio n. 19
0
<?php
header("Content-Type: image/jpeg");
include("inc/init.php");
if(!empty($_GET['url_file'])) $url_file = $_GET['url_file'];
$img = CImg::load_img($url_file, 345, 259);
imagejpeg($img, "", 100);
?>


Esempio n. 20
0
 private function makeSImgStr($id)
 {
     $tr = new CRow();
     $td = new CCol();
     $count = isset($this->tree[$id]['nodeimg']) ? strlen($this->tree[$id]['nodeimg']) : 0;
     for ($i = 0; $i < $count; $i++) {
         switch ($this->tree[$id]['nodeimg'][$i]) {
             case 'O':
                 $td->setAttribute('style', 'width: 22px');
                 $img = new CImg('images/general/tree/zero.gif', 'o', '22', '14');
                 break;
             case 'I':
                 $td->setAttribute('style', 'width:22px; background-image:url(images/general/tree/pointc.gif);');
                 $img = new CImg('images/general/tree/zero.gif', 'i', '22', '14');
                 break;
             case 'L':
                 $td->setAttribute('valign', 'top');
                 //					$td->setAttribute('style','width:22px; background-image:url(images/general/tree/pointc.gif);');
                 $div = new CTag('div', 'yes');
                 $div->setAttribute('style', 'height: 10px; width:22px; background-image:url(images/general/tree/pointc.gif);');
                 if ($this->tree[$id]['nodetype'] == 2) {
                     $img = new CImg('images/general/tree/plus.gif', 'y', '22', '14');
                     $img->setAttribute('onclick', 'javascript: ' . $this->treename . '.closeSNodeX(' . $id . ',this);' . " showPopupDiv('div_node_tree','select_iframe');");
                     // IE6 Fix
                     $img->setAttribute('id', 'idi_' . $id);
                     $img->setClass('imgnode');
                 } else {
                     $img = new CImg('images/general/tree/pointl.gif', 'y', '22', '14');
                 }
                 $div->addItem($img);
                 $img = $div;
                 break;
             case 'T':
                 $td->setAttribute('valign', 'top');
                 if ($this->tree[$id]['nodetype'] == 2) {
                     $td->setAttribute('style', 'width:22px; background-image:url(images/general/tree/pointc.gif);');
                     $img = new CImg('images/general/tree/plus.gif', 't', '22', '14');
                     $img->setAttribute('onclick', 'javascript: ' . $this->treename . '.closeSNodeX(' . $id . ',this);' . " showPopupDiv('div_node_tree','select_iframe');");
                     // IE6 Fix
                     $img->setAttribute('id', 'idi_' . $id);
                     $img->setClass('imgnode');
                 } else {
                     $td->setAttribute('style', 'width:22px; background-image:url(images/general/tree/pointc.gif);');
                     $img = new CImg('images/general/tree/pointl.gif', 't', '22', '14');
                 }
                 break;
         }
         $td->addItem($img);
         $tr->addItem($td);
         $td = new CCol();
     }
     //	echo $txt.' '.$this->tree[$id]['Name'].'<br />';
     return $tr;
 }
    if (zbx_empty($item['yaxisside'])) {
        $item['yaxisside'] = 0;
    }
    insert_js('loadItem(' . $n . ', ' . CJs::encodeJson($item['gitemid']) . ', ' . $this->data['graphid'] . ', ' . $item['itemid'] . ', ' . CJs::encodeJson($name) . ', ' . $item['type'] . ', ' . $item['calc_fnc'] . ', ' . $item['drawtype'] . ', ' . $item['yaxisside'] . ', \'' . $item['color'] . '\', ' . $item['flags'] . ');', true);
}
$graphFormList->addRow(_('Items'), new CDiv($itemsTable, 'objectgroup inlineblock border_dotted ui-corner-all'));
// append tabs to form
$graphTab = new CTabView();
if (!$this->data['form_refresh']) {
    $graphTab->setSelected(0);
}
$graphTab->addTab('graphTab', empty($this->data['parent_discoveryid']) ? _('Graph') : _('Graph prototype'), $graphFormList);
/*
 * Preview tab
 */
$chartImage = new CImg('chart3.php?period=3600');
$chartImage->preload();
$graphPreviewTable = new CTable(null, 'center maxwidth');
$graphPreviewTable->addRow(new CDiv($chartImage, null, 'previewChar'));
$graphTab->addTab('previewTab', _('Preview'), $graphPreviewTable);
$graphForm->addItem($graphTab);
// append buttons to form
if (!empty($this->data['graphid'])) {
    $updateButton = new CSubmit('update', _('Update'));
    $deleteButton = new CButtonDelete($this->data['parent_discoveryid'] ? _('Delete graph prototype?') : _('Delete graph?'), url_params(array('graphid', 'parent_discoveryid', 'hostid')));
    if (!empty($this->data['templateid'])) {
        $updateButton->setEnabled(false);
        $deleteButton->setEnabled(false);
    }
    $graphForm->addItem(makeFormFooter($updateButton, array(new CSubmit('clone', _('Clone')), $deleteButton, new CButtonCancel(url_param('parent_discoveryid')))));
} else {
Esempio n. 22
0
function get_screen($screenid, $editmode, $effectiveperiod = NULL)
{
    global $USER_DETAILS;
    if ($screenid == 0) {
        return new CTableInfo(S_NO_SCREENS_DEFINED);
    }
    $r = CScreen::get(array('screenids' => $screenid, 'editable' => $editmode == 1 ? 1 : null, 'output' => API_OUTPUT_SHORTEN));
    if (empty($r)) {
        access_deny();
    }
    if (is_null($effectiveperiod)) {
        $effectiveperiod = ZBX_MIN_PERIOD;
    }
    $result = DBselect('SELECT name,hsize,vsize FROM screens WHERE screenid=' . $screenid);
    $row = DBfetch($result);
    if (!$row) {
        return new CTableInfo(S_NO_SCREENS_DEFINED);
    }
    $sql = 'SELECT * FROM screens_items WHERE screenid=' . $screenid;
    $iresult = DBSelect($sql);
    $skip_field = array();
    $irows = array();
    while ($irow = DBfetch($iresult)) {
        $irows[] = $irow;
        for ($i = 0; $i < $irow['rowspan'] || $i == 0; $i++) {
            for ($j = 0; $j < $irow['colspan'] || $j == 0; $j++) {
                if ($i != 0 || $j != 0) {
                    if (!isset($skip_field[$irow['y'] + $i])) {
                        $skip_field[$irow['y'] + $i] = array();
                    }
                    $skip_field[$irow['y'] + $i][$irow['x'] + $j] = 1;
                }
            }
        }
    }
    $table = new CTable(new CLink(S_NO_ROWS_IN_SCREEN . SPACE . $row['name'], 'screenconf.php?config=0&form=update&screenid=' . $screenid), $editmode == 0 || $editmode == 2 ? 'screen_view' : 'screen_edit');
    $table->setAttribute('id', 'iframe');
    if ($editmode == 1) {
        $new_cols = array(new Ccol(new Cimg('images/general/zero.gif', 'zero', 1, 1)));
        for ($c = 0; $c < $row['hsize'] + 1; $c++) {
            $add_icon = new Cimg('images/general/closed.gif', NULL, NULL, NULL, 'pointer');
            $add_icon->addAction('onclick', "javascript: location.href = 'screenedit.php?config=1&screenid={$screenid}&add_col={$c}';");
            array_push($new_cols, new Ccol($add_icon));
        }
        $table->addRow($new_cols);
    }
    $empty_screen_col = array();
    for ($r = 0; $r < $row['vsize']; $r++) {
        $new_cols = array();
        $empty_screen_row = true;
        if ($editmode == 1) {
            $add_icon = new Cimg('images/general/closed.gif', NULL, NULL, NULL, 'pointer');
            $add_icon->addAction('onclick', "javascript: location.href = 'screenedit.php?config=1&screenid={$screenid}&add_row={$r}';");
            array_push($new_cols, new Ccol($add_icon));
        }
        for ($c = 0; $c < $row['hsize']; $c++) {
            $item = array();
            if (isset($skip_field[$r][$c])) {
                continue;
            }
            $item_form = false;
            $irow = false;
            foreach ($irows as $tmprow) {
                if ($tmprow['x'] == $c && $tmprow['y'] == $r) {
                    $irow = $tmprow;
                    break;
                }
            }
            if ($irow) {
                $screenitemid = $irow['screenitemid'];
                $resourcetype = $irow['resourcetype'];
                $resourceid = $irow['resourceid'];
                $width = $irow['width'];
                $height = $irow['height'];
                $colspan = $irow['colspan'];
                $rowspan = $irow['rowspan'];
                $elements = $irow['elements'];
                $valign = $irow['valign'];
                $halign = $irow['halign'];
                $style = $irow['style'];
                $url = $irow['url'];
                $dynamic = $irow['dynamic'];
            } else {
                $screenitemid = 0;
                $resourcetype = 0;
                $resourceid = 0;
                $width = 0;
                $height = 0;
                $colspan = 0;
                $rowspan = 0;
                $elements = 0;
                $valign = VALIGN_DEFAULT;
                $halign = HALIGN_DEFAULT;
                $style = 0;
                $url = '';
                $dynamic = 0;
            }
            if ($screenitemid > 0) {
                $empty_screen_row = false;
                $empty_screen_col[$c] = 1;
            }
            if ($editmode == 1 && $screenitemid != 0) {
                $onclick_action = "ZBX_SCREENS['" . $_REQUEST['screenid'] . "'].screen.element_onclick('screenedit.php?form=update" . url_param('screenid') . '&screenitemid=' . $screenitemid . "#form');";
                $action = 'screenedit.php?form=update' . url_param('screenid') . '&screenitemid=' . $screenitemid . '#form';
            } else {
                if ($editmode == 1 && $screenitemid == 0) {
                    $onclick_action = "ZBX_SCREENS['" . $_REQUEST['screenid'] . "'].screen.element_onclick('screenedit.php?form=update" . url_param('screenid') . '&x=' . $c . '&y=' . $r . "#form');";
                    $action = 'screenedit.php?form=update' . url_param('screenid') . '&x=' . $c . '&y=' . $r . '#form';
                } else {
                    $action = NULL;
                }
            }
            if ($editmode == 1 && isset($_REQUEST['form']) && isset($_REQUEST['x']) && $_REQUEST['x'] == $c && isset($_REQUEST['y']) && $_REQUEST['y'] == $r) {
                // click on empty field
                $item = get_screen_item_form();
                $item_form = true;
            } else {
                if ($editmode == 1 && isset($_REQUEST['form']) && isset($_REQUEST['screenitemid']) && bccomp($_REQUEST['screenitemid'], $screenitemid) == 0) {
                    // click on element
                    $item = get_screen_item_form();
                    $item_form = true;
                } else {
                    if ($screenitemid != 0 && $resourcetype == SCREEN_RESOURCE_GRAPH) {
                        if ($editmode == 0) {
                            $action = 'charts.php?graphid=' . $resourceid . url_param('period') . url_param('stime');
                        }
                        // GRAPH & ZOOM features
                        $dom_graph_id = 'graph_' . $screenitemid . '_' . $resourceid;
                        $containerid = 'graph_cont_' . $screenitemid . '_' . $resourceid;
                        $graphDims = getGraphDims($resourceid);
                        $graphDims['graphHeight'] = $height;
                        $graphDims['width'] = $width;
                        $graph = get_graph_by_graphid($resourceid);
                        $graphid = $graph['graphid'];
                        $legend = $graph['show_legend'];
                        $graph3d = $graph['show_3d'];
                        //-------------
                        // Host feature
                        if ($dynamic == SCREEN_DYNAMIC_ITEM && isset($_REQUEST['hostid']) && $_REQUEST['hostid'] > 0) {
                            $options = array('hostids' => $_REQUEST['hostid'], 'output' => array('hostid', 'host'));
                            $hosts = CHost::get($options);
                            $host = reset($hosts);
                            $options = array('graphids' => $resourceid, 'output' => API_OUTPUT_EXTEND, 'select_hosts' => API_OUTPUT_REFER, 'select_graph_items' => API_OUTPUT_EXTEND);
                            $graph = CGraph::get($options);
                            $graph = reset($graph);
                            if (count($graph['hosts']) == 1) {
                                // if items from one host we change them, or set calculated if not exist on that host
                                if ($graph['ymax_type'] == GRAPH_YAXIS_TYPE_ITEM_VALUE && $graph['ymax_itemid']) {
                                    $new_dinamic = get_same_graphitems_for_host(array(array('itemid' => $graph['ymax_itemid'])), $_REQUEST['hostid'], false);
                                    $new_dinamic = reset($new_dinamic);
                                    if (isset($new_dinamic['itemid']) && $new_dinamic['itemid'] > 0) {
                                        $graph['ymax_itemid'] = $new_dinamic['itemid'];
                                    } else {
                                        $graph['ymax_type'] = GRAPH_YAXIS_TYPE_CALCULATED;
                                    }
                                }
                                if ($graph['ymin_type'] == GRAPH_YAXIS_TYPE_ITEM_VALUE && $graph['ymin_itemid']) {
                                    $new_dinamic = get_same_graphitems_for_host(array(array('itemid' => $graph['ymin_itemid'])), $_REQUEST['hostid'], false);
                                    $new_dinamic = reset($new_dinamic);
                                    if (isset($new_dinamic['itemid']) && $new_dinamic['itemid'] > 0) {
                                        $graph['ymin_itemid'] = $new_dinamic['itemid'];
                                    } else {
                                        $graph['ymin_type'] = GRAPH_YAXIS_TYPE_CALCULATED;
                                    }
                                }
                            }
                            $url = $graph['graphtype'] == GRAPH_TYPE_PIE || $graph['graphtype'] == GRAPH_TYPE_EXPLODED ? 'chart7.php' : 'chart3.php';
                            $url = new Curl($url);
                            foreach ($graph as $name => $value) {
                                if ($name == 'width' || $name == 'height') {
                                    continue;
                                }
                                $url->setArgument($name, $value);
                            }
                            $new_items = get_same_graphitems_for_host($graph['gitems'], $_REQUEST['hostid'], false);
                            foreach ($new_items as $gitem) {
                                unset($gitem['gitemid']);
                                unset($gitem['graphid']);
                                foreach ($gitem as $name => $value) {
                                    $url->setArgument('items[' . $gitem['itemid'] . '][' . $name . ']', $value);
                                }
                            }
                            $url->setArgument('name', $host['host'] . ': ' . $graph['name']);
                            $url = $url->getUrl();
                        }
                        //-------------
                        $objData = array('id' => $resourceid, 'domid' => $dom_graph_id, 'containerid' => $containerid, 'objDims' => $graphDims, 'loadSBox' => 0, 'loadImage' => 1, 'loadScroll' => 0, 'dynamic' => 0);
                        $default = false;
                        if ($graphDims['graphtype'] == GRAPH_TYPE_PIE || $graphDims['graphtype'] == GRAPH_TYPE_EXPLODED) {
                            if ($dynamic == SCREEN_SIMPLE_ITEM || empty($url)) {
                                $url = 'chart6.php?graphid=' . $resourceid;
                                $default = true;
                            }
                            $timeline = array();
                            $timeline['period'] = $effectiveperiod;
                            $timeline['starttime'] = date('YmdHis', get_min_itemclock_by_graphid($resourceid));
                            if (isset($_REQUEST['stime'])) {
                                $timeline['usertime'] = date('YmdHis', zbxDateToTime($_REQUEST['stime']) + $timeline['period']);
                            }
                            // $src = $url.'&width='.$width.'&height='.$height.'&legend='.$legend.'&graph3d='.$graph3d;
                            $src = $url . '&width=' . $width . '&height=' . $height . '&legend=' . $legend . '&graph3d=' . $graph3d . '&period=' . $effectiveperiod . url_param('stime');
                            $objData['src'] = $src;
                        } else {
                            if ($dynamic == SCREEN_SIMPLE_ITEM || empty($url)) {
                                $url = 'chart2.php?graphid=' . $resourceid;
                                $default = true;
                            }
                            $src = $url . '&width=' . $width . '&height=' . $height . '&period=' . $effectiveperiod . url_param('stime');
                            $timeline = array();
                            if (isset($graphid) && !is_null($graphid) && $editmode != 1) {
                                $timeline['period'] = $effectiveperiod;
                                $timeline['starttime'] = date('YmdHis', time() - ZBX_MAX_PERIOD);
                                //get_min_itemclock_by_graphid($graphid);
                                if (isset($_REQUEST['stime'])) {
                                    $timeline['usertime'] = date('YmdHis', zbxDateToTime($_REQUEST['stime']) + $timeline['period']);
                                }
                                $objData['loadSBox'] = 1;
                            }
                            $objData['src'] = $src;
                        }
                        if ($editmode || !$default) {
                            $item = new CDiv();
                        } else {
                            $item = new CLink(null, $action);
                        }
                        $item->setAttribute('id', $containerid);
                        $item = array($item);
                        if ($editmode == 1) {
                            $item[] = BR();
                            $item[] = new CLink(S_CHANGE, $action);
                        }
                        if ($editmode == 2) {
                            insert_js('timeControl.addObject("' . $dom_graph_id . '",' . zbx_jsvalue($timeline) . ',' . zbx_jsvalue($objData) . ');');
                        } else {
                            zbx_add_post_js('timeControl.addObject("' . $dom_graph_id . '",' . zbx_jsvalue($timeline) . ',' . zbx_jsvalue($objData) . ');');
                        }
                    } else {
                        if ($screenitemid != 0 && $resourcetype == SCREEN_RESOURCE_SIMPLE_GRAPH) {
                            $dom_graph_id = 'graph_' . $screenitemid . '_' . $resourceid;
                            $containerid = 'graph_cont_' . $screenitemid . '_' . $resourceid;
                            $graphDims = getGraphDims();
                            $graphDims['graphHeight'] = $height;
                            $graphDims['width'] = $width;
                            $objData = array('id' => $resourceid, 'domid' => $dom_graph_id, 'containerid' => $containerid, 'objDims' => $graphDims, 'loadSBox' => 0, 'loadImage' => 1, 'loadScroll' => 0, 'dynamic' => 0);
                            // Host feature
                            if ($dynamic == SCREEN_DYNAMIC_ITEM && isset($_REQUEST['hostid']) && $_REQUEST['hostid'] > 0) {
                                if ($newitemid = get_same_item_for_host($resourceid, $_REQUEST['hostid'])) {
                                    $resourceid = $newitemid;
                                } else {
                                    $resourceid = '';
                                }
                            }
                            //-------------
                            if ($editmode == 0 && !empty($resourceid)) {
                                $action = 'history.php?action=showgraph&itemid=' . $resourceid . url_param('period') . url_param('stime');
                            }
                            $timeline = array();
                            $timeline['starttime'] = date('YmdHis', time() - ZBX_MAX_PERIOD);
                            if (!zbx_empty($resourceid) && $editmode != 1) {
                                $timeline['period'] = $effectiveperiod;
                                if (isset($_REQUEST['stime'])) {
                                    $timeline['usertime'] = date('YmdHis', zbxDateToTime($_REQUEST['stime']) + $timeline['period']);
                                }
                                $objData['loadSBox'] = 1;
                            }
                            $src = zbx_empty($resourceid) ? 'chart3.php?' : 'chart.php?itemid=' . $resourceid . '&';
                            $src .= $url . 'width=' . $width . '&height=' . $height;
                            $objData['src'] = $src;
                            if ($editmode) {
                                $item = new CDiv();
                            } else {
                                $item = new CLink(null, $action);
                            }
                            $item->setAttribute('id', $containerid);
                            $item = array($item);
                            if ($editmode == 1) {
                                $item[] = BR();
                                $item[] = new CLink(S_CHANGE, $action);
                            }
                            if ($editmode == 2) {
                                insert_js('timeControl.addObject("' . $dom_graph_id . '",' . zbx_jsvalue($timeline) . ',' . zbx_jsvalue($objData) . ');');
                            } else {
                                zbx_add_post_js('timeControl.addObject("' . $dom_graph_id . '",' . zbx_jsvalue($timeline) . ',' . zbx_jsvalue($objData) . ');');
                            }
                        } else {
                            if ($screenitemid != 0 && $resourcetype == SCREEN_RESOURCE_MAP) {
                                $image_map = new CImg("map.php?noedit=1&sysmapid={$resourceid}" . "&width={$width}&height={$height}&curtime=" . time());
                                if ($editmode == 0) {
                                    $options = array('sysmapids' => $resourceid, 'output' => API_OUTPUT_EXTEND, 'select_selements' => API_OUTPUT_EXTEND, 'nopermissions' => 1);
                                    $sysmaps = CMap::get($options);
                                    $sysmap = reset($sysmaps);
                                    $action_map = getActionMapBySysmap($sysmap);
                                    $image_map->setMap($action_map->getName());
                                    $item = array($action_map, $image_map);
                                } else {
                                    $item = $image_map;
                                    //						$item = new CLink($image_map, $action);
                                }
                            } else {
                                if ($screenitemid != 0 && $resourcetype == SCREEN_RESOURCE_PLAIN_TEXT) {
                                    // Host feature
                                    if ($dynamic == SCREEN_DYNAMIC_ITEM && isset($_REQUEST['hostid']) && $_REQUEST['hostid'] > 0) {
                                        if ($newitemid = get_same_item_for_host($resourceid, $_REQUEST['hostid'])) {
                                            $resourceid = $newitemid;
                                        } else {
                                            $resourceid = 0;
                                        }
                                    }
                                    //-------------
                                    $item = array(get_screen_plaintext($resourceid, $elements, $style));
                                    if ($editmode == 1) {
                                        array_push($item, new CLink(S_CHANGE, $action));
                                    }
                                } else {
                                    if ($screenitemid != 0 && $resourcetype == SCREEN_RESOURCE_HOSTGROUP_TRIGGERS) {
                                        $params = array('groupids' => null, 'hostids' => null, 'maintenance' => null, 'severity' => null, 'limit' => $elements);
                                        $tr_form = S_ALL_S;
                                        if ($resourceid > 0) {
                                            $options = array('groupids' => $resourceid, 'output' => API_OUTPUT_EXTEND);
                                            $hostgroups = CHostgroup::get($options);
                                            $hostgroup = reset($hostgroups);
                                            $tr_form = new CSpan(S_GROUP . ': ' . $hostgroup['name'], 'white');
                                            $params['groupids'] = $hostgroup['groupid'];
                                        } else {
                                            $groupid = get_request('tr_groupid', CProfile::get('web.screens.tr_groupid', 0));
                                            $hostid = get_request('tr_hostid', CProfile::get('web.screens.tr_hostid', 0));
                                            CProfile::update('web.screens.tr_groupid', $groupid, PROFILE_TYPE_ID);
                                            CProfile::update('web.screens.tr_hostid', $hostid, PROFILE_TYPE_ID);
                                            $options = array('monitored_hosts' => 1, 'output' => API_OUTPUT_EXTEND);
                                            $groups = CHostGroup::get($options);
                                            order_result($groups, 'name');
                                            $options = array('monitored_hosts' => 1, 'output' => API_OUTPUT_EXTEND);
                                            if ($groupid > 0) {
                                                $options['groupids'] = $groupid;
                                            }
                                            $hosts = CHost::get($options);
                                            $hosts = zbx_toHash($hosts, 'hostid');
                                            order_result($hosts, 'host');
                                            if (!isset($hosts[$hostid])) {
                                                $hostid = 0;
                                            }
                                            $tr_form = new CForm();
                                            $cmbGroup = new CComboBox('tr_groupid', $groupid, 'submit()');
                                            $cmbHosts = new CComboBox('tr_hostid', $hostid, 'submit()');
                                            $cmbGroup->addItem(0, S_ALL_SMALL);
                                            $cmbHosts->addItem(0, S_ALL_SMALL);
                                            foreach ($groups as $gnum => $group) {
                                                $cmbGroup->addItem($group['groupid'], get_node_name_by_elid($group['groupid'], null, ': ') . $group['name']);
                                            }
                                            foreach ($hosts as $hnum => $host) {
                                                $cmbHosts->addItem($host['hostid'], get_node_name_by_elid($host['hostid'], null, ': ') . $host['host']);
                                            }
                                            $tr_form->addItem(array(S_GROUP . SPACE, $cmbGroup));
                                            $tr_form->addItem(array(SPACE . S_HOST . SPACE, $cmbHosts));
                                            if ($groupid > 0) {
                                                $params['groupids'] = $groupid;
                                            }
                                            if ($hostid > 0) {
                                                $params['hostids'] = $hostid;
                                            }
                                        }
                                        $item = array(get_table_header(array(S_STATUS_OF_TRIGGERS_BIG, SPACE, zbx_date2str(S_SCREENS_TRIGGER_FORM_DATE_FORMAT)), $tr_form));
                                        $item[] = make_latest_issues($params);
                                        if ($editmode == 1) {
                                            array_push($item, new CLink(S_CHANGE, $action));
                                        }
                                        ///-----------------------
                                    } else {
                                        if ($screenitemid != 0 && $resourcetype == SCREEN_RESOURCE_HOST_TRIGGERS) {
                                            $params = array('groupids' => null, 'hostids' => null, 'maintenance' => null, 'severity' => null, 'limit' => $elements);
                                            $tr_form = S_ALL_S;
                                            if ($resourceid > 0) {
                                                $options = array('hostids' => $resourceid, 'output' => API_OUTPUT_EXTEND);
                                                $hosts = CHost::get($options);
                                                $host = reset($hosts);
                                                $tr_form = new CSpan(S_HOST . ': ' . $host['host'], 'white');
                                                $params['hostids'] = $host['hostid'];
                                            } else {
                                                $groupid = get_request('tr_groupid', CProfile::get('web.screens.tr_groupid', 0));
                                                $hostid = get_request('tr_hostid', CProfile::get('web.screens.tr_hostid', 0));
                                                CProfile::update('web.screens.tr_groupid', $groupid, PROFILE_TYPE_ID);
                                                CProfile::update('web.screens.tr_hostid', $hostid, PROFILE_TYPE_ID);
                                                $options = array('monitored_hosts' => 1, 'output' => API_OUTPUT_EXTEND);
                                                $groups = CHostGroup::get($options);
                                                order_result($groups, 'name');
                                                $options = array('monitored_hosts' => 1, 'output' => API_OUTPUT_EXTEND);
                                                if ($groupid > 0) {
                                                    $options['groupids'] = $groupid;
                                                }
                                                $hosts = CHost::get($options);
                                                $hosts = zbx_toHash($hosts, 'hostid');
                                                order_result($hosts, 'host');
                                                if (!isset($hosts[$hostid])) {
                                                    $hostid = 0;
                                                }
                                                $tr_form = new CForm();
                                                $cmbGroup = new CComboBox('tr_groupid', $groupid, 'submit()');
                                                $cmbHosts = new CComboBox('tr_hostid', $hostid, 'submit()');
                                                $cmbGroup->addItem(0, S_ALL_SMALL);
                                                $cmbHosts->addItem(0, S_ALL_SMALL);
                                                foreach ($groups as $gnum => $group) {
                                                    $cmbGroup->addItem($group['groupid'], get_node_name_by_elid($group['groupid'], null, ': ') . $group['name']);
                                                }
                                                foreach ($hosts as $hnum => $host) {
                                                    $cmbHosts->addItem($host['hostid'], get_node_name_by_elid($host['hostid'], null, ': ') . $host['host']);
                                                }
                                                $tr_form->addItem(array(S_GROUP . SPACE, $cmbGroup));
                                                $tr_form->addItem(array(SPACE . S_HOST . SPACE, $cmbHosts));
                                                if ($groupid > 0) {
                                                    $params['groupids'] = $groupid;
                                                }
                                                if ($hostid > 0) {
                                                    $params['hostids'] = $hostid;
                                                }
                                            }
                                            ///-----------------------
                                            $item = array(get_table_header(array(S_STATUS_OF_TRIGGERS_BIG, SPACE, zbx_date2str(S_SCREENS_TRIGGER_FORM_DATE_FORMAT)), $tr_form));
                                            $item[] = make_latest_issues($params);
                                            if ($editmode == 1) {
                                                array_push($item, new CLink(S_CHANGE, $action));
                                            }
                                        } else {
                                            if ($screenitemid != 0 && $resourcetype == SCREEN_RESOURCE_SYSTEM_STATUS) {
                                                $params = array('groupids' => null, 'hostids' => null, 'maintenance' => null, 'severity' => null, 'limit' => null, 'extAck' => 0);
                                                $item = array(get_table_header(array(S_SYSTEM_STATUS, SPACE, zbx_date2str(S_SCREENS_TRIGGER_FORM_DATE_FORMAT))));
                                                $item[] = make_system_status($params);
                                                if ($editmode == 1) {
                                                    array_push($item, new CLink(S_CHANGE, $action));
                                                }
                                            } else {
                                                if ($screenitemid != 0 && $resourcetype == SCREEN_RESOURCE_HOSTS_INFO) {
                                                    $item = array(new CHostsInfo($resourceid, $style));
                                                    if ($editmode == 1) {
                                                        array_push($item, new CLink(S_CHANGE, $action));
                                                    }
                                                } else {
                                                    if ($screenitemid != 0 && $resourcetype == SCREEN_RESOURCE_TRIGGERS_INFO) {
                                                        $item = new CTriggersInfo($resourceid, null, $style);
                                                        $item = array($item);
                                                        if ($editmode == 1) {
                                                            array_push($item, new CLink(S_CHANGE, $action));
                                                        }
                                                    } else {
                                                        if ($screenitemid != 0 && $resourcetype == SCREEN_RESOURCE_SERVER_INFO) {
                                                            //					$item = array(get_table_header(S_STATUS_OF_ZABBIX_BIG),make_status_of_zbx());
                                                            $item = array(new CServerInfo());
                                                            if ($editmode == 1) {
                                                                array_push($item, new CLink(S_CHANGE, $action));
                                                            }
                                                        } else {
                                                            if ($screenitemid != 0 && $resourcetype == SCREEN_RESOURCE_CLOCK) {
                                                                $item = new CFlashClock($width, $height, $style, $action);
                                                            } else {
                                                                if ($screenitemid != 0 && $resourcetype == SCREEN_RESOURCE_SCREEN) {
                                                                    $item = array(get_screen($resourceid, 2, $effectiveperiod));
                                                                    if ($editmode == 1) {
                                                                        array_push($item, new CLink(S_CHANGE, $action));
                                                                    }
                                                                } else {
                                                                    if ($screenitemid != 0 && $resourcetype == SCREEN_RESOURCE_TRIGGERS_OVERVIEW) {
                                                                        $hostids = array();
                                                                        $res = DBselect('SELECT DISTINCT hg.hostid FROM hosts_groups hg WHERE hg.groupid=' . $resourceid);
                                                                        while ($tmp_host = DBfetch($res)) {
                                                                            $hostids[$tmp_host['hostid']] = $tmp_host['hostid'];
                                                                        }
                                                                        $item = array(get_triggers_overview($hostids, $style));
                                                                        if ($editmode == 1) {
                                                                            array_push($item, new CLink(S_CHANGE, $action));
                                                                        }
                                                                    } else {
                                                                        if ($screenitemid != 0 && $resourcetype == SCREEN_RESOURCE_DATA_OVERVIEW) {
                                                                            $hostids = array();
                                                                            $res = DBselect('SELECT DISTINCT hg.hostid FROM hosts_groups hg WHERE hg.groupid=' . $resourceid);
                                                                            while ($tmp_host = DBfetch($res)) {
                                                                                $hostids[$tmp_host['hostid']] = $tmp_host['hostid'];
                                                                            }
                                                                            $item = array(get_items_data_overview($hostids, $style));
                                                                            if ($editmode == 1) {
                                                                                array_push($item, new CLink(S_CHANGE, $action));
                                                                            }
                                                                        } else {
                                                                            if ($screenitemid != 0 && $resourcetype == SCREEN_RESOURCE_URL) {
                                                                                $item = array(new CIFrame($url, $width, $height, "auto"));
                                                                                if ($editmode == 1) {
                                                                                    array_push($item, BR(), new CLink(S_CHANGE, $action));
                                                                                }
                                                                            } else {
                                                                                if ($screenitemid != 0 && $resourcetype == SCREEN_RESOURCE_ACTIONS) {
                                                                                    $item = array(get_history_of_actions($elements));
                                                                                    if ($editmode == 1) {
                                                                                        array_push($item, new CLink(S_CHANGE, $action));
                                                                                    }
                                                                                } else {
                                                                                    if ($screenitemid != 0 && $resourcetype == SCREEN_RESOURCE_EVENTS) {
                                                                                        $options = array('monitored' => 1, 'value' => array(TRIGGER_VALUE_TRUE, TRIGGER_VALUE_FALSE), 'limit' => $elements);
                                                                                        $hide_unknown = CProfile::get('web.events.filter.hide_unknown', 0);
                                                                                        if ($hide_unknown) {
                                                                                            $options['value'] = array(TRIGGER_VALUE_TRUE, TRIGGER_VALUE_FALSE);
                                                                                        }
                                                                                        $item = new CTableInfo(S_NO_EVENTS_FOUND);
                                                                                        $item->SetHeader(array(S_TIME, is_show_all_nodes() ? S_NODE : null, S_HOST, S_DESCRIPTION, S_VALUE, S_SEVERITY));
                                                                                        $events = getLastEvents($options);
                                                                                        foreach ($events as $enum => $event) {
                                                                                            $trigger = $event['trigger'];
                                                                                            $host = $event['host'];
                                                                                            $value = new CCol(trigger_value2str($event['value']), get_trigger_value_style($event['value']));
                                                                                            //						$row = zbx_array_merge($triggers[$row['triggerid']],$row);
                                                                                            //						if((1 == $hide_unknown) && (!event_initial_time($row,$hide_unknown))) continue;
                                                                                            $item->addRow(array(zbx_date2str(S_EVENTS_TRIGGERS_EVENTS_HISTORY_LIST_DATE_FORMAT, $event['clock']), get_node_name_by_elid($event['objectid']), $host['host'], new CLink($trigger['description'], 'tr_events.php?triggerid=' . $event['objectid'] . '&eventid=' . $event['eventid']), $value, new CCol(get_severity_description($trigger['priority']), get_severity_style($trigger['priority']))));
                                                                                        }
                                                                                        $item = array($item);
                                                                                        if ($editmode == 1) {
                                                                                            array_push($item, new CLink(S_CHANGE, $action));
                                                                                        }
                                                                                    } else {
                                                                                        $item = array(SPACE);
                                                                                        if ($editmode == 1) {
                                                                                            array_push($item, BR(), new CLink(S_CHANGE, $action));
                                                                                        }
                                                                                    }
                                                                                }
                                                                            }
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            $str_halign = 'def';
            if ($halign == HALIGN_CENTER) {
                $str_halign = 'cntr';
            }
            if ($halign == HALIGN_LEFT) {
                $str_halign = 'left';
            }
            if ($halign == HALIGN_RIGHT) {
                $str_halign = 'right';
            }
            $str_valign = 'def';
            if ($valign == VALIGN_MIDDLE) {
                $str_valign = 'mdl';
            }
            if ($valign == VALIGN_TOP) {
                $str_valign = 'top';
            }
            if ($valign == VALIGN_BOTTOM) {
                $str_valign = 'bttm';
            }
            if ($editmode == 1 && !$item_form) {
                $item = new CDiv($item, 'draggable');
                $item->setAttribute('id', 'position_' . $r . '_' . $c);
                if ($editmode == 1) {
                    $item->setAttribute('onclick', 'javascript: ' . $onclick_action);
                }
            }
            $new_col = new CCol($item, $str_halign . '_' . $str_valign);
            if ($colspan) {
                $new_col->SetColSpan($colspan);
            }
            if ($rowspan) {
                $new_col->SetRowSpan($rowspan);
            }
            array_push($new_cols, $new_col);
        }
        if ($editmode == 1) {
            $rmv_icon = new Cimg('images/general/opened.gif', NULL, NULL, NULL, 'pointer');
            if ($empty_screen_row) {
                $rmv_row_link = "javascript: location.href = 'screenedit.php?config=1&screenid={$screenid}&rmv_row={$r}';";
            } else {
                $rmv_row_link = "javascript: if(Confirm('" . S_THIS_SCREEN_ROW_NOT_EMPTY . '. ' . S_DELETE_IT_Q . "')){" . " location.href = 'screenedit.php?config=1&screenid={$screenid}&rmv_row={$r}';}";
            }
            $rmv_icon->addAction('onclick', $rmv_row_link);
            array_push($new_cols, new Ccol($rmv_icon));
        }
        $table->addRow(new CRow($new_cols));
    }
    if ($editmode == 1) {
        $add_icon = new Cimg('images/general/closed.gif', NULL, NULL, NULL, 'pointer');
        $add_icon->addAction('onclick', "javascript: location.href = 'screenedit.php?config=1&screenid={$screenid}&add_row={$row['vsize']}';");
        $new_cols = array(new Ccol($add_icon));
        for ($c = 0; $c < $row['hsize']; $c++) {
            $rmv_icon = new Cimg('images/general/opened.gif', NULL, NULL, NULL, 'pointer');
            if (isset($empty_screen_col[$c])) {
                $rmv_col_link = "javascript: if(Confirm('" . S_THIS_SCREEN_COLUMN_NOT_EMPTY . '. ' . S_DELETE_IT_Q . "')){" . " location.href = 'screenedit.php?config=1&screenid={$screenid}&rmv_col={$c}';}";
            } else {
                $rmv_col_link = "javascript: location.href = 'screenedit.php?config=1&screenid={$screenid}&rmv_col={$c}';";
            }
            $rmv_icon->addAction('onclick', $rmv_col_link);
            array_push($new_cols, new Ccol($rmv_icon));
        }
        array_push($new_cols, new Ccol(new Cimg('images/general/zero.gif', 'zero', 1, 1)));
        $table->addRow($new_cols);
    }
    return $table;
}
$removeLinkIcon->setAttribute('id', 'linkRemove');
$expandMacros = new CSpan($this->data['sysmap']['expand_macros'] == SYSMAP_EXPAND_MACROS_ON ? _('On') : _('Off'), 'whitelink');
$expandMacros->setAttribute('id', 'expand_macros');
$gridShow = new CSpan($this->data['sysmap']['grid_show'] == SYSMAP_GRID_SHOW_ON ? _('Shown') : _('Hidden'), 'whitelink');
$gridShow->setAttribute('id', 'gridshow');
$gridAutoAlign = new CSpan($this->data['sysmap']['grid_align'] == SYSMAP_GRID_ALIGN_ON ? _('On') : _('Off'), 'whitelink');
$gridAutoAlign->setAttribute('id', 'gridautoalign');
$gridSize = new CComboBox('gridsize', $this->data['sysmap']['grid_size']);
$gridSize->addItems(array(20 => '20x20', 40 => '40x40', 50 => '50x50', 75 => '75x75', 100 => '100x100'));
$gridAlignAll = new CSubmit('gridalignall', _('Align icons'));
$gridAlignAll->setAttribute('id', 'gridalignall');
$gridForm = new CDiv(array($gridSize, $gridAlignAll));
$gridForm->setAttribute('id', 'gridalignblock');
$saveButton = new CSubmit('update', _('Update'));
$saveButton->setAttribute('id', 'sysmap_update');
$menuTable = new CTable(null, 'textwhite');
$menuTable->addRow(array(_s('Map "%s"', $this->data['sysmap']['name']), SPACE . SPACE, _('Icon'), SPACE, $addIcon, SPACE, $removeIcon, SPACE . SPACE, _('Link'), SPACE, $addLinkIcon, SPACE, $removeLinkIcon, SPACE . SPACE, _('Expand macros') . ' [ ', $expandMacros, ' ]', SPACE . SPACE, _('Grid') . SPACE . '[', $gridShow, '|', $gridAutoAlign, ']', SPACE, $gridForm, SPACE . '|' . SPACE, $saveButton));
$sysmapWidget->addPageHeader($menuTable);
// create map
$backgroundImage = new CImg('images/general/tree/zero.gif', 'Sysmap');
$backgroundImage->setAttribute('id', 'sysmap_img', $this->data['sysmap']['width'], $this->data['sysmap']['height']);
$backgroundImageTable = new CTable();
$backgroundImageTable->addRow($backgroundImage);
$sysmapWidget->addItem($backgroundImageTable);
$container = new CDiv();
$container->setAttribute('id', 'sysmap_cnt');
$sysmapWidget->addItem($container);
// create elements
zbx_add_post_js('ZABBIX.apps.map.run("sysmap_cnt", ' . CJs::encodeJson(array('sysmap' => $this->data['sysmap'], 'iconList' => $this->data['iconList'], 'defaultAutoIconId' => $this->data['defaultAutoIconId'], 'defaultIconId' => $this->data['defaultIconId'], 'defaultIconName' => $this->data['defaultIconName']), true) . ');');
insert_show_color_picker_javascript();
return $sysmapWidget;
Esempio n. 24
0
    $cmbResource->addItem(AUDIT_RESOURCE_VALUE_MAP, S_VALUE_MAP);
    $cmbResource->addItem(AUDIT_RESOURCE_IT_SERVICE, S_IT_SERVICE);
    $cmbResource->addItem(AUDIT_RESOURCE_MAP, S_MAP);
    $cmbResource->addItem(AUDIT_RESOURCE_SCREEN, S_SCREEN);
    $cmbResource->addItem(AUDIT_RESOURCE_NODE, S_NODE);
    $cmbResource->addItem(AUDIT_RESOURCE_SCENARIO, S_SCENARIO);
    $cmbResource->addItem(AUDIT_RESOURCE_DISCOVERY_RULE, S_DISCOVERY_RULE);
    $cmbResource->addItem(AUDIT_RESOURCE_SLIDESHOW, S_SLIDESHOW);
    $cmbResource->addItem(AUDIT_RESOURCE_SCRIPT, S_SCRIPT);
    $cmbResource->addItem(AUDIT_RESOURCE_PROXY, S_PROXY);
    $cmbResource->addItem(AUDIT_RESOURCE_MAINTENANCE, S_MAINTENANCE);
    $cmbResource->addItem(AUDIT_RESOURCE_REGEXP, S_REGULAR_EXPRESSION);
    $filterForm->addRow(S_RESOURCE, $cmbResource);
}
//*
$clndr_icon = new CImg('images/general/bar/cal.gif', 'calendar', 16, 12, 'pointer');
$clndr_icon->AddAction('onclick', "javascript: var pos = getPosition(this); pos.top+=10; pos.left+=16; CLNDR['audit_since'].clndr.clndrshow(pos.top,pos.left);");
$filtertimetab = new CTable();
$filtertimetab->AddOption('width', '10%');
$filtertimetab->SetCellPadding(0);
$filtertimetab->SetCellSpacing(0);
$filtertimetab->AddRow(array(S_FROM, new CNumericBox('filter_since_day', $_REQUEST['filter_timesince'] > 0 ? date('d', $_REQUEST['filter_timesince']) : '', 2), '/', new CNumericBox('filter_since_month', $_REQUEST['filter_timesince'] > 0 ? date('m', $_REQUEST['filter_timesince']) : '', 2), '/', new CNumericBox('filter_since_year', $_REQUEST['filter_timesince'] > 0 ? date('Y', $_REQUEST['filter_timesince']) : '', 4), new CNumericBox('filter_since_hour', $_REQUEST['filter_timesince'] > 0 ? date('H', $_REQUEST['filter_timesince']) : '', 2), ':', new CNumericBox('filter_since_minute', $_REQUEST['filter_timesince'] > 0 ? date('i', $_REQUEST['filter_timesince']) : '', 2), $clndr_icon));
zbx_add_post_js('create_calendar(null,["filter_since_day","filter_since_month","filter_since_year","filter_since_hour","filter_since_minute"],"audit_since");');
$clndr_icon->AddAction('onclick', "javascript: var pos = getPosition(this); pos.top+=10; pos.left+=16; CLNDR['audit_till'].clndr.clndrshow(pos.top,pos.left);");
$filtertimetab->AddRow(array(S_TILL, new CNumericBox('filter_till_day', $_REQUEST['filter_timetill'] > 0 ? date('d', $_REQUEST['filter_timetill']) : '', 2), '/', new CNumericBox('filter_till_month', $_REQUEST['filter_timetill'] > 0 ? date('m', $_REQUEST['filter_timetill']) : '', 2), '/', new CNumericBox('filter_till_year', $_REQUEST['filter_timetill'] > 0 ? date('Y', $_REQUEST['filter_timetill']) : '', 4), new CNumericBox('filter_till_hour', $_REQUEST['filter_timetill'] > 0 ? date('H', $_REQUEST['filter_timetill']) : '', 2), ':', new CNumericBox('filter_till_minute', $_REQUEST['filter_timetill'] > 0 ? date('i', $_REQUEST['filter_timetill']) : '', 2), $clndr_icon));
zbx_add_post_js('create_calendar(null,["filter_till_day","filter_till_month","filter_till_year","filter_till_hour","filter_till_minute"],"audit_till");');
zbx_add_post_js('addListener($("filter_icon"),"click",CLNDR[\'audit_since\'].clndr.clndrhide.bindAsEventListener(CLNDR[\'audit_since\'].clndr));' . 'addListener($("filter_icon"),"click",CLNDR[\'audit_till\'].clndr.clndrhide.bindAsEventListener(CLNDR[\'audit_till\'].clndr));');
$row_count++;
$filterForm->addRow(S_PERIOD, $filtertimetab);
//*/
$reset = new CButton("filter_rst", S_RESET);
Esempio n. 25
0
/**
 * Create array with all inputs required for date selection and calendar.
 *
 * @param string      $name
 * @param int|array   $date unix timestamp/date array(Y,m,d,H,i)
 * @param string|null $relatedCalendar name of the calendar which must be closed when this calendar opens
 *
 * @return array
 */
function createDateSelector($name, $date, $relatedCalendar = null)
{
    $calendarIcon = new CImg('images/general/bar/cal.gif', 'calendar', 16, 12, 'pointer');
    $onClick = 'var pos = getPosition(this); pos.top += 10; pos.left += 16; CLNDR["' . $name . '_calendar"].clndr.clndrshow(pos.top, pos.left);';
    if ($relatedCalendar) {
        $onClick .= ' CLNDR["' . $relatedCalendar . '_calendar"].clndr.clndrhide();';
    }
    $calendarIcon->onClick($onClick);
    if (is_array($date)) {
        $y = $date['y'];
        $m = $date['m'];
        $d = $date['d'];
        $h = $date['h'];
        $i = $date['i'];
    } else {
        $y = date('Y', $date);
        $m = date('m', $date);
        $d = date('d', $date);
        $h = date('H', $date);
        $i = date('i', $date);
    }
    $day = new CNumericBox($name . '_day', $d, 2);
    $day->attr('placeholder', _('dd'));
    $month = new CNumericBox($name . '_month', $m, 2);
    $month->attr('placeholder', _('mm'));
    $year = new CNumericBox($name . '_year', $y, 4);
    $year->attr('placeholder', _('yyyy'));
    $hour = new CNumericBox($name . '_hour', $h, 2);
    $hour->attr('placeholder', _('hh'));
    $minute = new CNumericBox($name . '_minute', $i, 2);
    $minute->attr('placeholder', _('mm'));
    $fields = array($day, '/', $month, '/', $year, SPACE, $hour, ':', $minute, $calendarIcon);
    zbx_add_post_js('create_calendar(null,' . '["' . $name . '_day","' . $name . '_month","' . $name . '_year","' . $name . '_hour","' . $name . '_minute"],' . '"' . $name . '_calendar",' . '"' . $name . '");');
    return $fields;
}
Esempio n. 26
0
    $headerMapForm = new CForm('get');
    $headerMapForm->addVar('fullscreen', $this->data['fullscreen']);
    $headerMapForm->addItem(array(_('Maps'), SPACE, $mapComboBox));
    $headerSeverityMinForm = new CForm('get');
    $headerSeverityMinForm->addVar('fullscreen', $this->data['fullscreen']);
    $headerSeverityMinForm->addItem(array(SPACE, _('Minimum severity'), SPACE, $this->data['pageFilter']->getSeveritiesMinCB()));
    $mapWidget->addHeader($this->data['map']['name'], array($headerMapForm, $headerSeverityMinForm));
    // get map parent maps
    $parentMaps = array();
    foreach (getParentMaps($this->data['sysmapid']) as $parent) {
        // check for permissions
        if (isset($this->data['maps'][$parent['sysmapid']])) {
            $parentMaps[] = SPACE . SPACE;
            $parentMaps[] = new CLink($parent['name'], 'maps.php?sysmapid=' . $parent['sysmapid'] . '&fullscreen=' . $this->data['fullscreen'] . '&severity_min=' . $this->data['severity_min']);
        }
    }
    if (!empty($parentMaps)) {
        array_unshift($parentMaps, _('Upper level maps') . ':');
        $mapWidget->addHeader($parentMaps);
    }
    $actionMap = getActionMapBySysmap($this->data['map'], array('severity_min' => $this->data['severity_min']));
    $mapTable->addRow($actionMap);
    $imgMap = new CImg('map.php?sysmapid=' . $this->data['sysmapid'] . '&severity_min=' . $this->data['severity_min']);
    $imgMap->setMap($actionMap->getName());
    $mapTable->addRow($imgMap);
    $icon = get_icon('favourite', array('fav' => 'web.favorite.sysmapids', 'elname' => 'sysmapid', 'elid' => $this->data['sysmapid']));
    $fsIcon = get_icon('fullscreen', array('fullscreen' => $this->data['fullscreen']));
}
$mapWidget->addItem($mapTable);
$mapWidget->addPageHeader(_('NETWORK MAPS'), array($icon, SPACE, $fsIcon));
return $mapWidget;
Esempio n. 27
0
 $frmPd->addVar('dstfrm', $_REQUEST['dstfrm']);
 $config = get_request('config', 1);
 $caption = get_request('caption', '');
 $color = get_request('color', '009900');
 $report_timesince = get_request('report_timesince', time() - 86400);
 $report_timetill = get_request('report_timetill', time());
 $frmPd->addVar('config', $config);
 $frmPd->addVar('report_timesince', $report_timesince);
 $frmPd->addVar('report_timetill', $report_timetill);
 if (isset($_REQUEST['period_id'])) {
     $frmPd->addVar('period_id', $_REQUEST['period_id']);
 }
 $frmPd->addRow(array(new CVisibilityBox('caption_visible', !zbx_empty($caption), 'caption', S_DEFAULT), S_CAPTION), new CTextBox('caption', $caption, 10));
 //		$frmPd->addRow(S_CAPTION, new CTextBox('caption',$caption,10));
 //*
 $clndr_icon = new CImg('images/general/bar/cal.gif', 'calendar', 16, 12, 'pointer');
 $clndr_icon->addAction('onclick', 'javascript: ' . 'var pos = getPosition(this); ' . 'pos.top+=10; ' . 'pos.left+=16; ' . "CLNDR['avail_report_since'].clndr.clndrshow(pos.top,pos.left);");
 $reporttimetab = new CTable(null, 'calendar');
 $reporttimetab->setAttribute('width', '10%');
 $reporttimetab->setCellPadding(0);
 $reporttimetab->setCellSpacing(0);
 $reporttimetab->addRow(array(S_FROM, new CNumericBox('report_since_day', $report_timesince > 0 ? date('d', $report_timesince) : '', 2), '/', new CNumericBox('report_since_month', $report_timesince > 0 ? date('m', $report_timesince) : '', 2), '/', new CNumericBox('report_since_year', $report_timesince > 0 ? date('Y', $report_timesince) : '', 4), SPACE, new CNumericBox('report_since_hour', $report_timesince > 0 ? date('H', $report_timesince) : '', 2), ':', new CNumericBox('report_since_minute', $report_timesince > 0 ? date('i', $report_timesince) : '', 2), $clndr_icon));
 zbx_add_post_js('create_calendar(null,' . '["report_since_day","report_since_month","report_since_year","report_since_hour","report_since_minute"],' . '"avail_report_since",' . '"report_timesince");');
 $clndr_icon->addAction('onclick', 'javascript: ' . 'var pos = getPosition(this); ' . 'pos.top+=10; ' . 'pos.left+=16; ' . "CLNDR['avail_report_till'].clndr.clndrshow(pos.top,pos.left);");
 $reporttimetab->addRow(array(S_TILL, new CNumericBox('report_till_day', $report_timetill > 0 ? date('d', $report_timetill) : '', 2), '/', new CNumericBox('report_till_month', $report_timetill > 0 ? date('m', $report_timetill) : '', 2), '/', new CNumericBox('report_till_year', $report_timetill > 0 ? date('Y', $report_timetill) : '', 4), SPACE, new CNumericBox('report_till_hour', $report_timetill > 0 ? date('H', $report_timetill) : '', 2), ':', new CNumericBox('report_till_minute', $report_timetill > 0 ? date('i', $report_timetill) : '', 2), $clndr_icon));
 zbx_add_post_js('create_calendar(null,' . '["report_till_day","report_till_month","report_till_year","report_till_hour","report_till_minute"],' . '"avail_report_till",' . '"report_timetill");');
 $frmPd->addRow(S_PERIOD, $reporttimetab);
 //*/
 if ($config != 1) {
     $frmPd->addRow(S_COLOR, new CColor('color', $color));
 } else {
Esempio n. 28
0
if (isset($_REQUEST['groupid'])) {
    $navForm->AddVar('groupid', $_REQUEST['groupid']);
}
if (isset($_REQUEST['hostid'])) {
    $navForm->AddVar('hostid', $_REQUEST['hostid']);
}
$navForm->AddVar('fullscreen', $_REQUEST['fullscreen']);
//	$navForm->AddVar('nav_time',$_REQUEST['nav_time']);
$back = new CButton('back', '« ' . S_DAY);
$next = new CButton('next', S_DAY . ' »');
if ($nav_time + 86400 > time()) {
    $next->AddOption('disabled', 'disabled');
}
$script = new CScript("javascript: if(CLNDR['nav_time'].clndr.setSDateFromOuterObj()){" . "this.action += '?nav_time='+parseInt(CLNDR['nav_time'].clndr.sdt.getTime()/1000);}");
$navForm->AddAction('onsubmit', $script);
$clndr_icon = new CImg('images/general/bar/cal.gif', 'calendar', 16, 12, 'pointer');
$clndr_icon->AddAction('onclick', "javascript: var pos = getPosition(this); pos.top+=14; pos.left-=174; CLNDR['nav_time'].clndr.clndrshow(pos.top,pos.left);");
$clndr_icon->AddOption('style', 'vertical-align: bottom;');
$nav_clndr = array(new CNumericBox('nav_day', $_REQUEST['nav_time'] > 0 ? date('d', $_REQUEST['nav_time']) : '', 2), new CNumericBox('nav_month', $_REQUEST['nav_time'] > 0 ? date('m', $_REQUEST['nav_time']) : '', 2), new CNumericBox('nav_year', $_REQUEST['nav_time'] > 0 ? date('Y', $_REQUEST['nav_time']) : '', 4), $clndr_icon);
zbx_add_post_js('create_calendar(null,["nav_day","nav_month","nav_year"],"nav_time");');
zbx_add_post_js('addListener($("hat_events_icon"),' . '"click",' . 'CLNDR["nav_time"].clndr.clndrhide.bindAsEventListener(CLNDR["nav_time"].clndr));');
$navForm->AddItem(array($back, SPACE, $next, new CSpan(' | ', 'divider'), $nav_clndr, SPACE, new CButton('load', S_SHOW . ' »')));
$navigation = $navForm;
//------------
$filterForm = new CFormTable(S_FILTER);
//,'events.php?filter_set=1','POST',null,'sform');
$filterForm->AddOption('name', 'zbx_filter');
$filterForm->AddOption('id', 'zbx_filter');
$filterForm->SetMethod('get');
$filterForm->AddVar('nav_time', $_REQUEST['nav_time']);
if (EVENT_SOURCE_TRIGGERS == $source) {
 /**
  * Returns output for simple graph preview.
  *
  * @return CTag
  */
 protected function getPreviewOutput()
 {
     $itemPrototype = $this->getItemPrototype();
     $queryParams = array('items' => array($itemPrototype), 'period' => 3600, 'legend' => 1, 'width' => $this->screenitem['width'], 'height' => $this->screenitem['height'], 'name' => $itemPrototype['hosts'][0]['name'] . NAME_DELIMITER . $itemPrototype['name']);
     $src = 'chart3.php?' . http_build_query($queryParams);
     $img = new CImg($src);
     $img->preload();
     return new CSpan($img);
 }
Esempio n. 30
0
function make_sorting_link($obj, $tabfield, $url = '')
{
    global $page;
    $sortorder = isset($_REQUEST['sortorder']) && $_REQUEST['sortorder'] == ZBX_SORT_UP ? ZBX_SORT_DOWN : ZBX_SORT_UP;
    if (empty($url)) {
        $url = '?';
        $url_params = explode('&', $_SERVER['QUERY_STRING']);
        foreach ($url_params as $id => $param) {
            if (zbx_empty($param)) {
                continue;
            }
            list($name, $value) = explode('=', $param);
            if (zbx_empty($name) || $name == 'sort' || $name == 'sortorder') {
                continue;
            }
            $url .= $param . '&';
        }
    } else {
        $url .= '&';
    }
    $url .= 'sort=' . $tabfield . '&sortorder=' . $sortorder;
    if ($page['type'] != PAGE_TYPE_HTML && defined('ZBX_PAGE_MAIN_HAT')) {
        $link = new CLink($obj, $url, null, "javascript: return updater.onetime_update('" . ZBX_PAGE_MAIN_HAT . "','" . $url . "');");
    } else {
        $link = new CLink($obj, $url);
    }
    if (isset($_REQUEST['sort']) && $tabfield == $_REQUEST['sort']) {
        if ($sortorder == ZBX_SORT_UP) {
            $img = new CImg('images/general/sort_downw.gif', 'down', 10, 10);
        } else {
            $img = new CImg('images/general/sort_upw.gif', 'up', 10, 10);
        }
        $img->AddOption('style', 'line-height: 18px; vertical-align: middle;');
        $link = array($link, SPACE, $img);
    }
    return $link;
}