Commit d68f9e60 authored by Shakarim Sapa's avatar Shakarim Sapa

Merge remote-tracking branch 'origin/master'

parents e0932ea2 2e8b5fee
......@@ -168,6 +168,10 @@ JS;
$opt = $element['fileOptions'];
if(!empty($element['empty']))
$opt['value'] = $element['empty'];
if(!empty($element['inputOptions']))
$optEl['inputOptions'] = $element['inputOptions'];
if(!empty($element['inputOptions']))
$opt['inputOptions'] = $element['inputOptions'];
switch($element['type']) {
case 'checkbox':
$opt['data-render'] = 'switchery';
......@@ -191,12 +195,15 @@ JS;
case 'email':
$tmp = $this->field($this->model, $key, $optEl)->input($element['type'], $opt);
if(!empty($element['hint'])) $tmp = $tmp->hint($element['hint']);
if($element['options']['label'] === false) $tmp = $tmp->label(false);
$config['options'][] = $tmp;
break;
case 'password':
//$opt['value'] = '';
$optEl['template'] = '{label}{input}<div id="'.$element['pwd-id'].'" class="is0 m-t-5"></div>{error}';
$config['options'][] = $this->field($this->model, $key, $optEl)->input($element['type'], $opt);
$tmp = $this->field($this->model, $key, $optEl)->input($element['type'], $opt);
if($element['options']['label'] === false) $tmp = $tmp->label(false);
$config['options'][] = $tmp;
break;
case 'hidden':
$config['options'][] = $this->field($this->model, $key, $optEl)->hiddenInput($opt)->label(false);
......@@ -209,6 +216,7 @@ JS;
//$optEl['template'] = '{label}<div class="col-md-8">{input}</div>{error}{hint}';
$tmp = $this->field($this->model, $key, $optEl)->dropDownList($element['items'],$opt);
if(!empty($element['hint'])) $tmp = $tmp->hint($element['hint']);
if($element['options']['label'] === false) $tmp = $tmp->label(false);
$config['options'][] = $tmp;
break;
case 'listBox':
......@@ -272,7 +280,8 @@ JS;
if($button['type'] == 'htmlBlock')
$config['options'][] = $button['value'];
else if($button['type'] == 'submit')
$config['options'][] = \yii\helpers\Html::submitButton($button['value'], ['class'=> 'btn btn-success']);
$config['options'][] = (!empty($button['class'])) ? \yii\helpers\Html::submitButton($button['value'], ['class'=> $button['class']])
: \yii\helpers\Html::submitButton($button['value'], ['class'=> 'btn btn-success']);
else if($button['type'] == 'cancel')
$config['options'][] = \yii\helpers\Html::resetButton($button['value'], ['class'=> 'btn btn-default']);
else if($button['type'] == 'danger')
......
......@@ -121,7 +121,7 @@ JS;
if(!empty($element['options']['label']))
$optEl['labelOptions'] = ['label' => $element['options']['label']];
if(!empty($element['empty']))
$opt['value'] = $element['empty'];
$opt['value'] = $element['empty'];
switch($element['type']) {
case 'checkbox':
$opt['data-render'] = 'switchery';
......@@ -186,6 +186,7 @@ JS;
$config['options'][] = '<div style="clear: both;"></div>';
/* **************** */
}
unset($config['elements']);
if($meta) {
//die(print_r($model->metaTag));
......
......@@ -22,8 +22,6 @@ class Module extends \common\components\WebModule
public function init()
{
parent::init();
// custom initialization code goes here
}
public static function name()
......
......@@ -19,7 +19,6 @@ class BidAdminController extends AdminController
'Manage' => 'Управление заявками',
'Create' => 'Добавление заявки',
'Update' => 'Редактирование заявки',
'Delete' => 'Удаление заявки',
'View' => 'Просмотр заявки',
];
}
......@@ -103,19 +102,6 @@ class BidAdminController extends AdminController
}
}
/**
* Deletes an existing Bid model.
* If deletion is successful, the browser will be redirected to the 'index' page.
* @param integer $id
* @return mixed
*/
public function actionDelete($id)
{
$this->findModel($id)->delete();
return $this->redirect(['index']);
}
/**
* Finds the Bid model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown.
......
......@@ -4,6 +4,8 @@ namespace common\modules\bids\models;
use Yii;
use \common\models\Settings;
/**
* This is the model class for table "bids".
*
......@@ -17,11 +19,24 @@ class Bid extends \common\components\ActiveRecordModel
{
const SCENARIO_PROJECT = 'project';
const SCENARIO_CALLBACK = 'callback';
const SCENARIO_SUBSCRIBE = 'subscribe';
const FORM_SUBSCRIBE = 'subscribe';
const FORM_CALLBACK = 'callback';
const FORM_PROJECT = 'project';
const FORM_MESSAGE = 'message';
const FILE_FOLDER = '/uploads/bids/';
public $file;
public static $form_titles = [
self::FORM_PROJECT => 'Расчитать проект',
self::FORM_CALLBACK => 'Обратный звонок',
self::FORM_SUBSCRIBE => 'Подписка',
self::FORM_MESSAGE => 'Сообщение с сайта',
];
/**
* @inheritdoc
*/
......@@ -45,16 +60,18 @@ class Bid extends \common\components\ActiveRecordModel
{
return [
[['name', 'phone', 'email'], 'required', 'on' => self::SCENARIO_PROJECT],
[['email'], 'email', 'on' => self::SCENARIO_PROJECT],
[['email'], 'email'],
[['name', 'phone'], 'required', 'on' => self::SCENARIO_CALLBACK],
[['email'], 'required', 'on' => self::SCENARIO_SUBSCRIBE],
[['file'], 'file', 'skipOnEmpty' => true, 'extensions' => 'png, jpg, jpeg, gif, xls, xlsx, doc, docx, pdf'],
[['text'], 'string'],
[['name'], 'string', 'max' => 100],
[['phone'], 'string', 'max' => 30],
[['email'], 'string', 'max' => 70],
[['filename'], 'string', 'max' => 50],
[['filename', 'form'], 'string', 'max' => 50],
];
}
......@@ -71,6 +88,7 @@ class Bid extends \common\components\ActiveRecordModel
'filename' => 'Прикрепленный файл',
'file' => 'Прикрепленный файл',
'text' => 'Сообщение',
'form' => 'Форма отправки',
'created_at' => 'Дата добавления',
'updated_at' => 'Дата обновления',
];
......@@ -99,6 +117,26 @@ class Bid extends \common\components\ActiveRecordModel
public function send()
{
try
{
$email = Settings::getValue('bids-support-email');
$message = Yii::$app->controller->view->render('@common/modules/bids/views/bid/mail-all', [
'model' => $this
]);
$headers = "MIME-Version: 1.0\r\n".
"Content-Transfer-Encoding: 8bit\r\n".
"Content-Type: text/html; charset=\"UTF-8\"\r\n".
"X-Mailer: PHP v.".phpversion()."\r\n".
"From: Заявка с сайта TaskOn <robot@task-on.com>\r\n";
$subject = "Заявка с сайта TaskOn";
@mail($email, $subject, $message, $headers);
}
catch (Exception $e)
{
}
}
}
......@@ -19,7 +19,7 @@ class SearchBid extends Bid
{
return [
[['id'], 'integer'],
[['name', 'phone', 'email', 'filename', 'text', 'created_at'], 'safe'],
[['name', 'phone', 'email', 'filename', 'text', 'created_at', 'form'], 'safe'],
];
}
......@@ -60,6 +60,7 @@ class SearchBid extends Bid
// grid filtering conditions
$query->andFilterWhere([
'id' => $this->id,
'form' => $this->form,
'created_at' => ($this->created_at?strtotime($this->created_at):$this->created_at),
]);
......
......@@ -34,6 +34,14 @@ $this->params['breadcrumbs'][] = $this->title;
}
],
'text:ntext',
[
'attribute' => 'form',
'filter' => Bid::$form_titles,
'value' => function($model)
{
return ($model->form?Bid::$form_titles[$model->form]:null);
}
],
[
'attribute' => 'created_at',
'format' => ['date', 'php:d.m.Y H:i:s']
......
<?php
use yii\helpers\Html;
use common\modules\bids\models\Bid;
?>
Имя: <?=$model->name?><br>
Телефон: <?=$model->phone?><br>
Email: <?=$model->email?><br>
Сообщение: <?=$model->text?><br>
Файл: <?=($model->filename?Html::a($model->filename,\Yii::$app->params['frontUrl'].Bid::FILE_FOLDER.$model->filename):'')?><br>
Дата добавления заявки: <?=date('d.m.Y H:i:s', $model->created_at)?><br>
\ No newline at end of file
......@@ -3,6 +3,10 @@
namespace common\modules\content\models;
use Yii;
use yii\behaviors\TimestampBehavior;
use himiklab\sitemap\behaviors\SitemapBehavior;
use \yii\helpers\Url;
use common\modules\content\models\CoBlocks;
use common\modules\languages\models\Languages;
use common\models\MetaTags;
......@@ -47,7 +51,30 @@ class CoContent extends \common\components\ActiveRecordModel
],
'langs' => [
'class' => 'common\modules\content\components\CoContentLangBehavior',
]
],
'timestamp' => [
'class' => TimestampBehavior::className(),
'createdAtAttribute' => 'created_at',
'updatedAtAttribute' => 'updated_at',
'value' => time(),
],
'sitemap' => [
'class' => SitemapBehavior::className(),
'scope' => function ($model) {
/** @var \yii\db\ActiveQuery $model */
$model->select(['url', 'updated_at']);
// $model->andWhere(['is_deleted' => 0]);
},
'dataClosure' => function ($model) {
/** @var self $model */
return [
'loc' => Url::to($model->url, true),
'lastmod' => date('c', $model->updated_at),
'changefreq' => SitemapBehavior::CHANGEFREQ_DAILY,
'priority' => 0.8
];
}
],
];
}
......
......@@ -2,7 +2,9 @@
use yii\helpers\Html;
use yii\helpers\Url;
use yii\helpers\ArrayHelper;
use yii\grid\GridView;
use common\modules\content\models\CoCategory;
/* @var $this yii\web\View */
/* @var $searchModel common\modules\content\models\SearchCoContent */
......@@ -18,7 +20,7 @@ use yii\grid\GridView;
<?= \common\components\zii\AdminGrid::widget([
'dataProvider' => $dataProvider,
//'filterModel' => $searchModel,
'filterModel' => $searchModel,
'columns' => [
// 'name',
//'url:url',
......@@ -26,11 +28,12 @@ use yii\grid\GridView;
'attribute' => 'url',
'format' => 'raw',
'value' => function($data) {
return Html::a($data->url, 'http://soc-zaim.ru/'.$data->url, ['target' => '_blank', 'title' => 'Просмотреть как страницу видит пользователь', 'data-toggle'=>"tooltip"]);$data->category->name;
return Html::a($data->url, Yii::$app->params['frontUrl'].($data->url!='/'?'/':'').$data->url, ['target' => '_blank', 'title' => 'Просмотреть как страницу видит пользователь', 'data-toggle'=>"tooltip"]);$data->category->name;
}
],
[
'attribute' => 'category_id',
'filter' => ArrayHelper::map(CoCategory::find()->all(), 'id', 'name'),
'format' => 'text',
'value' => function($data) {
if(!empty($data->category))
......
......@@ -3,14 +3,14 @@
namespace common\modules\faq\models;
use Yii;
use \common\components\validators\TransliterateValidator;
use yii\behaviors\TimestampBehavior;
use \yii\helpers\StringHelper;
use \common\models\MetaTags;
use yii\helpers\Url;
use yii\db\Expression;
use himiklab\sitemap\behaviors\SitemapBehavior;
use \common\models\MetaTags;
use \common\components\validators\TransliterateValidator;
/**
* This is the model class for table "faq".
*
......@@ -44,23 +44,6 @@ class Faq extends \common\components\ActiveRecordModel
'meta' => [
'class' => 'common\components\activeRecordBehaviors\MetaTagBehavior',
],
'sitemap' => [
'class' => SitemapBehavior::className(),
'scope' => function ($model) {
/** @var \yii\db\ActiveQuery $model */
$model->select(['url', 'updated_at']);
// $model->andWhere(['is_deleted' => 0]);
},
'dataClosure' => function ($model) {
/** @var self $model */
return [
'loc' => Url::to($model->url, true),
'lastmod' => date('c', $model->updated_at),
'changefreq' => SitemapBehavior::CHANGEFREQ_DAILY,
'priority' => 0.8
];
}
],
'timestamp' => [
'class' => TimestampBehavior::className(),
'createdAtAttribute' => 'created_at',
......
......@@ -79,7 +79,7 @@ class AuthItem extends \common\components\ActiveRecordModel
}
public function getAssignment() {
return $this->hasOne(AuthAssignment::className(), ['name' => 'item_name']);
return $this->hasMany(AuthAssignment::className(), ['item_name' => 'name']);
}
public function relations()
......@@ -97,7 +97,6 @@ class AuthItem extends \common\components\ActiveRecordModel
'auth_items_childs(parent, child)',
'condition' => 'type = "' . self::TYPE_TASK . '"'
),
'assignments' => array(self::HAS_MANY, 'AuthAssignment', 'itemname'),
'users' => array(self::HAS_MANY, 'User', 'userid', 'through' => 'assignments')
);
}
......@@ -188,7 +187,8 @@ class AuthItem extends \common\components\ActiveRecordModel
if(!$roles)
{
$roles = $this->findAllByAttributes(array(
'type' => self::TYPE_ROLE
//'type' => self::TYPE_ROLE
'rule_name' => 'group'
));
}
return $roles;
......
......@@ -6,6 +6,7 @@ use common\components\BaseController;
use common\modules\school\models\Courses;
use common\modules\school\models\SearchCourses;
use common\modules\school\models\SearchLessons;
use common\modules\users\models\User;
class CourseController extends BaseController
{
......@@ -23,7 +24,9 @@ class CourseController extends BaseController
$search = \Yii::$app->request->queryParams;
$dataProvider = $searchModel->search($search);
return $this->render('index', ['dataProvider' => $dataProvider]);
$modelUser = new User();
$form = new \common\components\BaseForm('/common/modules/users/forms/RegistrationUserForm', $modelUser);
return $this->render('index', ['dataProvider' => $dataProvider, 'form' => $form->out]);
}
public function actionView($id)
......
......@@ -26,7 +26,6 @@ class Courses extends \common\components\ActiveRecordModel
self::TYPE_DV => 'в разработке',
];
public static function tableName()
{
return 'courses';
......
......@@ -49,12 +49,9 @@
<div class="container">
<div class="row">
<div class="col-md-4 col-xs-6 col-sm-12">
<form class="sh_reg_form">
<input type="text" class="input_st field-input required alphanumeric" placeholder="Ваше имя*">
<input type="tel" class="input_st field-input required alphanumeric" placeholder="Телефон*">
<input type="email" class="input_st field-input required email" placeholder="E-mail*">
<button class="save-button sh_bt_send">Записаться</button>
</form>
<?php
echo $form;
?>
<div class="usl">Проходя регистрацию вы подтверждаете<br><a href="#">согласие на обработку персональных данных.</a></div>
</div>
<div class="col-md-8 col-xs-6 col-sm-12">
......
......@@ -46,7 +46,7 @@ class UserController extends \common\components\BaseController {
}
public function loadModel($id) {
public function loadModel($id, $scopes = array(), $attribute = NULL) {
$model = User::model()->findByPk((int)$id);
if ($model === null) {
$this->pageNotFound();
......@@ -104,14 +104,15 @@ class UserController extends \common\components\BaseController {
public function actionRegistration() {
$model = new User;
die('');
$model = new User();
$model->scenario = User::SCENARIO_REGISTRATION;
$form = new BaseForm('users.RegistrationForm', $model);
/* $form = new BaseForm('users.RegistrationForm', $model);
$this->performAjaxValidation($model);
unset($form->elements['captcha']);
$is_created = false;
$is_created = false;*/
if (isset($_POST['User'])) {
$model->attributes = $_POST['User'];
......
<?php
use yii\helpers\Url;
use common\modules\users\models\User;
$elements = [
'name' => ['type' => 'text', 'placeholder'=>"Ваше имя*", 'options'=>['label'=>false],
'inputOptions'=>['class'=>'input_st field-input required alphanumeric']],
'email' => ['type' => 'text', 'placeholder'=>"E-mail*", 'options'=>['label'=>false],
'inputOptions'=>['class'=>'input_st field-input required alphanumeric']],
'password' => ['type' => 'password', 'placeholder'=>"Придумайте пароль*", 'options'=>['label'=>false],
'inputOptions'=>['class'=>'input_st field-input required alphanumeric']],
'password_c' => ['type' => 'password', 'placeholder'=>"Повторите пароль*", 'options'=>['label'=>false],
'inputOptions'=>['class'=>'input_st field-input required alphanumeric']],
'phone' => ['type' => 'text', 'placeholder'=>"Телефон", 'options'=>['label'=>false],
'inputOptions'=>['class'=>'input_st field-input required alphanumeric']],
'teltext' => '<div class="teltext-block">Для участие в проводимых конкурсах укажите Ваш реальный номер телефона,
что бы мы смогли вас оповестить о результатах</div>',
'occupation' => [
'type' => 'dropdownlist',
'items' => User::$occupation_list,
'placeholder'=>"Род занятий",
'options'=>['label'=>false],
'empty'=>'Чем вы занимаетесь',
'inputOptions'=>['class'=>'input_st field-input required alphanumeric']
],
];
return [
'activeForm'=>[
'id' => 'sh_reg_form',
'options' => [
//'onsubmit'=>"ajaxSubmit(url: ".Url::toRoute(['/users/user/registration']).")";
'enctype' => 'multipart/form-data'
],
],
'elements' => $elements,
'buttons' => [
'submit' => ['type' => 'submit', 'value' => 'Записаться', 'class'=>"save-button sh_bt_send"]
]
];
......@@ -16,7 +16,12 @@ use \common\modules\rbac\models\AuthAssignment;
class User extends \common\components\ActiveRecordModel implements IdentityInterface
{
const PAGE_SIZE = 10;
const OCCUPATION_CHIEF_IT = 1;
const OCCUPATION_MANAGER_IT = 2;
const OCCUPATION_CREATOR = 3;
const OCCUPATION_NOT_IT = 4;
const STATUS_ACTIVE = 'active';
const STATUS_NEW = 'new';
const STATUS_BLOCKED = 'blocked';
......@@ -63,6 +68,14 @@ class User extends \common\components\ActiveRecordModel implements IdentityInter
public $tmp; //for external using. no delete!
// public $post;
public static $occupation_list = [
self::OCCUPATION_CHIEF_IT => 'Руководитель в IT сфере',
self::OCCUPATION_MANAGER_IT => 'Менеджер в IT сфере',
self::OCCUPATION_CREATOR => 'Разработчик',
self::OCCUPATION_NOT_IT => 'Не работаю в IT',
];
public function behaviors()
{
return [
......@@ -91,7 +104,8 @@ class User extends \common\components\ActiveRecordModel implements IdentityInter
"send_email" => "Отправить уведомление на почту",
"generate_new" => "Сгенерировать пароль автоматически",
"post" => "Должность",
"status" => "Активен / заблокирован"
"status" => "Активен / заблокирован",
"occupation" => "Род занятий",
));
return $attrs;
......@@ -136,7 +150,7 @@ class User extends \common\components\ActiveRecordModel implements IdentityInter
self::SCENARIO_CHANGE_PASSWORD,
self::SCENARIO_CREATE,
], 'message' => 'Пожалуйста, укажите пароль'],
[['password'], 'string', 'min' => 4, 'on' => [
[['password'], 'string', 'min' => 7, 'on' => [
self::SCENARIO_REGISTRATION,
self::SCENARIO_CHANGE_PASSWORD,
self::SCENARIO_UPDATE,
......@@ -183,6 +197,7 @@ class User extends \common\components\ActiveRecordModel implements IdentityInter
self::SCENARIO_SEARCH,
self::SCENARIO_CREATE,
]],
[['occupation'], 'integer', 'max' => 11],
[['tmp','role','sort','fio','name', 'surname','email', 'mobile_phone'], 'safe'],
];
}
......@@ -355,8 +370,8 @@ class User extends \common\components\ActiveRecordModel implements IdentityInter
public function relations()
{
return array(
'assignment' => array(self::HAS_ONE, 'AuthAssignment', 'userid'),
'city' => array(self::BELONGS_TO, 'City', 'city_id')
'assignment' => array(self::HAS_ONE, 'AuthAssignment', 'user_id'),
'city' => array(self::BELONGS_TO, 'City', 'city_id')
);
}
......@@ -394,18 +409,23 @@ class User extends \common\components\ActiveRecordModel implements IdentityInter
public function getRole()
{
/*$assigment = AuthAssignment::find(['userid' => $this->id])->one();
$auth = AuthItem::find()->joinWith('assignment', true)
->andWhere(['rule_name' => 'group'])
->andWhere(['auth_assignment.user_id' => $this->id])
->one();
if (!$assigment)
return $auth->name;
/*$assigment = AuthAssignment::find(['userid' => $this->id])->one();
if (!$assigment)
{
$assigment = new AuthAssignment();
$assigment = new AuthAssignment();
$assigment->item_name = AuthItem::ROLE_DEFAULT;
$assigment->user_id = $this->id;
$assigment->save(false);
}
return $assigment->role;*/
return 'admin';
return $assigment->role;
return 'admin';*/
}
public function getRoleName()
......
<?php
use yii\db\Schema;
use yii\db\Migration;
class m160204_213447_add_field_to_users_table extends Migration
{
public function safeUp()
{
$this->addColumn('users', 'occupation', Schema::TYPE_INTEGER . '(11)');
}
public function safeDown()
{
$this->dropColumn('users', 'occupation');
}
}
<?php
use yii\db\Schema;
use yii\db\Migration;
class m160205_084445_addcolumn_bids extends Migration
{
// Use safeUp/safeDown to run migration code within a transaction
public function safeUp()
{
$this->addColumn('bids', 'form', Schema::TYPE_STRING . '(50) DEFAULT NULL');
}
public function safeDown()
{
$this->dropColumn('bids', 'form');
}
}
......@@ -22,40 +22,26 @@ return [
'school' => ['class' => 'common\modules\school\Module',],
'bids' => ['class' => 'common\modules\bids\Module'],
'testings' => ['class' => 'common\modules\testings\Module',],
'users' => ['class' => 'common\modules\users\users',],
'sitemap' => [
'class' => 'himiklab\sitemap\Sitemap',
'models' => [
// your models
'common\modules\faq\models\Faq',
'common\modules\content\models\CoContent',
],
'urls'=> [
// your additional urls
[
'loc' => '/faq',
'changefreq' => \himiklab\sitemap\behaviors\SitemapBehavior::CHANGEFREQ_DAILY,
'priority' => 0.8,
'faq' => [
'publication' => [
'name' => 'Вопрос-Ответ',
'language' => 'ru',
],
// 'access' => 'Subscription',
// 'genres' => 'Blog, UserGenerated',
// 'publication_date' => 'YYYY-MM-DDThh:mm:ssTZD',
// 'title' => 'Example Title',
// 'keywords' => 'example, keywords, comma-separated',
// 'stock_tickers' => 'NASDAQ:A, NASDAQ:B',
],
// 'images' => [
// [
// 'loc' => 'http://example.com/image.jpg',
// 'caption' => 'This is an example of a caption of an image',
// 'geo_location' => 'City, State',
// 'title' => 'Example image',
// 'license' => 'http://example.com/license',
// ],
// ],
],
// // your additional urls
// [
// 'loc' => '/faq',
// 'changefreq' => \himiklab\sitemap\behaviors\SitemapBehavior::CHANGEFREQ_DAILY,
// 'priority' => 0.8,
// 'faq' => [
// 'publication' => [
// 'name' => 'Вопрос-Ответ',
// 'language' => 'ru',
// ],
// ],
// ],
],
'enableGzip' => true, // default is false
'cacheExpire' => 1, // 1 second. Default is 24 hours
......@@ -81,7 +67,7 @@ return [
//'css_linebreak_pos' => false,
],
'user' => [
'identityClass' => 'common\modules\scoring\models\ScClient',
'identityClass' => 'common\modules\users\models\User',
'loginUrl' => ['/site/login'],
'enableAutoLogin' => true,
],
......@@ -165,6 +151,7 @@ return [
'school' => 'school/course/index',
'school/course/<id>' => 'school/course/view',
'school/lesson/<id>' => 'school/lesson/view',
'login' => 'site/login',
'<page:(/)>' => 'content/page/view',
'<_m>/<_c>/<_a>/<id:\d+>' => '<_m>/<_c>/<_a>',
......@@ -178,10 +165,10 @@ return [
],
'authManager' => [
'class' => 'yii\rbac\DbManager',
/*'connectionID' => 'db',
'connectionID' => 'db',
'itemTable' => 'auth_items',
'assignmentTable' => 'auth_assignments',
'itemChildTable' => 'auth_item_child',*/
'itemChildTable' => 'auth_item_child',
'defaultRoles' => [
'user',
'moderator',
......
......@@ -3,7 +3,7 @@ namespace frontend\controllers;
use common\modules\scoring\models\ScRequest;
use Yii;
use frontend\models\LoginForm;
//use frontend\models\LoginForm;
use frontend\models\PasswordResetRequestForm;
use frontend\models\ResetPasswordForm;
use frontend\models\SignupForm;
......@@ -22,6 +22,7 @@ use common\modules\request\models\ScZodiac;
use \yii\web\Response;
use \yii\widgets\ActiveForm;
use common\modules\scoring\models\ScClient;
use common\models\LoginForm;
/**
* Site controller
......@@ -115,6 +116,14 @@ class SiteController extends BaseController
}
public function actionLogin()
{
//Yii::$app->user->getIdentity()->getRole()
$model = new LoginForm();
$model->load(Yii::$app->request->post());
$model->login();
}
/*public function actionLogin()
{
$this->layout = '//main-short';
$model = new \frontend\models\LoginForm();
......@@ -178,7 +187,7 @@ class SiteController extends BaseController
'model' => $model,
]);
}
}
}*/
public function actionLogout()
{
......
<?php
use yii\widgets\ActiveForm;
use yii\helpers\Html;
use common\modules\bids\models\Bid;
?>
<div class="hidden">
<div id="zvonok_form" class="popup">
<div class="txtbtnclose">Закрыть</div>
<span class="popup__title">Заказать звонок</span>
<span class="popup__subtittle">Чтобы мы могли вам перезвонить укажите свой номер телефона:</span>
<?php
$model = new Bid;
$model->scenario = Bid::SCENARIO_CALLBACK;
$form = ActiveForm::begin([
'action' => '/',
'options' => [
'class' => 'valid_form bids-form',
],
]); ?>
<?php echo Html::hiddenInput('scenario', $model->scenario, ['class' => 'not_clear']); ?>
<?php echo Html::hiddenInput('Bid[form]', Bid::FORM_CALLBACK, ['class' => 'not_clear']); ?>
<?php echo $form->field($model, 'name', [
'template' => '<div class="row"><div class="col-sm-4">{input}</div></div>',
'errorOptions' => []
])->textInput([
'placeholder' => 'Ваше имя',
'class' => 'input_st'
])->label(false); ?>
<?php echo $form->field($model, 'phone', [
'template' => '<div class="row"><div class="col-sm-4">{input}</div></div>',
'errorOptions' => []
])->textInput([
'placeholder' => 'Ваш телефон',
'class' => 'input_st'
])->label(false); ?>
<?php echo Html::submitButton('Заказать звонок', ['class' => 'save-button popup_bt_send']); ?>
<?php ActiveForm::end(); ?>
</div>
</div>
\ No newline at end of file
<?php
use yii\widgets\ActiveForm;
use yii\helpers\Html;
use common\modules\bids\models\Bid;
?>
<div class="row">
<div class="col-md-12 col-xs-12 col-sm-12">
<div class="keys_send_mail">
<p>Процесс создания кейса очень трудоемкий.Поэтому мы занимаемся созданием кейсов свободное от работы время. Подпишитесь, чтобы следить за обновлениями.</p>
<form class="keys_mail_form">
<input type="email" placeholder="E-mail*" class="field-input required email"></input>
<button class="save-button">Подписаться</button>
</form>
<div class="send_secce">Вы успешно подписались на обновление раздела «Кейсы». Нам приятно, что вы следите за нашим развитием :-)</div>
<?php
$model = new Bid;
$model->scenario = Bid::SCENARIO_SUBSCRIBE;
$form = ActiveForm::begin([
'action' => '/',
'options' => [
'class' => 'keys_mail_form bids-form',
],
]); ?>
<?php echo Html::hiddenInput('scenario', $model->scenario, ['class' => 'not_clear']); ?>
<?php echo Html::hiddenInput('Bid[form]', Bid::FORM_SUBSCRIBE, ['class' => 'not_clear']); ?>
<?php echo $form->field($model, 'email', [
'template' => '<div class="row"><div class="col-sm-4">{input}</div></div>',
'errorOptions' => []
])->textInput([
'placeholder' => 'E-mail*'
]); ?>
<?php echo Html::submitButton('Подписаться', ['class' => 'save-button']); ?>
<?php ActiveForm::end(); ?>
<div class="send_secce" style="display:none;">Вы успешно подписались на обновление раздела «Кейсы». Нам приятно, что вы следите за нашим развитием :-)</div>
</div>
</div>
</div>
\ No newline at end of file
......@@ -22,4 +22,6 @@
<?php $this->registerJsFile('/js/jquery.inputmask.js', ['position' => yii\web\View::POS_END ]);?>
<?php $this->registerJsFile('/js/inputmask.phone.extensions.js', ['position' => yii\web\View::POS_END ]);?>
<?php $this->registerJsFile('/js/common.js', ['position' => yii\web\View::POS_END ]);?>
\ No newline at end of file
<?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
......@@ -6,67 +6,6 @@ use yii\helpers\Url;
use common\modules\bids\models\Bid;
?>
<style type="text/css">
.footer_form input,
.footer_form textarea {
margin-bottom: 9px;
}
.field-bid-file {
margin: 0;
}
</style>
<?php
$js = <<<JS
$('#bid-phone').inputmask("phone", {
url: "js/phone-codes/phone-codes.js",
});
$('form#form_foot').on('beforeSubmit', function(e) {
var form = $(this), xhr = new XMLHttpRequest, filebool = false, file, data = new FormData();
form.find('input, textarea').each(function(){
data.append($(this).attr('name'), $(this).val());
});
if(form.find('input[type=file]').length) {
file = form.find('input[type=file]')[0].files[0];
filebool = !filebool;
data.append("Bid[file]", file);
}
xhr.open("POST", '/bids/bid/add', true);
xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
xhr.send(data);
xhr.onreadystatechange = function()
{
if (xhr.readyState == 4){
try
{
var response = JSON.parse(xhr.responseText);
}
catch(e)
{
var response = xhr.responseText;
}
if(response.success)
{
form.find('input[name!="scenario"], textarea').val('');
}
}
}
}).on('submit', function(e){
return false;
});
JS;
$this->registerJs($js);
?>
<footer>
<div class="container">
<div class="row">
......@@ -84,27 +23,38 @@ $this->registerJs($js);
'id' => 'form_foot',
'action' => '/',
'options' => [
'class' => 'footer_form',
'class' => 'footer_form bids-form',
'enctype' => 'multipart/form-data'
],
]); ?>
<?php echo Html::hiddenInput('scenario', $model->scenario); ?>
<?php echo Html::hiddenInput('scenario', $model->scenario, ['class' => 'not_clear']); ?>
<?php echo Html::hiddenInput('Bid[form]', Bid::FORM_PROJECT, ['class' => 'not_clear']); ?>
<?php echo $form->field($model, 'name')->textInput([
<?php echo $form->field($model, 'name', [
'template' => '<div class="row"><div class="col-sm-4">{input}</div></div>',
'errorOptions' => []
])->textInput([
'placeholder' => 'Ваше имя*',
'class' => 'footer_form__input'
])->label(false); ?>
]); ?>
<?php echo $form->field($model, 'phone')->textInput([
<?php echo $form->field($model, 'phone', [
'template' => '<div class="row"><div class="col-sm-4">{input}</div></div>',
'errorOptions' => []
])->textInput([
'placeholder' => 'Телефон*',
'class' => 'footer_form__input'
])->label(false); ?>
]); ?>
<?php echo $form->field($model, 'email')->textInput([
<?php echo $form->field($model, 'email', [
'template' => '<div class="row"><div class="col-sm-4">{input}</div></div>',
'errorOptions' => []
])->textInput([
'placeholder' => 'E-mail*',
'class' => 'footer_form__input'
])->label(false); ?>
]); ?>
<?php echo $form->field($model, 'text')->textArea([
'placeholder' => 'Опишите в двух словах ваш проект',
......@@ -115,7 +65,9 @@ $this->registerJs($js);
<div class="file_upload_bt">
<div class="file-upload">
<label>
<?php echo $form->field($model, 'file')->fileInput()->label(false); ?>
<?php echo $form->field($model, 'file', [
'template' => '<div class="row"><div class="col-sm-4">{input}</div></div>'
])->fileInput(); ?>
<span>Выбрать файл</span>
</label>
</div>
......@@ -166,15 +118,4 @@ $this->registerJs($js);
</div>
</footer>
<div class="hidden">
<div id="zvonok_form" class="popup">
<div class="txtbtnclose">Закрыть</div>
<span class="popup__title">Заказать звонок</span>
<span class="popup__subtittle">Чтобы мы могли вам перезвонить укажите свой номер телефона:</span>
<form class="valid_form">
<input type="text" class="input_st field-input required alphanumeric" placeholder="Ваше имя">
<input type="tel" class="input_st field-input required email" placeholder="Ваш телефон">
<button class="save-button popup_bt_send">Заказать звонок</button>
</form>
</div>
</div>
\ No newline at end of file
<?php echo $this->render('block/callback'); ?>
\ No newline at end of file
......@@ -36,15 +36,4 @@
</div>
</footer>
<div class="hidden">
<div id="zvonok_form" class="popup">
<div class="txtbtnclose">Закрыть</div>
<span class="popup__title">Заказать звонок</span>
<span class="popup__subtittle">Чтобы мы могли вам перезвонить укажите свой номер телефона:</span>
<form class="valid_form">
<input type="text" class="input_st field-input required alphanumeric" placeholder="Ваше имя">
<input type="tel" class="input_st field-input required email" placeholder="Ваш телефон">
<button class="save-button popup_bt_send">Заказать звонок</button>
</form>
</div>
</div>
\ No newline at end of file
<?php echo $this->render('block/callback'); ?>
\ No newline at end of file
......@@ -19,4 +19,5 @@
<?php $this->registerCssFile('/css/fonts.css');?>
<?php $this->registerCssFile('/css/screen.css');?>
<?php $this->registerCssFile('/css/media.css');?>
\ No newline at end of file
<?php $this->registerCssFile('/css/media.css');?>
<?php $this->registerCssFile('/css/custom.css');?>
\ No newline at end of file
......@@ -11,7 +11,7 @@ use common\modules\languages\widgets\Languages;
<div class="phone_menu"><?=\common\models\Settings::getValue('content-phone')?></div>
<ul>
<li><?=Html::a(\Yii::t('menu', 'About'), ['/about']);?></li>
<li><?=Html::a(\Yii::t('menu', 'Portfolio'), ['/case']);?></li>
<li><?=Html::a(\Yii::t('menu', 'Portfolio'), ['/portfolio']);?></li>
<li><?=Html::a(\Yii::t('menu', 'Blog'), ['/#']);?></li>
<!-- <li><?=Html::a(\Yii::t('menu', 'Analytics school'), ['/school']);?></li> -->
<li><?=Html::a(\Yii::t('menu', 'Contacts'), ['/contacts']);?></li>
......@@ -30,7 +30,7 @@ use common\modules\languages\widgets\Languages;
<nav class="top_nav clearfix">
<ul>
<li><?=Html::a(\Yii::t('menu', 'About'), ['/about']);?></li>
<li><?=Html::a(\Yii::t('menu', 'Portfolio'), ['/case']);?></li>
<li><?=Html::a(\Yii::t('menu', 'Portfolio'), ['/portfolio']);?></li>
<li><?=Html::a(\Yii::t('menu', 'Blog'), ['/#']);?></li>
<!-- <li><?=Html::a(\Yii::t('menu', 'Analytics school'), ['/school']);?></li> -->
<li><?=Html::a(\Yii::t('menu', 'Contacts'), ['/contacts']);?></li>
......
<?php
use yii\widgets\ActiveForm;
use yii\helpers\Html;
use \common\models\Settings;
use \common\modules\bids\models\Bid;
?>
<script type="text/javascript">
......@@ -75,24 +79,62 @@ use \common\models\Settings;
<div class="row">
<div class="col-md-12 col-xs-12 col-sm-12">
<div class="sect_cont_block">
<form class="sect_cont_form" id="form_foot">
<input type="text" placeholder="Ваше имя*" name="name" class="sect_cont_form__input field-input required alphanumeric">
<input type="tel" placeholder="Телефон*" name="phone" class="sect_cont_form__input field-input required alphanumeric">
<textarea placeholder="Текст сообщения" class="sect_cont_form__textarea"></textarea>
<?php
$model = new Bid;
$model->scenario = Bid::SCENARIO_CALLBACK;
$form = ActiveForm::begin([
'id' => 'form_foot',
'action' => '/',
'options' => [
'class' => 'sect_cont_form bids-form',
'enctype' => 'multipart/form-data'
],
]); ?>
<?php echo Html::hiddenInput('scenario', $model->scenario, ['class' => 'not_clear']); ?>
<?php echo Html::hiddenInput('Bid[form]', Bid::FORM_MESSAGE, ['class' => 'not_clear']); ?>
<?php echo $form->field($model, 'name', [
'template' => '<div class="row"><div class="col-sm-4">{input}</div></div>',
'errorOptions' => []
])->textInput([
'placeholder' => 'Ваше имя*',
'class' => 'sect_cont_form__input'
]); ?>
<?php echo $form->field($model, 'phone', [
'template' => '<div class="row"><div class="col-sm-4">{input}</div></div>',
'errorOptions' => []
])->textInput([
'placeholder' => 'Телефон*',
'class' => 'sect_cont_form__input'
]); ?>
<?php echo $form->field($model, 'text')->textArea([
'placeholder' => 'Опишите в двух словах ваш проект',
'class' => 'sect_cont_form__textarea'
])->label(false); ?>
<div class="file-upload_block_cs">
<div class="file_upload_bt_cs">
<div class="file-upload_cs">
<label>
<input type="file" name="file">
<span>Выбрать файл</span>
</label>
<label>
<?php echo $form->field($model, 'file', [
'template' => '<div class="row"><div class="col-sm-4">{input}</div></div>'
])->fileInput(); ?>
<span>Выбрать файл</span>
</label>
</div>
<input type="text" id="filename" class="filename_cs" disabled>
<div class="file_drop_cs">Перетащите файл в данную область<br/> или выберите файл с компьютера</div>
</div>
</div>
<button class="btn-default save-button">Отправить</button>
</form>
<?php echo Html::submitButton('Отправить', ['class' => 'btn-default save-button']); ?>
<?php ActiveForm::end(); ?>
</div>
</div>
</div>
......
.bids-form input,
.bids-form textarea {
margin-bottom: 9px;
}
.field-bid-file {
margin: 0;
}
.has-error input {
background: #fff url(../images/icon-fail.png) no-repeat 96% center;
border: 1px solid #E9A2A2;
}
\ No newline at end of file
......@@ -11458,4 +11458,10 @@ h6 {
}
.row li{
list-style: none;
}
.teltext-block{
margin-top: -40px;
margin-bottom: 15px;
color: #698387;
font-size: 14px;
}
\ No newline at end of file
$('.bids-form input[name="Bid[phone]"]').inputmask("phone", {
mask: "+7(999)999-99-99"
});
$('form.bids-form').on('beforeSubmit', function(e) {
var form = $(this), xhr = new XMLHttpRequest, filebool = false, file, data = new FormData();
form.find('input, textarea').each(function(){
data.append($(this).attr('name'), $(this).val());
});
if(form.find('input[type=file]').length) {
file = form.find('input[type=file]')[0].files[0];
filebool = !filebool;
data.append("Bid[file]", file);
}
xhr.open("POST", '/bids/bid/add', true);
xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
xhr.send(data);
xhr.onreadystatechange = function()
{
if (xhr.readyState == 4){
try
{
var response = JSON.parse(xhr.responseText);
}
catch(e)
{
var response = xhr.responseText;
}
if(response.success)
{
form.find('input:not(.not_clear), textarea').val('');
$('.send_secce').show();
}
}
}
}).on('submit', function(e){
return false;
});
\ No newline at end of file
......@@ -580,4 +580,67 @@ jQuery(document).ready(function(){
$(this).parent().toggleClass("box_off_hide");
});
});
\ No newline at end of file
});
// prepare the form when the DOM is ready
$(document).ready(function() {
var options = {
//target: '#output2', // target element(s) to be updated with server response
beforeSubmit: showRequest, // pre-submit callback
success: showResponse, // post-submit callback
// other available options:
url: '/users/user/registration' // override for form's 'action' attribute
//type: type // 'get' or 'post', override for form's 'method' attribute
//dataType: null // 'xml', 'script', or 'json' (expected server response type)
//clearForm: true // clear all form fields after successful submit
//resetForm: true // reset the form after successful submit
// $.ajax options can be used here too, for example:
//timeout: 3000
};
// bind to the form's submit event
$('#sh_reg_form').submit(function() {
// inside event callbacks 'this' is the DOM element so we first
// wrap it in a jQuery object and then invoke ajaxSubmit
$(this).ajaxSubmit(options);
// !!! Important !!!
// always return false to prevent standard browser submit and page navigation
return false;
});
});
// pre-submit callback
function showRequest(formData, jqForm, options) {
// formData is an array; here we use $.param to convert it to a string to display it
// but the form plugin does this for you automatically when it submits the data
var queryString = $.param(formData);
// jqForm is a jQuery object encapsulating the form element. To access the
// DOM element for the form do this:
// var formElement = jqForm[0];
//alert('About to submit: \n\n' + queryString);
// here we could return false to prevent the form from being submitted;
// returning anything other than false will allow the form submit to continue
return true;
}
// post-submit callback
function showResponse(responseText, statusText, xhr, $form) {
// for normal html responses, the first argument to the success callback
// is the XMLHttpRequest object's responseText property
// if the ajaxSubmit method was passed an Options Object with the dataType
// property set to 'xml' then the first argument to the success callback
// is the XMLHttpRequest object's responseXML property
// if the ajaxSubmit method was passed an Options Object with the dataType
// property set to 'json' then the first argument to the success callback
// is the json data object returned by the server
//alert('status: ' + statusText + '\n\nresponseText: \n' + responseText +
// '\n\nThe output div should have already been updated with the responseText.');
}
\ 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