Beispiel #1
0
/**
 * Format a time as 'x' years, 'x' weeks, 'x' days, 'x' hours, 'x' minutes, 'x' seconds
 *
 * @param int $time UNIX timestamp
 * @return string formatted time
 *
 * @access public
 */
function xhelpFormatTime($time)
{
    $values = xhelpGetElapsedTime($time);
    foreach ($values as $key => $value) {
        ${$key} = $value;
    }
    $ret = array();
    if ($years) {
        $ret[] = $years . ' ' . ($years == 1 ? _XHELP_TIME_YEAR : _XHELP_TIME_YEARS);
    }
    if ($weeks) {
        $ret[] = $weeks . ' ' . ($weeks == 1 ? _XHELP_TIME_WEEK : _XHELP_TIME_WEEKS);
    }
    if ($days) {
        $ret[] = $days . ' ' . ($days == 1 ? _XHELP_TIME_DAY : _XHELP_TIME_DAYS);
    }
    if ($hours) {
        $ret[] = $hours . ' ' . ($hours == 1 ? _XHELP_TIME_HOUR : _XHELP_TIME_HOURS);
    }
    if ($minutes) {
        $ret[] = $minutes . ' ' . ($minutes == 1 ? _XHELP_TIME_MIN : _XHELP_TIME_MINS);
    }
    $ret[] = $seconds . ' ' . ($seconds == 1 ? _XHELP_TIME_SEC : _XHELP_TIME_SECS);
    return implode(', ', $ret);
}
Beispiel #2
0
 function lastUpdate()
 {
     $tmp = xhelpGetElapsedTime($this->getVar('lastUpdate'));
     return $this->_prettyElapsed($tmp);
 }