'jquery_gallery_view', 'access arguments' => array('access content'), 'type' => MENU_CALLBACK, ); return $items; } /** * Implementation of hook_theme(). */ function jquery_gallery_view_theme() { return array( 'jquery_gallery_view' => array( 'arguments' => array( 'images' => array(), ), ), ); } /** * Menu callback. */ function jquery_gallery_view() { return jquery_gallery_view_setup_photos(); } /** * Load needed javascript files. */ function jquery_gallery_view_load() { drupal_add_js(drupal_get_path('module', 'jquery_gallery_view') .'/js/jquery_gallery_view.js'); drupal_add_js(drupal_get_path('module', 'jquery_gallery_view') .'/js/galleryview/jquery.galleryview-2.1.1-pack.js'); drupal_add_js(drupal_get_path('module', 'jquery_gallery_view') .'/js/galleryview/jquery.timers-1.2.js'); } /** * Setup photos for a view. * * @param $viewname * View data. * * @param $field * File field name. * * @param $title * Title field name. */ function jquery_gallery_view_setup_photos($viewname = 'foto', $field = 'field_foto_fid', $title = 'field_xmp_title_value') { global $base_url; $files = variable_get('file_directory_path', conf_path() .'/files'); $view = views_get_view($viewname); $view->execute(); $field = $view->display_handler->get_handler('field', $field)->field_alias; $title = $view->display_handler->get_handler('field', $title)->field_alias; foreach ($view->result as $result) { $fid = $result->{$field}; if ($fid != NULL) { $file = field_file_load($fid); $text = $result->{$title}; $images[] = array( 'url' => $base_url .'/'. $files .'/imagecache/65x40/images/'. $file['filename'], 'title' => $text, ); } } echo theme('jquery_gallery_view', $images); exit; } /** * Theme a jQuery Gallery list. * * @param $images * Array with images's urls and titles. * * @return * HTML list of images. */ function theme_jquery_gallery_view($images = array()) { $output = ''; return $output; }