on mobile devices, default to a single row
authorRobert Kaiser <kairo@kairo.at>
Wed, 8 Jul 2015 22:35:44 +0000 (00:35 +0200)
committerRobert Kaiser <kairo@kairo.at>
Wed, 8 Jul 2015 22:35:44 +0000 (00:35 +0200)
include/classes/rrdstat.php-class
testbed/rrd/rrd-stat.php

index f0cf864676846f107baaafac01b9e70aa43563b5..00ac8fb52e553780d66aa6fbd9c4f981d0c71c70 100644 (file)
@@ -966,7 +966,8 @@ class rrdstat {
     if (isset($pconf['stats_url_add'])) { $sURL_add = $pconf['stats_url_add']; }
     else { $sURL_add = '&sub=%s'; }
 
-    $num_rows = is_numeric($pconf['num_rows'])?$pconf['num_rows']:2;
+    $default_num_rows = $GLOBALS['ua']->isMobile()?1:2;
+    $num_rows = is_numeric($pconf['num_rows'])?$pconf['num_rows']:$default_num_rows;
     $num_cols = ceil(count($stats)/$num_rows);
 
     $out .= '<table class="overview">'."\n";
index 8dfbb6c871bff0b6e8c41701133437e603fe0590..ed939746be868d66d075b46cb18e73c90ae8f735 100644 (file)
@@ -10,6 +10,10 @@ if (getcwd() != dirname($myfile)) {
 
 include_once('rrdstat.php-class');
 
+// $GLOBALS['ua'] is required by some page generation routines
+include_once('useragent.php-class');
+$ua = new userAgent();
+
 $rrd_config_file = 'rrd-config/'.php_uname('n').'.inc.php';
 if (!file_exists($rrd_config_file)) { $rrd_config_file = 'rrd-config.inc.php'; }
 include_once($rrd_config_file);