You are here

function theme_archive_navigation_days in Archive 5

Same name and namespace in other branches
  1. 6 archive.pages.inc \theme_archive_navigation_days()
  2. 7.2 archive.pages.inc \theme_archive_navigation_days()
  3. 7 archive.pages.inc \theme_archive_navigation_days()

Theme the list of days for the archive navigation.

Parameters

$type: A string representing the node-type currently being displayed

$date: A date object returned from _archive_date()

1 theme call to theme_archive_navigation_days()
theme_archive_navigation in ./archive.inc
Theme the archive navigation with years, months and dates by default.

File

./archive.inc, line 272

Code

function theme_archive_navigation_days($type, $date) {
  $output = "";
  $day_stop = gmdate('t', gmmktime(0, 0, 0, $date->month, 1, $date->year));
  $output = "<ul id=\"archive-days\">\n";
  $all_count = 0;
  foreach ($date->days as $day) {
    $all_count += $day;
  }
  $output .= '<li' . ($date->day ? '' : ' class="selected"') . '>' . l(t('All'), _archive_url($type, $date->year, $date->month), array(
    'title' => format_plural($all_count, '1 post', '@count posts'),
  )) . "</li>\n";
  $curr_month = date('n', time());
  $curr_year = date('Y', time());
  $curr_day = date('j', time());
  for ($day = 1; $day <= $day_stop; $day++) {
    $posts = array_key_exists($day, $date->days) ? $date->days[$day] : 0;
    $class = '';
    if ($day == $date->day) {
      $class = ' class="selected"';
    }
    elseif ($curr_year == $date->year && $curr_month == $date->month && $day > $curr_day) {
      $class = ' class="future"';
    }
    $output .= "<li{$class}>" . ($posts ? l($day, _archive_url($type, $date->year, $date->month, $day), array(
      "title" => format_plural($posts, "1 post", "@count posts"),
    )) : $day) . "</li>\n";
  }
  $output .= "</ul>\n";
  return $output;
}