Добавил в конфиг названия отчетов, проброс списка отчетов в шаблон

parent 29af8eab
......@@ -28,6 +28,7 @@ return [
],
'reports' => [
'common' => [
'title' => 'Сводный отчет',
'cats' => [
'Views' => 'Показы',
'Clicks' => 'Клики',
......@@ -37,6 +38,7 @@ return [
]
],
'transaction' => [
'title' => 'Транзакции',
'cats' => [
'Views' => 'Показы',
'Clicks' => 'Клики',
......
......@@ -106,7 +106,15 @@ class Cabinet extends Common
$current_period = 'current_month';
$dates = [date('Y-m-01'), date('Y-m-d')];
$report_conf = $this->container->get('config')['feed_conf']['reports'][$report_type];
$reports_conf = $this->container->get('config')['feed_conf']['reports'];
$report_conf = $reports_conf[$report_type];
// Список отчетов:
$reports_list = [];
foreach($reports_conf as $report_name => $report_value) {
$reports_list[$report_name] = $report_value['title'];
}
switch ($report_type) {
case 'common':
......@@ -127,7 +135,9 @@ class Cabinet extends Common
$data['dates'] = $dates;
$data['periodStats'] = $periodStats;
//$data['campaignStats'] = $campaignStats;
$data['cats'] = $cats = $this->container->get('config')['feed_conf']['reports'][$report_type]['cats'];
$data['report_conf'] = $report_conf;
//$data['cats'] = $report_conf['cats'];
$data['reports_list'] = $reports_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'];
......
......@@ -61,8 +61,11 @@ if (!$error) {
//$campaignStats = $this->campaignStats;
$current_period = $this->current_period;
$dates = $this->dates;
$cats = $this->cats;
$report = $this->report;
$report_conf = $this->report_conf;
$report_title = $report_conf['title'];
$report_cats = $report_conf['cats'];
$reports_list = $this->reports_list;
$periods_list = $this->periods_list;
$colors_active_lines = $this->colors_active_lines;
......@@ -117,16 +120,13 @@ if (!$error) {
<div class="b-feeds-stat_controls-report">
<div class="dropdown" style="display:inline-block;">
<button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
<?php if($report == 'common'): ?>
<?= _t('Сводный отчет') ?>
<?php else: ?>
<?= _t('Транзакции') ?>
<?php endif; ?>
<?= _t($report_title) ?>
<span class="caret"></span>
</button>
<ul class="dropdown-menu" aria-labelledby="dropdownMenu">
<li><a href="<?= $this->url('user.cabinet', ['lang' => $this->lang, 'report' => 'common']) ?>" <?php if($report == 'common'): ?>class="current"<?php endif; ?> report="common"><?= _t('Сводный отчет') ?></a></li>
<li><a href="<?= $this->url('user.cabinet', ['lang' => $this->lang, 'report' => 'transaction']) ?>" <?php if($report == 'transaction'): ?>class="current"<?php endif; ?> report="transaction"><?= _t('Транзакции') ?></a></li>
<?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>
<?php endforeach; ?>
</ul>
</div>
</div>
......@@ -175,7 +175,7 @@ if (!$error) {
<b class="main-cat date selected"><?= _t('Транзакция')?></b>
<?php endif; ?>
</th>
<?php foreach($cats as $name => $title): ?>
<?php foreach($report_cats as $name => $title): ?>
<th>
<?php if ($report == 'common'): ?>
<span style="border-color: <?= $colors_active_lines[$name] ?>;">
......
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