first commit

This commit is contained in:
Konstantin
2026-05-30 09:27:58 +03:00
commit de0344d218
2371 changed files with 661486 additions and 0 deletions
+121
View File
@@ -0,0 +1,121 @@
<?php
class ControllerReportOnline extends Controller {
public function index() {
$this->load->language('report/online');
$this->document->setTitle($this->language->get('heading_title'));
if (isset($this->request->get['filter_ip'])) {
$filter_ip = $this->request->get['filter_ip'];
} else {
$filter_ip = '';
}
if (isset($this->request->get['filter_customer'])) {
$filter_customer = $this->request->get['filter_customer'];
} else {
$filter_customer = '';
}
if (isset($this->request->get['page'])) {
$page = (int)$this->request->get['page'];
} else {
$page = 1;
}
$url = '';
if (isset($this->request->get['filter_customer'])) {
$url .= '&filter_customer=' . urlencode(html_entity_decode($this->request->get['filter_customer'], ENT_QUOTES, 'UTF-8'));
}
if (isset($this->request->get['filter_ip'])) {
$url .= '&filter_ip=' . $this->request->get['filter_ip'];
}
if (isset($this->request->get['page'])) {
$url .= '&page=' . $this->request->get['page'];
}
$data['breadcrumbs'] = array();
$data['breadcrumbs'][] = array(
'text' => $this->language->get('text_home'),
'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
);
$data['breadcrumbs'][] = array(
'text' => $this->language->get('heading_title'),
'href' => $this->url->link('report/online', 'user_token=' . $this->session->data['user_token'], true)
);
$data['refresh'] = $this->url->link('report/online', 'user_token=' . $this->session->data['user_token'] . $url, true);
$this->load->model('report/online');
$this->load->model('customer/customer');
$data['customers'] = array();
$filter_data = array(
'filter_ip' => $filter_ip,
'filter_customer' => $filter_customer,
'start' => ($page - 1) * $this->config->get('config_limit_admin'),
'limit' => $this->config->get('config_limit_admin')
);
$customer_total = $this->model_report_online->getTotalOnline($filter_data);
$results = $this->model_report_online->getOnline($filter_data);
foreach ($results as $result) {
$customer_info = $this->model_customer_customer->getCustomer($result['customer_id']);
if ($customer_info) {
$customer = $customer_info['firstname'] . ' ' . $customer_info['lastname'];
} else {
$customer = $this->language->get('text_guest');
}
$data['customers'][] = array(
'customer_id' => $result['customer_id'],
'ip' => $result['ip'],
'customer' => $customer,
'url' => $result['url'],
'referer' => $result['referer'],
'date_added' => date($this->language->get('datetime_format'), strtotime($result['date_added'])),
'edit' => $this->url->link('customer/customer/edit', 'user_token=' . $this->session->data['user_token'] . '&customer_id=' . $result['customer_id'], true)
);
}
$data['user_token'] = $this->session->data['user_token'];
$url = '';
if (isset($this->request->get['filter_customer'])) {
$url .= '&filter_customer=' . urlencode($this->request->get['filter_customer']);
}
if (isset($this->request->get['filter_ip'])) {
$url .= '&filter_ip=' . $this->request->get['filter_ip'];
}
$pagination = new Pagination();
$pagination->total = $customer_total;
$pagination->page = $page;
$pagination->limit = $this->config->get('config_limit_admin');
$pagination->url = $this->url->link('report/online', 'user_token=' . $this->session->data['user_token'] . $url . '&page={page}', true);
$data['pagination'] = $pagination->render();
$data['results'] = sprintf($this->language->get('text_pagination'), ($customer_total) ? (($page - 1) * $this->config->get('config_limit_admin')) + 1 : 0, ((($page - 1) * $this->config->get('config_limit_admin')) > ($customer_total - $this->config->get('config_limit_admin'))) ? $customer_total : ((($page - 1) * $this->config->get('config_limit_admin')) + $this->config->get('config_limit_admin')), $customer_total, ceil($customer_total / $this->config->get('config_limit_admin')));
$data['filter_customer'] = $filter_customer;
$data['filter_ip'] = $filter_ip;
$data['header'] = $this->load->controller('common/header');
$data['column_left'] = $this->load->controller('common/column_left');
$data['footer'] = $this->load->controller('common/footer');
$this->response->setOutput($this->load->view('report/online', $data));
}
}
+72
View File
@@ -0,0 +1,72 @@
<?php
class ControllerReportReport extends Controller {
public function index() {
$this->load->language('report/report');
$this->document->setTitle($this->language->get('heading_title'));
$data['breadcrumbs'] = array();
$data['breadcrumbs'][] = array(
'text' => $this->language->get('text_home'),
'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
);
$data['breadcrumbs'][] = array(
'text' => $this->language->get('heading_title'),
'href' => $this->url->link('report/report', 'user_token=' . $this->session->data['user_token'], true)
);
$data['user_token'] = $this->session->data['user_token'];
if (isset($this->request->get['code'])) {
$data['code'] = $this->request->get['code'];
} else {
$data['code'] = '';
}
// Reports
$data['reports'] = array();
$this->load->model('setting/extension');
// Get a list of installed modules
$extensions = $this->model_setting_extension->getInstalled('report');
// Add all the modules which have multiple settings for each module
foreach ($extensions as $code) {
if ($this->config->get('report_' . $code . '_status') && $this->user->hasPermission('access', 'extension/report/' . $code)) {
$this->load->language('extension/report/' . $code, 'extension');
$data['reports'][] = array(
'text' => $this->language->get('extension')->get('heading_title'),
'code' => $code,
'sort_order' => $this->config->get('report_' . $code . '_sort_order'),
'href' => $this->url->link('report/report', 'user_token=' . $this->session->data['user_token'] . '&code=' . $code, true)
);
}
}
$sort_order = array();
foreach ($data['reports'] as $key => $value) {
$sort_order[$key] = $value['sort_order'];
}
array_multisort($sort_order, SORT_ASC, $data['reports']);
if (isset($this->request->get['code'])) {
$data['report'] = $this->load->controller('extension/report/' . $this->request->get['code'] . '/report');
} elseif (isset($data['reports'][0])) {
$data['report'] = $this->load->controller('extension/report/' . $data['reports'][0]['code'] . '/report');
} else {
$data['report'] = '';
}
$data['header'] = $this->load->controller('common/header');
$data['column_left'] = $this->load->controller('common/column_left');
$data['footer'] = $this->load->controller('common/footer');
$this->response->setOutput($this->load->view('report/report', $data));
}
}
@@ -0,0 +1,262 @@
<?php
class ControllerReportStatistics extends Controller {
private $error = array();
public function index() {
$this->load->language('report/statistics');
$this->document->setTitle($this->language->get('heading_title'));
$this->load->model('report/statistics');
$this->getList();
}
public function ordersale() {
$this->load->language('report/statistics');
$this->document->setTitle($this->language->get('heading_title'));
$this->load->model('report/statistics');
if ($this->validate()) {
$this->load->model('sale/order');
$this->model_report_statistics->editValue('order_sale', $this->model_sale_order->getTotalSales(array('filter_order_status' => implode(',', array_merge($this->config->get('config_complete_status'), $this->config->get('config_processing_status'))))));
$this->session->data['success'] = $this->language->get('text_success');
$this->response->redirect($this->url->link('report/statistics', 'user_token=' . $this->session->data['user_token'], true));
}
$this->getList();
}
public function orderprocessing() {
$this->load->language('report/statistics');
$this->document->setTitle($this->language->get('heading_title'));
$this->load->model('report/statistics');
if ($this->validate()) {
$this->load->model('sale/order');
$this->model_report_statistics->editValue('order_processing', $this->model_sale_order->getTotalOrders(array('filter_order_status' => implode(',', $this->config->get('config_processing_status')))));
$this->session->data['success'] = $this->language->get('text_success');
$this->response->redirect($this->url->link('report/statistics', 'user_token=' . $this->session->data['user_token'], true));
}
$this->getList();
}
public function ordercomplete() {
$this->load->language('report/statistics');
$this->document->setTitle($this->language->get('heading_title'));
$this->load->model('report/statistics');
if ($this->validate()) {
$this->load->model('sale/order');
$this->model_report_statistics->editValue('order_complete', $this->model_sale_order->getTotalOrders(array('filter_order_status' => implode(',', $this->config->get('config_complete_status')))));
$this->session->data['success'] = $this->language->get('text_success');
$this->response->redirect($this->url->link('report/statistics', 'user_token=' . $this->session->data['user_token'], true));
}
$this->getList();
}
public function orderother() {
$this->load->language('report/statistics');
$this->document->setTitle($this->language->get('heading_title'));
$this->load->model('report/statistics');
if ($this->validate()) {
$this->load->model('localisation/order_status');
$order_status_data = array();
$results = $this->model_localisation_order_status->getOrderStatuses();
foreach ($results as $result) {
if (!in_array($result['order_status_id'], array_merge($this->config->get('config_complete_status'), $this->config->get('config_processing_status')))) {
$order_status_data[] = $result['order_status_id'];
}
}
$this->load->model('sale/order');
$this->model_report_statistics->editValue('order_other', $this->model_sale_order->getTotalOrders(array('filter_order_status' => implode(',', $order_status_data))));
$this->session->data['success'] = $this->language->get('text_success');
$this->response->redirect($this->url->link('report/statistics', 'user_token=' . $this->session->data['user_token'], true));
}
$this->getList();
}
public function returns() {
$this->load->language('report/statistics');
$this->document->setTitle($this->language->get('heading_title'));
$this->load->model('report/statistics');
if ($this->validate()) {
$this->load->model('sale/return');
$this->model_report_statistics->editValue('return', $this->model_sale_return->getTotalReturns(array('filter_return_status_id' => $this->config->get('config_return_status_id'))));
$this->session->data['success'] = $this->language->get('text_success');
$this->response->redirect($this->url->link('report/statistics', 'user_token=' . $this->session->data['user_token'], true));
}
$this->getList();
}
public function customer() {
$this->load->language('report/statistics');
$this->document->setTitle($this->language->get('heading_title'));
$this->load->model('report/statistics');
if ($this->validate()) {
$this->load->model('customer/customer');
$this->model_report_statistics->editValue('customer', $this->model_customer_customer->getTotalCustomers(array('filter_approved' => 0)));
$this->session->data['success'] = $this->language->get('text_success');
$this->response->redirect($this->url->link('report/statistics', 'user_token=' . $this->session->data['user_token'], true));
}
$this->getList();
}
public function affiliate() {
$this->load->language('report/statistics');
$this->document->setTitle($this->language->get('heading_title'));
$this->load->model('report/statistics');
if ($this->validate()) {
$this->load->model('customer/customer');
$this->model_report_statistics->editValue('affiliate', $this->model_customer_customer->getTotalAffiliates(array('filter_approved' => 0)));
$this->session->data['success'] = $this->language->get('text_success');
$this->response->redirect($this->url->link('report/statistics', 'user_token=' . $this->session->data['user_token'], true));
}
$this->getList();
}
public function product() {
$this->load->language('report/statistics');
$this->document->setTitle($this->language->get('heading_title'));
$this->load->model('report/statistics');
if ($this->validate()) {
$this->load->model('catalog/product');
$this->model_report_statistics->editValue('product', $this->model_catalog_product->getTotalProducts(array('filter_quantity' => 0)));
$this->session->data['success'] = $this->language->get('text_success');
$this->response->redirect($this->url->link('report/statistics', 'user_token=' . $this->session->data['user_token'], true));
}
$this->getList();
}
public function review() {
$this->load->language('report/statistics');
$this->document->setTitle($this->language->get('heading_title'));
$this->load->model('report/statistics');
if ($this->validate()) {
$this->load->model('catalog/review');
$this->model_report_statistics->editValue('review', $this->model_catalog_review->getTotalReviews(array('filter_status' => 0)));
$this->session->data['success'] = $this->language->get('text_success');
$this->response->redirect($this->url->link('report/statistics', 'user_token=' . $this->session->data['user_token'], true));
}
$this->getList();
}
public function getList() {
$data['breadcrumbs'] = array();
$data['breadcrumbs'][] = array(
'text' => $this->language->get('text_home'),
'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
);
$data['breadcrumbs'][] = array(
'text' => $this->language->get('heading_title'),
'href' => $this->url->link('report/statistics', 'user_token=' . $this->session->data['user_token'], true)
);
$data['statistics'] = array();
$this->load->model('report/statistics');
$results = $this->model_report_statistics->getStatistics();
foreach ($results as $result) {
$data['statistics'][] = array(
'name' => $this->language->get('text_' . $result['code']),
'value' => $result['value'],
'href' => $this->url->link('report/statistics/' . str_replace('_', '', $result['code']), 'user_token=' . $this->session->data['user_token'], true)
);
}
if (isset($this->error['warning'])) {
$data['error_warning'] = $this->error['warning'];
} else {
$data['error_warning'] = '';
}
if (isset($this->session->data['success'])) {
$data['success'] = $this->session->data['success'];
unset($this->session->data['success']);
} else {
$data['success'] = '';
}
$data['header'] = $this->load->controller('common/header');
$data['column_left'] = $this->load->controller('common/column_left');
$data['footer'] = $this->load->controller('common/footer');
$this->response->setOutput($this->load->view('report/statistics', $data));
}
protected function validate() {
if (!$this->user->hasPermission('modify', 'report/statistics')) {
$this->error['warning'] = $this->language->get('error_permission');
}
return !$this->error;
}
}