Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
taskonsite-архив-перенесен
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Packages
Packages
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dmitry Korolev
taskonsite-архив-перенесен
Commits
8ce2bfd8
Commit
8ce2bfd8
authored
Jan 27, 2016
by
Олег Гиммельшпах
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix template and add preview image in CoContent
parent
81802671
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
268 additions
and
47 deletions
+268
-47
common/modules/content/controllers/ContentAdminController.php
...on/modules/content/controllers/ContentAdminController.php
+28
-10
common/modules/content/forms/ContentForm.php
common/modules/content/forms/ContentForm.php
+7
-0
common/modules/content/models/CoBlocks.php
common/modules/content/models/CoBlocks.php
+0
-5
common/modules/content/models/CoContent.php
common/modules/content/models/CoContent.php
+42
-0
console/migrations/m160127_070543_add_content_preview.php
console/migrations/m160127_070543_add_content_preview.php
+17
-0
frontend/views/layouts/block/cases.php
frontend/views/layouts/block/cases.php
+47
-32
frontend/views/layouts/footer-index.php
frontend/views/layouts/footer-index.php
+77
-0
frontend/views/layouts/footer.php
frontend/views/layouts/footer.php
+50
-0
frontend/web/uploads/content/27012016101816-56a86f38809a1.jpg
...tend/web/uploads/content/27012016101816-56a86f38809a1.jpg
+0
-0
No files found.
common/modules/content/controllers/ContentAdminController.php
View file @
8ce2bfd8
...
...
@@ -11,6 +11,7 @@ use common\modules\content\models\SearchCoContentData;
use
common\components\AdminController
;
use
yii\web\NotFoundHttpException
;
use
yii\filters\VerbFilter
;
use
yii\web\UploadedFile
;
/**
* ContentAdminController implements the CRUD actions for CoContent model.
...
...
@@ -143,10 +144,28 @@ class ContentAdminController extends AdminController
$model
->
name
,
];
}
//die(print_r($model->metaTag));
if
(
$model
->
load
(
Yii
::
$app
->
request
->
post
())
&&
$model
->
save
())
{
$model
->
load
(
Yii
::
$app
->
request
->
post
());
$model
->
image
=
UploadedFile
::
getInstance
(
$model
,
'image'
);
if
(
Yii
::
$app
->
request
->
isPost
&&
$model
->
validate
())
{
if
(
$model
->
image
)
{
if
(
$model
->
preview
)
{
$model
->
deletePreview
();
}
$model
->
upload
();
$model
->
image
=
null
;
}
$model
->
save
();
return
$this
->
redirect
([
'manage'
]);
}
else
{
}
$form
=
new
\common\components\BaseForm
(
'/common/modules/content/forms/ContentForm'
,
$model
);
return
$this
->
render
(
'update'
,
[
'model'
=>
$model
,
...
...
@@ -154,7 +173,6 @@ class ContentAdminController extends AdminController
'form'
=>
$form
->
out
,
]);
}
}
public
function
actionUpdatecontent
(
$content_id
,
$id
=
null
)
{
...
...
common/modules/content/forms/ContentForm.php
View file @
8ce2bfd8
...
...
@@ -3,6 +3,8 @@
use
yii\helpers\ArrayHelper
;
use
yii\helpers\Html
;
use
\common\modules\content\models\CoContent
;
$blocks
=
\common\modules\content\models\CoBlocks
::
find
()
->
all
();
$block_hint
=
''
;
if
(
count
(
$blocks
))
{
...
...
@@ -17,6 +19,9 @@ if(count($blocks)) {
return
[
'activeForm'
=>
[
'id'
=>
'controller-form'
,
'options'
=>
[
'enctype'
=>
'multipart/form-data'
],
],
'elements'
=>
[
'category_id'
=>
[
...
...
@@ -42,6 +47,8 @@ return [
'class'
=>
'form-control'
,
'hint'
=>
'Заголовок страницы виден пользователю сайта и как правило оформляется в тег <h1>. Если дизайном страницы не предусмотрен вывод заголовка, то он не будет выводиться даже если был введен в данное поле.'
,
],
(
$model
->
preview
?
Html
::
img
(
\Yii
::
$app
->
params
[
'frontUrl'
]
.
CoContent
::
PHOTO_FOLDER
.
$model
->
preview
)
:
''
),
'image'
=>
[
'type'
=>
'file'
,
'class'
=>
'form-control'
,],
'text'
=>
[
'type'
=>
'textarea'
,
'class'
=>
'form-control'
,
...
...
common/modules/content/models/CoBlocks.php
View file @
8ce2bfd8
...
...
@@ -75,11 +75,6 @@ class CoBlocks extends \common\components\ActiveRecordModel
public
static
function
printStaticBlock
(
$block
,
$addPath
=
false
)
{
return
\yii
::
$app
->
getView
()
->
render
(
'@app/views/layouts/block/'
.
$block
.
'.php'
);
if
(
$addPath
)
{
return
\yii
::
$app
->
getView
()
->
render
(
'@app/views/layouts/block/'
.
$block
.
'.php'
);
}
else
return
\yii
::
$app
->
getView
()
->
render
(
'/block/'
.
$block
);
}
public
function
afterFind
()
{
...
...
common/modules/content/models/CoContent.php
View file @
8ce2bfd8
...
...
@@ -23,6 +23,10 @@ use yii\base\Controller;
*/
class
CoContent
extends
\common\components\ActiveRecordModel
{
public
$image
;
const
PHOTO_FOLDER
=
'/uploads/content/'
;
/**
* @inheritdoc
*/
...
...
@@ -57,6 +61,7 @@ class CoContent extends \common\components\ActiveRecordModel
{
return
[
[[
'active'
,
'created_at'
,
'updated_at'
],
'integer'
],
[[
'image'
],
'file'
,
'skipOnEmpty'
=>
true
,
'extensions'
=>
'png, jpg, jpeg, gif'
],
[[
'url'
,
'name'
,
'text'
],
'required'
],
[[
'url'
,
'name'
,
'title'
],
'string'
,
'max'
=>
250
],
[[
'category_id'
,
'text'
],
'safe'
]
...
...
@@ -73,6 +78,7 @@ class CoContent extends \common\components\ActiveRecordModel
'category_id'
=>
Yii
::
t
(
'content'
,
'Category ID'
),
'url'
=>
Yii
::
t
(
'content'
,
'Url'
),
'name'
=>
Yii
::
t
(
'content'
,
'Name'
),
'image'
=>
'Превью'
,
'title'
=>
Yii
::
t
(
'content'
,
'Title'
),
'text'
=>
Yii
::
t
(
'content'
,
'Content'
),
'active'
=>
Yii
::
t
(
'content'
,
'Active'
),
...
...
@@ -127,6 +133,10 @@ class CoContent extends \common\components\ActiveRecordModel
$arrReplaceNext
[]
=
\common\modules\content\models\CoBlocks
::
printStaticBlock
(
'cases'
,
true
);
$arrWhatReplaceNext
[]
=
'[case-subscribe]'
;
$arrReplaceNext
[]
=
\common\modules\content\models\CoBlocks
::
printStaticBlock
(
'case-subscribe'
,
true
);
$arrWhatReplaceNext
[]
=
'[footer]'
;
$arrReplaceNext
[]
=
\Yii
::
$app
->
getView
()
->
render
(
'@app/views/layouts/footer'
);
$arrWhatReplaceNext
[]
=
'[footer-index]'
;
$arrReplaceNext
[]
=
\Yii
::
$app
->
getView
()
->
render
(
'@app/views/layouts/footer-index'
);
return
str_replace
(
$arrWhatReplaceNext
,
$arrReplaceNext
,
str_replace
(
$arrWhatReplace
,
$arrReplace
,
$content
));
}
...
...
@@ -135,4 +145,36 @@ class CoContent extends \common\components\ActiveRecordModel
$this
->
text
=
str_replace
(
"../../../source/"
,
"/source/"
,
$this
->
text
);
return
parent
::
beforeSave
(
$insert
);
}
private
function
getPath
()
{
return
Yii
::
getAlias
(
'@frontend/web'
)
.
self
::
PHOTO_FOLDER
;
}
public
function
upload
()
{
if
(
$this
->
validate
())
{
if
(
!
file_exists
(
$this
->
getPath
()))
{
mkdir
(
$this
->
getPath
(),
0777
,
true
);
}
$this
->
preview
=
date
(
'dmYHis-'
)
.
uniqid
()
.
'.'
.
$this
->
image
->
extension
;
$this
->
image
->
saveAs
(
$this
->
getPath
()
.
$this
->
preview
);
return
true
;
}
else
{
return
false
;
}
}
public
function
deletePreview
()
{
if
(
file_exists
(
$this
->
getPath
()
.
$this
->
preview
))
{
unlink
(
$this
->
getPath
()
.
$this
->
preview
);
}
}
}
console/migrations/m160127_070543_add_content_preview.php
0 → 100644
View file @
8ce2bfd8
<?php
use
yii\db\Schema
;
use
yii\db\Migration
;
class
m160127_070543_add_content_preview
extends
Migration
{
public
function
safeUp
()
{
$this
->
addColumn
(
'co_content'
,
'preview'
,
Schema
::
TYPE_STRING
.
'(50) AFTER `active`'
);
}
public
function
safeDown
()
{
$this
->
dropColumn
(
'co_content'
,
'preview'
);
}
}
frontend/views/layouts/block/cases.php
View file @
8ce2bfd8
<div
class=
"row"
>
<?php
use
\common\modules\content\models\CoContent
;
use
yii\helpers\Html
;
$models
=
CoContent
::
find
()
->
where
([
'category_id'
=>
4
])
->
orderBy
(
'id DESC'
)
->
all
();
?>
<?php
if
(
$models
)
:
?>
<div
class=
"row"
>
<?php
foreach
(
$models
as
$model
)
:
?>
<div
class=
"col-md-6 col-xs-6 col-sm-12"
>
<div
class=
"keys_block_small"
>
<img
src=
"/images/keys_small1.jpg"
height=
"338"
width=
"455"
alt=
""
>
<div
class=
"keys_small_title"
>
Он-лайн сервис по подбору аналогов оборудования
</div>
<?=
Html
::
img
([
CoContent
::
PHOTO_FOLDER
.
$model
->
preview
],
[
'height'
=>
'338'
,
'width'
=>
'455'
])
?
>
<div
class=
"keys_small_title"
>
<?=
$model
->
title
?>
</div>
<div
class=
"keys_small_foot"
>
<a
href=
"/case/kns"
class=
"keys_small_btn_more"
><span>
Подробнее
</span></a
>
<a
href=
"#"
class=
"keys_small_tags"
>
# Big data
</a
>
<?=
Html
::
a
(
'<span>Подробнее</span>'
,
[
'/'
.
$model
->
url
],
[
'class'
=>
'keys_small_btn_more'
])
?
>
<!-- <a href="#" class="keys_small_tags"># Big data</a> --
>
</div>
</div>
</div>
<div
class=
"col-md-6 col-xs-6 col-sm-12"
>
<?php
endforeach
;
?>
<!-- <div class="col-md-6 col-xs-6 col-sm-12">
<div class="keys_block_small">
<img src="/images/keys_small2.jpg" height="338" width="455" alt="">
<div class="keys_small_title">Автоматизация освещения на АЗС</div>
...
...
@@ -18,9 +31,9 @@
<a href="#" class="keys_small_tags"># Big data</a>
</div>
</div>
</div> -->
</div>
</div>
<div
class=
"row"
>
<!-- <div class="row">
<div class="col-md-12 col-xs-12 col-sm-12">
<div class="keys_block_big">
<picture>
...
...
@@ -34,4 +47,6 @@
</div>
</div>
</div>
</div>
\ No newline at end of file
</div> -->
<?php
endif
;
?>
\ No newline at end of file
frontend/views/layouts/footer-index.php
0 → 100644
View file @
8ce2bfd8
<footer>
<div
class=
"container"
>
<div
class=
"row"
>
<div
class=
"col-md-12 col-sm-12"
>
<div
class=
"calk_form"
>
<span
class=
"calk_form__title"
>
Рассчитать проект
</span>
<span
class=
"calk_form_subtitle"
>
Готовы обсудить любой проект. Есть идея или готовое ТЗ по проекту - отправьте его нам
</span>
<form
class=
"footer_form"
id=
"form_foot"
>
<input
type=
"text"
placeholder=
"Ваше имя*"
name=
"name"
class=
"footer_form__input field-input required alphanumeric"
>
<input
type=
"tel"
placeholder=
"Телефон*"
name=
"phone"
class=
"footer_form__input field-input required alphanumeric"
>
<input
type=
"email"
placeholder=
"E-mail*"
class=
"footer_form__input field-input required email"
>
<textarea
placeholder=
"Опишите в двух словах ваш проект"
class=
"footer_form__textarea"
></textarea>
<div
class=
"file-upload_block"
>
<div
class=
"file_upload_bt"
>
<div
class=
"file-upload"
>
<label>
<input
type=
"file"
name=
"file"
>
<span>
Выбрать файл
</span>
</label>
</div>
<input
type=
"text"
id=
"filename"
class=
"filename"
disabled
>
<div
class=
"file_drop"
>
Перетащите файл в данную область
<br/>
или выберите файл с компьютера
</div>
</div>
</div>
<button
class=
"btn-default save-button"
>
Рассчитать проект
</button>
</form>
</div>
</div>
</div>
<div
class=
"row"
>
<div
class=
"col-md-4 col-xs-4 col-sm-12"
>
<a
href=
"mailto:info@task-on.com"
class=
"foot_mail"
>
info@task-on.com
</a>
</div>
<div
class=
"col-md-4 col-xs-4 col-sm-12"
><a
href=
"#zvonok_form"
class=
"zvonok_bt popup-form"
><span>
Заказать звонок
</span></a></div>
<div
class=
"col-md-4 col-xs-4 col-sm-12"
>
<div
class=
"phone_hover_foot"
>
Стоимость звонка 0 руб,
<br/>
в том числе с мобильного
</div>
<span
class=
"foot_phone"
>
<?=
\common\models\Settings
::
getValue
(
'content-phone'
);
?>
</span>
</div>
</div>
<div
class=
"footbottom_line"
>
<div
class=
"row"
>
<div
class=
"col-md-3 col-xs-3 col-sm-12"
>
<div
class=
"foot_logo"
>
<img
src=
"images/foot_logo.png"
height=
"51"
width=
"192"
alt=
""
>
</div>
</div>
<div
class=
"col-md-6 col-xs-6 col-sm-12"
>
<ul
class=
"social_link"
>
<li><a
href=
"#"
class=
"soc_item"
><i
class=
"fa fa-vk"
></i></a></li>
<li><a
href=
"#"
class=
"soc_item"
><i
class=
"fbicon"
></i></a></li>
<li><a
href=
"#"
class=
"soc_item"
><i
class=
"fa fa-youtube"
></i></a></li>
<li><a
href=
"#"
class=
"soc_item"
><i
class=
"fa fa-instagram"
></i></a></li>
<li><a
href=
"#"
class=
"soc_item"
><i
class=
"fa fa-twitter"
></i></a></li>
<li><a
href=
"#"
class=
"soc_item"
><i
class=
"gplusicon"
></i></a></li>
</ul>
</div>
<div
class=
"col-md-3 col-xs-3 col-sm-12"
>
<div
class=
"taskon"
><img
src=
"images/taskon.png"
height=
"31"
width=
"100"
alt=
""
></div>
<div
class=
"copyring"
>
Powered by Taskon
<br
/>
Собственная разработка Арт Проект
</div>
</div>
</div>
</div>
</div>
</footer>
<div
class=
"hidden"
>
<div
id=
"zvonok_form"
class=
"popup"
>
<div
class=
"txtbtnclose"
>
Закрыть
</div>
<span
class=
"popup__title"
>
Заказать звонок
</span>
<span
class=
"popup__subtittle"
>
Чтобы мы могли вам перезвонить укажите свой номер телефона:
</span>
<form
class=
"valid_form"
>
<input
type=
"text"
class=
"input_st field-input required alphanumeric"
placeholder=
"Ваше имя"
>
<input
type=
"tel"
class=
"input_st field-input required email"
placeholder=
"Ваш телефон"
>
<button
class=
"save-button popup_bt_send"
>
Заказать звонок
</button>
</form>
</div>
</div>
\ No newline at end of file
frontend/views/layouts/footer.php
0 → 100644
View file @
8ce2bfd8
<footer
style=
"padding-top:70px"
>
<div
class=
"container"
>
<div
class=
"row"
>
<div
class=
"col-md-4 col-xs-4 col-sm-12"
>
<a
href=
"mailto:info@task-on.com"
class=
"foot_mail"
>
info@task-on.com
</a>
</div>
<div
class=
"col-md-4 col-xs-4 col-sm-12"
><a
href=
"#zvonok_form"
class=
"zvonok_bt popup-form"
><span>
Заказать звонок
</span></a></div>
<div
class=
"col-md-4 col-xs-4 col-sm-12"
>
<div
class=
"phone_hover_foot"
>
Стоимость звонка 0 руб,
<br/>
в том числе с мобильного
</div>
<span
class=
"foot_phone"
>
<?=
\common\models\Settings
::
getValue
(
'content-phone'
);
?>
</span>
</div>
</div>
<div
class=
"footbottom_line"
>
<div
class=
"row"
>
<div
class=
"col-md-3 col-xs-3 col-sm-12"
>
<div
class=
"foot_logo"
>
<img
src=
"/images/foot_logo.png"
height=
"51"
width=
"192"
alt=
""
>
</div>
</div>
<div
class=
"col-md-6 col-xs-6 col-sm-12"
>
<ul
class=
"social_link"
>
<li><a
href=
"#"
class=
"soc_item"
><i
class=
"fa fa-vk"
></i></a></li>
<li><a
href=
"#"
class=
"soc_item"
><i
class=
"fbicon"
></i></a></li>
<li><a
href=
"#"
class=
"soc_item"
><i
class=
"fa fa-youtube"
></i></a></li>
<li><a
href=
"#"
class=
"soc_item"
><i
class=
"fa fa-instagram"
></i></a></li>
<li><a
href=
"#"
class=
"soc_item"
><i
class=
"fa fa-twitter"
></i></a></li>
<li><a
href=
"#"
class=
"soc_item"
><i
class=
"gplusicon"
></i></a></li>
</ul>
</div>
<div
class=
"col-md-3 col-xs-3 col-sm-12"
>
<div
class=
"taskon"
><img
src=
"/images/taskon.png"
height=
"31"
width=
"100"
alt=
""
></div>
<div
class=
"copyring"
>
Powered by Taskon
<br
/>
Собственная разработка Арт Проект
</div>
</div>
</div>
</div>
</div>
</footer>
<div
class=
"hidden"
>
<div
id=
"zvonok_form"
class=
"popup"
>
<div
class=
"txtbtnclose"
>
Закрыть
</div>
<span
class=
"popup__title"
>
Заказать звонок
</span>
<span
class=
"popup__subtittle"
>
Чтобы мы могли вам перезвонить укажите свой номер телефона:
</span>
<form
class=
"valid_form"
>
<input
type=
"text"
class=
"input_st field-input required alphanumeric"
placeholder=
"Ваше имя"
>
<input
type=
"tel"
class=
"input_st field-input required email"
placeholder=
"Ваш телефон"
>
<button
class=
"save-button popup_bt_send"
>
Заказать звонок
</button>
</form>
</div>
</div>
\ No newline at end of file
frontend/web/uploads/content/27012016101816-56a86f38809a1.jpg
0 → 100644
View file @
8ce2bfd8
70.8 KB
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