32 lines
1.7 KiB
PHP
Executable File
32 lines
1.7 KiB
PHP
Executable File
<?php
|
||
ini_set('display_errors', 0 );
|
||
//проверяем авторизацию
|
||
if ( $_SESSION['dostup'] !=='a' && $_SESSION['dostup'] !== 'e' ) header( 'Location: /403/' );
|
||
/* ----------------------------------------------------------------------
|
||
14.12.2022
|
||
Получаем инфу о пользователе
|
||
---------------------------------------------------------------------- */
|
||
$smarty -> assign( 'userInfo', \core::getUserInfo( $_SESSION['user_id'] ) );
|
||
$set['showNoPublic']=\core::getSettings('showNoPublic', 'a_tovar_cat');
|
||
/* ----------------------------------------------------------------------
|
||
15.12.2022
|
||
Получаем список категорий
|
||
---------------------------------------------------------------------- */
|
||
$_GET['id'] = ($_GET['id']) ? $_GET['id'] : 0;
|
||
$cats=\DB::getAll("SELECT `id`, `title` FROM `tovar_category` WHERE `status`=1 ORDER BY `title`");
|
||
for ( $i=0; $i<count($cats); $i++){
|
||
unset($c);
|
||
$c=\DB::getAll("SELECT count(*) FROM `tovar_category` WHERE `category`=? AND `status`=1" , $cats[$i]['id']);
|
||
$cats[$i]['count_cats']=$c[0]['count(*)'];
|
||
unset($c);
|
||
$c=\DB::getAll("SELECT count(*) FROM `tovar` WHERE `category`=? AND `status`=1", $cats[$i]['id']);
|
||
$cats[$i]['count_tovar']=$c[0]['count(*)'];
|
||
}
|
||
|
||
$smarty -> assign( 'cats', $cats );
|
||
$smarty -> assign( 'cat_list', 'api/modules/' . MOD . '/cat_list.html' );
|
||
$smarty -> assign( 'pages_list', 'api/modules/' . MOD . '/pages_list.html' );
|
||
$smarty -> assign( 'modal_new_cat', 'api/modules/' . MOD . '/modal_new_cat.html' );
|
||
$smarty -> assign( 'modal_del_page', 'api/modules/' . MOD . '/modal_del_page.html' );
|
||
$smarty -> assign( 'set', $set );
|
||
?>
|