You are here

function views_ui_cache_load in Views (for Drupal 7) 6.3

Same name and namespace in other branches
  1. 8.3 views_ui/views_ui.module \views_ui_cache_load()
  2. 6.2 views_ui.module \views_ui_cache_load()
  3. 7.3 views_ui.module \views_ui_cache_load()

Specialized menu callback to load a view either out of the cache or just load it.

File

./views_ui.module, line 249
views_ui.module Provide structure for the administrative interface to Views.

Code

function views_ui_cache_load($name) {
  views_include('cache');
  views_include('view');
  $view = views_object_cache_get('view', $name);
  if (empty($view)) {
    $view = views_get_view($name);
    if (!empty($view)) {

      // Check to see if someone else is already editing this view.
      global $user;
      $view->locked = db_fetch_object(db_query("SELECT s.uid, v.updated FROM {views_object_cache} v INNER JOIN {sessions}  s ON v.sid = s.sid WHERE s.sid != '%s' and v.name = '%s' and v.obj = 'view' ORDER BY v.updated ASC", session_id(), $view->name));

      // Set a flag to indicate that this view is being edited.
      // This flag will be used e.g. to determine whether strings
      // should be localized.
      $view->editing = TRUE;
    }
  }
  if (empty($view)) {
    return FALSE;
  }
  else {
    return $view;
  }
}