| 4 |
* @author Ryan Hughes <ryan@linuxbox.com> |
* @author Ryan Hughes <ryan@linuxbox.com> |
| 5 |
*/ |
*/ |
| 6 |
|
|
| 7 |
function theme_monthgroup_monthgroup_teaser($view, $nodes, $type) { |
function theme_monthgroup_group_teaser($view, $nodes, $type) { |
| 8 |
return theme("monthgroup_monthgroup", $view, $nodes, $type, true); |
return theme("monthgroup_group", $view, $nodes, $type, true); |
| 9 |
} // funciton theme_monthgroup_monthgroup_teaser |
} // funciton theme_monthgroup_monthgroup_teaser |
| 10 |
|
|
| 11 |
|
|
| 12 |
function theme_monthgroup_monthgroup($view, $nodes, $type, $teaser=false) { |
function theme_monthgroup_group($view, $nodes, $type, $teaser=false) { |
| 13 |
$output = ""; |
$output = ""; |
| 14 |
|
|
| 15 |
drupal_add_css(drupal_get_path('module', 'views_group_pack').'/monthgroup.css'); |
drupal_add_css(drupal_get_path('module', 'views_group_pack').'/monthgroup.css'); |
| 28 |
} // if the sort field isn't set |
} // if the sort field isn't set |
| 29 |
|
|
| 30 |
$by_month = array(); |
$by_month = array(); |
| 31 |
|
include_once(drupal_get_path('module', 'date_api') .'/date.inc'); |
| 32 |
foreach ($nodes as $proto_node) { |
foreach ($nodes as $proto_node) { |
| 33 |
$node = node_load($proto_node->nid); |
$node = node_load($proto_node->nid); |
| 34 |
$val = $node->$sort_field; |
$val = $node->$sort_field; |
| 35 |
$val = $val[0]['value']; |
$val = $val[0]['value']; |
| 36 |
$year = date('Y', strtotime($val)); |
|
| 37 |
$month = date('F', strtotime($val)); |
// format_date doesn't handle pre-1970 dates, so we'll use date_format_date |
| 38 |
|
// in that case. But both of these provide translation. |
| 39 |
|
if (function_exists('date_format_date')) { |
| 40 |
|
$year = date_format_date('Y', strtotime($val)); |
| 41 |
|
$month = date_format_date('F', strtotime($val)); |
| 42 |
|
} else { |
| 43 |
|
$year = format_date(strtotime($val), 'custom', 'Y', 0); |
| 44 |
|
$month = format_date(strtotime($val), 'custom', 'F', 0); |
| 45 |
|
} |
| 46 |
|
|
| 47 |
|
|
| 48 |
$by_month[$year][$month][] = $node; |
$by_month[$year][$month][] = $node; |
| 49 |
} // foreach node |
} // foreach node |
| 50 |
|
|
| 51 |
|
return theme("monthgroup_monthgroup", $view, $by_month, $type, $teaser); |
| 52 |
|
} |
| 53 |
|
|
| 54 |
$output .= "<div id=\"monthgroup\" class=\"monthgroup\">"; |
function theme_monthgroup_monthgroup($view, $by_month, $type, $teaser=false) { |
| 55 |
|
$output = "<div id=\"monthgroup\" class=\"monthgroup\">"; |
| 56 |
foreach ($by_month as $year => $monthlist) { |
foreach ($by_month as $year => $monthlist) { |
| 57 |
$output .= theme('monthgroup_year', $monthlist, $year, $teaser); |
$output .= theme('monthgroup_year', $monthlist, $year, $teaser); |
| 58 |
} // foreach year |
} // foreach year |