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
64b85017
Commit
64b85017
authored
Mar 20, 2020
by
Александр Чаплыгин
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
стр. одной кампании, рендер по исходным данным
parent
3a1b1a93
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
210 additions
and
14 deletions
+210
-14
acl.global.php
src/config/autoload/acl.global.php
+1
-0
amsystem.global.php
src/config/autoload/amsystem.global.php
+0
-0
dependencies.global.php
src/config/autoload/dependencies.global.php
+13
-0
routes.global.php
src/config/autoload/routes.global.php
+16
-0
styles-amsystem.css
src/public/css/styles-amsystem.css
+5
-2
amsystem-campaign.js
src/public/js/adm/amsystem-campaign.js
+68
-0
CabinetAmSystem.php
src/src/App/Action/User/CabinetAmSystem.php
+83
-0
banner-preview.phtml
src/templates/app/popup/banner-preview.phtml
+5
-0
campaign_item.phtml
src/templates/app/user/campaign_item.phtml
+0
-0
campaigns_list.phtml
src/templates/app/user/campaigns_list.phtml
+8
-4
profile.phtml
src/templates/app/user/profile.phtml
+2
-2
layout-main.phtml
src/templates/layout/layout-main.phtml
+9
-6
No files found.
src/config/autoload/acl.global.php
View file @
64b85017
...
...
@@ -38,6 +38,7 @@ return [
->
allow
(
Roles
::
ROLE_USER
,
'user.cabinet.viewid'
,
null
,
new
\App\Acl\Assertion\UserActive
())
->
allow
(
Roles
::
ROLE_USER
,
'user.cabinet.orderid'
,
null
,
new
\App\Acl\Assertion\UserActive
())
->
allow
(
Roles
::
ROLE_USER
,
'user.cabinet.amsystem'
,
null
,
new
\App\Acl\Assertion\UserActive
())
->
allow
(
Roles
::
ROLE_USER
,
'user.cabinet.campaign'
,
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_GUEST
,
'email.counter'
)
...
...
src/config/autoload/amsystem.global.php
0 → 100644
View file @
64b85017
This diff is collapsed.
Click to expand it.
src/config/autoload/dependencies.global.php
View file @
64b85017
...
...
@@ -63,6 +63,7 @@ return [
$hpm
->
setService
(
\App\Entity\Feeds\OrderStatus
::
class
,
new
\Zend\Hydrator\ClassMethods
());
$hpm
->
setService
(
\App\Entity\AmSystem\Campaign
::
class
,
new
\Zend\Hydrator\ClassMethods
());
$hpm
->
setService
(
\App\Entity\AmSystem\Banner
::
class
,
new
\Zend\Hydrator\ClassMethods
());
$hpm
->
setService
(
\App\Entity\Contacts
::
class
,
new
\Zend\Hydrator\ClassMethods
());
...
...
@@ -238,6 +239,18 @@ return [
$container
->
get
(
\Monolog\Logger
::
class
)
);
},
\App\Model\AmSystem\Banners
::
class
=>
function
(
ContainerInterface
$container
)
{
return
new
\App\Model\AmSystem\Banners
(
new
Zend\Db\TableGateway\TableGateway
(
'am_banners'
,
$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\AmSystem\Banner
())
),
$container
->
get
(
\Zend\Hydrator\DelegatingHydrator
::
class
),
$container
->
get
(
\Monolog\Logger
::
class
)
);
},
\App\Model\FAQ\Categories
::
class
=>
function
(
ContainerInterface
$container
)
{
return
new
\App\Model\FAQ\Categories
(
new
Zend\Db\TableGateway\TableGateway
(
...
...
src/config/autoload/routes.global.php
View file @
64b85017
...
...
@@ -398,6 +398,22 @@ return [
]
],
],
[
'name'
=>
'user.cabinet.campaign'
,
'path'
=>
'/[:lang/]campaign/:id'
,
'middleware'
=>
App\Action\User\CabinetAmSystem
::
class
,
'allowed_methods'
=>
[
'GET'
,
'POST'
],
'options'
=>
[
'constraints'
=>
[
'lang'
=>
'[a-z]{2,3}'
,
'id'
=>
'\w+'
,
],
'defaults'
=>
[
'lang'
=>
\App\Model\Locales
::
DEFAULT_LANG
,
'action'
=>
App\Action\User\CabinetAmSystem
::
ACTION_ITEM
,
]
],
],
[
'name'
=>
'contacts'
,
'path'
=>
'/[:lang/]contacts/'
,
...
...
src/public/css/styles-amsystem.css
View file @
64b85017
...
...
@@ -13,6 +13,11 @@
min-height
:
300px
;
text-align
:
center
;
}
.form-group
.form-control
{
font-family
:
monospace
;
}
input
[
type
=
"checkbox"
],
input
[
type
=
"radio"
]
...
...
@@ -23,8 +28,6 @@ input[type="radio"]
.edited
{
min-width
:
100px
;
min-height
:
20px
;
/*border-bottom: 1px dotted #ccc;*/
cursor
:
pointer
;
}
input
.editing
{
...
...
src/public/js/adm/amsystem-campaign.js
0 → 100644
View file @
64b85017
$
(
document
).
ready
(
function
()
{
"use strict"
;
/* Стр. кампании пользователя */
// Превьюшки:
(
function
(){
var
$popupBg
=
$
(
'.l-popup'
),
$popup
=
$
(
'.b-popup__window.preview'
,
$popupBg
),
$popupClose
=
$
(
'.button-close'
,
$popup
),
$popupInner
=
$
(
'.b-popup-content'
,
$popup
),
$popupMessage
=
$
(
'.b-popup-message'
,
$popup
),
$banners
=
$
(
'.form-group.banners'
),
$tableBanners
=
$
(
'table.campaign-banners'
,
$banners
);
// Открываем попап:
$tableBanners
.
on
(
'click'
,
'.banner-preview'
,
function
(){
var
$this
=
$
(
this
),
size
=
$
.
trim
(
$
(
'.banner-size'
,
$this
.
parents
(
'tr'
)).
text
()),
data
=
{
id
:
$this
.
parents
(
'tr'
).
data
(
'id'
),
size
:
size
.
split
(
'x'
),
img
:
$this
.
attr
(
'src'
)
};
ShowPopup
(
data
);
});
// Закрыввем попап по клику на Х:
$popupClose
.
on
(
'click'
,
function
(){
ClosePopup
();
});
// Закрыввем попап по клику извне:
$popup
.
on
(
'click'
,
function
(
event
){
event
.
stopPropagation
();
});
$popupBg
.
on
(
'click'
,
function
(){
ClosePopup
();
});
function
ShowPopup
(
data
)
{
var
$content
=
$
(
document
.
createElement
(
'div'
));
$content
.
append
(
'<h2>id: <b>'
+
data
.
id
+
'</b> <span>('
+
data
.
size
[
0
]
+
'х'
+
data
.
size
[
1
]
+
')</span></h2>'
);
$content
.
append
(
'<div class="banner-img"><img width="'
+
data
.
size
[
0
]
+
'" height="'
+
data
.
size
[
1
]
+
'" src="'
+
data
.
img
+
'" /></div>'
);
$popupInner
.
append
(
$content
)
$popupBg
.
addClass
(
'open-popup'
);
$popup
.
show
();
}
function
ClosePopup
()
{
$popupBg
.
removeClass
(
'open-popup'
);
$popupMessage
.
hide
();
$popup
.
hide
();
$popupInner
.
empty
();
}
})();
});
src/src/App/Action/User/CabinetAmSystem.php
View file @
64b85017
...
...
@@ -53,6 +53,7 @@ use App\Model\Statistics;
class
CabinetAmSystem
extends
Common
{
const
ACTION_LIST
=
'list'
;
const
ACTION_ITEM
=
'item'
;
/**
* @param ServerRequestInterface $request
...
...
@@ -141,6 +142,88 @@ class CabinetAmSystem extends Common
return
new
HtmlResponse
(
$this
->
template
->
render
(
'app::user/campaigns_list'
,
$data
));
}
elseif
(
$request
->
getAttribute
(
'action'
)
==
self
::
ACTION_ITEM
)
{
$campaign_id
=
$request
->
getAttribute
(
'id'
);
/** @var UserService $auth */
$auth
=
$this
->
container
->
get
(
UserService
::
class
);
$userId
=
$auth
->
getIdentity
()
->
getId
();
/** @var \App\Model\AmSystem\Campaigns $campaignsModel */
$campaignsModel
=
$this
->
container
->
get
(
\App\Model\AmSystem\Campaigns
::
class
);
$campaign_item
=
$campaignsModel
->
findById
(
$campaign_id
);
if
(
$campaign_item
)
{
if
(
$campaign_item
->
getUserId
()
==
$userId
){
$countries
=
$this
->
container
->
get
(
'config'
)[
'amsystem_conf'
][
'country'
];
$regions
=
$this
->
container
->
get
(
'config'
)[
'amsystem_conf'
][
'region'
];
$cities
=
$this
->
container
->
get
(
'config'
)[
'amsystem_conf'
][
'city'
];
/** @var \App\Model\AmSystem\Campaigns $campaignsModel */
$campaignsModel
=
$this
->
container
->
get
(
\App\Model\AmSystem\Campaigns
::
class
);
$campaign
=
$campaignsModel
->
findOne
([
'id'
=>
$campaign_id
]);
$campaign_banners_id
=
$campaign
->
getBanners
();
if
(
$campaign_banners_id
)
{
$banners_id
=
json_decode
(
$campaign_banners_id
);
/** @var \App\Model\AmSystem\Banners $bannersModel */
$bannersModel
=
$this
->
container
->
get
(
\App\Model\AmSystem\Banners
::
class
);
$banners
=
$bannersModel
->
findAll
([
'id'
=>
$banners_id
])
->
toArray
();
/** @var \App\Model\Statistics $stats */
$stats
=
$this
->
container
->
get
(
\App\Model\Statistics
::
class
);
$banners_stats
=
[];
foreach
(
$banners
as
$banner_item
)
{
$banner_id
=
$banner_item
[
'id'
];
$banners_stats
[
$banner_id
]
=
$stats
->
getBannersStat
([
$banner_id
],
null
);
if
(
$campaign
->
getTargetAction
()
==
'load'
)
{
$banners_stats
[
$banner_id
][
'views'
]
=
$banners_stats
[
$banner_id
][
'loads'
];
}
else
{
}
$views
=
$banners_stats
[
$banner_id
][
'views'
];
$money
=
$banners_stats
[
$banner_id
][
'money'
];
$clicks
=
$banners_stats
[
$banner_id
][
'clicks'
];
$banners_stats
[
$banner_id
][
'ctr'
]
=
(
$views
!=
0
)
?
round
((
$clicks
/
$views
)
*
100
,
2
)
:
0
;
$banners_stats
[
$banner_id
][
'cpm'
]
=
(
$views
!=
0
)
?
round
((
$money
/
$views
)
*
1000
,
3
)
:
0
;
$banners_stats
[
$banner_id
][
'cpc'
]
=
(
$clicks
!=
0
)
?
round
((
$money
/
$clicks
)
*
100
,
1
)
:
0
;
$banners_stats
[
$banner_id
][
'money'
]
=
round
(
$banners_stats
[
$banner_id
][
'money'
],
2
);
}
}
$data
[
'campaign'
]
=
$campaign
;
$data
[
'countries'
]
=
$countries
;
$data
[
'regions'
]
=
$regions
;
$data
[
'cities'
]
=
$cities
;
$data
[
'banners'
]
=
$banners
;
$data
[
'banners_stats'
]
=
$banners_stats
;
}
else
{
$data
[
'error'
]
=
_t
(
'Извините, данная кампания закреплена за другим пользователем'
);
}
}
else
{
$data
[
'error'
]
=
_t
(
'Извините, кампания не найдена'
);
}
$data
=
array_merge
(
$data
,
[
'lang'
=>
$request
->
getAttribute
(
'layoutInfo'
)
->
getLang
(),
'layoutInfo'
=>
$request
->
getAttribute
(
'layoutInfo'
),
]);
return
new
HtmlResponse
(
$this
->
template
->
render
(
'app::user/campaign_item'
,
$data
));
}
}
...
...
src/templates/app/popup/banner-preview.phtml
0 → 100644
View file @
64b85017
<div
class=
"preview b-popup__window"
>
<p
class=
"button-close"
></p>
<div
class=
"b-popup-message"
></div>
<div
class=
"b-popup-content"
></div>
</div>
src/templates/app/user/campaign_item.phtml
0 → 100644
View file @
64b85017
This diff is collapsed.
Click to expand it.
src/templates/app/user/campaigns_list.phtml
View file @
64b85017
...
...
@@ -37,6 +37,7 @@ $this->headLink()
$lang
=
$this
->
lang
;
$campaigns
=
$this
->
campaigns
;
$error
=
$this
->
error
;
?>
...
...
@@ -61,7 +62,9 @@ $campaigns = $this->campaigns;
<table
class=
"table table-striped campaigns"
data-content=
"campaigns"
data-action=
"/amsystem/campaigns/id/edit/"
>
<thead>
<tr>
<th
width=
"1px"
></th>
<?php
/* ?>
<th width="1px"></th>
<?php */
?>
<th
width=
"1px"
>
#ID
</th>
<th>
Название кампании
</th>
<th
width=
"1px"
>
Показы
</th>
...
...
@@ -82,19 +85,20 @@ $campaigns = $this->campaigns;
$stat
=
$stats
[
$campaign_id
];
$target_class
=
(
$campaign
[
'target_action'
]
==
'load'
)
?
'load-target'
:
''
;
?>
<?php
/* ?>
<td>
<input class="is-active" type="checkbox" data-id="<?= $campaign_id ?>" <?php if ($campaign['active']): ?>checked<?php endif; ?>>
</td>
<?php */
?>
<td>
<span
class=
"item-id"
>
<?=
$campaign_id
?>
</span>
</td>
<td>
<?php
/*
$btn_link = $this->url('adm.amsystem.campaigns.edit', [
$btn_link
=
$this
->
url
(
'user.cabinet.campaign'
,
[
'lang'
=>
$this
->
lang
,
'id'
=>
$campaign_id
,
]);
*/
]);
?>
<span
class=
"item-title"
><a
href=
"
<?=
$btn_link
?>
"
>
<?=
$campaign
[
'title'
]
?>
</a></span>
</td>
...
...
src/templates/app/user/profile.phtml
View file @
64b85017
...
...
@@ -55,7 +55,7 @@ $src = $sxml['src'];
<section
class=
"b-content__form"
>
<div
class=
"wrapp"
>
<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
])
?>
"
>
<form
action=
""
class=
"b-content__form-set"
name=
"setting"
data-url=
"
<?=
$this
->
url
(
'user.cabinet.profile'
,
[
'lang'
=>
$this
->
lang
])
?>
"
data-url-success=
"
<?=
$this
->
url
(
'
home
'
,
[
'lang'
=>
$this
->
lang
])
?>
"
>
<div>
<label
for=
"setting-password"
class=
"b-content__form-set-item-label"
>
<p
class=
"text"
>
<?=
_t
(
"Старый пароль:"
)
?>
</p>
...
...
@@ -75,7 +75,7 @@ $src = $sxml['src'];
<div
class=
'wrapp-button submit'
data-action=
"
<?=
_t
(
'Ваши данные обновлены'
)
?>
"
>
<input
type=
"submit"
name=
"submit"
value=
"
<?=
_t
(
'Сохранить'
)
?>
"
>
</div>
<div
class=
"wrapp-button reset"
data-url=
"
<?=
$this
->
url
(
'
user.cabinet
'
,
[
'lang'
=>
$this
->
lang
])
?>
"
>
<div
class=
"wrapp-button reset"
data-url=
"
<?=
$this
->
url
(
'
home
'
,
[
'lang'
=>
$this
->
lang
])
?>
"
>
<input
type=
"reset"
name=
"reset"
value=
"
<?=
_t
(
'Отмена'
)
?>
"
class=
"text bold"
>
</div>
</form>
...
...
src/templates/layout/layout-main.phtml
View file @
64b85017
...
...
@@ -122,13 +122,16 @@ $urlHome = $this->url('home',['lang' => $lang]);
</header>
<div
class=
"l-popup"
>
<?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/password-reset', ['lang' => $lang]) ?>
<?= $this->partial('app::popup/confirm', ['lang' => $lang]) ?>
<?= $this->partial('app::popup/order-regected-comment', ['lang' => $lang]) ?>
<?php */
?>
<?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/password-reset'
,
[
'lang'
=>
$lang
])
?>
<?=
$this
->
partial
(
'app::popup/confirm'
,
[
'lang'
=>
$lang
])
?>
<?=
$this
->
partial
(
'app::popup/order-regected-comment'
,
[
'lang'
=>
$lang
])
?>
<?=
$this
->
partial
(
'app::popup/banner-preview'
,
[
'lang'
=>
$layoutInfo
->
getLang
()])
?>
</div>
...
...
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