on mobile devices, default to a single column - add symlink for ua library
[php-utility-classes.git] / include / classes / rrdstat.php-class
index 00ac8fb52e553780d66aa6fbd9c4f981d0c71c70..7532f00bfc637d649eea5599543b89e7b372c159 100644 (file)
@@ -966,15 +966,15 @@ class rrdstat {
     if (isset($pconf['stats_url_add'])) { $sURL_add = $pconf['stats_url_add']; }
     else { $sURL_add = '&sub=%s'; }
 
-    $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);
+    $default_num_cols = $GLOBALS['ua']->isMobile()?1:2;
+    $num_cols = is_numeric($pconf['num_rows'])?$pconf['num_rows']:$default_num_cols;
+    $num_rows = ceil(count($stats)/$num_cols);
 
     $out .= '<table class="overview">'."\n";
-    for ($col = 0; $col < $num_cols; $col++) {
+    for ($row = 0; $row < $num_rows; $row++) {
       $out .= '<tr>'."\n";
-      for ($row = 0; $row < $num_rows; $row++) {
-        $idx = $col * $num_rows + $row;
+      for ($col = 0; $col < $num_cols; $col++) {
+        $idx = $row * $num_cols + $col;
         $out .= '<td>'."\n";
         if ($idx < count($stats)) {
           @list($sname, $s_psub) = explode('|', $stats[$idx]['name'], 2);