/[drupal]/contributions/modules/carbon/carbon_account.inc
ViewVC logotype

Diff of /contributions/modules/carbon/carbon_account.inc

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

revision 1.5 by johnackers, Tue Jan 6 22:19:26 2009 UTC revision 1.6 by johnackers, Sat Jan 10 15:46:14 2009 UTC
# Line 266  function carbon_account_account_form(&$f Line 266  function carbon_account_account_form(&$f
266  {  {
267    $form["account"] = array(    $form["account"] = array(
268      "#type" => "fieldset",      "#type" => "fieldset",
269      "#title" => "My preferences",      "#title" => "Carbon settings",
270      "#weight" => -1,      "#weight" => -1,
271  //      '#prefix' => '<div class="container-inline">',  //      '#prefix' => '<div class="container-inline">',
272  //      '#suffix' => '</div>',  //      '#suffix' => '</div>',
# Line 395  function carbon_account_validate($form_i Line 395  function carbon_account_validate($form_i
395    carbon_stamp_validate($form_id, $form_values);    carbon_stamp_validate($form_id, $form_values);
396  }  }
397    
   
   
   
398  /**  /**
399   * Implementation of hook_view, add our node specific information   * Implementation of hook_view, add our node specific information
400   * @param node object to display   * @param node object to display
# Line 750  function carbon_account_delete($node) { Line 747  function carbon_account_delete($node) {
747  }  }
748    
749    
 /**  
  * Add whole years onto a date  
  *  
  * @param unix timestamp (secs from 1970)  
  * @param integer number of months  
  * @return the new date (secs from 1970)  
  */  
   
 function _add_months($date, $num)  
 {  
     return strtotime($num." month", $date);  
 }  
   
 /**  
  * bypass Drupal's format_date() which deals only with offsets and  
  * appears to not understand daylight savings time.  
  *  
  * @param $timestamp  
  * @param $type  
  * @return unknown_type  
  */  
   
750    
 function _format_date($timestamp, $type = 'medium', $format = '')  
 {  
         // lifted formatting options from drupal code for consistency  
   switch ($type) {  
     case 'small':  
       $format = variable_get('date_format_short', 'm/d/Y - H:i');  
       break;  
     case 'large':  
       $format = variable_get('date_format_long', 'l, F j, Y - H:i');  
       break;  
     case 'custom':  
       // No change to format  
       break;  
     case 'medium':  
     default:  
       $format = variable_get('date_format_medium', 'D, m/d/Y - H:i');  
   }  
         return date($format, $timestamp);  
 }  
   
   
   
 /**  
  * Format a date range. The main purpose of this is to show a  
  * date range using as few as characters as possible so that  
  * it takes little space on the screen without being ambiguous.  
  */  
   
 function _format_date_range($firstdate, $lastdate)  
 {  
   $y1 = _format_date($firstdate, "custom", "y"); $y2 = _format_date($lastdate, "custom", "y");  
   $m1 = _format_date($firstdate, "custom", "m"); $m2 = _format_date($lastdate, "custom", "m");  
   
   if ($y1 == $y2)  
   {  
     if ($m1 == $m2)  
       return _format_date($firstdate,"custom", "M Y");  
   
     return _format_date($firstdate,"custom", "M")." to "._format_date($lastdate,"custom", "M Y");  
   }  
   return _format_date($firstdate,"custom", "M Y")." to "._format_date($lastdate,"custom", "M Y");  
 }  
751    
752    
753    

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

  ViewVC Help
Powered by ViewVC 1.1.3