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
cac0c014
Commit
cac0c014
authored
Jul 12, 2016
by
andre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#1302
parent
cef961e2
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
0 deletions
+40
-0
common/modules/cases/controllers/CasesAdminController.php
common/modules/cases/controllers/CasesAdminController.php
+2
-0
common/modules/cases/models/CaseContent.php
common/modules/cases/models/CaseContent.php
+38
-0
No files found.
common/modules/cases/controllers/CasesAdminController.php
View file @
cac0c014
...
@@ -178,10 +178,12 @@ class CasesAdminController extends AdminController {
...
@@ -178,10 +178,12 @@ class CasesAdminController extends AdminController {
if
(
Yii
::
$app
->
request
->
isPost
)
if
(
Yii
::
$app
->
request
->
isPost
)
{
{
// print_r(Yii::$app->request->post('CaseContent'));die;
$transaction
=
Yii
::
$app
->
db
->
beginTransaction
();
$transaction
=
Yii
::
$app
->
db
->
beginTransaction
();
try
try
{
{
$category_id
=
$model
->
category_id
;
$category_id
=
$model
->
category_id
;
// $model->attributes = Yii::$app->request->post('CoContent');
// $model->attributes = Yii::$app->request->post('CoContent');
$model
->
attributes
=
Yii
::
$app
->
request
->
post
(
'CaseContent'
);
$model
->
attributes
=
Yii
::
$app
->
request
->
post
(
'CaseContent'
);
...
...
common/modules/cases/models/CaseContent.php
View file @
cac0c014
...
@@ -23,6 +23,8 @@ use common\modules\content\models\CoContent;
...
@@ -23,6 +23,8 @@ use common\modules\content\models\CoContent;
*/
*/
class
CaseContent
extends
CoContent
class
CaseContent
extends
CoContent
{
{
public
$parentClass
=
'common\modules\content\models\CoContent'
;
public
function
getPreviewType
()
public
function
getPreviewType
()
{
{
return
$this
->
hasOne
(
CasesPreviewType
::
className
(),
[
'content_id'
=>
'id'
])
->
one
();
return
$this
->
hasOne
(
CasesPreviewType
::
className
(),
[
'content_id'
=>
'id'
])
->
one
();
...
@@ -33,6 +35,33 @@ class CaseContent extends CoContent
...
@@ -33,6 +35,33 @@ class CaseContent extends CoContent
return
$this
->
previewType
=
$pwt
;
return
$this
->
previewType
=
$pwt
;
}
}
public
function
getMetaTags
(
$lang_id
=
null
)
{
$query
=
$this
->
hasMany
(
MetaTags
::
className
(),
[
'object_id'
=>
'id'
])
->
where
([
'model_id'
=>
$this
->
parentClass
]);
if
(
$lang_id
)
{
$query
->
andWhere
([
'lang_id'
=>
$lang_id
]);
}
return
$query
;
}
/**
* @return \yii\db\ActiveQuery
*/
public
function
getMetaTag
(
$lang_id
=
null
)
{
$lang_id
=
(
$lang_id
===
null
)
?
Languages
::
getCurrent
()
->
id
:
$lang_id
;
return
$this
->
hasOne
(
MetaTags
::
className
(),
[
'object_id'
=>
'id'
])
->
where
([
'model_id'
=>
$this
->
parentClass
,
'lang_id'
=>
$lang_id
]);
}
public
function
afterSave
(
$insert
,
$changedAttributes
)
public
function
afterSave
(
$insert
,
$changedAttributes
)
{
{
parent
::
afterSave
(
$insert
,
$changedAttributes
);
parent
::
afterSave
(
$insert
,
$changedAttributes
);
...
@@ -42,6 +71,15 @@ class CaseContent extends CoContent
...
@@ -42,6 +71,15 @@ class CaseContent extends CoContent
$previewType
->
attributes
=
Yii
::
$app
->
request
->
post
(
'CasesPreviewType'
);
$previewType
->
attributes
=
Yii
::
$app
->
request
->
post
(
'CasesPreviewType'
);
$previewType
->
content_id
=
$this
->
id
;
$previewType
->
content_id
=
$this
->
id
;
$previewType
->
save
();
$previewType
->
save
();
$metatags
=
MetaTags
::
find
()
->
where
([
'model_id'
=>
get_class
(
$this
)])
->
all
();
foreach
(
$metatags
as
$metatag
)
{
$metatag
->
model_id
=
$this
->
parentClass
;
$metatag
->
save
();
}
}
}
// public function __construct(array $config)
// public function __construct(array $config)
...
...
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