Changeset 9051 for trunk/admin/cat_modify.php
- Timestamp:
- Feb 2, 2011, 10:35:48 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/cat_modify.php
r8728 r9051 45 45 if (isset($_POST['submit'])) 46 46 { 47 $image_order = null;48 if ( !isset($_POST['image_order_default']) )49 {50 for ($i=1; $i<=3; $i++)51 {52 if ( !empty($_POST['order_field_'.$i]) )53 {54 if (! empty($image_order) )55 {56 $image_order .= ',';57 }58 $image_order .= $_POST['order_field_'.$i];59 if ($_POST['order_direction_'.$i]=='DESC')60 {61 $image_order .= ' DESC';62 }63 }64 }65 }66 67 47 $data = 68 48 array( … … 73 53 $conf['allow_html_descriptions'] ? 74 54 @$_POST['comment'] : strip_tags(@$_POST['comment']), 75 'image_order' => $image_order,76 55 ); 77 56 … … 87 66 // retrieve cat infos before continuing (following updates are expensive) 88 67 $cat_info = get_cat_info($_GET['cat_id']); 89 90 if (isset($_POST['image_order_subcats']))91 {92 $query = '93 UPDATE '.CATEGORIES_TABLE.' SET image_order='.(isset($image_order) ? 'NULL':'\''.$image_order.'\'').'94 WHERE uppercats LIKE \''.$cat_info['uppercats'].',%\'';95 pwg_query($query);96 }97 68 98 69 if ($cat_info['visible'] != get_boolean( $_POST['visible'] ) ) … … 245 216 'CAT_COMMENTABLE' => boolean_to_string($category['commentable']), 246 217 247 'IMG_ORDER_DEFAULT' => empty($category['image_order']) ?248 'checked="checked"' : '',249 250 218 'U_JUMPTO' => make_index_url( 251 219 array( … … 278 246 $base_url.'batch_manager&cat='.$category['id'] 279 247 ); 280 $template->assign( 281 'U_MANAGE_RANKS', 282 $base_url.'element_set_ranks&cat_id='.$category['id'] 283 ); 284 } 248 } 249 250 $template->assign( 251 'U_MANAGE_RANKS', 252 $base_url.'element_set_ranks&cat_id='.$category['id'] 253 ); 285 254 286 255 if ($category['is_virtual']) … … 303 272 ); 304 273 } 305 306 // image order management307 308 $sort_fields = array(309 '' => '',310 'date_creation' => l10n('Creation date'),311 'date_available' => l10n('Post date'),312 'average_rate' => l10n('Average rate'),313 'hit' => l10n('Most visited'),314 'file' => l10n('File name'),315 'id' => 'Id',316 'rank' => l10n('Rank'),317 );318 319 $sort_directions = array(320 'ASC' => l10n('ascending'),321 'DESC' => l10n('descending'),322 );323 324 $template->assign( 'image_order_field_options', $sort_fields);325 $template->assign( 'image_order_direction_options', $sort_directions);326 327 $matches = array();328 if ( !empty( $category['image_order'] ) )329 {330 preg_match_all('/([a-z_]+) *(?:(asc|desc)(?:ending)?)? *(?:, *|$)/i',331 $category['image_order'], $matches);332 }333 334 for ($i=0; $i<3; $i++) // 3 fields335 {336 $tpl_image_order_select = array(337 'ID' => $i+1,338 'FIELD' => array(''),339 'DIRECTION' => array('ASC'),340 );341 342 if ( isset($matches[1][$i]) )343 {344 $tpl_image_order_select['FIELD'] = array($matches[1][$i]);345 }346 347 if (isset($matches[2][$i]) and strcasecmp($matches[2][$i],'DESC')==0)348 {349 $tpl_image_order_select['DIRECTION'] = array('DESC');350 }351 $template->append( 'image_orders', $tpl_image_order_select);352 }353 354 274 355 275 // representant management
Note: See TracChangeset
for help on using the changeset viewer.