You are here

function andromeda_slideshow_reorder_slideshow in Andromeda Slideshow 7

Same name and namespace in other branches
  1. 7.2 andromeda_slideshow.module \andromeda_slideshow_reorder_slideshow()

Reorders images in a slideshow

Parameters

$slideshow: the slideshow object

$images: Images array value pairs array($siid => array('position' => $position))

1 call to andromeda_slideshow_reorder_slideshow()
andromeda_slideshow_manage_form_submit in includes/andromeda_slideshow.forms.inc
Submit handler for andromeda_slideshow_manage_form

File

./andromeda_slideshow.module, line 558
Slideshow for the Andromeda (http://drupal.org/project/andromeda) Theme

Code

function andromeda_slideshow_reorder_slideshow($slideshow, $images) {
  $update = TRUE;
  foreach ($images as $siid => $values) {
    $fields = array(
      'position' => $values['position'],
    );
    $query = db_update('slideshows_index')
      ->fields($fields)
      ->condition('sid', $slideshow->sid)
      ->condition('siid', $siid)
      ->execute();
    if (!$query) {
      $update = FALSE;
    }
  }
  return $update;
}