You are here

function oa_core_get_space_context in Open Atrium Core 7.2

Returns the current space id context

Parameters

boolean $from_session only use the context stored in $SESSION: set this to TRUE if calling from a access hook to avoid infinite loops

Return value

int Space ID

21 calls to oa_core_get_space_context()
OaGroupsSelectionHandler::getReferencableEntities in plugins/entityreference/selection/OaGroupsSelectionHandler.class.php
Implements EntityReferenceHandler::getReferencableEntities().
oa_buttons_clear_section_button_cache in modules/oa_buttons/oa_buttons.module
Clear the button cache for the given group
oa_core_create_node in includes/oa_core.util.inc
Create a new content node within a space/section
oa_core_create_space_access in ./oa_core.module
Menu access callback for creating space types
oa_core_form_views_content_views_panes_content_type_edit_form_alter in ./oa_core.module
Implements hook_form_FORM_ID_alter().

... See full list

File

includes/oa_core.util.inc, line 214
Code for Utility functions for OpenAtrium spaces

Code

function oa_core_get_space_context($from_session = FALSE) {
  if (variable_get('install_task') !== 'done') {

    // don't run this during the installer
    return 0;
  }
  if ($from_session) {
    if (defined('OG_SESSION_CONTEXT_ID') && isset($_SESSION[OG_SESSION_CONTEXT_ID])) {
      return $_SESSION[OG_SESSION_CONTEXT_ID];
    }
    return 0;
  }
  $context = og_context('node');
  if (!empty($context['gid'])) {
    og_session_context_set_context($context['gid']);
    return $context['gid'];
  }
  else {
    return og_session_context_get_context();
  }
}