' . PHP_EOL;
if (isset($args['title'])) {
$return .= '
' . PHP_EOL;
}
$return .= ' ' . PHP_EOL;
if (isset($args['footer_content'])) {
$return .= ' ' . PHP_EOL;
}
$return .= '
' . PHP_EOL;
return $return;
}
// DOCME needs phpdoc block
function print_graph_row_port($graph_array, $port) {
$graph_array['to'] = get_time();
$graph_array['id'] = $port['port_id'];
print_graph_row($graph_array);
}
function generate_graph_summary_row($graph_summary_array, $state_marker = FALSE)
{
global $config;
$graph_array = $graph_summary_array;
unset($graph_array['types']);
if ($_SESSION['widescreen']) {
if ($config['graphs']['size'] === 'big') {
if (!$graph_array['height']) {
$graph_array['height'] = "110";
}
if (!$graph_array['width']) {
$graph_array['width'] = "372";
}
$limit = 4;
} else {
if (!$graph_array['height']) {
$graph_array['height'] = "110";
}
if (!$graph_array['width']) {
$graph_array['width'] = "287";
}
$limit = 5;
}
} else {
if ($config['graphs']['size'] === 'big') {
if (!$graph_array['height']) {
$graph_array['height'] = "100";
}
if (!$graph_array['width']) {
$graph_array['width'] = "323";
}
$limit = 3;
} else {
if (!$graph_array['height']) {
$graph_array['height'] = "100";
}
if (!$graph_array['width']) {
$graph_array['width'] = "228";
}
$limit = 4;
}
}
if (!isset($graph_summary_array['period'])) {
$graph_summary_array['period'] = "day";
}
if ($state_marker) {
$graph_array['width'] -= 2;
}
$graph_array['to'] = get_time();
$graph_array['from'] = get_time($graph_summary_array['period']);
$graph_rows = [];
foreach ($graph_summary_array['types'] as $graph_type) {
// FIX THIS LATER :DDDD
// $hide_lg = $period[0] === '!';
// if ($hide_lg)
// {
// $period = substr($period, 1);
// }
$graph_array['type'] = $graph_type;
preg_match(OBS_PATTERN_GRAPH_TYPE, $graph_type, $type_parts);
$descr = $config['graph_types'][$type_parts['type']][$type_parts['subtype']]['descr'] ?? nicecase($graph_type);
$graph_array_zoom = $graph_array;
$graph_array_zoom['height'] = "175";
$graph_array_zoom['width'] = "600";
unset($graph_array_zoom['legend']);
$link_array = $graph_array;
$link_array['page'] = "graphs";
unset($link_array['height'], $link_array['width']);
unset($link_array['legend']); // Remove the legend=no when we kick out to /graphs/ because it doesn't make sense there.
$link = generate_url($link_array);
$popup_contents = '' . $descr . '
';
$popup_contents .= generate_graph_tag($graph_array_zoom);
$graph_link = overlib_link($link, generate_graph_tag($graph_array), $popup_contents, NULL);
// if ($hide_lg)
// {
// Hide this graph on lg/xl screen since it not fit to single row (on xs always visible, since here multirow)
// $graph_link = '' . $graph_link . '
';
// }
if (count($graph_rows) < $limit) {
$graph_rows[] = $graph_link;
}
}
return implode(PHP_EOL, $graph_rows);
}
// DOCME needs phpdoc block
function generate_graph_row($graph_array, $state_marker = FALSE)
{
global $config;
if ($_SESSION['widescreen']) {
if ($config['graphs']['size'] === 'big') {
if (!$graph_array['height']) {
$graph_array['height'] = "110";
}
if (!$graph_array['width']) {
$graph_array['width'] = "372";
}
$periods = ['day', 'week', 'month', 'year'];
} else {
if (!$graph_array['height']) {
$graph_array['height'] = "110";
}
if (!$graph_array['width']) {
$graph_array['width'] = "287";
}
$periods = ['day', 'week', 'month', 'year', 'twoyear'];
}
} else {
if ($config['graphs']['size'] === 'big') {
if (!$graph_array['height']) {
$graph_array['height'] = "100";
}
if (!$graph_array['width']) {
$graph_array['width'] = "330";
}
$periods = ['day', 'week', '!month'];
} else {
if (!$graph_array['height']) {
$graph_array['height'] = "100";
}
if (!$graph_array['width']) {
$graph_array['width'] = "228";
}
$periods = ['day', 'week', 'month', '!year'];
}
}
if ($graph_array['shrink']) {
$graph_array['width'] -= $graph_array['shrink'];
}
// If we're printing the row inside a table cell with "state-marker", we need to make the graphs a tiny bit smaller to fit
if ($state_marker) {
$graph_array['width'] -= 2;
}
$graph_array['to'] = get_time();
$graph_rows = [];
foreach ($periods as $period) {
$hide_lg = $period[0] === '!';
if ($hide_lg) {
$period = substr($period, 1);
}
$graph_array['from'] = get_time($period);
$graph_array_zoom = $graph_array;
$graph_array_zoom['height'] = "175";
$graph_array_zoom['width'] = "600";
unset($graph_array_zoom['legend']);
$link_array = $graph_array;
$link_array['page'] = "graphs";
unset($link_array['height'], $link_array['width']);
$link = generate_url($link_array);
$graph_link = overlib_link($link, generate_graph_tag($graph_array), generate_graph_tag($graph_array_zoom), NULL);
if ($hide_lg) {
// Hide this graph on lg/xl screen since it not fit to single row (on xs always visible, since here multirow)
$graph_link = '' . $graph_link . '
';
}
$graph_rows[] = $graph_link;
}
return implode(PHP_EOL, $graph_rows);
}
function print_graph_row($graph_array, $state_marker = FALSE)
{
echo(generate_graph_row($graph_array, $state_marker));
}
function print_graph_summary_row($graph_array, $state_marker = FALSE)
{
echo(generate_graph_summary_row($graph_array, $state_marker));
}
function print_setting_row($varname, $variable)
{
global $config, $config_variable, $database_config, $defined_config, $default_config;
// required arrays:
// config definitions
# $config_variable; // include($config['install_dir'] . '/includes/config-variables.inc.php');
if (safe_empty($config_variable)) {
//print_warning("LOADED CONFIG DEF");
include($config['install_dir'] . '/includes/config-variables.inc.php');
//r($config_variable);
}
// SQL config
# $database_config; // load_sqlconfig($database_config);
// Defined config
# $defined_config; // $defined_config = get_defined_settings();
// Default config
# $default_config; // $default_config = get_default_settings();
if (isset($variable['edition']) && $variable['edition'] !== OBSERVIUM_EDITION) {
// Skip variables not allowed for current Observium edition
return;
}
$switchdescr = <<