Changeset 535 for trunk


Ignore:
Timestamp:
2008-03-02T04:16:21+01:00 (6 years ago)
Author:
moo
Message:

mark current hour in hits graph

Location:
trunk/admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/xcache.css

    r530 r535  
    2929.blocksgraph { border: 1px solid gray; border-bottom: 0px; } 
    3030 
    31 .hitsgraph { height: 20px; border: solid gray; border-width: 1px 0 1px 0; margin: auto; } 
     31.hitsgraph { height: 20px; margin: auto; } 
    3232.hitsgraph div { float: left; width: 2px; height: 100%; } 
    33 .bitsgraph div div { float: none; width: 100%; } 
     33.hitsgraph div div { float: none; width: 100%; } 
     34.hitsgraph div div.barf { border: 0px solid gray; border-width: 1px 0 0 0; } 
     35.hitsgraph div div.barv { border: 0px solid gray; border-width: 0 0 1px 0; } 
     36.hitsgraph div div.barf.active { border-color: yellow; } 
     37.hitsgraph div div.barv.active { border-color: yellow; } 
    3438 
    3539.switcher, h1 { text-align: center; display: block; } 
  • trunk/admin/xcache.php

    r526 r535  
    152152} 
    153153 
    154 function bar_percent($percent) 
     154function bar_percent($percent, $active) 
    155155{ 
    156156    $r = 220 + (int) ($percent * 25); 
    157157    $g = $b = 220 - (int) ($percent * 220); 
    158158    $percent = (int) ($percent * 100); 
     159    $a = $active ? ' active' : ''; 
    159160    return '<div>' 
    160         . '<div style="height: ' . (100 - $percent) . '%"></div>' 
    161         . '<div style="background: rgb(' . "$r,$g,$b" . '); height: ' . $percent . '%"></div>' 
     161        . '<div class="barf' . $a . '" style="height: ' . (100 - $percent) . '%"></div>' 
     162        . '<div class="barv' . $a . '" style="background: rgb(' . "$r,$g,$b" . '); height: ' . $percent . '%"></div>' 
    162163        . '</div>'; 
    163164} 
     
    174175        return ''; 
    175176    } 
     177    $t = (time() / (60 * 60)) % 24; 
    176178    $html = array(); 
    177     foreach ($hits as $v) { 
    178         $html[] = bar_percent($v / $max); 
     179    foreach ($hits as $i => $v) { 
     180        $html[] = bar_percent($v / $max, $i == $t); 
    179181    } 
    180182    return implode('', $html); 
Note: See TracChangeset for help on using the changeset viewer.