/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Infocompany::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', $this->name])->andFilterWhere(['like', 'logo', $this->logo])->andFilterWhere(['like', 'address', $this->address])->andFilterWhere(['like', 'mobile', $this->mobile])->andFilterWhere(['like', 'tel', $this->tel])->andFilterWhere(['like', 'email', $this->email])->andFilterWhere(['like', 'license', $this->license])->andFilterWhere(['like', 'fax', $this->fax])->andFilterWhere(['like', 'website', $this->website])->andFilterWhere(['like', 'facebook', $this->facebook])->andFilterWhere(['like', 'skype', $this->skype])->andFilterWhere(['like', 'zalo', $this->zalo])->andFilterWhere(['like', 'yahoo', $this->yahoo])->andFilterWhere(['like', 'viber', $this->viber])->andFilterWhere(['like', 'map', $this->map])->andFilterWhere(['like', 'video', $this->video]); return $dataProvider; }
/** * Creates a new Booktour model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionBooktour() { $this->layout = "main"; $model = new Booktour(); $vietTravel = Infocompany::find()->where(['id' => 1])->one(); if ($model->load(Yii::$app->request->post())) { $model->fullname = $_POST['genderName'] . " " . $model->fullname; if ($model->save()) { $info = Infocompany::find()->where(['id' => 1])->one(); Yii::$app->mailer->compose('@app/views/mail/mail-layout', ['model' => $model])->setFrom($model->email)->setTo($vietTravel->email)->setSubject('[vietnam-vietviettravel.com] ' . $model->fullname . " Book tour")->send(); return $this->render('@app/views/booktour/success', ['model' => $model]); } } else { return $this->render('create', ['model' => $model]); } }
<?php /* @var $this \yii\web\View */ /* @var $content string */ use yii\helpers\Html; use yii\bootstrap\Nav; use yii\bootstrap\NavBar; use yii\widgets\Breadcrumbs; use app\assets\AppAsset; use app\models\Infocompany; use app\models\Slide; use app\models\Article; use yii\widgets\ActiveForm; AppAsset::register($this); /* select info company */ $info = Infocompany::find()->one(); /* select slide */ $slides = Slide::find()->where(['position' => '1'])->all(); /* select article*/ $article = Article::find()->where(['hot' => '1'])->all(); /* select article services */ $articleService = Article::find()->where(['type' => "100"])->all(); $services = []; for ($i = 0; $i < count($articleService); $i++) { $services[] = ['label' => $articleService[$i]->title, 'url' => ['article/' . implode('-', explode(' ', $articleService[$i]->title))]]; } $this->title = $info->name; $hotelInfo = \app\models\Location::find()->all(); $hotelMenu = []; for ($i = 0; $i < count($hotelInfo); $i++) { $item = [];
<?php /* @var $this yii\web\View */ /* @var $form yii\bootstrap\ActiveForm */ /* @var $model app\models\LoginForm */ use yii\helpers\Html; use yii\bootstrap\ActiveForm; /*$this->title = 'Login'; $this->params['breadcrumbs'][] = $this->title;*/ $company = \app\models\Infocompany::find()->where(['id' => 1])->one(); ?> <div class="admin"> <?php echo \yii\helpers\Html::img('@web/images/' . $company->logo, ['alt' => 'logo', 'class' => 'logo-size']); ?> <div class="admin-login"> <?php $form = ActiveForm::begin(['id' => 'login-form', 'options' => ['role' => 'form'], 'method' => 'post', 'action' => ['admin/login'], 'fieldConfig' => ['template' => "{label}<div class=\"col-md-12\">{input}</div>\n<div class=\"col-md-12\">{error}</div>", 'labelOptions' => ['class' => 'control-label']]]); ?> <?php echo $form->field($model, 'email'); ?> <?php echo $form->field($model, 'password')->passwordInput(); ?> <?php
?> <?php echo $form->field($model, 'address')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'regdate', ['options' => ['class' => 'sr-only']])->textInput(['value' => date('Y-m-d')]); ?> <?php echo $form->field($model, 'status')->dropDownList(['1' => 'Active', '0' => 'DeActive']); ?> <?php echo $form->field($model, 'phone')->textInput(['placeholder' => \app\models\Infocompany::find()->where(['id' => 1])->one()->mobile, 'value' => \app\models\Infocompany::find()->where(['id' => 1])->one()->mobile]); ?> <?php echo $form->field($model, 'simg', ['options' => ['name' => 'simg', 'class' => 'form-group']])->label('Smallimg')->widget(FileInput::classname(), ['options' => ['accept' => 'image/*', 'name' => 'smallimg'], 'pluginOptions' => ['uploadUrl' => \yii\helpers\Url::to(['/file-upload/upload']), 'maxFileCount' => 1, 'autoReplace' => true], 'pluginEvents' => ['fileuploaded' => 'function(event, data, previewId, index){ var fileName = data.files[index].name.replace(" ", "_"); $("#hotel-smallimg").val(fileName); }', 'filesuccessremove' => 'function(event, id){ var name = $("#" + id + " img").attr("title"), fileName = name.replace(" ", "_"); $.post("/file-upload/delete/" + fileName); $("#hotel-smallimg").val(""); }']]);