Commit 099fb87b by san58

Фильтры контроллер

1 parent 3bb0314f
...@@ -20,27 +20,9 @@ class AppAsset extends AssetBundle ...@@ -20,27 +20,9 @@ class AppAsset extends AssetBundle
public $basePath = '@webroot'; public $basePath = '@webroot';
public $baseUrl = '@web'; public $baseUrl = '@web';
public $css = [ public $css = [
"//fonts.googleapis.com/css?family=Roboto+Condensed:300,300i,400,400i,700,700i", 'css/site.css',
"//fonts.googleapis.com/css?family=Dosis:200,300,400,500,600,700",
//"/css/font-awesome.min.css",
//"/css/ionicons.min.css",
//"/css/Pe-icon-7-stroke.min.css",
"/css/owl.carousel.min.css",
// "/css/slick-theme.css",
// "/css/slick.css",
"/css/animation.css",
//"/css/bootstrap-select.min.css",
"/css/styles.css",
]; ];
public $js = [ public $js = [
//'/app.js',
// "js/vit-gallery.js",
// "js/jquery.countTo.js",
// "js/jquery.appear.min.js",
// "js/isotope.pkgd.min.js",
// "js/bootstrap-select.js",
// "js/jquery.littlelightbox.js",
]; ];
public $depends = [ public $depends = [
'yii\web\YiiAsset', 'yii\web\YiiAsset',
......
...@@ -20,12 +20,9 @@ class MainAsset extends AssetBundle ...@@ -20,12 +20,9 @@ class MainAsset extends AssetBundle
public $basePath = '@webroot'; public $basePath = '@webroot';
public $baseUrl = '@web'; public $baseUrl = '@web';
public $css = [ public $css = [
//'css/site.css', 'css/site.css',
]; ];
public $js = [ public $js = [
"/js/owl.carousel.min.js",
"/js/slick.min.js",
"/js/function.js"
]; ];
public $depends = [ public $depends = [
'yii\web\YiiAsset', 'yii\web\YiiAsset',
......
...@@ -108,8 +108,12 @@ class ScanController extends Controller ...@@ -108,8 +108,12 @@ class ScanController extends Controller
} }
unset($host_bd); unset($host_bd);
} }
else
echo PHP_EOL.$this->ansiFormat('! Error create DB request');
unset($db_request); unset($db_request);
} }
else
$csv_skip_row++;
unset($host_level); unset($host_level);
unset($host); unset($host);
} }
......
<?php
namespace app\controllers;
use Yii;
use app\models\Filter;
use app\models\FilterSearch;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
/**
* FilterController implements the CRUD actions for Filter model.
*/
class FilterController extends Controller
{
/**
* {@inheritdoc}
*/
public function behaviors()
{
return [
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
'delete' => ['POST'],
],
],
];
}
/**
* Lists all Filter models.
* @return mixed
*/
public function actionIndex()
{
$searchModel = new FilterSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
return $this->render('index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
]);
}
/**
* Displays a single Filter model.
* @param integer $id
* @return mixed
* @throws NotFoundHttpException if the model cannot be found
*/
public function actionView($id)
{
return $this->render('view', [
'model' => $this->findModel($id),
]);
}
/**
* Creates a new Filter model.
* If creation is successful, the browser will be redirected to the 'view' page.
* @return mixed
*/
public function actionCreate()
{
$model = new Filter();
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->id]);
}
return $this->render('create', [
'model' => $model,
]);
}
/**
* Updates an existing Filter model.
* If update is successful, the browser will be redirected to the 'view' page.
* @param integer $id
* @return mixed
* @throws NotFoundHttpException if the model cannot be found
*/
public function actionUpdate($id)
{
$model = $this->findModel($id);
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->id]);
}
return $this->render('update', [
'model' => $model,
]);
}
/**
* Deletes an existing Filter model.
* If deletion is successful, the browser will be redirected to the 'index' page.
* @param integer $id
* @return mixed
* @throws NotFoundHttpException if the model cannot be found
*/
public function actionDelete($id)
{
$this->findModel($id)->delete();
return $this->redirect(['index']);
}
/**
* Finds the Filter model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown.
* @param integer $id
* @return Filter the loaded model
* @throws NotFoundHttpException if the model cannot be found
*/
protected function findModel($id)
{
if (($model = Filter::findOne($id)) !== null) {
return $model;
}
throw new NotFoundHttpException('The requested page does not exist.');
}
}
<?php
namespace app\controllers;
use Yii;
use app\models\Host;
use app\models\HostSearch;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
/**
* HostController implements the CRUD actions for Host model.
*/
class HostController extends Controller
{
/**
* {@inheritdoc}
*/
public function behaviors()
{
return [
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
'delete' => ['POST'],
],
],
];
}
/**
* Lists all Host models.
* @return mixed
*/
public function actionIndex()
{
$searchModel = new HostSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
return $this->render('index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
]);
}
/**
* Displays a single Host model.
* @param integer $id
* @return mixed
* @throws NotFoundHttpException if the model cannot be found
*/
public function actionView($id)
{
return $this->render('view', [
'model' => $this->findModel($id),
]);
}
/**
* Creates a new Host model.
* If creation is successful, the browser will be redirected to the 'view' page.
* @return mixed
*/
public function actionCreate()
{
$model = new Host();
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->id]);
}
return $this->render('create', [
'model' => $model,
]);
}
/**
* Updates an existing Host model.
* If update is successful, the browser will be redirected to the 'view' page.
* @param integer $id
* @return mixed
* @throws NotFoundHttpException if the model cannot be found
*/
public function actionUpdate($id)
{
$model = $this->findModel($id);
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->id]);
}
return $this->render('update', [
'model' => $model,
]);
}
/**
* Deletes an existing Host model.
* If deletion is successful, the browser will be redirected to the 'index' page.
* @param integer $id
* @return mixed
* @throws NotFoundHttpException if the model cannot be found
*/
public function actionDelete($id)
{
$this->findModel($id)->delete();
return $this->redirect(['index']);
}
/**
* Finds the Host model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown.
* @param integer $id
* @return Host the loaded model
* @throws NotFoundHttpException if the model cannot be found
*/
protected function findModel($id)
{
if (($model = Host::findOne($id)) !== null) {
return $model;
}
throw new NotFoundHttpException('The requested page does not exist.');
}
}
...@@ -64,8 +64,8 @@ class SiteController extends Controller ...@@ -64,8 +64,8 @@ class SiteController extends Controller
*/ */
public function actionIndex() public function actionIndex()
{ {
var_dump(Yii::$app->user->isGuest); //var_dump(Yii::$app->user->isGuest);
var_dump(Yii::$app->user->identity); //var_dump(Yii::$app->user->identity);
return $this->render('index'); return $this->render('index');
} }
......
<?php
use yii\db\Migration;
/**
* Class m210603_142134_filters
*/
class m210603_142134_filters extends Migration
{
/**
* {@inheritdoc}
*/
public function safeUp()
{
$this->createTable('{{%filters}}', [
'id' => $this->primaryKey(),
'pattern' => $this->text()->notNull()->comment('Паттерн'),
'created' => $this->dateTime()->comment('Дата записи'),
'include' => $this->tinyInteger(1)->notNull()->defaultValue(0)->comment('Исключение или включение'),
'status' => $this->tinyInteger(1)->notNull()->defaultValue(0)->comment('Статус'),
'type' => $this->tinyInteger(1)->notNull()->defaultValue(0)->comment('Тип'),
], 'CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE=InnoDB');
$this->createIndex('idx-status', '{{%filters}}', 'status');
$this->createIndex('idx-type', '{{%filters}}', 'type');
}
/**
* {@inheritdoc}
*/
public function safeDown()
{
$this->dropIndex('idx-type', '{{%filters}}');
$this->dropIndex('idx-status', '{{%filters}}');
$this->dropTable('{{%filters}}');
}
}
<?php
namespace app\models;
use Yii;
use yii\behaviors\TimestampBehavior;
use yii\db\Expression;
/**
* This is the model class for table "{{%filters}}".
*
* @property int $id
* @property string $pattern Домен
* @property string|null $created Дата записи
* @property int $include Исключение или включение
* @property int $status Статус
* @property int $type Тип
*/
class Filter extends \yii\db\ActiveRecord
{
const INCLUDE_ON = 0; //включая
const INCLUDE_OFF = 1; //выключая
const STATUS_OFF = 0; //выкл
const STATUS_ON = 1; //вкл
const TYPE_BEFORE = 0; //До добавления БД
const TYPE_AFTER = 1; //После добавления БД
/**
* {@inheritdoc}
*/
public static function tableName()
{
return '{{%filters}}';
}
public function behaviors()
{
return [
[
'class' => TimestampBehavior::className(),
'createdAtAttribute' => 'created',
'updatedAtAttribute' => null,
'value' => new Expression('NOW()'),
],
];
}
/**
* {@inheritdoc}
*/
public function rules()
{
return [
[['pattern'], 'required'],
['include', 'in', 'range' => array_keys(self::getIncludes())],
['status', 'in', 'range' => array_keys(self::getStatus())],
['type', 'in', 'range' => array_keys(self::getTypes())],
[['created', 'pattern'], 'safe'],
[['include', 'status', 'type'], 'integer']
];
}
/**
* {@inheritdoc}
*/
public function attributeLabels()
{
return [
'id' => 'ID',
'domain' => 'Domain',
'created_at' => 'Date',
'csv_date' => 'Date CSV',
'wis_date' => 'Date WHOIS',
'wis_status' => 'Status',
'domain_expire' => 'Date expired',
'tix' => 'TIX',
];
}
/**
* {@inheritdoc}
* @return FilterQuery the active query used by this AR class.
*/
public static function find()
{
return new FilterQuery(get_called_class());
}
public static function getIncludes($inc = false)
{
$arr = [
self::INCLUDE_ON => 'Before',
self::INCLUDE_OFF => 'After'
];
if (is_numeric($inc)) {
if (array_key_exists($inc, $arr)) {
return $arr[$inc];
}
return $inc;
}
return $arr;
}
public static function getStatus($status = false)
{
$arr = [
self::STATUS_OFF => 'Disable',
self::STATUS_ON => 'Enable'
];
if (is_numeric($status)) {
if (array_key_exists($status, $arr)) {
return $arr[$status];
}
return $status;
}
return $arr;
}
public static function getTypes($type = false)
{
$arr = [
self::TYPE_BEFORE => 'Before',
self::TYPE_AFTER => 'After'
];
if (is_numeric($type)) {
if (array_key_exists($type, $arr)) {
return $arr[$type];
}
return $type;
}
return $arr;
}
}
<?php
namespace app\models;
/**
* This is the ActiveQuery class for [[Host]].
*
* @see Filter
*/
class FilterQuery extends \yii\db\ActiveQuery
{
/*public function active()
{
return $this->andWhere('[[status]]=1');
}*/
/**
* {@inheritdoc}
* @return Filter[]|array
*/
public function all($db = null)
{
return parent::all($db);
}
/**
* {@inheritdoc}
* @return Filter|array|null
*/
public function one($db = null)
{
return parent::one($db);
}
}
<?php
namespace app\models;
use yii\base\Model;
use yii\data\ActiveDataProvider;
use app\models\Filter;
/**
* HostSearch represents the model behind the search form of `app\models\Filter`.
*/
class FilterSearch extends Filter
{
/**
* {@inheritdoc}
*/
public function rules()
{
return [
[['id', 'include', 'status', 'type'], 'integer'],
[['pattern', 'created'], 'safe'],
];
}
/**
* {@inheritdoc}
*/
public function scenarios()
{
// bypass scenarios() implementation in the parent class
return Model::scenarios();
}
/**
* Creates data provider instance with search query applied
*
* @param array $params
*
* @return ActiveDataProvider
*/
public function search($params)
{
$query = Filter::find();
// add conditions that should always apply here
$dataProvider = new ActiveDataProvider([
'query' => $query,
]);
$this->load($params);
if (!$this->validate()) {
// uncomment the following line if you do not want to return any records when validation fails
// $query->where('0=1');
return $dataProvider;
}
// grid filtering conditions
$query->andFilterWhere([
'id' => $this->id,
'pattern' => $this->pattern,
//'created' => $this->created,
'include' => $this->include,
'status' => $this->status,
'type' => $this->type,
]);
$query->andFilterWhere(['like', 'domain', $this->domain]);
return $dataProvider;
}
}
...@@ -18,40 +18,44 @@ $this->registerMetaTag(['property' => 'description', 'content' => 'Автори ...@@ -18,40 +18,44 @@ $this->registerMetaTag(['property' => 'description', 'content' => 'Автори
//MainAsset::register($this); //MainAsset::register($this);
?> ?>
<section id="main-content" class="checkout-page">
<div class="container"> <div class="container-fluid">
<div class="checkout-form"> <div class="checkout-form row">
<?php $form = ActiveForm::begin([ <?php
'id' => 'order-form', $form = ActiveForm::begin(
'options' => ['class' => 'form-bottom row'], [
'fieldConfig' => [ /* классы полей формы */ 'id' => 'order-form',
'options' => [ 'options' => [
'tag' => false, 'class' => 'form-bottom col-md-6 col-md-offset-3'
], ],
], 'fieldConfig' => [
]); ?> 'options' => [
<div class="col-md-6"> 'tag' => false,
<div class="form-login"> ]
<?= $form->field($model, 'username', [ ]
'inputTemplate' => '{input}', ]
'template' => '<div class="field-loginform-username required">{label}{input}{error}{hint}</div>', );
])->textInput(['autofocus' => true])->input('text', ['placeholder' => "Логин *"])->label(false); ?> ?>
<?= $form->field($model, 'password', [
'inputTemplate' => '{input}', <h2 class="form-signin-heading">Please sign in</h2>
'template' => '<div class="field-loginform-password required">{label}{input}{error}{hint}</div>', <div class="form-login">
])->passwordInput()->input('password', ['placeholder' => "Пароль *"])->label(false); ?> <?= $form->field($model, 'username', [
<div class="action-login"> 'inputTemplate' => '{input}',
<div class="btn-login btn-theme btn-medium"> 'template' => '<div class="field-loginform-username required form-group form-group-lg">{label}{input}{error}{hint}</div>',
<?= Html::submitButton('<span>Авторизоваться</span>', ['class' => 'class="proceed-checkout btn-theme btn-lage mybtn', 'name' => 'auth']) ?> ])->textInput(['autofocus' => true])->input('text', ['placeholder' => "Login *"])->label(false); ?>
<div class="radio"> <?= $form->field($model, 'password', [
<label> <?= $form->field($model, 'rememberMe')->checkbox(['template' => "{input} {label} {error}",]) ?></label> 'inputTemplate' => '{input}',
</div> 'template' => '<div class="field-loginform-password required form-group form-group-lg">{label}{input}{error}{hint}</div>',
</div> ])->passwordInput()->input('password', ['placeholder' => "Password *"])->label(false); ?>
</div> <div class="action-login">
</div> <div class="btn-login btn-theme btn-medium">
</div> <?= Html::submitButton('<span>Login</span>', ['class' => 'class="btn btn-primary btn-lg btn-block', 'name' => 'auth']) ?>
<div class="col-md-6"></div> <div class="radio">
<?php ActiveForm::end(); ?> <label> <?= $form->field($model, 'rememberMe')->checkbox(['template' => "{input} {label} {error}",]) ?></label>
</div> </div>
</div> </div>
</section> </div>
</div>
<?php ActiveForm::end(); ?>
</div>
</div>
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model app\models\Host */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="host-form">
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'domain')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'created_at')->textInput() ?>
<?= $form->field($model, 'csv_date')->textInput() ?>
<?= $form->field($model, 'wis_date')->textInput() ?>
<?= $form->field($model, 'wis_status')->textInput() ?>
<?= $form->field($model, 'tix')->textInput() ?>
<div class="form-group">
<?= Html::submitButton('Save', ['class' => 'btn btn-success']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model app\models\HostSearch */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="host-search">
<?php $form = ActiveForm::begin([
'action' => ['index'],
'method' => 'get',
'options' => [
'data-pjax' => 1
],
]); ?>
<?= $form->field($model, 'id') ?>
<?= $form->field($model, 'domain') ?>
<?= $form->field($model, 'created_at') ?>
<?= $form->field($model, 'csv_date') ?>
<?= $form->field($model, 'wis_date') ?>
<?php // echo $form->field($model, 'wis_status') ?>
<?php // echo $form->field($model, 'tix') ?>
<div class="form-group">
<?= Html::submitButton('Search', ['class' => 'btn btn-primary']) ?>
<?= Html::resetButton('Reset', ['class' => 'btn btn-outline-secondary']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model app\models\Host */
$this->title = 'Create Host';
$this->params['breadcrumbs'][] = ['label' => 'Hosts', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="host-create">
<h1><?= Html::encode($this->title) ?></h1>
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>
<?php
use yii\jui\DatePicker;
use yii\helpers\Html;
use yii\grid\GridView;
use yii\widgets\Pjax;
/* @var $this yii\web\View */
/* @var $searchModel app\models\HostSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'List of domains';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="host-index">
<h1><?= Html::encode($this->title) ?></h1>
<!--p>
<?= Html::a('Create Host', ['create'], ['class' => 'btn btn-success']) ?>
</p-->
<?php Pjax::begin(); ?>
<?php // echo $this->render('_search', ['model' => $searchModel]); ?>
<?= GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
'id',
'domain',
'created_at' => [
'attribute' => 'created_at',
'value' => 'created_at',
// 'format' => 'date',
/* 'filter' => DatePicker::widget([
'name' => 'created_at',
'clientOptions' => [
'format' => 'd.mm.yyyy',
'todayHighlight' => true,
]
]),*/
],
'csv_date',
'wis_status' =>
[
'attribute' => 'wis_status',
'filter' => \app\models\Host::getStatus(),
'format' => 'raw',
'value' => function ($model) {
return $model::getStatus($model->wis_status);
},
],
'wis_date',
'domain_expire',
'tix',
[
'class' => 'yii\grid\ActionColumn',
'header' => 'Actions',
'template' => '{view} {delete}',
]
],
]); ?>
<?php Pjax::end(); ?>
</div>
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model app\models\Host */
$this->title = 'Update Host: ' . $model->id;
$this->params['breadcrumbs'][] = ['label' => 'Hosts', 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->id, 'url' => ['view', 'id' => $model->id]];
$this->params['breadcrumbs'][] = 'Update';
?>
<div class="host-update">
<h1><?= Html::encode($this->title) ?></h1>
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>
<?php
use yii\helpers\Html;
use yii\widgets\DetailView;
/* @var $this yii\web\View */
/* @var $model app\models\Host */
$this->title = $model->id;
$this->params['breadcrumbs'][] = ['label' => 'Hosts', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
\yii\web\YiiAsset::register($this);
?>
<div class="host-view">
<h1><?= Html::encode($this->title) ?></h1>
<p>
<?= Html::a('Update', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
<?= Html::a('Delete', ['delete', 'id' => $model->id], [
'class' => 'btn btn-danger',
'data' => [
'confirm' => 'Are you sure you want to delete this item?',
'method' => 'post',
],
]) ?>
</p>
<?= DetailView::widget([
'model' => $model,
'attributes' => [
'id',
'domain',
'created_at',
'csv_date',
'wis_date',
'wis_status',
'tix',
],
]) ?>
</div>
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model app\models\Host */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="host-form">
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'domain')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'created_at')->textInput() ?>
<?= $form->field($model, 'csv_date')->textInput() ?>
<?= $form->field($model, 'wis_date')->textInput() ?>
<?= $form->field($model, 'wis_status')->textInput() ?>
<?= $form->field($model, 'tix')->textInput() ?>
<div class="form-group">
<?= Html::submitButton('Save', ['class' => 'btn btn-success']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model app\models\HostSearch */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="host-search">
<?php $form = ActiveForm::begin([
'action' => ['index'],
'method' => 'get',
'options' => [
'data-pjax' => 1
],
]); ?>
<?= $form->field($model, 'id') ?>
<?= $form->field($model, 'domain') ?>
<?= $form->field($model, 'created_at') ?>
<?= $form->field($model, 'csv_date') ?>
<?= $form->field($model, 'wis_date') ?>
<?php // echo $form->field($model, 'wis_status') ?>
<?php // echo $form->field($model, 'tix') ?>
<div class="form-group">
<?= Html::submitButton('Search', ['class' => 'btn btn-primary']) ?>
<?= Html::resetButton('Reset', ['class' => 'btn btn-outline-secondary']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model app\models\Host */
$this->title = 'Create Host';
$this->params['breadcrumbs'][] = ['label' => 'Hosts', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="host-create">
<h1><?= Html::encode($this->title) ?></h1>
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>
<?php
use yii\jui\DatePicker;
use yii\helpers\Html;
use yii\grid\GridView;
use yii\widgets\Pjax;
/* @var $this yii\web\View */
/* @var $searchModel app\models\HostSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'List of domains';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="host-index">
<h1><?= Html::encode($this->title) ?></h1>
<!--p>
<?= Html::a('Create Host', ['create'], ['class' => 'btn btn-success']) ?>
</p-->
<?php Pjax::begin(); ?>
<?php // echo $this->render('_search', ['model' => $searchModel]); ?>
<?= GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
'id',
'domain',
'created_at' => [
'attribute' => 'created_at',
'value' => 'created_at',
// 'format' => 'date',
/* 'filter' => DatePicker::widget([
'name' => 'created_at',
'clientOptions' => [
'format' => 'd.mm.yyyy',
'todayHighlight' => true,
]
]),*/
],
'csv_date',
'wis_status' =>
[
'attribute' => 'wis_status',
'filter' => \app\models\Host::getStatus(),
'format' => 'raw',
'value' => function ($model) {
return $model::getStatus($model->wis_status);
},
],
'wis_date',
'domain_expire',
'tix',
[
'class' => 'yii\grid\ActionColumn',
'header' => 'Actions',
'template' => '{view} {delete}',
]
],
]); ?>
<?php Pjax::end(); ?>
</div>
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model app\models\Host */
$this->title = 'Update Host: ' . $model->id;
$this->params['breadcrumbs'][] = ['label' => 'Hosts', 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->id, 'url' => ['view', 'id' => $model->id]];
$this->params['breadcrumbs'][] = 'Update';
?>
<div class="host-update">
<h1><?= Html::encode($this->title) ?></h1>
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>
<?php
use yii\helpers\Html;
use yii\widgets\DetailView;
/* @var $this yii\web\View */
/* @var $model app\models\Host */
$this->title = $model->id;
$this->params['breadcrumbs'][] = ['label' => 'Hosts', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
\yii\web\YiiAsset::register($this);
?>
<div class="host-view">
<h1><?= Html::encode($this->title) ?></h1>
<p>
<?= Html::a('Update', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
<?= Html::a('Delete', ['delete', 'id' => $model->id], [
'class' => 'btn btn-danger',
'data' => [
'confirm' => 'Are you sure you want to delete this item?',
'method' => 'post',
],
]) ?>
</p>
<?= DetailView::widget([
'model' => $model,
'attributes' => [
'id',
'domain',
'created_at',
'csv_date',
'wis_date',
'wis_status',
'tix',
],
]) ?>
</div>
...@@ -4,37 +4,99 @@ ...@@ -4,37 +4,99 @@
/* @var $content string */ /* @var $content string */
use app\widgets\Alert;
use yii\helpers\Url;
use yii\helpers\Html; use yii\helpers\Html;
use yii\bootstrap\Nav; use yii\bootstrap\Nav;
use yii\bootstrap\NavBar; use yii\bootstrap\NavBar;
use yii\widgets\Breadcrumbs; use yii\widgets\Breadcrumbs;
use app\assets\AppAsset; use app\assets\AppAsset;
use app\widgets\Alert;
AppAsset::register($this); AppAsset::register($this);
?> ?>
<?php $this->beginPage() ?> <?php $this->beginPage() ?>
<!DOCTYPE html> <!DOCTYPE html>
<html lang="<?= Yii::$app->language ?>"> <html lang="<?= Yii::$app->language ?>">
<head> <head>
<meta charset="<?= Yii::$app->charset ?>"> <meta charset="<?= Yii::$app->charset ?>" />
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1" />
<!-- CSS LIBRARY --> <!-- CSS LIBRARY -->
<link rel="shortcut icon" type="text/css" href="images/favicon.png"/> <link rel="shortcut icon" type="text/css" href="images/favicon.png"/>
<?php $this->registerCsrfMetaTags() ?> <?php $this->registerCsrfMetaTags() ?>
<title><?= Html::encode($this->title) ?></title> <title><?= Html::encode($this->title) ?></title>
<?php $this->head() ?> <?php $this->head() ?>
</head> </head>
<body>
<body> <?php $this->beginBody() ?>
<div id="app"> <div id="app" class="wrap">
<?php $this->beginBody() ?> <?php
<!-- END-HEADER --> NavBar::begin(
<?= Alert::widget() ?> [
<?= $content ?> 'brandLabel' => Yii::$app->name,
<?php $this->endBody() ?> 'brandUrl' => Yii::$app->homeUrl,
</body> 'options' => [
'class' => 'navbar-inverse navbar-fixed-top',
],
]
);
$items = [
['label' => 'Home', 'url' => ['/site/index']]
];
if (Yii::$app->user->isGuest===false)
{
$items[] = ['label' => 'Filter', 'url' => ['/filters']];
$items[] = ['label' => 'Domains', 'url' => ['/host']];
$items[] = ['label' => 'Logout (' . Yii::$app->user->identity->name . ')', 'url' => ['/auth/logout']];
}
else
$items[] = ['label' => 'Sig in', 'url' => ['/auth/login']];
echo Nav::widget(
[
'options' => ['class' => 'navbar-nav navbar-right'],
'items' => $items
]
);
NavBar::end();
?>
<div class="container">
<?php
echo Breadcrumbs::widget(
[
'homeLink' => [
'label' => 'Home',
'url' => Url::home()
],
'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [],
]
).
Alert::widget().
$content;
?>
</div>
<notifications
width="380"
group="admin"
position="bottom right"
classes="flower-style"
:duration="3000"
></notifications>
</div>
<footer class="footer">
<div class="container">
<p class="pull-left">&copy; <?php echo Yii::$app->name; ?> <?php
$d = date('Y');
echo(($d - 2021) ? '2021 - ' . $d : $d); ?>
</p>
</div>
</footer>
<?php $this->endBody() ?>
</body>
</html> </html>
<?php $this->endPage() ?> <?php $this->endPage() ?>
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!