Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
A
addcpm-json
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Александр Чаплыгин
addcpm-json
Commits
046cd179
Commit
046cd179
authored
Feb 28, 2019
by
Александр Чаплыгин
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
МЕтод для получения данных по клику
parent
80de9341
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
62 additions
and
76 deletions
+62
-76
ViewId.php
src/src/App/Action/User/ViewId.php
+12
-2
Feeds.php
src/src/App/Model/Feeds/Feeds.php
+19
-0
Statistics.php
src/src/App/Model/Statistics.php
+24
-0
view-id.phtml
src/templates/app/user/view-id.phtml
+7
-74
No files found.
src/src/App/Action/User/ViewId.php
View file @
046cd179
...
@@ -82,10 +82,20 @@ class ViewId extends Common
...
@@ -82,10 +82,20 @@ class ViewId extends Common
try
{
try
{
/** @var UserService $auth */
$auth
=
$this
->
container
->
get
(
UserService
::
class
);
$userId
=
$auth
->
getIdentity
()
->
getId
();
/** @var \App\Model\Feeds $feedsModel */
$feedsModel
=
$this
->
container
->
get
(
Feeds
::
class
);
$feed_id_list
=
$feedsModel
->
getIdListByUser
(
$userId
);
$view_id
=
$request
->
getAttribute
(
'id'
);
$view_id
=
$request
->
getAttribute
(
'id'
);
//return new JsonResponse($view_id);
$data
[
'error'
]
=
_t
(
'Извините, история визитов по клику: '
.
$view_id
.
' временно не работает'
);
// Статистика по клику:
$viewIdStats
=
$stats
->
getViewIdStatData
(
$feed_id_list
,
$view_id
);
$data
[
'viewIdStats'
]
=
$viewIdStats
;
}
catch
(
\Exception
$e
)
{
}
catch
(
\Exception
$e
)
{
$data
[
'error'
]
=
_t
(
'Извините, история визитов по клику временно не работает'
);
$data
[
'error'
]
=
_t
(
'Извините, история визитов по клику временно не работает'
);
...
...
src/src/App/Model/Feeds/Feeds.php
View file @
046cd179
...
@@ -59,4 +59,22 @@ class Feeds extends Common
...
@@ -59,4 +59,22 @@ class Feeds extends Common
return
$id
;
return
$id
;
}
}
public
function
getIdListByUser
(
$userId
)
{
$feeds
=
$this
->
findAll
([
'clientid'
=>
$userId
])
->
toArray
();
if
(
$feeds
)
{
$feed_id_list
=
[];
foreach
(
$feeds
as
$feed_item
)
{
$feed_id
=
$feed_item
[
'id'
];
if
(
!
in_array
(
$feed_id
,
$feed_id_list
))
{
$feed_id_list
[]
=
$feed_id
;
}
}
}
return
$feed_id_list
;
}
}
}
\ No newline at end of file
src/src/App/Model/Statistics.php
View file @
046cd179
...
@@ -250,6 +250,30 @@ class Statistics
...
@@ -250,6 +250,30 @@ class Statistics
return
$stats
;
return
$stats
;
}
}
// Данные по статистике по клику
public
function
getViewIdStatData
(
$feed_id_list
,
$view_id
)
{
$dataRequest
=
array
(
'method'
=>
"viewid"
,
'data'
=>
array
(
'filters'
=>
array
(
'FeedID'
=>
array
(
'values'
=>
$feed_id_list
),
'ViewID'
=>
$view_id
,
),
)
);
return
$dataRequest
;
//$stats = $this->apiRequest($dataRequest);
try
{
$stats
=
$this
->
apiRequest
(
$dataRequest
);
}
catch
(
\Exception
$e
)
{
$stats
[
'status'
]
=
'Error'
;
}
//return $stats;
$stats
=
[
$feed_id_list
,
$view_id
];
return
$stats
;
}
...
...
src/templates/app/user/view-id.phtml
View file @
046cd179
...
@@ -59,21 +59,13 @@ $error = $this->error;
...
@@ -59,21 +59,13 @@ $error = $this->error;
if
(
!
$error
)
{
if
(
!
$error
)
{
$periodStats
=
$this
->
periodStats
;
$periodStats
=
$this
->
periodStats
;
//$campaignStats = $this->campaignStats;
$current_period
=
$this
->
current_period
;
$current_period
=
$this
->
current_period
;
$dates
=
$this
->
dates
;
$dates
=
$this
->
dates
;
$current_report
=
$this
->
current_report
;
$report_conf
=
$this
->
report_conf
;
$report_title
=
$report_conf
[
'title'
];
$report_main_cat
=
$report_conf
[
'main_cat'
];
$report_cats
=
$report_conf
[
'cats'
];
$reports_list
=
$this
->
reports_list
;
$periods_list
=
$this
->
periods_list
;
$periods_list
=
$this
->
periods_list
;
$colors_active_lines
=
$this
->
colors_active_lines
;
$data_request_link
=
$this
->
url
(
'user.cabinet'
,
[
'lang'
=>
$this
->
lang
,
'report'
=>
$current_report
]);
$system_link
=
$this
->
url
(
'adm.system.actions'
);
//$data_request_link = $this->url('user.cabinet', ['lang' => $this->lang, 'report' => $current_report]);
}
}
?>
?>
...
@@ -88,36 +80,15 @@ if (!$error) {
...
@@ -88,36 +80,15 @@ if (!$error) {
<?php
else
:
?>
<?php
else
:
?>
<textarea
id=
"period-stats"
>
<?=
(
$periodStats
?
json_encode
(
$periodStats
,
JSON_UNESCAPED_UNICODE
)
:
''
)
?>
</textarea>
<textarea
id=
"period-stats"
>
<?=
(
$viewIdStats
?
json_encode
(
$viewIdStats
,
JSON_UNESCAPED_UNICODE
)
:
''
)
?>
</textarea>
<textarea
id=
"report-cats"
>
<?=
(
$report_cats
?
json_encode
(
$report_cats
,
JSON_UNESCAPED_UNICODE
)
:
''
)
?>
</textarea>
<?php
/* ?>
<textarea id="campaign-stats"><?= ($campaignStats ? json_encode($campaignStats) : '')?></textarea>
<?php */
?>
<section
class=
"b-content__work"
>
<section
class=
"b-content__work"
>
<div
class=
"wrapp"
style=
"position: relative;"
>
<div
class=
"wrapp"
style=
"position: relative;"
>
<div
class=
"b-feeds-stat_data-loading"
></div>
<div
class=
"b-feeds-stat_data-loading"
></div>
<?php
/* ?>
<a class="btn btn-primary service-action feed-test-data" href="<?= $system_link ?>">Сформировать тестовые данные</a>
<?php */
?>
<div
class=
"b-feeds-stat_controls form-group"
>
<div
class=
"b-feeds-stat_controls form-group"
>
<?php
/* Переключатель отчетов */
?>
<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"
>
<?=
_t
(
$report_title
)
?>
<span
class=
"caret"
></span>
</button>
<ul
class=
"dropdown-menu"
aria-labelledby=
"dropdownMenu"
>
<?php
foreach
(
$reports_list
as
$report_name
=>
$report_title
)
:
?>
<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
;
?>
</ul>
</div>
</div>
<?php
/* Выбор дат */
?>
<?php
/* Выбор дат */
?>
<span
class=
"b-feeds-stat_controls-period"
>
<span
class=
"b-feeds-stat_controls-period"
>
...
@@ -136,6 +107,9 @@ if (!$error) {
...
@@ -136,6 +107,9 @@ if (!$error) {
</div>
</div>
<?php
print_r
(
$viewIdStats
)
?>
<div
class=
"chart-graph-stat-info"
>
<div
class=
"chart-graph-stat-info"
>
<h2>
По заданным параметрам статистика отсутствует
</h2>
<h2>
По заданным параметрам статистика отсутствует
</h2>
</div>
</div>
...
@@ -144,47 +118,6 @@ if (!$error) {
...
@@ -144,47 +118,6 @@ if (!$error) {
<div
class=
"message"
></div>
<div
class=
"message"
></div>
</div>
</div>
<?php
/* График */
?>
<?php
if
(
$current_report
==
'common'
)
:
?>
<div
id=
"chart-graph-stat"
style=
"height: 370px;"
data-colors=
<?=
(
$colors_active_lines
?
json_encode
(
$colors_active_lines
)
:
''
)
?>
>
</div
>
<?php
endif
?>
<?php
/* Таблица */
?>
<div
id=
"table-stat"
class=
"b-table_wrapp"
>
<div
class=
"b-content__loading"
></div>
<table
id=
"table-line"
class=
"table table-striped admin
<?=
$current_report
?>
"
>
<thead
class=
"metric sortable"
>
<tr>
<th
class=
"period"
data-id=
"period"
>
<?php
foreach
(
$report_main_cat
as
$main_cat
)
:
?>
<b
class=
"main-cat selected
<?php
if
(
!
$main_cat
[
'isSorted'
])
:
?>
not-sorted
<?php
endif
;
?>
"
data-cat=
"
<?=
$main_cat
[
'name'
]
?>
"
>
<?=
_t
(
$main_cat
[
'title'
])
?>
</b>
<?php
endforeach
;
?>
</th>
<?php
foreach
(
$report_cats
as
$name
=>
$title
)
:
?>
<th
class=
"
<?=
$name
?>
"
data-id=
"
<?=
$name
?>
"
>
<?php
if
(
$current_report
==
'common'
)
:
?>
<span
style=
"border-color:
<?=
$colors_active_lines
[
$name
]
?>
;"
>
<input
type=
"checkbox"
data-field=
"
<?=
$name
?>
"
checked
/>
</span>
<b
class=
"cat"
id=
"
<?=
$name
?>
"
>
<?=
_t
(
$title
)
?>
</b>
<?php
endif
;
?>
<?php
if
(
$current_report
==
'transaction'
)
:
?>
<?php
if
(
$name
==
'Basket'
)
:
?>
<b
class=
"cat not-sorted"
id=
"
<?=
$name
?>
"
>
<?=
_t
(
$title
)
?>
</b><br
/>
<b
class=
"basket-link not-sorted"
>
Товар
</b>
<b
class=
"quantity not-sorted"
>
Кол-во
</b>
<b
class=
"price not-sorted"
>
Цена
</b>
<?php
else
:
?>
<b
class=
"cat"
id=
"
<?=
$name
?>
"
>
<?=
_t
(
$title
)
?>
<b
class=
"arrow asc"
>
▲
</b><b
class=
"arrow desc"
>
▼
</b></b>
<?php
endif
;
?>
<?php
endif
;
?>
</th>
<?php
endforeach
;
?>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
</section>
</section>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment