Changeset 13087 for trunk/admin/element_set_ranks.php
- Timestamp:
- Feb 10, 2012, 10:41:08 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/element_set_ranks.php
r13013 r13087 105 105 } 106 106 107 $image_order = null;108 107 if (!empty($_POST['image_order_choice']) 109 108 && in_array($_POST['image_order_choice'], $image_order_choices)) … … 112 111 } 113 112 113 $image_order = null; 114 114 if ($image_order_choice=='user_define') 115 115 { 116 for ($i= 1; $i<=3; $i++)116 for ($i=0; $i<3; $i++) 117 117 { 118 if ( !empty($_POST['order_field_'.$i]))118 if (!empty($_POST['image_order'][$i])) 119 119 { 120 if (! empty($image_order) ) 121 { 122 $image_order .= ','; 123 } 124 $image_order .= $_POST['order_field_'.$i]; 125 if ($_POST['order_direction_'.$i]=='DESC') 126 { 127 $image_order .= ' DESC'; 128 } 120 if (!empty($image_order)) $image_order.= ','; 121 $image_order.= $_POST['image_order'][$i]; 129 122 } 130 123 } … … 135 128 } 136 129 $query = ' 137 UPDATE '.CATEGORIES_TABLE.' SET image_order=\''.$image_order.'\' 130 UPDATE '.CATEGORIES_TABLE.' 131 SET image_order=\''.$image_order.'\' 138 132 WHERE id='.$page['category_id']; 139 133 pwg_query($query); … … 273 267 // image order management 274 268 $sort_fields = array( 275 '' => '', 276 'date_creation' => l10n('Creation date'), 277 'date_available' => l10n('Post date'), 278 'rating_score' => l10n('Rating score'), 279 'hit' => l10n('Most visited'), 280 'file' => l10n('File name'), 281 'name' => l10n('Photo name'), 282 'id' => 'Id', 283 'rank' => l10n('Rank'), 269 '' => '', 270 'file' => l10n('file name, A → Z'), 271 'file DESC' => l10n('file name, Z → A'), 272 'name' => l10n('photo title, A → Z'), 273 'name DESC' => l10n('photo title, Z → A'), 274 'date_creation DESC' => l10n('date created, new → old'), 275 'date_creation' => l10n('date created, old → new'), 276 'date_available DESC' => l10n('date posted, new → old'), 277 'date_available' => l10n('date posted, old → new'), 278 'rating_score DESC' => l10n('rating score, high → low'), 279 'rating_score' => l10n('rating score, low → high'), 280 'hit DESC' => l10n('visits, high → low'), 281 'hit' => l10n('visits, low → high'), 282 'id' => l10n('numeric identifier, 1 → 9'), 283 'id DESC' => l10n('numeric identifier, 9 → 1'), 284 'rank' => l10n('manual sort order'), 284 285 ); 285 286 286 $sort_directions = array( 287 'ASC' => l10n('ascending'), 288 'DESC' => l10n('descending'), 289 ); 290 291 $template->assign('image_order_field_options', $sort_fields); 292 $template->assign('image_order_direction_options', $sort_directions); 293 294 $matches = array(); 295 if ( !empty( $category['image_order'] ) ) 296 { 297 preg_match_all('/([a-z_]+) *(?:(asc|desc)(?:ending)?)? *(?:, *|$)/i', 298 $category['image_order'], $matches); 299 } 287 $template->assign('image_order_options', $sort_fields); 288 289 $image_order = explode(',', $category['image_order']); 300 290 301 291 for ($i=0; $i<3; $i++) // 3 fields 302 292 { 303 $tpl_image_order_select = array( 304 'ID' => $i+1, 305 'FIELD' => array(''), 306 'DIRECTION' => array('ASC'), 307 ); 308 309 if ( isset($matches[1][$i]) ) 310 { 311 $tpl_image_order_select['FIELD'] = array($matches[1][$i]); 312 } 313 314 if (isset($matches[2][$i]) and strcasecmp($matches[2][$i],'DESC')==0) 315 { 316 $tpl_image_order_select['DIRECTION'] = array('DESC'); 317 } 318 $template->append( 'image_orders', $tpl_image_order_select); 293 if ( isset($image_order[$i]) ) 294 { 295 $template->append('image_order', $image_order[$i]); 296 } 297 else 298 { 299 $template->append('image_order', ''); 300 } 319 301 } 320 302
Note: See TracChangeset
for help on using the changeset viewer.