Ignore:
Timestamp:
2012-07-30T07:28:15+02:00 (2 years ago)
Author:
moo
Message:

htdocs/cacher: fix hits graph

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/htdocs/cacher/index.php

    r1081 r1084  
    8585    $g = $b = 220 - (int) ($percent * 220); 
    8686    $percent = (int) ($percent * 100); 
    87     $a = $active ? ' active' : ''; 
    88     $height = 20; 
     87    $a = $active ? ' class="active"' : ''; 
     88    $height = 20 - 1 * 2; 
    8989    $valueHeight = ceil($height * $percent / 100); 
    9090    $paddingHeight = $height - $valueHeight; 
    9191    $valueHeight = $valueHeight ? $valueHeight . "px" : 0; 
    9292    $paddingHeight = $paddingHeight ? $paddingHeight . "px" : 0; 
    93     return '<div title="' . $v . '">' 
    94         . '<div class="barf' . $a . '" style="height: ' . $paddingHeight . '"></div>' 
    95         . '<div class="barv' . $a . '" style="background: rgb(' . "$r,$g,$b" . '); height: ' . $valueHeight . '"></div>' 
    96         . '</div>'; 
     93    return '<a title="' . $v . '" href="javascript:;"' . $a . '>' 
     94        . ($paddingHeight ? '<div style="height: ' . $paddingHeight . '"></div>' : '') 
     95        . ($valueHeight ? '<div style="background: rgb(' . "$r,$g,$b" . '); height: ' . $valueHeight . '"></div>' : '') 
     96        . '</a>'; 
    9797} 
    9898// }}} 
     
    110110    } 
    111111    $t = (time() / (60 * 60)) % 24; 
     112 
    112113    $html = array(); 
     114    static $cssOut = false; 
     115    if (!$cssOut) { 
     116        $cssOut = true; 
     117        $html[] = '<style type="text/css">'; 
     118        $html[] = '.hitsgraph a { width: 2px; height: 20px; border-top-width: 1px; border-bottom-width: 1px; }'; 
     119        $html[] = '</style>'; 
     120    } 
     121 
     122    $width = count($ci[$key]) * 2; 
     123    $html[] = '<div class="hitsgraph" style="width: ' . $width . 'px">'; 
    113124    foreach ($ci[$key] as $i => $v) { 
    114125        $html[] = bar_hits_percent($v, $v / $max, $i == $t); 
    115126    } 
     127    $html[] = "</div>"; 
    116128    return implode('', $html); 
    117129} 
Note: See TracChangeset for help on using the changeset viewer.