You are here

function tft_manage_folders_form in Taxonomy File Tree 7.2

Same name and namespace in other branches
  1. 7 tft.admin.inc \tft_manage_folders_form()

Form: reorganize folder items.

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

File

includes/tft.pages.inc, line 356
Defines all page callbacks for TFT.

Code

function tft_manage_folders_form($form, $form_state, $tid = 0) {
  $path = drupal_get_path('module', 'tft');
  drupal_add_css($path . '/css/tft.css');
  drupal_add_js($path . '/js/tft.js');
  if (variable_get('tft_use_weight', 0)) {
    drupal_add_js($path . '/js/tft.tabledrag.js');
  }
  $tree = tft_tree($tid);
  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, TRUE, FALSE);
  $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) {
    $parts = explode('#', $url);
    $form['cancel'] = array(
      '#markup' => l(t("cancel"), $parts[0], array(
        'attributes' => array(
          'class' => array(
            'tft-cancel-button',
          ),
        ),
        'fragment' => isset($parts[1]) ? $parts[1] : '',
      )),
    );
  }
  return $form;
}