diff -urp -N countdown5/countdown.info countdown/countdown.info --- countdown5/countdown.info 2007-01-16 03:30:03.000000000 -0500 +++ countdown/countdown.info 2008-05-11 12:42:55.000000000 -0400 @@ -2,7 +2,9 @@ name = Countdown description = Adds a block to count the days, hours, minutes, and seconds since or until a specified event. package = "Event" +dependencies[] = "event" +core = 6.x +version = "6.x-1.x-dev" ; Information added by drupal.org packaging script on 2007-01-16 -version = "5.x-1.0" project = "countdown" diff -urp -N countdown5/countdown.module countdown/countdown.module --- countdown5/countdown.module 2007-01-15 18:34:37.000000000 -0500 +++ countdown/countdown.module 2008-05-11 15:14:41.000000000 -0400 @@ -11,9 +11,9 @@ * @param string $section * @return string */ -function countdown_help($section) { +function countdown_help($path, $arg) { $output = ''; - switch ($section) { + switch ($path) { case 'admin/help#countdown': $output = t("Don't forget to configure the event name and date in Administer/blocks/Countdown configure"); break; @@ -126,51 +126,22 @@ function countdown_block($op = 'list', $ case 'view': if (user_access('access content')) { $block['subject'] = variable_get('countdown_block_title', t('Countdown')); - $time = time(); - $difference = variable_get('countdown_timestamp', $time) - $time; - if ($difference < 0) { - $passed = 1; - $difference = abs($difference); - } else { - $passed = 0; - } - - $accuracy = variable_get('countdown_accuracy', 'd'); - $days_left = floor($difference/60/60/24); - $hrs_left = floor(($difference - $days_left*60*60*24)/60/60); - $min_left = floor(($difference - $days_left*60*60*24 - $hrs_left*60*60)/60); - $secs_left = floor(($difference - $days_left*60*60*24 - $hrs_left*60*60 - $min_left*60)); - - $block['content'] .= t('%i days', array('%i' => $days_left)); - if($accuracy == 'h' || $accuracy == 'm' || $accuracy == 's') { - $block['content'] .= t(', %i hours', array('%i' => $hrs_left)); - } - if($accuracy == 'm' || $accuracy == 's') { - $block['content'] .= t(', %i minutes', array('%i' => $min_left)); - } - if($accuracy == 's') { - $block['content'] .= t(', %i seconds', array('%i' => $secs_left)); - } - $block['content'] .= t(($passed) ? ' since %s.' : ' until %s.', array('%s' => variable_get('countdown_event_name', ''))); -/* - $yrs_left = floor($difference/31556926); // 31556926 seconds in a year - $months_left = floor(($difference%31556926)/2629744); // remainder of years into months - 2629744 seconds in month - $days_left = floor((($difference%31556926)%2629744)/86400); // remainder of months into days - 86400 seconds in a day - $hrs_left = floor(((($difference%31556926)%2629744)%86400)/3600); // remainder of days into hours - 3600 seconds in an hour - $min_left = floor((((($difference%31556926)%2629744)%86400)%3600)/60); // remainder of hours into minutes - 60 seconds in a minute - $secs_left = floor((((($difference%31556926)%2629744)%86400)%3600)%60); // remainder of minutes, already in seconds so no need to divide - - $block['content'] .= t("%i years ", array('%i' => $yrs_left)); - $block['content'] .= t("%i months ", array('%i' => $months_left)); - $block['content'] .= t("%i days ", array('%i' => $days_left)); - $block['content'] .= t("%i hours ", array('%i' => $hrs_left)); - $block['content'] .= t("%i minutes ", array('%i' => $min_left)); - $block['content'] .= t("%i seconds ", array('%i' => $secs_left)); -*/ + $block['content'] = theme('countdown'); return $block; } break; } } +/** + * Theme function for similar block + * + */ +function countdown_theme() { + return array( + 'countdown' => array( + 'template' => 'countdown', + ), + ); +} ?> \ No newline at end of file diff -urp -N countdown5/countdown.tpl.php countdown/countdown.tpl.php --- countdown5/countdown.tpl.php 1969-12-31 19:00:00.000000000 -0500 +++ countdown/countdown.tpl.php 2008-05-11 15:13:32.000000000 -0400 @@ -0,0 +1,41 @@ + $days_left)); + if($accuracy == 'h' || $accuracy == 'm' || $accuracy == 's') { + print t(', %i hours', array('%i' => $hrs_left)); + } + if($accuracy == 'm' || $accuracy == 's') { + print t(', %i minutes', array('%i' => $min_left)); + } + if($accuracy == 's') { + print t(', %i seconds', array('%i' => $secs_left)); + } + print t(($passed) ? ' since %s.' : ' until %s.', array('%s' => variable_get('countdown_event_name', ''))); + return $block; +?>