You are here

function calendar_handler_arg_type in Calendar 5

Same name and namespace in other branches
  1. 5.2 calendar.module \calendar_handler_arg_type()

Custom views handler for all calendar arguments.

4 calls to calendar_handler_arg_type()
calendar_handler_arg_day in ./calendar.module
Custom views handler for the day argument.
calendar_handler_arg_month in ./calendar.module
Custom views handler for the month argument.
calendar_handler_arg_week in ./calendar.module
Custom views handlers for the week argument.
calendar_handler_arg_year in ./calendar.module
Custom views handler for the year argument.

File

./calendar.module, line 657
Adds calendar filtering and displays to Views.

Code

function calendar_handler_arg_type($op, &$query, $argtype, $arg, $field_type) {
  calendar_load_date_api();
  switch ($op) {
    case 'summary':
    case 'link':

      // The query to do summaries when date ranges can include multiple days, months, and years
      // is extremely complex and has been omitted, so summary views with these arguments just will not work.
      // TODO add some kind of validation or warning to keep people from trying to use summary views.
      break;
    case 'filter':

      // Figure out which will be the final calendar argument in this view so we know when to insert the query.
      $view = $GLOBALS['current_view'];
      if ($argtype['type'] == calendar_is_last_arg($view)) {
        $query->calendar_finished = TRUE;
        calendar_build_filter($query, $view);
      }
      break;
    case 'title':

      // Set titles for each argument.
      $value = intval(str_replace('W', '', $arg ? $arg : $query));
      return theme('calendar_arg_title', $field_type, $value, $query);
  }
  return;
}