/**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Item::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['item_no' => $this->item_no, 'max_life_time' => $this->max_life_time, 'current_life_time' => $this->current_life_time, 'hourly_price' => $this->hourly_price]);
     $query->andFilterWhere(['like', 'status', $this->status])->andFilterWhere(['like', 'model', $this->model])->andFilterWhere(['like', 'manufaturer', $this->manufaturer])->andFilterWhere(['like', 'type', $this->type]);
     return $dataProvider;
 }
예제 #2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Item::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->joinWith('category');
     $query->andFilterWhere(['id' => $this->id]);
     $query->andFilterWhere(['like', 'itemname', $this->itemname])->andFilterWhere(['like', 'category.name', $this->categoryID]);
     return $dataProvider;
 }
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getItems()
 {
     return $this->hasMany(Item::className(), ['item_sub_category_id' => 'sub_category_id']);
 }
예제 #4
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getItems()
 {
     return $this->hasMany(Item::className(), ['categoryID' => 'id']);
 }
예제 #5
0
 /**
  * Finds the Item model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Item the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Item::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
예제 #6
0
   
    <?php 
echo $form->field($event, 'end_date_time')->widget(DateTimePicker::className(), ['language' => 'english', 'pickButtonIcon' => 'glyphicon glyphicon-time', 'inline' => false, 'clientOptions' => ['autoclose' => true, 'linkFormat' => 'HH:ii P', 'todayBtn' => false]]);
?>

   <?php 
echo $form->field($event, 'type')->dropDownList(['Wedding' => 'Wedding', 'Party' => 'Party', 'Meeting' => 'Meeting', 'Religious event' => 'Religious event', 'Other' => 'Other'], ['prompt' => '']);
?>
  
   



    <?php 
echo $form->field($model, 'item_1')->dropDownList(ArrayHelper::map(Item::find()->all(), 'type', 'type'), ['prompt' => 'Select item']);
?>
   


   <?php 
echo $form->field($model, 'qtyItem_1')->textInput();
?>


    <?php 
echo $form->field($model, 'advanced_payment')->textInput();
?>

    
      
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getItem()
 {
     return $this->hasOne(Item::className(), ['item_id' => 'item_id']);
 }