Ad Widget

Collapse

PATCH: Extend time periods in php frontend (1.4.4-1.4.5)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pilson66
    Junior Member
    • Feb 2008
    • 10

    #1

    PATCH: Extend time periods in php frontend (1.4.4-1.4.5)

    Patch for php frontend
    Extending time periods in "Period" (period, increase, decrease) and "Move" (left, right) to "10min, 30min, 1h, 2h, 4h, 8h, 12h, 24h, 1 week, 1 month, 3 month, 6 month, 1 year" in any graphic.

    Code:
    +++ frontends/php/include/config.inc.php  2008-04-16 10:19:35.000000000 +0300 
    @@ -1442,7 +1442,7 @@ 
    
            $hour=3600; 
    
    -               $a=array(S_1H=>3600,S_2H=>2*3600,S_4H=>4*3600,S_8H=>8*3600,S_12H=>12*3600, 
    + $a=array(S_10Min=>600,S_30Min=>1800,S_1H=>3600,S_2H=>2*3600,S_4H=>4*3600,S_8H=>8*3600,S_12H=>12*3600, 
                            S_24H=>24*3600,S_WEEK_SMALL=>7*24*3600,S_MONTH_SMALL=>31*24*3600,S_YEAR_SMALL=>365*24*3600); 
                    foreach($a as $label=>$sec) 
                    { 
    +++ frontends/php/include/defines.inc.php 2008-04-16 10:19:35.000000000 +0300 
    @@ -428,7 +428,7 @@ 
     /* Define if your logs are in non-standard format */ 
     /*     define('ZBX_LOG_ENCODING_DEFAULT', 'Shift_JIS');*/ 
    
    -       define('ZBX_MIN_PERIOD', 3600); 
    +       define('ZBX_MIN_PERIOD', 600); 
            define('ZBX_MAX_PERIOD', 12*31*24*3600); 
            define('ZBX_PERIOD_DEFAULT', ZBX_MIN_PERIOD); 
    
    +++ frontends/php/include/graphs.inc.php  2008-04-16 10:19:35.000000000 +0300 
    @@ -796,64 +796,96 @@ 
    
                    $period = get_request('period',ZBX_PERIOD_DEFAULT); 
    
    -               if(uint_in_array($period,array(3600,2*3600,4*3600,8*3600,12*3600,24*3600,7*24*3600,31*24*3600,365*24*3600))) 
    + if(uint_in_array($period,array(600,1800,3600,2*3600,4*3600,8*3600,12*3600,24*3600,7*24*3600,31*24*3600,90*24*3600,182*24*3600,365*24*3600))) 
                            $custom_per = ZBX_MIN_PERIOD; 
                    else 
                            $custom_per = $period; 
    
                    $cmbPeriod = new CComboBox("period",$period,"submit()"); 
                    $cmbPeriod->AddItem($custom_per,"custom"); 
    +               $cmbPeriod->AddItem(600,"10min"); 
    +               $cmbPeriod->AddItem(1800,"30min"); 
                    $cmbPeriod->AddItem(3600,"1h"); 
                    $cmbPeriod->AddItem(2*3600,"2h"); 
                    $cmbPeriod->AddItem(4*3600,"4h"); 
                    $cmbPeriod->AddItem(8*3600,"8h"); 
                    $cmbPeriod->AddItem(12*3600,"12h"); 
                    $cmbPeriod->AddItem(24*3600,"24h"); 
    -               $cmbPeriod->AddItem(7*24*3600,"week"); 
    -               $cmbPeriod->AddItem(31*24*3600,"month"); 
    -               $cmbPeriod->AddItem(365*24*3600,"year"); 
    +               $cmbPeriod->AddItem(7*24*3600,"1 week"); 
    +               $cmbPeriod->AddItem(31*24*3600,"1 month"); 
    +               $cmbPeriod->AddItem(90*24*3600,"3 month"); 
    +               $cmbPeriod->AddItem(182*24*3600,"6 month"); 
    +               $cmbPeriod->AddItem(365*24*3600,"1 year"); 
                    $form->AddItem($cmbPeriod); 
    
                    $cmbDec = new CComboBox("dec",0,"submit()"); 
                    $cmbDec->AddItem(0,S_DECREASE); 
    +               $cmbDec->AddItem(600,"-10min"); 
    +               $cmbDec->AddItem(1800,"-30min"); 
                    $cmbDec->AddItem(3600,"-1h"); 
    +               $cmbDec->AddItem(2*3600,"-2h"); 
                    $cmbDec->AddItem(4*3600,"-4h"); 
    +               $cmbDec->AddItem(8*3600,"-8h"); 
    +               $cmbDec->AddItem(12*3600,"-12h"); 
                    $cmbDec->AddItem(24*3600,"-24h"); 
    -               $cmbDec->AddItem(7*24*3600,"-week"); 
    -               $cmbDec->AddItem(31*24*3600,"-month"); 
    -               $cmbDec->AddItem(365*24*3600,"-year"); 
    +               $cmbDec->AddItem(7*24*3600,"-1 week"); 
    +               $cmbDec->AddItem(31*24*3600,"-1 month"); 
    +               $cmbDec->AddItem(90*24*3600,"-3 month"); 
    +               $cmbDec->AddItem(182*24*3600,"-6 month"); 
    +               $cmbDec->AddItem(365*24*3600,"-1 year"); 
                    $form->AddItem($cmbDec); 
    
                    $cmbInc = new CComboBox("inc",0,"submit()"); 
                    $cmbInc->AddItem(0,S_INCREASE); 
    +               $cmbInc->AddItem(600,"+10min"); 
    +               $cmbInc->AddItem(1800,"+30min"); 
                    $cmbInc->AddItem(3600,"+1h"); 
    +               $cmbInc->AddItem(2*3600,"+2h"); 
                    $cmbInc->AddItem(4*3600,"+4h"); 
    +               $cmbInc->AddItem(8*3600,"+8h"); 
    +               $cmbInc->AddItem(12*3600,"+12h"); 
                    $cmbInc->AddItem(24*3600,"+24h"); 
    -               $cmbInc->AddItem(7*24*3600,"+week"); 
    -               $cmbInc->AddItem(31*24*3600,"+month"); 
    -               $cmbInc->AddItem(365*24*3600,"+year"); 
    +               $cmbInc->AddItem(7*24*3600,"+1 week"); 
    +               $cmbInc->AddItem(31*24*3600,"+1 month"); 
    +               $cmbInc->AddItem(90*24*3600,"+3 month"); 
    +               $cmbInc->AddItem(182*24*3600,"+6 month"); 
    +               $cmbInc->AddItem(365*24*3600,"+1 year"); 
                    $form->AddItem($cmbInc); 
    
                    $form->AddItem(SPACE.S_MOVE.SPACE); 
    
                    $cmbLeft = new CComboBox("left",0,"submit()"); 
                    $cmbLeft->AddItem(0,S_LEFT_DIR); 
    +               $cmbLeft->AddItem(0.167,"-10min"); 
    +               $cmbLeft->AddItem(0.5,"-30min"); 
                    $cmbLeft->AddItem(1,"-1h"); 
    +               $cmbLeft->AddItem(2,"-2h"); 
                    $cmbLeft->AddItem(4,"-4h"); 
    +               $cmbLeft->AddItem(8,"-8h"); 
    +               $cmbLeft->AddItem(12,"-12h"); 
                    $cmbLeft->AddItem(24,"-24h"); 
    -               $cmbLeft->AddItem(7*24,"-week"); 
    -               $cmbLeft->AddItem(31*24,"-month"); 
    -               $cmbLeft->AddItem(365*24,"-year"); 
    +               $cmbLeft->AddItem(7*24,"-1 week"); 
    +               $cmbLeft->AddItem(31*24,"-1 month"); 
    +               $cmbLeft->AddItem(90*24,"-3 month"); 
    +               $cmbLeft->AddItem(182*24,"-6 month"); 
    +               $cmbLeft->AddItem(365*24,"-1 year"); 
                    $form->AddItem($cmbLeft); 
    
                    $cmbRight = new CComboBox("right",0,"submit()"); 
                    $cmbRight->AddItem(0,S_RIGHT_DIR); 
    +               $cmbRight->AddItem(0.167,"+10min"); 
    +               $cmbRight->AddItem(0.5,"+30min"); 
                    $cmbRight->AddItem(1,"+1h"); 
    +               $cmbRight->AddItem(2,"+2h"); 
                    $cmbRight->AddItem(4,"+4h"); 
    +               $cmbRight->AddItem(8,"+8h"); 
    +               $cmbRight->AddItem(12,"+12h"); 
                    $cmbRight->AddItem(24,"+24h"); 
    -               $cmbRight->AddItem(7*24,"+week"); 
    -               $cmbRight->AddItem(31*24,"+month"); 
    -               $cmbRight->AddItem(365*24,"+year"); 
    +               $cmbRight->AddItem(7*24,"+1 week"); 
    +               $cmbRight->AddItem(31*24,"+1 month"); 
    +               $cmbRight->AddItem(90*24,"+3 month"); 
    +               $cmbRight->AddItem(182*24,"+6 month"); 
    +               $cmbRight->AddItem(365*24,"+1 year"); 
                    $form->AddItem($cmbRight); 
    
                    $form->AddItem(array(SPACE,
    Attached Files
    Last edited by pilson66; 16-04-2008, 10:09.
  • swaterhouse
    Senior Member
    • Apr 2006
    • 268

    #2
    I would like to see this added in, I just ran into an issue yesterday with the move that wouldn't let me go back 12 hours so i had to do 3 4 hour jumps.

    Comment

    Working...