Esempio n. 1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = TblAssetLoanPurpose::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', 'purpose', $this->purpose]);
     return $dataProvider;
 }
 /**
  * Finds the TblAssetLoanPurpose model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return TblAssetLoanPurpose the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = TblAssetLoanPurpose::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Esempio n. 3
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getPurPose()
 {
     return $this->hasOne(TblAssetLoanPurpose::className(), ['id' => 'purpose']);
 }
Esempio n. 4
0
    <!--?= $form->field($model, 'update_date')->widget(\yii\jui\DatePicker::classname(), [
    'language' => 'eng',
    'dateFormat' => 'yyyy-MM-dd',
]) ?-->

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

    <?php 
echo $form->field($model, 'inventory')->textInput(['maxlength' => true]);
?>

    <?php 
echo $form->field($model, 'purpose')->dropDownList(ArrayHelper::map(TblAssetLoanPurpose::find()->all(), 'id', 'purpose'), ['prompt' => 'Select purpose']);
?>

    <?php 
echo $form->field($model, 'purpose_other')->textarea(['rows' => 6]);
?>

    <?php 
echo $form->field($model, 'comments')->textInput(['maxlength' => true]);
?>

    <?php 
echo $form->field($model, 'expected_return')->widget(\yii\jui\DatePicker::classname(), ['language' => 'eng', 'dateFormat' => 'yyyy-MM-dd']);
?>

    <?php