1 | <?php |
---|
2 | defined('USER_COLLEC_PATH') or die('Hacking attempt!'); |
---|
3 | |
---|
4 | |
---|
5 | // image order |
---|
6 | if (isset($_GET['uc_image_order'])) |
---|
7 | { |
---|
8 | if ( (int)$_GET['uc_image_order'] > 0) |
---|
9 | { |
---|
10 | pwg_set_session_var('uc_image_order', (int)$_GET['uc_image_order']); |
---|
11 | } |
---|
12 | else |
---|
13 | { |
---|
14 | pwg_unset_session_var('uc_image_order'); |
---|
15 | } |
---|
16 | redirect($self_url); |
---|
17 | } |
---|
18 | |
---|
19 | // get sorted elements |
---|
20 | $image_order_id = pwg_get_session_var('uc_image_order', 0); |
---|
21 | $orders = get_collection_preferred_image_orders(); |
---|
22 | |
---|
23 | $query = ' |
---|
24 | SELECT 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 | // caddie |
---|
34 | if (isset($_GET['uc_caddie'])) |
---|
35 | { |
---|
36 | fill_caddie($page['items']); |
---|
37 | redirect($self_url); |
---|
38 | } |
---|
39 | |
---|
40 | // image order menu |
---|
41 | if ( $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; |
---|
65 | if (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 |
---|
78 | add_event_handler('loc_end_index_thumbnails', 'user_collections_thumbnails_in_collection', EVENT_HANDLER_PRIORITY_NEUTRAL, 2); |
---|
79 | |
---|
80 | global $selection, $pictures; |
---|
81 | include(PHPWG_ROOT_PATH . 'include/category_default.inc.php'); |
---|
82 | |
---|
83 | |
---|
84 | // multisize menu |
---|
85 | if ( !empty($page['items']) ) |
---|
86 | { |
---|
87 | $url = add_url_params($self_url, array('display' => '')); |
---|
88 | |
---|
89 | $selected_type = $template->get_template_vars('derivative_params')->type; |
---|
90 | $template->clear_assign( 'derivative_params' ); |
---|
91 | $type_map = ImageStdParams::get_defined_type_map(); |
---|
92 | unset($type_map[IMG_XXLARGE], $type_map[IMG_XLARGE]); |
---|
93 | |
---|
94 | foreach($type_map as $params) |
---|
95 | { |
---|
96 | $template->append( |
---|
97 | 'image_derivatives', |
---|
98 | array( |
---|
99 | 'DISPLAY' => l10n($params->type), |
---|
100 | 'URL' => $url.$params->type, |
---|
101 | 'SELECTED' => ($params->type == $selected_type ? true:false), |
---|
102 | ) |
---|
103 | ); |
---|
104 | } |
---|
105 | } |
---|
106 | |
---|
107 | |
---|
108 | // caddie link |
---|
109 | if (is_admin() and !empty($page['items'])) |
---|
110 | { |
---|
111 | $template->assign('U_CADDIE', |
---|
112 | add_url_params($self_url, array('uc_caddie'=>1) ) |
---|
113 | ); |
---|
114 | } |
---|
115 | |
---|
116 | |
---|
117 | function user_collections_thumbnails_in_collection($tpl_thumbnails_var, $pictures) |
---|
118 | { |
---|
119 | global $template, $page; |
---|
120 | |
---|
121 | $url = USER_COLLEC_PUBLIC . 'edit/'.$page['col_id']; |
---|
122 | |
---|
123 | foreach ($tpl_thumbnails_var as &$thumbnail) |
---|
124 | { |
---|
125 | $src_image = new SrcImage($thumbnail); |
---|
126 | |
---|
127 | $thumbnail['FILE_SRC'] = DerivativeImage::url(IMG_LARGE, $src_image); |
---|
128 | $thumbnail['URL'] = duplicate_picture_url( |
---|
129 | array( |
---|
130 | 'image_id' => $thumbnail['id'], |
---|
131 | 'image_file' => $thumbnail['file'], |
---|
132 | 'section' => 'none', |
---|
133 | ), |
---|
134 | array('start') |
---|
135 | ); |
---|
136 | } |
---|
137 | |
---|
138 | return $tpl_thumbnails_var; |
---|
139 | } |
---|
140 | |
---|
141 | ?> |
---|