You are here

function opening_hours_admin_settings_page in Opening hours 7

Same name and namespace in other branches
  1. 6 includes/opening_hours.admin.inc \opening_hours_admin_settings_page()

Main admin overview page.

1 string reference to 'opening_hours_admin_settings_page'
opening_hours_menu in ./opening_hours.module
Implements hook_menu().

File

includes/opening_hours.admin.inc, line 10
Administration page for opening hours.

Code

function opening_hours_admin_settings_page() {
  $page = array();

  // Blocked days section.
  $page['blocked_title'] = array(
    '#tag' => 'h3',
    '#type' => 'html_tag',
    '#value' => t('Blocked days'),
  );
  $page['blocked_description'] = array(
    '#tag' => 'p',
    '#type' => 'html_tag',
    '#value' => t('Blocked days are days where no opening hours are
    allowed, ie. everythings appears to be closed. You can use this
    functionality to enforce closing days for a large chain of shops or
    similar organisations, to avoid having to enter closing data on
    dozens of pages.'),
    '#attributes' => array(
      'class' => 'description',
    ),
  );
  $items = array();
  $blocked_days = variable_get('opening_hours_blocked_days', array());
  foreach ($blocked_days as $date) {
    $items[] = $date . ' ' . l(t('Delete'), 'admin/structure/opening_hours/blocked_day/' . $date . '/delete');
  }
  if (!empty($items)) {
    $page['blocked_day_list'] = array(
      '#items' => $items,
      '#theme' => 'item_list',
    );
  }
  else {
    $output[] = '<p>' . t('No blocked days found.') . '</p>';
  }
  $page['block_add_new'] = array(
    '#markup' => l(t('Add new blocked day'), 'admin/structure/opening_hours/blocked_day/add'),
  );
  return $page;
}