You are here

function draggableviews_handler_native::save in DraggableViews 7

Same name and namespace in other branches
  1. 6.3 implementations/draggableviews_handler_native.inc \draggableviews_handler_native::save()

Overrides draggableviews_handler::save

File

implementations/draggableviews_handler_native.inc, line 17
The default implementation of draggableviews handlers.

Class

draggableviews_handler_native

Code

function save($nid, $value) {
  $args = '';
  if (!empty($this->view->style_plugin->options['draggableviews_arguments']['use_args'])) {
    $args = implode('/', $this->view->args);
  }

  // TODO Please review the conversion of this statement to the D7 database API syntax.

  /* db_query("DELETE FROM {draggableviews_structure} WHERE view_name='%s' AND nid=%d AND delta=%d AND args='%s'", $this->view->name, $nid, $this->delta, $args) */
  db_delete('draggableviews_structure')
    ->condition('view_name', $this->view->name)
    ->condition('nid', $nid)
    ->condition('delta', $this->delta)
    ->condition('args', $args)
    ->execute();

  // TODO Please convert this statement to the D7 database API syntax.

  /* db_query("INSERT INTO {draggableviews_structure}(view_name, nid, delta, value, args) VALUES('%s', %d, %d, %d, '%s')", $this->view->name, $nid, $this->delta, $value, $args) */
  $record = array(
    'view_name' => $this->view->name,
    'nid' => $nid,
    'delta' => $this->delta,
    'value' => $value,
    'args' => $args,
  );
  drupal_write_record('draggableviews_structure', $record);
}