Commit f14e3733 authored by john's avatar john

3031

parent 34c7df0d
......@@ -20,16 +20,19 @@ use common\modules\sessions\models\Session;
class Bid extends \common\components\ActiveRecordModel
{
public $blog = false;
public $message = '';
const SCENARIO_PROJECT = 'project';
const SCENARIO_CALLBACK = 'callback';
const SCENARIO_SUBSCRIBE = 'subscribe';
const SCENARIO_BUSINESS = 'business';
const SCENARIO_DOCUMENTATION = 'documentation';
const FORM_SUBSCRIBE = 'subscribe';
const FORM_CALLBACK = 'callback';
const FORM_PROJECT = 'project';
const FORM_MESSAGE = 'message';
const FORM_BUSINESS = 'business';
const FORM_DOCUMENTATION = 'documentation';
const TAG_INVOLVEMENT = 'Вовлечение';
const TAG_TREATMENT = 'Обращение';
......@@ -39,7 +42,8 @@ class Bid extends \common\components\ActiveRecordModel
self::FORM_CALLBACK => 'Обратный звонок',
// self::FORM_SUBSCRIBE => 'Подписка',
self::FORM_MESSAGE => 'Сообщение с сайта',
self::FORM_BUSINESS => 'Расчет для бизнес решения'
self::FORM_BUSINESS => 'Расчет для бизнес решения',
self::FORM_DOCUMENTATION => 'Документация'
];
public static $tag_titles = [
......@@ -82,6 +86,8 @@ class Bid extends \common\components\ActiveRecordModel
[['name', 'phone'], 'required', 'on' => self::SCENARIO_CALLBACK],
[['name', 'message', 'text'], 'required', 'on' => self::SCENARIO_DOCUMENTATION],
[['phone'], 'required', 'on' => self::SCENARIO_BUSINESS],
[['email'], 'required', 'on' => self::SCENARIO_SUBSCRIBE],
......
......@@ -213,9 +213,9 @@ class DocumentationListAdminController extends AdminController
*/
public function actionDelete($id)
{
$items = \common\modules\documentation\models\DocContent::find()->where(['category_id' => $id])->all();
$items = \common\modules\documentation\models\DocContent::find()->where(['list_id' => $id])->all();
foreach ($items as $item) {
$item->category_id = null;
$item->list_id = null;
$item->save();
}
......
......@@ -2,8 +2,11 @@
namespace common\modules\documentation\controllers;
use common\modules\users\models\User;
use common\modules\documentation\models\DocContent;
use yii\web\NotFoundHttpException;
use yii\web\Response;
use yii\widgets\ActiveForm;
use common\modules\bids\models\Bid;
class PageController extends \common\components\BaseController
{
......@@ -12,6 +15,7 @@ class PageController extends \common\components\BaseController
{
return [
'View' => 'Просмотр контента',
'Request-access' => 'Отправить запрос',
];
}
......@@ -66,4 +70,48 @@ class PageController extends \common\components\BaseController
}
}
/**
* @return mixed
*/
public function actionRequestAccess()
{
if (\Yii::$app->request->isAjax) {
\Yii::$app->response->format = Response::FORMAT_JSON;
$model = new Bid();
$model->blog = true;
$model->scenario = Bid::SCENARIO_DOCUMENTATION;
if ($model->load(\Yii::$app->request->post())) {
$transaction = \Yii::$app->db->beginTransaction();
try {
$model->text=$model->message;
if ($model->save()) {
\Yii::$app->mailer->compose([
'html' => '@common/modules/blog/mail/messageBlog-html',
'text' => '@common/modules/blog/mail/messageBlog-text'], ['model' => $model]
)
->setFrom([\common\models\Settings::getValue('bids-support-email-from') => 'Блог Task-On'])
->setTo(\common\models\Settings::getValue('article-email'))
->setSubject("Заявка на подключения к TaskOn - " . $model->primaryKey)
->send();
$transaction->commit();
return ['success' => true];
} else {
return ActiveForm::validate($model);
}
} catch (Exception $e) {
$transaction->rollBack();
throw $e;
}
} else {
throw new NotFoundHttpException('The requested page does not exist.');
}
} else {
throw new NotFoundHttpException('The requested page does not exist.');
}
}
}
......@@ -28,7 +28,9 @@ use common\modules\documentation\models\DocList;
'attribute' => 'url',
'format' => 'raw',
'value' => function($data) {
if ($data->lang)
return Html::a($data->lang->url, Yii::$app->params['frontUrl'] . ($data->lang->url != '/' ? '/' : '') . $data->lang->url, ['target' => '_blank', 'title' => 'Просмотреть как страницу видит пользователь', 'data-toggle' => "tooltip"]);
return null;
}
],
[
......@@ -36,7 +38,7 @@ use common\modules\documentation\models\DocList;
'filter' => ArrayHelper::map(DocList::find()->all(), 'id', 'name'),
'format' => 'text',
'value' => function($data) {
if ($data->list)
if ($data->list && $data->list->lang)
return $data->list->lang->name;
return 'без пункта';
}
......
<?php
use yii\helpers\Html;
use yii\grid\GridView;
use yii\helpers\ArrayHelper;
/* @var $this yii\web\View */
/* @var $searchModel common\modules\documentation\models\SearchCoCategory */
......@@ -32,21 +32,23 @@ $parentList = $searchModel->getParentList($searchModel, 0, 0, true);
'value' => function($model)use($parentList) {
$sort = yii::$app->request->get('sort');
if (!$sort)
return '<p style="white-space: nowrap;">' . $parentList[$model->id . ' '] . '</p>';
return '<p style="white-space: nowrap;">' . ArrayHelper::getValue($parentList, $model->id . ' ', '(not set)') . '</p>';
if ($model->lang)
return $model->lang->name;
return null;
}
],
[
'attribute' => 'parent_id',
'value' => function($model) {
return $model->parent ? $model->parent->lang->name : null;
return $model->parent && $model->parent->lang ? $model->parent->lang->name : null;
}
],
[
'attribute' => 'active',
'value' => function($model) {
$list = ['0' => 'Пункт меню скрыт от пользователя ', '1' => 'Пункт меню виднен для пользователю'];
return $list[$model->active];
return ArrayHelper::getValue($list, $model->active);
}
],
// [
......
<?php
use yii\helpers\Html;
use himiklab\sortablegrid\SortableGridView
use himiklab\sortablegrid\SortableGridView;
use yii\helpers\ArrayHelper;
/* @var $this yii\web\View */
/* @var $searchModel common\modules\documentation\models\SearchCoCategory */
......@@ -35,14 +36,16 @@ SortableGridView::widget([
'attribute' => 'name',
'format' => 'raw',
'value' => function($model) {
if ($model->lang)
return'<p style="white-space: nowrap;">' . $model->lang->name . '</p>';
return null;
}
],
[
'header' => $searchModel->getAttributeLabel('parent_id'),
'attribute' => 'parent_id',
'value' => function($model) {
return $model->parent ? $model->parent->lang->name : null;
return $model->parent && $model->parent->lang ? $model->parent->lang->name : null;
}
],
[
......@@ -50,7 +53,7 @@ SortableGridView::widget([
'attribute' => 'active',
'value' => function($model) {
$list = ['0' => 'Пункт меню скрыт от пользователя ', '1' => 'Пункт меню виднен для пользователю'];
return $list[$model->active];
return ArrayHelper::getValue($list, $model->active);
}
],
],
......
......@@ -3,6 +3,7 @@
use yii\helpers\Html;
use yii\widgets\DetailView;
use yii\helpers\Url;
use yii\helpers\ArrayHelper;
/* @var $this yii\web\View */
/* @var $model common\modules\documentation\models\CoCategory */
......@@ -32,20 +33,22 @@ DetailView::widget([
[
'attribute' => 'name',
'value' => function($model) {
if ($model->lang)
return $model->lang->name;
return null;
}
],
[
'attribute' => 'parent_id',
'value' => function($model) {
return $model->parent ? $model->parent->lang->name : null;
return $model->parent && $model->parent->lang ? $model->parent->lang->name : null;
}
],
[
'attribute' => 'active',
'value' => function($model) {
$list = ['0' => 'Пункт меню скрыт от пользователя ', '1' => 'Пункт меню виднен для пользователю'];
return $list[$model->active];
return ArrayHelper::getValue($list, $model->active);
}
],
],
......
<?php
use yii\widgets\ActiveForm;
use yii\helpers\Html;
use common\modules\bids\models\Bid;
?>
<div class="hidden">
<div id="request_access" class="popup popup_2 blog_form_2">
<div class="txtbtnclose">Закрыть</div>
<span class="popup__title">Запрос на подключение</span>
<p><strong>Доступ к репозитория (исходному коду платформы Task On 2) отправляется по запросу.</strong></p>
<div class="txtbtnclose"><?= \Yii::t('blog', 'Close') ?></div>
<span class="popup__title"><?= \Yii::t('blog', 'Connection request') ?></span>
<p><strong><?= \Yii::t('blog', 'Access to the repository (the source code platform Task On 2) is sent on request. Detailed documentation can be found in the "<a href="/platforma-taskon">Developer Guide </a>"') ?></strong></p>
<br>
<form id="w2" class="valid_form bids-form blog-form" action="/blog/post/send-article" method="post" data-title="Предложить тему для блога" data-form="Предложить тему для блога" data-tag="Обращение">
<input type="hidden" name="_csrf" value="CljlC3FQnDap9Ib3Ydx0xK6gdoQ4KpBgU_wsu57IWfM9FpdIMCL4UNGm7ZEwjDWBzJkc9mJv5FE4vR7q2IwOgg==">
<div class="message-box send_secce">Заявка на статью по предложенной теме отправлена. Мы обязательно ее рассмотрим.</div>
<?php
$model = new Bid();
$model->scenario = Bid::SCENARIO_DOCUMENTATION;
$model->form = Bid::FORM_DOCUMENTATION;
$form = ActiveForm::begin([
'action' => '/documentation/page/request-access',
'enableClientValidation' => false,
'options' => [
'class' => 'valid_form bids-form blog-form',
'data-title' => 'Заявка на подключения к TaskOn - {номер заявки}',
'data-form' => 'Заявка на подключения к TaskOn - {номер заявки}',
'data-tag' => Bid::TAG_TREATMENT
],
]);
?>
<div class="message-box send_secce"><?= \Yii::t('blog', 'Connection request sent. We will consider it.') ?></div>
<div class="content">
<div class="form-group field-dynamicmodel-form">
<input type="hidden" id="dynamicmodel-form" class="not_clear" name="DynamicModel[form]" value="theme">
</div>
<?php echo $form->field($model, 'form', ['template' => '{input}'])->hiddenInput(['class' => 'not_clear']); ?>
<div class="blog_form_left50 form_resp">
<div>
<div class="form-group field-dynamicmodel-name required">
<input type="text" id="dynamicmodel-name" class="input_st" name="DynamicModel[name]" placeholder="Ваше имя *" aria-required="true">
<div class="help-block"></div>
</div>
<?php
echo $form->field($model, 'name')->textInput([
'placeholder' => \Yii::t('form', 'Your name') . '*',
'class' => 'input_st'
])->label(false);
?>
</div>
</div>
<div class="blog_form_right50 form_resp">
<div class="form-group field-dynamicmodel-email required">
<input type="text" id="dynamicmodel-email" class="input_st" name="DynamicModel[email]" placeholder="E-mail *" aria-required="true">
<?php
echo $form->field($model, 'email')->textInput([
'placeholder' => 'E-mail' . '*',
'class' => 'input_st'
])->label(false);
?>
<div class="help-block"></div>
</div>
</div>
<div class="clear"></div>
<div class="form-group field-dynamicmodel-message required">
<textarea id="dynamicmodel-message" class="sect_cont_form__textarea" name="DynamicModel[message]" placeholder=" Опишите коротко для каких задач вы хотите использовать платформу TaskOn?*" aria-required="true"></textarea>
<div class="help-block"></div>
</div>
<?php
echo $form->field($model, 'message')->textArea([
'placeholder' => \Yii::t('blog', 'Describe briefly for which tasks you want to use the TaskOn platform? *'),
'class' => 'sect_cont_form__textarea'
])->label(false);
?>
<div class="clear"></div>
<button type="submit" class="save-button btn-default button-lg">Запросить доступ</button>
<?php echo Html::submitButton(\Yii::t('blog', 'Request access'), ['class' => 'save-button btn-default button-lg']); ?>
</div>
</form>
<?php ActiveForm::end(); ?>
</div>
</div>
\ No newline at end of file
......@@ -60,13 +60,13 @@ return [
'cache' => [
'class' => 'yii\caching\FileCache',
],
'view' => [
'class' => 'rmrevin\yii\minify\View',
'base_path' => '@app/web',
'minify_path' => '@app/web/minify',
'force_charset' => 'UTF-8',
'expand_imports' => true,
],
// 'view' => [
// 'class' => 'rmrevin\yii\minify\View',
// 'base_path' => '@app/web',
// 'minify_path' => '@app/web/minify',
// 'force_charset' => 'UTF-8',
// 'expand_imports' => true,
// ],
'user' => [
'identityClass' => 'common\modules\users\models\User',
'identityCookie' => [
......
<?php
return [
'Blog' => 'Блог компании Арт Проект',
'Categories' => 'Категории',
......@@ -23,4 +24,9 @@ For example: write about CRM" => "Что хочу почитать?
'Close' => 'Закрыть',
'Please enter your e-mail' => 'Необходимо заполнить «Email»',
'You already subscribed to Art Project blog news' => 'Вы уже подписаны на новости блога',
'Connection request' => 'Запрос на подключение',
'Request access' => 'Запросить доступ',
'Access to the repository (the source code platform Task On 2) is sent on request. Detailed documentation can be found in the "<a href="/platforma-taskon">Developer Guide </a>"' => 'Доступ к репозитория (исходному коду платформы Task On 2) отправляется по запросу. С подробной документации можно ознакомиться в "<a href="/platforma-taskon">Руводстве для разработчиков</a>"',
'Describe briefly for which tasks you want to use the TaskOn platform? *' => 'Опишите коротко для каких задач вы хотите использовать платформу TaskOn?*',
'Connection request sent. We will consider it.' => 'Запрос на подключение отправлен. Мы обязательно его рассмотрим.',
];
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