[3298] | 1 | <?php |
---|
| 2 | |
---|
[5735] | 3 | global $page, $conf, $template, $user; |
---|
[3298] | 4 | |
---|
| 5 | include_once(LIGHTBOX_PATH.'functions.inc.php'); |
---|
| 6 | $params = unserialize($conf['lightbox']); |
---|
| 7 | $conf['lightbox_rel'] = isset($conf['lightbox_rel']) ? ++$conf['lightbox_rel'] : 0; |
---|
[7252] | 8 | $selector = 'a[rel=colorbox'.$conf['lightbox_rel'].']'; |
---|
[3298] | 9 | |
---|
[10078] | 10 | $template->func_combine_script(array('id'=>'jquery.colorbox', 'path'=>'plugins/lightbox/js/jquery.colorbox.js'), $smarty); |
---|
[9977] | 11 | $template->func_combine_css(array('path'=>'plugins/lightbox/theme/'.$params['theme'].'/colorbox.css'), $smarty); |
---|
[10078] | 12 | $template->block_html_head('',' |
---|
| 13 | <script type="text/javascript"> |
---|
[7949] | 14 | jQuery(document).ready(function(){ |
---|
[9977] | 15 | jQuery("'.$selector.'").attr("href", function () { |
---|
| 16 | return this.name; |
---|
[3298] | 17 | }); |
---|
[9977] | 18 | jQuery("'.$selector.'").colorbox({ |
---|
| 19 | current: "", |
---|
| 20 | transition: "'.$params['transition'].'", |
---|
| 21 | speed: "'.$params['transition_speed'].'", |
---|
| 22 | initialWidth: "'.(!empty($params['initial_width']) ? $params['initial_width'] : $config_default['initial_width']).'", |
---|
| 23 | initialHeight: "'.(!empty($params['initial_height']) ? $params['initial_height'] : $config_default['initial_height']).'", |
---|
| 24 | width: '.(!empty($params['fixed_width']) ? '"'.$params['fixed_width'].'"' : 'false').', |
---|
| 25 | height: '.(!empty($params['fixed_height']) ? '"'.$params['fixed_height'].'"' : 'false').' |
---|
| 26 | }, |
---|
| 27 | function() { |
---|
| 28 | jQuery.post("'.get_root_url().'plugins/lightbox/save_history.php", { |
---|
| 29 | imgid: this.id, |
---|
| 30 | catid: "'.@$page['category']['id'].'", |
---|
| 31 | section: "'.@$page['section'].'", |
---|
| 32 | tagids: "'.@implode(',', @$page['tag_ids']).'" |
---|
| 33 | }); |
---|
| 34 | }); |
---|
[3298] | 35 | }); |
---|
[10078] | 36 | </script> |
---|
[9977] | 37 | ', $smarty, $repeat); |
---|
[3298] | 38 | |
---|
| 39 | foreach($tpl_thumbnails_var as $key => $tpl_var) |
---|
| 40 | { |
---|
| 41 | // Image URL for lightbox |
---|
| 42 | if ($newurl = get_lightbox_url($pictures[$key])) |
---|
| 43 | { |
---|
| 44 | $tpl_thumbnails_var[$key]['URL'] .= '" id="img-'.$pictures[$key]['id'].'" name="'.$newurl; |
---|
| 45 | } |
---|
| 46 | else |
---|
| 47 | { |
---|
| 48 | continue; |
---|
| 49 | } |
---|
| 50 | |
---|
| 51 | // Title display |
---|
| 52 | if ($params['display_name']) |
---|
| 53 | { |
---|
| 54 | $tpl_thumbnails_var[$key]['URL'] .= '" title="'.get_lightbox_title($pictures[$key], $params['name_link']); |
---|
| 55 | } |
---|
| 56 | |
---|
| 57 | // Arrows display |
---|
| 58 | if ($params['display_arrows']) |
---|
| 59 | { |
---|
| 60 | $tpl_thumbnails_var[$key]['URL'] .= '" rel="colorbox'.$conf['lightbox_rel']; |
---|
| 61 | } |
---|
| 62 | } |
---|
| 63 | |
---|
| 64 | // Add all items from category |
---|
| 65 | if ($params['display_arrows'] and $params['all_cat'] and !empty($page['navigation_bar'])) |
---|
| 66 | { |
---|
| 67 | $rank_of = array_flip($page['items']); |
---|
| 68 | if ($page['start'] > 0) |
---|
| 69 | { |
---|
| 70 | $selection = array_slice($page['items'], 0, $page['start']); |
---|
| 71 | $template->concat('PLUGIN_INDEX_CONTENT_BEGIN', get_lightbox_extra_pictures($selection, $rank_of, $params['name_link'])); |
---|
| 72 | } |
---|
| 73 | |
---|
| 74 | if (count($page['items']) > $page['start'] + $page['nb_image_page']) |
---|
| 75 | { |
---|
| 76 | $selection = array_slice($page['items'], $page['start'] + $page['nb_image_page']); |
---|
| 77 | $template->concat('PLUGIN_INDEX_CONTENT_END', get_lightbox_extra_pictures($selection, $rank_of, $params['name_link'])); |
---|
| 78 | } |
---|
| 79 | } |
---|
| 80 | |
---|
[7252] | 81 | ?> |
---|