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

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

parents dc186c8f a70c73e3
......@@ -27,6 +27,7 @@ return [
'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'],
],
'components' => [
'session' => [
......
......@@ -3,12 +3,27 @@ namespace common\components;
use Yii;
use yii\web\Request;
// use yii\helpers\Url;
use common\modules\languages\models\Languages;
class LangRequest extends Request
{
private $_lang_url;
public function init()
{
$url = explode('/', $this->getUrl());
$url = $url[1];
$lang = Languages::getLangByUrl($url);
if($lang !== null && $lang->default)
{
header('Location: ' . $this->getLangUrl()); die();
}
parent::init();
}
public function getLangUrl()
{
if ($this->_lang_url === null)
......
<?php
namespace common\modules\messageTemplate;
/**
* MessageTemplate module definition class
*/
class Module extends \common\components\WebModule
{
/**
* @inheritdoc
*/
public $controllerNamespace = 'common\modules\messageTemplate\controllers';
public static $active = true;
public $menu_icons = 'fa fa-message';
/**
* @inheritdoc
*/
public function init()
{
parent::init();
// custom initialization code goes here
}
public static function name()
{
return 'Управление шаблонами';
}
public static function description()
{
return 'Управление шаблонами';
}
public static function version()
{
return '1.0';
}
public static function adminMenu()
{
return [
'Управление шаблонами' => '/message-template/template-admin/manage'
];
}
}
<?php
namespace common\modules\messageTemplate\components;
use common\modules\messageTemplate\models\MessageTemplate;
use yii\web\NotFoundHttpException;
/**
* Class Templates
* @package common\modules\messageTemplate\components
*
* @property MessageTemplate $template
*/
class Templates {
protected $template;
/**
* @param $id
* @param array $values
* @throws \yii\web\NotFoundHttpException
*/
public function __construct($id, $values=array()){
/** @var MessageTemplate $model */
$model = MessageTemplate::findOne($id);
if ($model===null)
throw new NotFoundHttpException('The requested page does not exist.');
$this->template = $model->template;
$this->setValues($values);
}
protected function setValues($values) {
$pattern = '/\{(.*?)\}/';
preg_match_all($pattern, $this->template, $result, PREG_PATTERN_ORDER);
$pseudo_vars = $result[1];
foreach($pseudo_vars as $key) {
if (array_key_exists($key, $values)) {
$this->template = str_replace('{'.$key.'}', $values[$key], $this->template);
}
if (array_key_exists(mb_strtolower($key), $values)) {
$this->template = str_replace('{'.$key.'}', $values[mb_strtolower($key)], $this->template);
}
}
}
/**
* @return MessageTemplate
*/
public function getTemplate(){
return $this->template;
}
}
\ No newline at end of file
<?php
namespace common\modules\messageTemplate\controllers;
use yii\web\Controller;
/**
* Default controller for the `MessageTemplate` module
*/
class DefaultController extends Controller
{
/**
* Renders the index view for the module
* @return string
*/
public function actionIndex()
{
return $this->render('index');
}
}
<?php
/**
* Created by PhpStorm.
* User: PHOENIX
* Date: 16.02.16
* Time: 20:42
*/
namespace common\modules\messageTemplate\controllers;
use Yii;
use common\components\AdminController;
use common\modules\messageTemplate\models\MessageTemplate;
use yii\data\ActiveDataProvider;
use yii\web\NotFoundHttpException;
use common\modules\messageTemplate\components\Templates;
class TemplateAdminController extends AdminController {
/**
* @return array|void
*/
public static function actionsTitles(){
return [
'Manage' => 'Управление шаблонами',
'Create' => 'Добавление шаблона',
'Update' => 'Редактирование шаблона',
'Delete' => 'Удаление шаблона'
];
}
/**
* @return string
*/
public function actionManage(){
$dataProvider = new ActiveDataProvider([
'query' => MessageTemplate::find()
]);
return $this->render(
'manage',
[
'dataProvider' => $dataProvider
]
);
}
/**
* @return string|\yii\web\Response
*/
public function actionCreate(){
$model = new MessageTemplate();
if ($model->load(Yii::$app->request->post())) {
if ($model->save())
return $this->redirect(
[
'manage'
]
);
}
$form = new \common\components\BaseForm('/common/modules/messageTemplate/forms/TemplateForm', $model);
return $this->render(
'create',
[
'model' => $model,
'form' => $form
]
);
}
/**
* @param $id
* @return string|\yii\web\Response
*/
public function actionUpdate($id){
/** @var MessageTemplate $model */
$model = MessageTemplate::findOne($id);
if ($model->load(Yii::$app->request->post())) {
if ($model->save())
return $this->redirect(
[
'manage'
]
);
}
$form = new \common\components\BaseForm('/common/modules/messageTemplate/forms/TemplateForm', $model);
return $this->render(
'update',
[
'model' => $model,
'form' => $form
]
);
}
/**
* @param $id
* @return \yii\web\Response
*/
public function actionDelete($id){
$this->findModel($id)->delete();
return $this->redirect(['manage']);
}
/**
* @param $id
* @return null|MessageTemplate
* @throws \yii\web\NotFoundHttpException
*/
protected function findModel($id)
{
if (($model = MessageTemplate::findOne($id)) !== null) {
return $model;
} else {
throw new NotFoundHttpException('The requested page does not exist.');
}
}
}
\ No newline at end of file
<?php
return [
'activeForm' => [
'id' => 'template-form'
],
'elements' => [
'name' => [
'type' => 'text'
],
'template' => [
'type' => 'textarea'
]
],
'buttons' => [
'submit' => ['type' => 'submit', 'value' => 'Cохранить']
]
];
\ No newline at end of file
<?php
namespace common\modules\messageTemplate\models;
use Yii;
/**
* This is the model class for table "message_template".
*
* @property integer $id
* @property string $name
* @property string $template
* @property string $created_at
*/
class MessageTemplate extends \common\components\ActiveRecordModel
{
/**
* @inheritdoc
*/
public static function tableName()
{
return 'message_template';
}
public function name()
{
return 'Шаблоны писем';
}
public function beforeSave($insert){
if (!parent::beforeSave($insert))
return false;
if ($insert && $this->created_at==null) {
$datetime = new \DateTime();
$this->created_at = $datetime->format('Y-m-d H:i:s');
}
return true;
}
public function behaviors(){
return [];
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[['name', 'template'], 'required'],
[['template'], 'string'],
[['created_at'], 'safe'],
[['name'], 'string', 'max' => 255],
];
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'id' => 'ID',
'name' => 'Название',
'template' => 'Шаблон',
'created_at' => 'Дата создания',
];
}
}
<div class="MessageTemplate-default-index">
<h1><?= $this->context->action->uniqueId ?></h1>
<p>
This is the view content for action "<?= $this->context->action->id ?>".
The action belongs to the controller "<?= get_class($this->context) ?>"
in the "<?= $this->context->module->id ?>" module.
</p>
<p>
You may customize this page by editing the following file:<br>
<code><?= __FILE__ ?></code>
</p>
</div>
<?php
/**
* @var $form common\components\BaseForm
*/
echo $form->out;
\ No newline at end of file
<?php
use yii\helpers\Html;
use yii\grid\GridView;
/* @var $this yii\web\View */
/* @var $dataProvider yii\data\ActiveDataProvider */
?>
<div class="trigger-trigger-index">
<h1><?= Html::encode($this->title) ?></h1>
<p>
<?= Html::a('Добавить шаблон', ['create'], ['class' => 'btn btn-success']) ?>
</p>
<?= GridView::widget([
'dataProvider' => $dataProvider,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
'id',
'name',
'template:html',
'created_at:datetime',
[
'class' => 'yii\grid\ActionColumn',
'template' => '{update}{delete}',
],
],
]); ?>
</div>
\ No newline at end of file
<?php
/**
* @var $form common\components\BaseForm
*/
echo $form->out;
\ No newline at end of file
<?php
use yii\db\Migration;
class m160216_145545_add_message_templates_table extends Migration
{
// Use safeUp/safeDown to run migration code within a transaction
public function safeUp()
{
$this->createTable(
'message_template',
[
'id' => $this->primaryKey(),
'name' => $this->string(255)->notNull(),
'template' => $this->text()->notNull(),
'created_at' => $this->dateTime()->notNull()
]
);
}
public function safeDown()
{
$this->dropTable(
'message_template'
);
}
}
......@@ -17,8 +17,8 @@ $more = CoContent::find()
->one();
?>
<section class="short_keys_sect">
<div class="container">
<!-- <section class="short_keys_sect">
<div class="container"> -->
<div class="row">
<div class="col-md-12 col-xs-12 col-sm-12">
<h2 class="short_keys_title">Посмотрите еще один<br/> короткий кейс</h2>
......@@ -70,8 +70,8 @@ $more = CoContent::find()
</div>
</div>
</div>
</div>
</section>
<!-- </div>
</section> -->
<style type="text/css">
.field-bid-email,
.field-bid-email input {
......
<?php
use \common\modules\content\models\CoContent;
use yii\helpers\Html;
use yii\helpers\Url;
$models = CoContent::find()
->where([
......@@ -17,7 +18,7 @@ $models = CoContent::find()
<div class="col-md-6 col-xs-6 col-sm-12">
<div class="keys_block_small">
<img src="<?=$model->preview?>" height="338" width="455">
<div class="keys_small_title" <?if($model->custom==CoContent::CUSTOM_WHITE){?>style="color:#fff;"<?}?>><?=$model->lang->title?></div>
<a href="<?=Url::to(['/'.$model->url])?>" class="keys_small_title" <?if($model->custom==CoContent::CUSTOM_WHITE){?>style="color:#fff;"<?}?>><?=$model->lang->title?></a>
<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> -->
......
......@@ -24,4 +24,5 @@
<?php $this->registerJsFile('/js/common.js', ['position' => yii\web\View::POS_END ]);?>
<?php $this->registerJsFile('/js/jquery.form.js', ['position' => yii\web\View::POS_END ]);?>
<?php $this->registerJsFile('/js/bids-form.js', ['position' => yii\web\View::POS_END ]);?>
\ No newline at end of file
<?php $this->registerJsFile('/js/bids-form.js', ['position' => yii\web\View::POS_END ]);?>
<?php $this->registerJsFile('/js/custom.js', ['position' => yii\web\View::POS_END ]);?>
\ No newline at end of file
......@@ -2,6 +2,8 @@
<meta name="keywords" content="<?php echo \Yii::$app->controller->meta_keywords?>">
<meta name="description" content="<?php echo \Yii::$app->controller->meta_description?>">
<meta name='yandex-verification' content='6f739356d418cfe3' />
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
<link rel="apple-touch-icon" href="/images/favicon/apple-touch-icon.png">
<link rel="apple-touch-icon" sizes="72x72" href="/images/favicon/apple-touch-icon-72x72.png">
......
......@@ -93,4 +93,112 @@ section.reviews-block .row {
}
.reviews-deend {
padding-bottom: 60px;
}
.keys_small_title:hover {
text-decoration: none;
}
a.toggle_bottom {
display: block;
font-size: 20px;
color: #fff;
width: 201px;
height: 47px;
border: 2px solid #fff;
text-align: center;
line-height: 40px;
border-radius: 50px;
-moz-border-radius: 50px;
-webkit-border-radius: 50px;
-o-border-radius: 50px;
-ms-border-radius: 50px;
display: block;
font-size: 20px;
color: #fff;
-moz-transition: all 0.3s linear 0.1s;
-o-transition: all 0.3s linear 0.1s;
-webkit-transition: all 0.3s linear 0.1s;
-ms-transition: all 0.3s linear 0.1s;
transition: all 0.3s linear 0.1s;
-webkit-animation-name: fadeIn;
animation-name: fadeIn;
}
a.toggle_bottom:hover, a.toggle_bottom:active, a.toggle_bottom:focus {
color: #000;
text-decoration: none;
background: #fff;
}
a.toggle_bottom:hover .icon-arrowDown2:after, a.toggle_bottom:active .icon-arrowDown2:after, a.toggle_bottom:focus .icon-arrowDown2:after {
background: url(../images/icon/arrow_down_black.png) no-repeat;
}
.e_cat_top a.toggle_bottom {
margin-top: 160px;
}
.gen_mail_top a.toggle_bottom {
margin-top: 66px;
}
.keys_appl_top a.toggle_bottom {
height: 47px;
position: relative;
top: 157px;
left: 0;
float: left;
margin-top: 0;
}
.first_neft a.toggle_bottom {
position: relative;
top: 270px;
left: 0;
float: left;
margin-top: 0;
}
.top_ops a.toggle_bottom {
position: relative;
top: 157px;
left: 0;
right: -28px;
float: right;
margin-top: 0;
}
.video_sec a.toggle_bottom {
margin-top: 153px;
}
@media (max-width: 970px) {
.e_cat_top a.toggle_bottom {
margin-top: 35px;
}
.gen_mail_top a.toggle_bottom {
margin-top: 50px;
}
}
@media (max-width: 768px) {
.top_ops a.toggle_bottom {
top: 15px;
position: relative;
float: none;
}
.first_neft a.toggle_bottom {
position: static;
top: 0;
left: 0;
float: none;
margin: 20px auto 40px;
}
.keys_appl_top a.toggle_bottom {
position: static;
top: 0;
left: 0;
float: none;
margin: 20px auto 40px;
}
}
@media only screen and (max-width: 479px) and (min-width: 320px) {
.video_sec a.toggle_bottom {
width: 270px;
font-size: 14px;
margin-top: 90px;
}
}
\ No newline at end of file
This diff is collapsed.
......@@ -53,10 +53,12 @@ $(document).ready(function() {
if ($('.dep_block_hide__btn').text() == $(this).data('show')){
$('.dep_block__hide').slideDown(1000);
$(this).text($(this).data('hide'));
$('.dep_block .line_hide').fadeTo( "slow" , 0);
}
else {
$('.dep_block__hide').slideUp(1000);
$(this).text($(this).data('show'));
$('.dep_block .line_hide').fadeTo( "slow" , 1);
}
});
......@@ -181,10 +183,10 @@ $(document).ready(function() {
} catch(err) {
};
$(".toggle_bottom").click(function() {
$("html, body").animate({ scrollTop: $(".section2").height()+120 }, "slow");
return false;
});
// $(".toggle_bottom").click(function() {
// $("html, body").animate({ scrollTop: $(".section2").height()+120 }, "slow");
// return false;
// });
$(".mouse").click(function() {
$("html, body").animate({ scrollTop: $(".video_block__title").height()+700 }, "slow");
return false;
......@@ -388,6 +390,7 @@ $(document).ready(function() {
$(".menu").removeClass("menu_active");
$(".toggle-mnu").removeClass("on");
});
});
$(window).load(function() {
......@@ -463,6 +466,32 @@ $(window).scroll(function() {
$(".mail_p5").css({
"transform" : "translate(0%, -" + st /8 + "%"
});
$(".soc_p1").css({
"transform" : "translate(0%, -" + st /8 + "%"
});
$(".soc_p2").css({
"transform" : "translate(0%, -" + st /6 + "%"
});
$(".soc_p3").css({
"transform" : "translate(0%, -" + st /4 + "%"
});
$(".e_cat_p1").css({
"transform" : "translate(0%, -" + st /6 + "%"
});
$(".e_cat_p2").css({
"transform" : "translate(0%, -" + st /4 + "%"
});
$(".e_cat_p3").css({
"transform" : "translate(0%, -" + st /8 + "%"
});
$(".e_cat_p4").css({
"transform" : "translate(0%, -" + st /4 + "%"
});
$(".e_cat_p5").css({
"transform" : "translate(0%, -" + st /8 + "%"
});
});
jQuery(function($){
$(document).mouseup(function (e){
......
$(document).ready(function() {
$("a.toggle_bottom").click(function() {
var a = $(this);
$("html, body").animate({ scrollTop: $(a.attr('href')).position().top - 50 }, "slow");
return false;
});
});
\ No newline at end of file
This diff is collapsed.
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