$text2 = new CTextBox('macros[' . $i . '][value]', $macro['value'], 40, $readonly, 255); $text2->setAttribute('placeholder', _('value')); $span = new CSpan('⇒'); $span->addStyle('vertical-align:top;'); $deleteButtonCell = null; if (!$readonly) { $deleteButtonCell = array(new CButton('macros_' . $i . '_remove', _('Remove'), null, 'link_menu element-table-remove')); if (isset($macro['globalmacroid'])) { $deleteButtonCell[] = new CVar('macros[' . $i . '][globalmacroid]', $macro['globalmacroid'], 'macros_' . $i . '_id'); } if (isset($macro['hostmacroid'])) { $deleteButtonCell[] = new CVar('macros[' . $i . '][hostmacroid]', $macro['hostmacroid'], 'macros_' . $i . '_id'); } } $row = array($text1, $span, $text2, $deleteButtonCell); $macrosTable->addRow($row, 'form_row'); } // buttons if (!$readonly) { $addButton = new CButton('macro_add', _('Add'), null, 'link_menu element-table-add'); $buttonColumn = new CCol($addButton); $buttonColumn->setAttribute('colspan', 5); $buttonRow = new CRow(); $buttonRow->setAttribute('id', 'row_new_macro'); $buttonRow->addItem($buttonColumn); $macrosTable->addRow($buttonRow); } // form list $macrosFormList = new CFormList('macrosFormList'); $macrosFormList->addRow($macrosTable); return $macrosFormList;
function create_hat($caption, $items, $addicons = null, $id = null, $state = null) { if (is_null($id)) { list($usec, $sec) = explode(' ', microtime()); $id = 'hat_' . (int) ($sec % 10) . (int) ($usec * 1000); } $td_l = new CCol(SPACE); $td_l->setAttribute('width', '100%'); $icons_row = array($td_l); if (!is_null($addicons)) { if (!is_array($addicons)) { $addicons = array($addicons); } foreach ($addicons as $value) { $icons_row[] = $value; } } if (!is_null($state)) { $icon = new CIcon(_('Show') . '/' . _('Hide'), $state ? 'arrowup' : 'arrowdown', "change_hat_state(this,'" . $id . "');"); $icon->setAttribute('id', $id . '_icon'); $icons_row[] = $icon; } else { $state = true; } $icon_tab = new CTable(); $icon_tab->setAttribute('width', '100%'); $icon_tab->addRow($icons_row); $table = new CTable(); $table->setAttribute('width', '100%'); $table->setCellPadding(0); $table->setCellSpacing(0); $table->addRow(get_table_header($caption, $icon_tab)); $div = new CDiv($items); $div->setAttribute('id', $id); if (!$state) { $div->setAttribute('style', 'display: none;'); } $table->addRow($div); return $table; }
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; }
foreach ($this->data['new_operation']['opconditions'] as $opcondition) { if (!isset($opcondition['conditiontype'])) { $opcondition['conditiontype'] = 0; } if (!isset($opcondition['operator'])) { $opcondition['operator'] = 0; } if (!isset($opcondition['value'])) { $opcondition['value'] = 0; } if (!str_in_array($opcondition['conditiontype'], $allowed_opconditions)) { continue; } $label = num2letter($i); $labelCol = new CCol($label, 'label'); $labelCol->setAttribute('data-conditiontype', $opcondition['conditiontype']); $labelCol->setAttribute('data-formulaid', $label); $operationConditionsTable->addRow(array($labelCol, get_condition_desc($opcondition['conditiontype'], $opcondition['operator'], $opcondition['value']), array(new CButton('remove', _('Remove'), 'javascript: removeOperationCondition(' . $i . ');', 'link_menu'), new CVar('new_operation[opconditions][' . $i . '][conditiontype]', $opcondition['conditiontype']), new CVar('new_operation[opconditions][' . $i . '][operator]', $opcondition['operator']), new CVar('new_operation[opconditions][' . $i . '][value]', $opcondition['value']))), null, 'opconditions_' . $i); $i++; } $calcTypeComboBox = new CComboBox('new_operation[evaltype]', $this->data['new_operation']['evaltype'], 'submit()'); $calcTypeComboBox->attr('id', 'operationEvaltype'); $calcTypeComboBox->addItem(CONDITION_EVAL_TYPE_AND_OR, _('And/Or')); $calcTypeComboBox->addItem(CONDITION_EVAL_TYPE_AND, _('And')); $calcTypeComboBox->addItem(CONDITION_EVAL_TYPE_OR, _('Or')); $newOperationsTable->addRow(array(_('Type of calculation'), array($calcTypeComboBox, new CSpan('', null, 'operationConditionLabel'))), null, 'operationConditionRow'); if (!isset($_REQUEST['new_opcondition'])) { $operationConditionsTable->addRow(new CCol(new CSubmit('new_opcondition', _('New'), null, 'link_menu'))); } $newOperationsTable->addRow(array(_('Conditions'), new CDiv($operationConditionsTable, 'objectgroup inlineblock border_dotted ui-corner-all')), 'indent_top'); }
/** * NOTE - menu array format: * first level: * 'label' = main menu title. * 'default_page_id = default page url from 'pages' then opened menu. * 'pages' = collection of pages which are displayed from this menu. * these pages are saved a last visited submenu of main menu. * * second level (pages): * 'url' = real url for this page * 'label' = submenu title, if missing, menu skipped, but remembered as last visited page. * 'sub_pages' = collection of pages for displaying but not remembered as last visited. */ function zbx_construct_menu(&$main_menu, &$sub_menus, &$page) { global $ZBX_MENU; $denied_page_requested = false; $page_exists = false; $deny = !defined('ZBX_PAGE_NO_AUTHORIZATION'); foreach ($ZBX_MENU as $label => $menu) { $show_menu = true; if (isset($menu['user_type'])) { $show_menu &= $menu['user_type'] <= CWebUser::$data['type']; } if ($label == 'login') { $show_menu = false; } $menu_class = 'horizontal_menu_n'; $sub_menus[$label] = array(); foreach ($menu['pages'] as $sub_page) { $show_sub_menu = true; // show check if (!isset($sub_page['label'])) { $show_sub_menu = false; } if (!isset($sub_page['user_type'])) { $sub_page['user_type'] = $menu['user_type']; } if (CWebUser::$data['type'] < $sub_page['user_type']) { $show_sub_menu = false; } $row = array('menu_text' => isset($sub_page['label']) ? $sub_page['label'] : '', 'menu_url' => $sub_page['url'], 'class' => 'highlight', 'selected' => false); $sub_menu_active = $page['file'] == $sub_page['url']; $sub_menu_active |= isset($sub_page['sub_pages']) && str_in_array($page['file'], $sub_page['sub_pages']); if ($sub_menu_active) { // permition check $deny &= CWebUser::$data['type'] < $menu['user_type'] || CWebUser::$data['type'] < $sub_page['user_type']; $menu_class = 'active'; $page_exists = true; $page['menu'] = $label; $row['selected'] = true; if (!defined('ZBX_PAGE_NO_MENU')) { CProfile::update('web.menu.' . $label . '.last', $sub_page['url'], PROFILE_TYPE_STR); } } if ($show_sub_menu) { $sub_menus[$label][] = $row; } } if ($page_exists && !defined('ZBX_NOT_ALLOW_ALL_NODES') && (isset($menu['force_disable_all_nodes']) || isset($sub_page['force_disable_all_nodes']))) { define('ZBX_NOT_ALLOW_ALL_NODES', 1); } if ($page_exists && $deny) { $denied_page_requested = true; } if (!$show_menu) { unset($sub_menus[$label]); continue; } $menu_url = $sub_menus[$label][$menu['default_page_id']]['menu_url']; $mmenu_entry = new CCol($menu['label'], $menu_class); $mmenu_entry->setAttribute('id', $label); $mmenu_entry->addAction('onclick', 'javascript: redirect(\'' . $menu_url . '\');'); $mmenu_entry->addAction('onmouseover', 'javascript: MMenu.mouseOver(\'' . $label . '\');'); $mmenu_entry->addAction('onmouseout', 'javascript: MMenu.mouseOut();'); array_push($main_menu, $mmenu_entry); } if (!$page_exists && $page['type'] != PAGE_TYPE_XML && $page['type'] != PAGE_TYPE_CSV && $page['type'] != PAGE_TYPE_TEXT_FILE) { $denied_page_requested = true; } return $denied_page_requested; }
$lastValueHeader->setAttribute('title', _('Last value')); $lastDataHeader = new CCol(new CSpan(_x('Change', 'noun in latest data')), 'latest-data'); $lastDataHeader->setAttribute('title', _x('Change', 'noun in latest data')); $checkAllCheckbox = new CCheckBox('all_items', null, "checkAll('" . $form->getName() . "', 'all_items', 'itemids');"); $checkAllCheckboxCol = new CCol($checkAllCheckbox, 'latest-checkbox'); if ($filter['showDetails']) { $intervalHeader = new CCol(new CSpan(_('Interval')), 'latest-interval'); $intervalHeader->setAttribute('title', _('Interval')); $historyHeader = new CCol(new CSpan(_('History')), 'latest-history'); $historyHeader->setAttribute('title', _('History')); $trendsHeader = new CCol(new CSpan(_('Trends')), 'latest-trends'); $trendsHeader->setAttribute('title', _('Trends')); $typeHeader = new CCol(new CSpan(_('Type')), 'latest-type'); $typeHeader->setAttribute('title', _('Type')); $infoHeader = new CCol(new CSpan(_('Info')), 'latest-info'); $infoHeader->setAttribute('title', _('Info')); $table->addClass('latest-details'); $table->setHeader(array(new CCol(new CDiv(null, 'app-list-toggle-all icon-plus-9x9')), $checkAllCheckboxCol, $hostHeader, $nameHeader, $intervalHeader, $historyHeader, $trendsHeader, $typeHeader, $lastCheckHeader, $lastValueHeader, $lastDataHeader, new CCol(null, 'latest-actions'), $infoHeader)); } else { $table->setHeader(array(new CCol(new CDiv(null, 'app-list-toggle-all icon-plus-9x9')), $checkAllCheckboxCol, $hostHeader, $nameHeader, $lastCheckHeader, $lastValueHeader, $lastDataHeader, new CCol(null, 'latest-actions'))); } $tab_rows = array(); foreach ($items as $key => $item) { if (!$item['applications']) { continue; } $lastHistory = isset($history[$item['itemid']][0]) ? $history[$item['itemid']][0] : null; $prevHistory = isset($history[$item['itemid']][1]) ? $history[$item['itemid']][1] : null; if (strpos($item['units'], ',') !== false) { list($item['units'], $item['unitsLong']) = explode(',', $item['units']); } else {
function make_sorting_header($obj, $tabfield, $url = '') { global $page; $sortorder = $_REQUEST['sort'] == $tabfield && $_REQUEST['sortorder'] == ZBX_SORT_UP ? ZBX_SORT_DOWN : ZBX_SORT_UP; $link = new Curl($url); if (empty($url)) { $link->formatGetArguments(); } $link->setArgument('sort', $tabfield); $link->setArgument('sortorder', $sortorder); $url = $link->getUrl(); if ($page['type'] != PAGE_TYPE_HTML && defined('ZBX_PAGE_MAIN_HAT')) { $script = "javascript: return updater.onetime_update('" . ZBX_PAGE_MAIN_HAT . "', '" . $url . "');"; } else { $script = 'javascript: redirect("' . $url . '");'; } zbx_value2array($obj); $cont = new CSpan(); foreach ($obj as $el) { if (is_object($el) || $el === SPACE) { $cont->addItem($el); } else { $cont->addItem(new CSpan($el, 'underline')); } } $cont->addItem(SPACE); $img = null; if (isset($_REQUEST['sort']) && $tabfield == $_REQUEST['sort']) { if ($sortorder == ZBX_SORT_UP) { $img = new CSpan(SPACE, 'icon_sortdown'); } else { $img = new CSpan(SPACE, 'icon_sortup'); } } $col = new CCol(array($cont, $img), 'nowrap hover_grey'); $col->setAttribute('onclick', $script); return $col; }
function show_messages($bool = true, $okmsg = null, $errmsg = null) { global $page, $ZBX_MESSAGES; if (!defined('PAGE_HEADER_LOADED')) { return null; } if (defined('ZBX_API_REQUEST')) { return null; } if (!isset($page['type'])) { $page['type'] = PAGE_TYPE_HTML; } $message = array(); $width = 0; $height = 0; if (!$bool && !is_null($errmsg)) { $msg = _('ERROR') . ': ' . $errmsg; } elseif ($bool && !is_null($okmsg)) { $msg = $okmsg; } if (isset($msg)) { switch ($page['type']) { case PAGE_TYPE_IMAGE: array_push($message, array('text' => $msg, 'color' => !$bool ? array('R' => 255, 'G' => 0, 'B' => 0) : array('R' => 34, 'G' => 51, 'B' => 68), 'font' => 2)); $width = max($width, imagefontwidth(2) * zbx_strlen($msg) + 1); $height += imagefontheight(2) + 1; break; case PAGE_TYPE_XML: echo htmlspecialchars($msg) . "\n"; break; case PAGE_TYPE_HTML: default: $msg_tab = new CTable($msg, $bool ? 'msgok' : 'msgerr'); $msg_tab->setCellPadding(0); $msg_tab->setCellSpacing(0); $row = array(); $msg_col = new CCol(bold($msg), 'msg_main msg'); $msg_col->setAttribute('id', 'page_msg'); $row[] = $msg_col; if (isset($ZBX_MESSAGES) && !empty($ZBX_MESSAGES)) { $msg_details = new CDiv(_('Details'), 'blacklink'); $msg_details->setAttribute('onclick', 'javascript: showHide("msg_messages", IE ? "block" : "table");'); $msg_details->setAttribute('title', _('Maximize') . '/' . _('Minimize')); array_unshift($row, new CCol($msg_details, 'clr')); } $msg_tab->addRow($row); $msg_tab->show(); break; } } if (isset($ZBX_MESSAGES) && !empty($ZBX_MESSAGES)) { if ($page['type'] == PAGE_TYPE_IMAGE) { $msg_font = 2; foreach ($ZBX_MESSAGES as $msg) { if ($msg['type'] == 'error') { array_push($message, array('text' => $msg['message'], 'color' => array('R' => 255, 'G' => 55, 'B' => 55), 'font' => $msg_font)); } else { array_push($message, array('text' => $msg['message'], 'color' => array('R' => 155, 'G' => 155, 'B' => 55), 'font' => $msg_font)); } $width = max($width, imagefontwidth($msg_font) * zbx_strlen($msg['message']) + 1); $height += imagefontheight($msg_font) + 1; } } elseif ($page['type'] == PAGE_TYPE_XML) { foreach ($ZBX_MESSAGES as $msg) { echo '[' . $msg['type'] . '] ' . $msg['message'] . "\n"; } } else { $lst_error = new CList(null, 'messages'); foreach ($ZBX_MESSAGES as $msg) { $lst_error->addItem($msg['message'], $msg['type']); $bool = $bool && 'error' != zbx_strtolower($msg['type']); } $msg_show = 6; $msg_count = count($ZBX_MESSAGES); if ($msg_count > $msg_show) { $msg_count = $msg_show * 16; $lst_error->setAttribute('style', 'height: ' . $msg_count . 'px;'); } $tab = new CTable(null, $bool ? 'msgok' : 'msgerr'); $tab->setCellPadding(0); $tab->setCellSpacing(0); $tab->setAttribute('id', 'msg_messages'); $tab->setAttribute('style', 'width: 100%;'); if (isset($msg_tab) && $bool) { $tab->setAttribute('style', 'display: none;'); } $tab->addRow(new CCol($lst_error, 'msg')); $tab->show(); } $ZBX_MESSAGES = null; } if ($page['type'] == PAGE_TYPE_IMAGE && count($message) > 0) { $width += 2; $height += 2; $canvas = imagecreate($width, $height); imagefilledrectangle($canvas, 0, 0, $width, $height, imagecolorallocate($canvas, 255, 255, 255)); foreach ($message as $id => $msg) { $message[$id]['y'] = 1 + (isset($previd) ? $message[$previd]['y'] + $message[$previd]['h'] : 0); $message[$id]['h'] = imagefontheight($msg['font']); imagestring($canvas, $msg['font'], 1, $message[$id]['y'], $msg['text'], imagecolorallocate($canvas, $msg['color']['R'], $msg['color']['G'], $msg['color']['B'])); $previd = $id; } imageOut($canvas); imagedestroy($canvas); } }
$name->setAttribute('name_step', $stepid); $name->onClick('return PopUp("popup_httpstep.php?dstfrm=' . $httpForm->getName() . '&list_name=steps&stepid="+jQuery(this).attr("name_step")+"' . url_param($step['name'], false, 'name') . url_param($step['timeout'], false, 'timeout') . url_param($step['url'], false, 'url') . url_param($step['posts'], false, 'posts') . url_param($step['required'], false, 'required') . url_param($step['status_codes'], false, 'status_codes') . '", 600, 410);'); if (zbx_strlen($step['url']) > 70) { $url = new CSpan(substr($step['url'], 0, 35) . SPACE . '...' . SPACE . substr($step['url'], zbx_strlen($step['url']) - 25, 25)); $url->setHint($step['url']); } else { $url = $step['url']; } $removeButton = new CButton('remove_' . $stepid, _('Remove'), 'javascript: removeStep(this);', 'link_menu'); $removeButton->setAttribute('remove_step', $stepid); $row = new CRow(array(new CSpan(null, 'ui-icon ui-icon-arrowthick-2-n-s move'), $numSpan, $name, $step['timeout'] . SPACE . _('sec'), $url, htmlspecialchars($step['required']), $step['status_codes'], $removeButton), 'sortable'); $row->setAttribute('id', 'steps_' . $stepid); $stepsTable->addRow($row); } $tmpColumn = new CCol(new CButton('add_step', _('Add'), 'return PopUp("popup_httpstep.php?dstfrm=' . $httpForm->getName() . '", 600, 410);', 'link_menu'), null, 8); $tmpColumn->setAttribute('style', 'vertical-align: middle;'); $stepsTable->addRow(new CRow($tmpColumn)); $httpStepFormList->addRow(_('Steps'), new CDiv($stepsTable, 'objectgroup inlineblock border_dotted ui-corner-all')); // append tabs to form $httpTab = new CTabView(array('remember' => true)); if (!$this->data['form_refresh']) { $httpTab->setSelected(0); } $httpTab->addTab('scenarioTab', _('Scenario'), $httpFormList); $httpTab->addTab('stepTab', _('Steps'), $httpStepFormList); $httpForm->addItem($httpTab); // append buttons to form if (!empty($this->data['httptestid'])) { $httpForm->addItem(makeFormFooter(array(new CSubmit('save', _('Save'))), array(new CSubmit('clone', _('Clone')), new CButtonDelete(_('Delete scenario?'), url_param('form') . url_param('httptestid') . url_param('hostid')), new CButtonCancel()))); } else { $httpForm->addItem(makeFormFooter(array(new CSubmit('save', _('Save'))), array(new CButtonCancel())));
$scroll_div->setAttribute('id', 'scrollbar_cntr'); $charts_wdgt->addFlicker($scroll_div, CProfile::get('web.charts.filter.state', 1)); $graphDims = getGraphDims($_REQUEST['graphid']); if ($graphDims['graphtype'] == GRAPH_TYPE_PIE || $graphDims['graphtype'] == GRAPH_TYPE_EXPLODED) { $loadSBox = 0; $scrollWidthByImage = 0; $containerid = 'graph_cont1'; $src = 'chart6.php?graphid=' . $_REQUEST['graphid']; } else { $loadSBox = 1; $scrollWidthByImage = 1; $containerid = 'graph_cont1'; $src = 'chart2.php?graphid=' . $_REQUEST['graphid']; } $graph_cont = new CCol(); $graph_cont->setAttribute('id', $containerid); $table->addRow($graph_cont); $icon = get_icon('favourite', array('fav' => 'web.favorite.graphids', 'elname' => 'graphid', 'elid' => $_REQUEST['graphid'])); $fs_icon = get_icon('fullscreen', array('fullscreen' => $_REQUEST['fullscreen'])); $rst_icon = get_icon('reset', array('id' => $_REQUEST['graphid'])); array_push($icons, $icon, $rst_icon, $fs_icon); // NAV BAR $utime = zbxDateToTime($_REQUEST['stime']); $starttime = get_min_itemclock_by_graphid($_REQUEST['graphid']); if ($utime < $starttime) { $starttime = $utime; } $timeline = array('starttime' => date('YmdHis', $starttime), 'period' => $effectiveperiod, 'usertime' => date('YmdHis', $utime + $effectiveperiod)); $dom_graph_id = 'graph'; $objData = array('id' => $_REQUEST['graphid'], 'domid' => $dom_graph_id, 'containerid' => $containerid, 'src' => $src, 'objDims' => $graphDims, 'loadSBox' => $loadSBox, 'loadImage' => 1, 'loadScroll' => 1, 'scrollWidthByImage' => $scrollWidthByImage, 'dynamic' => 1); zbx_add_post_js('timeControl.addObject("' . $dom_graph_id . '",' . zbx_jsvalue($timeline) . ',' . zbx_jsvalue($objData) . ');');
** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. **/ $regExpForm = new CForm(); $regExpForm->setName('regularExpressionsForm'); $regExpForm->addVar('form', $this->data['form']); $regExpForm->addVar('form_refresh', $this->data['form_refresh']); $regExpForm->addVar('regexpid', get_request('regexpid')); $regExpLeftTable = new CTable(); $regExpLeftTable->addRow(create_hat(_('Regular expression'), get_regexp_form(), null, 'hat_regexp')); $regExpRightTable = new CTable(); $regExpRightTable->addRow(create_hat(_('Expressions'), get_expressions_tab(), null, 'hat_expressions')); if (isset($_REQUEST['new_expression'])) { $hatTable = create_hat(_('New expression'), get_expression_form(), null, 'hat_new_expression'); $hatTable->setAttribute('style', 'margin-top: 3px;'); $regExpRightTable->addRow($hatTable); } $regExpLeftColumn = new CCol($regExpLeftTable); $regExpLeftColumn->setAttribute('valign', 'top'); $regExpRightColumn = new CCol($regExpRightTable); $regExpRightColumn->setAttribute('valign', 'top'); $regExpOuterTable = new CTable(); $regExpOuterTable->addRow(array($regExpLeftColumn, new CCol(' '), $regExpRightColumn)); $regExpForm->addItem($regExpOuterTable); show_messages(); return $regExpForm;
$help = new CHelp('web.view.php', 'right'); $help_table = new CTableInfo(); $help_table->setAttribute('style', 'width: 200px'); if ($_REQUEST['type'] == SHOW_TRIGGERS) { $help_table->addRow(array(new CCol(SPACE, 'normal'), S_DISABLED)); } foreach (array(1, 2, 3, 4, 5) as $tr_severity) { $help_table->addRow(array(new CCol(get_severity_description($tr_severity), get_severity_style($tr_severity)), S_ENABLED)); } $help_table->addRow(array(new CCol(SPACE, 'unknown_trigger'), S_UNKNOWN)); if ($_REQUEST['type'] == SHOW_TRIGGERS) { $col = new CCol(SPACE, 'unknown_trigger'); $col->setAttribute('style', 'background-image: url(images/gradients/blink1.gif); ' . 'background-position: top left; background-repeat: repeate;'); $help_table->addRow(array($col, S_5_MIN)); $col = new CCol(SPACE, 'unknown_trigger'); $col->setAttribute('style', 'background-image: url(images/gradients/blink2.gif); ' . 'background-position: top left; background-repeat: repeate;'); $help_table->addRow(array($col, S_15_MIN)); $help_table->addRow(array(new CCol(SPACE), S_NO_TRIGGER)); } else { $help_table->addRow(array(new CCol(SPACE), S_DISABLED . ' ' . S_OR . ' ' . S_NO_TRIGGER)); } $help->setHint($help_table); $over_wdgt = new CWidget(); // Header $url = 'overview.php?fullscreen=' . ($_REQUEST['fullscreen'] ? '0' : '1'); $fs_icon = new CDiv(SPACE, 'fullscreen'); $fs_icon->setAttribute('title', $_REQUEST['fullscreen'] ? S_NORMAL . ' ' . S_VIEW : S_FULLSCREEN); $fs_icon->addAction('onclick', new CScript("javascript: document.location = '" . $url . "';")); $over_wdgt->addHeader(S_OVERVIEW_BIG, array($fs_icon, $help)); // 2nd heder $form_l = new CForm();
function show_history($itemid, $from, $stime, $period) { //$till=date(S_DATE_FORMAT_YMDHMS,time(NULL)-$from*3600); //show_table_header(S_TILL.SPACE.$till.' ( '.zbx_date2age($stime,$stime+$period).' )'); $td = new CCol(get_js_sizeable_graph('graph', 'chart.php?itemid=' . $itemid . url_param($from, false, 'from') . url_param($stime, false, 'stime') . url_param($period, false, 'period'))); $td->setAttribute('align', 'center'); $tr = new CRow($td); $tr->setAttribute('bgcolor', '#dddddd'); $table = new CTable(); $table->setAttribute('width', '100%'); $table->setAttribute('bgcolor', '#cccccc'); $table->setAttribute('cellspacing', '1'); $table->setAttribute('cellpadding', '3'); $table->addRow($tr); $table->show(); }
/** * Create report bar for for "Compare values for multiple periods" * * @return object $reportForm */ function valueComparisonFormForMultiplePeriods() { $config = get_request('config', 1); $title = get_request('title', _('Report 3')); $xlabel = get_request('xlabel', ''); $ylabel = get_request('ylabel', ''); $scaletype = get_request('scaletype', TIMEPERIOD_TYPE_WEEKLY); $avgperiod = get_request('avgperiod', TIMEPERIOD_TYPE_DAILY); $report_timesince = get_request('report_timesince', date(TIMESTAMP_FORMAT_ZERO_TIME, time() - SEC_PER_DAY)); $report_timetill = get_request('report_timetill', date(TIMESTAMP_FORMAT_ZERO_TIME)); $itemId = get_request('itemid', 0); $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'); $reportForm->setAttribute('name', 'zbx_report'); $reportForm->setAttribute('id', 'zbx_report'); if (isset($_REQUEST['report_show']) && $itemId) { $reportForm->addVar('report_show', 'show'); } $reportForm->addVar('config', $config); $reportForm->addVar('report_timesince', date(TIMESTAMP_FORMAT, $report_timesince)); $reportForm->addVar('report_timetill', date(TIMESTAMP_FORMAT, $report_timetill)); $reportForm->addRow(_('Title'), new CTextBox('title', $title, 40)); $reportForm->addRow(_('X label'), new CTextBox('xlabel', $xlabel, 40)); $reportForm->addRow(_('Y label'), new CTextBox('ylabel', $ylabel, 40)); $reportForm->addRow(_('Legend'), new CCheckBox('showlegend', $showlegend, null, 1)); $reportForm->addVar('sortorder', 0); $groupids = get_request('groupids', array()); $group_tb = new CTweenBox($reportForm, 'groupids', $groupids, 10); $options = array('real_hosts' => true, 'output' => 'extend'); $db_groups = API::HostGroup()->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(_('Groups'), $group_tb->Get(_('Selected groups'), _('Other groups'))); $groupid = get_request('groupid', 0); $cmbGroups = new CComboBox('groupid', $groupid, 'submit()'); $cmbGroups->addItem(0, _('All')); foreach ($db_groups as $gnum => $group) { $cmbGroups->addItem($group['groupid'], $group['name']); } $td_groups = new CCol(array(_('Group'), SPACE, $cmbGroups)); $td_groups->setAttribute('style', 'text-align: right;'); $host_tb = new CTweenBox($reportForm, 'hostids', $hostids, 10); $options = array('real_hosts' => true, 'output' => array('hostid', 'name')); if ($groupid > 0) { $options['groupids'] = $groupid; } $db_hosts = API::Host()->get($options); $db_hosts = zbx_toHash($db_hosts, 'hostid'); order_result($db_hosts, 'name'); foreach ($db_hosts as $hnum => $host) { $host_tb->addItem($host['hostid'], $host['name']); } $options = array('real_hosts' => true, 'output' => array('hostid', 'name'), 'hostids' => $hostids); $db_hosts2 = API::Host()->get($options); order_result($db_hosts2, 'name'); foreach ($db_hosts2 as $hnum => $host) { if (!isset($db_hosts[$host['hostid']])) { $host_tb->addItem($host['hostid'], $host['name']); } } $reportForm->addRow(_('Hosts'), $host_tb->Get(_('Selected hosts'), array(_('Other hosts | Group') . SPACE, $cmbGroups))); $reporttimetab = new CTable(null, 'calendar'); $timeSinceRow = createDateSelector('report_timesince', $report_timesince, 'report_timetill'); array_unshift($timeSinceRow, _('From')); $reporttimetab->addRow($timeSinceRow); $timeTillRow = createDateSelector('report_timetill', $report_timetill, 'report_timesince'); array_unshift($timeTillRow, _('Till')); $reporttimetab->addRow($timeTillRow); $reportForm->addRow(_('Period'), $reporttimetab); $scale = new CComboBox('scaletype', $scaletype); $scale->addItem(TIMEPERIOD_TYPE_HOURLY, _('Hourly')); $scale->addItem(TIMEPERIOD_TYPE_DAILY, _('Daily')); $scale->addItem(TIMEPERIOD_TYPE_WEEKLY, _('Weekly')); $scale->addItem(TIMEPERIOD_TYPE_MONTHLY, _('Monthly')); $scale->addItem(TIMEPERIOD_TYPE_YEARLY, _('Yearly')); $reportForm->addRow(_('Scale'), $scale); $avgcmb = new CComboBox('avgperiod', $avgperiod); $avgcmb->addItem(TIMEPERIOD_TYPE_HOURLY, _('Hourly')); $avgcmb->addItem(TIMEPERIOD_TYPE_DAILY, _('Daily')); $avgcmb->addItem(TIMEPERIOD_TYPE_WEEKLY, _('Weekly')); $avgcmb->addItem(TIMEPERIOD_TYPE_MONTHLY, _('Monthly')); $avgcmb->addItem(TIMEPERIOD_TYPE_YEARLY, _('Yearly')); $reportForm->addRow(_('Average by'), $avgcmb); $itemName = ''; if ($itemId) { $itemName = get_item_by_itemid($itemId); $itemName = itemName($itemName); } $itemidVar = new CVar('itemid', $itemId, 'itemid'); $reportForm->addItem($itemidVar); $txtCondVal = new CTextBox('item_name', $itemName, 50, 'yes'); $txtCondVal->setAttribute('id', 'item_name'); $btnSelect = new CButton('btn1', _('Select'), 'return PopUp("popup.php?dstfrm=' . $reportForm->GetName() . '&dstfld1=itemid' . '&dstfld2=item_name' . '&srctbl=items' . '&srcfld1=itemid' . '&srcfld2=name' . '&monitored_hosts=1");', 'T'); $reportForm->addRow(_('Item'), array($txtCondVal, $btnSelect)); $paletteCmb = new CComboBox('palette', $palette); $paletteCmb->addItem(0, _s('Palette #%1$s', 1)); $paletteCmb->addItem(1, _s('Palette #%1$s', 2)); $paletteCmb->addItem(2, _s('Palette #%1$s', 3)); $paletteCmb->addItem(3, _s('Palette #%1$s', 4)); $paletteTypeCmb = new CComboBox('palettetype', $palettetype); $paletteTypeCmb->addItem(0, _('Middle')); $paletteTypeCmb->addItem(1, _('Darken')); $paletteTypeCmb->addItem(2, _('Brighten')); $reportForm->addRow(_('Palette'), array($paletteCmb, $paletteTypeCmb)); $reportForm->addItemToBottomRow(new CSubmit('report_show', _('Show'))); $reset = new CButton('reset', _('Reset')); $reset->setType('reset'); $reportForm->addItemToBottomRow($reset); return $reportForm; }
$value = new CSpan(trigger_value2str($row_event['value']), get_trigger_value_style($row_event['value'])); if ($config['event_ack_enable']) { if ($row_event['acknowledged'] == 1) { $acks_cnt = DBfetch(DBselect('SELECT COUNT(*) as cnt FROM acknowledges WHERE eventid=' . $row_event['eventid'])); $ack = array(new CSpan(S_YES, 'off'), SPACE . '(' . $acks_cnt['cnt'] . SPACE, new CLink(S_SHOW, 'acknow.php?eventid=' . $row_event['eventid'], 'action'), ')'); } else { $ack = new CLink(S_NOT_ACKNOWLEDGED, 'acknow.php?eventid=' . $row_event['eventid'], 'on'); } } $description = expand_trigger_description_by_data(array_merge($row, array('clock' => $row_event['clock'])), ZBX_FLAG_EVENT); $font = new CTag('font', 'yes'); $font->setAttribute('color', '#808080'); $font->addItem(array(' - ', $description)); $description = $font; $description = new CCol($description); $description->setAttribute('style', 'white-space: normal; width: 90%;'); $clock = new CLink(zbx_date2str(S_DATE_FORMAT_YMDHMS, $row_event['clock']), 'tr_events.php?triggerid=' . $row['triggerid'] . '&eventid=' . $row_event['eventid'], 'action'); $table->addRow(array($config['event_ack_enable'] ? $row_event['acknowledged'] == 1 ? SPACE : new CCheckBox('events[' . $row_event['eventid'] . ']', 'no', NULL, $row_event['eventid']) : NULL, new CCol(get_severity_description($row['priority']), get_severity_style($row['priority'], $row_event['value'])), $value, $clock, get_node_name_by_elid($row['triggerid']), $host, $description, $actions, $config['event_ack_enable'] ? new CCol($ack, 'center') : NULL, new CLink($row['comments'] == '' ? S_ADD : S_SHOW, 'tr_comments.php?triggerid=' . $row['triggerid'], 'action'))); $event_limit++; if ($event_limit >= $config['event_show_max']) { break; } } unset($row, $description, $actions); } //----- GO ------ if ($config['event_ack_enable']) { $goBox = new CComboBox('go'); $goBox->addItem('bulkacknowledge', S_BULK_ACKNOWLEDGE); // goButton name is necessary!!! $goButton = new CButton('goButton', S_GO . ' (0)');
$buttonCol = new CCol(new CButton('addJMXInterface', _('Add'), null, 'link_menu'), 'interface-add-control'); $col = new CCol($helpTextWhenDragInterfaceJMX); $col->setAttribute('colspan', 6); $buttonRow = new CRow(array($buttonCol, $col)); $buttonRow->setAttribute('id', 'JMXIterfacesFooter'); $ifTab->addRow($buttonRow); $hostList->addRow(_('JMX interfaces'), new CDiv($ifTab, 'border_dotted objectgroup inlineblock interface-group'), false, null, 'interface-row'); // table for IPMI interfaces with footer $ifTab = new CTable(null, 'formElementTable'); $ifTab->setAttribute('id', 'IPMIInterfaces'); $ifTab->setAttribute('data-type', 'ipmi'); $helpTextWhenDragInterfaceIPMI = new CSpan(_('Drag here to change the type of the interface to "IPMI" type.')); $helpTextWhenDragInterfaceIPMI->addClass('dragHelpText'); $buttonCol = new CCol(new CButton('addIPMIInterface', _('Add'), null, 'link_menu'), 'interface-add-control'); $col = new CCol($helpTextWhenDragInterfaceIPMI); $col->setAttribute('colspan', 6); $buttonRow = new CRow(array($buttonCol, $col)); $buttonRow->setAttribute('id', 'IPMIIterfacesFooter'); $ifTab->addRow($buttonRow); $hostList->addRow(_('IPMI interfaces'), new CDiv($ifTab, 'border_dotted objectgroup inlineblock interface-group'), false, null, 'interface-row'); } else { $interfaces = array(); $existingInterfaceTypes = array(); foreach ($dbHost['interfaces'] as $interface) { $interface['locked'] = true; $existingInterfaceTypes[$interface['type']] = true; $interfaces[$interface['interfaceid']] = $interface; } zbx_add_post_js('hostInterfacesManager.add(' . CJs::encodeJson($interfaces) . ');'); zbx_add_post_js('hostInterfacesManager.disable()'); // table for agent interfaces with footer
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; }
if (isset($ZBX_SERVER_NAME) && !zbx_empty($ZBX_SERVER_NAME)) { $table = new CTable(); $table->addStyle('width: 100%;'); $tableColumn = new CCol(new CSpan($ZBX_SERVER_NAME, 'textcolorstyles')); if (is_null($node_form)) { $tableColumn->addStyle('padding-right: 5px;'); } else { $tableColumn->addStyle('padding-right: 20px; padding-bottom: 2px;'); } $table->addRow(array($tableColumn, $node_form)); $node_form = $table; } // 1st level menu $table = new CTable(null, 'maxwidth'); $r_col = new CCol($node_form, 'right'); $r_col->setAttribute('style', 'line-height: 1.8em;'); $table->addRow(array($menu_table, $r_col)); $page_menu = new CDiv(null, 'textwhite'); $page_menu->setAttribute('id', 'mmenu'); $page_menu->addItem($table); // 2nd level menu $sub_menu_table = new CTable(null, 'sub_menu maxwidth ui-widget-header'); $menu_divs = array(); $menu_selected = false; foreach ($sub_menus as $label => $sub_menu) { $sub_menu_row = array(); foreach ($sub_menu as $id => $sub_page) { if (empty($sub_page['menu_text'])) { $sub_page['menu_text'] = SPACE; } $sub_page['menu_url'] .= '?ddreset=1';
function getEventActionsStatus($eventIds) { if (empty($eventIds)) { return array(); } $actions = array(); $alerts = DBselect('SELECT a.eventid,a.status,COUNT(a.alertid) AS cnt' . ' FROM alerts a' . ' WHERE a.alerttype IN (' . ALERT_TYPE_MESSAGE . ',' . ALERT_TYPE_COMMAND . ')' . ' AND ' . dbConditionInt('a.eventid', $eventIds) . ' GROUP BY eventid,status'); while ($alert = DBfetch($alerts)) { $actions[$alert['eventid']][$alert['status']] = $alert['cnt']; } foreach ($actions as $eventId => $action) { $sendCount = isset($action[ALERT_STATUS_SENT]) ? $action[ALERT_STATUS_SENT] : 0; $notSendCount = isset($action[ALERT_STATUS_NOT_SENT]) ? $action[ALERT_STATUS_NOT_SENT] : 0; $failedCount = isset($action[ALERT_STATUS_FAILED]) ? $action[ALERT_STATUS_FAILED] : 0; // calculate total $mixed = 0; if ($sendCount > 0) { $mixed += ALERT_STATUS_SENT; } if ($failedCount > 0) { $mixed += ALERT_STATUS_FAILED; } // display if ($notSendCount > 0) { $status = new CSpan(_('In progress'), 'orange'); } elseif ($mixed == ALERT_STATUS_SENT) { $status = new CSpan(_('Ok'), 'green'); } elseif ($mixed == ALERT_STATUS_FAILED) { $status = new CSpan(_('Failed'), 'red'); } else { $columnLeft = new CCol($sendCount > 0 ? new CSpan($sendCount, 'green') : SPACE); $columnLeft->setAttribute('width', '10'); $columnRight = new CCol($failedCount > 0 ? new CSpan($failedCount, 'red') : SPACE); $columnRight->setAttribute('width', '10'); $status = new CRow(array($columnLeft, $columnRight)); } $actions[$eventId] = new CTable(' - '); $actions[$eventId]->addRow($status); } return $actions; }
$div_node_tree->addStyle('display: none'); if (!is_null($combo_node_list)) { $node_form->addItem(array(new CSpan(S_CURRENT_NODE, 'textcolorstyles'), $combo_node_list)); } $node_form->addItem($button_show_tree); $node_form->addItem($div_node_tree); unset($combo_node_list); } } // 1st level menu $table = new CTable(); $table->setCellSpacing(0); $table->setCellPadding(0); $table->setAttribute('style', 'width: 100%;'); $r_col = new CCol($node_form); $r_col->setAttribute('align', 'right'); // $r_col->setAttribute('style','text-align: right;'); $table->addRow(array($menu_table, $r_col)); $page_menu = new CDiv(); $page_menu->setAttribute('id', 'mmenu'); $page_menu->addItem($table); //---- // 2nd level menu $sub_menu_table = new CTable(NULL, 'sub_menu'); $sub_menu_table->setCellSpacing(0); $sub_menu_table->setCellPadding(5); $menu_divs = array(); $menu_selected = false; foreach ($sub_menus as $label => $sub_menu) { $sub_menu_row = array(); foreach ($sub_menu as $id => $sub_page) {
function show_messages($bool = TRUE, $okmsg = NULL, $errmsg = NULL) { global $page, $ZBX_MESSAGES; if (!defined('PAGE_HEADER_LOADED')) { return; } if (defined('ZBX_API_REQUEST')) { return; } if (!isset($page['type'])) { $page['type'] = PAGE_TYPE_HTML; } $message = array(); $width = 0; $height = 0; $img_space = null; if (!$bool && !is_null($errmsg)) { $msg = S_CONFIG_ERROR_HEAD . ': ' . $errmsg; } else { if ($bool && !is_null($okmsg)) { $msg = $okmsg; } } $api_errors = CZBXAPI::resetErrors(); if (!empty($api_errors)) { error($api_errors); } if (isset($msg)) { switch ($page['type']) { case PAGE_TYPE_IMAGE: array_push($message, array('text' => $msg, 'color' => !$bool ? array('R' => 255, 'G' => 0, 'B' => 0) : array('R' => 34, 'G' => 51, 'B' => 68), 'font' => 2)); $width = max($width, ImageFontWidth(2) * zbx_strlen($msg) + 1); $height += imagefontheight(2) + 1; break; case PAGE_TYPE_XML: echo htmlspecialchars($msg) . "\n"; break; // case PAGE_TYPE_JS: break; // case PAGE_TYPE_JS: break; case PAGE_TYPE_HTML: default: $msg_tab = new CTable($msg, $bool ? 'msgok' : 'msgerr'); $msg_tab->setCellPadding(0); $msg_tab->setCellSpacing(0); $row = array(); $msg_col = new CCol(bold($msg), 'msg_main msg'); $msg_col->setAttribute('id', 'page_msg'); $row[] = $msg_col; if (isset($ZBX_MESSAGES) && !empty($ZBX_MESSAGES)) { $msg_details = new CDiv(S_DETAILS, 'blacklink'); $msg_details->setAttribute('onclick', "javascript: ShowHide('msg_messages', IE?'block':'table');"); $msg_details->setAttribute('title', S_MAXIMIZE . '/' . S_MINIMIZE); array_unshift($row, new CCol($msg_details, 'clr')); } $msg_tab->addRow($row); $msg_tab->show(); $img_space = new CImg('images/general/tree/zero.gif', 'space', '100', '2'); break; } } if (isset($ZBX_MESSAGES) && !empty($ZBX_MESSAGES)) { if ($page['type'] == PAGE_TYPE_IMAGE) { $msg_font = 2; foreach ($ZBX_MESSAGES as $msg) { if ($msg['type'] == 'error') { array_push($message, array('text' => $msg['message'], 'color' => array('R' => 255, 'G' => 55, 'B' => 55), 'font' => $msg_font)); } else { array_push($message, array('text' => $msg['message'], 'color' => array('R' => 155, 'G' => 155, 'B' => 55), 'font' => $msg_font)); } $width = max($width, imagefontwidth($msg_font) * zbx_strlen($msg['message']) + 1); $height += imagefontheight($msg_font) + 1; } } else { if ($page['type'] == PAGE_TYPE_XML) { foreach ($ZBX_MESSAGES as $msg) { echo '[' . $msg['type'] . '] ' . $msg['message'] . "\n"; } } else { $lst_error = new CList(null, 'messages'); foreach ($ZBX_MESSAGES as $msg) { $lst_error->addItem($msg['message'], $msg['type']); $bool = $bool && 'error' != zbx_strtolower($msg['type']); } //message scroll if needed $msg_show = 6; $msg_count = count($ZBX_MESSAGES); if ($msg_count > $msg_show) { $msg_count = $msg_show; $msg_count = $msg_count * 16; $lst_error->setAttribute('style', 'height: ' . $msg_count . 'px;'); } $tab = new CTable(null, $bool ? 'msgok' : 'msgerr'); $tab->setCellPadding(0); $tab->setCellSpacing(0); $tab->setAttribute('id', 'msg_messages'); $tab->setAttribute('style', 'width: 100%;'); if (isset($msg_tab) && $bool) { $tab->setAttribute('style', 'display: none;'); } $tab->addRow(new CCol($lst_error, 'msg')); $tab->Show(); //--- } } $ZBX_MESSAGES = null; } if (!is_null($img_space)) { print unpack_object($img_space); } if ($page['type'] == PAGE_TYPE_IMAGE && count($message) > 0) { $width += 2; $height += 2; $canvas = imagecreate($width, $height); imagefilledrectangle($canvas, 0, 0, $width, $height, imagecolorallocate($canvas, 255, 255, 255)); foreach ($message as $id => $msg) { $message[$id]['y'] = 1 + (isset($previd) ? $message[$previd]['y'] + $message[$previd]['h'] : 0); $message[$id]['h'] = imagefontheight($msg['font']); imagestring($canvas, $msg['font'], 1, $message[$id]['y'], $msg['text'], imagecolorallocate($canvas, $msg['color']['R'], $msg['color']['G'], $msg['color']['B'])); $previd = $id; } imageOut($canvas); imagedestroy($canvas); } }
function make_favorite_maps() { $table = new CTableInfo(); $fav_sysmaps = get_favorites('web.favorite.sysmapids'); foreach ($fav_sysmaps as $key => $favorite) { $source = $favorite['source']; $sourceid = $favorite['value']; if (!($sysmap = get_sysmap_by_sysmapid($sourceid))) { continue; } if (!sysmap_accessible($sourceid, PERM_READ_ONLY)) { continue; } $link = new CLink(get_node_name_by_elid($sourceid) . $sysmap['name'], 'maps.php?sysmapid=' . $sourceid); $link->setTarget('blank'); $capt = new CSpan($link); $capt->setAttribute('style', 'line-height: 14px; vertical-align: middle;'); $icon = new CLink(new CImg('images/general/chart.png', 'map', 18, 18, 'borderless'), 'maps.php?sysmapid=' . $sourceid . '&fullscreen=1'); $icon->setTarget('blank'); $table->addRow(new CCol(array($icon, SPACE, $capt))); } $td = new CCol(array(new CLink(S_MAPS . ' »', 'maps.php', 'highlight'))); $td->setAttribute('style', 'text-align: right;'); $table->setFooter($td); return $table; }
$details = ''; break; } // action list $actionLinks = array(); if (!empty($mediaType['listOfActions'])) { foreach ($mediaType['listOfActions'] as $action) { $actionLinks[] = new CLink($action['name'], 'actionconf.php?form=update&actionid=' . $action['actionid']); $actionLinks[] = ', '; } array_pop($actionLinks); } else { $actionLinks = '-'; } $actionColumn = new CCol($actionLinks); $actionColumn->setAttribute('style', 'white-space: normal;'); $statusLink = 'media_types.php?go=' . ($mediaType['status'] == MEDIA_TYPE_STATUS_DISABLED ? 'activate' : 'disable') . '&mediatypeids' . SQUAREBRACKETS . '=' . $mediaType['mediatypeid']; $status = MEDIA_TYPE_STATUS_ACTIVE == $mediaType['status'] ? new CLink(_('Enabled'), $statusLink, 'enabled') : new CLink(_('Disabled'), $statusLink, 'disabled'); // append row $mediaTypeTable->addRow(array(new CCheckBox('mediatypeids[' . $mediaType['mediatypeid'] . ']', null, null, $mediaType['mediatypeid']), $this->data['displayNodes'] ? $mediaType['nodename'] : null, new CLink($mediaType['description'], '?form=edit&mediatypeid=' . $mediaType['mediatypeid']), media_type2str($mediaType['typeid']), $status, $actionColumn, $details)); } // create go button $goComboBox = new CComboBox('go'); $goOption = new CComboItem('activate', _('Enable selected')); $goOption->setAttribute('confirm', _('Enable selected media types?')); $goComboBox->addItem($goOption); $goOption = new CComboItem('disable', _('Disable selected')); $goOption->setAttribute('confirm', _('Disable selected media types?')); $goComboBox->addItem($goOption); $goOption = new CComboItem('delete', _('Delete selected')); $goOption->setAttribute('confirm', _('Delete selected media types?'));
$hosts_count = CTemplate::get($params); $overalCount = $hosts_count['rowscount']; $viewCount = count($templates); $header = array(is_show_all_nodes() ? new CCol(S_NODE) : null, new CCol(S_TEMPLATES), new CCol(S_ITEMS), new CCol(S_TRIGGERS), new CCol(S_GRAPHS)); $table = new CTableInfo(); $table->setHeader($header); foreach ($templates as $num => $template) { $templateid = $template['hostid']; $groupid = isset($hostsgroups[$templateid]) ? $hostsgroups[$templateid] : 0; $link = 'groupid=' . $groupid . '&hostid=' . $templateid; $caption = make_decoration($template['host'], $search); $table->addRow(array(get_node_name_by_elid($templateid), new CLink($caption, 'hosts.php?config=3&hostid=' . $templateid), new CLink(S_GO, 'items.php?' . $link), new CLink(S_GO, 'triggers.php?' . $link), new CLink(S_GO, 'graphs.php?' . $link))); } $table->setFooter(new CCol(S_DISPLAYING . SPACE . $viewCount . SPACE . S_OF_SMALL . SPACE . $overalCount . SPACE . S_FOUND_SMALL)); $wdgt_templates = new CWidget('search_templates', $table); $wdgt_templates->addHeader(S_TEMPLATES, SPACE); $right_tab->addRow($wdgt_templates); } //---------------- $td_l = new CCol($left_tab); $td_l->setAttribute('valign', 'top'); $td_r = new CCol($right_tab); $td_r->setAttribute('valign', 'top'); $outer_table = new CTable(); $outer_table->setAttribute('border', 0); $outer_table->setCellPadding(1); $outer_table->setCellSpacing(1); $outer_table->addRow(array($td_l, $td_r)); $search_wdgt->addItem($outer_table); $search_wdgt->show(); include_once 'include/page_footer.php';
if ($result != '-') { $style = $result == 'TRUE' ? 'background-color: #ccf; color: #00f;' : 'background-color: #fcc; color: #f00;'; } $col = new CCol($result); $col->setAttribute('style', $style); $res_table->addRow(new CRow(array($e['list'], $col))); } $result = '-'; if ($allowedTesting && $test) { $result = evalExpressionData($expression, $macrosData, $octet); } $style = 'text-align: center;'; if ($result != '-') { $style = $result == 'TRUE' ? 'background-color: #ccf; color: #00f;' : 'background-color: #fcc; color: #f00;'; } $col = new CCol($result); $col->setAttribute('style', $style); $res_table->setFooter(array($outline, $col), $res_table->headerClass); $frm_test->addRow(_('Result'), $res_table); // action buttons $btn_test = new CSubmit('test_expression', _('Test')); if (!$allowedTesting) { $btn_test->setAttribute('disabled', 'disabled'); } $frm_test->addItemToBottomRow($btn_test); $frm_test->addItemToBottomRow(SPACE); $btn_close = new CButton('close', _('Close'), 'javascript: self.close();'); $frm_test->addItemToBottomRow($btn_close); $frm_test->show(); //------------------------ </FORM> --------------------------- require_once dirname(__FILE__) . '/include/page_footer.php';
private function createFlicker($col1, $col2 = null) { $table = new CTable(null, 'textwhite maxwidth middle flicker'); $table->setCellSpacing(0); $table->setCellPadding(1); if (!is_null($col2)) { $td_r = new CCol($col2, 'flicker_r'); $td_r->setAttribute('align', 'right'); $table->addRow(array(new CCol($col1, 'flicker_l'), $td_r)); } else { $td_c = new CCol($col1, 'flicker_c'); $td_c->setAttribute('align', 'center'); $table->addRow($td_c); } return $table; }
$imageComboBoxForm->addItem(_('Type') . SPACE); $imageComboBoxForm->addItem($imageComboBox); $this->data['widget']->addHeader(_('Images'), $imageComboBoxForm); // form $imageForm = new CForm(); $imageForm->setName('imageForm'); $imageForm->addItem(BR()); $imageTable = new CTable(_('No images found.'), 'header_wide padding_standard'); $count = 0; $imageRow = new CRow(); foreach ($this->data['images'] as $image) { $img = $image['imagetype'] == IMAGE_TYPE_BACKGROUND ? new CLink(new CImg('imgstore.php?width=200&height=200&iconid=' . $image['imageid'], 'no image'), 'image.php?imageid=' . $image['imageid']) : new CImg('imgstore.php?iconid=' . $image['imageid'], 'no image'); $nodeName = $this->data['displayNodes'] ? new CSpan($image['nodename'], 'unknown') : null; $name = new CLink($image['name'], 'adm.images.php?form=update&imageid=' . $image['imageid']); $imgColumn = new CCol(); $imgColumn->setAttribute('align', 'center'); $imgColumn->addItem(array($img, BR(), $nodeName, $name), 'center'); $imageRow->addItem($imgColumn); $count++; if ($count % 4 == 0) { $imageTable->addRow($imageRow); $imageRow = new CRow(); } } if ($count > 0) { while ($count % 4 != 0) { $imageRow->addItem(SPACE); $count++; } $imageTable->addRow($imageRow); }
foreach ($this->data['slides'] as $step => $slides) { $name = ''; if (!empty($slides['screenid'])) { $screen = get_screen_by_screenid($slides['screenid']); if (!empty($screen['name'])) { $name = $screen['name']; } } $delay = new CNumericBox('slides[' . $step . '][delay]', !empty($slides['delay']) ? $slides['delay'] : '', 5, 'no', true, false); $delay->setAttribute('placeholder', _('default')); $removeButton = new CButton('remove_' . $step, _('Remove'), 'javascript: removeSlide(this);', 'link_menu'); $removeButton->setAttribute('remove_slide', $step); $row = new CRow(array(new CSpan(null, 'ui-icon ui-icon-arrowthick-2-n-s move'), new CSpan($i++ . ':', 'rowNum', 'current_slide_' . $step), $name, $delay, $removeButton), 'sortable', 'slides_' . $step); $slideTable->addRow($row); } $addButtonColumn = new CCol(empty($this->data['work_slide']) ? new CButton('add', _('Add'), 'return PopUp("popup.php?srctbl=screens&srcfld1=screenid&dstfrm=' . $slideForm->getName() . '&multiselect=1", 450, 450)', 'link_menu') : null, null, 5); $addButtonColumn->setAttribute('style', 'vertical-align: middle;'); $slideTable->addRow(new CRow($addButtonColumn, null, 'screenListFooter')); $slideFormList->addRow(_('Slides'), new CDiv($slideTable, 'objectgroup inlineblock border_dotted ui-corner-all')); // append tabs to form $slideTab = new CTabView(); $slideTab->addTab('slideTab', _('Slide'), $slideFormList); $slideForm->addItem($slideTab); // append buttons to form if (empty($this->data['slideshowid'])) { $slideForm->addItem(makeFormFooter(new CSubmit('save', _('Save')), new CButtonCancel())); } else { $slideForm->addItem(makeFormFooter(new CSubmit('save', _('Save')), array(new CSubmit('clone', _('Clone')), new CButtonDelete(_('Delete slide show?'), url_param('form') . url_param('slideshowid') . url_param('config')), new CButtonCancel()))); } $slideWidget->addItem($slideForm); return $slideWidget;
// create table $servicesParentTable = new CTableInfo(); $servicesParentTable->setHeader(array(_('Service'), _('Status calculation'), _('Trigger'))); $prefix = null; // root $description = new CLink(_('root'), '#', null, 'javascript: jQuery(\'#parent_name\', window.opener.document).val(' . zbx_jsvalue(_('root')) . '); jQuery(\'#parentname\', window.opener.document).val(' . zbx_jsvalue(_('root')) . '); jQuery(\'#parentid\', window.opener.document).val(' . zbx_jsvalue(0) . '); self.close(); return false;'); $servicesParentTable->addRow(array(array($prefix, $description), _('Note'), '-')); // others foreach ($this->data['db_pservices'] as $db_service) { $description = new CSpan($db_service['name'], 'link'); $description->setAttribute('onclick', 'javascript: jQuery(\'#parent_name\', window.opener.document).val(' . zbx_jsvalue($db_service['name']) . '); jQuery(\'#parentname\', window.opener.document).val(' . zbx_jsvalue($db_service['name']) . '); jQuery(\'#parentid\', window.opener.document).val(' . zbx_jsvalue($db_service['serviceid']) . '); self.close(); return false;'); $servicesParentTable->addRow(array(array($prefix, $description), serviceAlgorythm($db_service['algorithm']), $db_service['trigger'])); } $column = new CCol(new CButton('cancel', _('Cancel'), 'javascript: self.close();')); $column->setAttribute('style', 'text-align:right;'); $servicesParentTable->setFooter($column); // append table to form $servicesParentForm->addItem($servicesParentTable); // append form to widget $servicesParentWidget->addItem($servicesParentForm); return $servicesParentWidget;
function show_messages($bool = true, $okmsg = null, $errmsg = null) { global $page, $ZBX_MESSAGES; if (!defined('PAGE_HEADER_LOADED')) { return null; } if (defined('ZBX_API_REQUEST')) { return null; } if (!isset($page['type'])) { $page['type'] = PAGE_TYPE_HTML; } $imageMessages = array(); if (!$bool && !is_null($errmsg)) { $msg = _('ERROR') . ': ' . $errmsg; } elseif ($bool && !is_null($okmsg)) { $msg = $okmsg; } if (isset($msg)) { switch ($page['type']) { case PAGE_TYPE_IMAGE: // save all of the messages in an array to display them later in an image $imageMessages[] = array('text' => $msg, 'color' => !$bool ? array('R' => 255, 'G' => 0, 'B' => 0) : array('R' => 34, 'G' => 51, 'B' => 68)); break; case PAGE_TYPE_XML: echo htmlspecialchars($msg) . "\n"; break; case PAGE_TYPE_HTML: default: $msg_tab = new CTable($msg, $bool ? 'msgok' : 'msgerr'); $msg_tab->setCellPadding(0); $msg_tab->setCellSpacing(0); $row = array(); $msg_col = new CCol(bold($msg), 'msg_main msg'); $msg_col->setAttribute('id', 'page_msg'); $row[] = $msg_col; if (isset($ZBX_MESSAGES) && !empty($ZBX_MESSAGES)) { $msg_details = new CDiv(_('Details'), 'blacklink'); $msg_details->setAttribute('onclick', 'javascript: showHide("msg_messages", IE ? "block" : "table");'); $msg_details->setAttribute('title', _('Maximize') . '/' . _('Minimize')); array_unshift($row, new CCol($msg_details, 'clr')); } $msg_tab->addRow($row); $msg_tab->show(); break; } } if (isset($ZBX_MESSAGES) && !empty($ZBX_MESSAGES)) { if ($page['type'] == PAGE_TYPE_IMAGE) { foreach ($ZBX_MESSAGES as $msg) { // save all of the messages in an array to display them later in an image if ($msg['type'] == 'error') { $imageMessages[] = array('text' => $msg['message'], 'color' => array('R' => 255, 'G' => 55, 'B' => 55)); } else { $imageMessages[] = array('text' => $msg['message'], 'color' => array('R' => 155, 'G' => 155, 'B' => 55)); } } } elseif ($page['type'] == PAGE_TYPE_XML) { foreach ($ZBX_MESSAGES as $msg) { echo '[' . $msg['type'] . '] ' . $msg['message'] . "\n"; } } else { $lst_error = new CList(null, 'messages'); foreach ($ZBX_MESSAGES as $msg) { $lst_error->addItem($msg['message'], $msg['type']); $bool = $bool && 'error' !== strtolower($msg['type']); } $msg_show = 6; $msg_count = count($ZBX_MESSAGES); if ($msg_count > $msg_show) { $msg_count = $msg_show * 16; $lst_error->setAttribute('style', 'height: ' . $msg_count . 'px;'); } $tab = new CTable(null, $bool ? 'msgok' : 'msgerr'); $tab->setCellPadding(0); $tab->setCellSpacing(0); $tab->setAttribute('id', 'msg_messages'); $tab->setAttribute('style', 'width: 100%;'); if (isset($msg_tab) && $bool) { $tab->setAttribute('style', 'display: none;'); } $tab->addRow(new CCol($lst_error, 'msg')); $tab->show(); } $ZBX_MESSAGES = null; } // draw an image with the messages if ($page['type'] == PAGE_TYPE_IMAGE && count($imageMessages) > 0) { $imageFontSize = 8; // calculate the size of the text $imageWidth = 0; $imageHeight = 0; foreach ($imageMessages as &$msg) { $size = imageTextSize($imageFontSize, 0, $msg['text']); $msg['height'] = $size['height'] - $size['baseline']; // calculate the total size of the image $imageWidth = max($imageWidth, $size['width']); $imageHeight += $size['height'] + 1; } unset($msg); // additional padding $imageWidth += 2; $imageHeight += 2; // create the image $canvas = imagecreate($imageWidth, $imageHeight); imagefilledrectangle($canvas, 0, 0, $imageWidth, $imageHeight, imagecolorallocate($canvas, 255, 255, 255)); // draw each message $y = 1; foreach ($imageMessages as $msg) { $y += $msg['height']; imageText($canvas, $imageFontSize, 0, 1, $y, imagecolorallocate($canvas, $msg['color']['R'], $msg['color']['G'], $msg['color']['B']), $msg['text']); } imageOut($canvas); imagedestroy($canvas); } }