本文整理汇总了PHP中zbx_strtolower函数的典型用法代码示例。如果您正苦于以下问题:PHP zbx_strtolower函数的具体用法?PHP zbx_strtolower怎么用?PHP zbx_strtolower使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了zbx_strtolower函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: addItem
public function addItem($value)
{
if (is_object($value) && zbx_strtolower(get_class($value)) != 'carea') {
return $this->error('Incorrect value for addItem "' . $value . '".');
}
return parent::addItem($value);
}
开发者ID:SandipSingh14,项目名称:Zabbix_,代码行数:7,代码来源:class.careamap.php
示例2: addItem
public function addItem($item)
{
if (is_object($item) && zbx_strtolower(get_class($item)) == 'ccol') {
parent::addItem($item);
} elseif (is_array($item)) {
foreach ($item as $el) {
if (is_object($el) && zbx_strtolower(get_class($el)) == 'ccol') {
parent::addItem($el);
} elseif (!is_null($el)) {
parent::addItem(new CCol($el));
}
}
} elseif (!is_null($item)) {
parent::addItem(new CCol($item));
}
}
开发者ID:quanta-computing,项目名称:debian-packages,代码行数:16,代码来源:class.crow.php
示例3: addRow
public function addRow($term, $description = null, $hidden = false, $id = null, $class = null)
{
$label = $term;
if (is_object($description)) {
$inputClass = zbx_strtolower(get_class($description));
if (in_array($inputClass, $this->formInputs)) {
$label = new CLabel($term, $description->getAttribute('id'));
}
}
$defaultClass = $hidden ? 'formrow hidden' : 'formrow';
if ($class === null) {
$class = $defaultClass;
} else {
$class .= ' ' . $defaultClass;
}
if ($description === null) {
$this->formList->addItem(array(new CDiv(SPACE, 'dt right'), new CDiv($label, 'dd')), $class, $id);
} else {
$this->formList->addItem(array(new CDiv($label, 'dt right'), new CDiv($description, 'dd')), $class, $id);
}
}
开发者ID:itnihao,项目名称:zatree-2.2,代码行数:21,代码来源:class.cformlist.php
示例4: addItem
public function addItem($value, $caption = '', $selected = NULL, $enabled = 'yes')
{
// if($enabled=='no') return; /* disable item method 1 */
if (is_object($value) && zbx_strtolower(get_class($value)) == 'ccomboitem') {
parent::addItem($value);
} else {
if (zbx_strlen($caption) > 44) {
$this->setAttribute('class', 'select selectShorten');
}
if (is_null($selected)) {
$selected = 'no';
if (is_array($this->value)) {
if (str_in_array($value, $this->value)) {
$selected = 'yes';
}
} else {
if (strcmp($value, $this->value) == 0) {
$selected = 'yes';
}
}
}
parent::addItem(new CComboItem($value, $caption, $selected, $enabled));
}
}
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:24,代码来源:class.ccombobox.php
示例5: hide_form_items
function hide_form_items(&$obj)
{
if (is_array($obj)) {
foreach ($obj as $id => $item) {
hide_form_items($obj[$id]);
// attention recursion
}
} elseif (is_object($obj)) {
$formObjects = array('cform', 'ccheckbox', 'cselect', 'cbutton', 'csubmit', 'cbuttonqmessage', 'cbuttondelete', 'cbuttoncancel');
if (is_object($obj) && str_in_array(zbx_strtolower(get_class($obj)), $formObjects)) {
$obj = SPACE;
}
if (isset($obj->items) && !empty($obj->items)) {
foreach ($obj->items as $id => $item) {
hide_form_items($obj->items[$id]);
// attention recursion
}
}
} else {
foreach (array('<form', '<input', '<select') as $item) {
if (zbx_strpos($obj, $item) !== false) {
$obj = SPACE;
}
}
}
}
开发者ID:quanta-computing,项目名称:debian-packages,代码行数:26,代码来源:html.inc.php
示例6: DBfetch
function DBfetch(&$cursor)
{
global $DB;
$result = false;
if (isset($DB['DB']) && !empty($DB['DB'])) {
switch ($DB['TYPE']) {
case 'MYSQL':
$result = mysql_fetch_assoc($cursor);
if (!$result) {
mysql_free_result($cursor);
}
break;
case 'POSTGRESQL':
$result = pg_fetch_assoc($cursor);
if (!$result) {
pg_free_result($cursor);
}
break;
case 'ORACLE':
if (ocifetchinto($cursor, $row, OCI_ASSOC + OCI_RETURN_NULLS)) {
$result = array();
foreach ($row as $key => $value) {
$field_type = zbx_strtolower(oci_field_type($cursor, $key));
$value = str_in_array($field_type, array('varchar', 'varchar2', 'blob', 'clob')) && is_null($value) ? '' : $value;
if (is_object($value) && zbx_stristr($field_type, 'lob') !== false) {
$value = $value->load();
}
$result[zbx_strtolower($key)] = $value;
}
}
break;
case 'IBM_DB2':
$result = db2_fetch_assoc($cursor);
if (!$result) {
db2_free_result($cursor);
}
break;
case 'SQLITE3':
if ($cursor) {
$result = array_shift($cursor);
if (is_null($result)) {
$result = false;
}
}
break;
}
}
/*
if($result === false){
switch($DB['TYPE']){
case 'MYSQL': mysql_free_result($cursor); break;
case 'POSTGRESQL': pg_free_result($cursor); break;
case 'ORACLE': oci_free_statement($cursor); break;
}
}
//*/
return $result;
}
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:58,代码来源:db.inc.php
示例7: inherit
protected function inherit($graph, $hostids = null)
{
$graphTemplates = API::Template()->get(array('itemids' => zbx_objectValues($graph['gitems'], 'itemid'), 'output' => API_OUTPUT_SHORTEN, 'nopermissions' => true));
if (empty($graphTemplates)) {
return true;
}
$graphTemplate = reset($graphTemplates);
$chdHosts = API::Host()->get(array('templateids' => $graphTemplate['templateid'], 'output' => array('hostid', 'host'), 'preservekeys' => true, 'hostids' => $hostids, 'nopermissions' => true, 'templated_hosts' => true));
$graph = $this->get(array('graphids' => $graph['graphid'], 'nopermissions' => true, 'filter' => array('flags' => null), 'selectItems' => API_OUTPUT_EXTEND, 'selectGraphItems' => API_OUTPUT_EXTEND, 'output' => API_OUTPUT_EXTEND));
$graph = reset($graph);
foreach ($chdHosts as $chdHost) {
$tmpGraph = $graph;
$tmpGraph['templateid'] = $graph['graphid'];
if (!($tmpGraph['gitems'] = get_same_graphitems_for_host($tmpGraph['gitems'], $chdHost['hostid']))) {
self::exception(ZBX_API_ERROR_PARAMETERS, _s('Graph "%1$s" cannot inherit. No required items on "%2$s".', $tmpGraph['name'], $chdHost['host']));
}
if ($tmpGraph['ymax_itemid'] > 0) {
$ymaxItemid = get_same_graphitems_for_host(array(array('itemid' => $tmpGraph['ymax_itemid'])), $chdHost['hostid']);
if (!$ymaxItemid) {
self::exception(ZBX_API_ERROR_PARAMETERS, _s('Graph "%1$s" cannot inherit. No required items on "%2$s" (Ymax value item).', $tmpGraph['name'], $chdHost['host']));
}
$ymaxItemid = reset($ymaxItemid);
$tmpGraph['ymax_itemid'] = $ymaxItemid['itemid'];
}
if ($tmpGraph['ymin_itemid'] > 0) {
$yminItemid = get_same_graphitems_for_host(array(array('itemid' => $tmpGraph['ymin_itemid'])), $chdHost['hostid']);
if (!$yminItemid) {
self::exception(ZBX_API_ERROR_PARAMETERS, _s('Graph "%1$s" cannot inherit. No required items on "%2$s" (Ymin value item).', $tmpGraph['name'], $chdHost['host']));
}
$yminItemid = reset($yminItemid);
$tmpGraph['ymin_itemid'] = $yminItemid['itemid'];
}
// check if templated graph exists
$chdGraphs = $this->get(array('filter' => array('templateid' => $tmpGraph['graphid'], 'flags' => array(ZBX_FLAG_DISCOVERY_CHILD, ZBX_FLAG_DISCOVERY_NORMAL)), 'output' => API_OUTPUT_EXTEND, 'selectGraphItems' => API_OUTPUT_EXTEND, 'preservekeys' => true, 'hostids' => $chdHost['hostid']));
if ($chdGraph = reset($chdGraphs)) {
if (zbx_strtolower($tmpGraph['name']) != zbx_strtolower($chdGraph['name']) && $this->exists(array('name' => $tmpGraph['name'], 'hostids' => $chdHost['hostid']))) {
self::exception(ZBX_API_ERROR_PARAMETERS, _s('Graph "%1$s" already exists on "%2$s".', $tmpGraph['name'], $chdHost['host']));
} elseif ($chdGraph['flags'] != $tmpGraph['flags']) {
self::exception(ZBX_API_ERROR_PARAMETERS, _('Graph with same name but other type exist.'));
}
$tmpGraph['graphid'] = $chdGraph['graphid'];
$this->updateReal($tmpGraph, $chdGraph);
} else {
$chdGraph = $this->get(array('filter' => array('name' => $tmpGraph['name'], 'flags' => null), 'output' => API_OUTPUT_EXTEND, 'selectGraphItems' => API_OUTPUT_EXTEND, 'preservekeys' => true, 'nopermissions' => true, 'hostids' => $chdHost['hostid']));
if ($chdGraph = reset($chdGraph)) {
if ($chdGraph['templateid'] != 0) {
self::exception(ZBX_API_ERROR_PARAMETERS, _s('Graph "%1$s" already exists on "%2$s" (inherited from another template).', $tmpGraph['name'], $chdHost['host']));
} elseif ($chdGraph['flags'] != $tmpGraph['flags']) {
self::exception(ZBX_API_ERROR_PARAMETERS, _('Graph with same name but other type exist.'));
}
$chdGraphItems = API::GraphItem()->get(array('graphids' => $chdGraph['graphid'], 'output' => API_OUTPUT_EXTEND, 'preservekeys' => true, 'expandData' => true, 'nopermissions' => true));
if (count($chdGraphItems) == count($tmpGraph['gitems'])) {
foreach ($tmpGraph['gitems'] as $gitem) {
foreach ($chdGraphItems as $chdItem) {
if ($gitem['key_'] == $chdItem['key_'] && bccomp($chdHost['hostid'], $chdItem['hostid']) == 0) {
continue 2;
}
}
self::exception(ZBX_API_ERROR_PARAMETERS, _s('Graph "%1$s" already exists on "%2$s" (items are not identical).', $tmpGraph['name'], $chdHost['host']));
}
$tmpGraph['graphid'] = $chdGraph['graphid'];
$this->updateReal($tmpGraph, $chdGraph);
} else {
self::exception(ZBX_API_ERROR_PARAMETERS, _s('Graph "%1$s" already exists on "%2$s" (items are not identical).', $tmpGraph['name'], $chdHost['host']));
}
} else {
$graphid = $this->createReal($tmpGraph);
$tmpGraph['graphid'] = $graphid;
}
}
$this->inherit($tmpGraph);
}
}
开发者ID:quanta-computing,项目名称:debian-packages,代码行数:73,代码来源:CGraphPrototype.php
示例8: 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
示例9: inherit
protected static function inherit($graph, $hostids = null)
{
$options = array('itemids' => zbx_objectValues($graph['gitems'], 'itemid'), 'output' => API_OUTPUT_SHORTEN, 'nopermissions' => 1);
$graph_templates = CTemplate::get($options);
if (empty($graph_templates)) {
return true;
}
//-----
$graphTemplate = reset($graph_templates);
$options = array('templateids' => $graphTemplate['templateid'], 'output' => array('hostid', 'host'), 'preservekeys' => 1, 'hostids' => $hostids, 'nopermissions' => 1, 'templated_hosts' => 1);
$chd_hosts = CHost::get($options);
$options = array('graphids' => $graph['graphid'], 'nopermissions' => 1, 'select_items' => API_OUTPUT_EXTEND, 'select_graph_items' => API_OUTPUT_EXTEND, 'output' => API_OUTPUT_EXTEND);
$graph = self::get($options);
$graph = reset($graph);
foreach ($chd_hosts as $chd_host) {
$tmp_graph = $graph;
$tmp_graph['templateid'] = $graph['graphid'];
if (!($tmp_graph['gitems'] = get_same_graphitems_for_host($tmp_graph['gitems'], $chd_host['hostid']))) {
self::exception(ZBX_API_ERROR_PARAMETERS, 'Graph [ ' . $tmp_graph['name'] . ' ]: cannot inherit. No required items on [ ' . $chd_host['host'] . ' ]');
}
if ($tmp_graph['ymax_itemid'] > 0) {
$ymax_itemid = get_same_graphitems_for_host(array(array('itemid' => $tmp_graph['ymax_itemid'])), $chd_host['hostid']);
if (!$ymax_itemid) {
self::exception(ZBX_API_ERROR_PARAMETERS, 'Graph [ ' . $tmp_graph['name'] . ' ]: cannot inherit. No required items on [ ' . $chd_host['host'] . ' ] (Ymax value item)');
}
$ymax_itemid = reset($ymax_itemid);
$tmp_graph['ymax_itemid'] = $ymax_itemid['itemid'];
}
if ($tmp_graph['ymin_itemid'] > 0) {
$ymin_itemid = get_same_graphitems_for_host(array(array('itemid' => $tmp_graph['ymin_itemid'])), $chd_host['hostid']);
if (!$ymin_itemid) {
self::exception(ZBX_API_ERROR_PARAMETERS, 'Graph [ ' . $tmp_graph['name'] . ' ]: cannot inherit. No required items on [ ' . $chd_host['host'] . ' ] (Ymin value item)');
}
$ymin_itemid = reset($ymin_itemid);
$tmp_graph['ymin_itemid'] = $ymin_itemid['itemid'];
}
// check if templated graph exists
$chd_graph = self::get(array('filter' => array('templateid' => $tmp_graph['graphid']), 'output' => API_OUTPUT_EXTEND, 'preservekeys' => 1, 'hostids' => $chd_host['hostid']));
if ($chd_graph = reset($chd_graph)) {
if (zbx_strtolower($tmp_graph['name']) != zbx_strtolower($chd_graph['name']) && self::exists(array('name' => $tmp_graph['name'], 'hostids' => $chd_host['hostid']))) {
self::exception(ZBX_API_ERROR_PARAMETERS, sprintf(S_GRAPH_ALREADY_EXISTS_ON, $tmp_graph['name'], $chd_host['host']));
}
$tmp_graph['graphid'] = $chd_graph['graphid'];
self::updateReal($tmp_graph);
} else {
$options = array('filter' => array('name' => $tmp_graph['name']), 'output' => API_OUTPUT_EXTEND, 'preservekeys' => 1, 'nopermissions' => 1, 'hostids' => $chd_host['hostid']);
$chd_graph = self::get($options);
if ($chd_graph = reset($chd_graph)) {
if ($chd_graph['templateid'] != 0) {
self::exception(ZBX_API_ERROR_PARAMETERS, sprintf(S_GRAPH_ALREADY_EXISTS_ON, $tmp_graph['name'], $chd_host['host']) . SPACE . S_INHERITED_FROM_ANOTHER_TEMPLATE);
}
$options = array('graphids' => $chd_graph['graphid'], 'output' => API_OUTPUT_EXTEND, 'preservekeys' => 1, 'expandData' => 1, 'nopermissions' => 1);
$chd_graph_items = CGraphItem::get($options);
if (count($chd_graph_items) == count($tmp_graph['gitems'])) {
foreach ($tmp_graph['gitems'] as $gitem) {
foreach ($chd_graph_items as $chd_item) {
if ($gitem['key_'] == $chd_item['key_'] && bccomp($chd_host['hostid'], $chd_item['hostid']) == 0) {
continue 2;
}
}
self::exception(ZBX_API_ERROR_PARAMETERS, sprintf(S_GRAPH_ALREADY_EXISTS_ON, $tmp_graph['name'], $chd_host['host']) . SPACE . S_ITEMS_ARE_NOT_IDENTICAL);
}
$tmp_graph['graphid'] = $chd_graph['graphid'];
self::updateReal($tmp_graph);
} else {
self::exception(ZBX_API_ERROR_PARAMETERS, sprintf(S_GRAPH_ALREADY_EXISTS_ON, $tmp_graph['name'], $chd_host['host']) . SPACE . S_ITEMS_ARE_NOT_IDENTICAL);
}
} else {
$graphid = self::createReal($tmp_graph);
$tmp_graph['graphid'] = $graphid;
}
}
self::inherit($tmp_graph);
}
}
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:75,代码来源:class.cgraph.php
示例10: setHeader
public function setHeader($value = null, $class = 'header')
{
if (is_null($class)) {
$class = $this->headerClass;
}
if (is_object($value) && zbx_strtolower(get_class($value)) == 'crow') {
if (!is_null($class)) {
$value->setAttribute('class', $class);
}
} else {
$value = new CRow($value, $class);
}
$this->colnum = $value->itemsCount();
$this->header = $value->toString();
}
开发者ID:SandipSingh14,项目名称:Zabbix_,代码行数:15,代码来源:class.ctable.php
示例11: str2mem
function str2mem($val)
{
$val = trim($val);
$last = zbx_strtolower(zbx_substr($val, -1, 1));
switch ($last) {
// The 'G' modifier is available since PHP 5.1.0
case 'g':
$val *= 1024;
case 'm':
$val *= 1024;
case 'k':
$val *= 1024;
}
return $val;
}
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:15,代码来源:func.inc.php
示例12: foreach
if ($data['pageFilter']->groupid > 0) {
$options['groupids'] = $data['pageFilter']->groupid;
}
$data['hosts'] = API::Host()->get($options);
// copy some inventory fields to the uppers array level for sorting
// and filter out hosts if we are using filter
foreach ($data['hosts'] as $num => $host) {
$data['hosts'][$num]['pr_name'] = $host['inventory']['name'];
$data['hosts'][$num]['pr_type'] = $host['inventory']['type'];
$data['hosts'][$num]['pr_os'] = $host['inventory']['os'];
$data['hosts'][$num]['pr_serialno_a'] = $host['inventory']['serialno_a'];
$data['hosts'][$num]['pr_tag'] = $host['inventory']['tag'];
$data['hosts'][$num]['pr_macaddress_a'] = $host['inventory']['macaddress_a'];
// if we are filtering by inventory field
if (!empty($data['filterField']) && !empty($data['filterFieldValue'])) {
// must we filter exactly or using a substring (both are case insensitive)
$match = $data['filterExact'] ? zbx_strtolower($data['hosts'][$num]['inventory'][$data['filterField']]) === zbx_strtolower($data['filterFieldValue']) : zbx_strpos(zbx_strtolower($data['hosts'][$num]['inventory'][$data['filterField']]), zbx_strtolower($data['filterFieldValue'])) !== false;
if (!$match) {
unset($data['hosts'][$num]);
}
}
}
order_result($data['hosts'], getPageSortField('name'), getPageSortOrder());
}
}
$data['paging'] = getPagingLine($data['hosts']);
$hostinventoriesView = new CView('inventory.host.list', $data);
$hostinventoriesView->render();
$hostinventoriesView->show();
}
require_once dirname(__FILE__) . '/include/page_footer.php';
开发者ID:SandipSingh14,项目名称:Zabbix_,代码行数:31,代码来源:hostinventories.php
示例13: get_items_data_overview
function get_items_data_overview($hostids, $view_style = null)
{
global $USER_DETAILS;
if (is_null($view_style)) {
$view_style = CProfile::get('web.overview.view.style', STYLE_TOP);
}
$table = new CTableInfo(S_NO_ITEMS_DEFINED);
// COpt::profiling_start('prepare_data');
$result = DBselect('SELECT DISTINCT h.hostid, h.host,i.itemid, i.key_, i.value_type, i.lastvalue, i.units, ' . ' i.description, t.priority, i.valuemapid, t.value as tr_value, t.triggerid ' . ' FROM hosts h, items i ' . ' LEFT JOIN functions f on f.itemid=i.itemid ' . ' LEFT JOIN triggers t on t.triggerid=f.triggerid and t.status=' . TRIGGER_STATUS_ENABLED . ' WHERE ' . DBcondition('h.hostid', $hostids) . ' AND h.status=' . HOST_STATUS_MONITORED . ' AND h.hostid=i.hostid ' . ' AND i.status=' . ITEM_STATUS_ACTIVE . ' ORDER BY i.description,i.itemid');
unset($items);
unset($hosts);
// get rid of warnings about $triggers undefined
$items = array();
while ($row = DBfetch($result)) {
$descr = item_description($row);
$row['host'] = get_node_name_by_elid($row['hostid'], null, ': ') . $row['host'];
$hosts[zbx_strtolower($row['host'])] = $row['host'];
// A little tricky check for attempt to overwrite active trigger (value=1) with
// inactive or active trigger with lower priority.
if (!isset($items[$descr][$row['host']]) || ($items[$descr][$row['host']]['tr_value'] == TRIGGER_VALUE_FALSE && $row['tr_value'] == TRIGGER_VALUE_TRUE || ($items[$descr][$row['host']]['tr_value'] == TRIGGER_VALUE_FALSE || $row['tr_value'] == TRIGGER_VALUE_TRUE) && $row['priority'] > $items[$descr][$row['host']]['severity'])) {
$items[$descr][$row['host']] = array('itemid' => $row['itemid'], 'value_type' => $row['value_type'], 'lastvalue' => $row['lastvalue'], 'units' => $row['units'], 'description' => $row['description'], 'valuemapid' => $row['valuemapid'], 'severity' => $row['priority'], 'tr_value' => $row['tr_value'], 'triggerid' => $row['triggerid']);
}
}
if (!isset($hosts)) {
return $table;
}
ksort($hosts, SORT_STRING);
// COpt::profiling_stop('prepare_data');
// COpt::profiling_start('prepare_table');
$css = getUserTheme($USER_DETAILS);
$vTextColor = $css == 'css_od.css' ? '&color=white' : '';
if ($view_style == STYLE_TOP) {
$header = array(new CCol(S_ITEMS, 'center'));
foreach ($hosts as $hostname) {
$header = array_merge($header, array(new CImg('vtext.php?text=' . $hostname . $vTextColor)));
}
$table->SetHeader($header, 'vertical_header');
$curr_rime = time();
foreach ($items as $descr => $ithosts) {
$table_row = array(nbsp($descr));
foreach ($hosts as $hostname) {
$table_row = get_item_data_overview_cells($table_row, $ithosts, $hostname);
}
$table->AddRow($table_row);
}
} else {
$header = array(new CCol(S_HOSTS, 'center'));
foreach ($items as $descr => $ithosts) {
$header = array_merge($header, array(new CImg('vtext.php?text=' . $descr . $vTextColor)));
}
$table->SetHeader($header, 'vertical_header');
$curr_rime = time();
foreach ($hosts as $hostname) {
$table_row = array(nbsp($hostname));
foreach ($items as $descr => $ithosts) {
$table_row = get_item_data_overview_cells($table_row, $ithosts, $hostname);
}
$table->AddRow($table_row);
}
}
// COpt::profiling_stop('prepare_table');
return $table;
}
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:63,代码来源:items.inc.php
示例14: 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;
}
$imageMessages = array();
if (!$bool && !is_null($errmsg)) {
$msg = _('ERROR') . ': ' . $errmsg;
} elseif ($bool && !is_null($okmsg)) {
$msg = $okmsg;
}
if (isset($msg)) {
switch ($page['type']) {
case PAGE_TYPE_IMAGE:
// save all of the messages in an array to display them later in an image
$imageMessages[] = array('text' => $msg, 'color' => !$bool ? array('R' => 255, 'G' => 0, 'B' => 0) : array('R' => 34, 'G' => 51, 'B' => 68));
break;
case PAGE_TYPE_XML:
echo htmlspecialchars($msg) . "\n";
break;
case PAGE_TYPE_HTML:
default:
$msg_tab = new CTable($msg, $bool ? 'msgok' : 'msgerr');
$msg_tab->setCellPadding(0);
$msg_tab->setCellSpacing(0);
$row = array();
$msg_col = new CCol(bold($msg), 'msg_main msg');
$msg_col->setAttribute('id', 'page_msg');
$row[] = $msg_col;
if (isset($ZBX_MESSAGES) && !empty($ZBX_MESSAGES)) {
$msg_details = new CDiv(_('Details'), 'blacklink');
$msg_details->setAttribute('onclick', 'javascript: showHide("msg_messages", IE ? "block" : "table");');
$msg_details->setAttribute('title', _('Maximize') . '/' . _('Minimize'));
array_unshift($row, new CCol($msg_details, 'clr'));
}
$msg_tab->addRow($row);
$msg_tab->show();
break;
}
}
if (isset($ZBX_MESSAGES) && !empty($ZBX_MESSAGES)) {
if ($page['type'] == PAGE_TYPE_IMAGE) {
foreach ($ZBX_MESSAGES as $msg) {
// save all of the messages in an array to display them later in an image
if ($msg['type'] == 'error') {
$imageMessages[] = array('text' => $msg['message'], 'color' => array('R' => 255, 'G' => 55, 'B' => 55));
} else {
$imageMessages[] = array('text' => $msg['message'], 'color' => array('R' => 155, 'G' => 155, 'B' => 55));
}
}
} elseif ($page['type'] == PAGE_TYPE_XML) {
foreach ($ZBX_MESSAGES as $msg) {
echo '[' . $msg['type'] . '] ' . $msg['message'] . "\n";
}
} else {
$lst_error = new CList(null, 'messages');
foreach ($ZBX_MESSAGES as $msg) {
$lst_error->addItem($msg['message'], $msg['type']);
$bool = $bool && 'error' != 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;
}
// draw an image with the messages
if ($page['type'] == PAGE_TYPE_IMAGE && count($imageMessages) > 0) {
$imageFontSize = 8;
// calculate the size of the text
$imageWidth = 0;
$imageHeight = 0;
foreach ($imageMessages as &$msg) {
$size = imageTextSize($imageFontSize, 0, $msg['text']);
$msg['height'] = $size['height'] - $size['baseline'];
// calculate the total size of the image
$imageWidth = max($imageWidth, $size['width']);
$imageHeight += $size['height'] + 1;
}
unset($msg);
//.........这里部分代码省略.........
开发者ID:davidmr001,项目名称:zatree-2.2,代码行数:101,代码来源:func.inc.php
示例15: addRow
public function addRow($item1, $item2 = null, $class = null, $id = null)
{
if (is_object($item1) && zbx_strtolower(get_class($item1)) == 'crow') {
} elseif (is_object($item1) && zbx_strtolower(get_class($item1)) == 'ctable') {
$td = new CCol($item1, 'form_row_c');
$td->setColSpan(2);
$item1 = new CRow($td);
} else {
if (is_string($item1)) {
$item1 = nbsp($item1);
}
if (empty($item1)) {
$item1 = SPACE;
}
if (empty($item2)) {
$item2 = SPACE;
}
$item1 = new CRow(array(new CCol($item1, 'form_row_l'), new CCol($item2, 'form_row_r')), $class);
}
if (!is_null($id)) {
$item1->attr('id', zbx_formatDomId($id));
}
array_push($this->center_items, $item1);
return $item1;
}
开发者ID:SandipSingh14,项目名称:Zabbix_,代码行数:25,代码来源:class.cformtable.php
示例16: addRow
public function addRow($item1, $item2 = NULL, $class = NULL)
{
if (is_object($item1) && zbx_strtolower(get_class($item1)) == 'crow') {
} else {
if (is_object($item1) && zbx_strtolower(get_class($item1)) == 'ctable') {
$td = new CCol($item1, 'form_row_c');
$td->setColSpan(2);
$item1 = new CRow($td);
} else {
$tmp = $item1;
if (is_string($item1)) {
$item1 = nbsp($item1);
}
if (empty($item1)) {
$item1 = SPACE;
}
if (empty($item2)) {
$item2 = SPACE;
}
$item1 = new CRow(array(new CCol($item1, 'form_row_l'), new CCol($item2, 'form_row_r')), $class);
}
}
array_push($this->center_items, $item1);
return $item1;
}
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:25,代码来源:class.cformtable.php
示例17: _json_decode
/**
* Decodes a JSON string into appropriate variable.
*
* Note: several changes were made in translating this method from
* Services_JSON, particularly related to how strings are handled. According
* to JSON_checker test suite from <http://www.json.org/JSON_checker/>,
* a JSON payload should be an object or an array, not a string.
*
* Therefore, returning bool(true) for 'true' is invalid JSON decoding
* behavior, unless nested inside of an array or object.
*
* Similarly, a string of '1' should return null, not int(1), unless
* nested inside of an array or object.
*
* @param string $str String encoded in JSON format
* @param bool $asArray Optional argument to decode as an array.
* @return mixed decoded value
* @todo Rewrite this based off of method used in Solar_Json_Checker
*/
protected function _json_decode($str, $asArray = false)
{
$str = $this->_reduce_string($str);
switch (zbx_strtolower($str)) {
case 'true':
// JSON_checker test suite claims
// "A JSON payload should be an object or array, not a string."
// Thus, returning bool(true) is invalid parsing, unless
// we're nested inside an array or object.
if (in_array($this->_level, array(self::IN_ARR, self::IN_OBJ))) {
return true;
} else {
return null;
}
break;
case 'false':
// JSON_checker test suite claims
// "A JSON payload should be an object or array, not a string."
// Thus, returning bool(false) is invalid parsing, unless
// we're nested inside an array or object.
if (in_array($this->_level, array(self::IN_ARR, self::IN_OBJ))) {
return false;
} else {
return null;
}
break;
case 'null':
return null;
default:
$m = array();
if (is_numeric($str) || ctype_digit($str) || ctype_xdigit($str)) {
// return float or int, or null as appropriate
if (in_array($this->_level, array(self::IN_ARR, self::IN_OBJ))) {
return (double) $str == (int) $str ? (int) $str : (double) $str;
} else {
return null;
}
break;
} elseif (preg_match('/^("|\').*(\\1)$/s', $str, $m) && $m[1] == $m[2]) {
// strings returned in UTF-8 format
$delim = substr($str, 0, 1);
$chrs = substr($str, 1, -1);
$utf8 = '';
$strlen_chrs = zbx_strlen($chrs);
for ($c = 0; $c < $strlen_chrs; ++$c) {
$substr_chrs_c_2 = substr($chrs, $c, 2);
$ord_chrs_c = ord($chrs[$c]);
switch (true) {
case $substr_chrs_c_2 == '\\b':
$utf8 .= chr(0x8);
++$c;
break;
case $substr_chrs_c_2 == '\\t':
$utf8 .= chr(0x9);
++$c;
break;
case $substr_chrs_c_2 == '\\n':
$utf8 .= chr(0xa);
++$c;
break;
case $substr_chrs_c_2 == '\\f':
$utf8 .= chr(0xc);
++$c;
break;
case $substr_chrs_c_2 == '\\r':
$utf8 .= chr(0xd);
++$c;
break;
case $substr_chrs_c_2 == '\\"':
case $substr_chrs_c_2 == '\\\'':
case $substr_chrs_c_2 == '\\\\':
case $substr_chrs_c_2 == '\\/':
if ($delim == '"' && $substr_chrs_c_2 != '\\\'' || $delim == "'" && $substr_chrs_c_2 != '\\"') {
$utf8 .= $chrs[++$c];
}
break;
case preg_match('/\\\\u[0-9A-F]{4}/i', substr($chrs, $c, 6)):
// single, escaped unicode character
$utf16 = chr(hexdec(substr($chrs, $c + 2, 2))) . chr(hexdec(substr($chrs, $c + 4, 2)));
$utf8 .= $this->_utf162utf8($utf16);
$c += 5;
//.........这里部分代码省略.........
开发者ID:SandipSingh14,项目名称:Zabbix_,代码行数:101,代码来源:class.cjson.php
示例18: DBfetch
/**
* Returns the next data set from a DB resource or false if there are no more results.
*
* @param resource $cursor
* @param bool $convertNulls convert all null values to string zeroes
*
* @return array|bool
*/
function DBfetch($cursor, $convertNulls = true)
{
global $DB;
$result = false;
if (!isset($DB['DB']) || empty($DB['DB']) || is_bool($cursor)) {
return $result;
}
switch ($DB['TYPE'
|
请发表评论