public function actionNew($eid)
 {
     $eid = (int) $eid;
     $id = EnrolledForm::findOne($eid);
     if ($id !== null) {
         $model = new AssessmentForm();
         $student_id = (int) $id->student_id;
         $grade_level_id = (int) $id->grade_level_id;
         $student = StudentForm::findOne($id->student_id);
         $tuition = Tuition::find()->where(['grade_level_id' => $grade_level_id])->orderBy(['id' => SORT_DESC])->all();
         $model->enrolled_id = $eid;
         $tid = (int) $tuition[0]['id'];
         $model->tuition_id = $tid;
         $model->has_sibling_discount = (int) $model->has_sibling_discount;
         $model->has_book_discount = (int) $model->has_book_discount;
         $model->has_honor_discount = (int) $model->has_honor_discount;
         if (!empty($tuition)) {
             $array = $tuition;
         } else {
             throw new NotFoundHttpException('Oops, Something went wrong.');
         }
         //$tuition_detail = Tuition::find()->where(['grade_level_id' => $grade_level_id])->orderBy(['id' => SORT_DESC])->all();
         if ($model->load(Yii::$app->request->post()) && $model->save()) {
             return $this->redirect(['view', 'id' => $model->id]);
         } else {
             return $this->render('new', ['model' => $model, 'student' => $student, 'tid' => $tid, 'array' => $array]);
         }
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function searchStudent($params)
 {
     $query = StudentForm::find();
     $pageSize = Yii::$app->params['pageSize'];
     $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['created_at' => SORT_DESC]], 'pagination' => ['pageSize' => $pageSize]]);
     $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(['zip_code' => $this->zip_code, 'mobile' => $this->mobile, 'phone' => $this->phone, 'fathers_mobile' => $this->fathers_mobile, 'fathers_phone' => $this->fathers_phone, 'father_is' => $this->father_is, 'mothers_mobile' => $this->mothers_mobile, 'mothers_phone' => $this->mothers_phone, 'mother_is' => $this->mother_is, 'parents_are' => $this->parents_are, 'guardians_phone' => $this->guardians_phone, 'guardians_mobile' => $this->guardians_mobile, 'student_is_living_with' => $this->student_is_living_with, 'previous_school_phone' => $this->previous_school_phone, 'previous_school_mobile' => $this->previous_school_mobile, 'previous_school_grade_level' => $this->previous_school_grade_level, 'previous_school_average_grade' => $this->previous_school_average_grade, 'previous_school_from_school_year' => $this->previous_school_from_school_year, 'previous_school_to_school_year' => $this->previous_school_to_school_year, 'student_has_sibling_enrolled' => $this->student_has_sibling_enrolled, 'student_photo' => $this->student_photo, 'guardians_photo' => $this->guardians_photo, 'report_card' => $this->report_card, 'good_moral' => $this->good_moral, 'birth_certificate' => $this->birth_certificate, 'sped' => $this->sped, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at]);
     $query->andFilterWhere(['like', 'id', $this->id])->andFilterWhere(['!=', 'status', 2])->andFilterWhere(['=', 'gender', $this->gender])->andFilterWhere(['=', 'grade_level_id', $this->grade_level_id])->andFilterWhere(['like', 'first_name', $this->first_name])->andFilterWhere(['like', 'middle_name', $this->middle_name])->andFilterWhere(['like', 'last_name', $this->last_name])->andFilterWhere(['like', 'nickname', $this->nickname])->andFilterWhere(['like', 'status', $this->status])->andFilterWhere(['like', 'religion', $this->religion])->andFilterWhere(['like', 'citizenship', $this->citizenship])->andFilterWhere(['like', 'address', $this->address])->andFilterWhere(['like', 'fathers_name', $this->fathers_name])->andFilterWhere(['like', 'fathers_occupation', $this->fathers_occupation])->andFilterWhere(['like', 'fathers_employer', $this->fathers_employer])->andFilterWhere(['like', 'fathers_citizenship', $this->fathers_citizenship])->andFilterWhere(['like', 'fathers_religion', $this->fathers_religion])->andFilterWhere(['like', 'fathers_email', $this->fathers_email])->andFilterWhere(['like', 'mothers_name', $this->mothers_name])->andFilterWhere(['like', 'mothers_occupation', $this->mothers_occupation])->andFilterWhere(['like', 'mothers_employer', $this->mothers_employer])->andFilterWhere(['like', 'mothers_citizenship', $this->mothers_citizenship])->andFilterWhere(['like', 'mothers_religion', $this->mothers_religion])->andFilterWhere(['like', 'mothers_email', $this->mothers_email])->andFilterWhere(['like', 'guardians_name', $this->guardians_name])->andFilterWhere(['like', 'guardians_profile_image', $this->guardians_profile_image])->andFilterWhere(['like', 'guardians_address', $this->guardians_address])->andFilterWhere(['like', 'guardians_relation_to_student', $this->guardians_relation_to_student])->andFilterWhere(['like', 'guardians_occupation', $this->guardians_occupation])->andFilterWhere(['like', 'guardians_employer', $this->guardians_employer])->andFilterWhere(['like', 'previous_school_name', $this->previous_school_name])->andFilterWhere(['like', 'previous_school_description', $this->previous_school_description])->andFilterWhere(['like', 'previous_school_address', $this->previous_school_address])->andFilterWhere(['like', 'previous_school_teacher_in_charge', $this->previous_school_teacher_in_charge])->andFilterWhere(['like', 'previous_school_principal', $this->previous_school_principal]);
     //$query->andFilterWhere(['not'],['status' => 2]);
     return $dataProvider;
 }
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getStudent()
 {
     return $this->hasOne(StudentForm::className(), ['id' => 'student_id']);
 }
 /**
  * Finds the StudentForm model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param string $id
  * @return StudentForm the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = StudentForm::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Example #5
0
                    </div>
                </div>
            <?php 
}
?>
            <div class="row">
                <div class="col-lg-4 col-md-4 col-sm-12">
                    <?php 
echo $form->field($model, 'sy_id', ['inputTemplate' => '<label style="padding: 0; color: #555; font-weight: 600;">School Year</label>{input}', 'inputOptions' => ['class' => 'form-control pva-form-control']])->dropDownList($listData2, ['id', 'sy'])->label(false);
?>
                </div>
            </div>
            <div class="row">
                <div class="col-lg-6 col-md-6 col-sm-12">
                    <?php 
echo $model->isNewRecord ? $form->field($model, 'student_id', ['inputTemplate' => '<label style="padding: 0; color: #555; font-weight: 600;">Student</label>{input}', 'inputOptions' => ['class' => 'form-control pva-form-control']])->widget(Select2::classname(), ['data' => ArrayHelper::map(StudentForm::find()->orderBy(['first_name' => SORT_ASC])->where(['!=', 'status', 2])->all(), 'id', function ($model) {
    return implode(' ', [$model->first_name, $model->middle_name, $model->last_name]);
}), 'language' => 'en', 'options' => ['id' => 'auto-suggest', 'placeholder' => 'Select Student', 'class' => 'form-control pva-form-control'], 'size' => 'md', 'pluginOptions' => ['allowClear' => true], 'pluginEvents' => ['change' => "\n                                function(){\n                                    if(\$('#auto-suggest').val() === ''){\n                                        console.log('empty');\n                                        \$('.tiny.image').attr('src', '/proverbs/uploads/ui/user-blue.svg');\n                                        \$('#header-label').html('&nbsp;');\n                                        \$('#header-content').html('&nbsp;');\n                                        \$('#meta-content').html('&nbsp;');\n                                        \$('#left-content').html('&nbsp;');\n                                        \$('#right-content').addClass('hidden');\n                                    }else {\n                                        \$.ajax({\n                                            type: 'POST',\n                                            url: {$card_url} + JSON.stringify({sid:\$('#auto-suggest').val(),}),\n                                            contentType: 'application/json; charset=utf-8',\n                                            dataType: 'json',\n                                            success: function(data){\n\n                                                \$('#header-label').html('ID# ' + '<strong>' + data.sid + '</strong>');\n                                                \$('#header-content').html(data.name);\n                                                \$('#meta-content').html(data.nick);\n                                                \$('#left-content').html(data.level);\n\n                                                if(data.spd === 0){\n                                                    \$('#right-content').removeClass('hidden');\n                                                }\n\n                                                if(data.img !== 'empty'){\n                                                    \$('.tiny.image').attr('src', data.img);\n                                                }else {\n                                                    \$('.tiny.image').attr('src', '/proverbs/uploads/ui/user-blue.svg');\n                                                }\n\n                                                \$.post('" . Yii::$app->urlManager->createUrl('enroll/grade-level?id=') . "'+parseInt(\$('#auto-suggest').val()), function(data){\n                                                    \$('select#enrolledform-grade_level_id').val(data);\n                                                    \$.post('" . Yii::$app->urlManager->createUrl('enroll/section?id=') . "'+parseInt(\$('#enrolledform-grade_level_id').val()), function(data){\n                                                        \$('#enrolledform-section_id').find('option').remove();\n                                                        \$('#enrolledform-section_id').each(function(){\n                                                            \$(this).append(data);\n                                                        });\n                                                    });\n                                                });\n                                            }\n                                        });\n                                    }\n                                }\n                            "]])->label(false) : '';
?>
                </div>
            </div>
            <div class="row">
                <div class="col-lg-4 col-md-4 col-sm-12">
                    <?php 
echo $form->field($model, 'grade_level_id', ['inputTemplate' => '<label style="padding: 0; color: #555; font-weight: 600;">Grade Level</label>{input}', 'inputOptions' => ['class' => 'form-control pva-form-control']])->dropDownList($listData, ['onchange' => "\n                                level = function(){\n                                    \$('#left-content').html(\$('#enrolledform-grade_level_id').find('option:selected').text());\n                                },\n                                \$.post('" . Yii::$app->urlManager->createUrl('enroll/section?id=') . "'+parseInt(\$('#enrolledform-grade_level_id').val()), function(data){\n                                    level();\n                                    \$('#enrolledform-section_id').find('option').remove();\n                                    \$('#enrolledform-section_id').each(function(){\n                                        \$(this).append(data);\n                                    });\n                                });\n                            "])->label(false);
?>
                </div>
            </div>
            <div class="row">
                <div class="col-lg-4 col-md-4 col-sm-12">
                    <?php 
 public function countStudents()
 {
     $count = count(StudentForm::find()->where(['status' => 1])->all());
     return $count;
 }
 public function getApplicantLastName($id)
 {
     $student = $this->hasOne(StudentForm::className(), ['id' => 'applicant_id']);
     return $student['last_name'];
 }