/[drupal]/contributions/modules/countdown/countdown.module
ViewVC logotype

Diff of /contributions/modules/countdown/countdown.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.4.2.3, Mon May 12 15:36:33 2008 UTC revision 1.4.2.4, Fri Jul 25 15:54:22 2008 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: countdown.module,v 1.4.2.1 2008/05/12 13:56:28 deekayen Exp $  // $Id: countdown.module,v 1.4.2.3 2008/05/12 15:36:33 deekayen Exp $
3    
4  /**  /**
5   * Count to or from a specified date and display the output in a block   * Count to or from a specified date and display the output in a block
# Line 43  function countdown_block($op = 'list', $ Line 43  function countdown_block($op = 'list', $
43        '#size' => 30,        '#size' => 30,
44        '#maxlength' => 200,        '#maxlength' => 200,
45        '#description' => t("Event name you're counting to or from."),        '#description' => t("Event name you're counting to or from."),
46        '#required' => true        '#required' => TRUE
47        );
48        $form['countdown_url'] = array(
49          '#type' => 'textfield',
50          '#title' => t('Event URL'),
51          '#default_value' => variable_get('countdown_url', ''),
52          '#size' => 30,
53          '#maxlength' => 200,
54          '#description' => t("Turn the event description into a link to more information about the event"),
55          '#required' => FALSE
56      );      );
57    
58      $form['countdown_accuracy'] = array(      $form['countdown_accuracy'] = array(
# Line 120  function countdown_block($op = 'list', $ Line 129  function countdown_block($op = 'list', $
129    
130    case 'save':    case 'save':
131      variable_set('countdown_event_name', $edit['countdown_event_name']);      variable_set('countdown_event_name', $edit['countdown_event_name']);
132        variable_set('countdown_url', $edit['countdown_url']);
133      variable_set('countdown_accuracy', $edit['countdown_accuracy']);      variable_set('countdown_accuracy', $edit['countdown_accuracy']);
134      variable_set('countdown_timestamp', mktime((int)$edit['hour'], (int)$edit['min'], (int)$edit['sec'], (int)$edit['month'], (int)$edit['day'], (int)$edit['year']));      variable_set('countdown_timestamp', mktime((int)$edit['hour'], (int)$edit['min'], (int)$edit['sec'], (int)$edit['month'], (int)$edit['day'], (int)$edit['year']));
135    
# Line 161  function theme_countdown_block() { Line 171  function theme_countdown_block() {
171    if ($accuracy == 's') {    if ($accuracy == 's') {
172      $block .= t(', %i seconds', array('%i' => $secs_left));      $block .= t(', %i seconds', array('%i' => $secs_left));
173    }    }
174    $block .= t(($passed) ? ' since %s.' : ' until %s.', array('%s' => variable_get('countdown_event_name', '')));  
175      $event_name = variable_get('countdown_event_name', '');
176      $url = variable_get('countdown_url', '');
177      $event_name = empty($url) || $url == 'http://' ? $event_name : l($event_name, $url, NULL, NULL, NULL, TRUE);
178    
179      $block .= t(($passed) ? ' since !s.' : ' until !s.', array('!s' => $event_name));
180    
181    
182    if ($accuracy != 'd') {    if ($accuracy != 'd') {
183      $path = drupal_get_path('module', 'countdown');      $path = drupal_get_path('module', 'countdown');
184      drupal_add_js($path .'/countdown.js');      drupal_add_js($path .'/countdown.js');

Legend:
Removed from v.1.4.2.3  
changed lines
  Added in v.1.4.2.4

  ViewVC Help
Powered by ViewVC 1.1.2