/**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function searchApplicant($params)
 {
     $query = ApplicantForm::find();
     $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['created_at' => SORT_DESC]]]);
     $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(['sped' => $this->sped, '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, 'father_is' => $this->father_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, 'grade_level_id' => $this->grade_level_id, '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, 'status' => 2, 'student_has_sibling_enrolled' => $this->student_has_sibling_enrolled, 'student_photo' => $this->student_photo, 'guardians_photo' => $this->guardians_photo, 'birth_certificate' => $this->birth_certificate, 'good_moral' => $this->good_moral, 'report_card' => $this->report_card]);
     $query->andFilterWhere(['like', 'id', $this->id])->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]);
     return $dataProvider;
 }
Ejemplo n.º 2
0
<div class="ui three column stackable grid">
    <div class="four wide rounded column">
        <?php 
echo Card::render($options = ['imageContent' => !$model->isNewRecord ? !empty($model->applicant->students_profile_image) ? ['/file', 'id' => $model->applicant->students_profile_image] : Yii::$app->request->baseUrl . Yii::$app->params['avatar'] : Yii::$app->request->baseUrl . Yii::$app->params['avatar'], 'labelContent' => !$model->isNewRecord ? implode(' ', ['ID#', '<strong>', $model->applicant_id, '</strong>']) : '&nbsp;', 'labelFor' => 'Applicant ID', 'labelOptions' => '', 'headerContent' => !$model->isNewRecord ? implode(' ', [$model->applicant->first_name, $middle, $model->applicant->last_name]) : '&nbsp;', 'headerOptions' => '', 'metaContent' => !$model->isNewRecord ? implode('', ['\'', $model->applicant->nickname, '\'']) : '&nbsp', 'metaOptions' => '', 'leftFloatedContent' => !$model->isNewRecord ? $model->applicant->gradeLevel->name : '&nbsp;', 'leftFloatedFor' => '', 'leftFloatedOptions' => '', 'rightFloatedContent' => '', 'rightFloatedOptions' => !$model->isNewRecord ? $model->applicant->sped === 0 ? '' : 'hidden' : 'hidden']);
?>
    </div>
    <div class="nine wide rounded column">
        <div class="ui segment">
            <?php 
echo !$model->isNewRecord ? Html::tag('label', implode('', [implode('-', array_map('ucfirst', explode('-', Yii::$app->controller->id))), '# ', $model->id]), ['class' => 'ui fluid big label']) : '';
?>
            <br><br>
            <div class="row">
                <div class="col-lg-6 col-md-6 col-sm-12">
                    <?php 
echo $model->isNewRecord ? $form->field($model, 'applicant_id', ['inputTemplate' => '<label style="padding: 0; color: #555; font-weight: 600;" for="Applicant">Applicant</label>{input}', 'inputOptions' => ['class' => 'form-control pva-form-control']])->widget(Select2::classname(), ['data' => ArrayHelper::map(ApplicantForm::find()->where(['status' => 2])->orderBy(['first_name' => SORT_ASC])->all(), 'id', function ($model) {
    return implode(' ', [$model->first_name, $model->middle_name, $model->last_name]);
}), 'language' => 'en', 'options' => ['id' => 'auto-suggest', 'placeholder' => 'Select Applicant', 'class' => 'form-control pva-form-control'], 'pluginOptions' => ['allowClear' => true], 'pluginEvents' => ['change' => "\n                                run = function(){\n                                        \$.ajax({\n                                            type: 'POST',\n                                            url: 'card?data=' + JSON.stringify({sid:\$('#auto-suggest').val(),}),\n                                            contentType: 'application/json; charset=utf-8',\n                                            dataType: 'json',\n                                            success: function(data) {\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                                        });\n                                }, function(){\n                                    if(\$('#auto-suggest').val() === ''){\n                                        \$('#header-label').html('&nbsp;');\n                                        \$('#header-content').html('&nbsp;');\n                                        \$('#meta-content').html('&nbsp;');\n                                        \$('#left-content').html('&nbsp;');\n                                        \$('.tiny.image').attr('src', '/proverbs/uploads/ui/user-blue.svg');\n                                        \$('#right-content').addClass('hidden');\n                                    }else {\n                                        run();\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, 'english', ['inputTemplate' => '<label for="English">English</label>{input}', 'inputOptions' => []])->label(false)->textInput(['class' => 'form-control pva-form-control'], ['maxlength' => true]);
?>
                </div>
                <div class="col-lg-4 col-md-4 col-sm-12">
                    <?php 
echo $form->field($model, 'reading_skills', ['inputTemplate' => '<label for="Reading Skills">Reading Skills</label>{input}', 'inputOptions' => []])->label(false)->textInput(['class' => 'form-control pva-form-control'], ['maxlength' => true]);
?>
 public function countApplicant()
 {
     $count = count(ApplicantForm::find()->where(['status' => 2])->all());
     return $count;
 }
 protected function findApplicant($id)
 {
     if (($applicant = ApplicantForm::findOne($id)) !== null) {
         return $applicant;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }