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
7ff3a456
Commit
7ff3a456
authored
Feb 03, 2016
by
Олег Гиммельшпах
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix blocks content
parent
15b534c0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
12 deletions
+23
-12
common/modules/content/models/CoBlocks.php
common/modules/content/models/CoBlocks.php
+4
-4
common/modules/content/models/CoContentLang.php
common/modules/content/models/CoContentLang.php
+13
-8
console/migrations/m160203_080816_fix_content.php
console/migrations/m160203_080816_fix_content.php
+6
-0
No files found.
common/modules/content/models/CoBlocks.php
View file @
7ff3a456
...
...
@@ -4,6 +4,9 @@ namespace common\modules\content\models;
use
Yii
;
use
common\modules\languages\models\Languages
;
use
common\modules\content\models\CoBlocksLang
;
/**
* This is the model class for table "co_blocks".
*
...
...
@@ -51,12 +54,9 @@ class CoBlocks extends \common\components\ActiveRecordModel
[[
'title'
,
'name'
,
'text'
],
'required'
],
[[
'text'
],
'string'
],
[[
'category_id'
],
'safe'
],
[[
'lang'
],
'string'
,
'max'
=>
2
],
[[
'module'
],
'string'
,
'max'
=>
100
],
[[
'title'
],
'string'
,
'max'
=>
250
],
[[
'name'
],
'string'
,
'max'
=>
50
],
[[
'lang'
,
'title'
],
'unique'
,
'targetAttribute'
=>
[
'lang'
,
'title'
],
'message'
=>
'The combination of Язык and Заголовок has already been taken.'
],
[[
'lang'
,
'name'
],
'unique'
,
'targetAttribute'
=>
[
'lang'
,
'name'
],
'message'
=>
'The combination of Язык and Название (англ.) has already been taken.'
]
[[
'name'
],
'unique'
]
];
}
...
...
common/modules/content/models/CoContentLang.php
View file @
7ff3a456
...
...
@@ -6,6 +6,7 @@ use Yii;
use
common\modules\content\models\CoContent
;
use
common\modules\languages\models\Languages
;
use
common\modules\content\models\CoBlocks
;
/**
* This is the model class for table "co_content_lang".
...
...
@@ -91,28 +92,32 @@ class CoContentLang extends \common\components\ActiveRecordModel
{
$content
=
$this
->
text
;
$content
=
\common\components\AppManager
::
prepareWidget
(
$content
);
$blocks
=
CoBlocks
::
find
()
->
all
();
$arrWhatReplace
=
[];
$arrReplace
=
[];
$arrWhatReplaceNext
=
[];
$arrReplaceNext
=
[];
foreach
(
$blocks
as
$block
)
{
$blocks
=
CoBlocks
::
find
()
->
all
();
foreach
(
$blocks
as
$block
)
{
$arrWhatReplace
[]
=
'{'
.
$block
->
name
.
'}'
;
$arrReplace
[]
=
$block
->
text
;
$arrReplace
[]
=
$block
->
lang
->
text
;
$arrWhatReplaceNext
[]
=
'['
.
$block
->
name
.
']'
;
$arrReplaceNext
[]
=
$block
->
text
;
$arrReplaceNext
[]
=
$block
->
lang
->
text
;
}
$arrWhatReplaceNext
[]
=
'[about-reviews]'
;
$arrReplaceNext
[]
=
\common\modules\content\models\
CoBlocks
::
printStaticBlock
(
'about-reviews'
,
true
);
$arrReplaceNext
[]
=
CoBlocks
::
printStaticBlock
(
'about-reviews'
,
true
);
$arrWhatReplaceNext
[]
=
'[content-phone]'
;
$arrReplaceNext
[]
=
\common\models\Settings
::
getValue
(
'content-phone'
);
$arrWhatReplaceNext
[]
=
'[cases]'
;
$arrReplaceNext
[]
=
\common\modules\content\models\
CoBlocks
::
printStaticBlock
(
'cases'
,
true
);
$arrReplaceNext
[]
=
CoBlocks
::
printStaticBlock
(
'cases'
,
true
);
$arrWhatReplaceNext
[]
=
'[projects]'
;
$arrReplaceNext
[]
=
\common\modules\content\models\
CoBlocks
::
printStaticBlock
(
'projects'
,
true
);
$arrReplaceNext
[]
=
CoBlocks
::
printStaticBlock
(
'projects'
,
true
);
$arrWhatReplaceNext
[]
=
'[case-subscribe]'
;
$arrReplaceNext
[]
=
\common\modules\content\models\
CoBlocks
::
printStaticBlock
(
'case-subscribe'
,
true
);
$arrReplaceNext
[]
=
CoBlocks
::
printStaticBlock
(
'case-subscribe'
,
true
);
$arrWhatReplaceNext
[]
=
'[footer]'
;
$arrReplaceNext
[]
=
\Yii
::
$app
->
getView
()
->
render
(
'@app/views/layouts/footer'
);
$arrWhatReplaceNext
[]
=
'[footer-index]'
;
...
...
console/migrations/m160203_080816_fix_content.php
View file @
7ff3a456
...
...
@@ -11,6 +11,9 @@ class m160203_080816_fix_content extends Migration
$this
->
dropColumn
(
'co_blocks_lang'
,
'name'
);
$this
->
dropColumn
(
'co_blocks_lang'
,
'title'
);
$this
->
dropColumn
(
'co_blocks'
,
'lang'
);
$this
->
dropColumn
(
'co_blocks'
,
'module'
);
$this
->
dropColumn
(
'co_content'
,
'name'
);
$this
->
dropColumn
(
'co_content'
,
'title'
);
$this
->
dropColumn
(
'co_content'
,
'text'
);
...
...
@@ -21,6 +24,9 @@ class m160203_080816_fix_content extends Migration
$this
->
addColumn
(
'co_blocks_lang'
,
'name'
,
Schema
::
TYPE_STRING
.
'(50) NOT NULL'
);
$this
->
addColumn
(
'co_blocks_lang'
,
'title'
,
Schema
::
TYPE_STRING
.
'(250) NOT NULL'
);
$this
->
addColumn
(
'co_blocks'
,
'lang'
,
"char(2) DEFAULT 'ru'"
);
$this
->
addColumn
(
'co_blocks'
,
'module'
,
Schema
::
TYPE_STRING
.
'(100) NOT NULL'
);
$this
->
addColumn
(
'co_content'
,
'name'
,
Schema
::
TYPE_STRING
.
'(250) NOT NULL'
);
$this
->
addColumn
(
'co_content'
,
'title'
,
Schema
::
TYPE_STRING
.
'(250) NOT NULL'
);
$this
->
addColumn
(
'co_content'
,
'text'
,
'longtext DEFAULT NULL'
);
...
...
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