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
8d391c91
Commit
8d391c91
authored
Jun 17, 2016
by
andre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
копирование страниц faq
parent
713367e3
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
58 additions
and
11 deletions
+58
-11
common/modules/faq/controllers/FaqAdminController.php
common/modules/faq/controllers/FaqAdminController.php
+44
-6
common/modules/faq/models/Faq.php
common/modules/faq/models/Faq.php
+2
-2
common/modules/faq/views/faq-admin/_form.php
common/modules/faq/views/faq-admin/_form.php
+4
-2
common/modules/faq/views/faq-admin/manage.php
common/modules/faq/views/faq-admin/manage.php
+8
-1
No files found.
common/modules/faq/controllers/FaqAdminController.php
View file @
8d391c91
...
@@ -24,11 +24,12 @@ class FaqAdminController extends AdminController
...
@@ -24,11 +24,12 @@ class FaqAdminController extends AdminController
{
{
public
static
function
actionsTitles
(){
public
static
function
actionsTitles
(){
return
[
return
[
'Manage'
=>
'Управление записями'
,
'Manage'
=>
'Список страниц'
,
'Create'
=>
'Добавление записи'
,
'Create'
=>
'Добавление страницы'
,
'Update'
=>
'Редактирование записи'
,
'Copy'
=>
'Копирование страницы'
,
'Delete'
=>
'Удаление записи'
,
'Update'
=>
'Редактирование страницы'
,
'View'
=>
'Просмотр записи'
,
'Delete'
=>
'Удаление страницы'
,
'View'
=>
'Просмотр страницы'
,
'Autocomplete'
=>
'Автокомплит для поля тегов'
'Autocomplete'
=>
'Автокомплит для поля тегов'
];
];
}
}
...
@@ -111,6 +112,41 @@ class FaqAdminController extends AdminController
...
@@ -111,6 +112,41 @@ class FaqAdminController extends AdminController
]);
]);
}
}
public
function
actionCopy
(
$id
)
{
if
(
!
Yii
::
$app
->
request
->
isPost
)
{
$model
=
$this
->
findModel
(
$id
);
$model
->
url
=
null
;
}
else
{
$transaction
=
Yii
::
$app
->
db
->
beginTransaction
();
try
{
$model
=
new
Faq
;
$model
->
attributes
=
Yii
::
$app
->
request
->
post
(
'Faq'
);
if
(
$model
->
save
())
{
$transaction
->
commit
();
return
$this
->
redirect
([
'manage'
]);
}
}
catch
(
\Exception
$e
)
{
$transaction
->
rollBack
();
throw
$e
;
}
}
return
$this
->
render
(
'update'
,
[
'model'
=>
$model
,
]);
}
/**
/**
* Updates an existing Post model.
* Updates an existing Post model.
* If update is successful, the browser will be redirected to the 'view' page.
* If update is successful, the browser will be redirected to the 'view' page.
...
@@ -148,6 +184,8 @@ class FaqAdminController extends AdminController
...
@@ -148,6 +184,8 @@ class FaqAdminController extends AdminController
]);
]);
}
}
/**
/**
* Deletes an existing Post model.
* Deletes an existing Post model.
* If deletion is successful, the browser will be redirected to the 'index' page.
* If deletion is successful, the browser will be redirected to the 'index' page.
...
@@ -158,7 +196,7 @@ class FaqAdminController extends AdminController
...
@@ -158,7 +196,7 @@ class FaqAdminController extends AdminController
{
{
$this
->
findModel
(
$id
)
->
delete
();
$this
->
findModel
(
$id
)
->
delete
();
return
$this
->
redirect
([
'
index
'
]);
return
$this
->
redirect
([
'
manage
'
]);
}
}
...
...
common/modules/faq/models/Faq.php
View file @
8d391c91
...
@@ -83,13 +83,13 @@ class Faq extends \common\components\ActiveRecordModel
...
@@ -83,13 +83,13 @@ class Faq extends \common\components\ActiveRecordModel
return
[
return
[
'meta'
=>
[
'meta'
=>
[
'class'
=>
'common\components\activeRecordBehaviors\MetaTagBehavior'
,
'class'
=>
'common\components\activeRecordBehaviors\MetaTagBehavior'
,
'actions'
=>
[
'create'
,
'update'
]
'actions'
=>
[
'create'
,
'update'
,
'copy'
]
],
],
'langs'
=>
[
'langs'
=>
[
'class'
=>
'common\modules\languages\components\LanguageHelperBehavior'
,
'class'
=>
'common\modules\languages\components\LanguageHelperBehavior'
,
'field'
=>
'faq_id'
,
'field'
=>
'faq_id'
,
'langClass'
=>
'common\modules\faq\models\FaqContentLang'
,
'langClass'
=>
'common\modules\faq\models\FaqContentLang'
,
'actions'
=>
[
'create'
,
'update'
]
'actions'
=>
[
'create'
,
'update'
,
'copy'
]
],
],
// 'tags' => [
// 'tags' => [
// 'class' => 'common\modules\blog\components\TagBehavior',
// 'class' => 'common\modules\blog\components\TagBehavior',
...
...
common/modules/faq/views/faq-admin/_form.php
View file @
8d391c91
...
@@ -13,8 +13,10 @@ use common\modules\faq\assets\AdminGeneratorAsset;
...
@@ -13,8 +13,10 @@ use common\modules\faq\assets\AdminGeneratorAsset;
AdminGeneratorAsset
::
register
(
$this
);
AdminGeneratorAsset
::
register
(
$this
);
//print_r($model->getLangsHelper());die;
/* @var $this yii\web\View */
/* @var $this yii\web\View */
/* @var $model common\modules\
blog\models\Post
*/
/* @var $model common\modules\
faq\models
*/
/* @var $form yii\widgets\ActiveForm */
/* @var $form yii\widgets\ActiveForm */
?>
?>
...
@@ -48,7 +50,7 @@ AdminGeneratorAsset::register($this);
...
@@ -48,7 +50,7 @@ AdminGeneratorAsset::register($this);
<?php
$c
=
0
;
foreach
(
$model
->
getLangsHelper
()
as
$i
=>
$content
)
:
$c
++
;
?>
<?php
$c
=
0
;
foreach
(
$model
->
getLangsHelper
()
as
$i
=>
$content
)
:
$c
++
;
?>
<li
class=
"
<?=
(
$c
==
1
?
'active'
:
''
)
?>
"
><a
href=
"#lang-
<?=
$content
->
lang
->
url
?>
"
data-toggle=
"tab"
>
<?=
$content
->
lang
->
name
?>
</a></li>
<li
class=
"
<?=
(
$c
==
1
?
'active'
:
''
)
?>
"
><a
href=
"#lang-
<?=
$content
->
lang
->
url
?>
"
data-toggle=
"tab"
>
<?=
$content
->
lang
->
name
?>
</a></li>
<?php
endforeach
;
?>
<?php
endforeach
;
?>
</ul>
</ul>
<div
class=
"tab-content"
>
<div
class=
"tab-content"
>
<?php
$c
=
0
;
foreach
(
$model
->
getLangsHelper
()
as
$content
)
:
$c
++
;
<?php
$c
=
0
;
foreach
(
$model
->
getLangsHelper
()
as
$content
)
:
$c
++
;
...
...
common/modules/faq/views/faq-admin/manage.php
View file @
8d391c91
...
@@ -58,7 +58,7 @@ $this->params['breadcrumbs'][] = $this->title;
...
@@ -58,7 +58,7 @@ $this->params['breadcrumbs'][] = $this->title;
[
[
'class'
=>
'common\components\ColorActionColumn'
,
'class'
=>
'common\components\ColorActionColumn'
,
'template'
=>
'{statistics} {update} {delete}'
,
'template'
=>
'{statistics} {
copy} {
update} {delete}'
,
'buttons'
=>
[
'buttons'
=>
[
'statistics'
=>
function
(
$url
,
$model
,
$key
)
{
'statistics'
=>
function
(
$url
,
$model
,
$key
)
{
return
'<a href="'
.
Url
::
toRoute
([
'/blog/statistics-admin/manage'
,
'id'
=>
$model
->
id
])
.
'">'
.
Html
::
beginTag
(
'i'
,
[
return
'<a href="'
.
Url
::
toRoute
([
'/blog/statistics-admin/manage'
,
'id'
=>
$model
->
id
])
.
'">'
.
Html
::
beginTag
(
'i'
,
[
...
@@ -67,6 +67,13 @@ $this->params['breadcrumbs'][] = $this->title;
...
@@ -67,6 +67,13 @@ $this->params['breadcrumbs'][] = $this->title;
'class'
=>
'fa fa-area-chart fa-lg'
'class'
=>
'fa fa-area-chart fa-lg'
])
.
Html
::
endTag
(
'i'
)
.
'</a>'
;
])
.
Html
::
endTag
(
'i'
)
.
'</a>'
;
},
},
'copy'
=>
function
(
$url
,
$model
,
$key
)
{
return
'<a href="'
.
Url
::
toRoute
([
'copy'
,
'id'
=>
$model
->
id
])
.
'">'
.
Html
::
beginTag
(
'i'
,
[
'title'
=>
"Копировать страницу"
,
'data-toggle'
=>
'tooltip'
,
'class'
=>
'fa fa-copy fa-lg'
])
.
Html
::
endTag
(
'i'
)
.
'</a>'
;
},
],
],
],
],
],
],
...
...
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