Changeset 314 for trunk/web


Ignore:
Timestamp:
04/18/07 09:39:55 (17 years ago)
Author:
bastiaans
Message:

web/addons/job_monarch/search.php:

  • removed makeTime -> moved to libtoga
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/web/addons/job_monarch/search.php

    r299 r314  
    8282
    8383        return ($error ? 0 : 1 );
    84 }
    85 
    86 function makeTime( $time ) {
    87 
    88         $days = intval( $time / 86400 );
    89         $time = ($days>0) ? $time % ($days * 86400) : $time;
    90 
    91         //printf( "time = %s, days = %s\n", $time, $days );
    92 
    93         $date_str = '';
    94         $day_str = '';
    95 
    96         if( $days > 0 ) {
    97                 if( $days > 1 )
    98                         $day_str .= $days . ' days';
    99                 else
    100                         $day_str .= $days . ' day';
    101         }
    102 
    103         $hours = intval( $time / 3600 );
    104         $time = $hours ? $time % ($hours * 3600) : $time;
    105 
    106         //printf( "time = %s, days = %s, hours = %s\n", $time, $days, $hours );
    107 
    108         if( $hours > 0 ) {
    109                 $date_str .= $hours . ':';
    110                 $date_unit = 'hours';
    111         }
    112 
    113         $minutes = intval( $time / 60 );
    114         $seconds = $minutes ? $time % ($minutes * 60) : $time;
    115 
    116         if( $minutes > 0 ) {
    117 
    118                 if( $minutes >= 10 )
    119                         $date_str .= $minutes . ':';
    120                 else
    121                         $date_str .= '0' . $minutes . ':';
    122 
    123                 $date_unit = (!isset($date_unit)) ? 'minutes' : $date_unit;
    124         } else {
    125                 if($hours > 0 ) {
    126                         $date_str .= '00:';
    127                         $date_unit = (!isset($date_unit)) ? 'minutes' : $date_unit;
    128                 }
    129         }
    130 
    131 
    132         $date_unit = (!isset($date_unit)) ? 'seconds' : $date_unit;
    133 
    134         if( $seconds > 0 ) {
    135 
    136                 if( $seconds >= 10 )
    137                         $date_str .= $seconds . ' ' . $date_unit;
    138                 else
    139                         $date_str .= '0' . $seconds . ' ' . $date_unit;
    140 
    141         } else if ( $hours > 0 or $minutes > 0 )
    142 
    143                 $date_str .= '00 ' . $date_unit;
    144 
    145         if( $days > 0) {
    146 
    147                 if( $hours > 0 or $minutes > 0 or $seconds > 0 )
    148                         $date_str = $day_str . ' - ' . $date_str;
    149                 else
    150                         $date_str = $day_str;
    151         }
    152 
    153         return $date_str;
    15484}
    15585
Note: See TracChangeset for help on using the changeset viewer.