You are here

function taxonomy_manager_update_weights in Taxonomy Manager 6.2

Same name and namespace in other branches
  1. 5 taxonomy_manager.module \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.admin.inc, line 2371
Taxonomy Manager Admin

Code

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