Study 3-Year Medicine. Online Options. Funding Available.
Open days
Join Our Open Days
Study Medicine Europe Open days
array(1665, 1669), 1661=>array(1661, 1674)); $galleryYear = ‘2017’; $titleVideo = “Entry Exam {$galleryYear} Video”; $titleGallery = “Entry Exam {$galleryYear} Photo Gallery”; $result = db_select(‘node’, ‘n’)->fields(‘n’)->condition(‘status’, 1)->condition(“type”,”gallery”, ‘=’)->execute(); $allGalleryArray =array(); $childGalleryArray =array(); $allGalleryVideoArray =array(); foreach ($result as $record) { if(in_array($record->nid, $galleryNodeIds)){ $node = node_load($record->nid); $galleryImages = array(); foreach($node->field_images[‘und’] as $image){ $galleryImages[] = array(‘url’ => file_create_url($image[‘uri’]), ‘alt’ => $image[‘alt’], ‘title’ => $image[‘title’]); } $allGalleryArray[] = array( ‘id’ => $node ->nid, ‘title’ => $node->field_title[‘und’][0][‘value’], ‘videoUrl’ => $node->field_video[‘und’][0][‘video_url’], ‘position’ => (int)$node->field_position[‘und’][0][‘value’], ‘gallery’ => $galleryImages ); if($node->field_video[‘und’][0][‘video_url’] != ” && $node->field_video[‘und’][0][‘video_url’] != null){ $allGalleryVideoArray[] = array( ‘id’ => $node ->nid, ‘title’ => $node->field_title[‘und’][0][‘value’], ‘videoUrl’ => $node->field_video[‘und’][0][‘video_url’], ‘position’ => (int)$node->field_position[‘und’][0][‘value’], ); } } //$childGalleryArray //if(in_array($record->nid, $childGalleryNodeIds)){ foreach($childGalleryNodeIds as $childGalleryNodeIdsKey=>$childGalleryNodeIdsVal){ if(in_array($record->nid, $childGalleryNodeIdsVal)){ $node = node_load($record->nid); $galleryImages = array(); foreach($node->field_images[‘und’] as $image){ $galleryImages[] = array(‘url’ => file_create_url($image[‘uri’]), ‘alt’ => $image[‘alt’], ‘title’ => $image[‘title’]); } $childGalleryArray[$childGalleryNodeIdsKey][] = array( ‘id’ => $node ->nid, ‘title’ => $node->field_title[‘und’][0][‘value’], ‘videoUrl’ => $node->field_video[‘und’][0][‘video_url’], ‘position’ => (int)$node->field_position[‘und’][0][‘value’], ‘gallery’ => $galleryImages ); } } } //print_r($allGalleryArray) usort($allGalleryArray, function($a, $b) { return $a[‘position’] – $b[‘position’]; }); usort($allGalleryVideoArray, function($a, $b) { return $a[‘position’] – $b[‘position’]; }); foreach($childGalleryArray as $childGalleryArrayKey=>$childGalleryArrayVal){ usort($childGalleryArrayVal, function($a, $b) { return $a[‘position’] – $b[‘position’]; }); $childGalleryArray[$childGalleryArrayKey] = $childGalleryArrayVal; } //print_r($childGalleryArray); ?>