You are here

function tft_manage_folders_form in Taxonomy File Tree 7

Same name and namespace in other branches
  1. 7.2 includes/tft.pages.inc \tft_manage_folders_form()

Reorganise terms under the given term tid.

Parameters

int $tid = 0: The top most parent term tid or 0 for root terms

Return value

string The HTML

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

File

./tft.admin.inc, line 68

Code

function tft_manage_folders_form($form, $form_state, $tid = 0, $use_hierarchy = TRUE, $use_weight = TRUE) {
  drupal_add_css(drupal_get_path('module', 'tft') . '/css/tft.css');
  drupal_add_js(drupal_get_path('module', 'tft') . '/js/tft.js');

  //  drupal_add_js(drupal_get_path('module', 'tft') . '/js/tft.tabledrag.js');
  $tree = tft_tree($tid);
  $form = array();
  if (!tft_term_access($tid)) {
    drupal_access_denied();
    return;
  }
  if (!$tid) {
    $root_depth = 0;
  }
  else {
    $root_depth = tft_get_depth($tid) + 1;
  }
  $form['#tid'] = $tid;
  $form['table'] = array(
    '#tree' => TRUE,
  );
  _tft_manage_folders_form($tree, $form, $root_depth, $tid, $use_hierarchy, $use_weight);
  $form['save'] = array(
    '#type' => 'submit',
    '#value' => t('Save'),
  );
  if (isset($_GET['destination'])) {
    $_SESSION['tft']['q'] = $_GET['destination'];
    $url = str_replace('%23', '#', $_GET['destination']);
  }
  elseif (isset($_SESSION['tft']['q'])) {
    $url = str_replace('%23', '#', $_SESSION['tft']['q']);
  }
  if ($url) {
    $form['cancel'] = array(
      '#value' => '<a href="' . base_path() . $url . '">' . t("cancel") . '</a>',
    );
  }
  return $form;
}