source: extensions/UserCollections/include/display_thumbnails.inc.php @ 20384

Last change on this file since 20384 was 20097, checked in by mistic100, 11 years ago

full compatibility with Gthumb+, improve some code

File size: 2.6 KB
Line 
1<?php
2defined('USER_COLLEC_PATH') or die('Hacking attempt!');
3
4
5// caddie
6if (isset($_GET['uc_caddie']))
7{
8  fill_caddie($page['items']);
9  redirect($self_url);
10}
11
12// image order
13if (isset($_GET['uc_image_order']))
14{
15  if ( (int)$_GET['uc_image_order'] > 0)
16  {
17    pwg_set_session_var('uc_image_order', (int)$_GET['uc_image_order']);
18  }
19  else
20  {
21    pwg_unset_session_var('uc_image_order');
22  }
23  redirect($self_url);
24}
25
26// get sorted elements
27$image_order_id = pwg_get_session_var('uc_image_order', 0);
28$orders = get_collection_preferred_image_orders();
29
30$query = '
31SELECT i.id
32  FROM '.IMAGES_TABLE.' AS i
33  JOIN '.COLLECTION_IMAGES_TABLE.' AS ci
34    ON i.id = ci.image_id
35    AND ci.col_id = '.$page['col_id'].'
36  ORDER BY '.$orders[$image_order_id][1].'
37;';
38$page['items'] = array_from_query($query, 'id');
39
40// image order menu
41if ( $conf['index_sort_order_input']
42    and count($page['items']) > 0)
43{
44  $url = add_url_params($self_url, array('uc_image_order' => ''));
45 
46  foreach ($orders as $order_id => $order)
47  {
48    if ($order[2])
49    {
50      $template->append(
51        'image_orders',
52        array(
53          'DISPLAY' => $order[0],
54          'URL' => $url.$order_id,
55          'SELECTED' => ($image_order_id == $order_id ? true:false),
56          )
57        );
58    }
59  }
60}
61
62
63// navigation bar
64$page['start'] = isset($_GET['start']) ? $_GET['start'] : 0;
65if (count($page['items']) > $page['nb_image_page'])
66{
67  $page['navigation_bar'] = create_navigation_bar(
68    $self_url,
69    count($page['items']),
70    $page['start'],
71    $page['nb_image_page'],
72    false
73    );
74  $template->assign('navbar', $page['navigation_bar']);
75}
76
77// add links for colorbox
78add_event_handler('loc_end_index_thumbnails', 'user_collections_thumbnails_in_collection', EVENT_HANDLER_PRIORITY_NEUTRAL, 2);
79
80include(PHPWG_ROOT_PATH . 'include/category_default.inc.php');
81
82
83// multisize menu
84if ( !empty($page['items']) )
85{
86  $url = add_url_params($self_url, array('display' => ''));
87   
88  $selected_type = $template->get_template_vars('derivative_params')->type;
89  $template->clear_assign( 'derivative_params' );
90  $type_map = ImageStdParams::get_defined_type_map();
91  unset($type_map[IMG_XXLARGE], $type_map[IMG_XLARGE]);
92
93  foreach($type_map as $params)
94  {
95    $template->append(
96      'image_derivatives',
97      array(
98        'DISPLAY' => l10n($params->type),
99        'URL' => $url.$params->type,
100        'SELECTED' => ($params->type == $selected_type ? true:false),
101        )
102      );
103  }
104}
105
106
107// caddie link
108if (is_admin() and !empty($page['items']))
109{
110  $template->assign('U_CADDIE',
111     add_url_params($self_url, array('uc_caddie'=>1) )
112    );
113}
114 
115?>
Note: See TracBrowser for help on using the repository browser.