$actionColumnSetting = [
'buttons' => [
'view' => function($name, $model, $key){
return Html::a('<i class="fas fa-eye" aria-hidden="true"></i>', ['update']);
},
'update' => function($name, $model, $key){
return Html::a('<i class="fas fa-pencil-alt" aria-hidden="true"></i>', ['update']);
},
'delete' => function($name, $model, $key){
return Html::a('<i class="fas fa-trash" aria-hidden="true"></i>', ['delete']);
}
],
];
\Yii::$container->set(ActionColumn::class, $actionColumnSetting);
$actionColumnSetting = [
'buttons' => [
'view' => function($name, $model, $key){
return Html::a('<i class="fas fa-eye" aria-hidden="true"></i>', ['edit']);
},
'update' => function($name, $model, $key){
return Html::a('<i class="fas fa-pencil-alt" aria-hidden="true"></i>', ['update']);
},
'delete' => function($name, $model, $key){
return Html::a('<i class="fas fa-trash" aria-hidden="true"></i>', ['delete']);
},
'archive' => function($name, $model, $key){
return Html::a('<i class="fas fa-trash" aria-hidden="true"></i>', ['archive']);
}
],
];
\Yii::$container->set(ActionColumn::class, $actionColumnSetting);
public function isAnswerExists($answers){}
$question = 1;
foreach ($questions as $key => $question) {
$questionPoint = new QuestionPoint($question);
$questionPoint->isAnswerExists($question, $answer)
}
<?php $form = ActiveForm::begin([
'layout'=>'horizontal',
'options' => ['class' => 'signup-form form-register1'],
'fieldConfig' => [
'template' => "{label}\n{beginWrapper}\n{input}\n{hint}\n{error}\n{endWrapper}",
'horizontalCssClasses' => [
'label' => 'col-sm-4',
'offset' => 'col-sm-offset-4',
'wrapper' => 'col-sm-8',
'error' => '',
'hint' => '',
],
],
]); ?>
<?= Html::activeLabel($model, 'password') ?>
<?= Html::activePasswordInput($model, 'password') ?>
<?= Html::error($model, 'password') ?>
or
<?= Html::activeLabel($model, 'username', ['label' => 'name']) ?>
<?= Html::activeTextInput($model, 'username') ?>
<div class="hint-block">Please enter your name</div>
<?= Html::error($model, 'username') ?>
'gridOptions'=>[
'dataProvider'=>$dataProvider,
'filterModel'=>$searchModel,
'showPageSummary'=>true,
'panel'=>[
'heading'=>'<h3 class="panel-title"><i class="glyphicon glyphicon-book"> Library',
'before'=>'{dynagrid}' . Html::a('Custom Button', '#', ['class'=>'btn btn-default'])
],
]
/*<!--Устраняем баг Select2-->*/
$(document).ready(function () {
$.fn.modal.Constructor.prototype.enforceFocus = function () {
};
});
/*<!--/Устраняем баг Select2-->*/
$(".select2me-filter").select2("destroy");
... Here do option updates you need
$(".select2me-filter").select2();
'modules'=>[
'dynagrid'=> [
'class'=>'\kartik\dynagrid\Module',
// other module settings
],
'gridview'=> [
'class'=>'\kartik\grid\Module',
// other module settings
],
];
<?= \kartik\dynagrid\DynaGrid::widget([
'columns' => $columns,
'theme'=>'panel-warning',
'gridOptions'=>[
'dataProvider'=>$dataProvider,
'filterModel'=>$searchModel,
'showPageSummary'=>true,
'panel'=>[
'heading'=>'<h3 class="panel-title"><i class="glyphicon glyphicon-book"> Library',
'before'=>'{dynagrid}' . Html::a('Custom Button', '#', ['class'=>'btn btn-secondary'])
],
]
]); ?>
<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;