<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On
</IfModule>
<IfModule mod_rewrite.c>
# deal with admin first
RewriteCond %{REQUEST_URI} ^/(admin)
RewriteRule ^admin/assets/(.*)$ backend/web/assets/$1 [L]
RewriteRule ^admin/css/(.*)$ backend/web/css/$1 [L]
RewriteCond %{REQUEST_URI} !^/backend/web/(assets|css)/
RewriteCond %{REQUEST_URI} ^/(admin)
RewriteRule ^.*$ backend/web/index.php [L]
RewriteCond %{REQUEST_URI} ^/(assets|css|js|images)
RewriteRule ^assets/(.*)$ frontend/web/assets/$1 [L]
RewriteRule ^css/(.*)$ frontend/web/css/$1 [L]
RewriteRule ^js/(.*)$ frontend/web/js/$1 [L]
RewriteRule ^images/(.*)$ frontend/web/images/$1 [L]
RewriteRule ^(.*)$ frontend/web/$1 [L]
RewriteCond %{REQUEST_URI} !^/(frontend|backend)/web/(assets|css|js)/
RewriteCond %{REQUEST_URI} !index.php
RewriteCond %{REQUEST_FILENAME} !-f [OR]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ frontend/web/index.php
</IfModule>
namespace app;
class Bootstrap implements \yii\base\BootstrapInterface
{
/**
* Bootstrap method to be called during application bootstrap stage.
*
* @param \yii\base\Application $app the application currently running
*/
public function bootstrap($app)
{
$this->gridViewSetting();
}
/**
* Применение настроек для yii\grid\GridView и yii\widgets\DetailView
*/
protected function gridViewSetting()
{
$gridSetting = [
'tableOptions' => ['class' => 'table table-condensed'],
'options' => ['class' => 'table-responsive'],
'summary' => false
];
\Yii::$container->set('yii\grid\GridView', $gridSetting);
$viewSetting = [
'options' => ['class' => 'table'],
];
\Yii::$container->set('yii\widgets\DetailView', $viewSetting);
}
}
<?php
namespace app;
class Bootstrap implements \yii\base\BootstrapInterface
{
/**
* Bootstrap method to be called during application bootstrap stage.
*
* @param \yii\base\Application $app the application currently running
*/
public function bootstrap($app)
{
$MenuSetting = [
'iconClassPrefix' => '',
];
\Yii::$container->set('dmstr\widgets\Menu', $MenuSetting);
}
}
Yii::t()
, то в yii3 нужно будет использовать $this->app->t()
'destination' => Pdf::DEST_DOWNLOAD,
'pdf' => [
'class' => Pdf::classname(),
'mode' => Pdf::MODE_UTF8,
'format' => Pdf::FORMAT_A4,
'orientation' => Pdf::ORIENT_PORTRAIT,
'destination' => Pdf::DEST_DOWNLOAD,
'marginTop' => 15,
'marginLeft' => 10,
'marginRight' => 10,
//'cssFile' => '@backend/web/css/print-pdf.css',
'defaultFontSize' => 12,//размер шрифта
'filename' => Yii::$app->name.'.pdf',
'methods' => [
//'SetHeader' => ['Service Desk||Generated On: ' . date("Y-m-d H:i:s")],
'SetFooter'=>[
'content' => '{DATE j-m-Y H:m} || #{PAGENO}',
],
]
],
/**
* @return \yii\db\ActiveQuery
*/
public function getAppointmentsJudges(): ActiveQuery
{
return $this->hasMany(Appointment::className(), ['event_id' => 'id'])
->joinWith(['certification', 'certification.comitet', 'certification.category'])
->with(['profile'])
->andWhere([Judge::tableName().'.role' => Judge::ROLE]);
}
'components' => [
'user' => [
'identityClass' => 'app\models\User',
],
],
/**
* @return \yii\db\ActiveQuery
*/
public function getСontact()
{
return $this->hasOne(Сontact::className(), ['user_id' => 'id']);
}
Yii::$app->user->contact
$model = User::find()->all();
$model->contact;
Ошибку typeerror аргумент 1 принят к приложение\контроллеры\пользователь\SecurityController::getUserEvent() должен быть экземпляр dektrium\пользователь\модели\Пользователь, экземпляр приложения\модели\пользователя, данные, называется в /применения/mamp/htdocs в/строительного/контроллеры/пользователей/SecurityController.php в строке 153
app\models\User
должна быть dektrium\user\models\User
//.......
'user' => [
'identityClass' => dektrium\user\models\User',
//...
],
//.......
public function behaviors()
{
return [
'access' => [
'class' => \yii\filters\AccessControl::className(),
'rules' => [
// allow authenticated users
[
'allow' => true,
'matchCallback' => function ($rule, $action) {
if (Yii::$app->user->id == 1){
return false;
} else {
return true;
}
}
],
// everything else is denied
],
],
];
}
15 мая 2018, то такой код подойдет
<?= Yii::$app->formatter->asDate($item->date, 'long')?>
мая
<?= Yii::$app->formatter->asDate($item->date, 'php:M')?>
<?= Yii::$app->formatter->asDate($item->date, 'php:d.M H:i')?>
'language' => 'ru-RU',
'timeZone' => 'Europe/Moscow',
$query = new Query();
$query->select(['profile.user_id as id, CONCAT_WS(" ", profile.last_name, profile.name, profile.middle_name) AS text'])
->from('profile')
->leftJoin('user','profile.user_id = user.id','user.id = 10')
->leftJoin('auth_assignment','auth_assignment.user_id = profile.user_id')
->where('CONCAT_WS(" ", last_name, name, middle_name) LIKE :search')
->params([':search' => '%' . $search . '%'])
->orderBy(['last_name' => 'SORT_ASC', 'name' => 'SORT_ASC', 'middle_name' => 'SORT_ASC'])
->andWhere(['auth_assignment.item_name'=>'organizer'])
->andWhere(['user.status'=>\common\models\User::STATUS_ACTIVE])
->limit(20);
$command = $query->createCommand();
$data = $command->queryAll();
/**
* @return string User full name
*/
public function getFullName()
{
return $this->name . ' ' . $this->surname;
}
return ArrayHelper::map(self::find()->all(), 'id', 'fullName');
// "kartik-v/yii2-widget-select2"
var $hasSelect2 = $(widgetOptionsRoot.widgetItem).find('[data-krajee-select2]');
if ($hasSelect2.length > 0) {
$hasSelect2.each(function() {
var id = $(this).attr('id');
var configSelect2 = eval($(this).attr('data-krajee-select2'));
if ($(this).data('select2')) {
$(this).select2('destroy');
}
var configDepdrop = $(this).data('depdrop');
if (configDepdrop) {
configDepdrop = $.extend(true, {}, configDepdrop);
$(this).removeData().off();
$(this).unbind();
_restoreKrajeeDepdrop($(this));
}
var s2LoadingFunc = typeof initSelect2Loading != 'undefined' ? initSelect2Loading : initS2Loading;
var s2OpenFunc = typeof initSelect2DropStyle != 'undefined' ? initSelect2Loading : initS2Loading;
$.when($('#' + id).select2(configSelect2)).done(s2LoadingFunc(id, '.select2-container--krajee'));
var kvClose = 'kv_close_' + id.replace(/\-/g, '_');
$('#' + id).on('select2:opening', function(ev) {
s2OpenFunc(id, kvClose, ev);
});
$('#' + id).on('select2:unselect', function() {
window[kvClose] = true;
});
if (configDepdrop) {
var loadingText = (configDepdrop.loadingText) ? configDepdrop.loadingText : 'Loading ...';
initDepdropS2(id, loadingText);
}
});
}
/*
// "kartik-v/yii2-widget-select2"
var $hasSelect2 = $(widgetOptionsRoot.widgetItem).find('[data-krajee-select2]');
if ($hasSelect2.length > 0) {
$hasSelect2.each(function() {
var id = $(this).attr('id');
var configSelect2 = eval($(this).attr('data-krajee-select2'));
$(this).select2('destroy');
$.when($('#' + id).select2(configSelect2)).done(initS2Loading(id));
$('#' + id).on('select2-open', function() {
initS2Open(id)
});
if ($(this).attr('data-krajee-depdrop')) {
$(this).on('depdrop.beforeChange', function(e,i,v) {
var configDepdrop = eval($(this).attr('data-krajee-depdrop'));
var loadingText = (configDepdrop.loadingText)? configDepdrop.loadingText : 'Loading ...';
$('#' + id).select2('data', {text: loadingText});
});
$(this).on('depdrop.change', function(e,i,v,c) {
$('#' + id).select2('val', $('#' + id).val());
});
}
});
}
*/