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


PHP CLink::setHint方法代码示例

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


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

示例1: make_latest_issues

function make_latest_issues($params = array())
{
    global $USER_DETAILS;
    $available_hosts = get_accessible_hosts_by_user($USER_DETAILS, PERM_READ_ONLY);
    $available_triggers = get_accessible_triggers(PERM_READ_ONLY, array());
    $scripts_by_hosts = get_accessible_scripts_by_hosts($available_hosts);
    $config = select_config();
    $sql_select = '';
    $sql_from = '';
    $sql_where = '';
    $limit = 20;
    if (!empty($params)) {
        if (isset($params['limit'])) {
            $limit = $params['limit'];
        }
        if (isset($params['groupid']) && $params['groupid'] > 0) {
            $sql_select .= ',g.name ';
            $sql_from .= ',groups g ';
            $sql_where .= ' AND g.groupid=hg.groupid ' . ' AND hg.groupid=' . $params['groupid'];
        }
        if (isset($params['hostid']) && $params['hostid'] > 0) {
            $sql_where .= ' AND h.hostid=' . $params['hostid'];
        }
    }
    $table = new CTableInfo();
    $table->setHeader(array(is_show_all_nodes() ? S_NODE : null, isset($params['groupid']) && $params['groupid'] > 0 ? S_GROUP : null, S_HOST, S_ISSUE, S_LAST_CHANGE, S_AGE, $config['event_ack_enable'] ? S_ACK : NULL, S_ACTIONS));
    $sql = 'SELECT DISTINCT t.triggerid,t.status,t.description,t.expression,t.priority,t.lastchange,t.value,h.host,h.hostid ' . $sql_select . ' FROM triggers t,hosts h,items i,functions f,hosts_groups hg ' . $sql_from . ' WHERE f.itemid=i.itemid ' . ' AND h.hostid=i.hostid ' . ' AND hg.hostid=h.hostid ' . ' AND t.triggerid=f.triggerid ' . ' AND t.status=' . TRIGGER_STATUS_ENABLED . ' AND i.status=' . ITEM_STATUS_ACTIVE . ' AND ' . DBcondition('t.triggerid', $available_triggers) . ' AND h.status=' . HOST_STATUS_MONITORED . ' AND t.value=' . TRIGGER_VALUE_TRUE . $sql_where . ' ORDER BY t.lastchange DESC';
    $result = DBselect($sql, $limit);
    while ($row = DBfetch($result)) {
        // Check for dependencies
        if (trigger_dependent($row["triggerid"])) {
            continue;
        }
        $host = null;
        $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?groupid=0&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'], 'link');
        $host->setAttribute('onclick', 'javascript: ' . $menus);
        $host->setAttribute('onmouseover', "javascript: this.style.cursor = 'pointer';");
        $event_sql = 'SELECT DISTINCT e.eventid, e.value, e.clock, e.objectid as triggerid, e.acknowledged, t.type, t.url ' . ' FROM events e, triggers t ' . ' WHERE e.object=' . EVENT_SOURCE_TRIGGERS . ' AND e.objectid=' . $row['triggerid'] . ' AND t.triggerid=e.objectid ' . ' 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'], 'action');
                    $ack->setHint($ack_info);
                } else {
                    $ack = new CLink(S_NO, 'acknow.php?eventid=' . $row_event['eventid'], 'on');
                }
            }
            //			$description = expand_trigger_description($row['triggerid']);
            $description = expand_trigger_description_by_data(array_merge($row, array('clock' => $row_event['clock'])), ZBX_FLAG_EVENT);
            //actions
            $actions = get_event_actions_stat_hints($row_event['eventid']);
            $clock = new CLink(zbx_date2str(S_DATE_FORMAT_YMDHMS, $row_event['clock']), 'events.php?triggerid=' . $row['triggerid'] . '&source=0&show_unknown=1&nav_time=' . $row_event['clock'], 'action');
            if ($row_event['url']) {
                $description = new CLink($description, $row_event['url'], 'action', null, true);
            } else {
                $description = new CSpan($description, 'pointer');
            }
            $description = new CCol($description, get_severity_style($row["priority"]));
            $description->setHint(make_popup_eventlist($row_event['eventid'], $row['type']));
            $table->addRow(array(get_node_name_by_elid($row['triggerid']), $host, $description, $clock, zbx_date2age($row_event['clock']), $ack, $actions));
        }
        unset($row, $description, $actions, $alerts, $hint);
    }
    $table->setFooter(new CCol(S_UPDATED . ': ' . date("H:i:s", time())));
    return $table;
}
开发者ID:phedders,项目名称:zabbix,代码行数:82,代码来源:blocks.inc.php

示例2: getEventAckState

/**
 * Create element with event acknowledges info.
 * If $event has subarray 'acknowledges', returned link will have hint with acknowledges.
 *
 * @param array			$event   event data
 * @param int			$event['acknowledged']
 * @param int			$event['eventid']
 * @param int			$event['objectid']
 * @param array			$event['acknowledges']
 * @param bool|string	$backUrl if true, add backurl param to link with current page file name
 * @param bool			$isLink  if true, return link otherwise span
 * @param array			$params  additional params for link
 *
 * @return array|CLink|CSpan|null|string
 */
function getEventAckState($event, $backUrl = false, $isLink = true, $params = array())
{
    $config = select_config();
    if (!$config['event_ack_enable']) {
        return null;
    }
    if ($isLink) {
        if (!empty($backUrl)) {
            if (is_bool($backUrl)) {
                global $page;
                $backurl = '&backurl=' . $page['file'];
            } else {
                $backurl = '&backurl=' . $backUrl;
            }
        } else {
            $backurl = '';
        }
        $additionalParams = '';
        foreach ($params as $key => $value) {
            $additionalParams .= '&' . $key . '=' . $value;
        }
        if ($event['acknowledged'] == 0) {
            $ack = new CLink(_('No'), 'acknow.php?eventid=' . $event['eventid'] . '&triggerid=' . $event['objectid'] . $backurl . $additionalParams, 'disabled');
        } else {
            $ackLink = new CLink(_('Yes'), 'acknow.php?eventid=' . $event['eventid'] . '&triggerid=' . $event['objectid'] . $backurl . $additionalParams, 'enabled');
            if (is_array($event['acknowledges'])) {
                $ackLinkHints = makeAckTab($event);
                if (!empty($ackLinkHints)) {
                    $ackLink->setHint($ackLinkHints, '', '', false);
                }
                $ack = array($ackLink, ' (' . count($event['acknowledges']) . ')');
            } else {
                $ack = array($ackLink, ' (' . $event['acknowledges'] . ')');
            }
        }
    } else {
        if ($event['acknowledged'] == 0) {
            $ack = new CSpan(_('No'), 'on');
        } else {
            $ack = array(new CSpan(_('Yes'), 'off'), ' (' . (is_array($event['acknowledges']) ? count($event['acknowledges']) : $event['acknowledges']) . ')');
        }
    }
    return $ack;
}
开发者ID:SandipSingh14,项目名称:Zabbix_,代码行数:59,代码来源:events.inc.php

示例3: CLink

     array_push($page_header_r_col, new CLink(_('Profile'), 'profile.php', 'small_font', null, 'nosid'), '|');
 }
 if (isset(CWebUser::$data['debug_mode']) && CWebUser::$data['debug_mode'] == GROUP_DEBUG_MODE_ENABLED) {
     $debug = new CLink(_('Debug'), '#debug', 'small_font', null, 'nosid');
     $d_script = " if (!isset('state', this)) { this.state = 'none'; }" . " if (this.state == 'none') { this.state = 'block'; }" . " else { this.state = 'none'; }" . " showHideByName('zbx_debug_info', this.state);";
     $debug->setAttribute('onclick', 'javascript: ' . $d_script);
     array_push($page_header_r_col, $debug, '|');
 }
 if (CWebUser::isGuest()) {
     $page_header_r_col[] = array(new CLink(_('Login'), 'index.php?reconnect=1', 'small_font', null, null));
 } else {
     // it is not possible to logout from HTTP authentication
     $chck = $page['file'] == 'authentication.php' && isset($_REQUEST['save'], $_REQUEST['config']);
     if ($chck && $_REQUEST['config'] == ZBX_AUTH_HTTP || !$chck && isset($config) && $config['authentication_type'] == ZBX_AUTH_HTTP) {
         $logout = new CLink(_('Logout'), '', 'small_font', null, 'nosid');
         $logout->setHint(_s('It is not possible to logout from HTTP authentication.'), null, null, false);
     } else {
         $logout = new CLink(_('Logout'), 'index.php?reconnect=1', 'small_font', null, null);
     }
     array_push($page_header_r_col, $logout);
 }
 $logo = new CLink(new CDiv(SPACE, 'zabbix_logo'), 'http://www.zabbix.com/', 'image', null, 'nosid');
 $logo->setTarget('_blank');
 $top_page_row = array(new CCol($logo, 'page_header_l'), new CCol($page_header_r_col, 'maxwidth page_header_r'));
 unset($logo, $page_header_r_col, $help, $support);
 $table = new CTable(null, 'maxwidth page_header');
 $table->setCellSpacing(0);
 $table->setCellPadding(5);
 $table->addRow($top_page_row);
 $table->show();
 $menu_table = new CTable(null, 'menu pointer');
开发者ID:hujingguang,项目名称:work,代码行数:31,代码来源:page_header.php

示例4: 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


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