| 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>', |
| 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 |
| 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 |
|
|