Changeset 23533
- Timestamp:
- Jun 25, 2013, 1:37:44 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/index.php
r23399 r23533 244 244 } 245 245 246 246 // image order 247 247 if ( $conf['index_sort_order_input'] 248 248 and count($page['items']) > 0 … … 250 250 and $page['section'] != 'best_rated') 251 251 { 252 // image order252 $preferred_image_orders = get_category_preferred_image_orders(); 253 253 $order_idx = pwg_get_session_var( 'image_order', 0 ); 254 254 255 // get first order field and direction 256 $first_order = substr($conf['order_by'], 9); 257 if (($pos = strpos($first_order, ',')) !== false) 258 { 259 $first_order = substr($first_order, 0, $pos); 260 } 261 $first_order = trim($first_order); 262 255 263 $url = add_url_params( 256 264 duplicate_index_url(), 257 265 array('image_order' => '') 258 266 ); 259 foreach (get_category_preferred_image_orders() as $order_id => $order) 267 $tpl_orders = array(); 268 $order_selected = false; 269 270 foreach ($preferred_image_orders as $order_id => $order) 260 271 { 261 272 if ($order[2]) 262 273 { 263 $template->append( 264 'image_orders', 265 array( 266 'DISPLAY' => $order[0], 267 'URL' => $url.$order_id, 268 'SELECTED' => ($order_idx == $order_id ? true:false), 269 ) 274 // force select if the field is the first field of order_by 275 if (!$order_selected && $order[1]==$first_order) 276 { 277 $order_idx = $order_id; 278 $order_selected = true; 279 } 280 281 $tpl_orders[ $order_id ] = array( 282 'DISPLAY' => $order[0], 283 'URL' => $url.$order_id, 284 'SELECTED' => $order_idx==$order_id, 270 285 ); 271 286 } 272 287 } 288 289 $tpl_orders[0]['SELECTED'] = !$order_selected; // unselect "Default" if another one is selected 290 $template->assign('image_orders', $tpl_orders); 273 291 } 274 292
Note: See TracChangeset
for help on using the changeset viewer.