You are here

function _casetracker_get_og_query_string in Case Tracker 5

Same name and namespace in other branches
  1. 6 casetracker.module \_casetracker_get_og_query_string()
  2. 7 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

2 calls to _casetracker_get_og_query_string()
casetracker_projects_overview in ./casetracker.module
Menu callback; displays a list of all projects in a table. See the README.txt for the various URLs we support.
theme_casetracker_project_summary in ./casetracker.module
Theme the project summary shown at the beginning of a project's node.

File

./casetracker.module, line 1458
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' || isset($project->og_register)) {
    $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;
}