Example #1
0
 /**
  * Finds the Zal model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Zal the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Zal::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Example #2
0
 /**
  * Updates an existing Oborud model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id
  * @return mixed
  */
 public function actionUpdate($id)
 {
     $model = $this->findModel($id);
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('update', ['model' => $model, 'zal' => Zal::find()->all()]);
     }
 }
Example #3
0
 /**
  * Updates an existing Event model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id
  * @return mixed
  */
 public function actionUpdate($id)
 {
     $model = $this->findModel($id);
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('update', ['model' => $model, 'zal' => Zal::find()->asArray()->all(), 'client' => Client::find()->asArray()->orderBy('name_client')->all(), 'users' => Users::find()->asArray()->where(['status' => 10])->orderBy('username')->all()]);
     }
 }
Example #4
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Zal::find();
     $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;
     }
     $query->andFilterWhere(['id' => $this->id]);
     $query->andFilterWhere(['like', 'name_zal', $this->name_zal]);
     return $dataProvider;
 }
Example #5
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getIdZal()
 {
     return $this->hasOne(Zal::className(), ['id' => 'id_zal']);
 }
Example #6
0
use yii\grid\GridView;
use yii\helpers\ArrayHelper;
use app\models\Zal;
/* @var $this yii\web\View */
/* @var $searchModel app\models\OborudSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
?>
<div class="oborud-index">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>
    <?php 
// echo $this->render('_search', ['model' => $searchModel]);
?>

    <p>
        <?php 
echo Html::a('Добавить оборудование', ['create'], ['class' => 'btn btn-success']);
?>
    </p>

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['attribute' => 'id_zal', 'filter' => ArrayHelper::map(Zal::find()->orderBy('name_zal')->asArray()->all(), 'id', 'name_zal'), 'label' => 'Залы', 'value' => function ($data) {
    return $data->idZal->name_zal;
}], 'name_oborud', ['class' => 'yii\\grid\\ActionColumn']]]);
?>

</div>
Example #7
0
echo DatePicker::widget(['name' => 'from_date', 'type' => DatePicker::TYPE_RANGE, 'name2' => 'to_date', 'pluginOptions' => ['autoclose' => true, 'format' => 'yyyy-mm-dd']]);
echo '<br>';
echo Html::submitButton('Создать отчет', ['class' => 'btn btn-primary']);
ActiveForm::end();
?>

    <br><br>




    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'rowOptions' => function ($model, $key, $index, $grid) {
    if ($model->updated_at !== $model->created_at) {
        return ['style' => 'background-color:#8ECEE7;'];
    }
}, 'columns' => [['attribute' => 'date_event', 'label' => 'Дата', 'format' => 'date'], ['attribute' => 'date_ned', 'label' => 'День недели', 'value' => function ($data) {
    return Yii::$app->formatter->asDate($data->date_event, 'EEEE');
}], 'name_event', 'oborud', ['attribute' => 'id_zal', 'filter' => ArrayHelper::map(\app\models\Zal::find()->orderBy('name_zal')->asArray()->all(), 'id', 'name_zal'), 'label' => 'Зал', 'value' => function ($data) {
    return $data->idZal->name_zal;
}], 'time_event', 'kofebrayk', 'furshet', ['attribute' => 'id_client', 'filter' => ArrayHelper::map(\app\models\Client::find()->orderBy('name_client')->asArray()->all(), 'id', 'name_client'), 'label' => 'Клиент', 'value' => function ($data) {
    return $data->idClient->name_client;
}], ['attribute' => 'id_users', 'filter' => ArrayHelper::map(\app\models\Users::find()->orderBy('username')->asArray()->all(), 'id', 'username'), 'label' => 'Регистратор', 'value' => function ($data) {
    return $data->idUsers->username;
}], ['attribute' => 'id_users1', 'filter' => ArrayHelper::map(\app\models\Users::find()->orderBy('username')->asArray()->all(), 'id', 'username'), 'label' => 'Ответственный', 'value' => function ($data) {
    return $data->idUsers1->username;
}], 'dopinfo']]);
?>

</div>