You are here

function tft_og in Taxonomy File Tree 7

Same name and namespace in other branches
  1. 7.2 modules/tft_og/tft_og.module \tft_og()

Menu callback function the OG file explorer

Parameters

int $nid: The OG nid

Return value

string The HTML

1 string reference to 'tft_og'
tft_menu in ./tft.module
Implementation of hook_menu().

File

./tft.pages.inc, line 76

Code

function tft_og($nid) {

  // Check that all the settings are set.
  tft_check_vocabulary_setting();

  // 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 {
    return tft($tid, $nid);
  }
}