Commit 1b6899f7 authored by Олег Гиммельшпах's avatar Олег Гиммельшпах

Merge branch 'master' of git.task-on.com:ktask/task-on.com

parents 0750eff1 f9f3ff8c
......@@ -25,9 +25,9 @@ return [
'main' => ['class' => 'common\modules\main\main'],
'utility' => ['class' => 'c006\utility\migration\Module'],
'triggers' => ['class' => 'common\modules\triggers\Module'],
'school' => ['class' => 'common\modules\school\Module'],
'rbac' => ['class' => 'common\modules\rbac\rbac'],
'message-template' => ['class' => 'common\modules\messageTemplate\Module'],
'school' => ['class' => 'common\modules\school\Module'],
'rbac' => ['class' => 'common\modules\rbac\rbac'],
],
'components' => [
'session' => [
......
......@@ -28,12 +28,12 @@ class Module extends \common\components\WebModule
public static function name()
{
return 'Управление шаблонами';
return 'Управление письмами';
}
public static function description()
{
return 'Управление шаблонами';
return 'Управление письмами';
}
......@@ -45,7 +45,7 @@ class Module extends \common\components\WebModule
public static function adminMenu()
{
return [
'Управление шаблонами' => '/message-template/template-admin/manage'
'Управление письмами' => '/message-template/template-admin/manage'
];
}
}
......@@ -12,7 +12,10 @@ use Yii;
use common\components\AdminController;
use common\modules\messageTemplate\models\MessageTemplate;
use yii\data\ActiveDataProvider;
use yii\swiftmailer\Message;
use yii\web\HttpException;
use yii\web\NotFoundHttpException;
use yii\web\ServerErrorHttpException;
use common\modules\messageTemplate\components\Templates;
class TemplateAdminController extends AdminController {
......@@ -25,10 +28,23 @@ class TemplateAdminController extends AdminController {
'Manage' => 'Управление шаблонами',
'Create' => 'Добавление шаблона',
'Update' => 'Редактирование шаблона',
'Delete' => 'Удаление шаблона'
'Delete' => 'Удаление шаблона',
'Copy' => 'Создание копии'
];
}
public function actionCopy($id){
/** @var MessageTemplate $model */
/** @var MessageTemplate $model_two */
$model = new MessageTemplate();
$model_two = $this->findModel($id);
$model->attributes=$model_two->attributes;
if ($model->save())
$this->redirect(['update', 'id' => $model->getPrimaryKey()]);
else
throw new ServerErrorHttpException('Копирование не удалось', 500);
}
/**
* @return string
*/
......
......@@ -61,7 +61,7 @@ class MessageTemplate extends \common\components\ActiveRecordModel
public function attributeLabels()
{
return [
'id' => 'ID',
'id' => 'ID шаблона',
'name' => 'Название',
'template' => 'Шаблон',
'created_at' => 'Дата создания',
......
......@@ -19,11 +19,23 @@ use yii\grid\GridView;
'id',
'name',
'template:html',
[
'attribute' => 'template',
'format' => 'html',
'options' => [
'style' => 'width: 200px;'
]
],
'created_at:datetime',
[
'class' => 'yii\grid\ActionColumn',
'template' => '{update}{delete}',
'template' => '{double}{update}{delete}',
'buttons' => [
'double' => function($url, $model) {
$url = \yii\helpers\Url::toRoute(['/message-template/template-admin/copy', 'id' => $model->id]);
return \yii\helpers\Html::a('<span class="glyphicon"><img src="/img/copy.png"></span>', $url, ['title' => 'Сделать дубликат']);
}
]
],
],
]); ?>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment