You are here

function theme_archive_navigation_days in Archive 7

Same name and namespace in other branches
  1. 5 archive.inc \theme_archive_navigation_days()
  2. 6 archive.pages.inc \theme_archive_navigation_days()
  3. 7.2 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 340
Pages for the archive module.

Code

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