Добавил в конфиг отчетов параметры запросов к API

parent 66fc9497
...@@ -29,6 +29,8 @@ return [ ...@@ -29,6 +29,8 @@ return [
'reports' => [ 'reports' => [
'common' => [ 'common' => [
'title' => 'Сводный отчет', 'title' => 'Сводный отчет',
'type' => 'feed_stat',
'fields' => ['Views','Clicks','Orders','OrderSum'],
'cats' => [ 'cats' => [
'Views' => 'Показы', 'Views' => 'Показы',
'Clicks' => 'Клики', 'Clicks' => 'Клики',
...@@ -39,6 +41,8 @@ return [ ...@@ -39,6 +41,8 @@ return [
], ],
'transaction' => [ 'transaction' => [
'title' => 'Транзакции', 'title' => 'Транзакции',
'type' => 'feed_stat',
'fields' => ['Views','Clicks','Orders','OrderSum'],
'cats' => [ 'cats' => [
'Views' => 'Показы', 'Views' => 'Показы',
'Clicks' => 'Клики', 'Clicks' => 'Клики',
......
...@@ -130,13 +130,12 @@ class Cabinet extends Common ...@@ -130,13 +130,12 @@ class Cabinet extends Common
} }
$data['feeds'] = $feeds; $data['feeds'] = $feeds;
$data['report'] = $report_type; $data['current_report'] = $report_type;
$data['current_period'] = $current_period; $data['current_period'] = $current_period;
$data['dates'] = $dates; $data['dates'] = $dates;
$data['periodStats'] = $periodStats; $data['periodStats'] = $periodStats;
//$data['campaignStats'] = $campaignStats; //$data['campaignStats'] = $campaignStats;
$data['report_conf'] = $report_conf; $data['report_conf'] = $report_conf;
//$data['cats'] = $report_conf['cats'];
$data['reports_list'] = $reports_list; $data['reports_list'] = $reports_list;
$data['periods_list'] = $this->container->get('config')['feed_conf']['periods_list']; $data['periods_list'] = $this->container->get('config')['feed_conf']['periods_list'];
$data['colors_active_lines'] = $this->container->get('config')['feed_conf']['colors_active_lines']; $data['colors_active_lines'] = $this->container->get('config')['feed_conf']['colors_active_lines'];
......
...@@ -38,12 +38,12 @@ class Statistics ...@@ -38,12 +38,12 @@ class Statistics
// Параметры запроса по типу отчета: // Параметры запроса по типу отчета:
switch ($report_type) { switch ($report_type) {
case 'common': case 'common':
$type = 'feed_stat'; $type = $report_conf['type'];
$fields = ['Views','Clicks','Orders','OrderSum']; $fields = $report_conf['fields'];
break; break;
case 'transaction': case 'transaction':
$type = 'feed_stat'; $type = $report_conf['type'];
$fields = ['Views','Clicks','Orders','OrderSum']; $fields = $report_conf['fields'];
break; break;
} }
......
...@@ -61,7 +61,7 @@ if (!$error) { ...@@ -61,7 +61,7 @@ if (!$error) {
//$campaignStats = $this->campaignStats; //$campaignStats = $this->campaignStats;
$current_period = $this->current_period; $current_period = $this->current_period;
$dates = $this->dates; $dates = $this->dates;
$report = $this->report; $current_report = $this->current_report;
$report_conf = $this->report_conf; $report_conf = $this->report_conf;
$report_title = $report_conf['title']; $report_title = $report_conf['title'];
$report_cats = $report_conf['cats']; $report_cats = $report_conf['cats'];
...@@ -69,7 +69,7 @@ if (!$error) { ...@@ -69,7 +69,7 @@ if (!$error) {
$periods_list = $this->periods_list; $periods_list = $this->periods_list;
$colors_active_lines = $this->colors_active_lines; $colors_active_lines = $this->colors_active_lines;
$data_request_link = $this->url('user.cabinet', ['lang' => $this->lang, 'report' => $report]); $data_request_link = $this->url('user.cabinet', ['lang' => $this->lang, 'report' => $current_report]);
$system_link = $this->url('adm.system.actions'); $system_link = $this->url('adm.system.actions');
} }
...@@ -125,7 +125,7 @@ if (!$error) { ...@@ -125,7 +125,7 @@ if (!$error) {
</button> </button>
<ul class="dropdown-menu" aria-labelledby="dropdownMenu"> <ul class="dropdown-menu" aria-labelledby="dropdownMenu">
<?php foreach($reports_list as $report_name => $report_title): ?> <?php foreach($reports_list as $report_name => $report_title): ?>
<li><a href="<?= $this->url('user.cabinet', ['lang' => $this->lang, 'report' => $report_name]) ?>" <?php if($report == $report_name): ?>class="current"<?php endif; ?> report="<?= $report_name ?>"><?= _t($report_title) ?></a></li> <li><a href="<?= $this->url('user.cabinet', ['lang' => $this->lang, 'report' => $report_name]) ?>" <?php if($current_report == $report_name): ?>class="current"<?php endif; ?> report="<?= $report_name ?>"><?= _t($report_title) ?></a></li>
<?php endforeach; ?> <?php endforeach; ?>
</ul> </ul>
</div> </div>
...@@ -157,7 +157,7 @@ if (!$error) { ...@@ -157,7 +157,7 @@ if (!$error) {
</div> </div>
<?php /* График */ ?> <?php /* График */ ?>
<?php if ($report == 'common'): ?> <?php if ($current_report == 'common'): ?>
<div id="chart-graph-stat" style="height: 370px;" data-colors=<?= ($colors_active_lines ? json_encode($colors_active_lines) : '')?>></div> <div id="chart-graph-stat" style="height: 370px;" data-colors=<?= ($colors_active_lines ? json_encode($colors_active_lines) : '')?>></div>
<?php endif ?> <?php endif ?>
...@@ -168,7 +168,7 @@ if (!$error) { ...@@ -168,7 +168,7 @@ if (!$error) {
<thead class="metric sortable"> <thead class="metric sortable">
<tr> <tr>
<th> <th>
<?php if($report == 'common'): ?> <?php if($current_report == 'common'): ?>
<b class="main-cat date selected"><?= _t('Дата')?></b> <b class="main-cat date selected"><?= _t('Дата')?></b>
<?php /* ?>/ <b class="main-cat campaign"><?= _t('Кампания')?></b><?php */ ?> <?php /* ?>/ <b class="main-cat campaign"><?= _t('Кампания')?></b><?php */ ?>
<?php else: ?> <?php else: ?>
...@@ -177,7 +177,7 @@ if (!$error) { ...@@ -177,7 +177,7 @@ if (!$error) {
</th> </th>
<?php foreach($report_cats as $name => $title): ?> <?php foreach($report_cats as $name => $title): ?>
<th> <th>
<?php if ($report == 'common'): ?> <?php if ($current_report == 'common'): ?>
<span style="border-color: <?= $colors_active_lines[$name] ?>;"> <span style="border-color: <?= $colors_active_lines[$name] ?>;">
<input type="checkbox" data-field="<?= $name ?>" checked /> <input type="checkbox" data-field="<?= $name ?>" checked />
</span> </span>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment