You are here

function form_save_order_submit in Sortable Grid Views Plugin 6

File

./sgrid.module, line 41

Code

function form_save_order_submit($form, $form_state) {
  db_query("DELETE FROM {sgrid} WHERE view_display = '%s'", $form_state['values']['viewdisplay']);
  foreach (explode(',', $form_state['values']['itemsorder']) as $index => $name) {
    $nid = substr(strrchr($name, '_'), 1);
    db_query("INSERT INTO {sgrid} (nid, rank, view_display) VALUES (%d, %d, '%s')", $nid, $index, $form_state['values']['viewdisplay']);
  }
}