/[drupal]/contributions/modules/calendar/theme/theme.inc
ViewVC logotype

Diff of /contributions/modules/calendar/theme/theme.inc

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

revision 1.10.2.53, Wed Nov 26 12:54:39 2008 UTC revision 1.10.2.54, Mon Dec 1 02:14:03 2008 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: theme.inc,v 1.10.2.52 2008/11/26 10:51:37 karens Exp $  // $Id: theme.inc,v 1.10.2.53 2008/11/26 12:54:39 karens Exp $
3  /**  /**
4   * Display a calendar navigation and links   * Display a calendar navigation and links
5   */   */
# Line 114  function template_preprocess_calendar(&$ Line 114  function template_preprocess_calendar(&$
114        }        }
115      }      }
116    }    }
117    
118    $vars['display_type'] = $view->date_info->granularity;    $vars['display_type'] = $view->date_info->granularity;
119    $vars['min_date_formatted'] = date_format($view->date_info->min_date, DATE_FORMAT_DATETIME);    $vars['min_date_formatted'] = date_format($view->date_info->min_date, DATE_FORMAT_DATETIME);
120    $vars['max_date_formatted'] = date_format($view->date_info->max_date, DATE_FORMAT_DATETIME);    $vars['max_date_formatted'] = date_format($view->date_info->max_date, DATE_FORMAT_DATETIME);
# Line 494  function template_preprocess_calendar_no Line 495  function template_preprocess_calendar_no
495              break;              break;
496          }          }
497        }        }
       if ($field_alias == $node->datefield) {  
         $data = theme('calendar_date_combo', $node, $field->options['label'], $view);  
       }  
498        $fields[$field_alias] = array(        $fields[$field_alias] = array(
499          'id' => views_css_safe($field_alias),          'id' => views_css_safe($field_alias),
500          'label' => $label,          'label' => $label,
# Line 684  function theme_calendar_title($granulari Line 682  function theme_calendar_title($granulari
682    }    }
683  }  }
684    
 /**  
  * Format a from/to date in the calendar view.  
  *  
  * Alter the display as appropriate for the type of view.  
  * We can fine-tune the display to show only the time in  
  * the calendar month and week cells but the  
  * whole date in other places.  
  */  
 function theme_calendar_date_combo($node, $label, $view) {  
   switch ($node->format) {  
     case 'format_interval':  
       return theme('date_time_ago', $node->calendar_start_date, $node->calendar_end_date);  
   
     case 'time ago':  
       $value = date_format($node->calendar_start_date, 'U');  
       return $value ? t('%time ago', array('%time' => format_interval(time() - $value, 2))) : theme('views_nodate');  
   }  
   
   
   switch ($view->style_plugin->definition['handler']) {  
     // Some of the calendar views need a smaller date format.  
     case 'calendar_view_plugin_style':  
       switch ($view->date_info->calendar_display) {  
         case 'year':  
           // We don't display individual dates in the calendar year view.  
           return;  
         case 'week':  
         case 'month':  
           // No room for a label or the full date in these small  
           // displays, show only the time.  
           $format = $node->format_time;  
           $label = '';  
           break;  
         case 'day':  
           $format = $node->format;  
           break;  
       }  
       break;  
     // For non-calendar views, like lists and tables, show the entire date.  
     default:  
       $format = $node->format;  
       break;  
   }  
   
   
   $date1 = theme('date_all_day', 'date1', $node->calendar_start_date, $node->calendar_end_date, $format, $node, $view);  
   $date2 = theme('date_all_day', 'date2', $node->calendar_start_date, $node->calendar_end_date, $format, $node, $view);  
   
   // No date values, display nothing.  
   if (empty($date1) && empty($date2)) {  
     $output = '';  
   }  
   // From and To dates match or there is no To date,  
   // display a complete single date.  
   elseif ($date1 == $date2 || empty($date2)) {  
     $output = '<span class="date-display-single">'. $date1 .'</span>';  
   }  
   // Full date format, same day, different times, don't repeat the date  
   // but show both From and To times.  
   elseif (date_format($node->calendar_start_date, $node->format_time) != date_format($node->calendar_end_date, $node->format_time) && $format != $node->format_time) {  
     $date_format = date_limit_format($format, array('year', 'month', 'day'));  
     $output = '<span class="date-display-single">'. date_format($node->calendar_start_date, $date_format).'</span> '.  
       '<span class="date-display-start">'. date_format($node->calendar_start_date, $node->format_time) .'</span>'.  
       '<span class="date-display-separator"> - </span>'.  
       '<span class="date-display-end">'. date_format($node->calendar_end_date, $node->format_time) .'</span>';  
   }  
   // Time format only or different days, display both in their entirety.  
   else {  
     $output = '<span class="date-display-start">'. $date1 .'</span>'.  
       '<span class="date-display-separator"> - </span>'.  
       '<span class="date-display-end">'. $date2 .'</span>';  
   }  
   return $output;  
 }  
   
685  /** @} End of addtogroup themeable */  /** @} End of addtogroup themeable */

Legend:
Removed from v.1.10.2.53  
changed lines
  Added in v.1.10.2.54

  ViewVC Help
Powered by ViewVC 1.1.2