function views_ui_cache_load

Same name in other branches
  1. 7.x-3.x 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

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;
    }
}