You are here

function theme_archive_navigation_days in Archive 6

Same name and namespace in other branches
  1. 5 archive.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.

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

File

./archive.pages.inc, line 320

Code

function theme_archive_navigation_days($type, $date) {
  $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(
    'attributes' => 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());
  $day_stop = gmdate('t', gmmktime(0, 0, 0, $date->month, 1, $date->year));
  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"';
    }
    else {
      if ($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(
      'attributes' => array(
        "title" => format_plural($posts, "1 post", "@count posts"),
      ),
    )) : $day) . "</li>\n";
  }
  $output .= "</ul>\n";
  return $output;
}