Changeset 1500 for trunk/admin/cat_modify.php
- Timestamp:
- Jul 26, 2006, 2:51:08 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/cat_modify.php
r1250 r1500 81 81 } 82 82 83 $image_order = ''; 84 if ( !isset($_POST['image_order_default']) ) 85 { 86 for ($i=1; $i<=3; $i++) 87 { 88 if ( !empty($_POST['order_field_'.$i]) ) 89 { 90 if (! empty($image_order) ) 91 { 92 $image_order .= ','; 93 } 94 $image_order .= $_POST['order_field_'.$i]; 95 if ($_POST['order_direction_'.$i]=='DESC') 96 { 97 $image_order .= ' DESC'; 98 } 99 } 100 } 101 } 102 $image_order = empty($image_order) ? 'null' : "'$image_order'"; 103 $query = ' 104 UPDATE '.CATEGORIES_TABLE.' SET image_order='.$image_order.' 105 WHERE '; 106 if (isset($_POST['image_order_subcats'])) 107 { 108 $query .= 'uppercats REGEXP \'(^|,)'.$_GET['cat_id'].'(,|$)\''; 109 } 110 else 111 { 112 $query .= 'id='.$_GET['cat_id'].';'; 113 } 114 pwg_query($query); 115 83 116 array_push($page['infos'], $lang['editcat_confirm']); 84 117 } … … 226 259 $commentable => 'checked="checked"', 227 260 $uploadable => 'checked="checked"', 261 262 'IMG_ORDER_DEFAULT' => empty($category['image_order']) ? 263 'checked="checked"' : '', 228 264 229 265 'L_EDIT_NAME' => $lang['name'], … … 278 314 } 279 315 316 // image order management 317 $matches = array(); 318 if ( !empty( $category['image_order'] ) ) 319 { 320 preg_match_all('/([a-z_]+) *(?:(asc|desc)(?:ending)?)? *(?:, *|$)/i', 321 $category['image_order'], $matches); 322 } 323 324 $sort_fields = array( 325 '' => '', 326 'date_creation' => l10n('Creation date'), 327 'date_available' => l10n('Post date'), 328 'average_rate' => l10n('Average rate'), 329 'hit' => l10n('most_visited_cat'), 330 'file' => l10n('File name'), 331 'id' => 'Id', 332 ); 333 334 for ($i=0; $i<3; $i++) // 3 fields 335 { 336 $template->assign_block_vars('image_order', array('NUMBER'=>$i+1) ); 337 foreach ($sort_fields as $sort_field => $name) 338 { 339 $selected=''; 340 if ( isset($matches[1][$i]) and $matches[1][$i]==$sort_field ) 341 { 342 $selected='selected="selected"'; 343 } 344 elseif ( empty($sort_field) ) 345 { 346 $selected='selected="selected"'; 347 } 348 349 $template->assign_block_vars('image_order.field', 350 array( 351 'SELECTED' => $selected, 352 'VALUE' => $sort_field, 353 'OPTION' => $name 354 ) 355 ); 356 } 357 358 $template->assign_block_vars('image_order.order', 359 array( 360 'SELECTED' => 361 ( empty($matches[2][$i]) or strcasecmp($matches[2][$i],'ASC')==0 ) 362 ? 'selected="selected"' : '', 363 'VALUE' => 'ASC', 364 'OPTION' => 'Ascending' 365 ) 366 ); 367 368 $template->assign_block_vars('image_order.order', 369 array( 370 'SELECTED' => 371 ( isset($matches[2][$i]) and strcasecmp($matches[2][$i],'DESC')==0 ) 372 ? 'selected="selected"' : '', 373 'VALUE' => 'DESC', 374 'OPTION' => 'Descending' 375 ) 376 ); 377 } 378 379 280 380 // representant management 281 381 if ($category['nb_images'] > 0
Note: See TracChangeset
for help on using the changeset viewer.