function get_dynamic_chart($dom_graph_id, $img_src, $width = 0) { if (is_int($width) && $width > 0) { $img_src .= url_param($width, false, 'width'); } $result = new CScript(' <script language="JavaScript" type="text/javascript"> <!-- var width = "' . (!(is_int($width) && $width > 0) ? $width : '') . '"; var img_src = "' . $img_src . '"; A_SBOX["' . $dom_graph_id . '"] = new Object; A_SBOX["' . $dom_graph_id . '"].shiftT = 17; A_SBOX["' . $dom_graph_id . '"].shiftL = 10; var ZBX_G_WIDTH; if(width!=""){ if(window.innerWidth) ZBX_G_WIDTH=window.innerWidth; else ZBX_G_WIDTH=document.body.clientWidth; ZBX_G_WIDTH-= 80; ZBX_G_WIDTH+= parseInt(width); width = "&width=" + ZBX_G_WIDTH; } else{ ZBX_G_WIDTH = ' . $width . '; } document.write(\'<img src="\'+img_src + width +\'" alt="chart" id="' . $dom_graph_id . '" />\'); --> </script>'); return $result; }
static function rte_image_editor_search() { $active = url_param('view'); $cls = ''; if ($active == 'shop') { $cls = ' class="active" '; } print '<module type="files/admin" />'; }
function mw_print_stats_on_dashboard() { $active = url_param('view'); $cls = ''; if ($active == 'shop') { // $cls = ' class="active" '; } print ' <module type="site_stats/admin" subtype="graph" /> <module type="site_stats/admin" />'; //print '<microweber module="site_stats" view="admin" />'; }
function mw_print_admin_updates_settings_link() { $active = url_param('view'); $cls = ''; if ($active == 'comments') { $cls = ' class="active" '; } $notif_html = ''; $mname = module_name_encode('updates'); print "<li><a class=\"item-" . $mname . "\" href=\"#option_group=" . $mname . "\">" . _e("Updates", true) . "</a></li>"; //$notif_count = mw()->notifications_manager->get('module=comments&is_read=0&count=1'); /*if ($notif_count > 0) { $notif_html = '<sup class="mw-notif-bubble">' . $notif_count . '</sup>'; }*/ //print '<li' . $cls . '><a href="' . admin_url() . 'view:comments"><span class="ico icomment">' . $notif_html . '</span><span>Comments</span></a></li>'; }
function index() { $is_admin = is_admin(); if ($is_admin == false) { $go = site_url('login'); safe_redirect($go); } $action = url_param('action'); $this->template['functionName'] = strtolower(__FUNCTION__); $this->load->vars($this->template); $layout = CI::view('admin/layout', true, true); if ($action == false) { $primarycontent = CI::view('admin/index', true, true); } else { $primarycontent = CI::view('admin/' . $action, true, true); } $layout = str_ireplace('{content}', $primarycontent, $layout); $layout = CI::model('template')->parseMicrwoberTags($layout); CI::library('output')->set_output($layout); }
function loginas() { $id = url_param('id'); if ($id == false) { exit('Specify id'); } $cur_user = user_id(); if ($cur_user == false) { exit('You need to be logged in as some of the parent users.'); } $other_user = get_user($id); if ($cur_user == $other_user) { redirect('dashboard'); } //var_dump($other_user); if (intval($other_user['parent_id']) == $cur_user) { } else { exit('You need to be logged in as some of the parent users.'); } $user_session['is_logged'] = 'yes'; $user_session['user_id'] = $other_user['id']; CI::library('session')->set_userdata('user_session', $user_session); CI::library('session')->set_userdata('user', $other_user); $back_to = CI::model('core')->getParamFromURL('back_to'); if ($back_to != '') { $back_to = base64_decode($back_to); if (trim($back_to) != '') { header('Location: ' . $back_to); exit; } else { redirect('dashboard'); } } else { redirect('dashboard'); } }
$hostinvent_wdgt->addItem(BR()); $table = new CTableInfo(_('No hosts defined.')); $table->setHeader(array(make_sorting_header($groupFieldTitle === '' ? _('Field') : $groupFieldTitle, 'inventory_field'), make_sorting_header(_('Host count'), 'host_count'))); // to show a report, we will need a host group and a field to aggregate if ($pageFilter->groupsSelected && $groupFieldTitle !== '') { $options = array('output' => array('hostid', 'name'), 'selectInventory' => array($_REQUEST['groupby']), 'withInventory' => true); if ($pageFilter->groupid > 0) { $options['groupids'] = $pageFilter->groupid; } $hosts = API::Host()->get($options); // aggregating data by chosen field value $report = array(); foreach ($hosts as $host) { if ($host['inventory'][$_REQUEST['groupby']] !== '') { $lowerValue = zbx_strtolower($host['inventory'][$_REQUEST['groupby']]); if (!isset($report[$lowerValue])) { $report[$lowerValue] = array('inventory_field' => $host['inventory'][$_REQUEST['groupby']], 'host_count' => 1); } else { $report[$lowerValue]['host_count'] += 1; } } } order_result($report, getPageSortField('host_count'), getPageSortOrder()); foreach ($report as $rep) { $row = array(new CSpan($rep['inventory_field'], 'pre'), new CLink($rep['host_count'], 'hostinventories.php?filter_field=' . $_REQUEST['groupby'] . '&filter_field_value=' . urlencode($rep['inventory_field']) . '&filter_set=1&filter_exact=1' . url_param('groupid'))); $table->addRow($row); } } $hostinvent_wdgt->addItem($table); $hostinvent_wdgt->show(); require_once dirname(__FILE__) . '/include/page_footer.php';
if (isset($service) && isset($_REQUEST['showgraph'])) { $table = new CTable(null, 'chart'); $table->AddRow(new CImg('chart5.php?serviceid=' . $service['serviceid'] . url_param('path'))); $table->Show(); } else { $query = 'SELECT DISTINCT s.serviceid, sl.servicedownid, sl_p.serviceupid as serviceupid, s.triggerid, ' . ' s.name as caption, s.algorithm, t.description, t.expression, s.sortorder, sl.linkid, s.showsla, s.goodsla, s.status ' . ' FROM services s ' . ' LEFT JOIN triggers t ON s.triggerid = t.triggerid ' . ' LEFT JOIN services_links sl ON s.serviceid = sl.serviceupid and NOT(sl.soft=0) ' . ' LEFT JOIN services_links sl_p ON s.serviceid = sl_p.servicedownid and sl_p.soft=0 ' . ' WHERE ' . DBin_node('s.serviceid') . ' AND (t.triggerid IS NULL OR ' . DBcondition('t.triggerid', $available_triggers) . ') ' . ' ORDER BY s.sortorder, sl_p.serviceupid, s.serviceid'; $result = DBSelect($query); $services = array(); $row = array('id' => 0, 'serviceid' => 0, 'serviceupid' => 0, 'caption' => S_ROOT_SMALL, 'status' => SPACE, 'reason' => SPACE, 'sla' => SPACE, 'sla2' => SPACE, 'graph' => SPACE, 'linkid' => ''); $services[0] = $row; $now = time(); while ($row = DBFetch($result)) { $row['id'] = $row['serviceid']; empty($row['serviceupid']) ? $row['serviceupid'] = '0' : ''; empty($row['description']) ? $row['description'] = 'None' : ''; $row['graph'] = new CLink(S_SHOW, "srv_status.php?serviceid=" . $row["serviceid"] . "&showgraph=1" . url_param('path'), "action"); if (isset($row["triggerid"]) && !empty($row["triggerid"])) { $url = new CLink(expand_trigger_description($row['triggerid']), 'events.php?triggerid=' . $row['triggerid']); $row['caption'] = array($row['caption'] . ' [', $url, ']'); } if ($row["status"] == 0 || isset($service) && bccomp($service["serviceid"], $row["serviceid"]) == 0) { $row['reason'] = '-'; } else { $row['reason'] = '-'; $result2 = DBselect('SELECT s.triggerid,s.serviceid ' . ' FROM services s, triggers t ' . ' WHERE s.status>0 ' . ' AND s.triggerid is not NULL ' . ' AND t.triggerid=s.triggerid ' . ' AND ' . DBcondition('t.triggerid', $available_triggers) . ' AND ' . DBin_node('s.serviceid') . ' ORDER BY s.status DESC, t.description'); while ($row2 = DBfetch($result2)) { if (is_string($row['reason']) && $row['reason'] == '-') { $row['reason'] = new CList(null, "itservices"); } if (does_service_depend_on_the_service($row["serviceid"], $row2["serviceid"])) { $row['reason']->AddItem(new CLink(expand_trigger_description($row2["triggerid"]), "events.php?triggerid=" . $row2["triggerid"]));
$itemFormList = new CFormList('itemFormList'); // append type to form list $copyTypeComboBox = new CComboBox('copy_type', $this->data['copy_type'], 'submit()'); $copyTypeComboBox->addItem(0, _('Hosts')); $copyTypeComboBox->addItem(1, _('Host groups')); $itemFormList->addRow(_('Target type'), $copyTypeComboBox); // append targets to form list $targetList = array(); if ($this->data['copy_type'] == 0) { $groupComboBox = new CComboBox('copy_groupid', $this->data['copy_groupid'], 'submit()'); foreach ($this->data['groups'] as $group) { $groupComboBox->addItem($group['groupid'], $group['name']); } $itemFormList->addRow(_('Group'), $groupComboBox); foreach ($this->data['hosts'] as $host) { array_push($targetList, array(new CCheckBox('copy_targetid[' . $host['hostid'] . ']', uint_in_array($host['hostid'], $this->data['copy_targetid']), null, $host['hostid']), SPACE, $host['name'], BR())); } } else { foreach ($this->data['groups'] as $group) { array_push($targetList, array(new CCheckBox('copy_targetid[' . $group['groupid'] . ']', uint_in_array($group['groupid'], $this->data['copy_targetid']), null, $group['groupid']), SPACE, $group['name'], BR())); } } $itemFormList->addRow(_('Target'), !empty($targetList) ? $targetList : SPACE); // append tabs to form $itemTab = new CTabView(); $itemTab->addTab('itemTab', count($this->data['group_itemid']) . ' ' . _('elements copy to ...'), $itemFormList); $itemForm->addItem($itemTab); // append buttons to form $itemForm->addItem(makeFormFooter(new CSubmit('copy', _('Copy')), new CButtonCancel(url_param('groupid') . url_param('hostid') . url_param('config')))); $itemWidget->addItem($itemForm); return $itemWidget;
$imageForm = new CForm('post', null, 'multipart/form-data'); $imageForm->setName('imageForm'); $imageForm->addVar('form', $this->data['form']); if (isset($this->data['imageid'])) { $imageForm->addVar('imageid', $this->data['imageid']); } $imageForm->addVar('imagetype', $this->data['imagetype']); // append form list $imageFormList = new CFormList('imageFormList'); $nameTextBox = new CTextBox('name', $this->data['imagename'], 64, false, 64); $nameTextBox->attr('autofocus', 'autofocus'); $imageFormList->addRow(_('Name'), $nameTextBox); $imageFormList->addRow(_('Upload'), new CFile('image')); if (isset($this->data['imageid'])) { if ($this->data['imagetype'] == IMAGE_TYPE_BACKGROUND) { $imageFormList->addRow(_('Image'), new CLink(new CImg('imgstore.php?width=200&height=200&iconid=' . $this->data['imageid'], 'no image'), 'image.php?imageid=' . $this->data['imageid'])); } else { $imageFormList->addRow(_('Image'), new CImg('imgstore.php?iconid=' . $this->data['imageid'], 'no image', null)); } } // append tab $imageTab = new CTabView(); $imageTab->addTab('imageTab', $this->data['imagetype'] == IMAGE_TYPE_ICON ? _('Icon') : _('Background'), $imageFormList); $imageForm->addItem($imageTab); // append buttons if (isset($this->data['imageid'])) { $imageForm->addItem(makeFormFooter(new CSubmit('update', _('Update')), array(new CButtonDelete(_('Delete selected image?'), url_param('form') . url_param('imageid')), new CButtonCancel()))); } else { $imageForm->addItem(makeFormFooter(new CSubmit('add', _('Add')), new CButtonCancel())); } return $imageForm;
if (!isset($params['id'])) { return; } require_once dirname(__FILE__) . DS . 'functions.php'; if (get_option('enable_comments', 'comments') == 'y') { $engine = get_option('engine', 'comments'); if ($engine == 'disqus') { return include dirname(__FILE__) . DS . 'engines/disqus.php'; } elseif ($engine == 'facebook') { return include dirname(__FILE__) . DS . 'engines/facebook.php'; } $login_required = get_option('user_must_be_logged', 'comments') == 'y'; $from_related_posts = false; $paging_param = $params['id'] . '_page'; $current_page_from_url = url_param($paging_param); $data = $params; if (isset($params['content-id'])) { $data['rel_type'] = 'content'; $data['rel_id'] = $params['content-id']; } elseif (isset($params['content_id'])) { $data['rel_type'] = 'content'; $data['rel_id'] = $params['content_id']; } if (!isset($params['rel_type'])) { $data['rel_type'] = 'content'; } if (!isset($data['rel_id']) and isset($params['content-id'])) { $data['rel_id'] = intval($params['content-id']); $data['rel_type'] = 'content'; }
function make_latest_data() { global $USER_DETAILS; $available_hosts = get_accessible_hosts_by_user($USER_DETAILS, PERM_READ_ONLY, PERM_RES_IDS_ARRAY); while ($db_app = DBfetch($db_applications)) { $db_items = DBselect('SELECT DISTINCT i.* ' . ' FROM items i,items_applications ia' . ' WHERE ia.applicationid=' . $db_app['applicationid'] . ' AND i.itemid=ia.itemid' . ' AND i.status=' . ITEM_STATUS_ACTIVE . order_by('i.description,i.itemid,i.lastclock')); $app_rows = array(); $item_cnt = 0; while ($db_item = DBfetch($db_items)) { $description = item_description($db_item); if (!zbx_empty($_REQUEST['select']) && !zbx_stristr($description, $_REQUEST['select'])) { continue; } ++$item_cnt; if (!uint_in_array($db_app['applicationid'], $_REQUEST['applications']) && !isset($show_all_apps)) { continue; } if (isset($db_item['lastclock'])) { $lastclock = date(S_DATE_FORMAT_YMDHMS, $db_item['lastclock']); } else { $lastclock = new CCol('-', 'center'); } $lastvalue = format_lastvalue($db_item); if (isset($db_item['lastvalue']) && isset($db_item['prevvalue']) && $db_item['value_type'] == 0 && $db_item['lastvalue'] - $db_item['prevvalue'] != 0) { if ($db_item['lastvalue'] - $db_item['prevvalue'] < 0) { $change = convert_units($db_item['lastvalue'] - $db_item['prevvalue'], $db_item['units']); } else { $change = '+' . convert_units($db_item['lastvalue'] - $db_item['prevvalue'], $db_item['units']); } $change = nbsp($change); } else { $change = new CCol('-', 'center'); } if ($db_item['value_type'] == ITEM_VALUE_TYPE_FLOAT || $db_item['value_type'] == ITEM_VALUE_TYPE_UINT64) { $actions = new CLink(S_GRAPH, 'history.php?action=showgraph&itemid=' . $db_item['itemid'], 'action'); } else { $actions = new CLink(S_HISTORY, 'history.php?action=showvalues&period=3600&itemid=' . $db_item['itemid'], 'action'); } array_push($app_rows, new CRow(array(is_show_all_nodes() ? SPACE : null, $_REQUEST['hostid'] > 0 ? NULL : SPACE, str_repeat(SPACE, 6) . $description, $lastclock, new CCol($lastvalue, $lastvalue == '-' ? 'center' : null), $change, $actions))); } if ($item_cnt > 0) { if (uint_in_array($db_app['applicationid'], $_REQUEST['applications']) || isset($show_all_apps)) { $link = new CLink(new CImg('images/general/opened.gif'), '?close=1&applicationid=' . $db_app['applicationid'] . url_param('groupid') . url_param('hostid') . url_param('applications') . url_param('select')); } else { $link = new CLink(new CImg('images/general/closed.gif'), '?open=1&applicationid=' . $db_app['applicationid'] . url_param('groupid') . url_param('hostid') . url_param('applications') . url_param('select')); } $col = new CCol(array($link, SPACE, bold($db_app['name']), SPACE . '(' . $item_cnt . SPACE . S_ITEMS . ')')); $col->setColSpan(5); $table->ShowRow(array(get_node_name_by_elid($db_app['hostid']), $_REQUEST['hostid'] > 0 ? NULL : $db_app['host'], $col)); $any_app_exist = true; foreach ($app_rows as $row) { $table->ShowRow($row); } } } }
$hosts[$num]['pr_serialno_a'] = $host['inventory']['serialno_a']; $hosts[$num]['pr_tag'] = $host['inventory']['tag']; $hosts[$num]['pr_macaddress_a'] = $host['inventory']['macaddress_a']; // if we are filtering by inventory field if (!empty($_REQUEST['filter_field']) && !empty($_REQUEST['filter_field_value'])) { // must we filter exactly or using a substring (both are case insensitive) $match = $_REQUEST['filter_exact'] ? zbx_strtolower($hosts[$num]['inventory'][$_REQUEST['filter_field']]) === zbx_strtolower($_REQUEST['filter_field_value']) : zbx_strpos(zbx_strtolower($hosts[$num]['inventory'][$_REQUEST['filter_field']]), zbx_strtolower($_REQUEST['filter_field_value'])) !== false; if (!$match) { unset($hosts[$num]); } } } order_result($hosts, getPageSortField('name'), getPageSortOrder()); $paging = getPagingLine($hosts); foreach ($hosts as $host) { $host_groups = array(); foreach ($host['groups'] as $group) { $host_groups[] = $group['name']; } natsort($host_groups); $host_groups = implode(', ', $host_groups); $row = array(get_node_name_by_elid($host['hostid']), new CLink($host['name'], '?hostid=' . $host['hostid'] . url_param('groupid')), $host_groups, zbx_str2links($host['inventory']['name']), zbx_str2links($host['inventory']['type']), zbx_str2links($host['inventory']['os']), zbx_str2links($host['inventory']['serialno_a']), zbx_str2links($host['inventory']['tag']), zbx_str2links($host['inventory']['macaddress_a'])); $table->addRow($row); } } } $table = array($paging, $table, $paging); $hostinvent_wdgt->addItem($table); } $hostinvent_wdgt->show(); require_once dirname(__FILE__) . '/include/page_footer.php';
$controls = (new CList())->addItem([_('Group') . SPACE, $pageFilter->getGroupsCB()])->addItem([_('Grouping by') . SPACE, $inventoryFieldsComboBox]); $hostinvent_wdgt->setControls((new CForm('get'))->addItem($controls)); $table = (new CTableInfo())->setHeader([make_sorting_header($groupFieldTitle === '' ? _('Field') : $groupFieldTitle, 'inventory_field', $sortField, $sortOrder), make_sorting_header(_('Host count'), 'host_count', $sortField, $sortOrder)]); // to show a report, we will need a host group and a field to aggregate if ($pageFilter->groupsSelected && $groupFieldTitle !== '') { $options = ['output' => ['hostid', 'name'], 'selectInventory' => [$_REQUEST['groupby']], 'withInventory' => true]; if ($pageFilter->groupid > 0) { $options['groupids'] = $pageFilter->groupid; } $hosts = API::Host()->get($options); // aggregating data by chosen field value $report = []; foreach ($hosts as $host) { if ($host['inventory'][$_REQUEST['groupby']] !== '') { // same names with different letter casing are considered the same $lowerValue = mb_strtolower($host['inventory'][$_REQUEST['groupby']]); if (!isset($report[$lowerValue])) { $report[$lowerValue] = ['inventory_field' => $host['inventory'][$_REQUEST['groupby']], 'host_count' => 1]; } else { $report[$lowerValue]['host_count'] += 1; } } } order_result($report, $sortField, $sortOrder); foreach ($report as $rep) { $table->addRow([zbx_str2links($rep['inventory_field']), new CLink($rep['host_count'], 'hostinventories.php?filter_field=' . $_REQUEST['groupby'] . '&filter_field_value=' . urlencode($rep['inventory_field']) . '&filter_set=1&filter_exact=1' . url_param('groupid'))]); } } $hostinvent_wdgt->addItem($table); $hostinvent_wdgt->show(); require_once dirname(__FILE__) . '/include/page_footer.php';
?> ", function () { data = {}; data.id = id $.post("<?php print api_link(); ?> delete_user", data, function () { _mw_admin_users_manage(); }); }); } </script> <?php $mw_notif = url_param('mw_notif'); if ($mw_notif != false) { $mw_notif = mw()->notifications_manager->read($mw_notif); } mw()->notifications_manager->mark_as_read('users'); ?> <?php if (is_array($mw_notif) and isset($mw_notif['rel_id'])) { ?> <script type="text/javascript"> $(document).ready(function () { mw.url.windowHashParam('edit-user', '<?php print $mw_notif['rel_id']; ?> '); _mw_admin_user_edit();
} $frmHostG->addRow(S_HOSTS, $cmbHosts->Get(S_HOSTS . SPACE . S_IN, array(S_OTHER . SPACE . S_HOSTS . SPACE . '|' . SPACE . S_GROUP . SPACE, $cmbGroups))); $frmHostG->addItemToBottomRow(new CButton('save', S_SAVE)); if ($groupid > 0) { $frmHostG->addItemToBottomRow(SPACE); $frmHostG->addItemToBottomRow(new CButton('clone', S_CLONE)); $frmHostG->addItemToBottomRow(SPACE); $dltButton = new CButtonDelete('Delete selected group?', url_param('form') . url_param('config') . url_param('groupid')); $dlt_groups = getDeletableHostGroups($_REQUEST['groupid']); if (empty($dlt_groups)) { $dltButton->setAttribute('disabled', 'disabled'); } $frmHostG->addItemToBottomRow($dltButton); } $frmHostG->addItemToBottomRow(SPACE); $frmHostG->addItemToBottomRow(new CButtonCancel(url_param('config'))); $frmHostG->show(); } else { $config = select_config(); $numrows = new CSpan(null, 'info'); $numrows->setAttribute('name', 'numrows'); $header = get_table_header(array(S_HOST_GROUPS_BIG, new CSpan(SPACE . SPACE . '|' . SPACE . SPACE, 'divider'), S_FOUND . ': ', $numrows)); show_table_header($header); $form = new CForm('hostgroups.php'); $form->setName('form_groups'); $table = new CTableInfo(S_NO_HOST_GROUPS_DEFINED); $table->setHeader(array(new CCheckBox('all_groups', NULL, "checkAll('" . $form->GetName() . "','all_groups','groups');"), make_sorting_link(S_NAME, 'g.name'), ' # ', S_MEMBERS)); $groups = CHostGroup::get(array('order' => 'name', 'editable' => 1, 'extendoutput' => 1, 'select_hosts' => 1)); foreach ($groups as $groupid => $group) { $tpl_count = 0; $host_count = 0;
$passwordField = array($passwordButton, $passwordBox); } else { $passwordField = new CPassBox('password', '', ZBX_TEXTBOX_SMALL_SIZE); } // append password field to form list if ($this->data['type'] == MEDIA_TYPE_JABBER) { $mediaTypeFormList->addRow(_('Jabber identifier'), new CTextBox('username', $this->data['username'], ZBX_TEXTBOX_STANDARD_SIZE)); $mediaTypeFormList->addRow(_('Password'), $passwordField); } else { $mediaTypeFormList->addRow(_('Username'), new CTextBox('username', $this->data['username'], ZBX_TEXTBOX_STANDARD_SIZE)); $mediaTypeFormList->addRow(_('Password'), $passwordField); $limitCb = new CComboBox('exec_path', $this->data['exec_path']); $limitCb->addItems(array(EZ_TEXTING_LIMIT_USA => _('USA (160 characters)'), EZ_TEXTING_LIMIT_CANADA => _('Canada (136 characters)'))); $mediaTypeFormList->addRow(_('Message text limit'), $limitCb); } } $mediaTypeFormList->addRow(_('Enabled'), new CCheckBox('status', MEDIA_TYPE_STATUS_ACTIVE == $this->data['status'], null, MEDIA_TYPE_STATUS_ACTIVE)); // append form list to tab $mediaTypeTab = new CTabView(); $mediaTypeTab->addTab('mediaTypeTab', _('Media type'), $mediaTypeFormList); // append tab to form $mediaTypeForm->addItem($mediaTypeTab); // append buttons to form if (!empty($this->data['mediatypeid'])) { $mediaTypeForm->addItem(makeFormFooter(new CSubmit('update', _('Update')), array(new CButtonDelete(_('Delete selected media type?'), url_param('form') . url_param('mediatypeid') . url_param('config')), new CButtonCancel(url_param('config'))))); } else { $mediaTypeForm->addItem(makeFormFooter(new CSubmit('add', _('Add')), new CButtonCancel(url_param('config')))); } // append form to widget $mediaTypeWidget->addItem($mediaTypeForm); return $mediaTypeWidget;
} array_push($app_rows, new CRow(array(is_show_subnodes() ? $db_host['item_cnt'] ? SPACE : get_node_name_by_elid($db_item['itemid']) : null, $_REQUEST['hostid'] ? NULL : ($db_host['item_cnt'] ? SPACE : $db_item['host']), str_repeat(SPACE, 6) . $description, $lastclock, new CCol($lastvalue), $change, $actions))); } unset($app_rows); unset($db_host); foreach ($db_hosts as $hostid => $db_host) { if (!isset($tab_rows[$hostid])) { continue; } $app_rows = $tab_rows[$hostid]; if (uint_in_array(0, $_REQUEST['applications']) || isset($show_all_apps)) { $url = '?close=1&applicationid=0' . url_param('groupid') . url_param('hostid') . url_param('applications') . url_param('select'); $link = new CLink(new CImg('images/general/opened.gif'), $url); // $link = new CLink(new CImg('images/general/opened.gif'),$url,null,"javascript: return updater.onetime_update('".ZBX_PAGE_MAIN_HAT."','".$url."');"); } else { $url = '?open=1&applicationid=0' . url_param('groupid') . url_param('hostid') . url_param('applications') . url_param('select'); $link = new CLink(new CImg('images/general/closed.gif'), $url); // $link = new CLink(new CImg('images/general/closed.gif'),$url,null,"javascript: return updater.onetime_update('".ZBX_PAGE_MAIN_HAT."','".$url."');"); } $col = new CCol(array($link, SPACE, bold(S_MINUS_OTHER_MINUS), SPACE . '(' . $db_host['item_cnt'] . SPACE . S_ITEMS . ')')); $col->SetColSpan(5); $table->AddRow(array(get_node_name_by_elid($db_host['hostid']), $_REQUEST['hostid'] > 0 ? NULL : $db_host['host'], $col)); foreach ($app_rows as $row) { $table->AddRow($row); } } $p_elements[] = $table; /* // Refresh tab $refresh_tab = array( array('id' => ZBX_PAGE_MAIN_HAT,
$interfaceTable->addRow(array(_('IP address'), _('DNS name'), _('Connect to'), _('Port'))); $connectByComboBox = new CRadioButtonList('interface[useip]', $this->data['interface']['useip']); $connectByComboBox->addValue(_('IP'), 1); $connectByComboBox->addValue(_('DNS'), 0); $connectByComboBox->useJQueryStyle(); $interfaceTable->addRow(array(new CTextBox('interface[ip]', $this->data['interface']['ip'], ZBX_TEXTBOX_SMALL_SIZE, 'no', 64), new CTextBox('interface[dns]', $this->data['interface']['dns'], ZBX_TEXTBOX_SMALL_SIZE, 'no', 64), $connectByComboBox, new CTextBox('interface[port]', $this->data['interface']['port'], 18, 'no', 64))); $proxyFormList->addRow(_('Interface'), new CDiv($interfaceTable, 'objectgroup inlineblock border_dotted ui-corner-all')); } // append hosts to form list $hostsTweenBox = new CTweenBox($proxyForm, 'hosts', $this->data['hosts']); foreach ($this->data['dbHosts'] as $host) { // show only normal hosts, and discovered hosts monitored by the current proxy // for new proxies display only normal hosts if ($this->data['proxyid'] && idcmp($this->data['proxyid'], $host['proxy_hostid']) || $host['flags'] == ZBX_FLAG_DISCOVERY_NORMAL) { $hostsTweenBox->addItem($host['hostid'], $host['name'], null, empty($host['proxy_hostid']) || !empty($this->data['proxyid']) && bccomp($host['proxy_hostid'], $this->data['proxyid']) == 0 && $host['flags'] == ZBX_FLAG_DISCOVERY_NORMAL); } } $proxyFormList->addRow(_('Hosts'), $hostsTweenBox->get(_('Proxy hosts'), _('Other hosts'))); // append tabs to form $proxyTab = new CTabView(); $proxyTab->addTab('proxyTab', _('Proxy'), $proxyFormList); $proxyForm->addItem($proxyTab); // append buttons to form if (!empty($this->data['proxyid'])) { $proxyForm->addItem(makeFormFooter(new CSubmit('save', _('Save')), array(new CSubmit('clone', _('Clone')), new CButtonDelete(_('Delete proxy?'), url_param('form') . url_param('proxyid')), new CButtonCancel()))); } else { $proxyForm->addItem(makeFormFooter(new CSubmit('save', _('Save')), new CButtonCancel())); } // append form to widget $proxyWidget->addItem($proxyForm); return $proxyWidget;
$users_id = array(); $db_users = DBselect('SELECT DISTINCT u.alias,u.userid ' . ' FROM users u,users_groups ug ' . ' WHERE u.userid=ug.userid ' . ' AND ug.usrgrpid=' . $row['usrgrpid'] . ' ORDER BY u.alias'); while ($db_user = DBfetch($db_users)) { if (!empty($users)) { $users[$db_user['userid']][] = ', '; } else { $users[$db_user['userid']] = array(); } $users[$db_user['userid']][] = new Clink($db_user['alias'], 'users.php?form=update&config=0&userid=' . $db_user['userid'] . '#form'); } $gui_access = user_auth_type2str($row['gui_access']); $users_status = $row['users_status'] == GROUP_STATUS_ENABLED ? S_ENABLED : S_DISABLED; if (granted2update_group($row['usrgrpid'])) { $next_gui_auth = $row['gui_access'] + 1 > GROUP_GUI_ACCESS_DISABLED ? GROUP_GUI_ACCESS_SYSTEM : $row['gui_access'] + 1; $gui_access = new CLink($gui_access, 'users.php?form=update' . '&set_gui_access=' . $next_gui_auth . '&usrgrpid=' . $row['usrgrpid'] . url_param('config'), $row['gui_access'] == GROUP_GUI_ACCESS_DISABLED ? 'orange' : 'enabled'); $users_status = new CLink($users_status, 'users.php?form=update' . '&set_users_status=' . ($row['users_status'] == GROUP_STATUS_ENABLED ? GROUP_STATUS_DISABLED : GROUP_STATUS_ENABLED) . '&usrgrpid=' . $row['usrgrpid'] . url_param('config'), $row['users_status'] == GROUP_STATUS_ENABLED ? 'enabled' : 'disabled'); } else { $gui_access = new CSpan($gui_access, $row['gui_access'] == GROUP_GUI_ACCESS_DISABLED ? 'orange' : 'green'); $users_status = new CSpan($users_status, $row['users_status'] == GROUP_STATUS_ENABLED ? 'green' : 'red'); } $table->addRow(array($users_status, $gui_access, array(new CCheckBox('group_groupid[' . $row['usrgrpid'] . ']', NULL, NULL, $row['usrgrpid']), $alias = new CLink($row['name'], 'users.php?form=update' . url_param('config') . '&usrgrpid=' . $row['usrgrpid'] . '#form', 'action')), new CCol($users, 'wraptext'))); $row_count++; } $table->SetFooter(new CCol(new CButtonQMessage('delete_selected', S_DELETE_SELECTED, S_DELETE_SELECTED_GROUPS_Q))); $form->AddItem($table); $form->Show(); } } } zbx_add_post_js('insert_in_element("numrows","' . $row_count . '");'); include_once 'include/page_footer.php';
$actionForm = (new CForm())->setName('actionForm'); // create table $actionTable = (new CTableInfo())->setHeader([(new CColHeader((new CCheckBox('all_items'))->onClick("checkAll('" . $actionForm->getName() . "', 'all_items', 'g_actionid');")))->addClass(ZBX_STYLE_CELL_WIDTH), make_sorting_header(_('Name'), 'name', $this->data['sort'], $this->data['sortorder']), _('Conditions'), _('Operations'), make_sorting_header(_('Status'), 'status', $this->data['sort'], $this->data['sortorder'])]); if ($this->data['actions']) { $actionConditionStringValues = actionConditionValueToString($this->data['actions'], $this->data['config']); $actionOperationDescriptions = getActionOperationDescriptions($this->data['actions']); foreach ($this->data['actions'] as $aIdx => $action) { $conditions = []; $operations = []; order_result($action['filter']['conditions'], 'conditiontype', ZBX_SORT_DOWN); foreach ($action['filter']['conditions'] as $cIdx => $condition) { $conditions[] = getConditionDescription($condition['conditiontype'], $condition['operator'], $actionConditionStringValues[$aIdx][$cIdx]); $conditions[] = BR(); } sortOperations($data['eventsource'], $action['operations']); foreach ($action['operations'] as $oIdx => $operation) { $operations[] = $actionOperationDescriptions[$aIdx][$oIdx]; } if ($action['status'] == ACTION_STATUS_DISABLED) { $status = (new CLink(_('Disabled'), 'actionconf.php?action=action.massenable&g_actionid[]=' . $action['actionid'] . url_param('eventsource')))->addClass(ZBX_STYLE_LINK_ACTION)->addClass(ZBX_STYLE_RED)->addSID(); } else { $status = (new CLink(_('Enabled'), 'actionconf.php?action=action.massdisable&g_actionid[]=' . $action['actionid'] . url_param('eventsource')))->addClass(ZBX_STYLE_LINK_ACTION)->addClass(ZBX_STYLE_GREEN)->addSID(); } $actionTable->addRow([new CCheckBox('g_actionid[' . $action['actionid'] . ']', $action['actionid']), new CLink($action['name'], 'actionconf.php?form=update&actionid=' . $action['actionid']), $conditions, $operations, $status]); } } // append table to form $actionForm->addItem([$actionTable, $this->data['paging'], new CActionButtonList('action', 'g_actionid', ['action.massenable' => ['name' => _('Enable'), 'confirm' => _('Enable selected actions?')], 'action.massdisable' => ['name' => _('Disable'), 'confirm' => _('Disable selected actions?')], 'action.massdelete' => ['name' => _('Delete'), 'confirm' => _('Delete selected actions?')]])]); // append form to widget $widget->addItem($actionForm); return $widget;
} elseif ($pf['M'] == PARAM_TYPE_COUNTS) { $expressionForm->addVar('paramtype', PARAM_TYPE_COUNTS); $paramTypeElement = SPACE . _('Count'); } } else { $expressionForm->addVar('paramtype', PARAM_TYPE_SECONDS); $paramTypeElement = SPACE . _('Seconds'); } } if ($pid == 1 && (substr($this->data['expr_type'], 0, 3) != 'str' || substr($this->data['expr_type'], 0, 6) == 'strlen') && substr($this->data['expr_type'], 0, 6) != 'regexp' && substr($this->data['expr_type'], 0, 7) != 'iregexp') { $paramTypeElement = SPACE . _('Seconds'); } $expressionFormList->addRow($pf['C'] . ' ', array(new CNumericBox('param[' . $pid . ']', $paramValue, 10, $paramIsReadonly), $paramTypeElement)); } else { $expressionFormList->addRow($pf['C'], new CTextBox('param[' . $pid . ']', $paramValue, 30)); $expressionForm->addVar('paramtype', PARAM_TYPE_SECONDS); } } } else { $expressionForm->addVar('paramtype', PARAM_TYPE_SECONDS); $expressionForm->addVar('param', 0); } $expressionFormList->addRow('N', new CTextBox('value', $this->data['value'], 10)); // append tabs to form $expressionTab = new CTabView(); $expressionTab->addTab('expressionTab', _('Trigger expression condition'), $expressionFormList); $expressionForm->addItem($expressionTab); // append buttons to form $expressionForm->addItem(makeFormFooter(array(new CSubmit('insert', _('Insert'))), array(new CButtonCancel(url_param('parent_discoveryid') . url_param('dstfrm') . url_param('dstfld1'))))); $expressionWidget->addItem($expressionForm); return $expressionWidget;
$exactComboBox->addItem('1', _('exactly')); $filterTable->addRow(array(array(array(bold(_('Field')), SPACE, $inventoryFieldsComboBox), array($exactComboBox, new CTextBox('filter_field_value', $this->data['filterFieldValue'], 20)))), 'host-inventories'); $filter = new CSubmit('filter_set', _('Filter')); $filter->useJQueryStyle('main'); $reset = new CSubmit('filter_rst', _('Reset')); $reset->useJQueryStyle(); $divButtons = new CDiv(array($filter, SPACE, $reset)); $divButtons->setAttribute('style', 'padding: 4px 0px;'); $footerCol = new CCol($divButtons, 'controls'); $filterTable->addRow($footerCol); $filterForm = new CForm('get'); $filterForm->setAttribute('name', 'zbx_filter'); $filterForm->setAttribute('id', 'zbx_filter'); $filterForm->addItem($filterTable); $hostInventoryWidget->addFlicker($filterForm, CProfile::get('web.hostinventories.filter.state', 0)); $hostInventoryWidget->addHeaderRowNumber(); $table = new CTableInfo(_('No hosts found.')); $table->setHeader(array(make_sorting_header(_('Host'), 'name', $this->data['sort'], $this->data['sortorder']), _('Group'), make_sorting_header(_('Name'), 'pr_name', $this->data['sort'], $this->data['sortorder']), make_sorting_header(_('Type'), 'pr_type', $this->data['sort'], $this->data['sortorder']), make_sorting_header(_('OS'), 'pr_os', $this->data['sort'], $this->data['sortorder']), make_sorting_header(_('Serial number A'), 'pr_serialno_a', $this->data['sort'], $this->data['sortorder']), make_sorting_header(_('Tag'), 'pr_tag', $this->data['sort'], $this->data['sortorder']), make_sorting_header(_('MAC address A'), 'pr_macaddress_a', $this->data['sort'], $this->data['sortorder']))); foreach ($this->data['hosts'] as $host) { $hostGroups = array(); foreach ($host['groups'] as $group) { $hostGroups[] = $group['name']; } natsort($hostGroups); $hostGroups = implode(', ', $hostGroups); $row = array(new CLink($host['name'], '?hostid=' . $host['hostid'] . url_param('groupid'), $host['status'] == HOST_STATUS_NOT_MONITORED ? 'not-monitored' : ''), $hostGroups, zbx_str2links($host['inventory']['name']), zbx_str2links($host['inventory']['type']), zbx_str2links($host['inventory']['os']), zbx_str2links($host['inventory']['serialno_a']), zbx_str2links($host['inventory']['tag']), zbx_str2links($host['inventory']['macaddress_a'])); $table->addRow($row); } $table = array($this->data['paging'], $table, $this->data['paging']); $hostInventoryWidget->addItem($table); return $hostInventoryWidget;
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;
<a href="javascript:;" class="mw-icon-off pull-right"></a> <a href="<?php print $past_page; ?>?editmode=y" class="mw-ui-btn mw-ui-btn-invert pull-right"><span class="mw-icon-live"></span><?php _e("Live Edit"); ?></a> </div>*/ if (is_admin()) { ?> <div id="mw-admin-container"> <div class="mw-ui-row main-admin-row"> <div class="mw-ui-col main-bar-column"> <div id="main-bar" class="scroll-height-exception-master"> <?php $view = url_param('view'); ?> <?php $action = url_param('action'); ?> <a href="<?php print admin_url(); ?> " id="main-bar-mw-icon" class="scroll-height-exception <?php if ($view == 'dashboard' or url_current() == admin_url() or url_current() == rtrim(admin_url(), '/')) { print 'active'; } ?> "> <?php if (mw()->ui->admin_logo != false) { ?> <img src="<?php print mw()->ui->admin_logo;
} } if (PAGE_TYPE_JS == $page['type'] || PAGE_TYPE_HTML_BLOCK == $page['type']) { exit; } //-------- if (!check_right_on_trigger_by_triggerid(PERM_READ_ONLY, $_REQUEST["triggerid"])) { access_deny(); } $trigger_data = DBfetch(DBselect('SELECT h.host, t.* ' . ' FROM hosts h, items i, functions f, triggers t ' . ' WHERE i.itemid=f.itemid ' . ' AND f.triggerid=t.triggerid ' . ' AND t.triggerid=' . $_REQUEST["triggerid"] . ' AND h.hostid=i.hostid ' . ' AND ' . DBin_node('t.triggerid'))); $p_elements = array(); //Header $trigger_data['exp_expr'] = explode_exp($trigger_data["expression"], 1); $trigger_data['exp_desc'] = expand_trigger_description_by_data($trigger_data); $text = array(S_EVENTS_BIG . ': "' . $trigger_data['exp_desc'] . '"'); $url = '?fullscreen=' . ($_REQUEST['fullscreen'] ? '0' : '1') . url_param('triggerid') . url_param('eventid'); $fs_icon = new CDiv(SPACE, 'fullscreen'); $fs_icon->addOption('title', $_REQUEST['fullscreen'] ? S_NORMAL . ' ' . S_VIEW : S_FULLSCREEN); $fs_icon->addAction('onclick', new CScript("javascript: document.location = '" . $url . "';")); //------- $left_tab = new CTable(); $left_tab->setCellPadding(3); $left_tab->setCellSpacing(3); $left_tab->addOption('border', 0); $left_tab->addRow(create_hat(S_EVENT . SPACE . S_SOURCE . SPACE . S_DETAILS, make_trigger_details($_REQUEST['triggerid'], $trigger_data), null, 'hat_triggerdetails')); $left_tab->addRow(create_hat(S_EVENT_DETAILS, make_event_details($_REQUEST['eventid']), null, 'hat_eventdetails')); $right_tab = new CTable(); $right_tab->setCellPadding(3); $right_tab->setCellSpacing(3); $right_tab->addOption('border', 0); $right_tab->addRow(create_hat(S_ACKNOWLEDGES, make_acktab_by_eventid($_REQUEST['eventid']), null, 'hat_eventack', get_profile('web.tr_events.hats.hat_eventack.state', 1)));
function index() { $url = url(); $cache_id = "js_api_" . md5($url); $cache_group = 'global/blocks'; $edit = $this->template['edit']; if (!$edit) { $edit = url_param('edit'); if ($edit) { $this->template['edit'] = true; } } $editmode = CI::library('session')->userdata('editmode'); if ($editmode == true) { $edit = true; } if ($edit == true) { $cache_group = 'global/blocks/edit'; } //$cache_content = CI::model ( 'core' )->cacheGetContentAndDecode ( $cache_id, $cache_group ); if ($cache_content != false) { //CI::library ( 'output' )->set_output ( $cache_content ); } else { //header ( 'Content-type: application/javascript' ); $load_extra_libs = false; $files = readDirIntoArray(APPPATH . 'controllers/api/js/', 'files'); //$layout = $layout . "\n\n\n // File: _php.default.min.js \n\n" . $this->load->file ( APPPATH . 'controllers/api/js/' . '_php.default.min.js', true ); $layout = $layout . "\n\n" . $this->load->file(APPPATH . 'controllers/api/js_dist/' . 'jquery.min.js', true); if (isset($_SERVER['HTTP_REFERER']) and $_SERVER['HTTP_REFERER'] != '') { $url = urldecode($_SERVER['HTTP_REFERER']); if (eregi("admin", $url)) { //preg_match ( "'(\?¦&)q=(.*?)(&¦$)'si", " $url ", $keywords ); $load_extra_libs = true; $in_admin = true; } } $and_ui = url_param('ui'); if ($and_ui) { } else { $and_ui = false; } $no_mw_edit = url_param('no_mw_edit'); if ($no_mw_edit) { } else { $no_mw_edit = false; } if ($editmode == true or $load_extra_libs == true or $and_ui == true) { $layout = $layout . "\n\n" . $this->load->file(APPPATH . 'controllers/api/js_dist/' . 'jquery-ui-1.8.12.custom.min.js', true); //$apicss = '<link rel="stylesheet" href="' . ADMIN_STATIC_FILES_URL . 'css/api.css" type="text/css" media="screen" />'; } $layout = $layout . "\n\n" . $this->load->file(APPPATH . 'controllers/api/js_dist/' . 'jquery.form.js', true); $layout = $layout . "\n\n" . $this->load->file(APPPATH . 'controllers/api/js_dist/' . 'jquery.embedly.min.js', true); $layout = $layout . "\n\n" . $this->load->file(APPPATH . 'controllers/api/js_dist/' . 'jquery_plugins.js', true); $layout = $layout . "\n\n" . $this->load->file(APPPATH . 'controllers/api/js_dist/' . 'rangy-core.js', true); $layout = $layout . "\n\n" . $this->load->file(APPPATH . 'controllers/api/js_dist/' . 'rangy-cssclassapplier.js', true); $layout = $layout . "\n\n" . $this->load->file(APPPATH . 'controllers/api/js_dist/' . 'jquery.cookie.js', true); $layout = $layout . "\n\n\n // File: _mw.js \n\n" . $this->load->file(APPPATH . 'controllers/api/js/' . '_mw.js', true); $ajax = isAjax(); if ($ajax == false) { if ($edit == true and $in_admin == false and $no_mw_edit == false) { $layout = $layout . "\n\n\n // File: _mw_edit.js \n\n" . $this->load->file(APPPATH . 'controllers/api/js/' . '_mw_edit.js', true); } if ($editmode == true or $load_extra_libs == true) { $layout = $layout . "\n\n" . $this->load->file(APPPATH . 'controllers/api/js/' . '_mw_extra.js', true); } } $layout = $layout . "\n\n\n // File: utils.js \n\n" . $this->load->file(APPPATH . 'controllers/api/js/' . 'utils.js', true); foreach ($files as $file) { if (substr($file, -2) == 'js') { if ($file != '_mw.js' and $file != 'utils.js' and $file != '_mw_edit.js') { $this->load->vars($this->template); $layout = $layout . "\n\n\n // File: {$file} \n\n" . $this->load->file(APPPATH . 'controllers/api/js/' . $file, true); } } } $layout = CI::model('content')->applyGlobalTemplateReplaceables($layout); //$layout = $layout . $apicss; CI::library('output')->set_output($layout); CI::model('core')->cacheWriteAndEncode($layout, $cache_id, $cache_group); } //var_dump ($content_filename_pre, $files ); }
$params['load_list'] = '0'; } $data['list_id'] = $params['load_list']; } if (isset($params['keyword'])) { $data['keyword'] = $params['keyword']; } if (isset($params['for_module'])) { $data['module_name'] = $params['for_module']; } $custom_fields = array(); $data_paging = $data; $data_paging['page_count'] = 1; $data_paging = get_form_entires($data_paging); if (url_param('current_page') != false) { $data['current_page'] = url_param('current_page'); } $custom_fields = array(); $data = get_form_entires($data); if (is_array($data)) { foreach ($data as $item) { if (isset($item['custom_fields'])) { foreach ($item['custom_fields'] as $k => $value) { $custom_fields[$k] = $value; } } } } ?> <table id="table_data_<?php
require_once dirname(__FILE__) . '/include/services.inc.php'; $page['title'] = _('IT services'); $page['file'] = 'srv_status.php'; $page['hist_arg'] = array(); define('ZBX_PAGE_DO_REFRESH', 1); require_once dirname(__FILE__) . '/include/page_header.php'; $periods = array('today' => _('Today'), 'week' => _('This week'), 'month' => _('This month'), 'year' => _('This year'), 24 => _('Last 24 hours'), 24 * 7 => _('Last 7 days'), 24 * 30 => _('Last 30 days'), 24 * DAY_IN_YEAR => _('Last 365 days')); // VAR TYPE OPTIONAL FLAGS VALIDATION EXCEPTION $fields = array('serviceid' => array(T_ZBX_INT, O_OPT, P_SYS | P_NZERO, DB_ID, null), 'showgraph' => array(T_ZBX_INT, O_OPT, P_SYS, IN('1'), 'isset({serviceid})'), 'period' => array(T_ZBX_STR, O_OPT, P_SYS, IN('"' . implode('","', array_keys($periods)) . '"'), null), 'fullscreen' => array(T_ZBX_INT, O_OPT, P_SYS, IN('0,1'), null)); check_fields($fields); if (isset($_REQUEST['serviceid']) && isset($_REQUEST['showgraph'])) { $service = API::Service()->get(array('output' => array('serviceid'), 'serviceids' => getRequest('serviceid'))); $service = reset($service); if ($service) { $table = new CTable(null, 'chart'); $table->addRow(new CImg('chart5.php?serviceid=' . $service['serviceid'] . url_param('path'))); $table->show(); } else { access_deny(); } } else { $period = getRequest('period', 7 * 24); $period_end = time(); switch ($period) { case 'today': $period_start = mktime(0, 0, 0, date('n'), date('j'), date('Y')); break; case 'week': $period_start = strtotime('last sunday'); break; case 'month':
$operationConditionValueComboBox->addItem(0, _('Not Ack')); $operationConditionValueComboBox->addItem(1, _('Ack')); $rowCondition[] = $operationConditionValueComboBox; } $newOperationConditionTable->addRow($rowCondition); $newOperationConditionFooter = array(new CSubmit('add_opcondition', _('Add'), null, 'link_menu'), SPACE . SPACE, new CSubmit('cancel_new_opcondition', _('Cancel'), null, 'link_menu')); $newOperationsTable->addRow(array(_('Operation condition'), new CDiv(array($newOperationConditionTable, $newOperationConditionFooter), 'objectgroup inlineblock border_dotted ui-corner-all'))); } $footer = array(new CSubmit('add_operation', $this->data['new_operation']['action'] == 'update' ? _('Update') : _('Add'), null, 'link_menu'), SPACE . SPACE, new CSubmit('cancel_new_operation', _('Cancel'), null, 'link_menu')); $operationFormList->addRow(_('Operation details'), new CDiv(array($newOperationsTable, $footer), 'objectgroup inlineblock border_dotted ui-corner-all')); } // append tabs to form $actionTabs = new CTabView(); if (!isset($_REQUEST['form_refresh'])) { $actionTabs->setSelected(0); } $actionTabs->addTab('actionTab', _('Action'), $actionFormList); $actionTabs->addTab('conditionTab', _('Conditions'), $conditionFormList); $actionTabs->addTab('operationTab', _('Operations'), $operationFormList); $actionForm->addItem($actionTabs); // append buttons to form $others = array(); if (!empty($this->data['actionid'])) { $others[] = new CButton('clone', _('Clone')); $others[] = new CButtonDelete(_('Delete current action?'), url_param('form') . url_param('eventsource') . url_param('actionid')); } $others[] = new CButtonCancel(url_param('actiontype')); $actionForm->addItem(makeFormFooter(new CSubmit('save', _('Save')), $others)); // append form to widget $actionWidget->addItem($actionForm); return $actionWidget;