Commit e155adc9 authored by Виталий Мурашко's avatar Виталий Мурашко

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

Conflicts:
	common/modules/school/views/course/index.php
	frontend/web/css/custom.css
Replace confirmed block
parents 4ed0f802 550fca84
......@@ -100,11 +100,27 @@ class UnisenderAPI {
return $this->callMethod(
'createCampaign',
[
'message_id' => $message_id
'message_id' => $message_id,
'defer' => 1
]
);
}
public function getLists(){
return $this->callMethod(
'getLists'
);
}
public function getContactCount($listId, $params){
$params=(array)$params;
$params['list_id'] = $listId;
return $this->callMethod(
'getContactCount',
$params
);
}
public function createEmailMessage($sender_name, $sender_email, $subject, $body, $list_id){
return $this->callMethod(
'createEmailMessage',
......@@ -118,6 +134,19 @@ class UnisenderAPI {
);
}
/**
* @param $email
* @return array
*/
public function validateSender($email){
return $this->callMethod(
'validateSender',
[
'email' => $email
]
);
}
/**
* @param array $Params
* @return string
......
......@@ -2,12 +2,13 @@
namespace common\components;
use common\modules\languages\models\Languages;
use common\modules\content\models\CoContent;
class UrlManager extends \yii\web\UrlManager {
public function parseRequest($request)
{
$pages = \common\modules\content\models\CoContent::find()->all();
$pages = CoContent::find()->where(['active' => true])->all();
$rules = [];
foreach($pages as $page)
......
......@@ -12,7 +12,7 @@ class MetaTagBehavior extends Behavior
return [
ActiveRecord::EVENT_AFTER_UPDATE => 'Save',
ActiveRecord::EVENT_AFTER_INSERT => 'Insert',
ActiveRecord::EVENT_AFTER_DELETE => 'Delete',
ActiveRecord::EVENT_BEFORE_DELETE => 'Delete',
];
}
......@@ -69,11 +69,14 @@ class MetaTagBehavior extends Behavior
public function Delete($event)
{
MetaTags::deleteAll([
'object_id' => $this->owner->id,
'model_id' => get_class($this->owner)
]);
if($this->owner->metaTags)
{
foreach ($this->owner->metaTags as $meta)
{
$meta->delete();
}
}
return true;
}
}
......@@ -13,7 +13,7 @@ class CoBlocksLangBehavior extends Behavior
return [
ActiveRecord::EVENT_AFTER_UPDATE => 'Save',
ActiveRecord::EVENT_AFTER_INSERT => 'Insert',
ActiveRecord::EVENT_AFTER_DELETE => 'Delete',
ActiveRecord::EVENT_BEFORE_DELETE => 'Delete',
];
}
......@@ -67,9 +67,13 @@ class CoBlocksLangBehavior extends Behavior
public function Delete($event)
{
CoBlocksLang::deleteAll([
'block_id' => $this->owner->id
]);
if($this->owner->langs)
{
foreach ($this->owner->langs as $lang)
{
$lang->delete();
}
}
return true;
}
......
......@@ -13,7 +13,7 @@ class CoContentLangBehavior extends Behavior
return [
ActiveRecord::EVENT_AFTER_UPDATE => 'Save',
ActiveRecord::EVENT_AFTER_INSERT => 'Insert',
ActiveRecord::EVENT_AFTER_DELETE => 'Delete',
ActiveRecord::EVENT_BEFORE_DELETE => 'Delete',
];
}
......@@ -67,9 +67,13 @@ class CoContentLangBehavior extends Behavior
public function Delete($event)
{
CoContentLang::deleteAll([
'content_id' => $this->owner->id
]);
if($this->owner->langs)
{
foreach ($this->owner->langs as $lang)
{
$lang->delete();
}
}
return true;
}
......
......@@ -28,7 +28,7 @@ class ContentAdminController extends AdminController
'Update' => 'Редактирование контента',
'Delete' => 'Удаление контента',
'View' => 'Просмотр контента',
// 'Copy' => '',
'Copy' => 'Копирование страниц',
];
}
......@@ -44,23 +44,6 @@ class ContentAdminController extends AdminController
];
}
// public function actionCopy($id)
// {
// $model = $this->findModel($id);
// $meta = $model->metaTags->attributes;
// \Yii::$app->request->setBodyParams(['MetaTags' => $meta]);
// $newPage = new CoContent();
// $data = $model->attributes;
// unset($data['id']);
// $data['url'] = '';
// $newPage->setAttributes($data);
// $newPage->name .= ' (Копия)';
// $newPage->save(false);
// $this->redirect(['manage']);
// }
/**
* Lists all CoContent models.
* @return mixed
......@@ -256,6 +239,62 @@ class ContentAdminController extends AdminController
return $this->redirect(['manage']);
}
public function actionCopy($id)
{
$model = $this->findModel($id);
$transaction = Yii::$app->db->beginTransaction();
try
{
$copy = new CoContent();
$data = $model->attributes;
unset($data['id']);
$copy->setAttributes($data);
$copy->save(false);
if($model->metaTags)
{
foreach ($model->metaTags as $mt)
{
$mtn = new \common\models\MetaTags;
$data = $mt->attributes;
unset($data['id']);
$mtn->setAttributes($data);
$mtn->object_id = $copy->id;
$mtn->save(false);
}
}
if($model->langs)
{
foreach ($model->langs as $lang)
{
$lng = new CoContentLang;
$data = $lang->attributes;
unset($data['id']);
$lng->setAttributes($data);
$lng->name .= ' (Копия)';
$lng->content_id = $copy->id;
$lng->save(false);
}
}
$transaction->commit();
}
catch (Exception $e)
{
$transaction->rollBack();
throw $e;
}
$this->redirect(['manage']);
}
/**
* Finds the CoContent model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown.
......
......@@ -29,10 +29,18 @@ use common\models\MetaTags;
*/
class CoContent extends \common\components\ActiveRecordModel
{
public $image;
const CUSTOM_DARK = 'dark';
const CUSTOM_WHITE = 'white';
const PHOTO_FOLDER = '/uploads/content/';
public $image;
public static $cutom_list = [
self::CUSTOM_DARK => 'Темный',
self::CUSTOM_WHITE => 'Светлый',
];
/**
* @inheritdoc
*/
......@@ -95,7 +103,7 @@ class CoContent extends \common\components\ActiveRecordModel
[['image'], 'file', 'skipOnEmpty' => true, 'extensions' => 'png, jpg, jpeg, gif'],
[['url'], 'required'],
[['url'], 'string', 'max' => 250],
[['category_id', 'priority'], 'safe'],
[['category_id', 'priority', 'custom'], 'safe'],
[['priority'], 'double']
];
}
......@@ -111,6 +119,7 @@ class CoContent extends \common\components\ActiveRecordModel
'url' => Yii::t('content', 'Url'),
'name' => Yii::t('content', 'Name'),
'image' => 'Превью',
'custom' => 'Заголовок',
'priority' => 'Приоритет в Sitemap',
'title' => Yii::t('content', 'Title'),
'text' => Yii::t('content', 'Content'),
......@@ -125,7 +134,7 @@ class CoContent extends \common\components\ActiveRecordModel
*/
public function getMetaTags($lang_id = null)
{
$query = $this->hasOne(MetaTags::className(), ['object_id' => 'id'])->where(['model_id' => get_class($this)]);
$query = $this->hasMany(MetaTags::className(), ['object_id' => 'id'])->where(['model_id' => get_class($this)]);
if($lang_id)
{
......
......@@ -72,6 +72,10 @@ $blocks = \common\modules\content\models\CoBlocks::find()->all();
<?= $form->field($model, 'priority')->textInput(['maxlength' => 3])->hint('По умолчанию: 0.8') ?>
<?= $form->field($model, 'custom')->dropDownList(CoContent::$cutom_list, [
'class' => 'form-control',
]) ?>
<?php if($model->preview)
{
echo Html::img(\Yii::$app->params['frontUrl'] . CoContent::PHOTO_FOLDER . $model->preview);
......
......@@ -43,15 +43,15 @@ use common\modules\content\models\CoCategory;
],
[
'class' => 'common\components\ColorActionColumn',
'template' => '{update} {delete}',
'template' => '{copy} {update} {delete}',
'buttons' => [
// '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>';
// },
'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>';
},
],
],
],
......
......@@ -94,10 +94,11 @@ class UserEAuth extends \common\components\ActiveRecordModel
$model = User::findByUsername($socialProfile['email']);
// Assign service token
$modelEAuth = $model->eauth;
$modelEAuth = $model->eauth ? $model->eauth : new UserEauth();
$modelEAuth->user_id = $model->user_id;
$modelEAuth->{$eauthField} = $socialProfile['id'];
$modelEAuth->update(false, [$eauthField]);
echo '<pre>'; die(var_dump($model)); echo '</pre>';
return $model;
}
else {
......
......@@ -157,13 +157,14 @@ class ReviewAdminController extends AdminController
if (Yii::$app->request->isPost && $model->validate())
{
if($model->image)
if($model->photo || $model->photo_delete)
{
if($model->photo)
{
$model->deletePhoto();
}
$model->deletePhoto();
$model->photo = null;
}
if($model->image)
{
$model->upload();
$model->image = null;
}
......
......@@ -15,6 +15,7 @@ return [
'type' => 'text',
],
($model->photo?Html::img(\Yii::$app->params['frontUrl'] . Reviews::PHOTO_FOLDER . $model->photo):''),
'photo_delete' => ['type' => 'checkbox', 'class' => 'form-control',],
'image' => ['type' => 'file', 'class' => 'form-control',],
'video' => ['type' => 'text', 'class' => 'form-control',],
'date' => ['type' => 'date', 'class' => 'form-control',],
......
......@@ -34,10 +34,11 @@ use Yii;
*/
class Reviews extends \common\components\ActiveRecordModel
{
public $image;
const PHOTO_FOLDER = '/uploads/reviews/';
public $image;
public $photo_delete = false;
private static $rate = [
'rate_usability' => [
0 => 'Не определено',
......@@ -65,7 +66,8 @@ class Reviews extends \common\components\ActiveRecordModel
],
];
public static function getSource($type) {
public static function getSource($type)
{
return self::$rate[$type];
}
......@@ -100,7 +102,7 @@ class Reviews extends \common\components\ActiveRecordModel
[['image'], 'file', 'skipOnEmpty' => true, 'extensions' => 'png, jpg, jpeg, gif'],
[['text', 'state', 'attendant_products'], 'string'],
[['admin_id'], 'adminIdValidate'],
[['date', 'answer', 'good', 'bad', 'date_create', 'notification_date', 'rate_usability', 'rate_loyality', 'rate_profit', 'title', 'order', 'photo', 'state', 'video'], 'safe'],
[['date', 'answer', 'good', 'bad', 'date_create', 'notification_date', 'rate_usability', 'rate_loyality', 'rate_profit', 'title', 'order', 'photo', 'state', 'video', 'photo_delete'], 'safe'],
// [['lang'], 'string', 'max' => 2],
[['title'], 'string', 'max' => 250],
[['email', 'video'], 'string', 'max' => 255]
......@@ -146,6 +148,7 @@ class Reviews extends \common\components\ActiveRecordModel
'rate_usability' => Yii::t('reviews', 'Удобство'),
'rate_loyality' => Yii::t('reviews', 'Лояльность'),
'rate_profit' => Yii::t('reviews', 'Выгода'),
'photo_delete' => 'Удалить фото'
];
}
......
......@@ -57,7 +57,7 @@
</div>
</div>
</section>
<?php if (Yii::$app->user->isGuest):?>
<?php if (!Yii::$app->user->isGuest):?>
<section class="sh_ft">
<div class="container">
<div class="row">
......@@ -69,7 +69,6 @@
echo $formLogin;
?>
<?php echo \common\modules\eauth\widgets\SocialWidget::widget(['action' => '/site/login']); ?>
<div class="usl">Проходя регистрацию вы подтверждаете<br><a href="javascript:void(0)">согласие на обработку персональных данных.</a></div>
</div>
<div class="col-md-8 col-xs-6 col-sm-12">
<div class="reg_title">Регистрация на курс <br> Лекции для менеджеров it-отрасли</div>
......@@ -80,6 +79,7 @@
</div>
</section>
<?php endif;?>
<div class="tr_foot"></div>
<footer>
<div class="container">
......@@ -139,8 +139,7 @@
echo $formLoginPopup;
?>
<?php echo \common\modules\eauth\widgets\SocialWidget::widget(['action' => '/site/login']); ?>
<span class="popup_text">Проходя регистрацию вы подтверждаете<br>
<a href="javascript:void(0)">согласие на обработку персональных данных.</a></span>
</div>
</div>
......
......@@ -11,15 +11,29 @@ $newListObject=Json::decode($newList);
if (array_key_exists('result', $newListObject) && array_key_exists('id', $newListObject['result'])) {
$newListId=$newListObject['result']['id'];
// Subscribe user to new List
$sender->subscribe(['list_ids' => $newListId, 'fields' => ['email' => $email]]);
$subscribe = $sender->subscribe(['list_ids' => $newListId, 'fields[email]' => $email]);
// Create new message
$newMessageId=$sender->createEmailMessage('bystrov', $email, 'Testing Subject', 'Testing Body <br><a href="http://www.google.com/">Testing link</a>', $newListId);
// Create new campaign
$newCampaign = $sender->createCampaign($newMessageId);
$newMessage=$sender->createEmailMessage('bystrov', $email, 'Testing Subject', 'Testing Body <br><a href="http://www.google.com/">Testing link</a><a href="{{_UnsubscribeUrl}}">Отписаться</a>', $newListId);
// Decode result
$newMessageObject=Json::decode($newMessage);
if (array_key_exists('result', $newMessageObject) && array_key_exists('message_id', $newMessageObject['result'])) {
// Get the message ID
$newMessageId=$newMessageObject['result']['message_id'];
// Create new campaign
$newCampaign = $sender->createCampaign($newMessageId);
}
}
echo 'Рассылка: '.((isset($newCampaign)) ? $newCampaign : 'Not found');
echo '<br>';
echo 'Список: '.((isset($newListId)) ? $newListId : 'Not found');
echo '<br>';
echo 'Сообщение: '.((isset($newMessageId)) ? $newMessageId : 'Not found');
\ No newline at end of file
echo 'Сообщение: '.((isset($newMessageId)) ? $newMessageId : 'Not found');
echo '<br>';
echo "<pre>";
print_r(Json::decode($subscribe));
echo "</pre>";
echo '<br>';
echo "<pre>";
print_r(Json::decode($sender->getContactCount($newListId, ['params[search]' => 'email/phone substring'])));
echo "</pre>";
\ No newline at end of file
......@@ -29,6 +29,8 @@ $elements = [
</div>
</a>',
'login_link' => '<a class="login_form_link" href="javascript:void(0)">Уже есть аккаунт?</a>',
'text-reg' => '<span class="popup_text">Проходя регистрацию вы подтверждаете<br>
<a href="javascript:void(0)">согласие на обработку персональных данных.</a></span>',
];
......
......@@ -30,6 +30,8 @@ $elements = [
</div>
</a>',
'login_popup_link' => '<a class="login_form_popup_link" href="javascript:void(0)">Уже есть аккаунт?</a>',
'text-reg' => '<span class="popup_text">Проходя регистрацию вы подтверждаете<br>
<a href="javascript:void(0)">согласие на обработку персональных данных.</a></span>',
];
......
......@@ -556,7 +556,7 @@ class User extends \common\components\ActiveRecordModel implements IdentityInter
public function isUserEmailExists($email)
{
return (bool)static::find(['email' => $email])->count();
return (bool)static::find()->where('email = :email', [':email'=>$email])->count();
}
}
<?php
use yii\db\Schema;
use yii\db\Migration;
class m160208_123717_add_column_co_content extends Migration
{
// Use safeUp/safeDown to run migration code within a transaction
public function safeUp()
{
$this->addColumn('co_content', 'custom', Schema::TYPE_STRING . '(20) DEFAULT NULL');
}
public function safeDown()
{
$this->dropColumn('co_content', 'custom');
}
}
<?php
return [
'About' => 'О компании',
'Portfolio' => 'Портфолио',
'Portfolio' => 'Кейсы',
'Blog' => 'Блог',
'Contacts' => 'Контакты',
'Analytics school' => 'Школа аналитики',
......
......@@ -5,7 +5,7 @@ use yii\helpers\Html;
$reviews = Reviews::find()
->where(['state' => 'active'])
->orderBy('created_at DESC')
->limit(2)
->limit(1)
->all();
?>
<?php if($reviews) : ?>
......
......@@ -3,7 +3,10 @@ use \common\modules\content\models\CoContent;
use yii\helpers\Html;
$models = CoContent::find()
->where(['category_id' => 4])
->where([
'category_id' => 4,
'active' => true
])
->orderBy('id DESC')
->all();
?>
......@@ -14,7 +17,7 @@ $models = CoContent::find()
<div class="col-md-6 col-xs-6 col-sm-12">
<div class="keys_block_small">
<img src="<?=CoContent::PHOTO_FOLDER . $model->preview?>" height="338" width="455">
<div class="keys_small_title"><?=$model->lang->title?></div>
<div class="keys_small_title" <?if($model->custom==CoContent::CUSTOM_WHITE){?>style="color:#fff;"<?}?>><?=$model->lang->title?></div>
<div class="keys_small_foot">
<?=Html::a('<span>Подробнее</span>', ['/'.$model->url], ['class' => 'keys_small_btn_more'])?>
<!-- <a href="#" class="keys_small_tags"># Big data</a> -->
......
......@@ -3,9 +3,15 @@ use \common\modules\content\models\CoContent;
use yii\helpers\Html;
use yii\helpers\Url;
$models = CoContent::find()->where(['category_id' => 5])->orderBy('id DESC')->all();
$models = CoContent::find()->where([
'category_id' => 5,
'active' => true
])->orderBy('id DESC')->all();
$cases = CoContent::find()->where(['category_id' => 4]);
$cases = CoContent::find()->where([
'category_id' => 4,
'active' => true
]);
?>
<?php if($models) : ?>
<div class="row">
......
......@@ -8,9 +8,9 @@ $reviews = Reviews::find()
->all();
?>
<?php if($reviews) : ?>
<section class="rev_sec">
<section class="rev_sec reviews-block">
<div class="container">
<div class="row" style="margin-top:50px;">
<div class="row" style="margin:50px -15px 0;">
<div class="col-md-12 col-xs-12 col-sm-12">
<span class="rev_title">Отзывы о нас</span>
</div>
......
......@@ -10,10 +10,10 @@
border: 1px solid #E9A2A2;
}
/* EAuth widget */
.eauth-service-id-vk .eauth-service-link:before {
.eauth-list .eauth-service-id-vk .eauth-service-link:before {
background-position: 0 -136px;
}
.eauth-service-id-google .eauth-service-link:before {
.eauth-list .eauth-service-id-google .eauth-service-link:before {
background-position: 0 -34px;
}
.eauth-service {
......@@ -24,10 +24,36 @@
margin: 0 !important;
margin-top: 10px !important;
}
.eauth-list .eauth-service-link:before, .eauth-service-link:after {
background: url("/images/auth.png") 0 0 no-repeat;
}
section .container ul:not([class]),
section .container ul:not([class]) li,
section .container ol:not([class]),
section .container ol:not([class]) li {
list-style: inherit;
}
section .container ul:not([class]),
section .container ol:not([class]) {
padding: 0 0 0 20px;
list-style-type: decimal;
}
section .container ul:not([class]) li,
section .container ol:not([class]) li {
margin: 0 0 15px 0;
color: #2d323a;
}
section.reviews-block .row {
margin-bottom: 50px;
}
a.login_form_link, a.login_form_popup_link, a.reg_popup_link, a.reg_form_link{
margin-top: 20px;
display: block;
}
#login_form, #login_form_popup{
display:none;
}
.sh_ft .popup_text, .reg_form .popup_text{
margin-top: 10px;
}
\ No newline at end of file
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