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
55f619f4
Commit
55f619f4
authored
Nov 16, 2018
by
Александр Чаплыгин
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Названия фидов в статистике вместо id, почистил проект
parent
9b2d5f7d
Hide whitespace changes
Inline
Side-by-side
Showing
37 changed files
with
13 additions
and
5313 deletions
+13
-5313
acl.global.php
src/config/autoload/acl.global.php
+0
-3
blog.global.php
src/config/autoload/blog.global.php
+0
-32
dependencies.global.php
src/config/autoload/dependencies.global.php
+0
-112
routes.global.php
src/config/autoload/routes.global.php
+2
-122
script-codestat.js
src/public/js/script-codestat.js
+0
-754
Blog.php
src/src/App/Action/Blog.php
+0
-131
Examples.php
src/src/App/Action/Examples.php
+0
-47
Site.php
src/src/App/Action/Site.php
+0
-117
Statistics.php
src/src/App/Action/Statistics.php
+0
-312
Cabinet.php
src/src/App/Action/User/Cabinet.php
+11
-2
Codestat.php
src/src/App/Action/User/Codestat.php
+0
-190
ApplyVacancy.php
src/src/App/Entity/ApplyVacancy.php
+0
-100
Article.php
src/src/App/Entity/Article.php
+0
-201
Provider.php
src/src/App/Entity/Provider.php
+0
-55
ProviderDomain.php
src/src/App/Entity/ProviderDomain.php
+0
-60
Site.php
src/src/App/Entity/Site.php
+0
-369
Slot.php
src/src/App/Entity/Slot.php
+0
-289
Blockers.php
src/src/App/Entity/Statistic/Blockers.php
+0
-128
Data.php
src/src/App/Entity/Statistic/Data.php
+0
-98
Site.php
src/src/App/Entity/Statistic/Site.php
+0
-247
Zone.php
src/src/App/Entity/Zone.php
+0
-328
ZoneAddition.php
src/src/App/Entity/ZoneAddition.php
+0
-96
Blockers.php
src/src/App/Hydrator/Blockers.php
+0
-63
Site.php
src/src/App/Hydrator/Site.php
+0
-65
Data.php
src/src/App/Hydrator/Strategy/Data.php
+0
-96
Providers.php
src/src/App/Model/Providers.php
+0
-68
ProvidersDomains.php
src/src/App/Model/ProvidersDomains.php
+0
-80
Sites.php
src/src/App/Model/Sites.php
+0
-191
Slots.php
src/src/App/Model/Slots.php
+0
-79
Zones.php
src/src/App/Model/Zones.php
+0
-184
ZonesAdditions.php
src/src/App/Model/ZonesAdditions.php
+0
-93
examples.phtml
src/templates/app/examples.phtml
+0
-41
add-site.phtml
src/templates/app/popup/add-site.phtml
+0
-45
statistics.phtml
src/templates/app/statistics.phtml
+0
-79
cabinet-feed.phtml
src/templates/app/user/cabinet-feed.phtml
+0
-2
cabinet.phtml
src/templates/app/user/cabinet.phtml
+0
-433
layout-main.phtml
src/templates/layout/layout-main.phtml
+0
-1
No files found.
src/config/autoload/acl.global.php
View file @
55f619f4
...
...
@@ -34,11 +34,8 @@ return [
->
allow
(
Roles
::
ROLE_GUEST
,
'user.mail.sent.password'
)
->
allow
(
Roles
::
ROLE_USER
,
'user.cabinet'
,
null
,
new
\App\Acl\Assertion\UserActive
())
->
allow
(
Roles
::
ROLE_USER
,
'user.cabinet.profile'
,
null
,
new
\App\Acl\Assertion\UserActive
())
->
allow
(
Roles
::
ROLE_USER
,
'site.add'
,
null
,
new
\App\Acl\Assertion\UserActive
())
->
allow
(
Roles
::
ROLE_USER
,
'site.remove'
,
null
,
new
\App\Acl\Assertion\UserActive
())
->
allow
(
Roles
::
ROLE_USER
,
'install.counter'
,
null
,
new
\App\Acl\Assertion\UserActive
())
->
allow
(
Roles
::
ROLE_USER
,
'download.counter'
,
null
,
new
\App\Acl\Assertion\UserActive
())
->
allow
(
Roles
::
ROLE_USER
,
'codestat'
)
->
allow
(
Roles
::
ROLE_GUEST
,
'email.counter'
)
->
allow
(
Roles
::
ROLE_GUEST
,
'adm.system.actions'
)
...
...
src/config/autoload/blog.global.php
deleted
100644 → 0
View file @
9b2d5f7d
<?php
/**
* Copyright (c) 2017 Serhii Borodai <clarifying@gmail.com>.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*
*/
return
[
'blog'
=>
[
'articlesPerPage'
=>
12
,
]
];
\ No newline at end of file
src/config/autoload/dependencies.global.php
View file @
55f619f4
...
...
@@ -41,7 +41,6 @@ return [
$hpm
->
setService
(
\App\Entity\User
::
class
,
new
\Zend\Hydrator\ClassMethods
());
$hpm
->
setService
(
\App\Entity\UserType
::
class
,
new
\Zend\Hydrator\ClassMethods
());
$hpm
->
setService
(
\App\Entity\Caterogy
::
class
,
new
\Zend\Hydrator\ClassMethods
());
$hpm
->
setService
(
\App\Entity\UserCategory
::
class
,
new
\Zend\Hydrator\ClassMethods
());
$hpm
->
setService
(
\App\Entity\Country
::
class
,
new
\Zend\Hydrator\ClassMethods
());
$hpm
->
setService
(
\App\Entity\Currency
::
class
,
new
\Zend\Hydrator\ClassMethods
());
...
...
@@ -53,19 +52,7 @@ return [
//TODO: Delete this?
$hpm
->
setService
(
\App\Entity\Statistic\Site
::
class
,
new
\App\Hydrator\Site
());
$hpm
->
setService
(
\App\Entity\Statistic\Blockers
::
class
,
new
\App\Hydrator\Blockers
());
$hpm
->
setService
(
\App\Entity\Site
::
class
,
new
\Zend\Hydrator\ClassMethods
());
$hpm
->
setService
(
\App\Entity\Zone
::
class
,
new
\Zend\Hydrator\ClassMethods
());
$hpm
->
setService
(
\App\Entity\Provider
::
class
,
new
\Zend\Hydrator\ClassMethods
());
$hpm
->
setService
(
\App\Entity\ProviderDomain
::
class
,
new
\Zend\Hydrator\ClassMethods
());
$hpm
->
setService
(
\App\Entity\Code
::
class
,
new
\Zend\Hydrator\ClassMethods
());
$hpm
->
setService
(
\App\Entity\Slot
::
class
,
new
\Zend\Hydrator\ClassMethods
());
$hpm
->
setService
(
\App\Entity\RtbParam
::
class
,
new
\Zend\Hydrator\ClassMethods
());
$hpm
->
setService
(
\App\Entity\ZoneAddition
::
class
,
new
\Zend\Hydrator\ClassMethods
());
$hpm
->
setService
(
\App\Entity\Feeds\Feed
::
class
,
new
\Zend\Hydrator\ClassMethods
());
$hpm
->
setService
(
\App\Entity\Feeds\StatsDay
::
class
,
new
\Zend\Hydrator\ClassMethods
());
...
...
@@ -74,9 +61,7 @@ return [
$hpm
->
setService
(
\App\Entity\Contacts
::
class
,
new
\Zend\Hydrator\ClassMethods
());
$hpm
->
setService
(
\App\Entity\Feedback
::
class
,
new
\Zend\Hydrator\ClassMethods
());
$hpm
->
setService
(
\App\Entity\ApplyVacancy
::
class
,
new
\Zend\Hydrator\ClassMethods
());
$hpm
->
setService
(
\App\Entity\Article
::
class
,
new
\Zend\Hydrator\ClassMethods
());
$hpm
->
setService
(
\App\Entity\Tag
::
class
,
new
\Zend\Hydrator\ClassMethods
());
return
$hpm
;
...
...
@@ -163,103 +148,6 @@ return [
$container
->
get
(
\Monolog\Logger
::
class
)
);
},
\App\Model\Sites
::
class
=>
function
(
ContainerInterface
$container
)
{
return
new
\App\Model\Sites
(
new
Zend\Db\TableGateway\TableGateway
(
'sites'
,
$container
->
get
(
Zend\Db\Adapter\Adapter
::
class
),
new
\Zend\Db\TableGateway\Feature\MetadataFeature
(),
new
\Zend\Db\ResultSet\HydratingResultSet
(
$container
->
get
(
\Zend\Hydrator\DelegatingHydrator
::
class
),
new
\App\Entity\Site
())
),
$container
->
get
(
\Zend\Hydrator\DelegatingHydrator
::
class
),
$container
->
get
(
\Monolog\Logger
::
class
)
);
},
\App\Model\Zones
::
class
=>
function
(
ContainerInterface
$container
)
{
return
new
\App\Model\Zones
(
new
Zend\Db\TableGateway\TableGateway
(
'zones'
,
$container
->
get
(
Zend\Db\Adapter\Adapter
::
class
),
new
\Zend\Db\TableGateway\Feature\MetadataFeature
(),
new
\Zend\Db\ResultSet\HydratingResultSet
(
$container
->
get
(
\Zend\Hydrator\DelegatingHydrator
::
class
),
new
\App\Entity\Zone
())
),
$container
->
get
(
\Zend\Hydrator\DelegatingHydrator
::
class
),
$container
->
get
(
\Monolog\Logger
::
class
)
);
},
\App\Model\Providers
::
class
=>
function
(
ContainerInterface
$container
)
{
return
new
\App\Model\Providers
(
new
Zend\Db\TableGateway\TableGateway
(
'providers'
,
$container
->
get
(
Zend\Db\Adapter\Adapter
::
class
),
new
\Zend\Db\TableGateway\Feature\MetadataFeature
(),
new
\Zend\Db\ResultSet\HydratingResultSet
(
$container
->
get
(
\Zend\Hydrator\DelegatingHydrator
::
class
),
new
\App\Entity\Provider
())
),
$container
->
get
(
\Zend\Hydrator\DelegatingHydrator
::
class
),
$container
->
get
(
\Monolog\Logger
::
class
)
);
},
\App\Model\ProvidersDomains
::
class
=>
function
(
ContainerInterface
$container
)
{
return
new
\App\Model\ProvidersDomains
(
new
Zend\Db\TableGateway\TableGateway
(
'providers_domains'
,
$container
->
get
(
Zend\Db\Adapter\Adapter
::
class
),
new
\Zend\Db\TableGateway\Feature\MetadataFeature
(),
new
\Zend\Db\ResultSet\HydratingResultSet
(
$container
->
get
(
\Zend\Hydrator\DelegatingHydrator
::
class
),
new
\App\Entity\ProviderDomain
())
),
$container
->
get
(
\Zend\Hydrator\DelegatingHydrator
::
class
),
$container
->
get
(
\Monolog\Logger
::
class
)
);
},
\App\Model\Codes
::
class
=>
function
(
ContainerInterface
$container
)
{
return
new
\App\Model\Codes
(
new
Zend\Db\TableGateway\TableGateway
(
'codes'
,
$container
->
get
(
Zend\Db\Adapter\Adapter
::
class
),
new
\Zend\Db\TableGateway\Feature\MetadataFeature
(),
new
\Zend\Db\ResultSet\HydratingResultSet
(
$container
->
get
(
\Zend\Hydrator\DelegatingHydrator
::
class
),
new
\App\Entity\Code
())
),
$container
->
get
(
\Zend\Hydrator\DelegatingHydrator
::
class
),
$container
->
get
(
\Monolog\Logger
::
class
)
);
},
\App\Model\ZonesAdditions
::
class
=>
function
(
ContainerInterface
$container
)
{
return
new
\App\Model\ZonesAdditions
(
new
Zend\Db\TableGateway\TableGateway
(
'zones_additions'
,
$container
->
get
(
Zend\Db\Adapter\Adapter
::
class
),
new
\Zend\Db\TableGateway\Feature\MetadataFeature
(),
new
\Zend\Db\ResultSet\HydratingResultSet
(
$container
->
get
(
\Zend\Hydrator\DelegatingHydrator
::
class
),
new
\App\Entity\ZoneAddition
())
),
$container
->
get
(
\Zend\Hydrator\DelegatingHydrator
::
class
),
$container
->
get
(
\Monolog\Logger
::
class
)
);
},
\App\Model\Slots
::
class
=>
function
(
ContainerInterface
$container
)
{
return
new
\App\Model\Slots
(
new
Zend\Db\TableGateway\TableGateway
(
'slots'
,
$container
->
get
(
Zend\Db\Adapter\Adapter
::
class
),
new
\Zend\Db\TableGateway\Feature\MetadataFeature
(),
new
\Zend\Db\ResultSet\HydratingResultSet
(
$container
->
get
(
\Zend\Hydrator\DelegatingHydrator
::
class
),
new
\App\Entity\Slot
())
),
$container
->
get
(
\Zend\Hydrator\DelegatingHydrator
::
class
),
$container
->
get
(
\Monolog\Logger
::
class
)
);
},
\App\Model\RtbParams
::
class
=>
function
(
ContainerInterface
$container
)
{
return
new
\App\Model\RtbParams
(
new
Zend\Db\TableGateway\TableGateway
(
'rtb_params'
,
$container
->
get
(
Zend\Db\Adapter\Adapter
::
class
),
new
\Zend\Db\TableGateway\Feature\MetadataFeature
(),
new
\Zend\Db\ResultSet\HydratingResultSet
(
$container
->
get
(
\Zend\Hydrator\DelegatingHydrator
::
class
),
new
\App\Entity\RtbParam
())
),
$container
->
get
(
\Zend\Hydrator\DelegatingHydrator
::
class
),
$container
->
get
(
\Monolog\Logger
::
class
)
);
},
\App\Model\Feeds\Feeds
::
class
=>
function
(
ContainerInterface
$container
)
{
return
new
\App\Model\Feeds\Feeds
(
new
Zend\Db\TableGateway\TableGateway
(
...
...
src/config/autoload/routes.global.php
View file @
55f619f4
...
...
@@ -43,13 +43,7 @@ return [
$container
);
},
App\Action\Examples
::
class
=>
function
(
ContainerInterface
$container
)
{
return
new
App\Action\Examples
(
$container
->
get
(
\Zend\Expressive\Router\RouterInterface
::
class
),
$container
->
get
(
\Zend\Expressive\Template\TemplateRendererInterface
::
class
),
$container
);
},
App\Action\FAQ
::
class
=>
function
(
ContainerInterface
$container
)
{
return
new
App\Action\FAQ
(
$container
->
get
(
\Zend\Expressive\Router\RouterInterface
::
class
),
...
...
@@ -64,13 +58,6 @@ return [
$container
);
},
App\Action\User\Codestat
::
class
=>
function
(
ContainerInterface
$container
)
{
return
new
App\Action\User\Codestat
(
$container
->
get
(
\Zend\Expressive\Router\RouterInterface
::
class
),
$container
->
get
(
\Zend\Expressive\Template\TemplateRendererInterface
::
class
),
$container
);
},
App\Action\User\Profile
::
class
=>
function
(
ContainerInterface
$container
)
{
return
new
App\Action\User\Profile
(
$container
->
get
(
\Zend\Expressive\Router\RouterInterface
::
class
),
...
...
@@ -288,20 +275,6 @@ return [
]
],
],
[
'name'
=>
'examples'
,
'path'
=>
'/[:lang/]examples/'
,
'middleware'
=>
App\Action\Examples
::
class
,
'allowed_methods'
=>
[
'GET'
],
'options'
=>
[
'constraints'
=>
[
'lang'
=>
'[a-z]{2,3}'
,
],
'defaults'
=>
[
'lang'
=>
\App\Model\Locales
::
DEFAULT_LANG
,
]
],
],
[
'name'
=>
'faq'
,
'path'
=>
'/[:lang/]faq/'
,
...
...
@@ -333,21 +306,6 @@ return [
]
],
],
[
'name'
=>
'codestat'
,
'path'
=>
'/[:lang/]codestat/:provider'
,
'middleware'
=>
App\Action\User\Codestat
::
class
,
'allowed_methods'
=>
[
'POST'
,
'GET'
],
'options'
=>
[
'constraints'
=>
[
'lang'
=>
'[a-z]{2,3}'
,
'provider'
=>
'\w+'
,
],
'defaults'
=>
[
'lang'
=>
\App\Model\Locales
::
DEFAULT_LANG
,
]
],
],
[
'name'
=>
'user.cabinet.profile'
,
'path'
=>
'/[:lang/]cabinet/profile/'
,
...
...
@@ -376,54 +334,7 @@ return [
]
],
],
[
'name'
=>
'common.blog'
,
'path'
=>
'/[:lang/]blog/list/[:tag]'
,
'middleware'
=>
App\Action\Blog
::
class
,
'allowed_methods'
=>
[
'GET'
],
'options'
=>
[
'constraints'
=>
[
'lang'
=>
'[a-z]{2,3}'
,
],
'defaults'
=>
[
'lang'
=>
\App\Model\Locales
::
DEFAULT_LANG
,
'action'
=>
\App\Action\Blog
::
ACTION_LIST
,
'tag'
=>
''
,
]
],
],
[
'name'
=>
'common.blog.article'
,
'path'
=>
'/[:lang/]blog/:article'
,
'middleware'
=>
App\Action\Blog
::
class
,
'allowed_methods'
=>
[
'POST'
,
'GET'
],
'options'
=>
[
'constraints'
=>
[
'lang'
=>
'[a-z]{2,3}'
,
'article'
=>
'\d+'
,
],
'defaults'
=>
[
'lang'
=>
\App\Model\Locales
::
DEFAULT_LANG
,
'action'
=>
\App\Action\Blog
::
ACTION_ARTICLE
,
]
],
],
[
'name'
=>
'common.blog.json'
,
'path'
=>
'/[:lang/]blog/list/:format/[:tag]'
,
'middleware'
=>
App\Action\Blog
::
class
,
'allowed_methods'
=>
[
'POST'
],
'options'
=>
[
'constraints'
=>
[
'lang'
=>
'[a-z]{2,3}'
,
],
'defaults'
=>
[
'lang'
=>
\App\Model\Locales
::
DEFAULT_LANG
,
'action'
=>
\App\Action\Blog
::
ACTION_LIST
,
'format'
=>
\App\Action\Blog
::
FORMAT_JSON
,
]
],
],
[
'name'
=>
'download.counter'
,
'path'
=>
'/[:lang/]download-counter/[:siteId]'
,
...
...
@@ -468,36 +379,5 @@ return [
]
],
],
[
'name'
=>
'site.add'
,
'path'
=>
'/[:lang/]site-add/'
,
'middleware'
=>
App\Action\Site
::
class
,
'allowed_methods'
=>
[
'GET'
,
'POST'
],
'options'
=>
[
'constraints'
=>
[
'lang'
=>
'[a-z]{2,3}'
,
],
'defaults'
=>
[
'lang'
=>
\App\Model\Locales
::
DEFAULT_LANG
,
'method'
=>
App\Action\Site
::
ADD
,
]
],
],
[
'name'
=>
'site.remove'
,
'path'
=>
'/[:lang/]site-remove/:id'
,
'middleware'
=>
App\Action\Site
::
class
,
'allowed_methods'
=>
[
'GET'
,
'POST'
],
'options'
=>
[
'constraints'
=>
[
'lang'
=>
'[a-z]{2,3}'
,
// 'id' => '\d+',
],
'defaults'
=>
[
'lang'
=>
\App\Model\Locales
::
DEFAULT_LANG
,
'method'
=>
App\Action\Site
::
REMOVE
,
]
],
],
],
];
src/public/js/script-codestat.js
deleted
100644 → 0
View file @
9b2d5f7d
$
(
document
).
ready
(
function
(){
Number
.
prototype
.
formatMoney
=
function
(
c
,
d
,
t
){
var
n
=
this
,
c
=
isNaN
(
c
=
Math
.
abs
(
c
))
?
2
:
c
,
d
=
d
==
undefined
?
"."
:
d
,
t
=
t
==
undefined
?
","
:
t
,
s
=
n
<
0
?
"-"
:
""
,
i
=
String
(
parseInt
(
n
=
Math
.
abs
(
Number
(
n
)
||
0
).
toFixed
(
c
))),
j
=
(
j
=
i
.
length
)
>
3
?
j
%
3
:
0
;
return
s
+
(
j
?
i
.
substr
(
0
,
j
)
+
t
:
""
)
+
i
.
substr
(
j
).
replace
(
/
(\d{3})(?=\d)
/g
,
"$1"
+
t
)
+
(
c
?
d
+
Math
.
abs
(
n
-
i
).
toFixed
(
c
).
slice
(
2
)
:
""
);
};
// Добавление впереди 0 у однозначных значений
function
pad
(
number
)
{
var
r
=
String
(
number
);
if
(
r
.
length
===
1
)
{
r
=
'0'
+
r
;
}
return
r
;
}
// Форматирование даты
function
formatDate
(
date
)
{
return
date
.
getUTCFullYear
()
+
'-'
+
pad
(
date
.
getMonth
()
+
1
)
+
'-'
+
pad
(
date
.
getDate
());
}
function
formatPercent
(
value
)
{
return
(
value
*
100
).
toFixed
(
2
);
}
function
createDropDown
(
$element
,
onselect
,
oncreate
)
{
var
$current
=
$element
.
find
(
'.droplist-current'
);
$current
.
on
(
'click focus'
,
function
(
e
,
t
){
var
$this
=
$
(
this
);
var
$thisList
=
$this
.
siblings
().
filter
(
'.droplist-block'
);
var
$dropList
=
$thisList
;
var
sumListEl
=
$thisList
.
children
().
length
;
var
heightList
=
$thisList
[
0
].
clientHeight
;
if
(
$dropList
.
hasClass
(
'm-open-droplist'
))
{
$
(
'.m-open-droplist'
).
removeClass
(
'm-open-droplist'
);
}
else
{
$
(
'.m-open-droplist'
).
removeClass
(
'm-open-droplist'
);
$dropList
.
addClass
(
'm-open-droplist'
);
$this
.
addClass
(
'm-open-droplist'
);
}
e
.
stopPropagation
();
return
false
;
});
var
$list
=
$element
.
find
(
'.droplist-item'
);
if
(
$list
.
length
>
0
)
{
$current
.
html
(
$list
.
first
().
html
());
if
(
typeof
oncreate
==
'function'
)
{
oncreate
(
$list
.
first
(),
$current
);
}
}
$list
.
on
(
'click'
,
function
()
{
var
$this
=
$
(
this
);
var
selectStr
=
$
(
this
).
html
();
$
(
this
).
parent
().
siblings
().
filter
(
'.droplist-current'
).
html
(
selectStr
);
$
(
'.m-open-droplist'
).
removeClass
(
'm-open-droplist'
);
if
(
typeof
onselect
==
'function'
)
{
onselect
(
$this
,
$current
);
}
return
false
;
});
}
var
domainsListSelector
=
'#domains-list'
;
var
domainClassSelected
=
'domain-selected'
;
var
subDomainClassSelected
=
'sub-domain-selected'
;
var
subDomainStateSelected
=
'state-selected'
;
function
selectedDomainsAll
()
{
var
$domainsList
=
$
(
domainsListSelector
),
selectedDomains
=
[],
subdomains
=
1
,
count
=
$domainsList
.
find
(
'.main-domain'
).
length
,
idDomains
=
[],
$mainDomains
=
$domainsList
.
find
(
'.main-domain'
+
'.'
+
domainClassSelected
);
// Выбрано несколько основных доменов
if
(
$mainDomains
.
length
>
1
)
{
$mainDomains
.
each
(
function
(){
selectedDomains
.
push
(
$
(
this
).
data
(
'domain'
));
idDomains
.
push
(
$
(
this
).
data
(
'siteid'
));
});
}
// Выбран один основной домен
else
{
var
mainDomainTitle
=
$mainDomains
.
data
(
'domain'
),
mainDomainId
=
$mainDomains
.
data
(
'siteid'
);
// Выбран основной домен
if
(
selectedDomains
.
length
==
0
)
{
selectedDomains
.
push
(
mainDomainTitle
);
idDomains
.
push
(
mainDomainId
);
}
}
return
{
'domains'
:
selectedDomains
,
'subdomains'
:
subdomains
,
'count'
:
count
,
'ids'
:
idDomains
};
}
// Создание дров дауны и список сайтов
$
(
'.b-filter__switch'
).
each
(
function
(
index
,
el
){
if
(
!
$
(
el
).
find
(
'.b-filter__switch-item'
).
hasClass
(
'm-filter__switch-item_active'
))
{
$
(
el
).
find
(
'.b-filter__switch-item'
).
eq
(
0
).
trigger
(
'click'
);
}
});
$
(
'.b-content__site-droplist .droplist-item'
).
each
(
function
(
index
,
el
){
if
(
$
(
el
).
attr
(
'data-src-icon-site'
)){
var
srcIcon
=
$
(
el
).
attr
(
'data-src-icon-site'
);
$
(
this
).
css
({
'background-image'
:
'url('
+
srcIcon
+
')'
});
}
});
// Список доменов
var
$domainsList
=
$
(
domainsListSelector
);
$domainsList
.
find
(
'.main-domain'
).
each
(
function
(){
$
(
this
).
addClass
(
domainClassSelected
);
});
// Клик по основному домену
$domainsList
.
find
(
'.main-domain'
).
click
(
function
()
{
var
$this
=
$
(
this
);
console
.
log
(
'AAA Клик по основному домену '
,
$this
.
data
(
'id'
));
var
type
=
$
(
'#sites-dropdown'
).
find
(
'.droplist-current'
).
data
(
'id'
);
console
.
log
(
'AAA Клик по основному домену type = '
,
type
);
if
(
type
==
'all'
)
{
// Отрображался список всех доменов
var
domainId
=
$
(
this
).
data
(
'id'
);
$
(
'#sites-dropdown .droplist-item'
).
each
(
function
(){
if
(
$
(
this
).
data
(
'id'
)
==
domainId
)
{
$
(
this
).
click
();
}
return
;
});
return
false
;
}
else
{
// Отрображался список поддоменов одного домена
$
(
this
).
parent
().
find
(
'.sub-domain'
).
removeClass
(
subDomainClassSelected
);
$
(
this
).
parent
().
find
(
'.sub-domain'
).
removeClass
(
subDomainStateSelected
);
}
$domainsList
.
trigger
(
'select-domain'
);
return
false
;
});
// Закрыть дропдаун по клику на странице
$
(
document
).
on
(
'click'
,
function
()
{
$
(
'.m-open-droplist'
).
removeClass
(
'm-open-droplist'
);
});
// Дропдаун списка доменов:
createDropDown
(
$
(
'#sites-dropdown'
),
function
(
$element
,
$current
)
{
//console.log('AAA Клик по домену из выпадающего списка');
var
attrSrcIcon
=
$element
.
attr
(
'data-src-icon-site'
);
// иконка выбранного сайта
var
attrSiteId
=
$element
.
attr
(
'data-id'
);
// id выбранного сайта
$current
.
data
(
'id'
,
attrSiteId
);
$current
.
css
({
'background-image'
:
'url('
+
attrSrcIcon
+
')'
}).
attr
(
'data-id'
,
attrSiteId
);
// Инициируем запрос по соответствующему домену в списке:
var
$leftItem
=
$
(
'.b-content__losses-left-item'
);
var
$allDomains
=
$
(
'.all-domains'
);
// Перебираем домены в списке:
$domainsList
.
find
(
'.main-domain'
).
each
(
function
()
{
var
relDomain
=
$
(
this
).
data
(
'domain'
);
if
(
attrSiteId
==
'all'
)
{
$
(
this
).
addClass
(
'domain-selected'
).
removeClass
(
'font-bold'
);
$
(
this
).
parent
().
show
();
$
(
this
).
parent
().
find
(
'.sub-list'
).
hide
();
$leftItem
.
removeClass
(
'state-subdomains'
);
//$(this).parent().find('.sub-domain').addClass(subDomainClassSelected);
}
else
if
(
relDomain
!=
attrSiteId
)
{
$
(
this
).
removeClass
(
'domain-selected'
).
removeClass
(
'font-bold'
);
$
(
this
).
parent
().
hide
();
$
(
this
).
parent
().
find
(
'.sub-domain'
).
removeClass
(
subDomainClassSelected
);
}
else
if
(
relDomain
==
attrSiteId
)
{
$
(
this
).
addClass
(
'domain-selected'
).
addClass
(
'font-bold'
);
$
(
this
).
parent
().
show
();
$
(
this
).
parent
().
find
(
'.sub-list'
).
show
();
$leftItem
.
addClass
(
'state-subdomains'
);
//$(this).parent().find('.sub-domain').addClass(subDomainClassSelected);
}
});
// Отображение ссылки "Все сайты":
if
(
attrSiteId
==
'all'
)
{
$allDomains
.
hide
();
}
else
{
$allDomains
.
show
();
}
$domainsList
.
trigger
(
'select-domain'
);
},
function
(
$element
,
$current
)
{
$current
.
data
(
'id'
,
$element
.
data
(
'id'
));
});
// Создание отчета и графика с таблицами
// Загрузка данных через 15 мин
/*
var timeOut = 1000*60*5;
var loadData = setTimeout(function runLoad() {
loadDataSummuryReport();
loadDataLineChart();
setTimeout(runLoad, timeOut);
}, timeOut);
*/
// Массив данных по суммарному таблице
var
linkSummaryReport
=
'/statistics/'
;
var
selectorSummaryReport
=
'#summary-report-table'
;
var
dataSummaryReport
=
false
;
if
(
$
(
'#summary-report-stats'
).
val
())
{
dataSummaryReport
=
JSON
.
parse
(
$
(
'#summary-report-stats'
).
val
());
}
// Массив данных по линейным диаграммам
var
selectorGraphChart
=
'#chart-graph'
;
var
dataLineChart
=
false
;
if
(
$
(
'#period-stats'
).
val
())
{
dataLineChart
=
JSON
.
parse
(
$
(
'#period-stats'
).
val
());
addDataFields
(
dataLineChart
);
}
// Подсвечиваем нужный график
var
fullSwitchSelector
=
'.b-filter__switch.display.full .b-filter__switch-item'
,
shortSwitchSelector
=
'.b-filter__switch.display.short .b-filter__switch-item'
,
classActive
=
'm-filter__switch-item_active'
,
cookieName
=
'active_graph'
;
if
(
$
.
cookie
(
cookieName
))
{
var
activeSwitch
=
$
.
cookie
(
cookieName
);
// Подсвечиваем полный список
if
(
$
(
fullSwitchSelector
+
'[data-filter-category='
+
activeSwitch
+
']'
).
length
>
0
)
{
$
(
fullSwitchSelector
+
'[data-filter-category='
+
activeSwitch
+
']'
).
addClass
(
classActive
);
}
else
{
$
(
fullSwitchSelector
+
':first'
).
addClass
(
classActive
);
}
// Подсвечиваем краткий список
if
(
$
(
shortSwitchSelector
+
'[data-filter-category='
+
activeSwitch
+
']'
).
length
>
0
)
{
$
(
shortSwitchSelector
+
'[data-filter-category='
+
activeSwitch
+
']'
).
addClass
(
classActive
);
}
else
{
$
(
shortSwitchSelector
+
':first'
).
addClass
(
classActive
);
}
}
else
{
$
(
shortSwitchSelector
+
':first'
).
addClass
(
classActive
);
$
(
fullSwitchSelector
+
':first'
).
addClass
(
classActive
);
var
activeSwitch
=
$
(
'.b-filter__switch.current .m-filter__switch-item_active'
).
data
(
'filter-category'
);
$
.
cookie
(
cookieName
,
activeSwitch
);
}
// Переключение между графиками
$
(
'.b-filter__switch-item'
).
click
(
function
(){
$
(
this
).
siblings
().
removeClass
(
classActive
);
$
(
this
).
addClass
(
classActive
);
// Переключение таблиц для админа
if
(
$
(
this
).
parent
().
hasClass
(
'time-table'
))
{
if
(
$
(
this
).
data
(
'filter-category'
)
==
'sites'
)
{
$
(
'#table-line'
).
hide
();
$
(
'#table-sites'
).
show
();
$
(
'.time-table-sort'
).
show
();
}
else
{
$
(
'#table-sites'
).
hide
();
$
(
'#table-line'
).
show
();
$
(
'.time-table-sort'
).
hide
();
}
}
else
{
activeLine
=
$
(
this
).
data
(
'filter-category'
);
$
.
cookie
(
cookieName
,
activeLine
);
$
(
selectorGraphChart
).
trigger
(
'render-chart'
);
}
return
false
;
});
var
activeLine
=
$
(
'.b-filter__switch.current .m-filter__switch-item_active'
).
data
(
'filter-category'
);
// Выбор периода-месяца
//console.log('AAA выбор периода:');
var
chartDateSelector
=
'#daterange-dropdown'
;
createDropDown
(
$
(
chartDateSelector
),
function
(
$element
,
$current
)
{
$current
.
data
(
'date-value'
,
$element
.
data
(
'date-value'
));
$
(
selectorGraphChart
).
trigger
(
'reload-chart'
);
},
function
(
$element
,
$current
){
$current
.
data
(
'date-value'
,
$element
.
data
(
'date-value'
));
});
// Ссылка на .json файлы данных категории для отображения данных в линейном графике
var
linkLinerChart
=
'/statistics/'
;
// Стартовая загрузка графиков / перерисовка при изменении размера экрана
$
(
window
).
on
(
'resize orientationchange'
,
function
()
{
loadDataLineChart
();
});
var
$loadingSummary
=
$
(
'.b-content__loading.summary'
),
$loadingChart
=
$
(
'.b-content__loading.chart'
),
$loadingTable
=
$
(
'.b-content__loading.table'
);
// Загрузка данных сводной таблицы
var
loadDataSummuryReportBusy
=
false
;
function
loadDataSummuryReport
()
{
if
(
loadDataSummuryReportBusy
)
{
return
;
}
var
selectedSitesId
=
selectedDomainsAll
().
ids
,
codes
=
[
$
(
'#period-stats'
).
data
(
'codeprovider'
)];
loadDataSummuryReportBusy
=
true
;
$loadingSummary
.
show
();
$
.
ajax
(
linkSummaryReport
,
{
method
:
'POST'
,
data
:
{
action
:
'codestatglobal'
,
sites
:
selectedSitesId
,
codes
:
codes
,
},
success
:
function
(
res
){
//console.log("AAA loadDataSummuryReport success res: ", res);
dataSummaryReport
=
res
;
renderSummaryReport
();
loadDataSummuryReportBusy
=
false
;
$loadingSummary
.
hide
();
},
error
:
function
(
req
,
status
,
err
)
{
console
.
log
(
"Error "
+
req
,
status
,
err
);
loadDataSummuryReportBusy
=
false
;
$loadingSummary
.
hide
();
}
});
}
// Отрисовка и загрузка данных линейного графика
var
loadDataLineChartBusy
=
false
;
function
loadDataLineChart
()
{
//console.log('AAA loadDataLineChart');
if
(
loadDataLineChartBusy
)
{
return
;
}
var
selectedSitesId
=
selectedDomainsAll
().
ids
,
codes
=
[
$
(
'#period-stats'
).
data
(
'codeprovider'
)],
chartDate
=
$
(
chartDateSelector
).
find
(
'.droplist-current'
).
data
(
'date-value'
);
var
reqData
=
{
action
:
'codestat'
,
sites
:
selectedSitesId
,
codes
:
codes
,
month
:
chartDate
,
};
loadDataLineChartBusy
=
true
;
$loadingChart
.
show
();
$loadingTable
.
show
();
$
.
ajax
(
linkLinerChart
,
{
type
:
'POST'
,
dataType
:
'json'
,
data
:
reqData
,
success
:
function
(
res
)
{
//console.log("success ", res);
loadDataLineChartBusy
=
false
;
dataLineChart
=
res
;
addDataFields
(
dataLineChart
);
renderLineChart
();
renderLineTable
();
$loadingChart
.
hide
();
$loadingTable
.
hide
();
},
error
:
function
(
req
,
status
,
err
)
{
console
.
log
(
"Error "
+
req
,
status
,
err
);
loadDataLineChartBusy
=
false
;
$loadingChart
.
hide
();
$loadingTable
.
hide
();
}
});
};
// Отрисовка сводной таблицы
function
renderSummaryReport
()
{
if
(
!
dataSummaryReport
||
dataSummaryReport
.
length
==
0
)
{
$
(
'.b-content__no-data'
).
show
();
$
(
'#summary-report-table'
).
hide
();
}
else
{
$
(
'.b-content__no-data'
).
hide
();
$
(
'#summary-report-table'
).
show
();
}
var
domains
=
selectedDomainsAll
().
domains
;
var
reportData
=
{
views
:
{
today
:
0
,
yesterday
:
0
,
'30days'
:
0
,
cur_month
:
0
,
prev_month
:
0
},
clicks
:
{
today
:
0
,
yesterday
:
0
,
'30days'
:
0
,
cur_month
:
0
,
prev_month
:
0
},
ctr
:
{
today
:
0
,
yesterday
:
0
,
'30days'
:
0
,
cur_month
:
0
,
prev_month
:
0
},
};
var
$summaryTable
=
$
(
selectorSummaryReport
);
$summaryTable
.
removeClass
(
'full'
).
addClass
(
'short'
);
if
(
domains
&&
dataSummaryReport
)
{
for
(
var
periodKey
in
dataSummaryReport
)
{
if
(
!
reportData
.
views
[
periodKey
])
{
reportData
.
views
[
periodKey
]
=
0
;
}
if
(
!
reportData
.
clicks
[
periodKey
])
{
reportData
.
clicks
[
periodKey
]
=
0
;
}
if
(
!
reportData
.
ctr
[
periodKey
])
{
reportData
.
ctr
[
periodKey
]
=
0
;
}
if
(
dataSummaryReport
[
periodKey
].
views
)
{
reportData
.
views
[
periodKey
]
=
dataSummaryReport
[
periodKey
].
views
;
}
if
(
dataSummaryReport
[
periodKey
].
clicks
)
{
reportData
.
clicks
[
periodKey
]
=
dataSummaryReport
[
periodKey
].
clicks
;
}
if
(
dataSummaryReport
[
periodKey
].
ctr
)
{
reportData
.
ctr
[
periodKey
]
=
dataSummaryReport
[
periodKey
].
ctr
;
}
}
}
var
$tableData
=
$
(
'<table>'
).
html
(
$
(
selectorSummaryReport
).
html
());
for
(
var
type
in
reportData
)
{
for
(
var
period
in
reportData
[
type
])
{
var
key
=
'#summary-'
+
period
+
'-'
+
type
;
var
value
=
reportData
[
type
][
period
];
if
(
type
==
'views'
)
{
value
=
value
.
formatMoney
(
0
);
}
if
(
type
==
'clicks'
)
{
value
=
value
.
formatMoney
(
0
);
}
if
(
type
==
'ctr'
)
{
value
=
formatPercent
(
value
);
}
$tableData
.
find
(
key
).
html
(
value
);
}
}
$
(
selectorSummaryReport
).
html
(
$tableData
.
html
());
}
// Отрисовка графика
function
renderLineChart
()
{
//console.log('AAA dataLineChart: ', dataLineChart);
if
(
dataLineChart
)
{
// Выбираем набор переключалок графиков для отображения
var
$fullSwitchBlock
=
$
(
'.b-filter__switch.display.full'
);
var
$shortSwitchBlock
=
$
(
'.b-filter__switch.display.short'
);
// Показываем список переключалок
$fullSwitchBlock
.
removeClass
(
'current'
);
$shortSwitchBlock
.
addClass
(
'current'
);
$fullSwitchBlock
.
hide
();
$shortSwitchBlock
.
show
();
// Отрисовываем график библиотекой c3.js
var
dataName
=
$
(
'.b-filter__switch.display.current .b-filter__switch-item.m-filter__switch-item_active'
).
html
();
var
activeLine
=
$
(
'.b-filter__switch.display.current .b-filter__switch-item.m-filter__switch-item_active'
).
data
(
'filter-category'
);
var
currencySymbol
=
' '
+
$
(
'.b-content__site-currency .droplist-current'
).
data
(
'symbol'
);
//console.log('AAA activeLine: ', activeLine);
var
dataColumns
=
[
[
'x'
].
concat
(
dataLineChart
[
'period'
]),
[
'data1'
].
concat
(
dataLineChart
[
activeLine
]),
];
var
dataNames
=
{
data1
:
dataName
}
var
colors
=
{
data1
:
'#2ca02c'
,
data2
:
'#ff0000'
};
var
valueFormat
=
function
(
value
,
ratio
,
id
)
{
var
currencyFields
=
[
'money'
,
'block_money'
,
'total'
,
'return'
];
var
isCurrencyValue
=
currencyFields
.
indexOf
(
activeLine
)
>=
0
;
var
format
=
(
isCurrencyValue
)
?
d3
.
format
(
',.2f'
)
:
d3
.
format
(
','
);
return
(
isCurrencyValue
)
?
format
(
value
)
+
currencySymbol
:
format
(
value
);
};
axisY1format
=
function
(
d
)
{
var
currencyFields
=
[
'money'
,
'block_money'
,
'total'
,
'return'
];
var
isCurrencyValue
=
currencyFields
.
indexOf
(
activeLine
)
>=
0
;
var
format
=
(
isCurrencyValue
)
?
d3
.
format
(
',.0f'
)
:
d3
.
format
(
','
);
return
(
isCurrencyValue
)
?
format
(
d
)
+
currencySymbol
:
format
(
d
);
}
var
axisY2format
=
function
(
d
)
{
return
d
;
}
var
paddingAxisX
=
{
left
:
0
};
var
showLegend
=
false
;
var
y2Show
=
false
;
if
(
activeLine
==
'ctr'
)
{
axisY1format
=
function
(
d
)
{
var
format
=
d3
.
format
(
".2%"
);
return
format
(
d
);
}
valueFormat
=
function
(
value
,
ratio
,
id
)
{
var
format
=
d3
.
format
(
".2%"
);
return
format
(
value
);
};
}
else
{
dataColumns
=
[
[
'x'
].
concat
(
dataLineChart
[
'period'
]),
[
'data1'
].
concat
(
dataLineChart
[
activeLine
]),
];
dataNames
=
{
data1
:
dataName
};
}
var
chart
=
c3
.
generate
({
bindto
:
'#chart-graph'
,
data
:
{
x
:
'x'
,
columns
:
dataColumns
,
names
:
dataNames
,
types
:
{
data1
:
'area-spline'
,
data2
:
'area-spline'
,
data3
:
'area-spline'
},
colors
:
colors
,
axes
:
{
data1
:
'y'
,
data2
:
'y2'
,
data3
:
'y2'
}
},
axis
:
{
x
:
{
type
:
'timeseries'
,
padding
:
paddingAxisX
,
tick
:
{
culling
:
{
max
:
31
},
format
:
'%d'
}
},
y
:
{
min
:
0
,
padding
:
{
top
:
50
,
bottom
:
0
},
tick
:
{
format
:
axisY1format
},
},
y2
:
{
padding
:
{
top
:
150
,
bottom
:
0
},
tick
:
{
format
:
axisY2format
},
show
:
y2Show
}
},
grid
:
{
x
:
{
show
:
true
},
y
:
{
show
:
true
},
},
tooltip
:
{
format
:
{
title
:
function
(
d
)
{
return
formatDate
(
d
);
},
value
:
valueFormat
}
},
legend
:
{
show
:
showLegend
},
});
$
(
'#b-content__traffic-chart'
).
show
();
}
else
{
$
(
'#b-content__traffic-chart'
).
hide
();
}
}
// Отрисовка месячной таблицы
function
renderLineTable
()
{
//console.log('AAA renderLineTable ', dataLineChart);
if
(
dataLineChart
)
{
var
$table
=
$
(
'#table-line'
),
$tableContent
=
$
(
'<tbody>'
),
$tableBody
=
$table
.
find
(
'tbody'
).
first
(),
$tableFooter
=
$table
.
find
(
'tfoot'
).
first
();
var
summ_views
=
0
,
summ_clicks
=
0
,
summ_ctr
=
0
;
for
(
var
i
=
dataLineChart
[
'period'
].
length
-
1
;
i
>=
0
;
i
-=
1
)
{
var
date
=
dataLineChart
[
'period'
][
i
];
var
views
=
dataLineChart
[
'views'
][
i
];
var
clicks
=
dataLineChart
[
'clicks'
][
i
];
var
ctr
=
dataLineChart
[
'ctr'
][
i
];
summ_views
+=
views
;
summ_clicks
+=
clicks
;
$row
=
$
(
'<tr>'
);
$row
.
append
(
$
(
'<td>'
).
html
(
date
));
$row
.
append
(
$
(
'<td>'
).
html
(
views
.
formatMoney
(
0
)));
$row
.
append
(
$
(
'<td>'
).
html
(
clicks
.
formatMoney
(
0
)));
$row
.
append
(
$
(
'<td>'
).
html
(
formatPercent
(
ctr
)));
$row
.
appendTo
(
$tableContent
);
}
summ_ctr
=
(
summ_views
==
0
)
?
0
:
summ_clicks
/
summ_views
*
1
;
$tableBody
.
html
(
''
).
append
(
$tableContent
.
children
());
$tableFooter
.
find
(
'.summ-views'
).
html
(
summ_views
.
formatMoney
(
0
));
$tableFooter
.
find
(
'.summ-clicks'
).
html
(
summ_clicks
.
formatMoney
(
0
));
$tableFooter
.
find
(
'.summ-ctr'
).
html
(
formatPercent
(
summ_ctr
));
var
$lineTable
=
$
(
'#table-line'
);
$lineTable
.
removeClass
(
'full'
).
addClass
(
'short'
);
$
(
'#b-content__traffic-table'
).
show
();
}
else
{
$
(
'#b-content__traffic-table'
).
hide
();
}
}
// Добавление информационных полей в данных
function
addDataFields
(
data
)
{
}
//renderSummaryReport();
renderLineChart
();
$
(
selectorSummaryReport
).
on
(
'render-summary-report'
,
function
(){
loadDataSummuryReport
();
});
$domainsList
.
on
(
'select-domain'
,
function
(){
loadDataSummuryReport
();
loadDataLineChart
();
});
$
(
selectorGraphChart
).
on
(
'render-chart'
,
function
(){
renderLineChart
();
});
$
(
selectorGraphChart
).
on
(
'reload-chart'
,
function
(){
loadDataLineChart
();
});
// Клик на "Все сайты":
$
(
'.all-domains'
).
click
(
function
(){
var
$all
=
$
(
'li.droplist-item[data-id="all"]'
);
$all
.
click
();
return
false
;
});
});
\ No newline at end of file
src/src/App/Action/Blog.php
deleted
100644 → 0
View file @
9b2d5f7d
<?php
/**
* Copyright (c) 2016 Serhii Borodai <clarifying@gmail.com>.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*
*/
namespace
App\Action
;
use
App\Model\Articles
;
use
App\Model\Tags
;
use
Psr\Http\Message\ResponseInterface
;
use
Psr\Http\Message\ServerRequestInterface
;
use
Zend\Diactoros\Response\HtmlResponse
;
use
Zend\Diactoros\Response\JsonResponse
;
use
Zend\Http\Response
;
/**
* Class Blog
* @package App\Action
*/
class
Blog
extends
Common
{
const
ACTION_LIST
=
'blog article list'
;
const
ACTION_ARTICLE
=
'blog article'
;
const
FORMAT_JSON
=
'json'
;
/**
* @param ServerRequestInterface $request
* @param ResponseInterface $response
* @param callable|null $next
* @return ResponseInterface|HtmlResponse
* @throws \Exception
*/
function
__invoke
(
ServerRequestInterface
$request
,
ResponseInterface
$response
,
callable
$next
=
null
)
{
$this
->
initInfo
(
$request
);
switch
(
$request
->
getAttribute
(
'action'
))
{
case
self
::
ACTION_ARTICLE
:
$articleId
=
$request
->
getAttribute
(
'article'
);
if
(
$articleId
)
{
/** @var Articles $articlesModel */
$articlesModel
=
$this
->
container
->
get
(
Articles
::
class
);
$article
=
$articlesModel
->
findById
(
$articleId
);
if
(
$article
)
{
$response
=
new
HtmlResponse
(
$this
->
template
->
render
(
"app::blog-article"
,
[
'lang'
=>
$request
->
getAttribute
(
'layoutInfo'
)
->
getLang
(),
'article'
=>
$article
,
]));
}
else
{
$response
->
withStatus
(
Response
::
STATUS_CODE_404
);
}
}
else
{
$response
->
withStatus
(
Response
::
STATUS_CODE_404
);
}
break
;
case
self
::
ACTION_LIST
:
$page
=
$request
->
getParsedBody
()[
'page'
]
??
1
;
$tag
=
$request
->
getAttribute
(
'tag'
,
''
);
$perPage
=
$this
->
container
->
get
(
'config'
)[
'blog'
][
'articlesPerPage'
];
/** @var Articles $articlesModel */
$articlesModel
=
$this
->
container
->
get
(
Articles
::
class
);
/** @var Tags $tagsModel */
$tagsModel
=
$this
->
container
->
get
(
Tags
::
class
);
$data
=
$tag
?
$articlesModel
->
findLimitWithTag
([
Articles
::
PLACEHOLDER_LIMIT
=>
$perPage
,
Articles
::
PLACEHOLDER_OFFSET
=>
(
$page
-
1
)
*
$perPage
,
],
$tag
)
:
$articlesModel
->
findLimit
([
Articles
::
PLACEHOLDER_LIMIT
=>
$perPage
,
Articles
::
PLACEHOLDER_OFFSET
=>
(
$page
-
1
)
*
$perPage
,
]);
$totalArticles
=
$articlesModel
->
foundRows
();
$pageNumbers
=
ceil
(
$totalArticles
/
$perPage
);
$tags
=
$tagsModel
->
findAll
();
if
(
$request
->
getAttribute
(
'format'
)
==
self
::
FORMAT_JSON
)
{
$response
=
new
JsonResponse
([
'data'
=>
$data
,
'lang'
=>
$request
->
getAttribute
(
'layoutInfo'
)
->
getLang
(),
'pageNumbers'
=>
$pageNumbers
,
'currentPage'
=>
$page
,
'tag'
=>
$tag
,
'tags'
=>
$tags
,
]);
}
else
{
$response
=
new
HtmlResponse
(
$this
->
template
->
render
(
"app::blog-list"
,
[
'lang'
=>
$request
->
getAttribute
(
'layoutInfo'
)
->
getLang
(),
'pageNumbers'
=>
$pageNumbers
,
'currentPage'
=>
$page
,
'tag'
=>
$tag
,
'tags'
=>
$tags
,
]));
}
break
;
default
:
throw
new
\Exception
(
'Unknown blog action'
);
break
;
}
return
$response
;
}
}
\ No newline at end of file
src/src/App/Action/Examples.php
deleted
100644 → 0
View file @
9b2d5f7d
<?php
/**
* Copyright (c) 2016 Serhii Borodai <clarifying@gmail.com>.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*
*/
namespace
App\Action
;
use
Psr\Http\Message\ResponseInterface
;
use
Psr\Http\Message\ServerRequestInterface
;
use
Zend\Diactoros\Response\HtmlResponse
;
class
Examples
extends
Common
{
/**
* @param ServerRequestInterface $request
* @param ResponseInterface $response
* @param callable|null $next
* @return HtmlResponse
*/
function
__invoke
(
ServerRequestInterface
$request
,
ResponseInterface
$response
,
callable
$next
=
null
)
{
return
new
HtmlResponse
(
$this
->
template
->
render
(
'app::examples'
,
[]));
}
}
\ No newline at end of file
src/src/App/Action/Site.php
deleted
100644 → 0
View file @
9b2d5f7d
<?php
/**
* Copyright (c) 2016 Serhii Borodai <clarifying@gmail.com>.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*
*/
namespace
App\Action
;
use
App\Authentication\UserService
;
use
App\Model\Sites
;
use
Psr\Http\Message\ResponseInterface
;
use
Psr\Http\Message\ServerRequestInterface
;
use
Zend\Diactoros\Response\JsonResponse
;
use
Zend\Hydrator\DelegatingHydrator
;
use
Zend\Validator\Uri
;
/**
* Class Site
* @package App\Action
*/
class
Site
extends
Common
{
const
ADD
=
'add-site'
;
const
REMOVE
=
'remove-site'
;
/**
* @param ServerRequestInterface $request
* @param ResponseInterface $response
* @param callable|null $next
* @return JsonResponse
* @throws \Exception
*/
function
__invoke
(
ServerRequestInterface
$request
,
ResponseInterface
$response
,
callable
$next
=
null
)
{
$this
->
initInfo
(
$request
);
$method
=
$request
->
getAttribute
(
'method'
);
//@todo add validation
/** @var Sites $sites */
$sites
=
$this
->
container
->
get
(
Sites
::
class
);
/** @var UserService $auth */
$auth
=
$this
->
container
->
get
(
UserService
::
class
);
/** @var DelegatingHydrator $hydrator */
$hydrator
=
$this
->
container
->
get
(
DelegatingHydrator
::
class
);
$result
=
false
;
$msg
[
'text'
]
=
'Unknown error'
;
$redirect
=
false
;
switch
(
$method
)
{
case
self
::
ADD
:
$domain
=
$request
->
getParsedBody
()[
'site'
];
$site
=
$sites
->
findOne
([
'domain'
=>
$domain
]);
if
(
$site
)
{
$result
=
false
;
$msg
=
'Domain \''
.
$domain
.
'\' already registered'
;
}
else
{
$validator
=
new
Uri
();
if
(
$validator
->
isValid
(
$domain
))
{
$site
=
$hydrator
->
hydrate
([
'users_id'
=>
$auth
->
getIdentity
()
->
getId
(),
'domain'
=>
$domain
],
new
\App\Entity\Site
());
/** @noinspection PhpParamsInspection */
$result
=
(
bool
)
$sites
->
save
(
$site
);
if
(
$result
)
{
$msg
[
'text'
]
=
'Success'
;
$site
=
$sites
->
findOne
([
'domain'
=>
$domain
]);
if
(
!
$site
)
{
$site
=
new
\App\Entity\Site
();
}
$redirect
=
$this
->
router
->
generateUri
(
'install.counter'
,
[
'siteId'
=>
$site
->
getId
()]);
}
else
{
$msg
[
'text'
]
=
'DB error'
;
}
}
else
{
throw
new
\Exception
(
implode
(
PHP_EOL
,
$validator
->
getMessages
()));
}
}
break
;
case
self
::
REMOVE
:
$id
=
$request
->
getAttribute
(
'id'
);
$result
=
(
bool
)
$sites
->
delete
(
$id
,
$auth
->
getIdentity
()
->
getId
());
if
(
!
$result
)
{
$msg
[
'text'
]
=
'not deleted'
;
}
break
;
default
:
$result
=
false
;
break
;
}
$data
=
[
'result'
=>
$result
,
'msg'
=>
$msg
,
'redirect'
=>
$redirect
];
return
new
JsonResponse
(
$data
);
}
}
\ No newline at end of file
src/src/App/Action/Statistics.php
deleted
100644 → 0
View file @
9b2d5f7d
<?php
/**
* Copyright (c) 2016 Serhii Borodai <clarifying@gmail.com>.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*
*/
/**
* http api
*
* 1. summary report
* 2.
*
*
*
*
*
*
*
*
*
*
*/
namespace
App\Action
;
use
App\Authentication\UserService
;
use
App\Authentication\AggregateAuth
;
use
App\Model\Users
;
use
App\Model\Sites
;
use
Psr\Http\Message\ResponseInterface
;
use
Psr\Http\Message\ServerRequestInterface
;
use
Zend\Diactoros\Response\HtmlResponse
;
use
Zend\Diactoros\Response\JsonResponse
;
/**
* Class Statistics
* @package App\Action
*/
class
Statistics
extends
Common
{
const
ACTION_SUMMARY_REPORT
=
'summary'
;
const
ACTION_LINECHART_REPORT
=
'linechart'
;
const
ACTION_SUBDOMAINS_LIST
=
'subdomains'
;
const
ACTION_SITESSTAT_REPORT
=
'sitesstat'
;
const
ACTION_REPORT_LIST
=
[
'minstat'
,
'bidstat'
,
'pagestat'
,
'blockstat'
,
'winstat'
,
'ndspstat'
,
'providersblockstat'
];
const
ACTION_GEO_LIST
=
'geolist'
;
const
ACTION_SITES_LIST
=
'siteslist'
;
const
ACTION_ZONES_LIST
=
'zoneslist'
;
const
ACTION_CODESTAT_GLOBAL_REPORT
=
'codestatglobal'
;
const
ACTION_CODESTAT_REPORT
=
'codestat'
;
/**
* @param ServerRequestInterface $request
* @param ResponseInterface $response
* @param callable|null $next
* @return HtmlResponse
*/
function
__invoke
(
ServerRequestInterface
$request
,
ResponseInterface
$response
,
callable
$next
=
null
)
{
/** @var Sites $sitesModel */
$sitesModel
=
$this
->
container
->
get
(
Sites
::
class
);
/** @var UserService $auth */
$auth
=
$this
->
container
->
get
(
UserService
::
class
);
/** @var AggregateAuth $aggregateAuth */
$aggregateAuth
=
$this
->
container
->
get
(
AggregateAuth
::
class
);
/** @var Statistics $stats */
$stats
=
$this
->
container
->
get
(
\App\Model\Statistics
::
class
);
/** @var Users $usersModel */
$usersModel
=
$this
->
container
->
get
(
Users
::
class
);
$isAdmin
=
in_array
(
$aggregateAuth
->
getIdentity
()
->
getRoleId
(),
[
'admin'
]);
$isManager
=
(
$aggregateAuth
->
getIdentity
()
->
getRoleId
()
==
'manager'
);
$params
=
$request
->
getParsedBody
();
if
((
!
$isAdmin
&&
!
$isManager
)
||
$params
[
'userid'
])
{
// Список сайтов пользователей
$userId
=
(
$params
[
'userid'
])
?
$params
[
'userid'
]
:
$auth
->
getIdentity
()
->
getId
();
$user
=
$usersModel
->
findById
(
$userId
);
$currency
=
$user
->
getCurrencyCode
();
$listSites
=
$sitesModel
->
findByUserId
(
$userId
)
->
buffer
();
$listDomains
=
array
();
foreach
(
$listSites
as
$site
)
{
$listDomains
[]
=
$site
->
getDomain
();
// Добавляем в список алиасы:
if
(
$site
->
getAlias
())
{
$site_aliases
=
explode
(
","
,
$site
->
getAlias
());
foreach
(
$site_aliases
as
$site_alias
)
{
if
(
$site_alias
!=
$site
->
getDomain
())
{
$listDomains
[]
=
$site_alias
;
}
}
}
}
}
else
if
(
$isManager
)
{
// Список сайтов менеджера
$currency
=
(
isset
(
$_COOKIE
[
"adminCurrency"
]))
?
$_COOKIE
[
"adminCurrency"
]
:
'USD'
;
$manager_id
=
$aggregateAuth
->
getIdentity
()
->
getId
();
$manager_users
=
$usersModel
->
findBySupportId
(
$manager_id
);
$managerSites
=
$sitesModel
->
findByUserId
(
$manager_users
)
->
buffer
();
$listDomains
=
array
();
foreach
(
$managerSites
as
$site
)
{
if
(
!
in_array
(
$site
->
getDomain
(),
$listDomains
))
{
$listDomains
[]
=
$site
->
getDomain
();
}
}
/*
} else if ($params['managerid']) { // Список сайтов менеджера
$currency = (isset($_COOKIE["adminCurrency"])) ? $_COOKIE["adminCurrency"] : 'USD';
$listUsersId = $usersModel->findBySupportId($params['managerid']);
$listDomains = array();
$managerSites = $sitesModel->findByUserId($listUsersId)->buffer();
foreach($managerSites as $site) {
if (!in_array($site->getDomain(), $listDomains)) {
$listDomains[] = $site->getDomain();
}
}
*/
}
else
{
// Список сайтов админа
$currency
=
(
isset
(
$_COOKIE
[
"adminCurrency"
]))
?
$_COOKIE
[
"adminCurrency"
]
:
'USD'
;
$listDomains
=
array
();
$adminSites
=
$sitesModel
->
findAllSites
();
foreach
(
$adminSites
as
$site
)
{
$listDomains
[]
=
$site
;
}
}
$month
=
trim
(
$params
[
'month'
]);
if
(
!
preg_match
(
'/^\d{4,4}-\d{2,2}$/'
,
$month
))
{
$month
=
''
;
}
$sites
=
trim
(
$params
[
'domains'
]);
if
(
!
$sites
)
{
$sites
=
array
();
}
else
{
$sites
=
array_filter
(
array_map
(
'trim'
,
explode
(
','
,
$sites
)));
}
foreach
(
$sites
as
$i
=>
$requestSite
)
{
$is_valid
=
false
;
foreach
(
$listDomains
as
$validDomain
)
{
if
(
preg_match
(
'/'
.
$validDomain
.
'$/'
,
$requestSite
))
{
$is_valid
=
true
;
break
;
}
}
if
(
!
$is_valid
)
{
unset
(
$sites
[
$i
]);
}
}
$subdomains
=
trim
(
$params
[
'subdomains'
]);
$subdomains
=
(
$subdomains
==
1
)
?
true
:
false
;
$domain
=
trim
(
$params
[
'domain'
]);
$domains
=
array
(
$domain
);
$allStat
=
((
$isAdmin
||
$isManager
)
&&
!
$params
[
'userid'
]);
$group
=
(
$isAdmin
&&
isset
(
$params
[
'group'
])
&&
!
$params
[
'userid'
]
&&
!
$params
[
'managerid'
])
?
trim
(
$params
[
'group'
])
:
"false"
;
$action
=
$params
[
'action'
];
$metrics_types
=
$this
->
container
->
get
(
'config'
)[
'metrics'
];
$dates
=
$params
[
'dates'
];
$geo
=
(
$params
[
'geo'
]
!=
''
)
?
$params
[
'geo'
]
:
null
;
$sites_id
=
(
$params
[
'sites_id'
]
!=
''
)
?
$params
[
'sites_id'
]
:
null
;
$zones_id
=
(
$params
[
'zones_id'
]
!=
''
)
?
$params
[
'zones_id'
]
:
null
;
// Формируем список id сайтов для codestat:
$sites_id_code
=
(
$params
[
'sites'
]
!=
''
)
?
$params
[
'sites'
]
:
null
;
if
(
!
is_null
(
$sites_id_code
))
{
$sites_id_code
=
array_map
(
function
(
$id
){
return
(
int
)
$id
;},
$sites_id_code
);
}
$codes
=
$params
[
'codes'
];
// Формируем фильтры:
if
(
!
is_null
(
$sites_id
))
{
$sites_id
[
'list'
]
=
array_map
(
function
(
$id
){
return
(
int
)
$id
;},
$sites_id
[
'list'
]);
}
if
(
!
is_null
(
$zones_id
))
{
$zones_id
[
'list'
]
=
array_map
(
function
(
$id
){
return
(
int
)
$id
;},
$zones_id
[
'list'
]);
}
if
(
$params
[
'action'
]
==
self
::
ACTION_SUMMARY_REPORT
)
{
$data
=
$stats
->
getSummuryReport
(
$sites
,
$currency
,
$subdomains
,
$allStat
,
$group
);
}
elseif
(
$params
[
'action'
]
==
self
::
ACTION_LINECHART_REPORT
)
{
list
(
$data
)
=
$stats
->
getPeriodReport
(
$month
,
$sites
,
$currency
,
$subdomains
,
$allStat
,
$group
);
}
elseif
(
$params
[
'action'
]
==
self
::
ACTION_SITESSTAT_REPORT
)
{
$data
=
$stats
->
getSitesReport
(
$month
,
$sites
,
$currency
,
$subdomains
,
$allStat
,
$group
);
}
elseif
(
$params
[
'action'
]
==
self
::
ACTION_SUBDOMAINS_LIST
)
{
$data
=
$stats
->
getSubDomains
(
$domains
);
}
elseif
(
in_array
(
$params
[
'action'
],
self
::
ACTION_REPORT_LIST
))
{
$type
=
$metrics_types
[
$action
][
'type'
];
$fields
=
$metrics_types
[
$action
][
'fields'
];
if
(
!
in_array
(
'ZoneID'
,
$metrics_types
[
$action
][
'filters'
]))
{
$zones_id
=
null
;
}
$data
=
$stats
->
getStatReport
(
$action
,
$type
,
$fields
,
$dates
,
$geo
,
$sites_id
,
$zones_id
,
$params
[
'by_sites'
],
$params
[
'by_zones'
],
$params
[
'by_countries'
]);
}
elseif
(
$params
[
'action'
]
==
self
::
ACTION_GEO_LIST
)
{
$metric
=
$params
[
'metric'
];
$type
=
$metrics_types
[
$metric
][
'type'
];
$fields
=
$metrics_types
[
$metric
][
'fields'
];
$data
=
$this
->
getGeoList
(
$type
,
$fields
);
}
elseif
(
$params
[
'action'
]
==
self
::
ACTION_SITES_LIST
)
{
$data
=
$this
->
getSitesList
();
}
elseif
(
$params
[
'action'
]
==
self
::
ACTION_ZONES_LIST
)
{
$data
=
$this
->
getZonesList
();
}
elseif
(
$params
[
'action'
]
==
self
::
ACTION_CODESTAT_GLOBAL_REPORT
)
{
$data
=
$stats
->
getCodestatGlobalReport
(
$sites_id_code
,
$codes
);
}
elseif
(
$params
[
'action'
]
==
self
::
ACTION_CODESTAT_REPORT
)
{
list
(
$data
)
=
$stats
->
getCodestatReport
(
$month
,
$sites_id_code
,
$codes
);
}
return
new
JsonResponse
(
$data
);
}
private
function
getGeoList
(
$type
,
$fields
)
{
/** @var \App\Model\Statistics $stats */
$stats
=
$this
->
container
->
get
(
\App\Model\Statistics
::
class
);
// Определяем список наиболее популярных стран:
//$geo_popular = $stats->getStatReportCountries($type, $fields);
if
(
$geo_popular
)
{
$list_codes
=
$this
->
container
->
get
(
'config'
)[
'country_codes'
];
foreach
(
array_keys
(
$geo_popular
)
as
$code
)
{
$geo_popular
[
$code
]
=
$list_codes
[
$code
];
}
}
else
{
$geo_popular
=
$this
->
container
->
get
(
'config'
)[
'site_countries'
];
}
return
$geo_popular
;
}
private
function
getSitesList
()
{
/** @var \App\Model\Sites $sitesModel */
$sitesModel
=
$this
->
container
->
get
(
\App\Model\Sites
::
class
);
$sites
=
array
();
foreach
(
$sitesModel
->
findAll
(
null
,
'domain ASC'
)
as
$site
)
{
$sites
[]
=
array
(
'id'
=>
$site
->
getId
(),
'domain'
=>
$site
->
getDomain
(),
);
}
return
$sites
;
}
private
function
getZonesList
()
{
/** @var \App\Model\Sites $sitesModel */
$sitesModel
=
$this
->
container
->
get
(
\App\Model\Sites
::
class
);
/** @var \App\Model\Sites $zonesModel */
$zonesModel
=
$this
->
container
->
get
(
\App\Model\Zones
::
class
);
$zones
=
array
();
foreach
(
$zonesModel
->
findAll
(
$where
?:
null
,
'id ASC'
)
as
$zone
)
{
$site
=
$sitesModel
->
findOne
([
'id'
=>
$zone
->
getSiteId
()]);
$site_domain
=
$site
->
getDomain
();
$zones
[
$zone
->
getId
()]
=
array
(
'domain'
=>
$site_domain
,
'site_id'
=>
$zone
->
getSiteId
(),
'size'
=>
$zone
->
getWidth
()
.
'x'
.
$zone
->
getHeight
(),
);
}
return
$zones
;
}
}
\ No newline at end of file
src/src/App/Action/User/Cabinet.php
View file @
55f619f4
...
...
@@ -118,13 +118,22 @@ class Cabinet extends Common
$periodStats
=
$transactionsModel
->
getStatsByDate
(
$feed_id_list
,
$dates
);
$companyStats
=
$transactionsModel
->
getStatsByFeeds
(
$feed_id_list
,
$dates
);
$cats
=
[
'localmoney'
,
'usdollarmoney'
];
//return new JsonResponse($periodStats);
break
;
default
:
$data
[
'error'
]
=
_t
(
'Извините, тип отчета "'
.
$report_type
.
'" недоступен'
);
break
;
}
if
(
$companyStats
||
count
(
$companyStats
[
'period'
])
>
0
)
{
$feeds_names
=
[];
foreach
(
$companyStats
[
'period'
]
as
$feed_id
)
{
$feed
=
$feedsModel
->
findById
(
$feed_id
);
$feeds_names
[]
=
$feed
->
getTitle
();
}
$companyStats
[
'period'
]
=
$feeds_names
;
}
//return new JsonResponse($companyStats);
$periodStats
[
'type'
]
=
'interval'
;
$periodStats
[
'report'
]
=
$report_type
;
...
...
src/src/App/Action/User/Codestat.php
deleted
100644 → 0
View file @
9b2d5f7d
<?php
/**
* Copyright (c) 2016 Serhii Borodai <clarifying@gmail.com>.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*
*/
namespace
App\Action\User
;
use
App\Action\Common
;
use
App\Authentication\UserService
;
use
App\Model\Users
;
use
App\Model\Sites
;
use
App\Model\Statistics
;
use
App\Model\Providers
;
use
App\Model\Codes
;
use
Psr\Http\Message\ResponseInterface
;
use
Psr\Http\Message\ServerRequestInterface
;
use
Zend\Diactoros\Response\HtmlResponse
;
/**
* Class Codestat
* @package App\Action\User
*/
class
Codestat
extends
Common
{
/**
* @param ServerRequestInterface $request
* @param ResponseInterface $response
* @param callable|null $next
* @return HtmlResponse
*/
function
__invoke
(
ServerRequestInterface
$request
,
ResponseInterface
$response
,
callable
$next
=
null
)
{
$provider_name
=
$request
->
getAttribute
(
'provider'
);
try
{
/** @var Sites $sitesModel */
$sitesModel
=
$this
->
container
->
get
(
Sites
::
class
);
/** @var UserService $authUser */
$authUser
=
$this
->
container
->
get
(
UserService
::
class
);
$userAuth
=
$authUser
->
getIdentity
();
/** @var Statistics $stats */
$stats
=
$this
->
container
->
get
(
Statistics
::
class
);
/** @var Users $usersModel */
$usersModel
=
$this
->
container
->
get
(
Users
::
class
);
/** @var \App\Model\Providers $providerModel */
$providerModel
=
$this
->
container
->
get
(
Providers
::
class
);
$provider
=
$providerModel
->
findOne
([
'name'
=>
$provider_name
]);
// Проверяем наличие провайдера в системе:
if
(
$provider
)
{
$provider_id
=
$provider
->
getId
();
if
(
$userAuth
)
{
$data
[
'adminStats'
]
=
false
;
$user_id
=
$userAuth
->
getId
();
$user
=
$usersModel
->
findById
(
$user_id
);
$userCodeProviderId
=
json_decode
(
$user
->
getCodeProvider
(),
true
);
// Проверяем наличие у данного юзера кода провайдера:
if
(
!
in_array
(
$provider_id
,
$userCodeProviderId
))
{
$data
[
'error'
]
=
_t
(
'У вас нет доступа к этой странице'
);
}
}
else
{
$data
[
'adminStats'
]
=
true
;
$this
->
container
->
get
(
'layout'
)
->
setTemplate
(
'layout/support'
);
}
}
else
{
if
(
$userAuth
)
{
$data
[
'error'
]
=
_t
(
'У вас нет доступа к этой странице'
);
}
else
{
$data
[
'error'
]
=
_t
(
'Извините, провайдера: '
.
$provider_name
.
' нет в системе'
);
}
}
if
(
!
$data
[
'error'
])
{
/** @var \App\Model\Codes $codeModel */
$codeModel
=
$this
->
container
->
get
(
Codes
::
class
);
$codes
=
$codeModel
->
findAll
([
'provider'
=>
$provider_id
])
->
toArray
();
if
(
$codes
)
{
$sites_id
=
[];
foreach
(
$codes
as
$code
)
{
$code_site_id
=
(
int
)
$code
[
'site_id'
];
if
(
!
in_array
(
$code_site_id
,
$sites_id
)
&&
$code_site_id
<
59990
)
{
$sites_id
[]
=
$code_site_id
;
}
}
if
(
count
(
$sites_id
))
{
$listSites
=
$sitesModel
->
findAll
([
'id'
=>
$sites_id
])
->
buffer
();
$listDomains
=
[];
foreach
(
$listSites
as
$site
)
{
$listDomains
[
$site
->
getId
()]
=
$site
->
getDomain
();
}
$listSites
->
rewind
();
asort
(
$listDomains
);
/** @var \App\Model\Currencies $currencyModel */
$currencyModel
=
$this
->
container
->
get
(
\App\Model\Currencies
::
class
);
$currentCurencyCode
=
'USD'
;
$currencies
=
array
();
foreach
(
$currencyModel
->
findAll
()
as
$currency
)
{
$currencies
[
$currency
->
getCode
()]
=
$currency
->
getName
();
}
$summaryReport
=
$stats
->
getCodestatGlobalReport
(
$sites_id
,
[
$provider_name
]);
list
(
$periodStats
,
$periodDates
)
=
$stats
->
getCodestatReport
(
date
(
'Y-m'
),
$sites_id
,
[
$provider_name
]);
$dateIterval
=
new
\DateInterval
(
'P1M'
);
$dateStart
=
\DateTime
::
createFromFormat
(
'Y-m-d'
,
$periodDates
[
'min'
]
?:
date
(
'Y-m-01'
));
$dateEnd
=
\DateTime
::
createFromFormat
(
'Y-m-d'
,
$periodDates
[
'max'
]
?:
date
(
'Y-m-01'
));
$dateRange
=
[];
if
(
$dateStart
!=
$dateEnd
)
{
$_dateRange
=
new
\DatePeriod
(
$dateStart
,
$dateIterval
,
$dateEnd
);
foreach
(
$_dateRange
as
$dt
)
{
$dateRange
[]
=
$dt
;
}
}
$dateRange
[]
=
$dateEnd
;
$dateRange
=
array_reverse
(
$dateRange
);
//$data['sites'] = $listSites;
$data
[
'listDomains'
]
=
$listDomains
;
$data
[
'summaryReport'
]
=
$summaryReport
;
$data
[
'periodStats'
]
=
$periodStats
;
$data
[
'dateRange'
]
=
$dateRange
;
$data
[
'codeProvider'
]
=
$provider_name
;
}
else
{
if
(
$userAuth
)
{
$data
[
'error'
]
=
_t
(
'У вас нет доступа к этой странице'
);
}
else
{
$data
[
'error'
]
=
_t
(
'Извините, отсутствуют сайты с кодом данного провайдера'
);
}
}
}
}
}
catch
(
\Exception
$e
)
{
$data
[
'error'
]
=
_t
(
'Извините, статистика недоступна'
);
}
$data
=
array_merge
(
$data
,
[
'lang'
=>
$request
->
getAttribute
(
'layoutInfo'
)
->
getLang
(),
'layoutInfo'
=>
$request
->
getAttribute
(
'layoutInfo'
),
]);
return
new
HtmlResponse
(
$this
->
template
->
render
(
'app::codestat'
,
$data
));
}
}
\ No newline at end of file
src/src/App/Entity/ApplyVacancy.php
deleted
100644 → 0
View file @
9b2d5f7d
<?php
/**
* Copyright (c) 2017 Serhii Borodai <clarifying@gmail.com>.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*
*/
namespace
App\Entity
;
/**
* Class ApplyVacancy
* used on form of applying vacancies
*
* @package App\Entity
*/
class
ApplyVacancy
{
protected
$name
;
protected
$mail
;
protected
$phone
;
/**
* @return mixed
*/
public
function
getName
()
{
return
$this
->
name
;
}
/**
* @param mixed $name
* @return ApplyVacancy
*/
public
function
setName
(
$name
)
{
$this
->
name
=
$name
;
return
$this
;
}
/**
* @return mixed
*/
public
function
getMail
()
{
return
$this
->
mail
;
}
/**
* @param mixed $mail
* @return ApplyVacancy
*/
public
function
setMail
(
$mail
)
{
$this
->
mail
=
$mail
;
return
$this
;
}
/**
* @return mixed
*/
public
function
getPhone
()
{
return
$this
->
phone
;
}
/**
* @param mixed $phone
* @return ApplyVacancy
*/
public
function
setPhone
(
$phone
)
{
$this
->
phone
=
$phone
;
return
$this
;
}
}
\ No newline at end of file
src/src/App/Entity/Article.php
deleted
100644 → 0
View file @
9b2d5f7d
<?php
/**
* Copyright (c) 2017 Serhii Borodai <clarifying@gmail.com>.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*
*/
namespace
App\Entity
;
use
App\Model\HideableInterface
;
/**
* Class Article
* @package App\Entity
*/
class
Article
extends
Common
implements
HideableInterface
{
protected
$title
;
protected
$desc
;
protected
$content
;
protected
$date_create
;
protected
$date_update
;
protected
$hidden
=
0
;
protected
$title_img_url
;
/**
* @var Tag[]
*/
protected
$tags
=
[];
/**
* @return mixed
*/
public
function
getTitle
()
{
return
$this
->
title
;
}
/**
* @param mixed $title
* @return Article
*/
public
function
setTitle
(
$title
)
{
$this
->
title
=
$title
;
return
$this
;
}
/**
* @return mixed
*/
public
function
getDesc
()
{
return
$this
->
desc
;
}
/**
* @param mixed $desc
* @return Article
*/
public
function
setDesc
(
$desc
)
{
$this
->
desc
=
$desc
;
return
$this
;
}
/**
* @return mixed
*/
public
function
getContent
()
{
return
$this
->
content
;
}
/**
* @param mixed $content
* @return Article
*/
public
function
setContent
(
$content
)
{
$this
->
content
=
$content
;
return
$this
;
}
/**
* @return mixed
*/
public
function
getDateCreate
()
{
return
$this
->
date_create
;
}
/**
* @param mixed $date_create
* @return Article
*/
public
function
setDateCreate
(
$date_create
)
{
$this
->
date_create
=
$date_create
;
return
$this
;
}
/**
* @return mixed
*/
public
function
getDateUpdate
()
{
return
$this
->
date_update
;
}
/**
* @param mixed $date_update
* @return Article
*/
public
function
setDateUpdate
(
$date_update
)
{
$this
->
date_update
=
$date_update
;
return
$this
;
}
/**
* @return int
*/
public
function
getHidden
()
:
int
{
return
$this
->
hidden
;
}
/**
* @param int $hidden
* @return Article
*/
public
function
setHidden
(
int
$hidden
)
:
Article
{
$this
->
hidden
=
$hidden
;
return
$this
;
}
/**
* @return mixed
*/
public
function
getTitleImgUrl
()
{
return
$this
->
title_img_url
;
}
/**
* @param mixed $title_img_url
* @return Article
*/
public
function
setTitleImgUrl
(
$title_img_url
)
{
$this
->
title_img_url
=
$title_img_url
;
return
$this
;
}
/**
* @return Tag[]
*/
public
function
getTags
()
{
return
$this
->
tags
;
}
/**
* @param Tag[] $tags
* @return Article
*/
public
function
setTags
(
$tags
)
:
Article
{
$this
->
tags
=
$tags
;
return
$this
;
}
}
\ No newline at end of file
src/src/App/Entity/Provider.php
deleted
100644 → 0
View file @
9b2d5f7d
<?php
/**
* Copyright (c) 2016 Serhii Borodai <clarifying@gmail.com>.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*
*/
namespace
App\Entity
;
/**
* Class Provider
* @package App\Entity
*/
class
Provider
extends
Common
{
/**
* @return string
*/
public
function
getName
()
{
return
$this
->
name
;
}
/**
* @param string $name
* @return Provider
*/
public
function
setName
(
$name
)
{
$this
->
name
=
$name
;
return
$this
;
}
}
\ No newline at end of file
src/src/App/Entity/ProviderDomain.php
deleted
100644 → 0
View file @
9b2d5f7d
<?php
/**
* Copyright (c) 2016 Serhii Borodai <clarifying@gmail.com>.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*
*/
namespace
App\Entity
;
/**
* Class Provider
* @package App\Entity
*/
class
ProviderDomain
extends
Common
{
/**
* @var string
*/
/**
* @return string
*/
public
function
getName
()
{
return
$this
->
name
;
}
/**
* @param string $name
* @return ProviderDomain
*/
public
function
setName
(
$name
)
{
$this
->
name
=
$name
;
return
$this
;
}
}
\ No newline at end of file
src/src/App/Entity/Site.php
deleted
100644 → 0
View file @
9b2d5f7d
<?php
/**
* Copyright (c) 2016 Serhii Borodai <clarifying@gmail.com>.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*
*/
namespace
App\Entity
;
/**
* Class Site
* @package App\Entity
*/
class
Site
extends
Common
{
/**
* @var string
*/
protected
$domain
;
protected
$usersId
;
protected
$alias
;
protected
$category
;
/**
* @return string
*/
public
function
getDomain
()
{
return
$this
->
domain
;
}
/**
* @param string $domain
* @return Site
*/
public
function
setDomain
(
$domain
)
{
$this
->
domain
=
$domain
;
return
$this
;
}
/**
* @return int
*/
public
function
getUsersId
()
{
return
$this
->
usersId
;
}
/**
* @param int $usersId
* @return Site
*/
public
function
setUsersId
(
$usersId
)
{
$this
->
usersId
=
$usersId
;
return
$this
;
}
/**
* @return string
*/
public
function
getAlias
()
{
return
$this
->
alias
;
}
/**
* @param string $alias
* @return Site
*/
public
function
setAlias
(
$alias
)
{
$this
->
alias
=
$alias
;
return
$this
;
}
/**
* @return string
*/
public
function
getCategory
()
{
return
$this
->
category
;
}
/**
* @param string $category
* @return Site
*/
public
function
setCategory
(
$category
)
{
$this
->
category
=
$category
;
return
$this
;
}
/**
* Set dateCreate
*
* @param string $dateCreate
*
* @return User
*/
public
function
setDateCreate
(
$dateCreate
)
{
$this
->
dateCreate
=
$dateCreate
;
return
$this
;
}
/**
* Get dateCreate
*
* @return string
*/
public
function
getDateCreate
()
{
return
$this
->
dateCreate
??
(
new
\DateTimeImmutable
())
->
format
(
'Y-m-d'
);
}
/**
*
* @return int
*/
public
function
getTraffic
()
:
int
{
return
(
int
)
$this
->
traffic
;
}
/**
*
* @param int $traffic
* @return $this
*/
public
function
setTraffic
(
$traffic
)
{
$this
->
traffic
=
$traffic
;
return
$this
;
}
/**
* @param bool $onlyNative
* @return Site
*/
public
function
setOnlyNative
(
$onlyNative
)
{
$this
->
onlyNative
=
$onlyNative
;
return
$this
;
}
/**
* @return bool
*/
public
function
getOnlyNative
()
{
return
$this
->
onlyNative
;
}
/**
* @param bool $forcedStart
* @return Site
*/
public
function
setForcedStart
(
$forcedStart
)
{
$this
->
forcedStart
=
$forcedStart
;
return
$this
;
}
/**
* @return bool
*/
public
function
getForcedStart
()
{
return
$this
->
forcedStart
;
}
/**
* @param bool $payBlock
* @return Site
*/
public
function
setPayBlock
(
$payBlock
)
{
$this
->
payBlock
=
$payBlock
;
return
$this
;
}
/**
* @return bool
*/
public
function
getPayBlock
()
{
return
$this
->
payBlock
;
}
/**
* @param bool $onlyGoods
* @return Site
*/
public
function
setOnlyGoods
(
$onlyGoods
)
{
$this
->
onlyGoods
=
$onlyGoods
;
return
$this
;
}
/**
* @return bool
*/
public
function
getOnlyGoods
()
{
return
$this
->
onlyGoods
;
}
/**
* @return string
*/
public
function
getHidezones
()
{
return
$this
->
hidezones
;
}
/**
* @param string $hidezones
* @return Site
*/
public
function
setHidezones
(
$hidezones
)
{
$this
->
hidezones
=
$hidezones
;
return
$this
;
}
/**
* @return string
*/
public
function
getStophide
()
{
return
$this
->
stophide
;
}
/**
* @param string $stophide
* @return Site
*/
public
function
setStophide
(
$stophide
)
{
$this
->
stophide
=
$stophide
;
return
$this
;
}
/**
* @return string
*/
public
function
getProvidersId
()
{
return
$this
->
providersId
;
}
/**
* @param string $providersId
* @return Site
*/
public
function
setProvidersId
(
$providersId
)
{
$this
->
providersId
=
$providersId
;
return
$this
;
}
/**
* @return string
*/
public
function
getCodezones
()
{
return
$this
->
codezones
;
}
/**
* @param string $codezones
* @return Site
*/
public
function
setCodezones
(
$codezones
)
{
$this
->
codezones
=
$codezones
;
return
$this
;
}
/**
* @return string
*/
public
function
getTempState
()
{
return
$this
->
tempState
;
}
/**
* @param string $tempState
* @return Site
*/
public
function
setTempState
(
$tempState
)
{
$this
->
tempState
=
$tempState
;
return
$this
;
}
/**
* @return int
*/
public
function
getEnabled
()
{
return
$this
->
enabled
;
}
/**
* @param int $is_enable
* @return Zone
*/
public
function
setEnabled
(
$is_enable
)
{
$this
->
enabled
=
$is_enable
;
return
$this
;
}
/**
* @return string
*/
public
function
getServerData
()
{
return
$this
->
serverData
;
}
/**
* @param string $serverData
* @return Site
*/
public
function
setServerData
(
$serverData
)
{
$this
->
serverData
=
$serverData
;
return
$this
;
}
}
\ No newline at end of file
src/src/App/Entity/Slot.php
deleted
100644 → 0
View file @
9b2d5f7d
<?php
/**
* Copyright (c) 2016 Serhii Borodai <clarifying@gmail.com>.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*
*/
namespace
App\Entity
;
/**
* Class Slot
* @package App\Entity
*/
class
Slot
extends
Common
{
/**
* @return string
*/
public
function
getSiteId
()
{
return
$this
->
siteId
;
}
/**
* @param string $siteId
* @return Slot
*/
public
function
setSiteId
(
$siteId
)
{
$this
->
siteId
=
$siteId
;
return
$this
;
}
/**
* @return int
*/
public
function
getDisabled
()
{
return
$this
->
disabled
;
}
/**
* @param int $is_disabled
* @return Slot
*/
public
function
setDisabled
(
$is_disabled
)
{
$this
->
disabled
=
$is_disabled
;
return
$this
;
}
/**
* @return string
*/
public
function
getName
()
{
return
$this
->
name
;
}
/**
* @param string $name
* @return Slot
*/
public
function
setName
(
$name
)
{
$this
->
name
=
$name
;
return
$this
;
}
/**
* @return string
*/
public
function
getNode
()
{
return
$this
->
node
;
}
/**
* @param string $node
* @return Slot
*/
public
function
setNode
(
$node
)
{
$this
->
node
=
$node
;
return
$this
;
}
/**
* @return string
*/
public
function
getOffset
()
{
return
$this
->
offset
;
}
/**
* @param string $offset
* @return Slot
*/
public
function
setOffset
(
$offset
)
{
$this
->
offset
=
$offset
;
return
$this
;
}
/**
* @return string
*/
public
function
getMargin
()
{
return
$this
->
margin
;
}
/**
* @param string $margin
* @return Slot
*/
public
function
setMargin
(
$margin
)
{
$this
->
margin
=
$margin
;
return
$this
;
}
/**
* @return int
*/
public
function
getSyncheight
()
{
return
$this
->
syncheight
;
}
/**
* @param int $is_syncheight
* @return Slot
*/
public
function
setSyncheight
(
$is_syncheight
)
{
$this
->
syncheight
=
$is_syncheight
;
return
$this
;
}
/**
* @return int
*/
public
function
getClearbefore
()
{
return
$this
->
clearbefore
;
}
/**
* @param int $is_clearbefore
* @return Slot
*/
public
function
setClearbefore
(
$is_clearbefore
)
{
$this
->
clearbefore
=
$is_clearbefore
;
return
$this
;
}
/**
* @return string
*/
public
function
getHalign
()
{
return
$this
->
halign
;
}
/**
* @param string $halign
* @return Slot
*/
public
function
setHalign
(
$halign
)
{
$this
->
halign
=
$halign
;
return
$this
;
}
/**
* @return string
*/
public
function
getStyles
()
{
return
$this
->
styles
;
}
/**
* @param string $styles
* @return Slot
*/
public
function
setStyles
(
$styles
)
{
$this
->
styles
=
$styles
;
return
$this
;
}
/**
* @return string
*/
public
function
getAddstyles
()
{
return
$this
->
addstyles
;
}
/**
* @param string $addstyles
* @return Slot
*/
public
function
setAddstyles
(
$addstyles
)
{
$this
->
addstyles
=
$addstyles
;
return
$this
;
}
/**
* @return string
*/
public
function
getZones
()
{
return
$this
->
zones
;
}
/**
* @param string $zones
* @return Slot
*/
public
function
setZones
(
$zones
)
{
$this
->
zones
=
$zones
;
return
$this
;
}
/**
* @return string
*/
public
function
getFixed
()
{
return
$this
->
fixed
;
}
/**
* @param string $fixed
* @return Slot
*/
public
function
setFixed
(
$fixed
)
{
$this
->
fixed
=
$fixed
;
return
$this
;
}
/**
* @return string
*/
public
function
getComment
()
{
return
$this
->
comment
;
}
/**
* @param string $comment
* @return Slot
*/
public
function
setComment
(
$comment
)
{
$this
->
comment
=
$comment
;
return
$this
;
}
}
\ No newline at end of file
src/src/App/Entity/Statistic/Blockers.php
deleted
100644 → 0
View file @
9b2d5f7d
<?php
/**
* Copyright (c) 2016 Serhii Borodai <clarifying@gmail.com>.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*
*/
namespace
App\Entity\Statistic
;
class
Blockers
{
const
PROP_FIRST
=
0
;
const
PROP_SECOND
=
1
;
const
PROP_THIRD
=
2
;
const
PROP_FORTH
=
3
;
/**
* @var Data
*/
protected
$first
;
/**
* @var Data
*/
protected
$second
;
/**
* @var Data
*/
protected
$third
;
/**
* @var Data
*/
protected
$forth
;
/**
* @return Data
*/
public
function
getFirst
()
:
Data
{
return
$this
->
first
;
}
/**
* @param Data $first
* @return Blockers
*/
public
function
setFirst
(
Data
$first
)
:
Blockers
{
$this
->
first
=
$first
;
return
$this
;
}
/**
* @return Data
*/
public
function
getSecond
()
:
Data
{
return
$this
->
second
;
}
/**
* @param Data $second
* @return Blockers
*/
public
function
setSecond
(
Data
$second
)
:
Blockers
{
$this
->
second
=
$second
;
return
$this
;
}
/**
* @return Data
*/
public
function
getThird
()
:
Data
{
return
$this
->
third
;
}
/**
* @param Data $third
* @return Blockers
*/
public
function
setThird
(
Data
$third
)
:
Blockers
{
$this
->
third
=
$third
;
return
$this
;
}
/**
* @return Data
*/
public
function
getForth
()
:
Data
{
return
$this
->
forth
;
}
/**
* @param Data $forth
* @return Blockers
*/
public
function
setForth
(
Data
$forth
)
:
Blockers
{
$this
->
forth
=
$forth
;
return
$this
;
}
}
\ No newline at end of file
src/src/App/Entity/Statistic/Data.php
deleted
100644 → 0
View file @
9b2d5f7d
<?php
/**
* Copyright (c) 2016 Serhii Borodai <clarifying@gmail.com>.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*
*/
namespace
App\Entity\Statistic
;
/**
* Class Data
* @package App\Entity\Statistic
*/
class
Data
{
const
PROP_VALUE
=
0
;
const
PROP_PERCENT
=
1
;
const
PROP_TITLE
=
2
;
protected
$value
;
protected
$percent
;
protected
$title
;
/**
* @return mixed
*/
public
function
getValue
()
{
return
$this
->
value
;
}
/**
* @param mixed $value
* @return Data
*/
public
function
setValue
(
$value
)
{
$this
->
value
=
$value
;
return
$this
;
}
/**
* @return mixed
*/
public
function
getPercent
()
{
return
$this
->
percent
;
}
/**
* @param mixed $percent
* @return Data
*/
public
function
setPercent
(
$percent
)
{
$this
->
percent
=
$percent
;
return
$this
;
}
/**
* @return mixed
*/
public
function
getTitle
()
{
return
$this
->
title
;
}
/**
* @param mixed $title
* @return Data
*/
public
function
setTitle
(
$title
)
{
$this
->
title
=
$title
;
return
$this
;
}
}
\ No newline at end of file
src/src/App/Entity/Statistic/Site.php
deleted
100644 → 0
View file @
9b2d5f7d
<?php
/**
* Copyright (c) 2016 Serhii Borodai <clarifying@gmail.com>.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*
*/
namespace
App\Entity\Statistic
;
/**
* Class Site
*
* @package App\Entity\Statistic
*/
class
Site
{
const
PROP_USERS_WITH_ADBLOCKER
=
0
;
const
PROP_USERS_WITHOUT_ADBLOCKER
=
1
;
const
PROP_LOSS_TOTAL
=
2
;
const
PROP_LOSS_DAY
=
3
;
const
PROP_LOSS_WEEK
=
4
;
const
PROP_LOSS_PER1000VIEWS
=
5
;
const
PROP_RECOVERED
=
6
;
const
PATTERN_USERS_WITH_ADBLOCKER
=
'%s пользователей блокируют рекламу'
;
const
PATTERN_USERS_WITHOUT_ADBLOCKER
=
'%s пользователей не устанавливали блокировщик'
;
const
TITLE_LOSS_TOTAL
=
'Всего потери'
;
const
TITLE_LOSS_DAY
=
'За день'
;
const
TITLE_LOSS_WEEK
=
'За неделю'
;
const
TITLE_LOSS_PER1000VIEWS
=
'За 1000 показов'
;
const
TITLE_RECOVERED
=
'Восстановлено'
;
/**
* @var Data
*/
protected
$usersWithAdBlocker
;
/**
* @var Data
*/
protected
$usersWithoutAdBlocker
;
/**
* @var Data
*/
protected
$lossTotal
;
/**
* @var Data
*/
protected
$lossDay
;
/**
* @var Data
*/
protected
$lossWeek
;
/**
* @var Data
*/
protected
$lossPer1000views
;
/**
* @var Data
*/
protected
$recovered
;
/**
*
* @var int
*/
protected
$sitesCount
;
/**
* @return Data
*/
public
function
getUsersWithAdBlocker
()
:
Data
{
if
(
is_null
(
$this
->
usersWithAdBlocker
))
{
$this
->
usersWithAdBlocker
=
new
Data
();
}
return
$this
->
usersWithAdBlocker
;
}
/**
* @param Data $usersWithAdBlocker
* @return Site
*/
public
function
setUsersWithAdBlocker
(
Data
$usersWithAdBlocker
)
:
Site
{
$this
->
usersWithAdBlocker
=
$usersWithAdBlocker
;
return
$this
;
}
/**
* @return Data
*/
public
function
getUsersWithoutAdBlocker
()
:
Data
{
if
(
is_null
(
$this
->
usersWithoutAdBlocker
))
{
$this
->
usersWithoutAdBlocker
=
new
Data
();
}
return
$this
->
usersWithoutAdBlocker
;
}
/**
* @param Data $usersWithoutAdBlocker
* @return Site
*/
public
function
setUsersWithoutAdBlocker
(
Data
$usersWithoutAdBlocker
)
:
Site
{
$this
->
usersWithoutAdBlocker
=
$usersWithoutAdBlocker
;
return
$this
;
}
/**
* @return Data
*/
public
function
getLossTotal
()
:
Data
{
if
(
is_null
(
$this
->
lossTotal
))
{
$this
->
lossTotal
=
new
Data
();
}
return
$this
->
lossTotal
;
}
/**
* @param Data $lossTotal
* @return Site
*/
public
function
setLossTotal
(
Data
$lossTotal
)
:
Site
{
$this
->
lossTotal
=
$lossTotal
;
return
$this
;
}
/**
* @return Data
*/
public
function
getLossDay
()
:
Data
{
if
(
is_null
(
$this
->
lossDay
))
{
$this
->
lossDay
=
new
Data
();
}
return
$this
->
lossDay
;
}
/**
* @param Data $lossDay
* @return Site
*/
public
function
setLossDay
(
Data
$lossDay
)
:
Site
{
$this
->
lossDay
=
$lossDay
;
return
$this
;
}
/**
* @return Data
*/
public
function
getLossWeek
()
:
Data
{
if
(
is_null
(
$this
->
lossWeek
))
{
$this
->
lossWeek
=
new
Data
();
}
return
$this
->
lossWeek
;
}
/**
* @param Data $lossWeek
* @return Site
*/
public
function
setLossWeek
(
Data
$lossWeek
)
:
Site
{
$this
->
lossWeek
=
$lossWeek
;
return
$this
;
}
/**
* @return Data
*/
public
function
getLossPer1000views
()
:
Data
{
if
(
is_null
(
$this
->
lossPer1000views
))
{
$this
->
lossPer1000views
=
new
Data
();
}
return
$this
->
lossPer1000views
;
}
/**
* @param Data $lossPer1000views
* @return Site
*/
public
function
setLossPer1000views
(
Data
$lossPer1000views
)
:
Site
{
$this
->
lossPer1000views
=
$lossPer1000views
;
return
$this
;
}
/**
* @return Data
*/
public
function
getRecovered
()
:
Data
{
if
(
is_null
(
$this
->
recovered
))
{
$this
->
recovered
=
new
Data
();
}
return
$this
->
recovered
;
}
/**
* @param Data $recovered
* @return Site
*/
public
function
setRecovered
(
Data
$recovered
)
:
Site
{
$this
->
recovered
=
$recovered
;
return
$this
;
}
public
function
getSitesCount
()
{
return
$this
->
sitesCount
;
}
public
function
setSitesCount
(
$sites
)
{
$this
->
sitesCount
=
$sites
;
return
$this
;
}
}
\ No newline at end of file
src/src/App/Entity/Zone.php
deleted
100644 → 0
View file @
9b2d5f7d
<?php
/**
* Copyright (c) 2016 Serhii Borodai <clarifying@gmail.com>.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*
*/
namespace
App\Entity
;
/**
* Class Zone
* @package App\Entity
*/
class
Zone
extends
Common
{
const
NOT_HIDDEN
=
0
;
const
HIDDEN
=
1
;
/**
* @var string
*/
protected
$siteId
;
protected
$width
;
protected
$height
;
/**
* @var boolean
*/
protected
$hidden
=
0
;
/**
* @return string
*/
public
function
getSiteId
()
{
return
$this
->
siteId
;
}
/**
* @param string $siteId
* @return Zone
*/
public
function
setSiteId
(
$siteId
)
{
$this
->
siteId
=
$siteId
;
return
$this
;
}
/**
* @return string
*/
public
function
getWidth
()
{
return
$this
->
width
;
}
/**
* @param string $width
* @return Zone
*/
public
function
setWidth
(
$width
)
{
$this
->
width
=
$width
;
return
$this
;
}
/**
* @return string
*/
public
function
getHeight
()
{
return
$this
->
height
;
}
/**
* @param string $height
* @return Zone
*/
public
function
setHeight
(
$height
)
{
$this
->
height
=
$height
;
return
$this
;
}
/**
* @return string
*/
public
function
getMinWindowWidth
()
{
return
$this
->
minWindowWidth
;
}
/**
* @param string $minwindowwidth
* @return Zone
*/
public
function
setMinWindowWidth
(
$minwindowwidth
)
{
$this
->
minWindowWidth
=
$minwindowwidth
;
return
$this
;
}
/**
* @return int
*/
public
function
getHidden
()
{
return
$this
->
hidden
;
}
/**
* @param int $is_hidden
* @return Zone
*/
public
function
setHidden
(
$is_hidden
)
{
$this
->
hidden
=
$is_hidden
;
return
$this
;
}
/**
* @return int
*/
public
function
getDisabled
()
{
return
$this
->
disabled
;
}
/**
* @param int $is_disable
* @return Zone
*/
public
function
setDisabled
(
$is_disable
)
{
$this
->
disabled
=
$is_disable
;
return
$this
;
}
/**
* @return string
*/
public
function
getSelectors
()
{
return
$this
->
selectors
;
}
/**
* @param string $selectors
* @return Zone
*/
public
function
setSelectors
(
$selectors
)
{
$this
->
selectors
=
$selectors
;
return
$this
;
}
/**
* @return string
*/
public
function
getMoreSelectors
()
{
return
$this
->
moreSelectors
;
}
/**
* @param string $more_selectors
* @return Zone
*/
public
function
setMoreSelectors
(
$more_selectors
)
{
$this
->
moreSelectors
=
$more_selectors
;
return
$this
;
}
/**
* @return string
*/
public
function
getTargets
()
{
return
$this
->
targets
;
}
/**
* @param string $targets
* @return Zone
*/
public
function
setTargets
(
$targets
)
{
$this
->
targets
=
$targets
;
return
$this
;
}
/**
* @return string
*/
public
function
getStyles
()
{
return
$this
->
styles
;
}
/**
* @param string $styles
* @return Zone
*/
public
function
setStyles
(
$styles
)
{
$this
->
styles
=
$styles
;
return
$this
;
}
/**
* @return string
*/
public
function
getSeq
()
{
return
$this
->
seq
;
}
/**
* @param string $seq
* @return Zone
*/
public
function
setSeq
(
$seq
)
{
$this
->
seq
=
$seq
;
return
$this
;
}
/**
* @return string
*/
public
function
getTpl
()
{
return
$this
->
tpl
;
}
/**
* @param string $tpl
* @return Zone
*/
public
function
setTpl
(
$tpl
)
{
$this
->
tpl
=
$tpl
;
return
$this
;
}
/**
* @return string
*/
public
function
getAddition
()
{
return
$this
->
addition
;
}
/**
* @param string $addition
* @return Zone
*/
public
function
setAddition
(
$addition
)
{
$this
->
addition
=
$addition
;
return
$this
;
}
/**
* @return string
*/
public
function
getComment
()
{
return
$this
->
comment
;
}
/**
* @param string $comment
* @return Zone
*/
public
function
setComment
(
$comment
)
{
$this
->
comment
=
$comment
;
return
$this
;
}
/**
* @return string
*/
public
function
getMinCpm
()
{
return
$this
->
minCpm
;
}
/**
* @param string $minCpm
* @return Zone
*/
public
function
setMinCpm
(
$minCpm
)
{
$this
->
minCpm
=
$minCpm
;
return
$this
;
}
}
\ No newline at end of file
src/src/App/Entity/ZoneAddition.php
deleted
100644 → 0
View file @
9b2d5f7d
<?php
/**
* Copyright (c) 2016 Serhii Borodai <clarifying@gmail.com>.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*
*/
namespace
App\Entity
;
/**
* Class ZoneAddition
* @package App\Entity
*/
class
ZoneAddition
extends
Common
{
/**
* @var string
*/
/**
* @return string
*/
public
function
getBeforeData
()
{
return
$this
->
beforeData
;
}
/**
* @param string $before
* @return ZoneAddition
*/
public
function
setBeforeData
(
$before
)
{
$this
->
beforeData
=
$before
;
return
$this
;
}
/**
* @return string
*/
public
function
getElData
()
{
return
$this
->
elData
;
}
/**
* @param string $el
* @return ZoneAddition
*/
public
function
setElData
(
$el
)
{
$this
->
elData
=
$el
;
return
$this
;
}
/**
* @return string
*/
public
function
getAfterData
()
{
return
$this
->
afterData
;
}
/**
* @param string $after
* @return ZoneAddition
*/
public
function
setAfterData
(
$after
)
{
$this
->
afterData
=
$after
;
return
$this
;
}
}
\ No newline at end of file
src/src/App/Hydrator/Blockers.php
deleted
100644 → 0
View file @
9b2d5f7d
<?php
/**
* Copyright (c) 2016 Serhii Borodai <clarifying@gmail.com>.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*
*/
namespace
App\Hydrator
;
use
Zend\Hydrator\ClassMethods
;
use
Zend\Hydrator\NamingStrategy\MapNamingStrategy
;
use
App\Hydrator\Strategy\Data
as
DataStrategy
;
/**
* Class Blockers
* @package App\Hydrator
*/
class
Blockers
extends
ClassMethods
{
/**
* Blockers constructor.
* @param array|bool $underscoreSeparatedKeys
*/
public
function
__construct
(
$underscoreSeparatedKeys
=
true
)
{
$dataPropertiesMapping
=
[
\App\Entity\Statistic\Blockers
::
PROP_FIRST
=>
'first'
,
\App\Entity\Statistic\Blockers
::
PROP_SECOND
=>
'second'
,
\App\Entity\Statistic\Blockers
::
PROP_THIRD
=>
'third'
,
\App\Entity\Statistic\Blockers
::
PROP_FORTH
=>
'forth'
,
];
parent
::
__construct
(
$underscoreSeparatedKeys
);
$this
->
setNamingStrategy
(
new
MapNamingStrategy
(
$dataPropertiesMapping
));
foreach
(
$dataPropertiesMapping
as
$alias
=>
$property
)
{
$this
->
addStrategy
(
$alias
,
new
DataStrategy
(
\App\Hydrator\Strategy\Data
::
EXTRACT_PERCENT
));
}
}
}
\ No newline at end of file
src/src/App/Hydrator/Site.php
deleted
100644 → 0
View file @
9b2d5f7d
<?php
/**
* Copyright (c) 2016 Serhii Borodai <clarifying@gmail.com>.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*
*/
namespace
App\Hydrator
;
use
App\Hydrator\Strategy\Data
as
DataStrategy
;
use
Zend\Hydrator\ClassMethods
;
use
Zend\Hydrator\NamingStrategy\MapNamingStrategy
;
/**
* Class Site
* @package App\Hydrator
*/
class
Site
extends
ClassMethods
{
/**
* Site constructor.
*/
public
function
__construct
(
$underscoreSeparatedKeys
=
true
)
{
$dataPropertiesMapping
=
[
\App\Entity\Statistic\Site
::
PROP_USERS_WITH_ADBLOCKER
=>
'usersWithAdBlocker'
,
\App\Entity\Statistic\Site
::
PROP_USERS_WITHOUT_ADBLOCKER
=>
'usersWithoutAdBlocker'
,
\App\Entity\Statistic\Site
::
PROP_LOSS_TOTAL
=>
'lossTotal'
,
\App\Entity\Statistic\Site
::
PROP_LOSS_DAY
=>
'lossDay'
,
\App\Entity\Statistic\Site
::
PROP_LOSS_WEEK
=>
'lossWeek'
,
\App\Entity\Statistic\Site
::
PROP_LOSS_PER1000VIEWS
=>
'lossPer1000views'
,
\App\Entity\Statistic\Site
::
PROP_RECOVERED
=>
'recovered'
,
];
parent
::
__construct
(
$underscoreSeparatedKeys
);
$this
->
setNamingStrategy
(
new
MapNamingStrategy
(
$dataPropertiesMapping
));
foreach
(
$dataPropertiesMapping
as
$alias
=>
$property
)
{
$this
->
addStrategy
(
$alias
,
new
DataStrategy
());
}
}
}
\ No newline at end of file
src/src/App/Hydrator/Strategy/Data.php
deleted
100644 → 0
View file @
9b2d5f7d
<?php
/**
* Copyright (c) 2016 Serhii Borodai <clarifying@gmail.com>.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*
*/
namespace
App\Hydrator\Strategy
;
use
App\Entity\Statistic\Data
as
DataEntity
;
use
App\Hydrator\Data
as
DataHydrator
;
use
Zend\Hydrator\Strategy\DefaultStrategy
;
/**
* Class Data
* @package App\Hydrator\Strategy
*/
class
Data
extends
DefaultStrategy
{
const
EXTRACT_ALL
=
1
;
const
EXTRACT_VALUES
=
2
;
const
EXTRACT_PERCENT
=
3
;
const
EXTRACT_TITLE
=
4
;
protected
$mode
;
/**
* Data constructor.
*/
public
function
__construct
(
$mode
=
Data
::
EXTRACT_ALL
)
{
$this
->
mode
=
$mode
;
}
/**
* @param \App\Entity\Statistic\Data $value
* @return mixed
*/
public
function
extract
(
$value
)
{
//$value = parent::extract($value);
switch
(
$this
->
mode
)
{
case
Data
::
EXTRACT_VALUES
:
$result
=
$value
->
getValue
();
break
;
case
Data
::
EXTRACT_PERCENT
:
$result
=
$value
->
getPercent
();
break
;
case
Data
::
EXTRACT_TITLE
:
$result
=
$value
->
getTitle
();
break
;
case
Data
::
EXTRACT_ALL
:
default
:
$result
=
(
new
DataHydrator
())
->
extract
(
$value
);
break
;
}
return
$result
;
}
/**
* @param mixed $value
* @return mixed
*/
public
function
hydrate
(
$value
)
{
if
(
!
$value
instanceof
DataEntity
)
{
$value
=
(
new
DataHydrator
())
->
hydrate
(
$value
,
new
DataEntity
());
}
parent
::
hydrate
(
$value
);
return
$value
;
}
}
\ No newline at end of file
src/src/App/Model/Providers.php
deleted
100644 → 0
View file @
9b2d5f7d
<?php
/**
* Copyright (c) 2016 Serhii Borodai <clarifying@gmail.com>.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*
*/
namespace
App\Model
;
use
App\Entity\Provider
;
//use App\Model\Common;
/**
* Class Providers
* @package App\Model
*/
class
Providers
extends
Common
{
/**
* @param \App\Entity\Common $entity
* @return int
* @throws \Exception
*/
public
function
create
(
$entity
)
{
$data
=
$this
->
delegatingHydrator
->
extract
(
$entity
);
// accept data columns only available at table
$data
=
array_intersect_key
(
$data
,
array_fill_keys
(
$this
->
tableGateway
->
getColumns
(),
1
));
$query
=
function
(
$data
)
{
$this
->
tableGateway
->
insert
(
$data
);
$insertId
=
$this
->
tableGateway
->
lastInsertValue
;
return
$insertId
;
};
try
{
$this
->
tableGateway
->
getAdapter
()
->
getDriver
()
->
getConnection
()
->
beginTransaction
();
$id
=
$query
(
$data
);
$this
->
tableGateway
->
getAdapter
()
->
getDriver
()
->
getConnection
()
->
commit
();
}
catch
(
\Exception
$e
)
{
$this
->
tableGateway
->
getAdapter
()
->
getDriver
()
->
getConnection
()
->
rollback
();
throw
$e
;
}
return
$id
;
}
}
src/src/App/Model/ProvidersDomains.php
deleted
100644 → 0
View file @
9b2d5f7d
<?php
/**
* Copyright (c) 2016 Serhii Borodai <clarifying@gmail.com>.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*
*/
namespace
App\Model
;
use
App\Entity\ProviderDomain
;
use
App\Model\Common
;
/**
* Class Providers
* @package App\Model
*/
class
ProvidersDomains
extends
Common
{
/**
* @param \App\Entity\Common $entity
* @return int
* @throws \Exception
*/
public
function
create
(
$entity
)
{
$data
=
$this
->
delegatingHydrator
->
extract
(
$entity
);
// accept data columns only available at table
$data
=
array_intersect_key
(
$data
,
array_fill_keys
(
$this
->
tableGateway
->
getColumns
(),
1
));
$query
=
function
(
$data
)
{
$this
->
tableGateway
->
insert
(
$data
);
$insertId
=
$this
->
tableGateway
->
lastInsertValue
;
return
$insertId
;
};
try
{
$this
->
tableGateway
->
getAdapter
()
->
getDriver
()
->
getConnection
()
->
beginTransaction
();
$id
=
$query
(
$data
);
$this
->
tableGateway
->
getAdapter
()
->
getDriver
()
->
getConnection
()
->
commit
();
}
catch
(
\Exception
$e
)
{
$this
->
tableGateway
->
getAdapter
()
->
getDriver
()
->
getConnection
()
->
rollback
();
throw
$e
;
}
return
$id
;
}
/**
* @param $name
* @return mixed
*/
public
function
findByName
(
$name
)
{
// we got an arrray instead of HydratingResultSet
// so use current
$result
=
$this
->
findOne
([
'name'
=>
$name
]);
return
$result
;
}
}
src/src/App/Model/Sites.php
deleted
100644 → 0
View file @
9b2d5f7d
<?php
/**
* Copyright (c) 2016 Serhii Borodai <clarifying@gmail.com>.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*
*/
namespace
App\Model
;
use
App\Entity\Site
;
/**
* Class Sites
* @package App\Model
*/
class
Sites
extends
Common
{
/**
* @param $id
* @return Site[]
*/
public
function
findByUserId
(
$id
)
{
/** @noinspection PhpIncompatibleReturnTypeInspection */
return
$this
->
findAll
([
'users_id'
=>
$id
],
'domain ASC'
);
}
/**
* @param $id int
* @param $usersId int
* @return int
*/
public
function
delete
(
$id
,
$usersId
)
{
return
$this
->
tableGateway
->
delete
([
'id'
=>
$id
,
'users_id'
=>
$usersId
]);
}
/**
* @param $siteId
* @param $userId
* @return \Zend\Db\ResultSet\HydratingResultSet
*/
public
function
findByIdAndUserId
(
$siteId
,
$userId
)
{
return
$this
->
findAll
([
'id'
=>
$siteId
,
'users_id'
=>
$userId
])
->
current
();
}
/**
*
* @param type $siteDomain
* @param type $userId
*
* @return \App\Entity\Common|object
* @throws \Exception
*/
public
function
findByDomainAndUserId
(
$siteDomain
,
$userId
)
{
return
$this
->
findOne
([
'domain'
=>
$siteDomain
,
'users_id'
=>
$userId
]);
}
public
function
findByDomain
(
$siteDomain
)
{
return
$this
->
findAll
([
'domain'
=>
$siteDomain
]);
}
public
function
findByAlias
(
$alias
)
{
$sites
=
$this
->
findAll
();
foreach
(
$sites
as
$site
)
{
$site_aliases
=
explode
(
","
,
$site
->
getAlias
());
foreach
(
$site_aliases
as
$key
=>
$site_alias
)
{
$site_aliases
[
$key
]
=
trim
(
$site_alias
);
}
if
(
in_array
(
$alias
,
$site_aliases
))
{
return
$site
;
}
}
return
null
;
}
public
function
findBy
(
$where
=
null
,
$limit
=
null
,
$order
=
null
)
{
if
(
$where
[
'category'
])
{
$result
=
parent
::
findByLike
(
$where
,
$limit
,
$order
);
}
else
{
$result
=
parent
::
findBy
(
$where
,
$limit
,
$order
);
}
return
$result
;
}
public
function
findAllSites
()
{
$url
=
'http://piguiqproxy.com/api'
;
$username
=
'dev'
;
$password
=
'LJsVSwx2K5t5HvcWaBKKDbLzB625D5mhrbDFaxYzugkutp23eUB5F'
;
$ch
=
curl_init
();
curl_setopt
(
$ch
,
CURLOPT_URL
,
$url
);
curl_setopt
(
$ch
,
CURLOPT_TIMEOUT
,
30
);
curl_setopt
(
$ch
,
CURLOPT_RETURNTRANSFER
,
true
);
curl_setopt
(
$ch
,
CURLOPT_POST
,
true
);
curl_setopt
(
$ch
,
CURLOPT_POSTFIELDS
,
"m=whitelist_get"
);
curl_setopt
(
$ch
,
CURLOPT_HTTPHEADER
,
array
(
'Content-Type: application/x-www-form-urlencoded'
,
'Authorization: Basic '
.
base64_encode
(
$username
.
":"
.
$password
)
));
// выполняем запрос
$result
=
curl_exec
(
$ch
);
$info
=
curl_getinfo
(
$ch
);
// закрываем curl
curl_close
(
$ch
);
if
(
$info
[
'http_code'
]
!=
200
)
{
throw
new
\Exception
(
'Error. '
.
$info
[
'http_code'
]);
}
return
json_decode
(
$result
,
1
);
}
public
function
createListItem
(
$entity
)
{
$data
=
$this
->
delegatingHydrator
->
extract
(
$entity
);
// accept data columns only available at table
$data
=
array_intersect_key
(
$data
,
array_fill_keys
(
$this
->
tableGateway
->
getColumns
(),
1
));
$query
=
function
(
$data
)
{
$this
->
tableGateway
->
insert
(
$data
);
$insertId
=
$this
->
tableGateway
->
lastInsertValue
;
return
$insertId
;
};
try
{
$this
->
tableGateway
->
getAdapter
()
->
getDriver
()
->
getConnection
()
->
beginTransaction
();
$id
=
$query
(
$data
);
$this
->
tableGateway
->
getAdapter
()
->
getDriver
()
->
getConnection
()
->
commit
();
}
catch
(
\Exception
$e
)
{
$this
->
tableGateway
->
getAdapter
()
->
getDriver
()
->
getConnection
()
->
rollback
();
throw
$e
;
}
return
$id
;
}
public
function
createListSites
()
{
$list_sites
=
[];
foreach
(
$this
->
findAll
()
->
toArray
()
as
$site_data
)
{
$list_sites
[
$site_data
[
'id'
]]
=
$site_data
[
'domain'
];
}
return
$list_sites
;
}
public
function
createListSitesById
(
$sites_id
)
{
$list_sites
=
[];
foreach
(
$this
->
findAll
([
'id'
=>
$sites_id
])
->
toArray
()
as
$site_data
)
{
$list_sites
[
$site_data
[
'id'
]]
=
$site_data
[
'domain'
];
}
return
$list_sites
;
}
}
\ No newline at end of file
src/src/App/Model/Slots.php
deleted
100644 → 0
View file @
9b2d5f7d
<?php
/**
* Copyright (c) 2016 Serhii Borodai <clarifying@gmail.com>.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*
*/
namespace
App\Model
;
use
App\Entity\Slot
;
/**
* Class Slots
* @package App\Model
*/
class
Slots
extends
Common
{
/**
* @param $id
* @return Slot[]
*/
public
function
findBySiteId
(
$id
)
{
/** @noinspection PhpIncompatibleReturnTypeInspection */
return
$this
->
findAll
([
'site_id'
=>
$id
]);
}
/**
* @param \App\Entity\Common $entity
* @return int
* @throws \Exception
*/
public
function
create
(
$entity
)
{
$data
=
$this
->
delegatingHydrator
->
extract
(
$entity
);
// accept data columns only available at table
$data
=
array_intersect_key
(
$data
,
array_fill_keys
(
$this
->
tableGateway
->
getColumns
(),
1
));
$query
=
function
(
$data
)
{
$this
->
tableGateway
->
insert
(
$data
);
$insertId
=
$this
->
tableGateway
->
lastInsertValue
;
return
$insertId
;
};
try
{
$this
->
tableGateway
->
getAdapter
()
->
getDriver
()
->
getConnection
()
->
beginTransaction
();
$id
=
$query
(
$data
);
$this
->
tableGateway
->
getAdapter
()
->
getDriver
()
->
getConnection
()
->
commit
();
}
catch
(
\Exception
$e
)
{
$this
->
tableGateway
->
getAdapter
()
->
getDriver
()
->
getConnection
()
->
rollback
();
throw
$e
;
}
return
$id
;
}
}
\ No newline at end of file
src/src/App/Model/Zones.php
deleted
100644 → 0
View file @
9b2d5f7d
<?php
/**
* Copyright (c) 2016 Serhii Borodai <clarifying@gmail.com>.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*
*/
namespace
App\Model
;
use
App\Entity\Zone
;
use
Zend\Diactoros\Response\JsonResponse
;
/**
* Class Zones
* @package App\Model
*/
class
Zones
extends
Common
{
/**
* @param $id
* @return Zone[]
*/
public
function
findBySiteId
(
$id
)
{
/** @noinspection PhpIncompatibleReturnTypeInspection */
return
$this
->
findAll
([
'site_id'
=>
$id
,
'hidden'
=>
0
]);
}
/**
* @param $id
* @return int
*/
public
function
findCurrentIdBySiteId
(
$id
)
{
/** @noinspection PhpIncompatibleReturnTypeInspection */
$zones
=
$this
->
findAll
([
'site_id'
=>
$id
]);
$currentIdZone
=
$id
*
100
;
foreach
(
$zones
as
$zone
)
{
$currentIdZone
=
(
$zone
->
getId
()
>
$currentIdZone
)
?
$zone
->
getId
()
:
$currentIdZone
;
}
return
$currentIdZone
;
}
public
function
findSiteZones
()
{
$adapter
=
$this
->
tableGateway
->
getAdapter
();
$sql
=
'SELECT site_id, COUNT(*) AS count'
.
' FROM '
.
(
string
)
$this
->
tableGateway
->
getTable
()
.
' GROUP BY site_id'
;
$res
=
$adapter
->
query
(
$sql
,
\Zend\Db\Adapter\Adapter
::
QUERY_MODE_EXECUTE
);
$zonesCount
=
array
();
if
(
$res
)
{
foreach
(
$res
as
$r
)
{
$zonesCount
[
$r
[
'site_id'
]]
=
$r
[
'count'
];
}
}
return
$zonesCount
;
}
public
function
findZonesInfoSize
()
{
$zones_list
=
[];
$zones
=
$this
->
findAll
()
->
toArray
();
foreach
(
$zones
as
$zone
)
{
$zones_list
[
$zone
[
'id'
]][
'size'
]
=
$zone
[
'width'
]
.
'x'
.
$zone
[
'height'
];
$zones_list
[
$zone
[
'id'
]][
'site_id'
]
=
$zone
[
'site_id'
];
}
return
$zones_list
;
}
public
function
findZonesInfoSizeById
(
$zones_id
)
{
$zones_list
=
[];
$zones
=
$this
->
findAll
([
'id'
=>
$zones_id
])
->
toArray
();
foreach
(
$zones
as
$zone
)
{
$zones_list
[
$zone
[
'id'
]][
'size'
]
=
$zone
[
'width'
]
.
'x'
.
$zone
[
'height'
];
}
return
$zones_list
;
}
/**
* @param \App\Entity\Common $entity
* @return int
* @throws \Exception
*/
public
function
create
(
$entity
)
{
$data
=
$this
->
delegatingHydrator
->
extract
(
$entity
);
// accept data columns only available at table
$data
=
array_intersect_key
(
$data
,
array_fill_keys
(
$this
->
tableGateway
->
getColumns
(),
1
));
$query
=
function
(
$data
)
{
$this
->
tableGateway
->
insert
(
$data
);
$insertId
=
$this
->
tableGateway
->
lastInsertValue
;
return
$insertId
;
};
try
{
$this
->
tableGateway
->
getAdapter
()
->
getDriver
()
->
getConnection
()
->
beginTransaction
();
$id
=
$query
(
$data
);
$this
->
tableGateway
->
getAdapter
()
->
getDriver
()
->
getConnection
()
->
commit
();
}
catch
(
\Exception
$e
)
{
$this
->
tableGateway
->
getAdapter
()
->
getDriver
()
->
getConnection
()
->
rollback
();
throw
$e
;
}
return
$id
;
}
public
function
updateStatus
(
$id
,
$status
,
$value
)
{
$zone
=
$this
->
findById
(
$id
);
$data
=
[];
if
(
$zone
)
{
$hydrator
=
$this
->
delegatingHydrator
;
$zone
=
$hydrator
->
hydrate
([
$status
=>
$value
],
$zone
);
try
{
$this
->
save
(
$zone
);
$data
[
'result'
]
=
true
;
}
catch
(
\Exception
$e
)
{
$data
[
'result'
]
=
false
;
$data
[
'msg'
]
=
$e
->
getMessage
();
}
}
else
{
$data
=
[
'result'
=>
false
,
'msg'
=>
'Zone not found'
,
];
}
$response
=
new
JsonResponse
(
$data
);
return
$response
;
}
public
function
deleteBySiteId
(
$site_id
)
{
$zone_items
=
$this
->
findAll
([
'site_id'
=>
$site_id
]);
if
(
$zone_items
)
{
foreach
(
$zone_items
as
$zone_item
)
{
$result
=
$this
->
deleteById
(
$zone_item
->
getId
());
}
}
return
$result
;
}
public
function
createListZones
()
{
$list_zones
=
[];
foreach
(
$this
->
findAll
()
->
toArray
()
as
$zone_data
)
{
$list_zones
[
$zone_data
[
'id'
]]
=
$zone_data
[
'site_id'
];
}
return
$list_zones
;
}
}
\ No newline at end of file
src/src/App/Model/ZonesAdditions.php
deleted
100644 → 0
View file @
9b2d5f7d
<?php
/**
* Copyright (c) 2016 Serhii Borodai <clarifying@gmail.com>.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*
*/
namespace
App\Model
;
use
App\Entity\ZoneAddition
;
/**
* Class ZonesAdditions
* @package App\Model
*/
class
ZonesAdditions
extends
Common
{
/**
* @param $id
* @return ZonesAddition[]
*/
public
function
findById
(
$id
)
{
/** @noinspection PhpIncompatibleReturnTypeInspection */
return
$this
->
findAll
([
'id'
=>
$id
]);
}
public
function
findOneById
(
$id
)
{
/** @noinspection PhpIncompatibleReturnTypeInspection */
return
$this
->
findOne
([
'id'
=>
$id
]);
}
/**
* @param \App\Entity\Common $entity
* @return int
* @throws \Exception
*/
public
function
create
(
$entity
)
{
$data
=
$this
->
delegatingHydrator
->
extract
(
$entity
);
// accept data columns only available at table
$data
=
array_intersect_key
(
$data
,
array_fill_keys
(
$this
->
tableGateway
->
getColumns
(),
1
));
$query
=
function
(
$data
)
{
$this
->
tableGateway
->
insert
(
$data
);
$insertId
=
$this
->
tableGateway
->
lastInsertValue
;
return
$insertId
;
};
try
{
$this
->
tableGateway
->
getAdapter
()
->
getDriver
()
->
getConnection
()
->
beginTransaction
();
$id
=
$query
(
$data
);
$this
->
tableGateway
->
getAdapter
()
->
getDriver
()
->
getConnection
()
->
commit
();
}
catch
(
\Exception
$e
)
{
$this
->
tableGateway
->
getAdapter
()
->
getDriver
()
->
getConnection
()
->
rollback
();
throw
$e
;
}
return
$id
;
}
public
function
clearTable
()
{
$adapter
=
$this
->
tableGateway
->
getAdapter
();
$sql
=
'TRUNCATE TABLE zones_additions'
;
$res
=
$adapter
->
query
(
$sql
,
\Zend\Db\Adapter\Adapter
::
QUERY_MODE_EXECUTE
);
return
$res
;
}
}
\ No newline at end of file
src/templates/app/examples.phtml
deleted
100644 → 0
View file @
9b2d5f7d
<?php
/**
* Copyright (c) 2016 Serhii Borodai <clarifying@gmail.com>.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*
*/
/** @var $this \Zend\View\Renderer\PhpRenderer */
//@todo absent page & styles/scripts
//$this->headScript()
// ->appendFile('/js/script-examples.js');
//
//$this->headLink()
// ->appendStylesheet('/css/styles-examples.css');
?>
<div
style=
"min-height: 200px"
>
<center>
<h1
style=
"padding-top: 50px"
>
NO CONTENT AVAILABLE
</h1>
</center>
</div>
src/templates/app/popup/add-site.phtml
deleted
100644 → 0
View file @
9b2d5f7d
<?php
/**
* Copyright (c) 2016 Serhii Borodai <clarifying@gmail.com>.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*
*/
/** @var $this \Zend\View\Renderer\PhpRenderer */
$dataUrl
=
$this
->
url
(
'site.add'
,
[
'lang'
=>
$this
->
lang
]);
?>
<div
class=
"add-site b-popup__window"
>
<p
class=
"button-close"
></p>
<div
class=
"form-wrapp"
>
<form
action=
""
class=
""
name=
"site"
data-url=
"
<?=
$dataUrl
?>
"
>
<h1>
<?=
_t
(
"Подключение к AddCPM"
)
?>
</h1>
<span
class=
"input input--akira"
>
<input
class=
"input__field input__field--akira"
type=
"text"
id=
"site"
name=
"site"
/>
<label
class=
"input__label input__label--akira"
for=
"site"
>
<span
class=
"input__label-content input__label-content--akira"
>
<?=
_t
(
"Адрес сайта"
)
?>
</span>
</label>
</span>
<input
type=
"submit"
name=
"submit"
value=
"
<?=
_t
(
'Отправить запрос'
)
?>
"
class=
"button-open"
>
</form>
</div>
</div>
src/templates/app/statistics.phtml
deleted
100644 → 0
View file @
9b2d5f7d
<?php
/**
* Copyright (c) 2016 Serhii Borodai <clarifying@gmail.com>.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*
*/
/** @var $this \Zend\View\Renderer\PhpRenderer */
$this
->
headScript
()
->
appendFile
(
'//cdnjs.cloudflare.com/ajax/libs/autosize.js/3.0.18/autosize.min.js'
)
->
appendFile
(
'/js/chartjs.js'
)
// old unknow version
->
appendFile
(
'/js/chartCircle.js'
)
//custom scripts for old version of chart.js
->
appendFile
(
'/js/chartLine.js'
)
//custom scripts for old version of chart.js
->
appendFile
(
'/js/script-statistics.js'
)
;
$this
->
headLink
()
->
appendStylesheet
(
'/css/styles-statistics.css'
);
/** @var \App\Entity\Statistic\Site $siteStatistic */
?>
<section
class=
"b-content__title"
>
<div
class=
"wrapp"
>
<h1>
<?=
_t
(
"Статистика"
)
?>
</h1>
<div
class=
"row"
>
<p
class=
"lead col sm-offset-1 sm-10"
>
<?=
sprintf
(
_t
(
"Статистика обновляется ежедневно и охватывает более %s с площадок различной направленности в Украине, России и Казахстане"
),
$siteStatistic
->
getSitesCount
())
?>
</p>
</div>
</div>
</section>
<?=
$this
->
partial
(
'app::statistics/losses'
)
?>
<?=
$this
->
partial
(
'app::statistics/use-block'
)
?>
<?=
$this
->
partial
(
'app::statistics/traffic'
)
?>
<section
class=
"b-content__contact"
>
<div
class=
"wrapp"
>
<h1>
<?=
_t
(
"Узнайте сколько теряет ваш сайт!"
)
?>
</h1>
<p
class=
"text"
>
<?=
_t
(
"Интегрируйте наш счётчик бесплатно и оцените потери сайта из-за блокировщиков."
)
?>
</p>
<div
class=
"row row-wrap"
>
<form
action=
"
<?=
$this
->
url
(
'email.counter'
)
?>
"
method=
"post"
accept-charset=
"utf-8"
class=
"form-contact col sm-offset-3 sm-6 xs-offset-2 xs-8"
name=
"contact-email"
>
<span
class=
"input input--akira"
>
<input
class=
"input__field input__field--akira"
type=
"email"
id=
"e-mail"
name=
"email"
/>
<label
class=
"input__label input__label--akira"
for=
"e-mail"
>
<span
class=
"input__label-content input__label-content--akira"
>
<?=
_t
(
"Ваш e-mail"
)
?>
</span>
</label>
</span>
<input
type=
"submit"
value=
"
<?=
_t
(
'Получить счетчик'
)
?>
"
>
</form>
</div>
<p
class=
"text"
>
<span>
<?=
_t
(
"Уже установили счётчик?"
)
?>
</span>
<a
href=
"#"
class=
"link login-button button-open"
>
<?=
_t
(
"Войти в личный кабинет"
)
?>
</a>
</p>
</div>
</section>
src/templates/app/user/cabinet-feed.phtml
View file @
55f619f4
...
...
@@ -25,8 +25,6 @@
/** @var $this \Zend\View\Renderer\PhpRenderer */
/** @var $userSiteStatistic \App\Entity\Statistic\Site */
$this
->
headScript
()
->
appendFile
(
'/js/underscore-min.js'
)
->
appendFile
(
'/js/jquery.cookie.js'
)
...
...
src/templates/app/user/cabinet.phtml
deleted
100644 → 0
View file @
9b2d5f7d
<?php
/**
* Copyright (c) 2016 Serhii Borodai <clarifying@gmail.com>.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*
*/
/** @var $this \Zend\View\Renderer\PhpRenderer */
/** @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/c3.min.js'
)
->
appendFile
(
'/js/d3.min.js'
)
->
appendFile
(
'/js/script-cabinet.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'
)
;
/** @var \App\Entity\IdentityInterface $identity */
$identity
=
$this
->
identity
();
$gravatar
=
$this
->
gravatar
(
$identity
->
getEmail
());
$gravatar
->
setDefaultImg
(
\Zend\View\Helper\Gravatar
::
DEFAULT_IDENTICON
);
$sxml
=
new
SimpleXMLElement
(
substr
(
$gravatar
,
0
,
-
1
)
.
'/>'
);
$src
=
$sxml
[
'src'
];
$error
=
$this
->
error
;
$summaryStats
=
$this
->
summaryStats
;
$periodStats
=
$this
->
periodStats
;
$summaryReport
=
$this
->
summaryReport
;
$listDomains
=
$this
->
listDomains
;
$dateRange
=
$this
->
dateRange
;
$adminStats
=
$this
->
adminStats
;
$accessSites
=
$this
->
accessSites
;
switch
(
$currency
[
'code'
])
{
case
'USD'
:
$symb
=
'$'
;
break
;
case
'UAH'
:
$symb
=
'₴'
;
break
;
case
'RUR'
:
$symb
=
'₽'
;
break
;
}
?>
<?php
if
(
$adminStats
)
:
$this
->
headLink
()
->
appendStylesheet
(
'/css/styles-support-index.css'
)
;
endif
;
?>
<?php
if
(
!
$adminStats
)
:
?>
<section
class=
"b-content__title"
>
<div
class=
"wrapp"
>
<!-- Вход произведен -->
<picture>
<img
src=
"/img/bg-img-logo.svg"
alt=
"No logo"
>
</picture>
<p
class=
"lead"
>
<?=
$identity
->
getEmail
()
?>
</p>
<p
class=
"b-content__title-settings"
>
<a
href=
"
<?=
$this
->
url
(
'user.cabinet.profile'
,
[
'lang'
=>
$this
->
lang
])
?>
"
title=
""
class=
"annotation"
>
<?=
_t
(
"Настройки профиля"
)
?>
</a>
<a
href=
"
<?=
$this
->
url
(
'logout'
,
[
'lang'
=>
$this
->
lang
])
?>
"
title=
""
class=
"annotation"
>
<?=
_t
(
"Выход"
)
?>
</a>
</p>
</div>
</section>
<?php
endif
;
?>
<?php
if
(
$error
)
:
?>
<section
class=
"b-content__work"
>
<h1>
<?=
$error
?>
</h1>
</section>
<?php
else
:
?>
<?php
/* Выпадающие списки сайтов и валют */
?>
<section
class=
"b-content__site"
>
<div
class=
"wrapp row row-wrap"
>
<div
id=
"sites-dropdown"
class=
"b-content__site-droplits droplist col sm-4 xs-12"
>
<span
class=
"droplist-current text bold tab-input"
></span>
<ul
class=
"droplist-block"
>
<li
class=
"droplist-item text"
data-id=
"all"
>
<?=
_t
(
'Все'
)
?>
</li>
<?php
/** @var \App\Entity\Site $site */
foreach
(
$listDomains
as
$main_domain
)
:?>
<
li
class
="
droplist
-
item
text
" data-id="
<?=
$main_domain
?>
" data-src-icon-site='http://
<?=
$main_domain
?>
/favicon.ico'>
<?=
$main_domain
?>
</li>
<?php
endforeach
;
?>
<?php
/* Доступные сайты */
foreach
(
$accessSites
as
$site
)
:?>
<
li
class
="
droplist
-
item
text
" data-id="
<?=
$site
->
getDomain
()
?>
" data-src-icon-site='http://
<?=
$site
->
getDomain
()
?>
/favicon.ico'>
<?=
$site
->
getDomain
()
?>
</li>
<?php
endforeach
;
?>
</ul>
</div>
<?php
if
(
!
$adminStats
)
:
?>
<div
class=
"b-content__site-currency user"
>
<span
class=
"droplist-current text bold tab-input"
data-symbol=
"
<?=
$symb
?>
"
>
<?=
$currency
[
'code'
]
?>
(
<?=
_t
(
$currency
[
'name'
])
?>
)
</span>
<?php
/* ?>
<form action="" class="b-content__form-set" name="setting" data-url="<?= $this->url('user.cabinet.profile', ['lang' => $this->lang]) ?>" data-url-success="<?= $this->url('user.cabinet', ['lang' => $this->lang]) ?>">
<div>
<span class="input input--akira currency">
<?php $currencies = $this->currencies; ?>
<input class="input__field input__field--akira" type="hidden" id="setting-money" name="currency" value="<?= $currency['code'] ?>"/>
<span class="droplist-current text bold tab-input" data-symbol="<?=$symb ?>"><?= $currency['code'] ?> (<?= _t($currency['name']) ?>)</span>
<ul class="droplist-block">
<?php foreach($currencies as $code => $name): ?>
<li class="droplist-item text" data-id="<?= $code?>"><?= $code?> (<?= $name?>)</li>
<?php endforeach ?>
</ul>
</span>
</div>
</form>
<?php */
?>
</div>
<span
class=
"userid-current"
data-userid=
"
<?=
$userId
?>
"
></span>
<?php
else
:
?>
<div
class=
"b-content__site-currency state-admin"
>
<?php
if
(
$userId
)
:
?>
<span
class=
"userid-current"
data-userid=
"
<?=
$userId
?>
"
></span>
<?php
endif
;
?>
<span
class=
"droplist-current text bold tab-input"
data-symbol=
"
<?=
$symb
?>
"
>
<?=
$currency
[
'code'
]
?>
(
<?=
_t
(
$currency
[
'name'
])
?>
)
</span>
</div>
<?php
endif
;
?>
</div>
</section>
<textarea
id=
"summary-report-stats"
style=
"display: none;"
>
<?=
(
$summaryStats
?
json_encode
(
$summaryStats
)
:
''
)
?>
</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"
>
<?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>
</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;"'
;
//if ($periodStats['block_hits'])
if
(
false
)
{
foreach
(
$periodStats
[
'block_hits'
]
as
$value
)
{
if
(
$value
!=
0
)
{
$is_block_hits
=
true
;
$block_hits_class
=
'full'
;
$block_switch_full_style
=
'style="display: flex;"'
;
$block_switch_short_style
=
'style="display: none;"'
;
break
;
}
}
}
?>
<?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>
</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>
<?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>
</div>
<div
id=
"chart-graph"
style=
"height: 370px"
></div>
</div>
</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
src/templates/layout/layout-main.phtml
View file @
55f619f4
...
...
@@ -133,7 +133,6 @@ $urlHome = $this->url(
<?php
//= $this->partial('app::popup/login', ['lang' => $lang]) ?>
<?=
$this
->
partial
(
'app::popup/to-action'
,
[
'lang'
=>
$lang
])
?>
<?=
$this
->
partial
(
'app::popup/connection'
,
[
'lang'
=>
$lang
])
?>
<?=
$this
->
partial
(
'app::popup/add-site'
,
[
'lang'
=>
$lang
])
?>
<?=
$this
->
partial
(
'app::popup/password-reset'
,
[
'lang'
=>
$lang
])
?>
<?=
$this
->
partial
(
'app::popup/confirm'
,
[
'lang'
=>
$lang
])
?>
...
...
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