Ignore:
Timestamp:
Feb 1, 2006, 3:46:26 AM (18 years ago)
Author:
rvelices
Message:

feature 280: Allow visitors/users to choose image ordering inside a category

improvement 82: Viewing pictures from remote galleries does not check anymore
for the high pictures (existence flag added to create_listing_file and db)

correction: link element in picture is in the head instead of body (w3c spec)

correction: in profile.php the current template was not selected by default

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/functions_category.inc.php

    r1008 r1020  
    319319}
    320320
     321// returns an array of image orders available for users/visitors
     322function get_category_preferred_image_orders()
     323{
     324  global $lang, $conf;
     325  return array(
     326        array('Default', '', true),
     327        array($lang['best_rated_cat'],   'average_rate DESC', $conf['rate']),
     328        array($lang['most_visited_cat'], 'hit DESC', true),
     329        array($lang['Creation date'], 'date_creation DESC', true),
     330        array($lang['Availability date'], 'date_available DESC', true)
     331  );
     332}
     333
     334
    321335// initialize_category initializes ;-) the variables in relation
    322336// with category :
     
    604618                               $user['nb_image_page'], 'back' );
    605619    }
     620   
     621    if ($page['cat'] != 'most_visited' and $page['cat'] != 'best_rated')
     622    {
     623      $available_image_orders = get_category_preferred_image_orders();
     624     
     625      $order_idx=0;
     626      if ( isset($_GET['image_order']) )
     627      {
     628        $order_idx = $_GET['image_order'];
     629        setcookie( 'pwg_image_order', $order_idx, 0 );
     630      }
     631      else if ( isset($_COOKIE['pwg_image_order']) )
     632      {
     633        $order_idx = $_COOKIE['pwg_image_order'];
     634      }
     635     
     636      if ( $order_idx > 0 )
     637      {
     638        $order = $available_image_orders[$order_idx][1];
     639        $conf['order_by'] = str_replace('ORDER BY ', 'ORDER BY '.$order.',',
     640                                          $conf['order_by'] );
     641      }
     642    }
    606643  }
    607644  else
Note: See TracChangeset for help on using the changeset viewer.