You are here

function archive_browse_form in Drupal 4

Generate a form that retrieves archives for a certain date.

1 call to archive_browse_form()
archive_page in modules/archive.module
Menu callback; lists all nodes posted on a given date.

File

modules/archive.module, line 253
Displays a calendar to navigate old content.

Code

function archive_browse_form($year, $month, $day) {

  // Prepare the values of the form fields.
  $years = drupal_map_assoc(range(2000, date('Y')));
  $months = array(
    1 => t('January'),
    2 => t('February'),
    3 => t('March'),
    4 => t('April'),
    5 => t('May'),
    6 => t('June'),
    7 => t('July'),
    8 => t('August'),
    9 => t('September'),
    10 => t('October'),
    11 => t('November'),
    12 => t('December'),
  );
  $days = drupal_map_assoc(range(1, 31));
  $form['year'] = array(
    '#type' => 'select',
    '#default_value' => $year ? $year : date('Y'),
    '#options' => $years,
  );
  $form['month'] = array(
    '#type' => 'select',
    '#default_value' => $month ? $month : date('m'),
    '#options' => $months,
  );
  $form['day'] = array(
    '#type' => 'select',
    '#default_value' => $day ? $day : date('d'),
    '#options' => $days,
  );
  $form['show'] = array(
    '#type' => 'submit',
    '#value' => t('Show'),
  );
  return drupal_get_form('archive_browse_form', $form);
}