/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Priority::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, 'priorityCreate' => $this->priorityCreate, 'priorityUpdate' => $this->priorityUpdate]); $query->andFilterWhere(['like', 'priorityName', $this->priorityName])->andFilterWhere(['like', 'priorityDesc', $this->priorityDesc]); return $dataProvider; }
/** * Finds the Priority model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Priority the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Priority::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
echo '<img src="' . \Yii::$app->request->BaseUrl . '/' . $model->documentImage . '" width="90px"> '; //echo Html::a('Delete Logo', ['uploads/', 'id'=>$model->id, 'field'=> 'documentImage'], ['class'=>'btn btn-danger']).'<p>'; } ?> <?php echo $form->field($model, 'category_id')->dropDownList(ArrayHelper::map(\common\models\Category::find()->all(), 'id', 'categoryName'), ['prompt' => 'Category']); ?> <?php echo $form->field($model, 'type_id')->dropDownList(ArrayHelper::map(\common\models\Type::find()->all(), 'id', 'typeName'), ['prompt' => 'Type']); ?> <?php echo $form->field($model, 'priority_id')->dropDownList(ArrayHelper::map(\common\models\Priority::find()->all(), 'id', 'priorityName'), ['prompt' => 'Priority']); ?> <?php echo $form->field($model, 'companyAgency_id')->dropDownList(ArrayHelper::map(\common\models\Companyagency::find()->all(), 'id', 'companyAgencyName'), ['prompt' => 'Company Agency']); ?> <?php echo $form->field($model, 'section_id')->dropDownList(ArrayHelper::map(\common\models\Section::find()->all(), 'id', 'sectionName'), ['prompt' => 'Section']); ?> <div class="form-group"> <?php echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?> </div>
/** * @return \yii\db\ActiveQuery */ public function getPriority() { return $this->hasOne(Priority::className(), ['id' => 'priority_id']); }