本文整理汇总了PHP中nicecase函数的典型用法代码示例。如果您正苦于以下问题:PHP nicecase函数的具体用法?PHP nicecase怎么用?PHP nicecase使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了nicecase函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: html_callback
/**
* Used for replace some strings at end of run all html scripts
*
* @param string $buffer HTML buffer from ob_start()
* @return string Changed buffer
*/
function html_callback($buffer)
{
global $config;
// Install registered CSS/JS links
$types = array('css' => ' <link href="STRING?v=' . OBSERVIUM_VERSION . '" rel="stylesheet" type="text/css" />' . PHP_EOL, 'js' => ' <script type="text/javascript" src="STRING?v=' . OBSERVIUM_VERSION . '"></script>' . PHP_EOL, 'script' => ' <script type="text/javascript">' . PHP_EOL . ' <!-- Begin' . PHP_EOL . 'STRING' . PHP_EOL . ' // End -->' . PHP_EOL . ' </script>' . PHP_EOL);
foreach ($types as $type => $string) {
if (isset($GLOBALS['cache_html']['resources'][$type])) {
$uptype = strtoupper($type);
${$type} = '<!-- ' . $uptype . ' BEGIN -->' . PHP_EOL;
foreach (array_unique($GLOBALS['cache_html']['resources'][$type]) as $link) {
${$type} .= str_replace('STRING', $link, $string);
}
${$type} .= ' <!-- ' . $uptype . ' END -->' . PHP_EOL;
$buffer = str_replace('<!-- ##' . $uptype . '_CACHE## -->' . PHP_EOL, ${$type}, $buffer);
}
}
// Replace page title as specified by the page modules
if (!is_array($GLOBALS['cache_html']['title'])) {
// Title not set by any page, fall back to nicecase'd page name:
if ($GLOBALS['vars']['page']) {
$GLOBALS['cache_html']['title'] = array(nicecase($GLOBALS['vars']['page']));
} else {
// HALP. Likely main page, doesn't need anything else...
$GLOBALS['cache_html']['title'] = array();
}
}
// If suffix is set, put it in the back
if ($config['page_title_suffix']) {
$GLOBALS['cache_html']['title'][] = $config['page_title_suffix'];
}
// If prefix is set, put it in front
if ($config['page_title_prefix']) {
array_unshift($GLOBALS['cache_html']['title'], $config['page_title_prefix']);
}
// Build title with separators
$title = implode($config['page_title_separator'], $GLOBALS['cache_html']['title']);
// Replace title placeholder by actual title
$buffer = str_replace('##TITLE##', $title, $buffer);
// Page panel
$buffer = str_replace('##PAGE_PANEL##', $GLOBALS['cache_html']['page_panel'], $buffer);
// Return modified HTML page source
return $buffer;
}
示例2: generate_entity_popup_graphs
function generate_entity_popup_graphs($entity, $vars)
{
global $config;
$entity_type = $vars['entity_type'];
if (is_array($config['entities'][$entity_type]['graph'])) {
if (isset($config['entities'][$entity_type]['graph']['type'])) {
$graphs[] = $config['entities'][$entity_type]['graph'];
} else {
$graphs = $config['entities'][$entity_type]['graph'];
}
foreach ($graphs as $graph_array) {
//$graph_array = $config['entities'][$entity_type]['graph'];
// We can draw a graph for this type/metric pair!
foreach ($graph_array as $key => $val) {
// Check to see if we need to do any substitution
if (substr($val, 0, 1) == "@") {
$nval = substr($val, 1);
$graph_array[$key] = $entity[$nval];
}
}
$graph_array['height'] = "100";
$graph_array['width'] = "323";
$content = '<div style="white-space: nowrap;">';
$content .= "<div class=entity-title><h4>" . nicecase(str_replace("_", " ", $graph_array['type'])) . "</h4></div>";
/*
$content = generate_box_open(array('title' => nicecase(str_replace("_", " ", $graph_array['type'])),
'body-style' => 'white-space: nowrap;'));
*/
foreach (array('day', 'month') as $period) {
$graph_array['from'] = $config['time'][$period];
$content .= generate_graph_tag($graph_array);
}
$content .= "</div>";
//$content .= generate_box_close();
}
//r($content);
return $content;
}
}
示例3: foreach
// 'poller_perf' => 'Poll Time'
// );
foreach (array('graphs') as $type) {
/// FIXME. Weird graph menu, they too long and not actual for all devices,
/// but here also not posible use sql query from `device_graphs` because here not stored all graphs
/*
$query = 'SELECT `graph` FROM `device_graphs`
LEFT JOIN `devices` ON `devices`.`device_id` = `device_graphs`.`device_id`';
$query .= $where . $query_permitted . ' AND `device_graphs`.`enabled` = 1 GROUP BY `graph`';
foreach (dbFetchColumn($query) as $option)
{
$data = $config['graph_types']['device'][$option];
*/
foreach ($config['graph_types']['device'] as $option => $data) {
if (!isset($data['descr'])) {
$data['descr'] = nicecase($option);
}
if ($vars['format'] == $type && $vars['graph'] == $option) {
$navbar['options'][$type]['suboptions'][$option]['class'] = 'active';
$navbar['options'][$type]['text'] .= " (" . $data['descr'] . ')';
}
$navbar['options'][$type]['suboptions'][$option]['text'] = $data['descr'];
$navbar['options'][$type]['suboptions'][$option]['url'] = generate_url($vars, array('view' => NULL, 'format' => $type, 'graph' => $option));
}
}
if ($vars['searchbar'] == "hide") {
$navbar['options_right']['searchbar'] = array('text' => 'Show Search', 'url' => generate_url($vars, array('searchbar' => NULL)));
} else {
$navbar['options_right']['searchbar'] = array('text' => 'Hide Search', 'url' => generate_url($vars, array('searchbar' => 'hide')));
}
if ($vars['bare'] == "yes") {
示例4: testNiceCase
/**
* @dataProvider providerNiceCase
*/
public function testNiceCase($string, $result)
{
$this->assertSame($result, nicecase($string));
}
示例5: rewrite_entity_name
$oid = ".1.3.6.1.2.1.99.1.1.1.4.{$index}";
$type = $entitysensor[$entry['entPhySensorType']];
$descr = rewrite_entity_name($entry['entPhysicalDescr']);
if ($entry['entPhysicalDescr'] && $entry['entPhysicalName']) {
// Check if entPhysicalDescr equals entPhysicalName,
// Also compare like this: 'TenGigabitEthernet2/1 Bias Current' and 'Te2/1 Bias Current'
if (strpos($entry['entPhysicalDescr'], substr($entry['entPhysicalName'], 2)) === FALSE) {
$descr = rewrite_entity_name($entry['entPhysicalDescr']) . ' - ' . rewrite_entity_name($entry['entPhysicalName']);
}
} else {
if (!$entry['entPhysicalDescr'] && $entry['entPhysicalName']) {
$descr = rewrite_entity_name($entry['entPhysicalName']);
} else {
if (!$entry['entPhysicalDescr'] && !$entry['entPhysicalName']) {
// This is also trick for some retard devices like NetMan Plus
$descr = nicecase($type);
}
}
}
if ($device['os'] == 'asa' && $entry['entPhySensorScale'] == 'yocto' && $entry['entPhySensorPrecision'] == '0') {
// Hardcoded fix for Cisco ASA 9.1.5 (can be other) bug when all scales equals yocto (OBSERVIUM-1110)
$scale = 1;
} else {
if (isset($entry['entPhySensorScale'])) {
$scale = si_to_scale($entry['entPhySensorScale'], $entry['entPhySensorPrecision']);
} else {
// Some devices not report scales, like NetMan Plus. But this is really HACK
// Heh, I not know why only ups.. I'm not sure that this for all ups.. just I see this only on NetMan Plus.
$scale = $device['os_group'] == 'ups' && $type == 'temperature' ? 0.1 : 1;
}
}
示例6: dbFetchCell
</ul>
</li>
<?php
$app_count = dbFetchCell("SELECT COUNT(`app_id`) FROM `applications`");
if ($_SESSION['userlevel'] >= '5' && $app_count > "0") {
?>
<li class="dropdown">
<a href="apps/" class="dropdown-toggle" data-hover="dropdown" data-toggle="dropdown"><img src="images/icons/apps.png" border="0" align="absmiddle" /> Apps<b class="caret"></b></a>
<ul class="dropdown-menu">
<?php
$app_list = dbFetchRows("SELECT `app_type` FROM `applications` GROUP BY `app_type` ORDER BY `app_type`");
foreach ($app_list as $app) {
$image = $config['html_dir'] . "/images/icons/" . $row['app_type'] . ".png";
$icon = file_exists($image) ? $row['app_type'] : "apps";
echo '
<li><a href="apps/app=' . $app['app_type'] . '/"><img src="images/icons/' . $icon . '.png" border="0" align="absmiddle" /> ' . nicecase($app['app_type']) . ' </a></li>';
}
?>
</ul>
</li>
<?php
}
$routing_count['bgp'] = dbFetchCell("SELECT COUNT(bgpPeer_id) from `bgpPeers` LEFT JOIN devices AS D ON bgpPeers.device_id=D.device_id WHERE D.device_id IS NOT NULL");
$routing_count['ospf'] = dbFetchCell("SELECT COUNT(ospf_instance_id) FROM `ospf_instances` WHERE `ospfAdminStat` = 'enabled'");
$routing_count['cef'] = dbFetchCell("SELECT COUNT(cef_switching_id) from `cef_switching`");
$routing_count['vrf'] = dbFetchCell("SELECT COUNT(vrf_id) from `vrfs`");
if ($_SESSION['userlevel'] >= '5' && $routing_count['bgp'] + $routing_count['ospf'] + $routing_count['cef'] + $routing_count['vrf'] > "0") {
?>
<li class="dropdown">
<a href="routing/" class="dropdown-toggle" data-hover="dropdown" data-toggle="dropdown"><img src="images/16/arrow_branch.png" border="0" align="absmiddle" /> Routing<b class="caret"></b></a>
<ul class="dropdown-menu">
示例7: foreach
<tr>
<th>Name</th>
<th>Description</th>
<th>Section</th>
<th style="width: 80;">Status</th>
<th style="width: 80;"></th>
</tr>
</thead>
<tbody>
<?php
foreach ($graphs_sections as $section => $entry) {
foreach ($entry as $graph => $enabled) {
echo '<tr><td><strong>' . $graph . '</strong></td><td>';
echo $config['graph_types']['device'][$graph]['descr'] . '</td><td>';
echo nicecase($section) . '</td><td>';
if (!$enabled) {
$attrib_status = '<span class="text-danger">disabled</span>';
$toggle = 'Enable';
$btn_class = 'btn-success';
} else {
$attrib_status = '<span class="text-success">enabled</span>';
$toggle = "Disable";
$btn_class = "btn-danger";
}
echo $attrib_status . '</td><td>';
if (!in_array($section, array('poller', 'system'))) {
echo '<form id="toggle_graph" name="toggle_graph" style="margin: 0px;" method="post" action="">
<input type="hidden" name="toggle_graph" value="' . $graph . '">
<button type="submit" class="btn btn-mini ' . $btn_class . '" name="Submit">' . $toggle . '</button></form>';
} else {
示例8: array
$graphs['bind'] = array('queries');
$graphs['tinydns'] = array('queries', 'errors', 'dnssec', 'other');
print_optionbar_start();
echo "<span style='font-weight: bold;'>Apps</span> » ";
unset($sep);
$link_array = array('page' => 'device', 'device' => $device['device_id'], 'tab' => 'apps');
foreach ($app_list as $app) {
echo $sep;
# if (!$vars['app']) { $vars['app'] = $app['app_type']; }
if ($vars['app'] == $app['app_type']) {
echo "<span class='pagemenu-selected'>";
#echo('<img src="images/icons/'.$app['app_type'].'.png" class="optionicon" />');
} else {
#echo('<img src="images/icons/greyscale/'.$app['app_type'].'.png" class="optionicon" />');
}
echo generate_link(nicecase($app['app_type']), array('page' => 'apps', 'app' => $app['app_type']));
if ($vars['app'] == $app['app_type']) {
echo "</span>";
}
$sep = " | ";
}
print_optionbar_end();
if ($vars['app']) {
if (is_file("pages/apps/" . mres($vars['app']) . ".inc.php")) {
include "pages/apps/" . mres($vars['app']) . ".inc.php";
} else {
include "pages/apps/default.inc.php";
}
} else {
include "pages/apps/overview.inc.php";
}
示例9: print_optionbar_start
<?php
global $config;
print_optionbar_start();
echo "<span style='font-weight: bold;'>" . nicecase($app['app_type']) . "</span> » ";
$app_sections = array('system' => "System", 'queries' => "Queries", 'innodb' => "InnoDB");
unset($sep);
foreach ($app_sections as $app_section => $app_section_text) {
echo $sep;
if (!$vars['app_section']) {
$vars['app_section'] = $app_section;
}
if ($vars['app_section'] == $app_section) {
echo "<span class='pagemenu-selected'>";
}
echo generate_link($app_section_text, $vars, array('app_section' => $app_section));
if ($vars['app_section'] == $app_section) {
echo "</span>";
}
$sep = " | ";
}
print_optionbar_end();
$graphs['system'] = array('mysql_connections' => 'Connections', 'mysql_files_tables' => 'Files and Tables', 'mysql_myisam_indexes' => 'MyISAM Indexes', 'mysql_network_traffic' => 'Network Traffic', 'mysql_table_locks' => 'Table Locks', 'mysql_temporary_objects' => 'Temporary Objects');
$graphs['queries'] = array('mysql_command_counters' => 'Command Counters', 'mysql_query_cache' => 'Query Cache', 'mysql_query_cache_memory' => 'Query Cache Memory', 'mysql_select_types' => 'Select Types', 'mysql_slow_queries' => 'Slow Queries', 'mysql_sorts' => 'Sorts');
$graphs['innodb'] = array('mysql_innodb_buffer_pool' => 'InnoDB Buffer Pool', 'mysql_innodb_buffer_pool_activity' => 'InnoDB Buffer Pool Activity', 'mysql_innodb_insert_buffer' => 'InnoDB Insert Buffer', 'mysql_innodb_io' => 'InnoDB IO', 'mysql_innodb_io_pending' => 'InnoDB IO Pending', 'mysql_innodb_log' => 'InnoDB Log', 'mysql_innodb_row_operations' => 'InnoDB Row Operations', 'mysql_innodb_semaphores' => 'InnoDB semaphores', 'mysql_innodb_transactions' => 'InnoDB Transactions');
foreach ($graphs[$vars['app_section']] as $key => $text) {
$graph_type = $key;
$graph_array['height'] = "100";
$graph_array['width'] = "215";
$graph_array['to'] = $config['time']['now'];
$graph_array['id'] = $app['app_id'];
示例10: snmpwalk_cache_oid
} else {
$data = snmpwalk_cache_oid($device, $type, array(), $netstats['mib']);
if (!count($data)) {
continue;
}
$data_array = $data[0];
}
$rrd_file = 'netstats-' . $type . '.rrd';
$rrd_create = '';
$rrd_update = 'N';
foreach ($oids as $oid) {
$oid_ds = truncate($oid, 19, '');
if ($oid == 'tcpCurrEstab') {
$rrd_create .= ' DS:' . $oid_ds . ':GAUGE:600:U:4294967295';
// Gauge32 max value 2^32 = 4294967295
} else {
$rrd_create .= ' DS:' . $oid_ds . ':COUNTER:600:U:4294967295';
// Counter32 max value 2^32 = 4294967295
}
$value = is_numeric($data_array[$oid]) ? $data_array[$oid] : 'U';
$rrd_update .= ':' . $value;
}
rrdtool_create($device, $rrd_file, $rrd_create);
rrdtool_update($device, $rrd_file, $rrd_update);
foreach ($netstats['graphs'] as $graph) {
$graphs[$graph] = TRUE;
}
print_cli_data(nicecase($type) . " Graphs", implode(" ", $netstats['graphs']), 2);
}
unset($netstats_poll, $netstats, $type, $oids, $oid, $oid_ds, $oids_string, $data, $data_array, $rrd_create, $rrd_file, $rrd_update, $value, $mibs_blacklist);
// EOF
示例11: array
<?php
if (!isset($vars['section'])) {
$vars['section'] = 'eventlog';
}
$sections = array('eventlog', 'syslog');
$navbar['brand'] = "Logging";
$navbar['class'] = "navbar-narrow";
foreach ($sections as $section) {
$type = strtolower($section);
if (!isset($vars['section'])) {
$vars['section'] = $section;
}
if ($vars['section'] == $section) {
$navbar['options'][$section]['class'] = "active";
}
$navbar['options'][$section]['url'] = generate_url(array('page' => 'device', 'device' => $device['device_id'], 'tab' => 'logs', 'section' => $section));
$navbar['options'][$section]['text'] = nicecase($section);
}
print_navbar($navbar);
switch ($vars['section']) {
case 'syslog':
case 'eventlog':
include 'pages/device/logs/' . $vars['section'] . '.inc.php';
break;
default:
echo '<h2>Error. No section ' . $vars['section'] . '.<br /> Please report this to observium developers.</h2>';
break;
}
示例12: print_syslogs
//.........这里部分代码省略.........
case 'timestamp_from':
$where .= ' AND `timestamp` > ?';
$param[] = $value;
break;
case 'timestamp_to':
$where .= ' AND `timestamp` < ?';
$param[] = $value;
break;
}
}
}
// Show events only for permitted devices
$query_permitted = generate_query_permitted();
$query = 'FROM `syslog` ';
$query .= $where . $query_permitted;
$query_count = 'SELECT COUNT(`seq`) ' . $query;
$query = 'SELECT * ' . $query;
$query .= ' ORDER BY `seq` DESC ';
$query .= "LIMIT {$start},{$pagesize}";
// Query syslog messages
$entries = dbFetchRows($query, $param);
// Query syslog count
if ($pagination && !$short) {
$count = dbFetchCell($query_count, $param);
} else {
$count = count($entries);
}
if (!$count) {
// There have been no entries returned. Print the warning.
print_warning('<h4>No syslog entries found!</h4>
Check that the syslog daemon and Observium configuration options are set correctly, that your devices are configured to send syslog to Observium and that there are no firewalls blocking the messages.
See <a href="http://www.observium.org/wiki/Category:Documentation" target="_blank">documentation</a> and <a href="http://www.observium.org/wiki/Configuration_Options#Syslog_Settings" target="_blank">configuration options</a> for more information.');
} else {
// Entries have been returned. Print the table.
$list = array('device' => FALSE, 'priority' => TRUE);
// For now (temporarily) priority always displayed
if (!isset($vars['device']) || empty($vars['device']) || $vars['page'] == 'syslog') {
$list['device'] = TRUE;
}
if ($short || !isset($vars['priority']) || empty($vars['priority'])) {
$list['priority'] = TRUE;
}
$string = '<table class="table table-bordered table-striped table-hover table-condensed-more">' . PHP_EOL;
if (!$short) {
$string .= ' <thead>' . PHP_EOL;
$string .= ' <tr>' . PHP_EOL;
$string .= ' <th>Date</th>' . PHP_EOL;
if ($list['device']) {
$string .= ' <th>Device</th>' . PHP_EOL;
}
if ($list['priority']) {
$string .= ' <th>Priority</th>' . PHP_EOL;
}
$string .= ' <th>Message</th>' . PHP_EOL;
$string .= ' </tr>' . PHP_EOL;
$string .= ' </thead>' . PHP_EOL;
}
$string .= ' <tbody>' . PHP_EOL;
foreach ($entries as $entry) {
$string .= ' <tr>';
if ($short) {
$string .= ' <td class="syslog" style="white-space: nowrap">';
$timediff = $GLOBALS['config']['time']['now'] - strtotime($entry['timestamp']);
$string .= overlib_link('', formatUptime($timediff, "short-3"), format_timestamp($entry['timestamp']), NULL) . '</td>' . PHP_EOL;
} else {
$string .= ' <td width="160">';
$string .= format_timestamp($entry['timestamp']) . '</td>' . PHP_EOL;
}
if ($list['device']) {
$dev = device_by_id_cache($entry['device_id']);
$device_vars = array('page' => 'device', 'device' => $entry['device_id'], 'tab' => 'logs', 'section' => 'syslog');
$string .= ' <td class="entity">' . generate_device_link($dev, short_hostname($dev['hostname']), $device_vars) . '</td>' . PHP_EOL;
}
if ($list['priority']) {
if (!$short) {
$string .= ' <td style="color: ' . $priorities[$entry['priority']]['color'] . '; white-space: nowrap;">' . nicecase($priorities[$entry['priority']]['name']) . ' (' . $entry['priority'] . ')</td>' . PHP_EOL;
}
}
$entry['program'] = empty($entry['program']) ? '[[EMPTY]]' : $entry['program'];
if ($short) {
$string .= ' <td class="syslog">';
$string .= '<strong style="color: ' . $priorities[$entry['priority']]['color'] . ';">' . $entry['program'] . '</strong> : ';
} else {
$string .= ' <td>';
$string .= '<strong>' . $entry['program'] . '</strong> : ';
}
$string .= htmlspecialchars($entry['msg']) . '</td>' . PHP_EOL;
$string .= ' </tr>' . PHP_EOL;
}
$string .= ' </tbody>' . PHP_EOL;
$string .= '</table>' . PHP_EOL;
// Print pagination header
if ($pagination && !$short) {
$string = pagination($vars, $count) . $string . pagination($vars, $count);
}
// Print syslog
echo $string;
}
}
示例13: nicecase
<table cellpadding="0" cellspacing="0">
<tr>
<td>
<form id="edit" name="edit" method="post" action="">
<input type="hidden" name="editing" value="yes">
<table border="0">
<?php
$numicons = 1;
echo " <tr>\n";
// Default icon
$icon = $config['os'][$device['os']]['icon'];
echo ' <td width="64" align="center"><img src="images/os/' . $icon . '.png"><br /><i>' . nicecase($icon) . '</i><p />';
echo '<input name="icon" type="radio" value="' . $icon . '"' . ($device['icon'] == '' || $device['icon'] == $icon ? ' checked="1"' : '') . ' /></td>' . "\n";
for ($i = 0; $i < count($config['os'][$device['os']]['icons']); $i++) {
$icon = $config['os'][$device['os']]['icons'][$i];
echo ' <td width="64" align="center"><img src="images/os/' . $icon . '.png"><br /><i>' . nicecase($icon) . '</i><p />';
echo '<input name="icon" type="radio" value="' . $icon . '"' . ($device['icon'] == $icon ? ' checked="1"' : '') . ' /></td>' . "\n";
}
if ($numicons % 10 == 0) {
echo " </tr>\n";
echo " <tr>\n";
}
?>
</tr>
<tr>
<td colspan="10">
<br />
<input type="submit" name="Submit" value="Save" />
</td>
</tr>
</table>
示例14: nicecase
} else {
$title .= " :: " . nicecase($subtype);
}
// Generate navbar with subtypes
$graph_array = $vars;
$graph_array['height'] = "60";
$graph_array['width'] = $thumb_width;
$graph_array['legend'] = "no";
$graph_array['to'] = $config['time']['now'];
$navbar = array('brand' => "Graph", 'class' => "navbar-narrow");
switch ($type) {
case 'device':
case 'sensor':
case 'cefswitching':
case 'munin':
$navbar['options']['graph'] = array('text' => nicecase($type) . ' (' . $subtype . ')', 'url' => generate_url($vars, array('type' => $type . "_" . $subtype, 'page' => "graphs")));
break;
default:
# Load our list of available graphtypes for this object
/// FIXME not all of these are going to be valid
/// This is terrible. --mike
/// The future solution is to keep a 'registry' of which graphtypes apply to which entities and devices.
/// I'm not quite sure if this is going to be too slow. --adama 2013-11-11
if ($handle = opendir($config['html_dir'] . "/includes/graphs/" . $type . "/")) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != ".." && $file != "auth.inc.php" && $file != "graph.inc.php" && strstr($file, ".inc.php")) {
$types[] = str_replace(".inc.php", "", $file);
}
}
closedir($handle);
}
示例15: snmpwalk_cache_multi_oid
//Printer-MIB::prtMarkerSpotColorants.1.1 = INTEGER: 0
//Printer-MIB::prtMarkerAddressabilityUnit.1.1 = INTEGER: tenThousandthsOfInches(3)
//Printer-MIB::prtMarkerAddressabilityFeedDir.1.1 = INTEGER: 600
//Printer-MIB::prtMarkerAddressabilityXFeedDir.1.1 = INTEGER: 600
//Printer-MIB::prtMarkerNorthMargin.1.1 = INTEGER: 1968
//Printer-MIB::prtMarkerSouthMargin.1.1 = INTEGER: 1968
//Printer-MIB::prtMarkerWestMargin.1.1 = INTEGER: 1968
//Printer-MIB::prtMarkerEastMargin.1.1 = INTEGER: 1968
//Printer-MIB::prtMarkerStatus.1.1 = INTEGER: 2
$oids = snmpwalk_cache_multi_oid($device, "prtMarkerEntry", array(), $mib);
$prt_supplies = snmpwalk_cache_oid($device, 'prtMarkerSuppliesDescription', array(), $mib);
//print_vars($oids);
$count = count($oids);
foreach ($oids as $index => $entry) {
$printer_supply = dbFetchRow("SELECT * FROM `printersupplies` WHERE `device_id` = ? AND `supply_mib` = ? AND `supply_index` = ?", array($device['device_id'], 'jetdirect', $index));
$marker_descr = "Printed " . nicecase($entry['prtMarkerCounterUnit']);
list($hrDeviceIndex, $prtMarkerIndex) = explode('.', $index);
$options = array('measured_class' => 'printersupply', 'measured_entity' => $printer_supply['supply_id'], 'sensor_unit' => $entry['prtMarkerCounterUnit']);
// Lifetime counter (should be always single)
$descr = "Total {$marker_descr}";
$oid_name = 'prtMarkerLifeCount';
$oid = '.1.3.6.1.2.1.43.10.2.1.4.' . $index;
$value = $entry[$oid_name];
if (isset($entry[$oid_name])) {
// CLEANME. Compatibility, remove in r8500, but not before CE 0.16.8
// Rename olf rrd filename and old ds name
$new_rrd = 'sensor-counter-Printer-MIB-prtMarkerLifeCount-' . $index;
$renamed = rename_rrd($device, 'pagecount', $new_rrd);
if ($renamed) {
rrdtool_rename_ds($device, $new_rrd, 'pagecount', 'sensor');
}