add filter years
This commit is contained in:
@@ -32,10 +32,10 @@ function api_login($login, $password){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function clientbuys_kuri($client_id, $page = 1, $group_id = null){
|
function clientbuys_kuri($client_id, $page = 1, $category_id = 1, $group_id = null, $filter = null){
|
||||||
|
|
||||||
if ($group_id == 1 or $group_id == 2){
|
if ($group_id == 1 or $group_id == 2){
|
||||||
return clients_arch($page);
|
return clients_arch($page, $category_id, $filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql_sub = "SELECT number_id FROM anbuy WHERE client_id = '$client_id' AND `number_id` = 486 AND `buy_status` = '1' LIMIT 1"; //есть ли активная подписка
|
$sql_sub = "SELECT number_id FROM anbuy WHERE client_id = '$client_id' AND `number_id` = 486 AND `buy_status` = '1' LIMIT 1"; //есть ли активная подписка
|
||||||
@@ -43,25 +43,46 @@ function clientbuys_kuri($client_id, $page = 1, $group_id = null){
|
|||||||
|
|
||||||
|
|
||||||
if (isset($findsub['number_id'])) {// есть поп
|
if (isset($findsub['number_id'])) {// есть поп
|
||||||
return clients_arch($page);
|
return clients_arch($page, $category_id, $filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($filter !== 'all'){
|
||||||
|
$between = "AND BeginDate BETWEEN '$filter-01-11' AND '$filter-12-31'";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
$between = '';
|
||||||
|
|
||||||
$limit = 25;
|
$limit = 25;
|
||||||
$countsql = "SELECT DISTINCT COUNT(buy_id) as count FROM `anbuy` WHERE `client_id` = $client_id AND `buy_status` = '1' LIMIT 1";
|
$countsql = "
|
||||||
|
SELECT
|
||||||
|
DISTINCT COUNT(buy_id) as count
|
||||||
|
FROM
|
||||||
|
`anbuy`
|
||||||
|
WHERE
|
||||||
|
`client_id` = $client_id
|
||||||
|
AND `buy_status` = '1'
|
||||||
|
$between
|
||||||
|
LIMIT 1
|
||||||
|
";
|
||||||
|
|
||||||
$buycount = db_get($countsql);
|
$buycount = db_get($countsql);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$buysql = "
|
$buysql = "
|
||||||
SELECT DISTINCT
|
SELECT DISTINCT
|
||||||
price_id, pricehash, pricename, priceimg
|
price_id, pricehash, pricename, priceimg
|
||||||
FROM anbuy
|
FROM
|
||||||
LEFT JOIN price ON anbuy.number_id = price.price_id
|
anbuy
|
||||||
WHERE client_id = '$client_id' AND `buy_status` = '1'
|
LEFT JOIN
|
||||||
ORDER BY `buy_id` DESC
|
price ON anbuy.number_id = price.price_id
|
||||||
LIMIT $limit";
|
WHERE
|
||||||
|
client_id = '$client_id' AND `buy_status` = '1'
|
||||||
|
AND category_id = $category_id
|
||||||
|
$between
|
||||||
|
ORDER BY
|
||||||
|
`buy_id` DESC
|
||||||
|
LIMIT
|
||||||
|
$limit
|
||||||
|
";
|
||||||
|
|
||||||
if ($page > 1){
|
if ($page > 1){
|
||||||
$offset = $limit * ($page -1);
|
$offset = $limit * ($page -1);
|
||||||
@@ -203,19 +224,43 @@ function clientmail($mail, $hash){
|
|||||||
|
|
||||||
|
|
||||||
//весь активный архив
|
//весь активный архив
|
||||||
function clients_arch($page = 1){
|
function clients_arch($page = 16, $category_id = 1, $filter = 'all'){
|
||||||
|
|
||||||
$limit = 25;
|
$limit = 25;
|
||||||
|
|
||||||
$countsql = "SELECT COUNT(price_id) AS count
|
|
||||||
FROM price
|
if ($filter !== 'all'){
|
||||||
WHERE category_id = 1
|
$between = "AND BeginDate BETWEEN '$filter-01-11' AND '$filter-12-31'";
|
||||||
LIMIT 1";
|
}
|
||||||
|
else
|
||||||
|
$between = '';
|
||||||
|
|
||||||
|
$countsql = "
|
||||||
|
SELECT
|
||||||
|
COUNT(price_id) AS count
|
||||||
|
FROM
|
||||||
|
price
|
||||||
|
WHERE
|
||||||
|
category_id = $category_id
|
||||||
|
$between
|
||||||
|
LIMIT 1
|
||||||
|
";
|
||||||
|
|
||||||
$count = db_get($countsql);
|
$count = db_get($countsql);
|
||||||
|
|
||||||
|
|
||||||
$pricesql = "SELECT price_id, pricehash, pricename, priceimg FROM price WHERE category_id = 1 ORDER BY price_id DESC LIMIT $limit";
|
$pricesql = "
|
||||||
|
SELECT
|
||||||
|
price_id, pricehash, pricename, priceimg
|
||||||
|
FROM
|
||||||
|
price
|
||||||
|
WHERE
|
||||||
|
category_id = $category_id
|
||||||
|
$between
|
||||||
|
ORDER BY
|
||||||
|
price_id DESC
|
||||||
|
LIMIT $limit
|
||||||
|
";
|
||||||
|
|
||||||
|
|
||||||
if ($page > 1){
|
if ($page > 1){
|
||||||
|
|||||||
@@ -237,6 +237,9 @@ input[type="email"],input[type="password"]{
|
|||||||
font-size: 150%;
|
font-size: 150%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#year_filter{
|
||||||
|
margin-bottom: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
@media screen and (max-width: 1000px) {
|
@media screen and (max-width: 1000px) {
|
||||||
header .lite-logo {
|
header .lite-logo {
|
||||||
|
|||||||
@@ -182,4 +182,22 @@ function changepage(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function changeyear(){
|
||||||
|
|
||||||
|
var e = document.getElementById("year_filter");
|
||||||
|
var curryear = e.options[e.selectedIndex].value;
|
||||||
|
|
||||||
|
yearurl = '/mybooks/gazeta/';
|
||||||
|
|
||||||
|
if (curryear !== 'all')
|
||||||
|
yearurl = yearurl + curryear + '/1';
|
||||||
|
|
||||||
|
location.href = yearurl;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -80,7 +80,8 @@ function addcard($id, $date) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function mybooks_kuri($page = 1){
|
function mybooks_kuri($category = 'gazeta', $filter = 'all', $page = 1){
|
||||||
|
|
||||||
|
|
||||||
$login = check_login_kuri();
|
$login = check_login_kuri();
|
||||||
|
|
||||||
@@ -90,16 +91,21 @@ function mybooks_kuri($page = 1){
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($category == 'gazeta')
|
||||||
|
$category_id = 1;
|
||||||
|
elseif ($category == 'books')
|
||||||
|
$category_id = 3;
|
||||||
|
|
||||||
$limit = 25;
|
$limit = 25;
|
||||||
$client = api_client_kuri($login['clienthash']);
|
$client = api_client_kuri($login['clienthash']);
|
||||||
$baseurl = SITE."mybooks/";
|
$baseurl = SITE.'mybooks/'.$category.'/'.$filter.'/';
|
||||||
|
|
||||||
if (!$client) {
|
if (!$client) {
|
||||||
echo 'Пользователь не найден';
|
echo 'Пользователь не найден';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$items = clientbuys_kuri($client['client_id'], $page, $client['clientgroup_id']);
|
$items = clientbuys_kuri($client['client_id'], $page, $category_id, $client['clientgroup_id'], $filter);
|
||||||
$count = $items['count'];
|
$count = $items['count'];
|
||||||
|
|
||||||
if ($count > $limit){
|
if ($count > $limit){
|
||||||
|
|||||||
@@ -4,6 +4,19 @@
|
|||||||
<!--<p>Всего покупок: <?=$items['count']?></p>-->
|
<!--<p>Всего покупок: <?=$items['count']?></p>-->
|
||||||
<?endif?>
|
<?endif?>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
фильтр: <select id="year_filter" onchange="changeyear()">
|
||||||
|
<option value="all"<?=$selected?>>все</option>
|
||||||
|
<?for ($y = date('Y'); $y >= 2006; $y--):?>
|
||||||
|
<?$selected = ($filter == $y) ? ' selected' : ''?>
|
||||||
|
<option value="<?=$y?>"<?=$selected?>><?=$y?> год</option>
|
||||||
|
<?endfor?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="lib_container">
|
<div class="lib_container">
|
||||||
<?foreach ($items['books'] as $book):?>
|
<?foreach ($items['books'] as $book):?>
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
<title>Еженедельник Аргументы Недели - <?=$title?></title>
|
<title>Еженедельник Аргументы Недели - <?=$title?></title>
|
||||||
<//base href="<?=SITE?>">
|
<//base href="<?=SITE?>">
|
||||||
<script src="/pub/scripts/pdf.min.js"></script>
|
<script src="/pub/scripts/pdf.min.js"></script>
|
||||||
<script src="/pub/scripts/anviewer.js?ver=48"></script>
|
<script src="/pub/scripts/anviewer.js?ver=51"></script>
|
||||||
<link rel="stylesheet" type="text/css" href="/pub/css/an.css?ver=55">
|
<link rel="stylesheet" type="text/css" href="/pub/css/an.css?ver=60">
|
||||||
<link rel="icon" type="image/ico" href="https://argumenti.ru/favicon.ico">
|
<link rel="icon" type="image/ico" href="https://argumenti.ru/favicon.ico">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<link rel="stylesheet" href="/pub/fontawesome/css/all.css">
|
<link rel="stylesheet" href="/pub/fontawesome/css/all.css">
|
||||||
|
|||||||
Reference in New Issue
Block a user