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

Last change on this file since 26047 was 25678, checked in by mistic100, 11 years ago

very big update for Piwigo 2.6

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