diff --git a/backend/assets/AppAsset.php b/backend/assets/AppAsset.php
index 940c0af..21e4b4b 100755
--- a/backend/assets/AppAsset.php
+++ b/backend/assets/AppAsset.php
@@ -15,6 +15,7 @@ class AppAsset extends AssetBundle
'css/site.css',
];
public $js = [
+ 'js/site.js',
];
public $depends = [
'yii\web\YiiAsset',
diff --git a/backend/config/main.php b/backend/config/main.php
index f00ca39..1a97a25 100755
--- a/backend/config/main.php
+++ b/backend/config/main.php
@@ -41,6 +41,9 @@ return [
'notes' => [
'class' => 'backend\modules\notes\Notes',
],
+ 'calendar' => [
+ 'class' => 'backend\modules\calendar\Calendar',
+ ],
],
'components' => [
'request' => [
diff --git a/backend/modules/accesses/models/Accesses.php b/backend/modules/accesses/models/Accesses.php
index 93aed81..741b21e 100755
--- a/backend/modules/accesses/models/Accesses.php
+++ b/backend/modules/accesses/models/Accesses.php
@@ -4,6 +4,7 @@
namespace app\modules\accesses\models;
use common\classes\Debug;
+use common\models\FieldsValueNew;
use Yii;
/**
@@ -17,5 +18,73 @@ use Yii;
class Accesses extends \common\models\Accesses
{
+ public $fields;
+
+ public function init()
+ {
+ parent::init();
+
+ $fieldValue = FieldsValueNew::find()->where(
+ [
+ 'item_id' => \Yii::$app->request->get('id'),
+ 'item_type' => FieldsValueNew::TYPE_ACCESS,
+ ]
+ )
+ ->all();
+ $array = [];
+ if (!empty($fieldValue)) {
+ foreach ($fieldValue as $item) {
+ array_push(
+ $array,
+ [
+ 'field_id' => $item->field_id,
+ 'value' => $item->value,
+ 'order' => $item->order,
+ 'type_file' => $item->type_file,
+ 'field_name' => $item->field->name
+ ]
+ );
+ }
+ $this->fields = $array;
+ } else {
+ $this->fields = [
+ [
+ 'field_id' => null,
+ 'value' => null,
+ 'order' => null,
+ 'field_name' => null,
+ 'type_file' => null,
+ ],
+ ];
+ }
+ }
+
+ public function afterSave($insert, $changedAttributes)
+ {
+ $post = \Yii::$app->request->post('Aceesses');
+
+ if ($post['fields']) {
+ FieldsValueNew::deleteAll(['item_id' => $this->id, 'item_type' => FieldsValueNew::TYPE_ACCESS]);
+ foreach ($post['fields'] as $item) {
+ $item['value'] = urldecode($item['value']);
+
+ $fieldsValue = new FieldsValueNew();
+ $fieldsValue->field_id = $item['field_id'];
+ $fieldsValue->value = $item['value'];
+ $fieldsValue->order = $item['order'];
+ $fieldsValue->item_id = $this->id;
+ $fieldsValue->item_type = FieldsValueNew::TYPE_ACCESS;
+ if (is_file(Yii::getAlias('@frontend') . '/web/' . $item['value'])) {
+ $fieldsValue->type_file = 'file';
+ } else {
+ $fieldsValue->type_file = 'text';
+ }
+
+ $fieldsValue->save();
+ }
+ }
+
+ parent::afterSave($insert, $changedAttributes); // TODO: Change the autogenerated stub
+ }
}
\ No newline at end of file
diff --git a/backend/modules/accesses/models/AccessesSearch.php b/backend/modules/accesses/models/AccessesSearch.php
index 709710a..4f375df 100755
--- a/backend/modules/accesses/models/AccessesSearch.php
+++ b/backend/modules/accesses/models/AccessesSearch.php
@@ -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;
}
diff --git a/backend/modules/accesses/views/accesses/_form.php b/backend/modules/accesses/views/accesses/_form.php
index 51f16f9..0895c92 100755
--- a/backend/modules/accesses/views/accesses/_form.php
+++ b/backend/modules/accesses/views/accesses/_form.php
@@ -1,5 +1,7 @@
field($model, 'name')->textInput(['maxlength' => true]) ?>
- = $form->field($model, 'access')->textarea(['maxlength' => true]) ?>
+ = $form->field($model, 'login')->textInput(['maxlength' => true]) ?>
-
-
- = 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
- ],
- ]
- ) ?>
-
-
+ = $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]) ?>
+
+
+
+ $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
+// ],
+// ]
+// ) ?>
+
+
Пользователи
- = Select2::widget(
+ $model,
'attribute' => '_users',
@@ -47,13 +58,12 @@ use kartik\select2\Select2;
'pluginOptions' => [
'allowClear' => true
],
- ]
- ) ?>
+ ]); ?>
- = Html::submitButton('Сохранить', ['class' => 'btn btn-success']) ?>
+ = '
' . Html::submitButton('Сохранить', ['class' => 'btn btn-success']) ?>
diff --git a/backend/modules/accesses/views/accesses/_search.php b/backend/modules/accesses/views/accesses/_search.php
index 40b1d85..cae9add 100755
--- a/backend/modules/accesses/views/accesses/_search.php
+++ b/backend/modules/accesses/views/accesses/_search.php
@@ -19,8 +19,6 @@ use yii\widgets\ActiveForm;
= $form->field($model, 'name') ?>
- = $form->field($model, 'access') ?>
-
= Html::submitButton('Поиск', ['class' => 'btn btn-primary']) ?>
= Html::resetButton('Сброс', ['class' => 'btn btn-default']) ?>
diff --git a/backend/modules/accesses/views/accesses/index.php b/backend/modules/accesses/views/accesses/index.php
index 05d1c81..0507d75 100755
--- a/backend/modules/accesses/views/accesses/index.php
+++ b/backend/modules/accesses/views/accesses/index.php
@@ -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'],
],
]); ?>
diff --git a/backend/modules/accesses/views/accesses/view.php b/backend/modules/accesses/views/accesses/view.php
index 7310ef2..bc75044 100755
--- a/backend/modules/accesses/views/accesses/view.php
+++ b/backend/modules/accesses/views/accesses/view.php
@@ -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();
+// },
+// ],
],
]) ?>
diff --git a/backend/modules/calendar/Calendar.php b/backend/modules/calendar/Calendar.php
new file mode 100644
index 0000000..f16ab3d
--- /dev/null
+++ b/backend/modules/calendar/Calendar.php
@@ -0,0 +1,24 @@
+all();
+ $user_array = array();
+ try {
+ if($_GET['month'] == 00)
+ $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
+ else {
+ foreach ($user_card as $value) {
+ if (substr(substr($value->dob, 5), 0, 2) == $_GET['month'])
+ array_push($user_array, $value);
+ }
+ $dataProvider = new ArrayDataProvider([
+ 'allModels' => $user_array,
+ ]);
+ }
+ } catch (\Exception $e) {
+ $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
+ }
+
+ return $this->render('index', [
+ 'searchModel' => $searchModel,
+ 'dataProvider' => $dataProvider,
+ ]);
+ }
+}
diff --git a/backend/modules/calendar/views/calendar/index.php b/backend/modules/calendar/views/calendar/index.php
new file mode 100644
index 0000000..148d8a5
--- /dev/null
+++ b/backend/modules/calendar/views/calendar/index.php
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+ 'reload']);
+echo GridView::widget([
+ 'dataProvider' => $dataProvider,
+ 'filterModel' => $searchModel,
+ 'columns' => [
+ ['class' => 'yii\grid\SerialColumn'],
+ 'fio',
+ 'dob',
+ ['class' => 'yii\grid\ActionColumn'],
+ ],
+]);
+Pjax::end();
+?>
\ No newline at end of file
diff --git a/backend/modules/card/controllers/UserCardController.php b/backend/modules/card/controllers/UserCardController.php
index 094d4d8..6c4f95f 100755
--- a/backend/modules/card/controllers/UserCardController.php
+++ b/backend/modules/card/controllers/UserCardController.php
@@ -47,9 +47,21 @@ class UserCardController extends Controller
$searchModel = new UserCardSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
+ $total = 0;
+ if(Yii::$app->request->queryParams)
+ foreach (Yii::$app->request->queryParams as $params)
+ $total = \common\models\UserCard::find()->filterWhere([
+ 'fio' => $params['fio'],
+ 'email' => $params['email'],
+ 'status' => $params['status'],
+ 'skills' => $params['skills'],
+ ])->sum('salary');
+ else $total = \common\models\UserCard::find()->sum('salary');
+
return $this->render('index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
+ 'total' => $total,
]);
}
diff --git a/backend/modules/card/models/UserCard.php b/backend/modules/card/models/UserCard.php
index 9365b92..8557172 100755
--- a/backend/modules/card/models/UserCard.php
+++ b/backend/modules/card/models/UserCard.php
@@ -105,7 +105,7 @@ class UserCard extends \common\models\UserCard
parent::afterSave($insert, $changedAttributes); // TODO: Change the autogenerated stub
}
- public function generateUser($email, $status)
+ public static function generateUser($email, $status)
{
$user = new User();
$auth_key = Yii::$app->security->generateRandomString();
@@ -126,13 +126,13 @@ class UserCard extends \common\models\UserCard
return $user->id;
}
- public function genereateLinlkOnUser($user_card, $user_id)
+ public static function genereateLinlkOnUser($user_card, $user_id)
{
$user_card->id_user = $user_id;
$user_card->save();
}
- public function generateUserForUserCard($card_id = null)
+ public static function generateUserForUserCard($card_id = null)
{
$userCardQuery = UserCard::find();
$card_id ? $userCardQuery->where(['id' => $card_id]) : $userCardQuery->where(['id_user' => NULL]);
diff --git a/backend/modules/card/views/user-card/index.php b/backend/modules/card/views/user-card/index.php
index 622adeb..daa3136 100755
--- a/backend/modules/card/views/user-card/index.php
+++ b/backend/modules/card/views/user-card/index.php
@@ -8,6 +8,7 @@ use yii\widgets\ListView;
/* @var $this yii\web\View */
/* @var $searchModel backend\modules\card\models\UserCardSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
+/* @var $total */
$this->title = 'Профили';
$this->params['breadcrumbs'][] = $this->title;
@@ -19,7 +20,8 @@ $this->params['breadcrumbs'][] = $this->title;
= Html::a('Сгенерировать пользователей', ['generate'], ['class' => 'btn btn-success']) ?>
- = GridView::widget([
+ $dataProvider,
'filterModel' => $searchModel,
'columns' => [
@@ -83,5 +85,7 @@ $this->params['breadcrumbs'][] = $this->title;
['class' => 'yii\grid\ActionColumn'],
],
- ]); ?>
+ ]);
+ echo "
Сумма зарплат: " . $total . "
";
+ ?>
\ No newline at end of file
diff --git a/backend/views/layouts/left.php b/backend/views/layouts/left.php
index 7dea35c..9a4d4f9 100755
--- a/backend/views/layouts/left.php
+++ b/backend/views/layouts/left.php
@@ -47,6 +47,7 @@
['label' => 'Отпуска', 'icon' => 'plane', 'url' => ['/holiday/holiday'], 'active' => \Yii::$app->controller->id == 'holiday'],
['label' => 'Доступы', 'icon' => 'key', 'url' => ['/accesses/accesses'], 'active' => \Yii::$app->controller->id == 'accesses'],
['label' => 'Заметки', 'icon' => 'sticky-note', 'url' => ['/notes/notes'], 'active' => \Yii::$app->controller->id == 'notes'],
+ ['label' => 'Календарь ДР', 'icon' => 'calendar', 'url' => ['/calendar/calendar'], 'active' => \Yii::$app->controller->id == 'calendar'],
/*['label' => 'Gii', 'icon' => 'file-code-o', 'url' => ['/gii']],
['label' => 'Debug', 'icon' => 'dashboard', 'url' => ['/debug']],
diff --git a/backend/web/js/site.js b/backend/web/js/site.js
new file mode 100644
index 0000000..510e486
--- /dev/null
+++ b/backend/web/js/site.js
@@ -0,0 +1,7 @@
+$(function(){
+ $('#options').change(function(){
+ month = $('#options :selected').val();
+ history.pushState({}, '', month);
+ $.pjax.reload({container:"#reload"});
+ })
+});
\ No newline at end of file
diff --git a/common/models/Accesses.php b/common/models/Accesses.php
index 4d3c6c9..3d49c97 100755
--- a/common/models/Accesses.php
+++ b/common/models/Accesses.php
@@ -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' => 'Дополнительная информация',
];
}
diff --git a/common/models/FieldsValueNew.php b/common/models/FieldsValueNew.php
index ca60f82..0dd7d32 100755
--- a/common/models/FieldsValueNew.php
+++ b/common/models/FieldsValueNew.php
@@ -26,6 +26,7 @@ class FieldsValueNew extends \yii\db\ActiveRecord
const TYPE_COMPANY = 2;
const TYPE_BALANCE = 3;
const TYPE_NOTE = 4;
+ const TYPE_ACCESS = 5;
/**
* {@inheritdoc}
diff --git a/common/models/UseField.php b/common/models/UseField.php
index c451261..1209d3a 100755
--- a/common/models/UseField.php
+++ b/common/models/UseField.php
@@ -23,6 +23,7 @@ class UseField extends \yii\db\ActiveRecord
const USE_COMPANY = 2;
const USE_BALANCE = 3;
const USE_NOTE = 4;
+ const USE_ACCESS = 5;
/**
@@ -72,7 +73,8 @@ class UseField extends \yii\db\ActiveRecord
self::USE_PROJECT => 'Проект',
self::USE_COMPANY => 'Компания',
self::USE_BALANCE => 'Баланс',
- self::USE_NOTE => 'Заметка'
+ self::USE_NOTE => 'Заметка',
+ self::USE_ACCESS => 'Доступ'
];
}
diff --git a/console/migrations/m200121_115737_drop_access_column_from_accesses_table.php b/console/migrations/m200121_115737_drop_access_column_from_accesses_table.php
new file mode 100644
index 0000000..e7ca433
--- /dev/null
+++ b/console/migrations/m200121_115737_drop_access_column_from_accesses_table.php
@@ -0,0 +1,25 @@
+dropColumn('{{%accesses}}', 'access');
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function safeDown()
+ {
+ $this->addColumn('{{%accesses}}', 'access', $this->string());
+ }
+}
diff --git a/console/migrations/m200121_120006_add_login_column_to_accesses_table.php b/console/migrations/m200121_120006_add_login_column_to_accesses_table.php
new file mode 100644
index 0000000..4cbb9eb
--- /dev/null
+++ b/console/migrations/m200121_120006_add_login_column_to_accesses_table.php
@@ -0,0 +1,25 @@
+addColumn('{{%accesses}}', 'login', $this->string());
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function safeDown()
+ {
+ $this->dropColumn('{{%accesses}}', 'login');
+ }
+}
diff --git a/console/migrations/m200121_120121_add_password_column_to_accesses_table.php b/console/migrations/m200121_120121_add_password_column_to_accesses_table.php
new file mode 100644
index 0000000..2e78572
--- /dev/null
+++ b/console/migrations/m200121_120121_add_password_column_to_accesses_table.php
@@ -0,0 +1,31 @@
+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');
+ }
+}
diff --git a/frontend/modules/access/controllers/AccessController.php b/frontend/modules/access/controllers/AccessController.php
old mode 100755
new mode 100644
index 8eb6c2c..d6e4c4a
--- a/frontend/modules/access/controllers/AccessController.php
+++ b/frontend/modules/access/controllers/AccessController.php
@@ -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.');
}
}
diff --git a/frontend/modules/access/models/Access.php b/frontend/modules/access/models/Access.php
new file mode 100644
index 0000000..3ffeb0d
--- /dev/null
+++ b/frontend/modules/access/models/Access.php
@@ -0,0 +1,29 @@
+ 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();
+ }
+}
\ No newline at end of file
diff --git a/frontend/modules/access/models/AccessSearch.php b/frontend/modules/access/models/AccessSearch.php
new file mode 100644
index 0000000..9f173ba
--- /dev/null
+++ b/frontend/modules/access/models/AccessSearch.php
@@ -0,0 +1,73 @@
+ $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;
+ }
+}
diff --git a/frontend/modules/access/views/access/_form.php b/frontend/modules/access/views/access/_form.php
new file mode 100644
index 0000000..4b979f7
--- /dev/null
+++ b/frontend/modules/access/views/access/_form.php
@@ -0,0 +1,33 @@
+
+
+
diff --git a/frontend/modules/access/views/access/_search.php b/frontend/modules/access/views/access/_search.php
new file mode 100644
index 0000000..ab44ab4
--- /dev/null
+++ b/frontend/modules/access/views/access/_search.php
@@ -0,0 +1,39 @@
+
+
+
+
+ ['index'],
+ 'method' => 'get',
+ ]); ?>
+
+ = $form->field($model, 'id') ?>
+
+ = $form->field($model, 'name') ?>
+
+ = $form->field($model, 'login') ?>
+
+ = $form->field($model, 'password') ?>
+
+ = $form->field($model, 'link') ?>
+
+ field($model, 'project') ?>
+
+ field($model, 'info') ?>
+
+
+ = Html::submitButton('Поиск', ['class' => 'btn btn-primary']) ?>
+ = Html::resetButton('Сброс', ['class' => 'btn btn-default']) ?>
+
+
+
+
+
diff --git a/frontend/modules/access/views/access/create.php b/frontend/modules/access/views/access/create.php
new file mode 100644
index 0000000..09486ea
--- /dev/null
+++ b/frontend/modules/access/views/access/create.php
@@ -0,0 +1,18 @@
+title = 'Добавить';
+$this->params['breadcrumbs'][] = ['label' => 'Accesses', 'url' => ['index']];
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+
+ = $this->render('_form', [
+ 'model' => $model,
+ ]) ?>
+
+
diff --git a/frontend/modules/access/views/access/index.php b/frontend/modules/access/views/access/index.php
old mode 100755
new mode 100644
index 4340a7c..415c7fc
--- a/frontend/modules/access/views/access/index.php
+++ b/frontend/modules/access/views/access/index.php
@@ -1,14 +1,37 @@
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;
+?>
+
+
+ render('_search', ['model' => $searchModel]); ?>
+
+
+ = Html::a('Добавить', ['create'], ['class' => 'btn btn-success']) ?>
+
+
+ = GridView::widget([
+ 'dataProvider' => $dataProvider,
+ 'columns' => [
+ ['class' => 'yii\grid\SerialColumn'],
+ 'id',
+ 'name',
+ 'login',
+ 'password',
+ 'link',
+ 'project',
+ [
+ 'class' => 'yii\grid\ActionColumn',
+ 'template' => '{view} {update}',
+ ],
+ ],
+ ]); ?>
+
diff --git a/frontend/modules/access/views/access/update.php b/frontend/modules/access/views/access/update.php
new file mode 100644
index 0000000..0e59e05
--- /dev/null
+++ b/frontend/modules/access/views/access/update.php
@@ -0,0 +1,19 @@
+title = 'Изменить';
+$this->params['breadcrumbs'][] = ['label' => 'Доступы', 'url' => ['index']];
+$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]];
+$this->params['breadcrumbs'][] = 'Изменить';
+?>
+
+
+ = $this->render('_form', [
+ 'model' => $model,
+ ]) ?>
+
+
diff --git a/frontend/modules/access/views/access/view.php b/frontend/modules/access/views/access/view.php
new file mode 100644
index 0000000..8a9c95e
--- /dev/null
+++ b/frontend/modules/access/views/access/view.php
@@ -0,0 +1,40 @@
+title = $model->name;
+$this->params['breadcrumbs'][] = ['label' => 'Accesses', 'url' => ['index']];
+$this->params['breadcrumbs'][] = $this->title;
+\yii\web\YiiAsset::register($this);
+?>
+
+
+ = 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']) ?>
+
+
+ = DetailView::widget([
+ 'model' => $model,
+ 'attributes' => [
+ 'id',
+ 'name',
+ 'login',
+ 'password',
+ 'link',
+ 'project',
+ 'info:ntext',
+ ],
+ ]) ?>
+
+
diff --git a/frontend/modules/card/views/user-card/_form.php b/frontend/modules/card/views/user-card/_form.php
index aaf3967..eeefc53 100755
--- a/frontend/modules/card/views/user-card/_form.php
+++ b/frontend/modules/card/views/user-card/_form.php
@@ -15,6 +15,22 @@ use yii\helpers\ArrayHelper;
+ = $form->field($model, 'fio')->textInput(['maxlength' => true]) ?>
+
+ = $form->field($model, 'email')->textInput(['maxlength' => true]) ?>
+
+ = $form->field($model, 'gender')->dropDownList($model->genders, ['prompt' => 'Выберите']) ?>
+
+ = $form->field($model, 'dob')->input(
+ 'date',
+ [
+ 'placeholder' => 'Zadejte svůj Datum narození',
+ 'language' => 'en',
+ "data-format" => "DD MMMM YYYY",
+
+ ]
+ ) ?>
+
= $form->field($model, 'skill')->widget(
diff --git a/frontend/modules/card/views/user-card/view.php b/frontend/modules/card/views/user-card/view.php
index ac7fb40..972feb4 100755
--- a/frontend/modules/card/views/user-card/view.php
+++ b/frontend/modules/card/views/user-card/view.php
@@ -57,8 +57,6 @@ $this->title = 'Профиль';
= $skill['skill']->name; ?>
-
- = Html::a('Добавить', ['/card/user-card/update', 'id' => $model->id], ['class' => 'btn btn-success']); ?>
Дополнительные сведения
@@ -80,4 +78,6 @@ $this->title = 'Профиль';
],
]); ?>
+ = Html::a('Изменить', ['/card/user-card/update', 'id' => $model->id], ['class' => 'btn btn-success']); ?>
+
diff --git a/frontend/web/log.txt b/frontend/web/log.txt
new file mode 100755
index 0000000..e69de29