/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = EdgeCourse::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(['course_id' => $this->course_id, 'starting_date' => $this->starting_date, 'week_num' => $this->week_num, 'associated_cid' => $this->associated_cid, "status" => "active"]); $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'status', $this->status])->andFilterWhere(['like', 'detail', $this->detail])->andFilterWhere(['like', 'is_oriantation', $this->is_oriantation])->andFilterWhere(['like', 'sfcoID', $this->sfcoID])->andFilterWhere(['like', 'courseImage', $this->courseImage]); return $dataProvider; }
echo $form->field($model, 'status')->dropDownList(["active" => "active", "inactive" => "inactive"]); ?> <?php echo $form->field($model, 'week_num')->textInput(); ?> <?php echo $form->field($model, 'is_oriantation')->dropDownList(['0' => "No", '1' => "Yes"], ['prompt' => '-- Is orientation program --']); ?> <?php echo $form->field($model, 'associated_cid')->dropDownList(ArrayHelper::map(EdgeCourse::find()->where("status = 'active' AND course_id != :course_id AND is_oriantation = '0'", [":course_id" => $cID])->all(), "course_id", "name"), ["prompt" => "--Select Course --"]); ?> <?php echo $form->field($model, 'courseImage')->fileInput(); ?> <div class="form-group"> <?php echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?> </div> <?php ActiveForm::end(); ?>
<?php use yii\helpers\Html; use yii\widgets\ActiveForm; use yii\helpers\ArrayHelper; use yii\jui\AutoComplete; use yii\web\JsExpression; use common\models\EdgeCourse; $courseAr = ArrayHelper::map(EdgeCourse::find(["status" => "active"])->all(), "course_id", "name"); $form = ActiveForm::begin(); ?> <?php echo $form->field($model, 'course_id')->dropDownList($courseAr, ["prompt" => "Choose..."]); ?> <div class="form-group"> <label for="edgevolunteer-reference_id" class="control-label">Student Name</label> <?php echo AutoComplete::widget(['name' => 'State', 'id' => 'edgevolunteer-reference_id', 'options' => ["class" => "form-control"], 'clientOptions' => ['source' => new JsExpression("function(request, response) {\n \t\t\t\t\$.getJSON('/admin/edge/getstudentforen/'+jQuery('#edgevolunteer-course_id').val(), {\n \t\t\t\tterm: jQuery('#edgevolunteer-reference_id').val()\n \t\t\t\t}, response);\n\t\t\t\t}"), 'minLength' => "3", 'select' => new JsExpression("function( event, ui ) {\n \t\tvar text = '<div class=\\'col-xs-3\\'><div class=\\'checkbox\\'><label><input type=\\'checkbox\\' value=\\''+ui.item.id+'\\' name=\\'enrollStudent[]\\'>'+ui.item.label+'</label></div></div>';\n jQuery('#assignS').show().append(text);\n jQuery('#edgevolunteer-reference_id').val('');\n return false;\n \t\t}")]]); ?> </div> <div class="row" id="" style=""> </div> <div class="row" id="assignS" style="display: none;"> <div class='col-xs-12'><a href="javascript:void(0)" onclick="Util._checkAll('assignS')">Check All</a> <a href="javascript:void(0)" onclick="Util._unCheckAll('assignS')">Uncheck All</a></div> </div> <div class="form-group"> <?php echo Html::submitButton($model->isNewRecord ? 'Enroll Student' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?> </div>
/** * Finds the EdgeCourse model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return EdgeCourse the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = EdgeCourse::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }