You are here

function taxonomy_manager_update_weights in Taxonomy Manager 6

Same name and namespace in other branches
  1. 5 taxonomy_manager.module \taxonomy_manager_update_weights()
  2. 6.2 taxonomy_manager.admin.inc \taxonomy_manager_update_weights()
  3. 7 taxonomy_manager.admin.inc \taxonomy_manager_update_weights()

callback for updating weights data send through AJAX, $_POST $_POST[$tid] => $weight

1 string reference to 'taxonomy_manager_update_weights'
taxonomy_manager_menu in ./taxonomy_manager.module
Implementation of hook_menu

File

./taxonomy_manager.admin.inc, line 1353

Code

function taxonomy_manager_update_weights($vid) {
  $weights = $_POST;
  if (is_array($weights)) {
    foreach ($weights as $tid => $weight) {
      if (is_numeric($tid) && is_numeric($weight)) {
        if (_taxonomy_manager_tree_term_valid($tid, $vid)) {
          db_query("UPDATE {term_data} SET weight = %d WHERE tid = %d", $weight, $tid);
        }
      }
    }
  }
  exit;
}