当前位置: 首页>>代码示例>>PHP>>正文


PHP CSpan::setAttribute方法代码示例

本文整理汇总了PHP中CSpan::setAttribute方法的典型用法代码示例。如果您正苦于以下问题:PHP CSpan::setAttribute方法的具体用法?PHP CSpan::setAttribute怎么用?PHP CSpan::setAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CSpan的用法示例。


在下文中一共展示了CSpan::setAttribute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: CSpan

 // }}} DEPENDENCIES
 $tr_desc = new CSpan($description);
 // host JS menu {{{
 $hosts_list = array();
 foreach ($trigger['hosts'] as $trigger_host) {
     $host = $hosts[$trigger_host['hostid']];
     $hosts_span = new CDiv(null, 'floatleft');
     // fetch scripts for the host JS menu
     $menuScripts = array();
     if (isset($scripts_by_hosts[$trigger_host['hostid']])) {
         foreach ($scripts_by_hosts[$trigger_host['hostid']] as $script) {
             $menuScripts[] = array('scriptid' => $script['scriptid'], 'confirmation' => $script['confirmation'], 'name' => $script['name']);
         }
     }
     $hosts_name = new CSpan($trigger_host['name'], 'link_menu menu-host');
     $hosts_name->setAttribute('data-menu', array('scripts' => $menuScripts, 'hostid' => $trigger_host['hostid'], 'hasScreens' => (bool) $host['screens'], 'hasInventory' => (bool) $host['inventory']));
     $hosts_span->addItem($hosts_name);
     // add maintenance icon with hint if host is in maintenance
     if ($trigger_host['maintenance_status']) {
         $mntIco = new CDiv(null, 'icon-maintenance-inline');
         $maintenances = API::Maintenance()->get(array('maintenanceids' => $trigger_host['maintenanceid'], 'output' => API_OUTPUT_EXTEND, 'limit' => 1));
         if ($maintenance = reset($maintenances)) {
             $hint = $maintenance['name'] . ' [' . ($trigger_host['maintenance_type'] ? _('Maintenance without data collection') : _('Maintenance with data collection')) . ']';
             if (isset($maintenance['description'])) {
                 // double quotes mandatory
                 $hint .= "\n" . $maintenance['description'];
             }
             $mntIco->setHint($hint);
             $mntIco->addClass('pointer');
         }
         $hosts_span->addItem($mntIco);
开发者ID:quanta-computing,项目名称:debian-packages,代码行数:31,代码来源:tr_status.php

示例2: redirect

     $menus .= "['" . S_LATEST_DATA . "',\"javascript: redirect('latest.php?hostid=" . $trigger_host['hostid'] . "')\", null,{'outer' : ['pum_o_item'],'inner' : ['pum_i_item']}],";
     $menus = rtrim($menus, ',');
     $menus = 'show_popup_menu(event,[' . $menus . '],180);';
     $maint_span = null;
     if ($trigger_host['maintenance_status']) {
         $text = $trigger_host['maintenance_type'] ? S_NO_DATA_MAINTENANCE : S_NORMAL_MAINTENANCE;
         $text = ' [' . $text . ']';
         $maint_span = new CSpan($text, 'orange pointer');
         $maintenanceOptions = array('maintenanceids' => $trigger_host['maintenanceid'], 'output' => API_OUTPUT_EXTEND);
         $maintenances = CMaintenance::get($maintenanceOptions);
         $maintenance = reset($maintenances);
         $maint_hint = new CSpan($maintenance['name'] . ($maintenance['description'] == '' ? '' : ': ' . $maintenance['description']));
         $maint_span->setHint($maint_hint);
     }
     $hosts_span = new CSpan($trigger_host['host'], 'link_menu');
     $hosts_span->setAttribute('onclick', 'javascript: ' . $menus);
     $hosts_list[] = $hosts_span;
     $hosts_list[] = $maint_span;
     $hosts_list[] = ', ';
 }
 array_pop($hosts_list);
 $host = new CCol($hosts_list);
 $host->addStyle('white-space: normal;');
 // }}} host JS menu
 $status = new CSpan(trigger_value2str($trigger['value']), get_trigger_value_style($trigger['value']));
 if (time() - $trigger['lastchange'] < TRIGGER_BLINK_PERIOD) {
     $status->setAttribute('name', 'blink');
 }
 $lastchange = new CLink(zbx_date2str(S_DATE_FORMAT_YMDHMS, $trigger['lastchange']), 'events.php?triggerid=' . $trigger['triggerid']);
 //.'&stime='.date('YmdHis', $trigger['lastchange']
 if ($config['event_ack_enable']) {
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:31,代码来源:tr_status.php

示例3: array

    $groupids = get_favorites('web.dashconf.groups.groupids');
    $groupids = zbx_objectValues($groupids, 'value');
    $groupids = zbx_toHash($groupids);
    $grpswitch = CProfile::get('web.dashconf.groups.grpswitch', 0);
    $maintenance = CProfile::get('web.dashconf.hosts.maintenance', 1);
    $extAck = CProfile::get('web.dashconf.events.extAck', 0);
    $severity = CProfile::get('web.dashconf.triggers.severity', '0;1;2;3;4;5');
    $severity = zbx_empty($severity) ? array() : explode(';', $severity);
}
$dashForm->addVar('filterEnable', $filterEnable);
if ($filterEnable) {
    $cbFilter = new CSpan(S_ENABLED, 'green underline pointer');
    $cbFilter->setAttribute('onclick', "create_var('" . $dashForm->getName() . "', 'filterEnable', 0, true);");
} else {
    $cbFilter = new CSpan(S_DISABLED, 'red underline pointer');
    $cbFilter->setAttribute('onclick', "\$('dashform').enable(); create_var('" . $dashForm->getName() . "', 'filterEnable', 1, true);");
}
$dashForm->addRow(S_DASHBOARD_FILTER, $cbFilter);
$dashForm->addVar('groupids', $groupids);
$cmbGroups = new CComboBox('grpswitch', $grpswitch, 'submit();');
$cmbGroups->addItem(0, S_ALL_S);
$cmbGroups->addItem(1, S_SELECTED);
if (!$filterEnable) {
    $cmbGroups->setAttribute('disabled', 'disabled');
}
$dashForm->addRow(S_HOST_GROUPS, $cmbGroups);
if ($grpswitch == 1) {
    $options = array('nodeids' => get_current_nodeid(true), 'groupids' => $groupids, 'output' => API_OUTPUT_EXTEND);
    $groups = CHostGroup::get($options);
    order_result($groups, 'name');
    $lstGroups = new CListBox('del_groups[]', null, 15);
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:31,代码来源:dashconf.php

示例4: getItemFilterForm

function getItemFilterForm(&$items)
{
    $filter_groupId = $_REQUEST['filter_groupid'];
    $filter_hostId = $_REQUEST['filter_hostid'];
    $filter_application = $_REQUEST['filter_application'];
    $filter_name = $_REQUEST['filter_name'];
    $filter_type = $_REQUEST['filter_type'];
    $filter_key = $_REQUEST['filter_key'];
    $filter_snmp_community = $_REQUEST['filter_snmp_community'];
    $filter_snmpv3_securityname = $_REQUEST['filter_snmpv3_securityname'];
    $filter_snmp_oid = $_REQUEST['filter_snmp_oid'];
    $filter_port = $_REQUEST['filter_port'];
    $filter_value_type = $_REQUEST['filter_value_type'];
    $filter_data_type = $_REQUEST['filter_data_type'];
    $filter_delay = $_REQUEST['filter_delay'];
    $filter_history = $_REQUEST['filter_history'];
    $filter_trends = $_REQUEST['filter_trends'];
    $filter_status = $_REQUEST['filter_status'];
    $filter_state = $_REQUEST['filter_state'];
    $filter_templated_items = $_REQUEST['filter_templated_items'];
    $filter_with_triggers = $_REQUEST['filter_with_triggers'];
    $subfilter_hosts = $_REQUEST['subfilter_hosts'];
    $subfilter_apps = $_REQUEST['subfilter_apps'];
    $subfilter_types = $_REQUEST['subfilter_types'];
    $subfilter_value_types = $_REQUEST['subfilter_value_types'];
    $subfilter_status = $_REQUEST['subfilter_status'];
    $subfilter_state = $_REQUEST['subfilter_state'];
    $subfilter_templated_items = $_REQUEST['subfilter_templated_items'];
    $subfilter_with_triggers = $_REQUEST['subfilter_with_triggers'];
    $subfilter_history = $_REQUEST['subfilter_history'];
    $subfilter_trends = $_REQUEST['subfilter_trends'];
    $subfilter_interval = $_REQUEST['subfilter_interval'];
    $form = new CForm('get');
    $form->setAttribute('name', 'zbx_filter');
    $form->setAttribute('id', 'zbx_filter');
    $form->addVar('subfilter_hosts', $subfilter_hosts);
    $form->addVar('subfilter_apps', $subfilter_apps);
    $form->addVar('subfilter_types', $subfilter_types);
    $form->addVar('subfilter_value_types', $subfilter_value_types);
    $form->addVar('subfilter_status', $subfilter_status);
    $form->addVar('subfilter_state', $subfilter_state);
    $form->addVar('subfilter_templated_items', $subfilter_templated_items);
    $form->addVar('subfilter_with_triggers', $subfilter_with_triggers);
    $form->addVar('subfilter_history', $subfilter_history);
    $form->addVar('subfilter_trends', $subfilter_trends);
    $form->addVar('subfilter_interval', $subfilter_interval);
    // type select
    $fTypeVisibility = array();
    $cmbType = new CComboBox('filter_type', $filter_type);
    $cmbType->setAttribute('id', 'filter_type');
    $cmbType->addItem(-1, _('all'));
    foreach (array('filter_delay_label', 'filter_delay') as $vItem) {
        zbx_subarray_push($fTypeVisibility, -1, $vItem);
    }
    $itemTypes = item_type2str();
    unset($itemTypes[ITEM_TYPE_HTTPTEST]);
    // httptest items are only for internal zabbix logic
    $cmbType->addItems($itemTypes);
    foreach ($itemTypes as $typeNum => $typeLabel) {
        if ($typeNum != ITEM_TYPE_TRAPPER) {
            zbx_subarray_push($fTypeVisibility, $typeNum, 'filter_delay_label');
            zbx_subarray_push($fTypeVisibility, $typeNum, 'filter_delay');
        }
        switch ($typeNum) {
            case ITEM_TYPE_SNMPV1:
            case ITEM_TYPE_SNMPV2C:
                $snmp_types = array('filter_snmp_community_label', 'filter_snmp_community', 'filter_snmp_oid_label', 'filter_snmp_oid', 'filter_port_label', 'filter_port');
                foreach ($snmp_types as $vItem) {
                    zbx_subarray_push($fTypeVisibility, $typeNum, $vItem);
                }
                break;
            case ITEM_TYPE_SNMPV3:
                foreach (array('filter_snmpv3_securityname_label', 'filter_snmpv3_securityname', 'filter_snmp_oid_label', 'filter_snmp_oid', 'filter_port_label', 'filter_port') as $vItem) {
                    zbx_subarray_push($fTypeVisibility, $typeNum, $vItem);
                }
                break;
        }
    }
    zbx_add_post_js("var filterTypeSwitcher = new CViewSwitcher('filter_type', 'change', " . zbx_jsvalue($fTypeVisibility, true) . ');');
    // type of information select
    $fVTypeVisibility = array();
    $cmbValType = new CComboBox('filter_value_type', $filter_value_type);
    $cmbValType->addItem(-1, _('all'));
    $cmbValType->addItem(ITEM_VALUE_TYPE_UINT64, _('Numeric (unsigned)'));
    $cmbValType->addItem(ITEM_VALUE_TYPE_FLOAT, _('Numeric (float)'));
    $cmbValType->addItem(ITEM_VALUE_TYPE_STR, _('Character'));
    $cmbValType->addItem(ITEM_VALUE_TYPE_LOG, _('Log'));
    $cmbValType->addItem(ITEM_VALUE_TYPE_TEXT, _('Text'));
    foreach (array('filter_data_type_label', 'filter_data_type') as $vItem) {
        zbx_subarray_push($fVTypeVisibility, ITEM_VALUE_TYPE_UINT64, $vItem);
    }
    zbx_add_post_js("var filterValueTypeSwitcher = new CViewSwitcher('filter_value_type', 'change', " . zbx_jsvalue($fVTypeVisibility, true) . ');');
    // status select
    $cmbStatus = new CComboBox('filter_status', $filter_status);
    $cmbStatus->addItem(-1, _('all'));
    foreach (array(ITEM_STATUS_ACTIVE, ITEM_STATUS_DISABLED) as $status) {
        $cmbStatus->addItem($status, item_status2str($status));
    }
    // state select
    $cmbState = new CComboBox('filter_state', $filter_state);
//.........这里部分代码省略.........
开发者ID:omidmt,项目名称:zabbix-greenplum,代码行数:101,代码来源:forms.inc.php

示例5: buildExpressionHtmlTree

/**
 * Builds expression html tree
 *
 * @param array $expressionTree output of getExpressionTree() function
 * @param array $next           parameter only for recursive call; should be empty array
 * @param int $letterNum        parameter only for recursive call; should be 0
 * @param int $level            parameter only for recursive call
 * @param string $operand       parameter only for recursive call
 *
 * @return bool                 returns true if element is found, false - otherwise
 */
function buildExpressionHtmlTree(array $expressionTree, array &$next, &$letterNum, $level = 0, $operand = null)
{
    $treeList = array();
    $outline = '';
    end($expressionTree);
    $lastKey = key($expressionTree);
    foreach ($expressionTree as $key => $element) {
        switch ($element['type']) {
            case 'operand':
                $next[$level] = $key != $lastKey;
                $expr = expressionLevelDraw($next, $level);
                $expr[] = SPACE;
                $expr[] = italic($element['operand'] == '&' ? _('AND') : _('OR'));
                $levelDetails = array('list' => $expr, 'id' => $element['id'], 'expression' => array('value' => $element['expression']));
                $levelErrors = expressionHighLevelErrors($element['expression']);
                if (count($levelErrors) > 0) {
                    $levelDetails['expression']['levelErrors'] = $levelErrors;
                }
                $treeList[] = $levelDetails;
                list($subOutline, $subTreeList) = buildExpressionHtmlTree($element['elements'], $next, $letterNum, $level + 1, $element['operand']);
                $treeList = array_merge($treeList, $subTreeList);
                $outline .= $level == 0 ? $subOutline : '(' . $subOutline . ')';
                if ($operand !== null && $next[$level]) {
                    $outline .= ' ' . $operand . ' ';
                }
                break;
            case 'expression':
                $next[$level] = $key != $lastKey;
                $letter = num2letter($letterNum++);
                $outline .= $letter;
                if ($operand !== null && $next[$level]) {
                    $outline .= ' ' . $operand . ' ';
                }
                if (defined('NO_LINK_IN_TESTING')) {
                    $url = new CSpan($element['expression']);
                } else {
                    $expressionId = 'expr_' . $element['id'];
                    $url = new CSpan($element['expression'], 'link');
                    $url->setAttribute('id', $expressionId);
                    $url->setAttribute('onclick', 'javascript: copy_expression("' . $expressionId . '");');
                }
                $expr = expressionLevelDraw($next, $level);
                $expr[] = SPACE;
                $expr[] = bold($letter);
                $expr[] = SPACE;
                $expr[] = $url;
                $levelDetails = array('list' => $expr, 'id' => $element['id'], 'expression' => array('value' => $element['expression']));
                $levelErrors = expressionHighLevelErrors($element['expression']);
                if (count($levelErrors) > 0) {
                    $levelDetails['expression']['levelErrors'] = $levelErrors;
                }
                $treeList[] = $levelDetails;
                break;
        }
    }
    return array($outline, $treeList);
}
开发者ID:SandipSingh14,项目名称:Zabbix_,代码行数:68,代码来源:triggers.inc.php

示例6: isset

foreach ($this->data['action']['filter']['conditions'] as $condition) {
    if (!isset($condition['conditiontype'])) {
        $condition['conditiontype'] = 0;
    }
    if (!isset($condition['operator'])) {
        $condition['operator'] = 0;
    }
    if (!isset($condition['value'])) {
        $condition['value'] = '';
    }
    if (!str_in_array($condition['conditiontype'], $this->data['allowedConditions'])) {
        continue;
    }
    $label = isset($condition['formulaid']) ? $condition['formulaid'] : num2letter($i);
    $labelSpan = new CSpan($label, 'label');
    $labelSpan->setAttribute('data-conditiontype', $condition['conditiontype']);
    $labelSpan->setAttribute('data-formulaid', $label);
    $conditionTable->addRow(array($labelSpan, get_condition_desc($condition['conditiontype'], $condition['operator'], $condition['value']), array(new CButton('remove', _('Remove'), 'javascript: removeCondition(' . $i . ');', 'link_menu'), new CVar('conditions[' . $i . ']', $condition)), new CVar('conditions[' . $i . '][formulaid]', $label)), null, 'conditions_' . $i);
    $i++;
}
$formula = new CTextBox('formula', $this->data['action']['filter']['formula'], ZBX_TEXTBOX_STANDARD_SIZE);
$formula->attr('id', 'formula');
$formula->attr('placeholder', 'A or (B and C) &hellip;');
if ($this->data['action']['filter']['evaltype'] != CONDITION_EVAL_TYPE_EXPRESSION) {
    $formula->addClass('hidden');
}
$calculationTypeComboBox = new CComboBox('evaltype', $this->data['action']['filter']['evaltype'], 'processTypeOfCalculation()');
$calculationTypeComboBox->addItem(CONDITION_EVAL_TYPE_AND_OR, _('And/Or'));
$calculationTypeComboBox->addItem(CONDITION_EVAL_TYPE_AND, _('And'));
$calculationTypeComboBox->addItem(CONDITION_EVAL_TYPE_OR, _('Or'));
$calculationTypeComboBox->addItem(CONDITION_EVAL_TYPE_EXPRESSION, _('Custom expression'));
开发者ID:TonywalkerCN,项目名称:Zabbix,代码行数:31,代码来源:configuration.action.edit.php

示例7: CLink

        }
    } else {
        if (empty($apps)) {
            $url = '?open=1&applicationid=0';
        } else {
            if (isset($apps[0])) {
                $url = '?close=1' . url_param($tmp_apps, false, 'apps');
            } else {
                $url = '?close=1&applicationid=0' . url_param($tmp_apps, false, 'apps');
            }
        }
    }
    $url .= url_param('groupid') . url_param('hostid') . url_param('fullscreen') . url_param('select');
    $link = new CLink($img, $url);
    $col = new CCol(array(bold('- ' . 'other' . ' -'), SPACE . '(' . _n('%1$s Item', '%1$s Items', $db_host['item_cnt']) . ')'));
    $col->setColSpan(5);
    // host JS menu link
    $hostSpan = null;
    if ($_REQUEST['hostid'] == 0) {
        $hostSpan = new CSpan($host['name'], 'link_menu menu-host');
        $scripts = $hostScripts[$host['hostid']];
        $hostSpan->setAttribute('data-menu', hostMenuData($host, $scripts));
    }
    $table->addRow(array($link, get_node_name_by_elid($db_host['hostid']), $hostSpan, $col));
    foreach ($app_rows as $row) {
        $table->addRow($row);
    }
}
$latest_wdgt->addItem($table);
$latest_wdgt->show();
require_once 'include/page_footer.php';
开发者ID:quanta-computing,项目名称:debian-packages,代码行数:31,代码来源:latest.php

示例8: foreach

    $triggers[$row['triggerid']]['items'][$row['itemid']] = $item;
}
foreach ($triggers as $triggerid => $row) {
    $description = expand_trigger_description_by_data($row);
    $menus = '';
    $host_nodeid = id2nodeid($row['hostid']);
    foreach ($scripts_by_hosts[$row['hostid']] as $id => $script) {
        $script_nodeid = id2nodeid($script['scriptid']);
        if (bccomp($host_nodeid, $script_nodeid) == 0) {
            $menus .= "['" . $script['name'] . "',\"javascript: openWinCentered('scripts_exec.php?execute=1&hostid=" . $row['hostid'] . "&scriptid=" . $script['scriptid'] . "','" . S_TOOLS . "',760,540,'titlebar=no, resizable=yes, scrollbars=yes, dialog=no');\", null,{'outer' : ['pum_o_item'],'inner' : ['pum_i_item']}],";
        }
    }
    $menus .= "[" . zbx_jsvalue(S_LINKS) . ",null,null,{'outer' : ['pum_oheader'],'inner' : ['pum_iheader']}],";
    $menus .= "['" . S_LATEST_DATA . "',\"javascript: redirect('latest.php?hostid=" . $row['hostid'] . "')\", null,{'outer' : ['pum_o_item'],'inner' : ['pum_i_item']}],";
    $menus = rtrim($menus, ',');
    $menus = "show_popup_menu(event,[[" . zbx_jsvalue(S_TOOLS) . ",null,null,{'outer' : ['pum_oheader'],'inner' : ['pum_iheader']}]," . $menus . "],180);";
    $host = new CSpan($row['host']);
    $host->setAttribute('onclick', 'javascript: ' . $menus);
    $host->setAttribute('onmouseover', "javascript: this.style.cursor = 'pointer';");
    $tr_conf_link = 'null';
    if ($USER_DETAILS['type'] > USER_TYPE_ZABBIX_USER) {
        $tr_conf_link = "['" . S_CONFIGURATION_OF_TRIGGERS . "',\"javascript: redirect('triggers.php?form=update&triggerid=" . $row['triggerid'] . "&hostid=" . $row['hostid'] . "')\", null,{'outer' : ['pum_o_item'],'inner' : ['pum_i_item']}]";
    }
    $tr_desc = new CSpan($description, 'pointer');
    $tr_desc->addAction('onclick', "create_mon_trigger_menu(event, " . " new Array({'triggerid': '" . $row['triggerid'] . "', 'lastchange': '" . $row['lastchange'] . "'}," . $tr_conf_link . ")," . zbx_jsvalue($row['items']) . ");");
    $table->addRow(array(get_node_name_by_elid($row['triggerid']), $host, $tr_desc, new CCol(get_severity_description($row['priority']), get_severity_style($row['priority'])), $row['cnt_event']));
}
$table->show();
$jsmenu = new CPUMenu(null, 170);
$jsmenu->InsertJavaScript();
include_once 'include/page_footer.php';
开发者ID:phedders,项目名称:zabbix,代码行数:31,代码来源:report5.php

示例9: make_latest_issues

function make_latest_issues($filter = array())
{
    global $page;
    $config = select_config();
    $limit = isset($filter['limit']) ? $filter['limit'] : 20;
    $options = array('groupids' => $filter['groupids'], 'monitored' => 1, 'maintenance' => $filter['maintenance'], 'skipDependent' => 1, 'filter' => array('priority' => $filter['severity'], 'value' => TRIGGER_VALUE_TRUE), 'select_groups' => API_OUTPUT_EXTEND, 'select_hosts' => API_OUTPUT_EXTEND, 'output' => API_OUTPUT_EXTEND, 'sortfield' => 'lastchange', 'sortorder' => ZBX_SORT_DOWN, 'limit' => $limit);
    if (isset($filter['hostids'])) {
        $options['hostids'] = $filter['hostids'];
    }
    $triggers = CTrigger::get($options);
    // GATHER HOSTS FOR SELECTED TRIGGERS {{{
    $triggers_hosts = array();
    foreach ($triggers as $tnum => $trigger) {
        // if trigger is lost(broken expression) we skip it
        if (empty($trigger['hosts'])) {
            unset($triggers[$tnum]);
            continue;
        }
        $triggers_hosts = array_merge($triggers_hosts, $trigger['hosts']);
    }
    $triggers_hosts = zbx_toHash($triggers_hosts, 'hostid');
    $triggers_hostids = array_keys($triggers_hosts);
    // }}} GATHER HOSTS FOR SELECTED TRIGGERS
    $scripts_by_hosts = CScript::getScriptsByHosts($triggers_hostids);
    $table = new CTableInfo();
    $table->setHeader(array(is_show_all_nodes() ? S_NODE : null, S_HOST, S_ISSUE, S_LAST_CHANGE, S_AGE, $config['event_ack_enable'] ? S_ACK : NULL, S_ACTIONS));
    $thosts_cache = array();
    foreach ($triggers as $tnum => $trigger) {
        // Check for dependencies
        $group = reset($trigger['groups']);
        $host = reset($trigger['hosts']);
        $trigger['hostid'] = $host['hostid'];
        $trigger['host'] = $host['host'];
        $host = null;
        $menus = '';
        $host_nodeid = id2nodeid($trigger['hostid']);
        foreach ($scripts_by_hosts[$trigger['hostid']] as $id => $script) {
            $script_nodeid = id2nodeid($script['scriptid']);
            if (bccomp($host_nodeid, $script_nodeid) == 0) {
                $menus .= "[" . zbx_jsvalue($script['name']) . ",\"javascript: openWinCentered('scripts_exec.php?execute=1&hostid=" . $trigger['hostid'] . "&scriptid=" . $script['scriptid'] . "','" . S_TOOLS . "',760,540,'titlebar=no, resizable=yes, scrollbars=yes, dialog=no');\", null,{'outer' : ['pum_o_item'],'inner' : ['pum_i_item']}],";
            }
        }
        if (!empty($scripts_by_hosts)) {
            $menus = "['" . S_TOOLS . "',null,null,{'outer' : ['pum_oheader'],'inner' : ['pum_iheader']}]," . $menus;
        }
        if (isset($thosts_cache[$trigger['hostid']])) {
            $hprofile = $thosts_cache[$trigger['hostid']];
        } else {
            $hprofile = CHost::get(array('hostids' => $trigger['hostid'], 'output' => API_OUTPUT_SHORTEN, 'select_profile' => API_OUTPUT_EXTEND));
            $hprofile = reset($hprofile);
            $thosts_cache[$hprofile['hostid']] = $hprofile;
        }
        $menus .= "['" . S_LINKS . "',null,null,{'outer' : ['pum_oheader'],'inner' : ['pum_iheader']}],";
        $menus .= "['" . S_LATEST_DATA . "',\"javascript: redirect('latest.php?groupid=" . $group['groupid'] . '&hostid=' . $trigger['hostid'] . "')\", null,{'outer' : ['pum_o_item'],'inner' : ['pum_i_item']}],";
        if (!empty($hprofile['profile'])) {
            $menus .= "['" . S_PROFILE . "',\"javascript: redirect('hostprofiles.php?hostid=" . $trigger['hostid'] . "&prof_type=0')\", null,{'outer' : ['pum_o_item'],'inner' : ['pum_i_item']}],";
        }
        if (!empty($hprofile['profile_ext'])) {
            $menus .= "['" . S_EXTENDED_PROFILE . "',\"javascript: redirect('hostprofiles.php?hostid=" . $trigger['hostid'] . "&prof_type=1')\", null,{'outer' : ['pum_o_item'],'inner' : ['pum_i_item']}],";
        }
        $menus = rtrim($menus, ',');
        $menus = 'show_popup_menu(event,[' . $menus . '],180);';
        $host = new CSpan($trigger['host'], 'link_menu pointer');
        $host->setAttribute('onclick', 'javascript: ' . $menus);
        //$host = new CSpan($trigger['host'],'link_menu pointer');
        //$host->setAttribute('onclick','javascript: '.$menus);
        // Maintenance {{{
        $trigger_host = $triggers_hosts[$trigger['hostid']];
        $text = null;
        $style = 'link_menu';
        if ($trigger_host['maintenance_status']) {
            $style .= ' orange';
            $options = array('maintenanceids' => $trigger_host['maintenanceid'], 'output' => API_OUTPUT_EXTEND);
            $maintenances = CMaintenance::get($options);
            $maintenance = reset($maintenances);
            $text = $maintenance['name'];
            $text .= ' [' . ($trigger_host['maintenance_type'] ? S_NO_DATA_MAINTENANCE : S_NORMAL_MAINTENANCE) . ']';
        }
        $host = new CSpan($trigger['host'], $style . ' pointer');
        $host->setAttribute('onclick', 'javascript: ' . $menus);
        if (!is_null($text)) {
            $host->setHint($text, '', '', false);
        }
        // }}} Maintenance
        $event_sql = 'SELECT e.eventid, e.value, e.clock, e.objectid as triggerid, e.acknowledged' . ' FROM events e' . ' WHERE e.object=' . EVENT_OBJECT_TRIGGER . ' AND e.objectid=' . $trigger['triggerid'] . ' AND e.value=' . TRIGGER_VALUE_TRUE . ' ORDER by e.object DESC, e.objectid DESC, e.eventid DESC';
        $res_events = DBSelect($event_sql, 1);
        while ($row_event = DBfetch($res_events)) {
            $ack = NULL;
            if ($config['event_ack_enable']) {
                if ($row_event['acknowledged'] == 1) {
                    $ack_info = make_acktab_by_eventid($row_event['eventid']);
                    $ack_info->setAttribute('style', 'width: auto;');
                    $ack = new CLink(S_YES, 'acknow.php?eventid=' . $row_event['eventid'] . '&backurl=' . $page['file'], 'off');
                    $ack->setHint($ack_info, '', '', false);
                } else {
                    $ack = new CLink(S_NO, 'acknow.php?eventid=' . $row_event['eventid'] . '&backurl=' . $page['file'], 'on');
                }
            }
            //			$description = expand_trigger_description($row['triggerid']);
            $description = expand_trigger_description_by_data(zbx_array_merge($trigger, array('clock' => $row_event['clock'])), ZBX_FLAG_EVENT);
//.........这里部分代码省略.........
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:101,代码来源:blocks.inc.php

示例10: foreach

     }
     if (!is_null($writeonly)) {
         $options['editable'] = 1;
     }
     if (!is_null($templated)) {
         $options['templated'] = $templated;
     }
     $items = CItem::get($options);
     foreach ($items as $tnum => $row) {
         $host = reset($row['hosts']);
         $row['host'] = $host['host'];
         $row['description'] = item_description($row);
         $description = new CSpan($row['description'], 'link');
         $row['description'] = $row['host'] . ':' . $row['description'];
         $action = get_window_opener($dstfrm, $dstfld1, $row[$srcfld1]) . get_window_opener($dstfrm, $dstfld2, $row[$srcfld2]);
         $description->setAttribute('onclick', $action . ' close_window(); return false;');
         $table->addRow(array($hostid > 0 ? null : $row['host'], $description, item_type2str($row['type']), item_value_type2str($row['value_type']), new CSpan(item_status2str($row['status']), item_status2style($row['status']))));
     }
     $table->show();
 } else {
     if ($srctbl == 'slides') {
         require_once 'include/screens.inc.php';
         $form = new CForm();
         $form->setName('slideform');
         $form->setAttribute('id', 'slides');
         $table = new CTableInfo(S_NO_SLIDES_DEFINED);
         insert_js_function('addSelectedValues');
         insert_js_function('addValues');
         insert_js_function('addValue');
         if ($multiselect) {
             $header = array(array(new CCheckBox("all_slides", NULL, "javascript: checkAll('" . $form->getName() . "', 'all_slides','slides');"), S_NAME));
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:31,代码来源:popup.php

示例11: CButton

        }
    } else {
        $allowedTesting = false;
        $this->data['outline'] = '';
    }
    $testButton = new CButton('test_expression', _('Test'), 'openWinCentered("tr_testexpr.php?expression=" + encodeURIComponent(this.form.elements["expression"].value),' . '"ExpressionTest", 850, 400, "titlebar=no, resizable=yes, scrollbars=yes"); return false;', 'link_menu');
    if (!$allowedTesting) {
        $testButton->setAttribute('disabled', 'disabled');
    }
    if (empty($this->data['outline'])) {
        $testButton->setAttribute('disabled', 'disabled');
    }
    $wrapOutline = new CSpan(array($this->data['outline']));
    $triggersFormList->addRow(SPACE, array($wrapOutline, BR(), BR(), new CDiv(array($expressionTable, $testButton), 'objectgroup inlineblock border_dotted ui-corner-all')));
    $inputMethodToggle = new CSpan(_('Close expression constructor'), 'link');
    $inputMethodToggle->setAttribute('onclick', 'javascript: ' . 'document.getElementById("toggle_input_method").value=1;' . 'document.getElementById("input_method").value=' . IM_ESTABLISHED . ';' . 'document.forms["' . $triggersForm->getName() . '"].submit();');
    $triggersFormList->addRow(SPACE, array($inputMethodToggle, BR()));
}
$triggersFormList->addRow(_('Multiple PROBLEM events generation'), new CCheckBox('type', $this->data['type'] == TRIGGER_MULT_EVENT_ENABLED ? 'yes' : 'no', null, 1));
$triggersFormList->addRow(_('Description'), new CTextArea('comments', $this->data['comments']));
$triggersFormList->addRow(_('URL'), new CTextBox('url', $this->data['url'], ZBX_TEXTBOX_STANDARD_SIZE));
$triggersFormList->addRow(_('Severity'), new CSeverity(array('name' => 'priority', 'value' => $this->data['priority'])));
// append status to form list
if (empty($this->data['triggerid']) && empty($this->data['form_refresh'])) {
    $status = 'yes';
} else {
    $status = $this->data['status'] == 0 ? 'yes' : 'no';
}
$triggersFormList->addRow(_('Enabled'), new CCheckBox('status', $status, null, 1));
// append tabs to form
$triggersTab = new CTabView();
开发者ID:omidmt,项目名称:zabbix-greenplum,代码行数:31,代码来源:configuration.triggers.edit.php

示例12: array

        $trigger['items'][$item['itemid']] = array('itemid' => $item['itemid'], 'action' => str_in_array($item['value_type'], array(ITEM_VALUE_TYPE_FLOAT, ITEM_VALUE_TYPE_UINT64)) ? 'showgraph' : 'showvalues', 'name' => itemName($item), 'value_type' => $item['value_type']);
    }
    $triggers[$tid] = $trigger;
}
CArrayHelper::sort($triggers, array(array('field' => 'cnt_event', 'order' => ZBX_SORT_DOWN), 'host', 'description', 'priority'));
$scripts_by_hosts = API::Script()->getScriptsByHosts($hosts);
foreach ($triggers as $trigger) {
    $menus = '';
    $host_nodeid = id2nodeid($trigger['hostid']);
    foreach ($scripts_by_hosts[$trigger['hostid']] as $script) {
        $script_nodeid = id2nodeid($script['scriptid']);
        if (bccomp($host_nodeid, $script_nodeid) == 0) {
            $menus .= "['" . $script['name'] . "',\"javascript: openWinCentered('scripts_exec.php?execute=1&hostid=" . $trigger['hostid'] . "&scriptid=" . $script['scriptid'] . "','Global script',760,540,'titlebar=no, resizable=yes, scrollbars=yes, dialog=no');\", null,{'outer' : ['pum_o_item'],'inner' : ['pum_i_item']}],";
        }
    }
    $menus .= "['" . _('URLs') . "',null,null,{'outer' : ['pum_oheader'],'inner' : ['pum_iheader']}],";
    $menus .= "['" . _('Latest data') . "',\"javascript: redirect('latest.php?hostid=" . $trigger['hostid'] . "')\", null,{'outer' : ['pum_o_item'],'inner' : ['pum_i_item']}]";
    $menus = "show_popup_menu(event,[['" . _('Scripts') . "',null,null,{'outer' : ['pum_oheader'],'inner' : ['pum_iheader']}]," . $menus . "],180);";
    $hostSpan = new CSpan($trigger['hostname'], 'link_menu');
    $hostSpan->setAttribute('onclick', $menus);
    $tr_conf_link = 'null';
    if ($USER_DETAILS['type'] > USER_TYPE_ZABBIX_USER && $trigger['flags'] == ZBX_FLAG_DISCOVERY_NORMAL) {
        $tr_conf_link = "['" . _('Configuration of trigger') . "',\"javascript: redirect('triggers.php?form=update&triggerid=" . $trigger['triggerid'] . "&hostid=" . $trigger['hostid'] . "')\", null,{'outer' : ['pum_o_item'],'inner' : ['pum_i_item']}]";
    }
    $tr_desc = new CSpan($trigger['description'], 'link_menu');
    $tr_desc->addAction('onclick', "create_mon_trigger_menu(event, " . " [{'triggerid': '" . $trigger['triggerid'] . "', 'lastchange': '" . $trigger['lastchange'] . "'}," . $tr_conf_link . "]," . zbx_jsvalue($trigger['items'], true) . ");");
    $table->addRow(array(get_node_name_by_elid($trigger['triggerid']), $hostSpan, $tr_desc, getSeverityCell($trigger['priority']), $trigger['cnt_event']));
}
$rprt_wdgt->addItem($table);
$rprt_wdgt->show();
require_once dirname(__FILE__) . '/include/page_footer.php';
开发者ID:quanta-computing,项目名称:debian-packages,代码行数:31,代码来源:report5.php

示例13: define

    define('ZBX_PAGE_NO_MENU', 1);
}
$refresh_rate = 30;
//seconds
$fields = array('warning_msg' => array(T_ZBX_STR, O_OPT, NULL, NULL, NULL), 'message' => array(T_ZBX_STR, O_OPT, NULL, NULL, NULL), 'retry' => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, NULL, NULL), 'cancel' => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, NULL, NULL));
check_fields($fields, false);
if (isset($_REQUEST['cancel'])) {
    zbx_unsetcookie('ZBX_CONFIG');
    redirect('index.php');
}
//	clear_messages();
$USER_DETAILS['refresh'] = $refresh_rate;
include_once 'include/page_header.php';
unset($USER_DETAILS);
$table = new CTable(null, 'warning');
$table->setAlign('center');
$table->setAttribute('style', 'width: 480px; margin-top: 100px;');
$table->setHeader(array(new CCol(S_ZABBIX . SPACE . ZABBIX_VERSION, 'left')), 'header');
$table->addRow(SPACE);
$warning_msg = isset($_REQUEST['warning_msg']) ? $_REQUEST['warning_msg'] : S_ZABBIX_IS_UNAVAILABLE . '!';
$img = new CImg('./images/general/warning16r.gif', 'warning', 16, 16, 'img');
$img->setAttribute('style', 'border-width: 0px; vertical-align: bottom;');
$msg = new CSpan(bold(SPACE . $warning_msg));
$msg->setAttribute('style', 'line-height: 20px; vertical-align: top;');
$table->addRow(new CCol(array($img, $msg), 'center'));
$table->addRow(SPACE);
$table->setFooter(new CCol(new CButton('retry', S_RETRY, 'javascript: document.location.reload();'), 'left'), 'footer');
$table->show();
zbx_add_post_js('setTimeout("document.location.reload();",' . $refresh_rate * 1000 . ');');
echo SBR;
include_once 'include/page_footer.php';
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:31,代码来源:warning.php

示例14: makeCell

 private function makeCell($id)
 {
     $td = new CCol();
     $caption = new CSpan();
     if ($id != 0 && array_key_exists('childnodes', $this->tree[$id])) {
         $caption->addItem((new CDiv((new CSpan())->addClass('arrow-right')))->addClass('treeview')->onClick($this->treename . '.closeSNodeX("' . $id . '", this.getElementsByTagName(\'span\')[0]);')->setId('idi_' . $id));
     }
     $caption->addItem($this->tree[$id]['caption']);
     if ($this->tree[$id]['Level'] != 0) {
         $level = $this->tree[$id]['Level'];
         $caption->setAttribute('style', 'padding-left:' . 2 * $level . 'em;');
     }
     $td->addItem($caption);
     return $td;
 }
开发者ID:jbfavre,项目名称:debian-zabbix,代码行数:15,代码来源:CTree.php

示例15: insert_show_color_picker_javascript

function insert_show_color_picker_javascript()
{
    global $SHOW_COLOR_PICKER_SCRIPT_ISERTTED;
    if ($SHOW_COLOR_PICKER_SCRIPT_ISERTTED) {
        return;
    }
    $SHOW_COLOR_PICKER_SCRIPT_ISERTTED = true;
    $table = new CTable();
    // gray colors
    $row = array();
    foreach (array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F') as $c) {
        $color = $c . $c . $c . $c . $c . $c;
        $row[] = new CColorCell(null, $color, 'set_color("' . $color . '");');
    }
    $table->addRow($row);
    // other colors
    $colors = array(array('r' => 0, 'g' => 0, 'b' => 1), array('r' => 0, 'g' => 1, 'b' => 0), array('r' => 1, 'g' => 0, 'b' => 0), array('r' => 0, 'g' => 1, 'b' => 1), array('r' => 1, 'g' => 0, 'b' => 1), array('r' => 1, 'g' => 1, 'b' => 0));
    $brigs = array(array(0 => '0', 1 => '3'), array(0 => '0', 1 => '4'), array(0 => '0', 1 => '5'), array(0 => '0', 1 => '6'), array(0 => '0', 1 => '7'), array(0 => '0', 1 => '8'), array(0 => '0', 1 => '9'), array(0 => '0', 1 => 'A'), array(0 => '0', 1 => 'B'), array(0 => '0', 1 => 'C'), array(0 => '0', 1 => 'D'), array(0 => '0', 1 => 'E'), array(0 => '3', 1 => 'F'), array(0 => '6', 1 => 'F'), array(0 => '9', 1 => 'F'), array(0 => 'C', 1 => 'F'));
    foreach ($colors as $c) {
        $row = array();
        foreach ($brigs as $br) {
            $r = $br[$c['r']];
            $g = $br[$c['g']];
            $b = $br[$c['b']];
            $color = $r . $r . $g . $g . $b . $b;
            $row[] = new CColorCell(null, $color, 'set_color("' . $color . '");');
        }
        $table->addRow($row);
    }
    $cancel = new CSpan(_('Cancel'), 'link');
    $cancel->setAttribute('onclick', 'javascript: hide_color_picker();');
    $tmp = array($table, $cancel);
    $script = '
		var color_picker = null;
		var curr_lbl = null;
		var curr_txt = null;
		var color_table = ' . zbx_jsvalue(unpack_object($tmp)) . "\n";
    insert_js($script);
    zbx_add_post_js('create_color_picker();');
}
开发者ID:quanta-computing,项目名称:debian-packages,代码行数:40,代码来源:js.inc.php


注:本文中的CSpan::setAttribute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。