You are here

function _spaces_groupmask in Spaces 5.2

Legacy function. Included in order to migrate from older previous versions of spaces.

1 call to _spaces_groupmask()
spaces_update_1 in ./spaces.install

File

./spaces.install, line 146

Code

function _spaces_groupmask($op = 'mask', $og_settings = array()) {
  static $spacetype_mask;
  if (!$spacetype_mask) {
    $spacetype_mask = array(
      'private' => array(
        'label' => t('Private'),
        'limit options' => array(
          SPACES_PRIVATE,
        ),
        'mask' => array(
          'og_selective' => OG_CLOSED,
          'og_directory' => OG_DIRECTORY_NEVER,
          'og_register' => OG_REGISTRATION_ALWAYS,
          'og_private' => defined(OG_PRIVATE_GROUPS_ALWAYS) ? OG_PRIVATE_GROUPS_ALWAYS : 1,
        ),
      ),
      'controlled' => array(
        'label' => t('Controlled'),
        'mask' => array(
          'og_selective' => variable_get('spaces_controlled_selective', OG_CLOSED),
          'og_directory' => OG_DIRECTORY_ALWAYS,
          'og_register' => OG_REGISTRATION_ALWAYS,
          'og_private' => defined(OG_PRIVATE_GROUPS_NEVER) ? OG_PRIVATE_GROUPS_NEVER : 0,
        ),
      ),
      'public' => array(
        'label' => t('Public'),
        'limit options' => array(
          SPACES_PUBLIC,
        ),
        'mask' => array(
          'og_selective' => OG_OPEN,
          'og_directory' => OG_DIRECTORY_ALWAYS,
          'og_register' => OG_REGISTRATION_ALWAYS,
          'og_private' => defined(OG_PRIVATE_GROUPS_NEVER) ? OG_PRIVATE_GROUPS_NEVER : 0,
        ),
      ),
    );
  }
  switch ($op) {
    case 'mask':
      return $spacetype_mask;
    case 'check':
      foreach ($spacetype_mask as $key => $type) {
        if ($og_settings == $type['mask']) {
          return $key;
        }
      }
      return false;
    case 'labels':
      $labels = array();
      foreach ($spacetype_mask as $key => $type) {
        $labels[$key] = $type['label'];
      }
      return $labels;
  }
}