<?php

/**
 * @file
 * Install, update and uninstall functions for the Date Views module.
 */

/**
 * Implements hook_install().
 */
function date_views_install() {
  variable_set('date_views_month_format_with_year', 'F Y');
  variable_set('date_views_month_format_without_year', 'F');
  variable_set('date_views_day_format_with_year', 'l, F j, Y');
  variable_set('date_views_day_format_without_year', 'l, F j');
  variable_set('date_views_week_format_with_year', 'F j, Y');
  variable_set('date_views_week_format_without_year', 'F j');
}

/**
 * Implements hook_uninstall().
 */
function date_views_uninstall() {
  variable_del('date_views_month_format_with_year');
  variable_del('date_views_month_format_without_year');
  variable_del('date_views_day_format_with_year');
  variable_del('date_views_day_format_without_year');
  variable_del('date_views_week_format_with_year');
  variable_del('date_views_week_format_without_year');
}

/**
 * Set default date views variables.
 */
function date_views_update_7200() {
  if (!variable_get('date_views_month_format_with_year', FALSE)) {
    variable_set('date_views_month_format_with_year', 'F Y');
  }
  if (!variable_get('date_views_month_format_without_year', FALSE)) {
    variable_set('date_views_month_format_without_year', 'F');
  }
  if (!variable_get('date_views_day_format_with_year', FALSE)) {
    variable_set('date_views_day_format_with_year', 'l, F j, Y');
  }
  if (!variable_get('date_views_day_format_without_year', FALSE)) {
    variable_set('date_views_day_format_without_year', 'l, F j');
  }
  if (!variable_get('date_views_week_format_with_year', FALSE)) {
    variable_set('date_views_week_format_with_year', 'F j, Y');
  }
  if (!variable_get('date_views_week_format_without_year', FALSE)) {
    variable_set('date_views_week_format_without_year', 'F j');
  }
}
