You are here

function _casetracker_get_og_query_string in Case Tracker 7

Same name and namespace in other branches
  1. 5 casetracker.module \_casetracker_get_og_query_string()
  2. 6 casetracker.module \_casetracker_get_og_query_string()

Returns an query string needed in case of Organic Groups providing preselected audience checkboxes for projects as groups (og)

Parameters

object CT project:

Return value

string

1 call to _casetracker_get_og_query_string()
theme_casetracker_project_summary in ./casetracker.module
Theme the project summary shown at the beginning of a project's node.

File

./casetracker.module, line 958
Enables the handling of projects and their cases.

Code

function _casetracker_get_og_query_string(&$project) {
  $querystring = array();

  // checking if project is group
  if ($project->type == 'group') {
    $querystring[] = 'gids[]=' . $project->nid;

    //checking if group-project is part of another group
    if (isset($project->og_groups) && is_array($project->og_groups)) {
      foreach ($project->og_groups as $group) {
        $querystring[] = 'gids[]=' . $group;
      }
    }
  }
  elseif (isset($project->og_groups) && is_array($project->og_groups) && $project->type !== 'group') {
    foreach ($project->og_groups as $group) {
      $querystring[] = 'gids[]=' . $group;
    }
  }
  return 0 < count($querystring) ? implode('&', $querystring) : NULL;
}