accesses new
This commit is contained in:
parent
188758c79c
commit
6880eaa2ba
@ -18,7 +18,7 @@ class AccessesSearch extends Accesses
|
||||
{
|
||||
return [
|
||||
[['id'], 'integer'],
|
||||
[['name', 'access'], 'safe'],
|
||||
[['name', 'login', 'password', 'link', 'project', 'info'], 'safe'],
|
||||
];
|
||||
}
|
||||
|
||||
@ -62,7 +62,11 @@ class AccessesSearch extends Accesses
|
||||
]);
|
||||
|
||||
$query->andFilterWhere(['like', 'name', $this->name])
|
||||
->andFilterWhere(['like', 'access', $this->access]);
|
||||
->andFilterWhere(['like', 'login', $this->login])
|
||||
->andFilterWhere(['like', 'password', $this->password])
|
||||
->andFilterWhere(['like', 'link', $this->link])
|
||||
->andFilterWhere(['like', 'project', $this->project])
|
||||
->andFilterWhere(['like', 'info', $this->info]);
|
||||
|
||||
return $dataProvider;
|
||||
}
|
||||
|
@ -18,28 +18,38 @@ use kartik\select2\Select2;
|
||||
|
||||
<?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
|
||||
|
||||
<?= $form->field($model, 'access')->textarea(['maxlength' => true]) ?>
|
||||
<?= $form->field($model, 'login')->textInput(['maxlength' => true]) ?>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<?= Select2::widget(
|
||||
[
|
||||
'model' => $model,
|
||||
'attribute' => '_projects',
|
||||
'data' => \yii\helpers\ArrayHelper::map(\common\models\Project::find()->all(), 'id', 'name'),
|
||||
'options' => ['placeholder' => '...', 'class' => 'form-control', 'multiple' => true],
|
||||
'pluginOptions' => [
|
||||
'allowClear' => true
|
||||
],
|
||||
]
|
||||
) ?>
|
||||
</div>
|
||||
</div>
|
||||
<?= $form->field($model, 'password')->textInput(['maxlength' => true]) ?>
|
||||
|
||||
<?= $form->field($model, 'link')->textInput(['maxlength' => true]) ?>
|
||||
|
||||
<?= $form->field($model, 'project')->textInput(['maxlength' => true]) ?>
|
||||
|
||||
<?= $form->field($model, 'info')->textarea(['maxlength' => true]) ?>
|
||||
|
||||
<!-- <div class="row">-->
|
||||
<!-- <div class="col-xs-12">-->
|
||||
<!-- --><?php
|
||||
// echo Select2::widget(
|
||||
// [
|
||||
// 'model' => $model,
|
||||
// 'attribute' => '_projects',
|
||||
// 'data' => \yii\helpers\ArrayHelper::map(\common\models\Project::find()->all(), 'id', 'name'),
|
||||
// 'options' => ['placeholder' => '...', 'class' => 'form-control', 'multiple' => true],
|
||||
// 'pluginOptions' => [
|
||||
// 'allowClear' => true
|
||||
// ],
|
||||
// ]
|
||||
// ) ?>
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<text>Пользователи</text>
|
||||
<?= Select2::widget(
|
||||
<?php
|
||||
echo Select2::widget(
|
||||
[
|
||||
'model'=> $model,
|
||||
'attribute' => '_users',
|
||||
@ -48,13 +58,12 @@ use kartik\select2\Select2;
|
||||
'pluginOptions' => [
|
||||
'allowClear' => true
|
||||
],
|
||||
]
|
||||
) ?>
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<?= Html::submitButton('Сохранить', ['class' => 'btn btn-success']) ?>
|
||||
<?= '<br>' . Html::submitButton('Сохранить', ['class' => 'btn btn-success']) ?>
|
||||
</div>
|
||||
|
||||
<?php ActiveForm::end(); ?>
|
||||
|
@ -19,8 +19,6 @@ use yii\widgets\ActiveForm;
|
||||
|
||||
<?= $form->field($model, 'name') ?>
|
||||
|
||||
<?= $form->field($model, 'access') ?>
|
||||
|
||||
<div class="form-group">
|
||||
<?= Html::submitButton('Поиск', ['class' => 'btn btn-primary']) ?>
|
||||
<?= Html::resetButton('Сброс', ['class' => 'btn btn-default']) ?>
|
||||
|
@ -24,10 +24,11 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
'filterModel' => $searchModel,
|
||||
'columns' => [
|
||||
['class' => 'yii\grid\SerialColumn'],
|
||||
|
||||
|
||||
'name',
|
||||
'access',
|
||||
'login',
|
||||
'password',
|
||||
'link',
|
||||
'project',
|
||||
[
|
||||
'attribute' => 'userCard.fio',
|
||||
'format' => 'raw',
|
||||
@ -35,15 +36,13 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
return $model->getUserCardName();
|
||||
},
|
||||
],
|
||||
|
||||
[
|
||||
'attribute' => 'projects.name',
|
||||
'format' => 'raw',
|
||||
'value' => function(\common\models\Accesses $model){
|
||||
return $model->getProjectName();
|
||||
},
|
||||
],
|
||||
|
||||
// [
|
||||
// 'attribute' => 'projects.name',
|
||||
// 'format' => 'raw',
|
||||
// 'value' => function(\common\models\Accesses $model){
|
||||
// return $model->getProjectName();
|
||||
// },
|
||||
// ],
|
||||
['class' => 'yii\grid\ActionColumn'],
|
||||
],
|
||||
]); ?>
|
||||
|
@ -30,21 +30,25 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
'model' => $model,
|
||||
'attributes' => [
|
||||
'name',
|
||||
'access',
|
||||
[
|
||||
'attribute' => 'userCard.fio',
|
||||
'format' => 'raw',
|
||||
'value' => function(\common\models\Accesses $model){
|
||||
return $model->getUserCardName();
|
||||
},
|
||||
],
|
||||
[
|
||||
'attribute' => 'projects.name',
|
||||
'format' => 'raw',
|
||||
'value' => function(\common\models\Accesses $model){
|
||||
return $model->getProjectName();
|
||||
},
|
||||
],
|
||||
'login',
|
||||
'password',
|
||||
'link',
|
||||
'project',
|
||||
'info',
|
||||
// [
|
||||
// 'attribute' => 'userCard.fio',
|
||||
// 'format' => 'raw',
|
||||
// 'value' => function(\common\models\Accesses $model){
|
||||
// return $model->getUserCardName();
|
||||
// },
|
||||
// ],
|
||||
// [
|
||||
// 'attribute' => 'projects.name',
|
||||
// 'format' => 'raw',
|
||||
// 'value' => function(\common\models\Accesses $model){
|
||||
// return $model->getProjectName();
|
||||
// },
|
||||
// ],
|
||||
],
|
||||
]) ?>
|
||||
|
||||
|
@ -1,24 +1,3 @@
|
||||
<div class="calendar-default-index">
|
||||
|
||||
<p>
|
||||
<select id="options" class="btn btn-secondary dropdown-toggle">
|
||||
<option selected="selected">Выберите месяц</option>
|
||||
<option value="?month=00">Показать все</option>
|
||||
<option value="?month=01">январь</option>
|
||||
<option value="?month=02">февраль</option>
|
||||
<option value="?month=03">март</option>
|
||||
<option value="?month=04">апрель</option>
|
||||
<option value="?month=05">май</option>
|
||||
<option value="?month=06">июнь</option>
|
||||
<option value="?month=07">июль</option>
|
||||
<option value="?month=08">август</option>
|
||||
<option value="?month=09">сентябрь</option>
|
||||
<option value="?month=10">октябрь</option>
|
||||
<option value="?month=11">ноябрь</option>
|
||||
<option value="?month=12">декабрь</option>
|
||||
</select>
|
||||
</p>
|
||||
|
||||
<?php
|
||||
|
||||
/* @var $searchModel backend\modules\card\models\UserCardSearch */
|
||||
@ -26,7 +5,28 @@
|
||||
|
||||
use yii\grid\GridView;
|
||||
use yii\widgets\Pjax;
|
||||
?>
|
||||
|
||||
<p>
|
||||
<select id="options" class="btn btn-secondary dropdown-toggle">
|
||||
<option selected="selected" value="?month=00">Выберите месяц</option>
|
||||
<option value="?month=00">Показать все</option>
|
||||
<option value="?month=01">январь</option>
|
||||
<option value="?month=02">февраль</option>
|
||||
<option value="?month=03">март</option>
|
||||
<option value="?month=04">апрель</option>
|
||||
<option value="?month=05">май</option>
|
||||
<option value="?month=06">июнь</option>
|
||||
<option value="?month=07">июль</option>
|
||||
<option value="?month=08">август</option>
|
||||
<option value="?month=09">сентябрь</option>
|
||||
<option value="?month=10">октябрь</option>
|
||||
<option value="?month=11">ноябрь</option>
|
||||
<option value="?month=12">декабрь</option>
|
||||
</select>
|
||||
</p>
|
||||
|
||||
<?php
|
||||
Pjax::begin(['id' => 'reload']);
|
||||
echo GridView::widget([
|
||||
'dataProvider' => $dataProvider,
|
||||
|
@ -121,7 +121,7 @@ class UserCard extends \common\models\UserCard
|
||||
$user->save();
|
||||
|
||||
$log = "Логин: " . $email . " Пароль: " . $password . " | ";
|
||||
//file_put_contents("log.txt", $log, FILE_APPEND | LOCK_EX);
|
||||
file_put_contents("log.txt", $log, FILE_APPEND | LOCK_EX);
|
||||
|
||||
return $user->id;
|
||||
}
|
||||
|
@ -11,7 +11,11 @@ use yii\helpers\ArrayHelper;
|
||||
*
|
||||
* @property int $id
|
||||
* @property string $name
|
||||
* @property string $access
|
||||
* @property string $login
|
||||
* @property string $password
|
||||
* @property string $link
|
||||
* @property string $project
|
||||
* @property string $info
|
||||
*/
|
||||
class Accesses extends \yii\db\ActiveRecord
|
||||
{
|
||||
@ -32,8 +36,8 @@ class Accesses extends \yii\db\ActiveRecord
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
[['name'], 'string', 'max' => 255],
|
||||
[['access'], 'string'],
|
||||
[['name', 'login', 'password', 'link', 'project' ], 'string', 'max' => 255],
|
||||
[['info'], 'string'],
|
||||
[['_projects'], 'safe'],
|
||||
[['_users'], 'safe'],
|
||||
];
|
||||
@ -47,7 +51,11 @@ class Accesses extends \yii\db\ActiveRecord
|
||||
return [
|
||||
'id' => 'ID',
|
||||
'name' => 'Название',
|
||||
'access' => 'Доступ',
|
||||
'login' => 'Логин',
|
||||
'password' => 'Пароль',
|
||||
'link' => 'Ссылка',
|
||||
'project' => 'Проект',
|
||||
'info' => 'Дополнительная информация',
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
use yii\db\Migration;
|
||||
|
||||
/**
|
||||
* Handles dropping columns from table `{{%accesses}}`.
|
||||
*/
|
||||
class m200121_115737_drop_access_column_from_accesses_table extends Migration
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function safeUp()
|
||||
{
|
||||
$this->dropColumn('{{%accesses}}', 'access');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function safeDown()
|
||||
{
|
||||
$this->addColumn('{{%accesses}}', 'access', $this->string());
|
||||
}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
use yii\db\Migration;
|
||||
|
||||
/**
|
||||
* Handles adding columns to table `{{%accesses}}`.
|
||||
*/
|
||||
class m200121_120006_add_login_column_to_accesses_table extends Migration
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function safeUp()
|
||||
{
|
||||
$this->addColumn('{{%accesses}}', 'login', $this->string());
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function safeDown()
|
||||
{
|
||||
$this->dropColumn('{{%accesses}}', 'login');
|
||||
}
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use yii\db\Migration;
|
||||
|
||||
/**
|
||||
* Handles adding columns to table `{{%accesses}}`.
|
||||
*/
|
||||
class m200121_120121_add_password_column_to_accesses_table extends Migration
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function safeUp()
|
||||
{
|
||||
$this->addColumn('{{%accesses}}', 'password', $this->string());
|
||||
$this->addColumn('{{%accesses}}', 'link', $this->string());
|
||||
$this->addColumn('{{%accesses}}', 'project', $this->string());
|
||||
$this->addColumn('{{%accesses}}', 'info', $this->text());
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function safeDown()
|
||||
{
|
||||
$this->dropColumn('{{%accesses}}', 'password');
|
||||
$this->dropColumn('{{%accesses}}', 'link');
|
||||
$this->dropColumn('{{%accesses}}', 'project');
|
||||
$this->dropColumn('{{%accesses}}', 'info');
|
||||
}
|
||||
}
|
124
frontend/modules/access/controllers/AccessController.php
Executable file → Normal file
124
frontend/modules/access/controllers/AccessController.php
Executable file → Normal file
@ -3,28 +3,128 @@
|
||||
namespace frontend\modules\access\controllers;
|
||||
|
||||
use Yii;
|
||||
use yii\web\Controller;
|
||||
use yii\data\ActiveDataProvider;
|
||||
use common\models\Accesses;
|
||||
use frontend\modules\access\models\AccessSearch;
|
||||
use yii\data\ActiveDataProvider;
|
||||
use yii\web\Controller;
|
||||
use yii\web\NotFoundHttpException;
|
||||
use yii\filters\VerbFilter;
|
||||
|
||||
/**
|
||||
* AccessController implements the CRUD actions for Accesses model.
|
||||
*/
|
||||
class AccessController extends Controller
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function behaviors()
|
||||
{
|
||||
return [
|
||||
'verbs' => [
|
||||
'class' => VerbFilter::className(),
|
||||
'actions' => [
|
||||
'delete' => ['POST'],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Lists all Accesses models.
|
||||
* @return mixed
|
||||
*/
|
||||
public function actionIndex()
|
||||
{
|
||||
$id_user = Yii::$app->user->id;
|
||||
$query = "SELECT accesses.name, accesses.access FROM `accesses`, `user_card`, `user_card_accesses` WHERE user_card.id_user =" . $id_user . " AND user_card_accesses.user_card_id = user_card.id AND accesses.id = user_card_accesses.accesses_id ";
|
||||
$access = Accesses::findBySql($query);
|
||||
|
||||
$dataProvider = new ActiveDataProvider([
|
||||
'query' => $access,
|
||||
'pagination' => [
|
||||
'pageSize' => 200,
|
||||
],
|
||||
$dataProvider = new ActiveDataProvider(['query' => Accesses::find()
|
||||
->where(['user_card.id_user' => Yii::$app->user->identity->id])
|
||||
->innerJoin('user_card_accesses', 'accesses.id = user_card_accesses.accesses_id')
|
||||
->innerJoin('user_card', 'user_card_accesses.user_card_id = user_card.id')
|
||||
]);
|
||||
|
||||
return $this->render('index', compact('dataProvider', $dataProvider));
|
||||
return $this->render('index', [
|
||||
'dataProvider' => $dataProvider,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays a single Accesses 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 Accesses model.
|
||||
* If creation is successful, the browser will be redirected to the 'view' page.
|
||||
* @return mixed
|
||||
*/
|
||||
public function actionCreate()
|
||||
{
|
||||
$model = new \frontend\modules\access\models\Access();
|
||||
|
||||
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 Accesses 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 Accesses 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 Accesses model based on its primary key value.
|
||||
* If the model is not found, a 404 HTTP exception will be thrown.
|
||||
* @param integer $id
|
||||
* @return Accesses the loaded model
|
||||
* @throws NotFoundHttpException if the model cannot be found
|
||||
*/
|
||||
protected function findModel($id)
|
||||
{
|
||||
if (($model = Accesses::findOne($id)) !== null) {
|
||||
return $model;
|
||||
}
|
||||
|
||||
throw new NotFoundHttpException('The requested page does not exist.');
|
||||
}
|
||||
}
|
||||
|
29
frontend/modules/access/models/Access.php
Normal file
29
frontend/modules/access/models/Access.php
Normal file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace frontend\modules\access\models;
|
||||
|
||||
|
||||
use common\classes\Debug;
|
||||
use common\models\UserCardAccesses;
|
||||
use frontend\modules\card\models\UserCard;
|
||||
use Yii;
|
||||
|
||||
class Access extends \common\models\Accesses
|
||||
{
|
||||
public function init()
|
||||
{
|
||||
parent::init();
|
||||
}
|
||||
|
||||
public function afterSave($insert, $changedAttributes)
|
||||
{
|
||||
parent::afterSave($insert, $changedAttributes); // TODO: Change the autogenerated stub
|
||||
|
||||
$user_card = UserCard::findOne(['id_user' => Yii::$app->user->identity->id]);
|
||||
$user_card_access = new UserCardAccesses();
|
||||
$user_card_access->user_card_id = $user_card->id;
|
||||
$user_card_access->accesses_id = $this->id;
|
||||
$user_card_access->save();
|
||||
}
|
||||
}
|
73
frontend/modules/access/models/AccessSearch.php
Normal file
73
frontend/modules/access/models/AccessSearch.php
Normal file
@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
namespace frontend\modules\access\models;
|
||||
|
||||
use yii\base\Model;
|
||||
use yii\data\ActiveDataProvider;
|
||||
use common\models\Accesses;
|
||||
|
||||
/**
|
||||
* AccessSearch represents the model behind the search form of `common\models\Accesses`.
|
||||
*/
|
||||
class AccessSearch extends Accesses
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
[['id'], 'integer'],
|
||||
[['name', 'login', 'password', 'link', 'project', 'info'], '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 = Accesses::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,
|
||||
]);
|
||||
|
||||
$query->andFilterWhere(['like', 'name', $this->name])
|
||||
->andFilterWhere(['like', 'login', $this->login])
|
||||
->andFilterWhere(['like', 'password', $this->password])
|
||||
->andFilterWhere(['like', 'link', $this->link])
|
||||
->andFilterWhere(['like', 'project', $this->project])
|
||||
->andFilterWhere(['like', 'info', $this->info]);
|
||||
|
||||
return $dataProvider;
|
||||
}
|
||||
}
|
33
frontend/modules/access/views/access/_form.php
Normal file
33
frontend/modules/access/views/access/_form.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\ActiveForm;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model common\models\Accesses */
|
||||
/* @var $form yii\widgets\ActiveForm */
|
||||
?>
|
||||
|
||||
<div class="accesses-form">
|
||||
|
||||
<?php $form = ActiveForm::begin(); ?>
|
||||
|
||||
<?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
|
||||
|
||||
<?= $form->field($model, 'login')->textInput(['maxlength' => true]) ?>
|
||||
|
||||
<?= $form->field($model, 'password')->passwordInput(['maxlength' => true]) ?>
|
||||
|
||||
<?= $form->field($model, 'link')->textInput(['maxlength' => true]) ?>
|
||||
|
||||
<?= $form->field($model, 'project')->textInput(['maxlength' => true]) ?>
|
||||
|
||||
<?= $form->field($model, 'info')->textarea(['rows' => 6]) ?>
|
||||
|
||||
<div class="form-group">
|
||||
<?= Html::submitButton('Сохранить', ['class' => 'btn btn-success']) ?>
|
||||
</div>
|
||||
|
||||
<?php ActiveForm::end(); ?>
|
||||
|
||||
</div>
|
39
frontend/modules/access/views/access/_search.php
Normal file
39
frontend/modules/access/views/access/_search.php
Normal file
@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\ActiveForm;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model frontend\modules\access\models\AccessSearch */
|
||||
/* @var $form yii\widgets\ActiveForm */
|
||||
?>
|
||||
|
||||
<div class="accesses-search">
|
||||
|
||||
<?php $form = ActiveForm::begin([
|
||||
'action' => ['index'],
|
||||
'method' => 'get',
|
||||
]); ?>
|
||||
|
||||
<?= $form->field($model, 'id') ?>
|
||||
|
||||
<?= $form->field($model, 'name') ?>
|
||||
|
||||
<?= $form->field($model, 'login') ?>
|
||||
|
||||
<?= $form->field($model, 'password') ?>
|
||||
|
||||
<?= $form->field($model, 'link') ?>
|
||||
|
||||
<?php // echo $form->field($model, 'project') ?>
|
||||
|
||||
<?php // echo $form->field($model, 'info') ?>
|
||||
|
||||
<div class="form-group">
|
||||
<?= Html::submitButton('Поиск', ['class' => 'btn btn-primary']) ?>
|
||||
<?= Html::resetButton('Сброс', ['class' => 'btn btn-default']) ?>
|
||||
</div>
|
||||
|
||||
<?php ActiveForm::end(); ?>
|
||||
|
||||
</div>
|
18
frontend/modules/access/views/access/create.php
Normal file
18
frontend/modules/access/views/access/create.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model common\models\Accesses */
|
||||
|
||||
$this->title = 'Добавить';
|
||||
$this->params['breadcrumbs'][] = ['label' => 'Accesses', 'url' => ['index']];
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
?>
|
||||
<div class="accesses-create">
|
||||
|
||||
<?= $this->render('_form', [
|
||||
'model' => $model,
|
||||
]) ?>
|
||||
|
||||
</div>
|
41
frontend/modules/access/views/access/index.php
Executable file → Normal file
41
frontend/modules/access/views/access/index.php
Executable file → Normal file
@ -1,14 +1,37 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\grid\GridView;
|
||||
|
||||
$this->title = 'Доступы';
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $searchModel frontend\modules\access\models\AccessSearch */
|
||||
/* @var $dataProvider yii\data\ActiveDataProvider */
|
||||
|
||||
echo GridView::widget([
|
||||
'dataProvider' => $dataProvider,
|
||||
'columns' => [
|
||||
['class' => 'yii\grid\SerialColumn'],
|
||||
'name',
|
||||
'access',
|
||||
],
|
||||
]);
|
||||
$this->title = 'Доступы';
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
?>
|
||||
<div class="accesses-index">
|
||||
|
||||
<?php // echo $this->render('_search', ['model' => $searchModel]); ?>
|
||||
|
||||
<p>
|
||||
<?= Html::a('Добавить', ['create'], ['class' => 'btn btn-success']) ?>
|
||||
</p>
|
||||
|
||||
<?= GridView::widget([
|
||||
'dataProvider' => $dataProvider,
|
||||
'columns' => [
|
||||
['class' => 'yii\grid\SerialColumn'],
|
||||
'id',
|
||||
'name',
|
||||
'login',
|
||||
'password',
|
||||
'link',
|
||||
'project',
|
||||
[
|
||||
'class' => 'yii\grid\ActionColumn',
|
||||
'template' => '{view} {update}',
|
||||
],
|
||||
],
|
||||
]); ?>
|
||||
</div>
|
||||
|
19
frontend/modules/access/views/access/update.php
Normal file
19
frontend/modules/access/views/access/update.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model common\models\Accesses */
|
||||
|
||||
$this->title = 'Изменить';
|
||||
$this->params['breadcrumbs'][] = ['label' => 'Доступы', 'url' => ['index']];
|
||||
$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]];
|
||||
$this->params['breadcrumbs'][] = 'Изменить';
|
||||
?>
|
||||
<div class="accesses-update">
|
||||
|
||||
<?= $this->render('_form', [
|
||||
'model' => $model,
|
||||
]) ?>
|
||||
|
||||
</div>
|
40
frontend/modules/access/views/access/view.php
Normal file
40
frontend/modules/access/views/access/view.php
Normal file
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\DetailView;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model common\models\Accesses */
|
||||
|
||||
$this->title = $model->name;
|
||||
$this->params['breadcrumbs'][] = ['label' => 'Accesses', 'url' => ['index']];
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
\yii\web\YiiAsset::register($this);
|
||||
?>
|
||||
<div class="accesses-view">
|
||||
<p>
|
||||
<?= Html::a('Изменить', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
|
||||
<?= Html::a('Удалить', ['delete', 'id' => $model->id], [
|
||||
'class' => 'btn btn-danger',
|
||||
'data' => [
|
||||
'confirm' => 'Вы уверенны, что хотите удалить эту запись?',
|
||||
'method' => 'post',
|
||||
],
|
||||
]) ?>
|
||||
<?= Html::a('Список', ['index'], ['class' => 'btn btn-primary']) ?>
|
||||
</p>
|
||||
|
||||
<?= DetailView::widget([
|
||||
'model' => $model,
|
||||
'attributes' => [
|
||||
'id',
|
||||
'name',
|
||||
'login',
|
||||
'password',
|
||||
'link',
|
||||
'project',
|
||||
'info:ntext',
|
||||
],
|
||||
]) ?>
|
||||
|
||||
</div>
|
Loading…
Reference in New Issue
Block a user