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


PHP CCol类代码示例

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


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

示例1: bodyToString

 public function bodyToString()
 {
     $this->cleanItems();
     $total = 0;
     // fetch accessible host ids
     $hosts = API::Host()->get(array('nodeids' => get_current_nodeid(true), 'output' => array('hostid'), 'preservekeys' => true));
     $hostIds = array_keys($hosts);
     if (remove_nodes_from_id($this->groupid) > 0) {
         $cond_from = ',hosts_groups hg';
         $cond_where = ' AND hg.hostid=h.hostid AND hg.groupid=' . zbx_dbstr($this->groupid);
     } else {
         $cond_from = '';
         $cond_where = andDbNode('h.hostid', $this->nodeid);
     }
     $db_host_cnt = DBselect('SELECT COUNT(DISTINCT h.hostid) AS cnt' . ' FROM hosts h' . $cond_from . ' WHERE h.available=' . HOST_AVAILABLE_TRUE . ' AND h.status IN (' . HOST_STATUS_MONITORED . ',' . HOST_STATUS_NOT_MONITORED . ')' . ' AND ' . dbConditionInt('h.hostid', $hostIds) . $cond_where);
     $host_cnt = DBfetch($db_host_cnt);
     $avail = $host_cnt['cnt'];
     $total += $host_cnt['cnt'];
     $db_host_cnt = DBselect('SELECT COUNT(DISTINCT h.hostid) AS cnt' . ' FROM hosts h' . $cond_from . ' WHERE h.available=' . HOST_AVAILABLE_FALSE . ' AND h.status IN (' . HOST_STATUS_MONITORED . ',' . HOST_STATUS_NOT_MONITORED . ')' . ' AND ' . dbConditionInt('h.hostid', $hostIds) . $cond_where);
     $host_cnt = DBfetch($db_host_cnt);
     $notav = $host_cnt['cnt'];
     $total += $host_cnt['cnt'];
     $db_host_cnt = DBselect('SELECT COUNT(DISTINCT h.hostid) AS cnt' . ' FROM hosts h' . $cond_from . ' WHERE h.available=' . HOST_AVAILABLE_UNKNOWN . ' AND h.status IN (' . HOST_STATUS_MONITORED . ',' . HOST_STATUS_NOT_MONITORED . ')' . ' AND ' . dbConditionInt('h.hostid', $hostIds) . $cond_where);
     $host_cnt = DBfetch($db_host_cnt);
     $uncn = $host_cnt['cnt'];
     $total += $host_cnt['cnt'];
     $node = get_node_by_nodeid($this->nodeid);
     $header_str = _('Hosts info') . SPACE;
     if ($node > 0) {
         $header_str .= '(' . $node['name'] . ')' . SPACE;
     }
     if (remove_nodes_from_id($this->groupid) > 0) {
         $group = get_hostgroup_by_groupid($this->groupid);
         $header_str .= _('Group') . SPACE . '"' . $group['name'] . '"';
     } else {
         $header_str .= _('All groups');
     }
     $header = new CCol($header_str, 'header');
     if ($this->style == STYLE_HORISONTAL) {
         $header->setColspan(4);
     }
     $this->addRow($header);
     $avail = new CCol($avail . '  ' . _('Available'), 'avail');
     $notav = new CCol($notav . '  ' . _('Not available'), 'notav');
     $uncn = new CCol($uncn . '  ' . _('Unknown'), 'uncn');
     $total = new CCol($total . '  ' . _('Total'), 'total');
     if ($this->style == STYLE_HORISONTAL) {
         $this->addRow(array($avail, $notav, $uncn, $total));
     } else {
         $this->addRow($avail);
         $this->addRow($notav);
         $this->addRow($uncn);
         $this->addRow($total);
     }
     return parent::bodyToString();
 }
开发者ID:SandipSingh14,项目名称:Zabbix_,代码行数:56,代码来源:class.chostsinfo.php

示例2: bodyToString

 public function bodyToString()
 {
     global $USER_DETAILS;
     $this->cleanItems();
     $total = 0;
     $accessible_hosts = get_accessible_hosts_by_user($USER_DETAILS, PERM_READ_ONLY, PERM_RES_IDS_ARRAY, get_current_nodeid(true));
     $cond_from = '';
     if (remove_nodes_from_id($this->groupid) > 0) {
         $cond_from = ', hosts_groups hg ';
         $cond_where = 'AND hg.hostid=h.hostid AND hg.groupid=' . $this->groupid;
     } else {
         $cond_where = ' AND ' . DBin_node('h.hostid', $this->nodeid);
     }
     $db_host_cnt = DBselect('SELECT COUNT(DISTINCT h.hostid) as cnt ' . ' FROM hosts h' . $cond_from . ' WHERE h.available=' . HOST_AVAILABLE_TRUE . ' AND h.status IN (' . HOST_STATUS_MONITORED . ',' . HOST_STATUS_NOT_MONITORED . ') ' . ' AND ' . DBcondition('h.hostid', $accessible_hosts) . $cond_where);
     $host_cnt = DBfetch($db_host_cnt);
     $avail = $host_cnt['cnt'];
     $total += $host_cnt['cnt'];
     $db_host_cnt = DBselect('SELECT COUNT(DISTINCT h.hostid) as cnt ' . ' FROM hosts h' . $cond_from . ' WHERE h.available=' . HOST_AVAILABLE_FALSE . ' AND h.status IN (' . HOST_STATUS_MONITORED . ',' . HOST_STATUS_NOT_MONITORED . ') ' . ' AND ' . DBcondition('h.hostid', $accessible_hosts) . $cond_where);
     $host_cnt = DBfetch($db_host_cnt);
     $notav = $host_cnt['cnt'];
     $total += $host_cnt['cnt'];
     $db_host_cnt = DBselect('SELECT COUNT(DISTINCT h.hostid) as cnt ' . ' FROM hosts h' . $cond_from . ' WHERE h.available=' . HOST_AVAILABLE_UNKNOWN . ' AND h.status IN (' . HOST_STATUS_MONITORED . ',' . HOST_STATUS_NOT_MONITORED . ') ' . ' AND ' . DBcondition('h.hostid', $accessible_hosts) . $cond_where);
     $host_cnt = DBfetch($db_host_cnt);
     $uncn = $host_cnt['cnt'];
     $total += $host_cnt['cnt'];
     $node = get_node_by_nodeid($this->nodeid);
     $header_str = S_HOSTS_INFO . SPACE;
     $header_str .= S_FOR_GROUP_SMALL . SPACE . '"';
     if ($node > 0) {
         $header_str .= '(' . $node['name'] . ')' . SPACE;
     }
     if (remove_nodes_from_id($this->groupid) > 0) {
         $group = get_hostgroup_by_groupid($this->groupid);
         $header_str .= $group['name'] . '"';
     } else {
         $header_str .= S_ALL_S . '"';
     }
     $header = new CCol($header_str, "header");
     if ($this->style == STYLE_HORISONTAL) {
         $header->SetColspan(4);
     }
     $this->addRow($header);
     $avail = new CCol($avail . '  ' . S_AVAILABLE, 'avail');
     $notav = new CCol($notav . '  ' . S_NOT_AVAILABLE, 'notav');
     $uncn = new CCol($uncn . '  ' . S_UNKNOWN, 'uncn');
     $total = new CCol($total . '  ' . S_TOTAL, 'total');
     if ($this->style == STYLE_HORISONTAL) {
         $this->addRow(array($avail, $notav, $uncn, $total));
     } else {
         $this->addRow($avail);
         $this->addRow($notav);
         $this->addRow($uncn);
         $this->addRow($total);
     }
     return parent::bodyToString();
 }
开发者ID:rennhak,项目名称:zabbix,代码行数:56,代码来源:class.chostsinfo.php

示例3: setDoubleHeader

 public function setDoubleHeader($left, $right)
 {
     $table = new CTable();
     $table->addStyle('width: 100%;');
     $lCol = new CCol($left);
     $lCol->addStyle('text-align: left; border: 0;');
     $rCol = new CCol($right);
     $rCol->addStyle('text-align: right; border: 0;');
     $table->addRow(array($lCol, $rCol));
     $this->_header = new CDiv(null, 'nowrap ui-corner-all ui-widget-header ' . $this->css_class);
     $this->_header->addItem($table);
     return $this->_header;
 }
开发者ID:SandipSingh14,项目名称:Zabbix_,代码行数:13,代码来源:class.cuiwidget.php

示例4: make_latest_issues


//.........这里部分代码省略.........
    foreach ($triggers as $tnum => $trigger) {
        // if trigger is lost (broken expression) we skip it
        if (empty($trigger['hosts'])) {
            unset($triggers[$tnum]);
            continue;
        }
        $host = reset($trigger['hosts']);
        $trigger['hostid'] = $host['hostid'];
        $trigger['hostname'] = $host['name'];
        if ($trigger['lastEvent']) {
            $trigger['lastEvent']['acknowledges'] = isset($eventAcknowledges[$trigger['lastEvent']['eventid']]) ? $eventAcknowledges[$trigger['lastEvent']['eventid']]['acknowledges'] : null;
        }
        $triggers[$tnum] = $trigger;
    }
    $hostIds = zbx_objectValues($triggers, 'hostid');
    // get hosts
    $hosts = API::Host()->get(array('hostids' => $hostIds, 'output' => array('hostid', 'name', 'status', 'maintenance_status', 'maintenance_type', 'maintenanceid'), 'selectScreens' => API_OUTPUT_COUNT, 'preservekeys' => true));
    // actions
    $actions = getEventActionsStatHints($eventIds);
    // ack params
    $ackParams = isset($filter['screenid']) ? array('screenid' => $filter['screenid']) : array();
    $config = select_config();
    // indicator of sort field
    if ($showSortIndicator) {
        $sortDiv = new CDiv(SPACE, $filter['sortorder'] === ZBX_SORT_DOWN ? 'icon_sortdown default_cursor' : 'icon_sortup default_cursor');
        $sortDiv->addStyle('float: left');
        $hostHeaderDiv = new CDiv(array(_('Host'), SPACE));
        $hostHeaderDiv->addStyle('float: left');
        $issueHeaderDiv = new CDiv(array(_('Issue'), SPACE));
        $issueHeaderDiv->addStyle('float: left');
        $lastChangeHeaderDiv = new CDiv(array(_('Time'), SPACE));
        $lastChangeHeaderDiv->addStyle('float: left');
    }
    $table = new CTableInfo(_('No events found.'));
    $table->setHeader(array(is_show_all_nodes() ? _('Node') : null, $showSortIndicator && $filter['sortfield'] === 'hostname' ? array($hostHeaderDiv, $sortDiv) : _('Host'), $showSortIndicator && $filter['sortfield'] === 'priority' ? array($issueHeaderDiv, $sortDiv) : _('Issue'), $showSortIndicator && $filter['sortfield'] === 'lastchange' ? array($lastChangeHeaderDiv, $sortDiv) : _('Last change'), _('Age'), _('Info'), $config['event_ack_enable'] ? _('Ack') : null, _('Actions')));
    $scripts = API::Script()->getScriptsByHosts($hostIds);
    // triggers
    foreach ($triggers as $trigger) {
        $host = $hosts[$trigger['hostid']];
        $hostName = new CSpan($host['name'], 'link_menu');
        $hostName->setMenuPopup(getMenuPopupHost($host, $scripts[$host['hostid']]));
        // add maintenance icon with hint if host is in maintenance
        $maintenanceIcon = null;
        if ($host['maintenance_status']) {
            $maintenanceIcon = new CDiv(null, 'icon-maintenance-abs');
            // get maintenance
            $maintenances = API::Maintenance()->get(array('maintenanceids' => $host['maintenanceid'], 'output' => API_OUTPUT_EXTEND, 'limit' => 1));
            if ($maintenance = reset($maintenances)) {
                $hint = $maintenance['name'] . ' [' . ($host['maintenance_type'] ? _('Maintenance without data collection') : _('Maintenance with data collection')) . ']';
                if (isset($maintenance['description'])) {
                    // double quotes mandatory
                    $hint .= "\n" . $maintenance['description'];
                }
                $maintenanceIcon->setHint($hint);
                $maintenanceIcon->addClass('pointer');
            }
            $hostName->addClass('left-to-icon-maintenance-abs');
        }
        $hostDiv = new CDiv(array($hostName, $maintenanceIcon), 'maintenance-abs-cont');
        // unknown triggers
        $unknown = SPACE;
        if ($trigger['state'] == TRIGGER_STATE_UNKNOWN) {
            $unknown = new CDiv(SPACE, 'status_icon iconunknown');
            $unknown->setHint($trigger['error'], '', 'on');
        }
        // trigger has events
        if ($trigger['lastEvent']) {
            // description
            $description = CMacrosResolverHelper::resolveEventDescription(zbx_array_merge($trigger, array('clock' => $trigger['lastEvent']['clock'], 'ns' => $trigger['lastEvent']['ns'])));
            // ack
            $ack = getEventAckState($trigger['lastEvent'], empty($filter['backUrl']) ? true : $filter['backUrl'], true, $ackParams);
        } else {
            // description
            $description = CMacrosResolverHelper::resolveEventDescription(zbx_array_merge($trigger, array('clock' => $trigger['lastchange'], 'ns' => '999999999')));
            // ack
            $ack = new CSpan(_('No events'), 'unknown');
        }
        // description
        if (!zbx_empty($trigger['url'])) {
            $description = new CLink($description, resolveTriggerUrl($trigger), null, null, true);
        } else {
            $description = new CSpan($description, 'pointer');
        }
        $description = new CCol($description, getSeverityStyle($trigger['priority']));
        if ($trigger['lastEvent']) {
            $description->setHint(make_popup_eventlist($trigger['triggerid'], $trigger['lastEvent']['eventid']), '', '', false);
        }
        // clock
        $clock = new CLink(zbx_date2str(_('d M Y H:i:s'), $trigger['lastchange']), 'events.php?triggerid=' . $trigger['triggerid'] . '&source=0&show_unknown=1&nav_time=' . $trigger['lastchange']);
        // actions
        $actionHint = $trigger['lastEvent'] && isset($actions[$trigger['lastEvent']['eventid']]) ? $actions[$trigger['lastEvent']['eventid']] : SPACE;
        $table->addRow(array(get_node_name_by_elid($trigger['triggerid']), $hostDiv, $description, $clock, zbx_date2age($trigger['lastchange']), $unknown, $ack, $actionHint));
    }
    // initialize blinking
    zbx_add_post_js('jqBlink.blink();');
    $script = new CJSScript(get_js("jQuery('#hat_lastiss_footer').html('" . _s('Updated: %s', zbx_date2str(_('H:i:s'))) . "')"));
    $infoDiv = new CDiv(_n('%1$d of %2$d issue is shown', '%1$d of %2$d issues are shown', count($triggers), $triggersTotalCount));
    $infoDiv->addStyle('text-align: right; padding-right: 3px;');
    return new CDiv(array($table, $infoDiv, $script));
}
开发者ID:SandipSingh14,项目名称:Zabbix_,代码行数:101,代码来源:blocks.inc.php

示例5: get

 /**
  * Process screen.
  *
  * @return CDiv (screen inside container)
  */
 public function get()
 {
     $this->dataId = 'discovery';
     $sort_field = $this->data['sort'];
     $sort_order = $this->data['sortorder'];
     $druleid = $this->data['druleid'];
     // discovery rules
     $options = ['output' => ['druleid', 'name'], 'selectDHosts' => ['dhostid', 'status', 'lastup', 'lastdown'], 'filter' => ['status' => DRULE_STATUS_ACTIVE]];
     if ($druleid > 0) {
         $options['druleids'] = $druleid;
         // set selected discovery rule id
     }
     $drules = API::DRule()->get($options);
     if ($drules) {
         order_result($drules, 'name');
     }
     // discovery services
     $options = ['selectHosts' => ['hostid', 'name', 'status'], 'output' => ['dserviceid', 'type', 'key_', 'port', 'status', 'lastup', 'lastdown', 'ip', 'dns'], 'sortfield' => $sort_field, 'sortorder' => $sort_order, 'limitSelects' => 1];
     if ($druleid > 0) {
         $options['druleids'] = $druleid;
     } else {
         $options['druleids'] = zbx_objectValues($drules, 'druleid');
     }
     $dservices = API::DService()->get($options);
     // user macros
     $macros = API::UserMacro()->get(['output' => ['macro', 'value'], 'globalmacro' => true]);
     $macros = zbx_toHash($macros, 'macro');
     // services
     $services = [];
     foreach ($dservices as $dservice) {
         $key_ = $dservice['key_'];
         if ($key_ !== '') {
             if (array_key_exists($key_, $macros)) {
                 $key_ = $macros[$key_]['value'];
             }
             $key_ = ': ' . $key_;
         }
         $service_name = discovery_check_type2str($dservice['type']) . discovery_port2str($dservice['type'], $dservice['port']) . $key_;
         $services[$service_name] = 1;
     }
     ksort($services);
     // discovery services to hash
     $dservices = zbx_toHash($dservices, 'dserviceid');
     // discovery hosts
     $dhosts = API::DHost()->get(['druleids' => zbx_objectValues($drules, 'druleid'), 'selectDServices' => ['dserviceid', 'ip', 'dns', 'type', 'status', 'key_'], 'output' => ['dhostid', 'lastdown', 'lastup', 'druleid']]);
     $dhosts = zbx_toHash($dhosts, 'dhostid');
     $header = [make_sorting_header(_('Discovered device'), 'ip', $sort_field, $sort_order, 'zabbix.php?action=discovery.view'), _('Monitored host'), _('Uptime') . '/' . _('Downtime')];
     foreach ($services as $name => $foo) {
         $header[] = (new CColHeader($name))->addClass('vertical_rotation');
     }
     // create table
     $table = (new CTableInfo())->makeVerticalRotation()->setHeader($header);
     foreach ($drules as $drule) {
         $discovery_info = [];
         foreach ($drule['dhosts'] as $dhost) {
             if ($dhost['status'] == DHOST_STATUS_DISABLED) {
                 $hclass = 'disabled';
                 $htime = $dhost['lastdown'];
             } else {
                 $hclass = 'enabled';
                 $htime = $dhost['lastup'];
             }
             // $primary_ip stores the primary host ip of the dhost
             $primary_ip = '';
             foreach ($dhosts[$dhost['dhostid']]['dservices'] as $dservice) {
                 $dservice = $dservices[$dservice['dserviceid']];
                 $hostName = '';
                 $host = reset($dservices[$dservice['dserviceid']]['hosts']);
                 if (!is_null($host)) {
                     $hostName = $host['name'];
                 }
                 if ($primary_ip !== '') {
                     if ($primary_ip === $dservice['ip']) {
                         $htype = 'primary';
                     } else {
                         $htype = 'slave';
                     }
                 } else {
                     $primary_ip = $dservice['ip'];
                     $htype = 'primary';
                 }
                 if (!array_key_exists($dservice['ip'], $discovery_info)) {
                     $discovery_info[$dservice['ip']] = ['ip' => $dservice['ip'], 'dns' => $dservice['dns'], 'type' => $htype, 'class' => $hclass, 'host' => $hostName, 'time' => $htime];
                 }
                 if ($dservice['status'] == DSVC_STATUS_DISABLED) {
                     $class = ZBX_STYLE_INACTIVE_BG;
                     $time = 'lastdown';
                 } else {
                     $class = ZBX_STYLE_ACTIVE_BG;
                     $time = 'lastup';
                 }
                 $key_ = $dservice['key_'];
                 if ($key_ !== '') {
                     if (array_key_exists($key_, $macros)) {
                         $key_ = $macros[$key_]['value'];
//.........这里部分代码省略.........
开发者ID:jbfavre,项目名称:debian-zabbix,代码行数:101,代码来源:CScreenDiscovery.php

示例6: CCol

    if ($result != '-') {
        $style = $result == 'TRUE' ? 'background-color: #ccf; color: #00f;' : 'background-color: #fcc; color: #f00;';
    }
    $col = new CCol($result);
    $col->setAttribute('style', $style);
    $res_table->addRow(new CRow(array($e['list'], $col)));
}
$result = '-';
if ($allowedTesting && $test) {
    $result = evalExpressionData($expression, $macrosData, $octet);
}
$style = 'text-align: center;';
if ($result != '-') {
    $style = $result == 'TRUE' ? 'background-color: #ccf; color: #00f;' : 'background-color: #fcc; color: #f00;';
}
$col = new CCol($result);
$col->setAttribute('style', $style);
$res_table->setFooter(array($outline, $col), $res_table->headerClass);
$frm_test->addRow(_('Result'), $res_table);
// action buttons
$btn_test = new CSubmit('test_expression', _('Test'));
if (!$allowedTesting) {
    $btn_test->setAttribute('disabled', 'disabled');
}
$frm_test->addItemToBottomRow($btn_test);
$frm_test->addItemToBottomRow(SPACE);
$btn_close = new CButton('close', _('Close'), 'javascript: self.close();');
$frm_test->addItemToBottomRow($btn_close);
$frm_test->show();
//------------------------ </FORM> ---------------------------
require_once dirname(__FILE__) . '/include/page_footer.php';
开发者ID:quanta-computing,项目名称:debian-packages,代码行数:31,代码来源:tr_testexpr.php

示例7: count

    $hosts_count = CTemplate::get($params);
    $overalCount = $hosts_count['rowscount'];
    $viewCount = count($templates);
    $header = array(is_show_all_nodes() ? new CCol(S_NODE) : null, new CCol(S_TEMPLATES), new CCol(S_ITEMS), new CCol(S_TRIGGERS), new CCol(S_GRAPHS));
    $table = new CTableInfo();
    $table->setHeader($header);
    foreach ($templates as $num => $template) {
        $templateid = $template['hostid'];
        $groupid = isset($hostsgroups[$templateid]) ? $hostsgroups[$templateid] : 0;
        $link = 'groupid=' . $groupid . '&hostid=' . $templateid;
        $caption = make_decoration($template['host'], $search);
        $table->addRow(array(get_node_name_by_elid($templateid), new CLink($caption, 'hosts.php?config=3&hostid=' . $templateid), new CLink(S_GO, 'items.php?' . $link), new CLink(S_GO, 'triggers.php?' . $link), new CLink(S_GO, 'graphs.php?' . $link)));
    }
    $table->setFooter(new CCol(S_DISPLAYING . SPACE . $viewCount . SPACE . S_OF_SMALL . SPACE . $overalCount . SPACE . S_FOUND_SMALL));
    $wdgt_templates = new CWidget('search_templates', $table);
    $wdgt_templates->addHeader(S_TEMPLATES, SPACE);
    $right_tab->addRow($wdgt_templates);
}
//----------------
$td_l = new CCol($left_tab);
$td_l->setAttribute('valign', 'top');
$td_r = new CCol($right_tab);
$td_r->setAttribute('valign', 'top');
$outer_table = new CTable();
$outer_table->setAttribute('border', 0);
$outer_table->setCellPadding(1);
$outer_table->setCellSpacing(1);
$outer_table->addRow(array($td_l, $td_r));
$search_wdgt->addItem($outer_table);
$search_wdgt->show();
include_once 'include/page_footer.php';
开发者ID:phedders,项目名称:zabbix,代码行数:31,代码来源:search.php

示例8: createFlicker

 private function createFlicker($col1, $col2 = null)
 {
     $table = new CTable(null, 'textwhite maxwidth middle flicker');
     $table->setCellSpacing(0);
     $table->setCellPadding(1);
     if (!is_null($col2)) {
         $td_r = new CCol($col2, 'flicker_r');
         $td_r->setAttribute('align', 'right');
         $table->addRow(array(new CCol($col1, 'flicker_l'), $td_r));
     } else {
         $td_c = new CCol($col1, 'flicker_c');
         $td_c->setAttribute('align', 'center');
         $table->addRow($td_c);
     }
     return $table;
 }
开发者ID:TonywalkerCN,项目名称:Zabbix,代码行数:16,代码来源:CWidget.php

示例9: CForm

$imageComboBoxForm = new CForm();
$imageComboBoxForm->addItem(_('Type') . SPACE);
$imageComboBoxForm->addItem($imageComboBox);
$this->data['widget']->addHeader(_('Images'), $imageComboBoxForm);
// form
$imageForm = new CForm();
$imageForm->setName('imageForm');
$imageForm->addItem(BR());
$imageTable = new CTable(_('No images found.'), 'header_wide padding_standard');
$count = 0;
$imageRow = new CRow();
foreach ($this->data['images'] as $image) {
    $img = $image['imagetype'] == IMAGE_TYPE_BACKGROUND ? new CLink(new CImg('imgstore.php?width=200&height=200&iconid=' . $image['imageid'], 'no image'), 'image.php?imageid=' . $image['imageid']) : new CImg('imgstore.php?iconid=' . $image['imageid'], 'no image');
    $nodeName = $this->data['displayNodes'] ? new CSpan($image['nodename'], 'unknown') : null;
    $name = new CLink($image['name'], 'adm.images.php?form=update&imageid=' . $image['imageid']);
    $imgColumn = new CCol();
    $imgColumn->setAttribute('align', 'center');
    $imgColumn->addItem(array($img, BR(), $nodeName, $name), 'center');
    $imageRow->addItem($imgColumn);
    $count++;
    if ($count % 4 == 0) {
        $imageTable->addRow($imageRow);
        $imageRow = new CRow();
    }
}
if ($count > 0) {
    while ($count % 4 != 0) {
        $imageRow->addItem(SPACE);
        $count++;
    }
    $imageTable->addRow($imageRow);
开发者ID:SandipSingh14,项目名称:Zabbix_,代码行数:31,代码来源:administration.general.image.list.php

示例10: CTable

 }
 if (isset($ZBX_SERVER_NAME) && !zbx_empty($ZBX_SERVER_NAME)) {
     $table = new CTable();
     $table->addStyle('width: 100%;');
     $tableColumn = new CCol(new CSpan($ZBX_SERVER_NAME, 'textcolorstyles'));
     if (is_null($node_form)) {
         $tableColumn->addStyle('padding-right: 5px;');
     } else {
         $tableColumn->addStyle('padding-right: 20px; padding-bottom: 2px;');
     }
     $table->addRow(array($tableColumn, $node_form));
     $node_form = $table;
 }
 // 1st level menu
 $table = new CTable(null, 'maxwidth');
 $r_col = new CCol($node_form, 'right');
 $r_col->setAttribute('style', 'line-height: 1.8em;');
 $table->addRow(array($menu_table, $r_col));
 $page_menu = new CDiv(null, 'textwhite');
 $page_menu->setAttribute('id', 'mmenu');
 $page_menu->addItem($table);
 // 2nd level menu
 $sub_menu_table = new CTable(null, 'sub_menu maxwidth ui-widget-header');
 $menu_divs = array();
 $menu_selected = false;
 foreach ($sub_menus as $label => $sub_menu) {
     $sub_menu_row = array();
     foreach ($sub_menu as $id => $sub_page) {
         if (empty($sub_page['menu_text'])) {
             $sub_page['menu_text'] = SPACE;
         }
开发者ID:hujingguang,项目名称:work,代码行数:31,代码来源:page_header.php

示例11: show_messages

function show_messages($bool = true, $okmsg = null, $errmsg = null)
{
    global $page, $ZBX_MESSAGES;
    if (!defined('PAGE_HEADER_LOADED')) {
        return null;
    }
    if (defined('ZBX_API_REQUEST')) {
        return null;
    }
    if (!isset($page['type'])) {
        $page['type'] = PAGE_TYPE_HTML;
    }
    $message = array();
    $width = 0;
    $height = 0;
    if (!$bool && !is_null($errmsg)) {
        $msg = _('ERROR') . ': ' . $errmsg;
    } elseif ($bool && !is_null($okmsg)) {
        $msg = $okmsg;
    }
    if (isset($msg)) {
        switch ($page['type']) {
            case PAGE_TYPE_IMAGE:
                array_push($message, array('text' => $msg, 'color' => !$bool ? array('R' => 255, 'G' => 0, 'B' => 0) : array('R' => 34, 'G' => 51, 'B' => 68), 'font' => 2));
                $width = max($width, imagefontwidth(2) * zbx_strlen($msg) + 1);
                $height += imagefontheight(2) + 1;
                break;
            case PAGE_TYPE_XML:
                echo htmlspecialchars($msg) . "\n";
                break;
            case PAGE_TYPE_HTML:
            default:
                $msg_tab = new CTable($msg, $bool ? 'msgok' : 'msgerr');
                $msg_tab->setCellPadding(0);
                $msg_tab->setCellSpacing(0);
                $row = array();
                $msg_col = new CCol(bold($msg), 'msg_main msg');
                $msg_col->setAttribute('id', 'page_msg');
                $row[] = $msg_col;
                if (isset($ZBX_MESSAGES) && !empty($ZBX_MESSAGES)) {
                    $msg_details = new CDiv(_('Details'), 'blacklink');
                    $msg_details->setAttribute('onclick', 'javascript: showHide("msg_messages", IE ? "block" : "table");');
                    $msg_details->setAttribute('title', _('Maximize') . '/' . _('Minimize'));
                    array_unshift($row, new CCol($msg_details, 'clr'));
                }
                $msg_tab->addRow($row);
                $msg_tab->show();
                break;
        }
    }
    if (isset($ZBX_MESSAGES) && !empty($ZBX_MESSAGES)) {
        if ($page['type'] == PAGE_TYPE_IMAGE) {
            $msg_font = 2;
            foreach ($ZBX_MESSAGES as $msg) {
                if ($msg['type'] == 'error') {
                    array_push($message, array('text' => $msg['message'], 'color' => array('R' => 255, 'G' => 55, 'B' => 55), 'font' => $msg_font));
                } else {
                    array_push($message, array('text' => $msg['message'], 'color' => array('R' => 155, 'G' => 155, 'B' => 55), 'font' => $msg_font));
                }
                $width = max($width, imagefontwidth($msg_font) * zbx_strlen($msg['message']) + 1);
                $height += imagefontheight($msg_font) + 1;
            }
        } elseif ($page['type'] == PAGE_TYPE_XML) {
            foreach ($ZBX_MESSAGES as $msg) {
                echo '[' . $msg['type'] . '] ' . $msg['message'] . "\n";
            }
        } else {
            $lst_error = new CList(null, 'messages');
            foreach ($ZBX_MESSAGES as $msg) {
                $lst_error->addItem($msg['message'], $msg['type']);
                $bool = $bool && 'error' != zbx_strtolower($msg['type']);
            }
            $msg_show = 6;
            $msg_count = count($ZBX_MESSAGES);
            if ($msg_count > $msg_show) {
                $msg_count = $msg_show * 16;
                $lst_error->setAttribute('style', 'height: ' . $msg_count . 'px;');
            }
            $tab = new CTable(null, $bool ? 'msgok' : 'msgerr');
            $tab->setCellPadding(0);
            $tab->setCellSpacing(0);
            $tab->setAttribute('id', 'msg_messages');
            $tab->setAttribute('style', 'width: 100%;');
            if (isset($msg_tab) && $bool) {
                $tab->setAttribute('style', 'display: none;');
            }
            $tab->addRow(new CCol($lst_error, 'msg'));
            $tab->show();
        }
        $ZBX_MESSAGES = null;
    }
    if ($page['type'] == PAGE_TYPE_IMAGE && count($message) > 0) {
        $width += 2;
        $height += 2;
        $canvas = imagecreate($width, $height);
        imagefilledrectangle($canvas, 0, 0, $width, $height, imagecolorallocate($canvas, 255, 255, 255));
        foreach ($message as $id => $msg) {
            $message[$id]['y'] = 1 + (isset($previd) ? $message[$previd]['y'] + $message[$previd]['h'] : 0);
            $message[$id]['h'] = imagefontheight($msg['font']);
            imagestring($canvas, $msg['font'], 1, $message[$id]['y'], $msg['text'], imagecolorallocate($canvas, $msg['color']['R'], $msg['color']['G'], $msg['color']['B']));
//.........这里部分代码省略.........
开发者ID:itnihao,项目名称:Zabbix_,代码行数:101,代码来源:func.inc.php

示例12: CCol

    $helpTextWhenDragInterfaceJMX->addClass('dragHelpText');
    $buttonCol = new CCol(new CButton('addJMXInterface', _('Add'), null, 'link_menu'), 'interface-add-control');
    $col = new CCol($helpTextWhenDragInterfaceJMX);
    $col->setAttribute('colspan', 6);
    $buttonRow = new CRow(array($buttonCol, $col));
    $buttonRow->setAttribute('id', 'JMXIterfacesFooter');
    $ifTab->addRow($buttonRow);
    $hostList->addRow(_('JMX interfaces'), new CDiv($ifTab, 'border_dotted objectgroup inlineblock interface-group'), false, null, 'interface-row');
    // table for IPMI interfaces with footer
    $ifTab = new CTable(null, 'formElementTable');
    $ifTab->setAttribute('id', 'IPMIInterfaces');
    $ifTab->setAttribute('data-type', 'ipmi');
    $helpTextWhenDragInterfaceIPMI = new CSpan(_('Drag here to change the type of the interface to "IPMI" type.'));
    $helpTextWhenDragInterfaceIPMI->addClass('dragHelpText');
    $buttonCol = new CCol(new CButton('addIPMIInterface', _('Add'), null, 'link_menu'), 'interface-add-control');
    $col = new CCol($helpTextWhenDragInterfaceIPMI);
    $col->setAttribute('colspan', 6);
    $buttonRow = new CRow(array($buttonCol, $col));
    $buttonRow->setAttribute('id', 'IPMIIterfacesFooter');
    $ifTab->addRow($buttonRow);
    $hostList->addRow(_('IPMI interfaces'), new CDiv($ifTab, 'border_dotted objectgroup inlineblock interface-group'), false, null, 'interface-row');
} else {
    $interfaces = array();
    $existingInterfaceTypes = array();
    foreach ($dbHost['interfaces'] as $interface) {
        $interface['locked'] = true;
        $existingInterfaceTypes[$interface['type']] = true;
        $interfaces[$interface['interfaceid']] = $interface;
    }
    zbx_add_post_js('hostInterfacesManager.add(' . CJs::encodeJson($interfaces) . ');');
    zbx_add_post_js('hostInterfacesManager.disable()');
开发者ID:SandipSingh14,项目名称:Zabbix_,代码行数:31,代码来源:configuration.host.edit.php

示例13: bodyToString

 public function bodyToString()
 {
     $res = parent::bodyToString();
     $tbl = new CTable(null, $this->tableclass);
     $tbl->setCellSpacing(0);
     $tbl->setCellPadding(1);
     $tbl->setAlign($this->align);
     // add first row
     if (!is_null($this->title)) {
         $col = new CCol(null, 'form_row_first');
         $col->setColSpan(2);
         if (isset($this->help)) {
             $col->addItem($this->help);
         }
         if (isset($this->title)) {
             $col->addItem($this->title);
         }
         $tbl->setHeader($col);
     }
     // add last row
     $tbl->setFooter($this->bottom_items);
     // add center rows
     foreach ($this->center_items as $item) {
         $tbl->addRow($item);
     }
     return $res . $tbl->toString();
 }
开发者ID:SandipSingh14,项目名称:Zabbix_,代码行数:27,代码来源:class.cformtable.php

示例14: get_event_actions_stat_hints

function get_event_actions_stat_hints($eventid)
{
    $actions = new CTable(' - ');
    $sql = 'SELECT COUNT(a.alertid) as cnt ' . ' FROM alerts a ' . ' WHERE a.eventid=' . $eventid . ' AND a.alerttype in (' . ALERT_TYPE_MESSAGE . ',' . ALERT_TYPE_COMMAND . ')';
    $alerts = DBfetch(DBselect($sql));
    if (isset($alerts['cnt']) && $alerts['cnt'] > 0) {
        $sql = 'SELECT COUNT(a.alertid) as sent ' . ' FROM alerts a ' . ' WHERE a.eventid=' . $eventid . ' AND a.alerttype in (' . ALERT_TYPE_MESSAGE . ',' . ALERT_TYPE_COMMAND . ')' . ' AND a.status=' . ALERT_STATUS_SENT;
        $alerts = DBfetch(DBselect($sql));
        $alert_cnt = new CSpan($alerts['sent'], 'green');
        if ($alerts['sent']) {
            $hint = get_actions_hint_by_eventid($eventid, ALERT_STATUS_SENT);
            $alert_cnt->SetHint($hint);
        }
        $tdl = new CCol($alerts['sent'] ? $alert_cnt : SPACE);
        $tdl->addOption('width', '10');
        $sql = 'SELECT COUNT(a.alertid) as inprogress ' . ' FROM alerts a ' . ' WHERE a.eventid=' . $eventid . ' AND a.alerttype in (' . ALERT_TYPE_MESSAGE . ',' . ALERT_TYPE_COMMAND . ')' . ' AND a.status=' . ALERT_STATUS_NOT_SENT;
        $alerts = DBfetch(DBselect($sql));
        $alert_cnt = new CSpan($alerts['inprogress'], 'orange');
        if ($alerts['inprogress']) {
            $hint = get_actions_hint_by_eventid($eventid, ALERT_STATUS_NOT_SENT);
            $alert_cnt->setHint($hint);
        }
        $tdc = new CCol($alerts['inprogress'] ? $alert_cnt : SPACE);
        $tdc->addOption('width', '10');
        $sql = 'SELECT COUNT(a.alertid) as failed ' . ' FROM alerts a ' . ' WHERE a.eventid=' . $eventid . ' AND a.alerttype in (' . ALERT_TYPE_MESSAGE . ',' . ALERT_TYPE_COMMAND . ')' . ' AND a.status=' . ALERT_STATUS_FAILED;
        $alerts = DBfetch(DBselect($sql));
        $alert_cnt = new CSpan($alerts['failed'], 'red');
        if ($alerts['failed']) {
            $hint = get_actions_hint_by_eventid($eventid, ALERT_STATUS_FAILED);
            $alert_cnt->setHint($hint);
        }
        $tdr = new CCol($alerts['failed'] ? $alert_cnt : SPACE);
        $tdr->addOption('width', '10');
        $actions->addRow(array($tdl, $tdc, $tdr));
    }
    return $actions;
}
开发者ID:rennhak,项目名称:zabbix,代码行数:37,代码来源:actions.inc.php

示例15: getEventActionsStatus

function getEventActionsStatus($eventIds)
{
    if (empty($eventIds)) {
        return array();
    }
    $actions = array();
    $alerts = DBselect('SELECT a.eventid,a.status,COUNT(a.alertid) AS cnt' . ' FROM alerts a' . ' WHERE a.alerttype IN (' . ALERT_TYPE_MESSAGE . ',' . ALERT_TYPE_COMMAND . ')' . ' AND ' . dbConditionInt('a.eventid', $eventIds) . ' GROUP BY eventid,status');
    while ($alert = DBfetch($alerts)) {
        $actions[$alert['eventid']][$alert['status']] = $alert['cnt'];
    }
    foreach ($actions as $eventId => $action) {
        $sendCount = isset($action[ALERT_STATUS_SENT]) ? $action[ALERT_STATUS_SENT] : 0;
        $notSendCount = isset($action[ALERT_STATUS_NOT_SENT]) ? $action[ALERT_STATUS_NOT_SENT] : 0;
        $failedCount = isset($action[ALERT_STATUS_FAILED]) ? $action[ALERT_STATUS_FAILED] : 0;
        // calculate total
        $mixed = 0;
        if ($sendCount > 0) {
            $mixed += ALERT_STATUS_SENT;
        }
        if ($failedCount > 0) {
            $mixed += ALERT_STATUS_FAILED;
        }
        // display
        if ($notSendCount > 0) {
            $status = new CSpan(_('In progress'), 'orange');
        } elseif ($mixed == ALERT_STATUS_SENT) {
            $status = new CSpan(_('Ok'), 'green');
        } elseif ($mixed == ALERT_STATUS_FAILED) {
            $status = new CSpan(_('Failed'), 'red');
        } else {
            $columnLeft = new CCol($sendCount > 0 ? new CSpan($sendCount, 'green') : SPACE);
            $columnLeft->setAttribute('width', '10');
            $columnRight = new CCol($failedCount > 0 ? new CSpan($failedCount, 'red') : SPACE);
            $columnRight->setAttribute('width', '10');
            $status = new CRow(array($columnLeft, $columnRight));
        }
        $actions[$eventId] = new CTable(' - ');
        $actions[$eventId]->addRow($status);
    }
    return $actions;
}
开发者ID:SandipSingh14,项目名称:Zabbix_,代码行数:41,代码来源:actions.inc.php


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