Esempio n. 1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Giftcardtypes::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['GiftCardTypeId' => $this->GiftCardTypeId, 'Amount' => $this->Amount, 'created_by' => $this->created_by, 'LastUpdatedBy' => $this->LastUpdatedBy, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at, 'deleted_at' => $this->deleted_at]);
     $query->andFilterWhere(['like', 'Name', $this->Name])->andFilterWhere(['like', 'Description', $this->Description])->andFilterWhere(['like', 'ImageUrl', $this->ImageUrl])->andFilterWhere(['like', 'Comment', $this->Comment]);
     return $dataProvider;
 }
 /**
  * Finds the Giftcardtypes model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Giftcardtypes the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Giftcardtypes::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Esempio n. 3
0
<?php

use yii\helpers\Html;
use yii\helpers\ArrayHelper;
use yii\bootstrap\ActiveForm;
use common\models\Giftcardtypes;
$dataGiftCardType = ArrayHelper::map(Giftcardtypes::find()->asArray()->all(), 'GiftCardTypeId', 'Name');
/* @var $this yii\web\View */
/* @var $model common\models\Giftcards */
/* @var $form yii\bootstrap\ActiveForm */
?>

<div class="giftcards-form">

    <?php 
$form = ActiveForm::begin(['layout' => 'horizontal']);
?>

    <?php 
echo $form->field($model, 'GiftCardTypeId', ['horizontalCssClasses' => ['wrapper' => 'col-sm-3']])->dropDownList($dataGiftCardType, ['prompt' => 'Choose a Type']);
?>

    <?php 
echo $form->field($model, 'Name', ['horizontalCssClasses' => ['wrapper' => 'col-sm-3']])->textInput(['maxlength' => 500]);
?>

    <?php 
echo $form->field($model, 'Description', ['horizontalCssClasses' => ['wrapper' => 'col-sm-3']])->textarea(['rows' => 6]);
?>

    <?php