You are here

function andromeda_slideshow_load_slideshows in Andromeda Slideshow 7.2

Same name and namespace in other branches
  1. 7 andromeda_slideshow.module \andromeda_slideshow_load_slideshows()

Loads multiple slideshow by $sids

Parameters

$sids: keyed array of slideshow sids

4 calls to andromeda_slideshow_load_slideshows()
andromeda_slideshow_get_disabled_slideshows in includes/andromeda_slideshow.inc
Returns a list of disabled slideshows
andromeda_slideshow_get_enabled_slideshows in includes/andromeda_slideshow.inc
Returns a list of enabled slideshows
andromeda_slideshow_load in ./andromeda_slideshow.module
Loads a slideshow by its $sid
andromeda_slideshow_load_by_name in ./andromeda_slideshow.module
Loads a slideshow by its name

File

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

Code

function andromeda_slideshow_load_slideshows($sids = array(), $by_name = FALSE) {
  $slideshows = array();
  $field = 'sid';
  $query = db_select('slideshows', 's')
    ->fields('s', array(
    'sid',
    'title',
    'name',
    'description',
    'settings',
  ));
  if (sizeof($sids)) {

    //load by name if $by_name = TRUE
    if ($by_name) {
      $field = 'name';
    }
    $query = $query
      ->condition($field, $sids, 'IN');
  }
  $slideshows = $query
    ->orderBy('s.title')
    ->execute()
    ->fetchAllAssoc($field);
  foreach ($slideshows as $index => $slideshow) {
    $slideshows[$index]->settings = drupal_json_decode($slideshow->settings);
  }
  return $slideshows;
}