aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2006-04-19 21:27:39 +0000
committerplegall <plg@piwigo.org>2006-04-19 21:27:39 +0000
commitad171f93f239b541a45f01c5f38dd7683b5ef922 (patch)
tree2648906fc7d637a14d92adfe46b045f29a61e882
parent8789f41f8ccb31d0ec9f2c75996511e26abba8bc (diff)
improvement: filter fieldset conforms with PWG standards.
git-svn-id: http://piwigo.org/svn/branches/branch-1_6@1210 68402e56-0260-453c-a942-63ccdbb3a9ee
-rw-r--r--admin/rating.php61
-rw-r--r--template/yoga/admin/rating.tpl61
2 files changed, 65 insertions, 57 deletions
diff --git a/admin/rating.php b/admin/rating.php
index 86f95205a..e228726f3 100644
--- a/admin/rating.php
+++ b/admin/rating.php
@@ -61,33 +61,18 @@ if (isset($_GET['order_by']) and is_numeric($_GET['order_by']))
$order_by_index = $_GET['order_by'];
}
-$display_filter= '';
-if (isset($_GET['display_filter']))
+$page['user_filter'] = '';
+if (isset($_GET['users']))
{
- if ( $_GET['display_filter']=='user' )
+ if ($_GET['users'] == 'user')
{
- $display_filter= ' AND r.user_id <> ' . $conf['guest_id'];
- $template->assign_vars( array(
- 'DISPLAY_FILTER_USER_CHECKED'=>'checked="checked"'
- )
- );
+ $page['user_filter'] = ' AND r.user_id <> '.$conf['guest_id'];
}
- elseif ( $_GET['display_filter']=='guest' )
+ elseif ($_GET['users'] == 'guest')
{
- $display_filter= ' AND r.user_id =' . $conf['guest_id'];
- $template->assign_vars( array(
- 'DISPLAY_FILTER_GUEST_CHECKED'=>'checked="checked"'
- )
- );
+ $page['user_filter'] = ' AND r.user_id = '.$conf['guest_id'];
}
}
-if ($display_filter=='')
-{
- $template->assign_vars( array(
- 'DISPLAY_FILTER_ALL_CHECKED'=>'checked="checked"'
- )
- );
-}
if (isset($_GET['del']))
{
@@ -121,7 +106,7 @@ while ($row = mysql_fetch_array($result))
$query = 'SELECT COUNT(DISTINCT(i.id))
FROM '.RATE_TABLE.' AS r, '.IMAGES_TABLE.' AS i
-WHERE r.element_id=i.id'. $display_filter .
+WHERE r.element_id=i.id'. $page['user_filter'] .
';';
list($nb_images) = mysql_fetch_row(pwg_query($query));
@@ -176,6 +161,36 @@ for ($i=0; $i<count($available_order_by); $i++)
);
}
+$user_options = array(
+ array(
+ 'value' => 'all',
+ 'content' => l10n('All'),
+ ),
+ array(
+ 'value' => 'user',
+ 'content' => l10n('Users'),
+ ),
+ array(
+ 'value' => 'guest',
+ 'content' => l10n('Guests'),
+ ),
+ );
+
+foreach ($user_options as $user_option)
+{
+ $template->assign_block_vars(
+ 'user_option',
+ array(
+ 'VALUE' => $user_option['value'],
+ 'CONTENT' => $user_option['content'],
+ 'SELECTED' =>
+ (isset($_GET['users']) and $_GET['users'] == $user_option['value'])
+ ? 'selected="selected"'
+ : '',
+ )
+ );
+}
+
$query = '
SELECT i.id,
i.path,
@@ -189,7 +204,7 @@ SELECT i.id,
ROUND(STD(r.rate),2) AS std_rates
FROM '.RATE_TABLE.' AS r
LEFT JOIN '.IMAGES_TABLE.' AS i ON r.element_id = i.id
- WHERE 1 = 1 ' . $display_filter . '
+ WHERE 1 = 1 ' . $page['user_filter'] . '
GROUP BY r.element_id
ORDER BY ' . $available_order_by[$order_by_index][1] .'
LIMIT '.$start.','.$elements_per_page.'
diff --git a/template/yoga/admin/rating.tpl b/template/yoga/admin/rating.tpl
index 139723b4d..862e538e8 100644
--- a/template/yoga/admin/rating.tpl
+++ b/template/yoga/admin/rating.tpl
@@ -1,44 +1,37 @@
<h2>{lang:Rating} [{NB_ELEMENTS} {lang:elements}]</h2>
-<form action="" method="GET" id="update">
-<fieldset>
-<legend></legend>
-<input type="hidden" name="page" value="rating" />
-<ul>
+<form action="{F_ACTION}" method="GET" id="update" class="filter">
+ <fieldset>
+ <legend>{lang:Filter}</legend>
-<li><label>{lang:elements per page}: <input type="text" name="display" size="2" value="{DISPLAY}"></label></li>
+ <label>
+ {lang:Sort by}
+ <select name="order_by">
+ <!-- BEGIN order_by -->
+ <option value="{order_by.VALUE}" {order_by.SELECTED}>{order_by.CONTENT}</option>
+ <!-- END order_by -->
+ </select>
+ </label>
-<li>
-<label>{lang:Sort by}:
-<select name="order_by">
-<!-- BEGIN order_by -->
-<option value="{order_by.VALUE}" {order_by.SELECTED}>{order_by.CONTENT}</option>
-<!-- END order_by -->
-</select>
-</label></li>
+ <label>
+ {lang:Users}
+ <select name="users">
+ <!-- BEGIN user_option -->
+ <option value="{user_option.VALUE}" {user_option.SELECTED}>{user_option.CONTENT}</option>
+ <!-- END user_option -->
+ </select>
+ </label>
-<li>{lang:Filter}:
-<label>
- <input type="radio" class="radio" name="display_filter" {DISPLAY_FILTER_ALL_CHECKED} value="all"/>
- {lang:users} & {lang:guest}
-</label>
-<label>
- <input type="radio" class="radio" name="display_filter" {DISPLAY_FILTER_USER_CHECKED} value="user"/>
- {lang:users}
-</label>
-<label>
- <input type="radio" class="radio" name="display_filter" {DISPLAY_FILTER_GUEST_CHECKED} value="guest"/>
- {lang:guest}
-</label>
-</li>
+ <label>
+ {lang:Number of items}
+ <input type="text" name="display" size="2" value="{DISPLAY}">
+ </label>
-</ul>
-
-</fieldset>
-<p class="bottomButtons">
-<input type="submit" value="{lang:Submit}" {TAG_INPUT_ENABLED}/>
-</p>
+ <input type="submit" name="submit_filter" value="{lang:Submit}" />
+ </fieldset>
+ <input type="hidden" name="page" value="rating" />
</form>
+
<div class="navigationBar">{NAVBAR}</div>
<table width="100%">
<tr class="throw">