You are here

function date_views_browser_get_views in Date 5

Same name and namespace in other branches
  1. 5.2 date/date_views.inc \date_views_browser_get_views()

Find all the views that qualify for date browser treatment

3 calls to date_views_browser_get_views()
date_clear_all in ./date.module
Empty or reset cached values.
theme_date_views_browser_full_view in ./date_views.inc
View, themed so it can be overridden $display -- views_view_list, views_view_table, views_view_teasers, views_view_nodes
_date_views_query_alter in ./date_views.inc
Implementation of hook_views_query() Used to make sure view defaults to current date if no date selected

File

./date_views.inc, line 642

Code

function date_views_browser_get_views($reset = FALSE) {
  static $date_views_browser_views;
  if (empty($date_views_browser_views) || $reset) {
    $cid = 'date_browser_views';
    if (!$reset && ($cached = cache_get($cid, 'cache_views'))) {
      $date_views_browser_views = unserialize($cached->data);
    }
    else {
      $date_views_browser_views = array();
      $arguments = array();
      $fields = content_fields();
      foreach ($fields as $field) {
        if ($field['type'] == DATE_UNIX || $field['type'] == DATE_ISO) {
          $arguments = array_merge($arguments, _date_views_arguments($field));
        }
      }
      $argument_list = "'" . implode("','", array_keys($arguments)) . "'";
      if (!$argument_list) {
        return array();
      }
      $result = db_query("SELECT arg.*, view.name FROM {view_argument} arg INNER JOIN {view_view} view ON arg.vid=view.vid WHERE arg.type IN ({$argument_list}) AND view.page_type='date_views_browser'");
      while ($view = db_fetch_object($result)) {
        $date_views_browser_views[$view->name] = $view;
      }
      cache_set($cid, 'cache_views', serialize($date_views_browser_views));
    }
  }
  return $date_views_browser_views;
}