You are here

function tft_get_folder_operation_links in Taxonomy File Tree 7

Return an <ul> with links for the current folder. Links include:

  • "go to parent"
  • "edit permissions"
  • "reorder folders"

Parameters

int $tid: The term tid

Return value

string The HTML string

2 calls to tft_get_folder_operation_links()
tft in ./tft.pages.inc
Menu callback function the file explorer
tft_ajax_get_folder in ./tft.ajax.inc
Menu function callback for getting the forlder content via AJAX. Returns a JSON object with a 'data' key for the HTML table and a 'parent' key for the parent taxonomy term tid. A 'ops_links' key stores the folder menu.

File

./tft.module, line 1340
Module hooks.

Code

function tft_get_folder_operation_links($tid, $gid = NULL) {
  $html = '<ul class="tabs primary" id="folder-menu-ops-links">';

  // First link: got to parent
  $parent_tid = tft_get_parent_tid($tid);
  if ($parent_tid > -1 && $tid != $_SESSION['tft']['root_tid']) {
    if (!tft_term_access($parent_tid)) {
      $disabled = TRUE;
    }
  }
  else {
    $disabled = TRUE;
  }
  $og_nid = tft_get_og_nid($tid);
  $html .= '<li id="tft-back" class="folder-menu-ops-link first"><a id="tft-back-link" class="' . ($disabled ? 'disabled' : '') . '" href="#' . ($disabled ? '' : "term/{$parent_tid}") . '">' . t("parent folder") . '</a></li>';

  // Third link: reorder child terms
  if (og_user_access('node', $og_nid, TFT_REORDER_TERMS)) {
    $html .= '<li id="manage-folders" class="folder-menu-ops-link">' . l(t("reorder elements"), "tft/terms/reorder/{$tid}", array(
      'query' => array(
        'destination' => $_SESSION['tft']['q'],
      ),
    )) . '</li>';
  }
  return $html . '</ul>';
}