diff --git a/backend/controllers/PackageController.php b/backend/controllers/PackageController.php
index 03563d0..989a0ba 100644
--- a/backend/controllers/PackageController.php
+++ b/backend/controllers/PackageController.php
@@ -18,7 +18,9 @@
use common\models\Package;
use yii\filters\AccessControl;
use yii\filters\VerbFilter;
+ use yii\helpers\Url;
use yii\web\Controller;
+ use yii\web\JsExpression;
use yii\web\NotFoundHttpException;
class PackageController extends Controller implements ControllerInterface
@@ -139,6 +141,37 @@
protected static function fieldsConfig()
{
return [
+ 'tinyMceConfig' => [
+ 'language' => 'ru',
+ 'clientOptions' => [
+ 'file_browser_callback' => new JsExpression(
+ "function(field_name, url, type, win) {
+window.open('" . Url::to(
+ [
+ 'imagemanager/manager',
+ 'view-mode' => 'iframe',
+ 'select-type' => 'tinymce',
+ ]
+ ) . "&tag_name='+field_name,'','width=800,height=540 ,toolbar=no,status=no,menubar=no,scrollbars=no,resizable=no');
+}"
+ ),
+ 'plugins' => [
+ "advlist autolink lists link charmap print preview anchor",
+ "searchreplace visualblocks code fullscreen",
+ "insertdatetime media table contextmenu paste image",
+ ],
+ 'toolbar' => "undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image | code | button",
+ 'setup' => new JsExpression('function (editor) {
+ editor.addButton("button", {
+ text: "Записаться на прием",
+ icon: false,
+ onclick: function () {
+ editor.insertContent("[[button]]");
+ }
+ });
+ }')
+ ],
+ ],
'model' => Package::className(),
'hasAlias' => true,
'languageFields' => [
diff --git a/backend/controllers/ServiceController.php b/backend/controllers/ServiceController.php
index 399bd50..72baa47 100644
--- a/backend/controllers/ServiceController.php
+++ b/backend/controllers/ServiceController.php
@@ -18,9 +18,11 @@
use common\models\Service;
use yii\filters\AccessControl;
use yii\filters\VerbFilter;
+ use yii\helpers\Url;
use yii\web\Controller;
+ use yii\web\JsExpression;
use yii\web\NotFoundHttpException;
-
+
class ServiceController extends Controller implements ControllerInterface
{
public function behaviors()
@@ -43,7 +45,7 @@
],
];
}
-
+
public function actions()
{
return [
@@ -53,7 +55,7 @@
'title' => [
'type' => Index::ACTION_COL,
],
- 'parent' => [
+ 'parent' => [
'type' => Index::RELATION_COL,
'columnConfig' => [
'relationField' => 'title',
@@ -65,7 +67,7 @@
'sort' => [
'type' => Index::POSITION_COL,
],
- 'status' => [
+ 'status' => [
'type' => Index::STATUS_COL,
],
],
@@ -105,35 +107,35 @@
],
];
}
-
+
public function findModel($id)
{
$model = Service::find()
- ->with('languages')
- ->where([ 'id' => $id ])
- ->one();
+ ->with('languages')
+ ->where([ 'id' => $id ])
+ ->one();
if ($model !== null) {
return $model;
} else {
throw new NotFoundHttpException('The requested page does not exist.');
}
}
-
+
public function newModel()
{
return new Service();
}
-
+
public function deleteModel($id)
{
$page = Service::find()
- ->with('languages.alias')
- ->where(
- [
- 'id' => $id,
- ]
- )
- ->one();
+ ->with('languages.alias')
+ ->where(
+ [
+ 'id' => $id,
+ ]
+ )
+ ->one();
$langs = call_user_func(
[
$page,
@@ -145,20 +147,58 @@
$lang->alias->delete();
}
}
-
+
return $page->delete();
}
-
+
protected static function fieldsConfig()
{
return [
+ 'tinyMceConfig' => [
+ 'language' => 'ru',
+ 'clientOptions' => [
+ 'file_browser_callback' => new JsExpression(
+ "function(field_name, url, type, win) {
+window.open('" . Url::to(
+ [
+ 'imagemanager/manager',
+ 'view-mode' => 'iframe',
+ 'select-type' => 'tinymce',
+ ]
+ ) . "&tag_name='+field_name,'','width=800,height=540 ,toolbar=no,status=no,menubar=no,scrollbars=no,resizable=no');
+}"
+ ),
+ 'plugins' => [
+ "advlist autolink lists link charmap print preview anchor",
+ "searchreplace visualblocks code fullscreen",
+ "insertdatetime media table contextmenu paste image",
+ ],
+ 'toolbar' => "undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image | code | prices | button",
+ 'setup' => new JsExpression('function (editor) {
+ editor.addButton("prices", {
+ text: "Цена",
+ icon: false,
+ onclick: function () {
+ editor.insertContent("[[prices]]");
+ }
+ });
+ editor.addButton("button", {
+ text: "Записаться на прием",
+ icon: false,
+ onclick: function () {
+ editor.insertContent("[[button]]");
+ }
+ });
+ }')
+ ],
+ ],
'model' => Service::className(),
'hasAlias' => true,
'languageFields' => [
[
- 'name' => 'title',
- 'type' => Form::STRING,
- 'decorate' => true
+ 'name' => 'title',
+ 'type' => Form::STRING,
+ 'decorate' => true,
],
[
'name' => 'body',
@@ -168,7 +208,7 @@
'fields' => [
[
'name' => 'image_id',
- 'type' => Form::IMAGE
+ 'type' => Form::IMAGE,
],
[
'name' => 'parent_id',
diff --git a/frontend/controllers/PackageController.php b/frontend/controllers/PackageController.php
index 96f4d45..e87ed5c 100644
--- a/frontend/controllers/PackageController.php
+++ b/frontend/controllers/PackageController.php
@@ -9,14 +9,14 @@
namespace frontend\controllers;
use common\models\Package;
- use yii\data\ActiveDataProvider;
use yii\web\Controller;
class PackageController extends Controller
{
public function actionView($id){
$package = Package::find()->with('language')->where(['id' => $id])->one();
-
+ $package->body = str_replace('[[button]]', ''.\Yii::t('app','Make an appointment').'', $package->body);
+
return $this->render('view', [
'package' => $package
]);
diff --git a/frontend/controllers/ServiceController.php b/frontend/controllers/ServiceController.php
index 4b1718a..3203480 100644
--- a/frontend/controllers/ServiceController.php
+++ b/frontend/controllers/ServiceController.php
@@ -118,6 +118,7 @@
$model->body = str_replace('[[prices]]', $this->renderPartial('_prices', ['prices' => $model->prices]), $model->body);
+ $model->body = str_replace('[[button]]', ''.\Yii::t('app','Make an appointment').'', $model->body);
return $this->render('view', [
'model' => $model,
'others'=> $others,
--
libgit2 0.21.4