first commit
This commit is contained in:
49
admin/menu/ArticlesMenu.php
Normal file
49
admin/menu/ArticlesMenu.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace Admin\Menu;
|
||||
|
||||
use Query\Operator;
|
||||
|
||||
class ArticlesMenu extends \Menu
|
||||
{
|
||||
public function get_vars()
|
||||
{
|
||||
$vars = parent::get_vars();
|
||||
|
||||
$AS = $this->articlesSections();
|
||||
$AA = [];
|
||||
$SQL = sqlQuery('SELECT id, nick
|
||||
FROM '.getTableName('articles_authors').'
|
||||
ORDER BY nick ASC');
|
||||
foreach ($SQL as $key => $row) {
|
||||
$AA[$key]['id'] = $row['id'];
|
||||
$AA[$key]['nick'] = $row['nick'];
|
||||
}
|
||||
|
||||
return array_merge($vars, [
|
||||
'article_sec' => $AS,
|
||||
'article_aut' => $AA,
|
||||
]);
|
||||
}
|
||||
|
||||
public function articlesSections($topCat = null)
|
||||
{
|
||||
$data = [];
|
||||
$SQL = sqlQueryBuilder()->select('ab.id, ab.name')
|
||||
->from('articles_branches', 'ab')
|
||||
->where(Operator::equalsNullable(['ab.top_branch' => $topCat]))
|
||||
->orderBy('ab.name', 'ASC')
|
||||
->execute();
|
||||
|
||||
foreach ($SQL as $key => $row) {
|
||||
$data[$key]['id'] = $row['id'];
|
||||
$data[$key]['topCat'] = $row['id'];
|
||||
$data[$key]['title'] = $row['name'];
|
||||
$data[$key]['submenu'] = $this->articlesSections($data[$key]['topCat']);
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
return ArticlesMenu::class;
|
||||
23
admin/menu/OrdersMassProcessMenu.php
Normal file
23
admin/menu/OrdersMassProcessMenu.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
class OrdersMassProcessMenu extends Menu
|
||||
{
|
||||
public function get_vars()
|
||||
{
|
||||
$vars = parent::get_vars();
|
||||
|
||||
$SQL = sqlQuery('SELECT d.id, d.name
|
||||
FROM '.getTableName('delivery_type').' AS dt
|
||||
LEFT JOIN '.getTableName('delivery_type_delivery').' d ON dt.id_delivery=d.id
|
||||
');
|
||||
|
||||
$dt = ['' => 'Všechny zp. dopravy'];
|
||||
foreach ($SQL as $row) {
|
||||
$dt[$row['id']] = $row['name'];
|
||||
}
|
||||
|
||||
$vars['delivery_types'] = $dt;
|
||||
|
||||
return $vars;
|
||||
}
|
||||
}
|
||||
53
admin/menu/OrdersMenu.php
Normal file
53
admin/menu/OrdersMenu.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
class OrdersMenu extends Menu
|
||||
{
|
||||
public function get_vars()
|
||||
{
|
||||
global $cfg;
|
||||
|
||||
$vars = parent::get_vars();
|
||||
|
||||
$complete = 0;
|
||||
// if (findModule('orders', 'complete')) {
|
||||
// sqlQuery(
|
||||
// 'SELECT SQL_CALC_FOUND_ROWS 1
|
||||
// FROM orders o
|
||||
// LEFT JOIN order_items oi ON oi.id_order=o.id
|
||||
// LEFT JOIN products p ON oi.id_product=p.id
|
||||
// LEFT JOIN products_variations pv ON pv.id=oi.id_variation
|
||||
// WHERE o.status_storno=0 AND o.status IN ('.join(',', getStatuses('complete')).')
|
||||
// GROUP BY o.id
|
||||
// HAVING MIN(COALESCE(pv.in_store, p.in_store) - oi.pieces + (
|
||||
// SELECT SUM(oi2.pieces)
|
||||
// FROM order_items oi2
|
||||
// LEFT JOIN orders o2 ON oi2.id_order=o2.id
|
||||
// WHERE oi2.id_product=p.id AND o2.date_created >= o.date_created AND o2.status_storno=0 AND o2.status IN ('.join(',', getStatuses('active')).')
|
||||
// AND ((oi2.id_variation IS NULL AND oi.id_variation IS NULL) OR oi.id_variation=oi2.id_variation)
|
||||
// )) >= 0'
|
||||
// );
|
||||
// $complete = returnSQLResult('SELECT FOUND_ROWS()');
|
||||
// }
|
||||
|
||||
$orders = [];
|
||||
if (isset($GLOBALS['cfg']['Order']['Status']['global'])) {
|
||||
foreach ($GLOBALS['cfg']['Order']['Status']['global'] as $key => $value) {
|
||||
$orders[$key] = (array_search($key, getStatuses('active')) !== false ? ' ('.returnSQLResult("SELECT COUNT(*) FROM orders WHERE status={$key} AND status_storno = 0").')' : '');
|
||||
}
|
||||
}
|
||||
|
||||
$flags = [];
|
||||
if (!empty($cfg['Order']['Flags'])) {
|
||||
foreach ($cfg['Order']['Flags'] as $key => $flag) {
|
||||
$flags[$key] = returnSQLResult("SELECT COUNT(*) FROM orders WHERE FIND_IN_SET('{$key}',flags)>0 AND status IN (".join(',', getStatuses('active')).')');
|
||||
}
|
||||
}
|
||||
|
||||
return array_merge($vars, [
|
||||
'complete' => $complete,
|
||||
'orders' => $orders,
|
||||
'flags' => $flags,
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
44
admin/menu/PhotosMenu.php
Normal file
44
admin/menu/PhotosMenu.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
class PhotosMenu extends Menu
|
||||
{
|
||||
public function get_vars()
|
||||
{
|
||||
$vars = parent::get_vars();
|
||||
|
||||
$print = ['Nenastaveno', 'leden', 'únor', 'březen', 'duben', 'květen', 'červen', 'červenec', 'srpen', 'září', 'říjen', 'listopad', 'prosinec'];
|
||||
|
||||
$SQL = sqlQuery('SELECT DISTINCT YEAR(date) AS y, MONTH(date) AS m
|
||||
FROM '.getTableName('photos').' AS p
|
||||
ORDER BY y DESC, m DESC');
|
||||
$data = [];
|
||||
$year = null;
|
||||
foreach ($SQL as $key => $row) {
|
||||
if (!$year || $year['year'] != $row['y']) {
|
||||
unset($year);
|
||||
$year = [
|
||||
'year' => $row['y'],
|
||||
'title' => $row['y'],
|
||||
'submenu' => [],
|
||||
];
|
||||
$data[] = &$year;
|
||||
|
||||
if ($year['year'] == 0) {
|
||||
$year['title'] = $print[0];
|
||||
$year['year'] = 'null';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$year['submenu'][] = [
|
||||
'month' => $row['m'],
|
||||
'year' => $row['y'],
|
||||
'title' => $print[$row['m']],
|
||||
];
|
||||
}
|
||||
|
||||
return array_merge($vars, [
|
||||
'data' => $data,
|
||||
]);
|
||||
}
|
||||
}
|
||||
25
admin/menu/ProductsMenu.php
Normal file
25
admin/menu/ProductsMenu.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
class ProductsMenu extends Menu
|
||||
{
|
||||
use \KupShop\AdminBundle\Util\CategoryTree;
|
||||
|
||||
public function get_vars()
|
||||
{
|
||||
$vars = parent::get_vars();
|
||||
|
||||
$SQL = sqlQuery('SELECT pr.id, pr.name
|
||||
FROM '.getTableName('producers').' AS pr
|
||||
ORDER BY pr.name ASC');
|
||||
|
||||
$producers = [];
|
||||
foreach ($SQL as $row) {
|
||||
$producers[] = $row;
|
||||
}
|
||||
|
||||
$vars['sections'] = $this->getCategories();
|
||||
$vars['producers'] = $producers;
|
||||
|
||||
return $vars;
|
||||
}
|
||||
}
|
||||
25
admin/menu/ProductsOfSuppliersMenu.php
Normal file
25
admin/menu/ProductsOfSuppliersMenu.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
class ProductsOfSuppliersMenu extends Menu
|
||||
{
|
||||
public function get_vars()
|
||||
{
|
||||
$vars = parent::get_vars();
|
||||
$SQL = sqlQuery('SELECT * FROM '.getTableName('suppliers').' ORDER BY name');
|
||||
$suppliers = [];
|
||||
foreach ($SQL as $key => $row) {
|
||||
$suppliers[$key] = $row;
|
||||
}
|
||||
$SQL = sqlQuery('SELECT id, name FROM '.getTableName('producers').' ORDER BY name');
|
||||
$producer = [];
|
||||
foreach ($SQL as $key => $row) {
|
||||
$producer[$key] = $row;
|
||||
}
|
||||
|
||||
return array_merge($vars, [
|
||||
'producers' => $producer,
|
||||
'suppliers' => $suppliers,
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
35
admin/menu/ProductsPricesMenu.php
Normal file
35
admin/menu/ProductsPricesMenu.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
class ProductsPricesMenu extends Menu
|
||||
{
|
||||
public function get_vars()
|
||||
{
|
||||
$vars = parent::get_vars();
|
||||
|
||||
$SQL = sqlQueryBuilder()
|
||||
->select('*')
|
||||
->from('suppliers')
|
||||
->orderBy('name')
|
||||
->execute();
|
||||
$suppliers = ['' => 'Všichni'];
|
||||
foreach ($SQL as $row) {
|
||||
$suppliers[$row['id']] = $row['name'];
|
||||
}
|
||||
|
||||
$SQL = sqlQueryBuilder()
|
||||
->select('*')
|
||||
->from('producers')
|
||||
->orderBy('name')
|
||||
->execute();
|
||||
$producers = ['' => 'Všichni'];
|
||||
foreach ($SQL as $key => $row) {
|
||||
$producers[$row['id']] = $row['name'];
|
||||
}
|
||||
|
||||
return array_merge($vars, [
|
||||
'suppliers' => $suppliers,
|
||||
'producers' => $producers,
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
19
admin/menu/UsersMenu.php
Normal file
19
admin/menu/UsersMenu.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
class UsersMenu extends Menu
|
||||
{
|
||||
public function get_vars()
|
||||
{
|
||||
$vars = parent::get_vars();
|
||||
|
||||
$result = [
|
||||
'users_groups' => sqlFetchAll(sqlQuery('SELECT id, name FROM users_groups'), ['id' => 'name']),
|
||||
];
|
||||
|
||||
if (findModule(Modules::PRICELISTS)) {
|
||||
$result['priceLists'] = sqlFetchAll(sqlQuery('SELECT id, name FROM pricelists'), ['id' => 'name']);
|
||||
}
|
||||
|
||||
return array_merge($vars, $result);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user