You are here

function tft_og in Taxonomy File Tree 7.2

Same name and namespace in other branches
  1. 7 tft.pages.inc \tft_og()

Page callback: OG file tree.

Parameters

int $nid: The OG nid

Return value

string The HTML

2 string references to 'tft_og'
tft_og_menu in modules/tft_og/tft_og.module
Implements hook_menu().
tft_taxonomy_access_access in modules/tft_taxonomy_access/tft_taxonomy_access.module
Access callback: check if user has access to manage this term access.

File

modules/tft_og/tft_og.module, line 258
Hook implementations for TFT OG.

Code

function tft_og($nid) {

  // Check if the user can access content of this group
  if (!node_access('view', node_load($nid))) {
    drupal_access_denied();
    return;
  }

  // Get the term tid
  $tid = db_query("SELECT tid FROM {tft_tid_og_nid} WHERE og_nid = :nid", array(
    ':nid' => $nid,
  ))
    ->fetchField();

  // Set the breadcrumb
  $breadcrumb = drupal_get_breadcrumb();
  $title = db_query("SELECT {node_revision}.title FROM {node_revision}\n                                      LEFT JOIN {node} ON {node}.vid = {node_revision}.vid\n                                    WHERE {node}.nid = :nid", array(
    ':nid' => $nid,
  ))
    ->fetchField();
  $breadcrumb[] = l($title, "node/{$nid}");
  drupal_set_breadcrumb($breadcrumb);

  // Check if we have a valid term tid
  if (!$tid) {
    return t("No term was found for this group ! Please contact your system administrator.");
  }
  else {
    module_load_include('inc', 'tft', 'includes/tft.pages');
    return tft($tid, $nid);
  }
}