You are here

function taxonomy_manager_update_weights in Taxonomy Manager 5

Same name and namespace in other branches
  1. 6.2 taxonomy_manager.admin.inc \taxonomy_manager_update_weights()
  2. 6 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.module, line 1450
Taxonomy Manager

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;
}