Changeset 1211


Ignore:
Timestamp:
Apr 19, 2006, 11:30:38 PM (18 years ago)
Author:
plg
Message:

merge -r1209:1210 from branch-1_6 to trunk (rating management filter display
improvement)

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/rating.php

    r1121 r1211  
    6262}
    6363
    64 $display_filter= '';
    65 if (isset($_GET['display_filter']))
    66 {
    67   if ( $_GET['display_filter']=='user' )
    68   {
    69     $display_filter= ' AND r.user_id <> ' . $conf['guest_id'];
    70     $template->assign_vars( array(
    71         'DISPLAY_FILTER_USER_CHECKED'=>'checked="checked"'
    72         )
    73     );
    74   }
    75   elseif ( $_GET['display_filter']=='guest' )
    76   {
    77     $display_filter= ' AND r.user_id =' . $conf['guest_id'];
    78     $template->assign_vars( array(
    79         'DISPLAY_FILTER_GUEST_CHECKED'=>'checked="checked"'
    80         )
    81      );
    82   }
    83 }
    84 if ($display_filter=='')
    85 {
    86     $template->assign_vars( array(
    87         'DISPLAY_FILTER_ALL_CHECKED'=>'checked="checked"'
    88         )
    89      );
     64$page['user_filter'] = '';
     65if (isset($_GET['users']))
     66{
     67  if ($_GET['users'] == 'user')
     68  {
     69    $page['user_filter'] = ' AND r.user_id <> '.$conf['guest_id'];
     70  }
     71  elseif ($_GET['users'] == 'guest')
     72  {
     73    $page['user_filter'] = ' AND r.user_id = '.$conf['guest_id'];
     74  }
    9075}
    9176
     
    122107$query = 'SELECT COUNT(DISTINCT(i.id))
    123108FROM '.RATE_TABLE.' AS r, '.IMAGES_TABLE.' AS i
    124 WHERE r.element_id=i.id'. $display_filter .
     109WHERE r.element_id=i.id'. $page['user_filter'] .
    125110';';
    126111list($nb_images) = mysql_fetch_row(pwg_query($query));
     
    173158      'CONTENT' => $available_order_by[$i][0],
    174159      'SELECTED' => $i==$order_by_index ? 'SELECTED' : ''
     160      )
     161    );
     162}
     163
     164$user_options = array(
     165  array(
     166    'value' => 'all',
     167    'content' => l10n('All'),
     168    ),
     169  array(
     170    'value' => 'user',
     171    'content' => l10n('Users'),
     172    ),
     173  array(
     174    'value' => 'guest',
     175    'content' => l10n('Guests'),
     176    ),
     177  );
     178
     179foreach ($user_options as $user_option)
     180{
     181  $template->assign_block_vars(
     182    'user_option',
     183    array(
     184      'VALUE' => $user_option['value'],
     185      'CONTENT' => $user_option['content'],
     186      'SELECTED' =>
     187        (isset($_GET['users']) and $_GET['users'] == $user_option['value'])
     188        ? 'selected="selected"'
     189        : '',
    175190      )
    176191    );
     
    190205  FROM '.RATE_TABLE.' AS r
    191206    LEFT JOIN '.IMAGES_TABLE.' AS i ON r.element_id = i.id
    192   WHERE 1 = 1 ' . $display_filter . '
     207  WHERE 1 = 1 ' . $page['user_filter'] . '
    193208  GROUP BY r.element_id
    194209  ORDER BY ' . $available_order_by[$order_by_index][1] .'
  • trunk/template/yoga/admin/rating.tpl

    r1085 r1211  
    11<h2>{lang:Rating} [{NB_ELEMENTS} {lang:elements}]</h2>
    22
    3 <form action="" method="GET" id="update">
    4 <fieldset>
    5 <legend></legend>
    6 <input type="hidden" name="page" value="rating" />
    7 <ul>
     3<form action="{F_ACTION}" method="GET" id="update" class="filter">
     4  <fieldset>
     5    <legend>{lang:Filter}</legend>
    86
    9 <li><label>{lang:elements per page}: <input type="text" name="display" size="2" value="{DISPLAY}"></label></li>
     7    <label>
     8      {lang:Sort by}
     9      <select name="order_by">
     10        <!-- BEGIN order_by -->
     11        <option value="{order_by.VALUE}" {order_by.SELECTED}>{order_by.CONTENT}</option>
     12        <!-- END order_by -->
     13      </select>
     14    </label>
    1015
    11 <li>
    12 <label>{lang:Sort by}:
    13 <select name="order_by">
    14 <!-- BEGIN order_by -->
    15 <option value="{order_by.VALUE}" {order_by.SELECTED}>{order_by.CONTENT}</option>
    16 <!-- END order_by -->
    17 </select>
    18 </label></li>
     16    <label>
     17      {lang:Users}
     18      <select name="users">
     19        <!-- BEGIN user_option -->
     20        <option value="{user_option.VALUE}" {user_option.SELECTED}>{user_option.CONTENT}</option>
     21        <!-- END user_option -->
     22      </select>
     23    </label>
    1924
    20 <li>{lang:Filter}:
    21 <label>
    22  <input type="radio" class="radio" name="display_filter" {DISPLAY_FILTER_ALL_CHECKED} value="all"/>
    23  {lang:users} & {lang:guest}
    24 </label>
    25 <label>
    26  <input type="radio" class="radio" name="display_filter" {DISPLAY_FILTER_USER_CHECKED} value="user"/>
    27  {lang:users}
    28 </label>
    29 <label>
    30  <input type="radio" class="radio" name="display_filter" {DISPLAY_FILTER_GUEST_CHECKED} value="guest"/>
    31  {lang:guest}
    32 </label>
    33 </li>
     25    <label>
     26      {lang:Number of items}
     27      <input type="text" name="display" size="2" value="{DISPLAY}">
     28    </label>
    3429
    35 </ul>
     30    <input type="submit" name="submit_filter" value="{lang:Submit}" />
     31  </fieldset>
     32  <input type="hidden" name="page" value="rating" />
     33</form>
    3634
    37 </fieldset>
    38 <p class="bottomButtons">
    39 <input type="submit" value="{lang:Submit}" {TAG_INPUT_ENABLED}/>
    40 </p>
    41 </form>
    4235<div class="navigationBar">{NAVBAR}</div>
    4336<table width="100%">
Note: See TracChangeset for help on using the changeset viewer.