mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-03-28 17:42:57 +01:00
merge -r1209:1210 from branch-1_6 to trunk (rating management filter display
improvement) git-svn-id: http://piwigo.org/svn/trunk@1211 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
@@ -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.'
|
||||
|
||||
@@ -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">
|
||||
|
||||
Reference in New Issue
Block a user