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
82178927
Commit
82178927
authored
Nov 09, 2018
by
Александр Чаплыгин
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Стр. статистики по фидам пользователя
parent
37088d16
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
675 additions
and
262 deletions
+675
-262
styles-feeds-stat.css
src/public/css/styles-feeds-stat.css
+138
-0
script-feeds-stat-charts.js
src/public/js/script-feeds-stat-charts.js
+185
-0
script-feeds-stat-table.js
src/public/js/script-feeds-stat-table.js
+123
-0
script-feeds-stat.js
src/public/js/script-feeds-stat.js
+70
-0
Cabinet.php
src/src/App/Action/User/Cabinet.php
+23
-1
StatsDay.php
src/src/App/Entity/Feeds/StatsDay.php
+47
-1
cabinet-feed.phtml
src/templates/app/user/cabinet-feed.phtml
+89
-260
No files found.
src/public/css/styles-feeds-stat.css
0 → 100644
View file @
82178927
/* Таблица стилей к странице статистики фида */
.b-content__work
{
padding-top
:
40px
;
background
:
#FFFFFF
;
}
.b-content__work.inner
{
max-width
:
1240px
;
margin
:
0
auto
;
}
.b-content__work.inner
input
[
type
=
"checkbox"
]
{
vertical-align
:
-2px
;
cursor
:
pointer
;
}
.b-clear
{
clear
:
both
;
}
.b-content__title
{
padding
:
85px
0
25px
;
height
:
260px
;
background-color
:
#EAEFF1
;
}
.b-content__title
picture
{
display
:
block
;
margin
:
0
auto
;
width
:
90px
;
margin-bottom
:
5px
;
}
.b-content__title
picture
img
{
height
:
90px
;
width
:
90px
;
object-fit
:
cover
;
border-radius
:
50%
;
}
.b-content__title
p
.lead
{
margin-bottom
:
5px
;
text-align
:
center
;
}
.b-content__title-settings
{
text-align
:
center
;
}
.b-content__title-settings
.annotation
{
color
:
#0071BC
;
}
.b-content__title-settings
.annotation
:hover
{
color
:
#177FC5
;
}
.b-content__title-settings
.annotation
:first-child
{
margin-right
:
30px
;
}
.form-group
.form-control
{
font-family
:
monospace
;
}
.form-group
select
.form-control
{
height
:
34px
;
line-height
:
14px
;
padding-right
:
15px
;
border-color
:
#BDCED4
;
background
:
url(../img/icon-open-accordeon.svg)
right
4px
center
no-repeat
;
background-size
:
10px
;
cursor
:
pointer
;
}
.b-feeds-stat_controls
{
margin-bottom
:
25px
;
height
:
34px
;
}
.b-feeds-stat_controls-report
{
float
:
left
;
}
.b-feeds-stat_controls-period
{
float
:
right
;
}
.b-feeds-stat_controls
input
.date-value
{
width
:
100px
;
}
.b-feeds-stat_controls
select
{
display
:
inline-block
;
margin
:
0
15px
0
2px
;
width
:
120px
;
height
:
30px
;
line-height
:
15px
;
}
.b-feeds-stat_controls
.order-period
{
width
:
135px
;
}
.chart-graph-stat-info
,
.chart-graph-stat-error
,
.chart-graph-stat-loading
{
display
:
none
;
padding-top
:
160px
;
height
:
370px
;
text-align
:
center
;
}
src/public/js/script-feeds-stat-charts.js
0 → 100644
View file @
82178927
$
(
document
).
ready
(
function
(){
var
selectorGraphChartStat
=
'#chart-graph-stat'
,
selectorActiveLine
=
'.b-filter__switch.current-metric .m-filter__switch-item_active'
,
selectorActiveTime
=
'.b-filter__switch.time .m-filter__switch-item_active'
,
selectorActiveDays
=
'.b-filter__switch.days .m-filter__switch-item_active'
,
selectorActiveData
=
'.b-filter__switch.metric-data .m-filter__switch-item_active'
,
activeLine
=
$
(
selectorActiveLine
).
data
(
'filter-category'
),
activeTime
,
activeDays
,
timeInterval
=
[],
weekDatesDataStart
;
// Временные интервалы для отображения на оси:
for
(
var
i
=
0
;
i
<
24
;
i
++
)
{
timeInterval
.
push
(
pad
(
i
)
+
':00'
);
}
// Добавление впереди 0 у однозначных значений
function
pad
(
number
)
{
var
r
=
String
(
number
);
if
(
r
.
length
===
1
)
{
r
=
'0'
+
r
;
}
return
r
;
}
// Форматирование даты
function
formatDate
(
date
)
{
return
date
.
getFullYear
()
+
'-'
+
pad
(
date
.
getMonth
()
+
1
)
+
'-'
+
pad
(
date
.
getDate
());
}
// Форматирование времени
function
formatTime
(
time
)
{
return
pad
(
time
.
getHours
())
+
':'
+
pad
(
time
.
getMinutes
());
}
function
valueFormat
(
value
,
ratio
,
id
)
{
var
currencyFields
=
[
'admoney'
,
'salemoney'
],
isCurrencyValue
=
currencyFields
.
indexOf
(
activeLine
)
>
-
1
,
format
=
(
isCurrencyValue
)
?
d3
.
format
(
',.2f'
)
:
d3
.
format
(
',.0f'
);
if
(
parseFloat
(
format
(
value
))
==
0
&&
value
!=
0
)
{
var
accuracy
=
Math
.
abs
(
Math
.
floor
(
Math
.
log10
(
value
)));
return
value
.
toFixed
(
accuracy
);
}
return
format
(
value
);
}
function
valueFormatTick
(
value
)
{
var
currencyFields
=
[
'admoney'
,
'salemoney'
],
isCurrencyValue
=
currencyFields
.
indexOf
(
activeLine
)
>
-
1
,
format
=
(
isCurrencyValue
)
?
d3
.
format
(
',.2f'
)
:
d3
.
format
(
',.0f'
);
return
format
(
value
);
}
function
formatDateMonth
(
value
)
{
var
monthes
=
[
'янв'
,
'фев'
,
'мар'
,
'апр'
,
'май'
,
'июн'
,
'июл'
,
'авг'
,
'сен'
,
'окт'
,
'ноя'
,
'дек'
];
return
monthes
[
value
.
getMonth
()];
}
function
formatDateWeek
(
value
)
{
var
monthes
=
[
'янв'
,
'фев'
,
'мар'
,
'апр'
,
'май'
,
'июн'
,
'июл'
,
'авг'
,
'сен'
,
'окт'
,
'ноя'
,
'дек'
],
startWeekDay
=
new
Date
(
value
),
currentDay
=
value
.
getDay
(),
diff
=
(
currentDay
==
0
)
?
6
:
currentDay
-
1
;
startWeekDay
.
setDate
(
value
.
getDate
()
-
diff
);
if
(
weekDatesDataStart
.
getTime
()
-
startWeekDay
.
getTime
()
>
0
)
{
startWeekDay
=
weekDatesDataStart
;
}
//return (startWeekDay.getMonth()+1) +'/'+ pad(startWeekDay.getDate()) + '-' + (value.getMonth()+1) +'/'+ pad(value.getDate());
return
startWeekDay
.
getDate
()
+
monthes
[
startWeekDay
.
getMonth
()]
+
'-'
+
value
.
getDate
()
+
monthes
[
value
.
getMonth
()];
}
$
.
extend
({
ChartStat
:
{
DateStat
:
function
(
dataLineChartStat
)
{
activeLine
=
'shows'
;
activeDays
=
'day'
;
console
.
log
(
'AAA DateStat: '
,
dataLineChartStat
);
// Диапазон дат:
if
(
dataLineChartStat
.
type
==
'interval'
)
{
var
dataPeriod
,
dataValue
,
rotateX
=
null
,
titleFormat
=
formatDate
,
formatTimeX
=
'%m-%d'
;
if
(
activeDays
==
'day'
)
{
dataPeriod
=
dataLineChartStat
[
'period'
];
dataValue
=
dataLineChartStat
[
activeLine
];
}
var
dataColumnsTemp
=
[[
'x'
].
concat
(
dataPeriod
)],
names
=
{},
types
=
{},
axes
=
{};
// Определяем названия в легенде:
dataColumnsTemp
.
push
([
'data'
].
concat
(
dataValue
));
names
[
'data'
]
=
activeLine
;
types
[
'data'
]
=
'area-spline'
;
axes
[
'data'
]
=
'y'
;
console
.
log
(
'AAA dataColumnsTemp '
,
dataColumnsTemp
);
var
chart
=
c3
.
generate
({
bindto
:
selectorGraphChartStat
,
data
:
{
x
:
'x'
,
//xFormat: '%H:%M',
columns
:
dataColumnsTemp
,
names
:
names
,
types
:
types
,
axes
:
axes
,
colors
:
{
data
:
'#2ca02c'
,
}
},
axis
:
{
x
:
{
type
:
'timeseries'
,
categories
:
dataPeriod
,
padding
:
{
left
:
0
},
tick
:
{
culling
:
{
max
:
25
},
format
:
formatTimeX
,
rotate
:
rotateX
}
},
y
:
{
min
:
0
,
padding
:
{
top
:
50
,
bottom
:
0
},
tick
:
{
format
:
valueFormatTick
}
}
},
grid
:
{
x
:
{
show
:
true
},
y
:
{
show
:
true
},
},
tooltip
:
{
format
:
{
title
:
titleFormat
,
value
:
valueFormat
}
},
legend
:
{
show
:
false
},
});
// Подсвечиваем Определяем индексы воскресенья:
if
(
activeDays
==
'day'
)
{
dataPeriod
.
forEach
(
function
(
date
,
ind
)
{
if
((
new
Date
(
date
)).
getUTCDay
()
==
0
)
{
$
(
'.c3-axis.c3-axis-x .tick'
).
eq
(
ind
).
attr
(
'class'
,
'tick sunday'
);
}
});
}
}
},
}
});
});
src/public/js/script-feeds-stat-table.js
0 → 100644
View file @
82178927
$
(
document
).
ready
(
function
(){
var
$table
=
$
(
'#table-line'
),
$tableHeader
=
$
(
'<thead>'
),
$tableContent
=
$
(
'<tbody>'
),
$tableBody
=
$table
.
find
(
'tbody'
).
first
(),
activeLinesSwitchSelector
=
'.b-filter__switch.current-metric:not(.metric-data) .b-filter__switch-item'
,
$activeLinesSwitch
=
$
(
activeLinesSwitchSelector
),
selectorTableTimeSwitch
=
'.b-filter__switch.time-table .m-filter__switch-item_active'
,
selectorActiveData
=
'.b-filter__switch.metric-data .m-filter__switch-item_active'
,
timeTableType
,
activeLines
=
[],
currentActiveLine
,
metric
,
dataTable
,
bySiteState
=
false
;
function
valueFormat
(
value
)
{
var
currencyFields
=
[
'admoney'
,
'salemoney'
],
isCurrencyValue
=
currencyFields
.
indexOf
(
currentActiveLine
)
>
-
1
,
format
=
(
isCurrencyValue
)
?
d3
.
format
(
',.2f'
)
:
d3
.
format
(
',.0f'
);
return
format
(
value
);
}
function
RenderInterval
(
dataLineChartStat
)
{
var
dataPeriod
=
dataLineChartStat
[
'period'
],
classTd
;
dataTable
=
dataLineChartStat
;
// Добавляем строку "Итого":
$row
=
$
(
'<tr style="font-weight: bold;">'
);
$row
.
append
(
$
(
'<td>'
).
html
(
"Итого"
));
activeLines
.
forEach
(
function
(
item
){
currentActiveLine
=
item
;
var
totalValue
=
0
;
for
(
var
i
=
dataPeriod
.
length
-
1
;
i
>=
0
;
i
--
)
{
totalValue
+=
dataTable
[
item
][
i
];
}
$row
.
append
(
$
(
'<td>'
).
html
(
valueFormat
(
totalValue
)));
});
$row
.
appendTo
(
$tableContent
);
for
(
var
i
=
dataPeriod
.
length
-
1
;
i
>=
0
;
i
--
)
{
var
date
=
dataPeriod
[
i
],
values
=
{};
activeLines
.
forEach
(
function
(
activeLine
){
currentActiveLine
=
activeLine
;
values
[
activeLine
]
=
valueFormat
(
dataTable
[
activeLine
][
i
]);
});
$row
=
$
(
'<tr>'
);
$row
.
append
(
$
(
'<td>'
).
html
(
date
));
activeLines
.
forEach
(
function
(
item
){
$row
.
append
(
$
(
'<td>'
).
html
(
values
[
item
]));
});
$row
.
appendTo
(
$tableContent
);
}
}
$
.
extend
({
TableStat
:
{
Render
:
function
(
dataLineChartStat
)
{
// Формируем список переключателей (категорий) activeLines:
activeLines
=
[
'shows'
,
'clicks'
,
'transactions'
,
'salemoney'
,
'admoney'
];
//console.log('AAA TableStat render: ', dataLineChartStat);
//console.log('AAA activeLines: ', activeLines);
dataTable
=
{};
activeLines
.
forEach
(
function
(
item
){
dataTable
[
item
]
=
[];
});
$table
.
removeClass
(
'compare'
);
$
(
'thead'
,
$table
).
removeClass
(
'sortable'
);
if
(
dataLineChartStat
.
type
==
'interval'
)
{
RenderInterval
(
dataLineChartStat
);
}
$tableBody
.
html
(
''
).
append
(
$tableContent
.
children
());
},
// Определяем список сайтов (зон, стиран) отмеченных галочками в таблице
CheckedCategories
:
function
()
{
var
listSites
=
[];
$
(
'input'
,
$table
).
each
(
function
(){
if
(
$
(
this
).
is
(
":checked"
))
{
if
(
!
isNaN
(
parseInt
(
$
(
this
).
attr
(
'id'
))))
{
listSites
.
push
(
parseInt
(
$
(
this
).
attr
(
'id'
)));
}
else
{
listSites
.
push
(
$
(
this
).
attr
(
'id'
));
}
}
})
return
(
listSites
.
length
==
0
)
?
false
:
listSites
;
},
// Устанавливаем состояние "по сайту" (при клике на сайт в таблице)
SetSiteState
:
function
(
state
)
{
bySiteState
=
state
;
},
// Получаем состояние "по сайту"
GetSiteState
:
function
()
{
return
bySiteState
;
},
}
});
});
src/public/js/script-feeds-stat.js
0 → 100644
View file @
82178927
$
(
document
).
ready
(
function
(){
(
function
(){
// Выбор дат для Stat http://t1m0n.name/air-datepicker/docs/index-ru.html
var
nowDate
=
new
Date
(),
datepicker1
=
$
(
'#date-value-1'
).
datepicker
({
dateFormat
:
"yyyy-mm-dd"
,
autoClose
:
true
,
maxDate
:
nowDate
}).
data
(
'datepicker'
),
datepicker2
=
$
(
'#date-value-2'
).
datepicker
({
dateFormat
:
"yyyy-mm-dd"
,
autoClose
:
true
,
maxDate
:
nowDate
}).
data
(
'datepicker'
),
currentDay1
=
new
Date
(
$
(
'#date-value-1'
).
val
()),
currentDay2
=
new
Date
(
$
(
'#date-value-2'
).
val
());
// Установка стартовых значений дат:
datepicker1
.
selectDate
(
currentDay1
);
datepicker2
.
selectDate
(
currentDay2
);
})();
var
$chartStat
=
$
(
'#chart-graph-stat'
),
$chartTable
=
$
(
'#b-content__traffic-table'
),
$chartStatInfo
=
$
(
'.chart-graph-stat-info'
),
$chartStatError
=
$
(
'.chart-graph-stat-error'
),
$chartStatLoading
=
$
(
'.chart-graph-stat-loading'
),
$chartStatErrorMessage
=
$
(
'.chart-graph-stat-error .message'
),
dataLineChartStat
;
// Получение данных для отрисовки графика Stat при старте:
if
(
$
(
'#period-stats'
).
val
())
{
dataLineChartStat
=
JSON
.
parse
(
$
(
'#period-stats'
).
val
());
}
// Отрисовка графика и таблицы по стартовым данным:
renderLineChart
();
renderHourTable
();
// Отрисовка графика Stat
function
renderLineChart
()
{
if
(
dataLineChartStat
)
{
console
.
log
(
'AAA dataLineChartStat = '
,
dataLineChartStat
);
$
.
ChartStat
.
DateStat
(
dataLineChartStat
);
return
false
;
}
}
// Отрисовка почасовой таблицы
function
renderHourTable
()
{
if
(
dataLineChartStat
)
{
$
.
TableStat
.
Render
(
dataLineChartStat
);
$chartTable
.
show
();
}
else
{
$chartTable
.
hide
();
}
}
});
\ No newline at end of file
src/src/App/Action/User/Cabinet.php
View file @
82178927
...
...
@@ -89,8 +89,30 @@ class Cabinet extends Common
$statsDaysModel
=
$this
->
container
->
get
(
StatsDays
::
class
);
$stats
=
$statsDaysModel
->
findAll
([
'FeedID'
=>
$feed_id_list
])
->
toArray
();
$periodStats
=
array
(
'period'
=>
[],
'shows'
=>
$stat_item
[
'shows'
],
'clicks'
=>
$stat_item
[
'clicks'
],
'transactions'
=>
$stat_item
[
'transactions'
],
'salemoney'
=>
$stat_item
[
'salemoney'
],
'admoney'
=>
$stat_item
[
'admoney'
],
'type'
=>
'interval'
);
foreach
(
$stats
as
$stat_item
)
{
$periodStats
[
'period'
][]
=
$stat_item
[
'eventdate'
];
$periodStats
[
'shows'
][]
=
$stat_item
[
'shows'
];
$periodStats
[
'clicks'
][]
=
$stat_item
[
'clicks'
];
$periodStats
[
'transactions'
][]
=
$stat_item
[
'transactions'
];
$periodStats
[
'salemoney'
][]
=
$stat_item
[
'salemoney'
];
$periodStats
[
'admoney'
][]
=
$stat_item
[
'admoney'
];
}
$dates
=
[
'2018-10-09'
,
'2018-11-09'
];
$data
[
'feeds'
]
=
$feeds
;
$data
[
'periodStats'
]
=
$stats
;
$data
[
'periodStats'
]
=
$periodStats
;
//$data['periodStats'] = $stats;
$data
[
'dates'
]
=
$dates
;
/*
$response = new HtmlResponse($this->template->render('app::user/feeds', [
...
...
src/src/App/Entity/Feeds/StatsDay.php
View file @
82178927
...
...
@@ -59,7 +59,7 @@ class StatsDay extends Common
}
// Shows
public
function
getShows
()
public
function
getShows
()
:
int
{
return
$this
->
shows
;
}
...
...
@@ -70,8 +70,53 @@ class StatsDay extends Common
return
$this
;
}
// Clicks
public
function
getClicks
()
:
int
{
return
$this
->
clicks
;
}
public
function
setClicks
(
$clicks
)
{
$this
->
clicks
=
$clicks
;
return
$this
;
}
// Transactions
public
function
getTransactions
()
:
int
{
return
$this
->
transactions
;
}
public
function
setTransactions
(
$transactions
)
{
$this
->
transactions
=
$transactions
;
return
$this
;
}
// Salemoney
public
function
getSalemoney
()
:
float
{
return
$this
->
salemoney
;
}
public
function
setSalemoney
(
$salemoney
)
{
$this
->
salemoney
=
$salemoney
;
return
$this
;
}
// Salemoney
public
function
getAdmoney
()
:
float
{
return
$this
->
admoney
;
}
public
function
setAdmoney
(
$admoney
)
{
$this
->
admoney
=
$admoney
;
return
$this
;
}
}
\ No newline at end of file
src/templates/app/user/cabinet-feed.phtml
View file @
82178927
...
...
@@ -28,19 +28,21 @@
/** @var $userSiteStatistic \App\Entity\Statistic\Site */
$this
->
headScript
()
->
appendFile
(
'//cdnjs.cloudflare.com/ajax/libs/autosize.js/3.0.18/autosize.min.js'
)
->
appendFile
(
'/js/underscore-min.js'
)
->
appendFile
(
'/js/jquery.cookie.js'
)
->
appendFile
(
'/js/bootstrap.min.js'
)
->
appendFile
(
'/js/c3.min.js'
)
->
appendFile
(
'/js/d3.min.js'
)
->
appendFile
(
'/js/script-cabinet.js'
)
->
appendFile
(
'/js/datepicker.min.js'
)
->
appendFile
(
'/js/script-feeds-stat-charts.js'
)
->
appendFile
(
'/js/script-feeds-stat-table.js'
)
->
appendFile
(
'/js/script-feeds-stat.js'
)
;
$this
->
headLink
()
->
appendStylesheet
(
'/css/styles-cabinet.css'
)
->
appendStylesheet
(
'/css/styles-cabinet-550.css'
,
'all and (max-width: 550px)'
)
->
appendStylesheet
(
'/css/styles-cabinet-stats.css'
)
->
appendStylesheet
(
'/css/c3.css'
)
->
appendStylesheet
(
'/css/datepicker.min.css'
)
->
appendStylesheet
(
'/css/styles-feeds-stat.css'
)
;
...
...
@@ -54,6 +56,8 @@ $src = $sxml['src'];
$error
=
$this
->
error
;
$periodStats
=
$this
->
periodStats
;
$dates
=
$this
->
dates
;
?>
...
...
@@ -72,268 +76,94 @@ $periodStats = $this->periodStats;
</section>
<?php
if
(
$error
)
:
?>
<section
class=
"b-content__work"
>
<h1>
<?=
$error
?>
</h1>
</section>
<section
class=
"b-content__work"
>
<h1>
<?=
$error
?>
</h1>
</section>
<?php
else
:
?>
<textarea
id=
"period-stats"
style=
"display: none;"
>
<?=
(
$periodStats
?
json_encode
(
$periodStats
)
:
''
)
?>
</textarea>
<textarea
id=
"period-stats"
style=
"display: none;"
>
<?=
(
$periodStats
?
json_encode
(
$periodStats
)
:
''
)
?>
</textarea>
<?php
/* Список доменов-поддоменов и сводная таблица */
?>
<section
class=
"b-content__losses"
>
<div
class=
"wrapp row row-wrap"
>
<div
class=
"b-content__losses-left col sm-4 xs-5"
>
<div
class=
"b-content__losses-left-item"
>
<section
class=
"b-content__work"
>
<div
class=
"wrapp"
>
<div
class=
"b-feeds-stat_controls form-group"
>
<?php
if
(
count
(
$listDomains
))
:
?>
<ul
id=
"domains-list"
class=
"b-subdomains-list main-list"
>
<a
class=
"all-domains"
href=
"#"
>
все сайты
→
</a>
<?php
foreach
(
$listDomains
as
$main_domain
)
:?>
<
li
>
<
a
class
="
main
-
domain
" data-domain="
<?=
$main_domain
?>
" data-id="
<?=
$main_domain
?>
" href="#">
<?=
$main_domain
?>
</a>
<ul
class=
"b-subdomains-list sub-list"
style=
"display: none;"
></ul>
</li>
<?php
endforeach
;
?>
</ul>
<?php
endif
;
?>
<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
(
'Сводный отчет'
)
?>
<span
class=
"caret"
></span>
</button>
<ul
class=
"dropdown-menu"
aria-labelledby=
"dropdownMenu"
>
<li><a
href=
"#"
class=
"current"
report=
"
<?=
$report
?>
"
>
<?=
_t
(
'Сводный отчет'
)
?>
</a></li>
<li><a
href=
"#"
class=
"current"
report=
"
<?=
$report
?>
"
>
<?=
_t
(
'Отчет 1'
)
?>
</a></li>
<li><a
href=
"#"
class=
"current"
report=
"
<?=
$report
?>
"
>
<?=
_t
(
'Отчет 2'
)
?>
</a></li>
<li><a
href=
"#"
class=
"current"
report=
"
<?=
$report
?>
"
>
<?=
_t
(
'Отчет 3'
)
?>
</a></li>
</ul>
</div>
</div>
</div>
</div>
<div
class=
"b-content__losses-right col sm-8 xs-7"
>
<div
class=
"b-content__no-data"
>
Данных по этому домену в системе нет
</div>
<div
class=
"b-content__loading summary"
></div>
<?php
$is_block_hits
=
false
;
$block_hits_class
=
'short'
;
foreach
(
$summaryReport
as
$range
=>
$value
)
{
if
(
$value
[
'block_hits'
]
&&
$value
[
'block_hits'
]
!=
0
)
{
$is_block_hits
=
true
;
$block_hits_class
=
'full'
;
break
;
}
}
?>
<table
id=
"summary-report-table"
class=
"user
<?=
$block_hits_class
?>
"
>
<thead>
<tr>
<th></th>
<th></th>
<?php
/* ?>
<th class="block-info"><?= _t('Показы блоков') ?></th>
<th class="block-info block_money"><?= _t('Сумма за блоки') ?></th>
<?php */
?>
<th>
<?=
_t
(
'Показы RTB'
)
?>
</th>
<th
class=
"money"
>
<?=
_t
(
'Доход RTB'
)
?>
</th>
<th
class=
"block-info total"
>
<?=
_t
(
'Итого'
)
?>
</th>
</tr>
</thead>
<tbody>
<tr>
<td><span
class=
"text"
>
<?=
_t
(
'Сегодня'
)
?>
</span></td>
<td></td>
<?php
/* ?>
<td class="block-info"><span id="summary-today-block_hits"><?= number_format(intval($summaryReport['today']['block_hits'])) ?></span></td>
<td class="block-info block_money"><span id="summary-today-block_money"><?= number_format((float) -$summaryReport['today']['block_money'], 2) ?> <?=$symb ?></span></td>
<?php */
?>
<td><span
id=
"summary-today-hits"
class=
"data"
>
<?=
number_format
(
intval
(
$summaryReport
[
'today'
][
'hits'
]))
?>
</span></td>
<td
class=
"money"
><span
id=
"summary-today-money"
class=
"data"
>
<?=
number_format
((
float
)
$summaryReport
[
'today'
][
'money'
],
2
)
?>
<?=
$symb
?>
</span></td>
<td
class=
"block-info total"
><span
id=
"summary-today-total"
>
<?=
number_format
((
float
)
$summaryReport
[
'today'
][
'money'
]
/*- $summaryReport['today']['block_money']*/
,
2
)
?>
<?=
$symb
?>
</span></td>
</tr>
<tr>
<td><span
class=
"text"
>
<?=
_t
(
'Вчера'
)
?>
</span></td>
<td></td>
<?php
/* ?>
<td class="block-info"><span id="summary-yesterday-block_hits"><?= number_format(intval($summaryReport['yesterday']['block_hits'])) ?></span></td>
<td class="block-info block_money"><span id="summary-yesterday-block_money"><?= number_format((float) -$summaryReport['yesterday']['block_money'], 2) ?> <?=$symb ?></span></td>
<?php */
?>
<td><span
id=
"summary-yesterday-hits"
class=
"data"
>
<?=
number_format
(
intval
(
$summaryReport
[
'yesterday'
][
'hits'
]))
?>
</span></td>
<td
class=
"money"
><span
id=
"summary-yesterday-money"
class=
"data"
>
<?=
number_format
((
float
)
$summaryReport
[
'yesterday'
][
'money'
],
2
)
?>
<?=
$symb
?>
</span></td>
<td
class=
"block-info total"
><span
id=
"summary-yesterday-total"
>
<?=
number_format
((
float
)
$summaryReport
[
'yesterday'
][
'money'
]
/*- $summaryReport['yesterday']['block_money']*/
,
2
)
?>
<?=
$symb
?>
</span></td>
</tr>
<tr>
<td><span
class=
"text"
>
<?=
_t
(
'30 дней'
)
?>
</span></td>
<td></td>
<?php
/* ?>
<td class="block-info"><span id="summary-30days-block_hits"><?= number_format(intval($summaryReport['30days']['block_hits'])) ?></span></td>
<td class="block-info block_money"><span id="summary-30days-block_money"><?= number_format((float) -$summaryReport['30days']['block_money'], 2) ?> <?=$symb ?></span></td>
<?php */
?>
<td><span
id=
"summary-30days-hits"
class=
"data"
>
<?=
number_format
(
intval
(
$summaryReport
[
'30days'
][
'hits'
]))
?>
</span></td>
<td
class=
"money"
><span
id=
"summary-30days-money"
class=
"data"
>
<?=
number_format
((
float
)
$summaryReport
[
'30days'
][
'money'
],
2
)
?>
<?=
$symb
?>
</span></td>
<td
class=
"block-info total"
><span
id=
"summary-30days-total"
>
<?=
number_format
((
float
)
$summaryReport
[
'30days'
][
'money'
]
/*- $summaryReport['30days']['block_money']*/
,
2
)
?>
<?=
$symb
?>
</span></td>
</tr>
<tr>
<td><span
class=
"text"
>
<?=
_t
(
'Текущий меcяц'
)
?>
</span></td>
<td></td>
<?php
/* ?>
<td class="block-info"><span id="summary-cur_month-block_hits"><?= number_format(intval($summaryReport['cur_month']['block_hits'])) ?></span></td>
<td class="block-info block_money"><span id="summary-cur_month-block_money"><?= number_format((float) -$summaryReport['cur_month']['block_money'], 2) ?> <?=$symb ?></span></td>
<?php */
?>
<td><span
id=
"summary-cur_month-hits"
class=
"data"
>
<?=
number_format
(
intval
(
$summaryReport
[
'cur_month'
][
'hits'
]))
?>
</span></td>
<td
class=
"money"
><span
id=
"summary-cur_month-money"
class=
"data"
>
<?=
number_format
((
float
)
$summaryReport
[
'cur_month'
][
'money'
],
2
)
?>
<?=
$symb
?>
</span></td>
<td
class=
"block-info total"
><span
id=
"summary-cur_month-total"
>
<?=
number_format
((
float
)
$summaryReport
[
'cur_month'
][
'money'
]
/*- $summaryReport['cur_month']['block_money']*/
,
2
)
?>
<?=
$symb
?>
</span></td>
</tr>
<tr>
<td><span
class=
"text"
>
<?=
_t
(
'Прошлый месяц'
)
?>
</span></td>
<td></td>
<?php
/* ?>
<td class="block-info"><span id="summary-prev_month-block_hits"><?= number_format(intval($summaryReport['prev_month']['block_hits'])) ?></span></td>
<td class="block-info block_money"><span id="summary-prev_month-block_money"><?= number_format((float) -$summaryReport['prev_month']['block_money'], 2) ?> <?=$symb ?></span></td>
<?php */
?>
<td><span
id=
"summary-prev_month-hits"
class=
"data"
>
<?=
number_format
(
intval
(
$summaryReport
[
'prev_month'
][
'hits'
]))
?>
</span></td>
<td
class=
"money"
><span
id=
"summary-prev_month-money"
class=
"data"
>
<?=
number_format
((
float
)
$summaryReport
[
'prev_month'
][
'money'
],
2
)
?>
<?=
$symb
?>
</span></td>
<td
class=
"block-info total"
><span
id=
"summary-prev_month-total"
>
<?=
number_format
((
float
)
$summaryReport
[
'prev_month'
][
'money'
]
/*- $summaryReport['prev_month']['block_money']*/
,
2
)
?>
<?=
$symb
?>
</span></td>
</tr>
</tbody>
</table>
</div>
</div>
</section>
<?php
$is_block_hits
=
false
;
$block_hits_class
=
'short'
;
$block_switch_full_style
=
'style="display: none;"'
;
$block_switch_short_style
=
'style="display: flex;"'
;
?>
<?php
/* График */
?>
<section
id=
"b-content__traffic-chart"
class=
"b-content__traffic"
>
<div
class=
"b-content__loading chart"
></div>
<div
class=
"wrapp"
>
<div
class=
"b-content__traffic-filter"
>
<div
id=
"daterange-dropdown"
class=
"b-add-car__form-item droplist chart-dates"
>
<span
class=
"droplist-current text bold tab-input"
></span>
<ul
class=
"droplist-block"
>
<?php
foreach
(
$dateRange
as
$date
)
:
?>
<li
class=
"droplist-item text"
data-date-value=
"
<?=
$date
->
format
(
'Y-m'
)
?>
"
>
<?=
_t
(
$date
->
format
(
'F'
))
.
', '
.
$date
->
format
(
'Y'
)
?>
</li>
<?php
endforeach
?>
</ul>
</div>
<?php
if
(
true
)
:
?>
<div
class=
"b-filter__switch display full
<?php
if
(
$is_block_hits
)
:
?>
current
<?php
endif
;
?>
"
<?=
$block_switch_full_style
?>
>
<?php
/* ?>
<span class="b-filter__switch-item text" data-filter-category="block_hits"><?= _t('Показы блоков')?></span>
<span class="b-filter__switch-item text" data-filter-category="block_money"><?= _t('Сумма за блоки')?></span>
<?php */
?>
<span
class=
"b-filter__switch-item text"
data-filter-category=
"hits"
>
<?=
_t
(
'Показы RTB'
)
?>
</span>
<span
class=
"b-filter__switch-item text"
data-filter-category=
"money"
>
<?=
_t
(
'Доход RTB'
)
?>
</span>
<span
class=
"b-filter__switch-item text"
data-filter-category=
"total"
>
<?=
_t
(
'Итого'
)
?>
</span>
<span
class=
"b-feeds-stat_controls-period"
>
<div
style=
"display:inline-block;"
>
Дата:
</div>
<input
type=
'text'
id=
"date-value-1"
class=
"btn btn-default date-value"
value=
"
<?=
$dates
[
0
]
?>
"
/>
–
<input
type=
'text'
id=
"date-value-2"
class=
"btn btn-default date-value"
value=
"
<?=
$dates
[
1
]
?>
"
/>
<span>
период:
</span>
<select
class=
"form-control order-period"
name=
"period"
>
<option
value=
""
disabled
>
--
</option>
<option
value=
"today"
>
сегодня
</option>
<option
value=
"yesterday"
>
вчера
</option>
<option
value=
"7days"
>
7 дней
</option>
<option
value=
"30days"
>
30 дней
</option>
<option
value=
"current_month"
>
текущий месяц
</option>
<option
value=
"prev_month"
selected
>
прошлый месяц
</option>
<option
value=
"year"
>
год
</option>
</select>
</span>
</div>
<?php
else
:
?>
<div
class=
"b-filter__switch display full
<?php
if
(
$is_block_hits
)
:
?>
current
<?php
endif
;
?>
"
<?=
$block_switch_full_style
?>
>
<span
class=
"b-filter__switch-item text"
data-filter-category=
"common_hits"
>
<?=
_t
(
'Показы'
)
?>
</span>
<span
class=
"b-filter__switch-item text"
data-filter-category=
"common_money"
>
<?=
_t
(
'Деньги'
)
?>
</span>
<span
class=
"b-filter__switch-item text"
data-filter-category=
"total"
>
<?=
_t
(
'Итого'
)
?>
</span>
<div
class=
"chart-graph-stat-info"
>
<h2>
По заданным параметрам статистика отсутствует
</h2>
</div>
<?php
endif
;
?>
<div
class=
"b-filter__switch display short
<?php
if
(
!
$is_block_hits
)
:
?>
current
<?php
endif
;
?>
"
<?=
$block_switch_short_style
?>
>
<span
class=
"b-filter__switch-item text"
data-filter-category=
"hits"
>
<?=
_t
(
'Показы RTB'
)
?>
</span>
<span
class=
"b-filter__switch-item text"
data-filter-category=
"money"
>
<?=
_t
(
'Доход RTB'
)
?>
</span>
<div
class=
"chart-graph-stat-error"
>
<h2>
Ошибка в статистике
</h2>
<div
class=
"message"
></div>
</div>
<div
id=
"chart-graph-stat"
style=
"height: 370px;"
></div>
<div
class=
"chart-graph-stat-loading"
></div>
<?php
/* Таблица */
?>
<section
id=
"b-content__traffic-table"
class=
"b-content__traffic metrics"
style=
"display: none;"
>
<div
class=
"b-content__loading"
></div>
<div
class=
"wrapp"
>
<table
id=
"table-line"
class=
"table table-striped admin"
>
<thead
class=
"metric"
>
<tr
data-metric=
"
<?=
$metric
?>
"
<?=
$current_style
?>
>
<th>
<?=
_t
(
'Дата/Компания'
)
?>
</th>
<?php
foreach
([
'shows'
,
'clicks'
,
'transactions'
,
'salemoney'
,
'admoney'
]
as
$name
)
:
?>
<th>
<b
id=
"
<?=
$name
?>
"
>
<?=
_t
(
$name
)
?>
<b
class=
"arrow asc"
>
∧
</b>
<b
class=
"arrow desc"
>
∨
</b>
</b>
</th>
<?php
endforeach
?>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</section>
</div>
<div
id=
"chart-graph"
style=
"height: 370px"
></div>
</div>
</section>
</section>
<?php
/* Основная таблица */
?>
<section
id=
"b-content__traffic-table"
class=
"b-content__traffic"
>
<div
class=
"b-content__loading table"
></div>
<div
class=
"wrapp"
>
<table
id=
"table-line"
class=
"table table-striped user
<?=
$block_hits_class
?>
"
>
<thead>
<tr>
<th>
<?=
_t
(
'Дата'
)
?>
</th>
<?php
/* ?>
<th class="block-info"><?= _t('Показы блоков')?></th>
<th class="block-info block_money"><?= _t('Сумма за блоки')?></th>
<?php */
?>
<th>
<?=
_t
(
'Показы RTB'
)
?>
</th>
<th
class=
"money"
>
<?=
_t
(
'Доход RTB'
)
?>
</th>
<th
class=
"block-info total"
>
<?=
_t
(
'Итого'
)
?>
</th>
</tr>
</thead>
<tbody>
<?php
$summ_views
=
0
;
$summ_income
=
0
;
$summ_block_hits
=
0
;
$summ_block_money
=
0
;
$summ_total
=
0
;
?>
<?php
if
(
$periodStats
)
:
?>
<?php
$periodStats
=
array_map
(
function
(
$v
){
$v
=
array_reverse
(
$v
);
return
$v
;
},
$periodStats
);
?>
<?php
foreach
(
$periodStats
[
'period'
]
as
$i
=>
$date
)
:
?>
<?php
$summ_views
+=
$periodStats
[
'hits'
][
$i
];
$summ_income
+=
$periodStats
[
'money'
][
$i
];
$summ_block_hits
+=
$periodStats
[
'block_hits'
][
$i
];
$summ_block_money
+=
$periodStats
[
'block_money'
][
$i
];
$summ_total
+=
$periodStats
[
'money'
][
$i
]
-
$periodStats
[
'block_money'
][
$i
];
?>
<tr>
<td>
<?=
$date
?>
</td>
<?php
/* ?>
<td class="block-info"><?= number_format(intval($periodStats['block_hits'][$i]))?></td>
<td class="block-info block_money"><?= number_format((float) -$periodStats['block_money'][$i], 2)?> <?=$symb ?></td>
<?php */
?>
<td>
<?=
number_format
(
intval
(
$periodStats
[
'hits'
][
$i
]))
?>
</td>
<td
class=
"money"
>
<?=
number_format
((
float
)
$periodStats
[
'money'
][
$i
],
2
)
?>
<?=
$symb
?>
</td>
<td
class=
"block-info total"
>
<?=
number_format
((
float
)
$periodStats
[
'money'
][
$i
]
-
$periodStats
[
'block_money'
][
$i
],
2
)
?>
<?=
$symb
?>
</td>
</tr>
<?php
endforeach
;
?>
<?php
endif
?>
</tbody>
<tfoot>
<?php
if
(
$periodStats
)
:
?>
<tr>
<td>
<?=
_t
(
'Сумма'
)
?>
</td>
<?php
/* ?>
<td class="block-info summ-block_hits"><?= number_format($summ_block_hits) ?></td>
<td class="block-info summ-block_money block_money"><?= number_format(-$summ_block_money, 2) ?> <?=$symb ?></td>
<?php */
?>
<td
class=
"summ-views"
>
<?=
number_format
(
$summ_views
)
?>
</td>
<td
class=
"summ-income money"
>
<?=
number_format
((
float
)
$summ_income
,
2
)
?>
<?=
$symb
?>
</td>
<td
class=
"block-info summ-total total"
>
<?=
number_format
(
$summ_total
,
2
)
?>
<?=
$symb
?>
</td>
</tr>
<?php
endif
?>
</tfoot>
</table>
</div>
</section>
<?php
endif
?>
\ No newline at end of file
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