/** * Lists all Section models. * @return mixed */ public function actionIndex() { $model = Section::find()->orderBy(['section_name' => SORT_ASC])->all(); $grade_level = GradeLevel::find()->all(); $listData = ArrayHelper::map($grade_level, 'id', 'name'); $searchModel = new SectionSearch(); $dataProvider = $searchModel->searchSection(Yii::$app->request->queryParams); return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider, 'listData' => $listData, 'model' => $model]); }
/** * Lists all EnrolledForm models. * @return mixed */ public function actionIndex() { $grade_level = GradeLevel::find()->all(); $school_year = SchoolYear::find()->orderBy(['id' => SORT_DESC])->all(); $listData = ArrayHelper::map($grade_level, 'id', 'name'); $listData2 = ArrayHelper::map($school_year, 'id', 'sy'); $searchModel = new EnrolledFormSearch(); $searchModel->sy_id = $this->findLatestSy(); $searchModel->enrollment_status = 0; $dataProvider = $searchModel->searchEnrolled(Yii::$app->request->queryParams); return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider, 'listData' => $listData, 'listData2' => $listData2]); }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = GradeLevel::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', 'name', $this->name]); return $dataProvider; }
use kartik\select2\Select2; use app\models\ApplicantForm; use app\models\ActiveRecord; use app\models\StudentForm; use yii\helpers\ArrayHelper; use yii\bootstrap\ActiveForm; use app\models\GradeLevel; use app\models\Section; use app\models\SchoolYear; use app\models\Card; use app\models\DataHelper; $card_url = json_encode(Yii::$app->request->baseUrl . '/site/card?data='); $current_date = date('Y'); $school_year = SchoolYear::find()->orderBy(['id' => SORT_DESC])->all(); $section = Section::find()->all(); $grade_level = GradeLevel::find()->where(['!=', 'id', 0])->all(); $status = [['id' => 1, 'status' => 'Pending'], ['id' => 0, 'status' => 'Enrolled']]; $listData = ArrayHelper::map($grade_level, 'id', 'name'); $listData2 = ArrayHelper::map($school_year, 'id', 'sy'); $listData3 = ArrayHelper::map($section, 'id', 'section_name'); $listData4 = ArrayHelper::map($status, 'id', 'status'); $state = false; $avatar = Yii::$app->request->baseUrl . Yii::$app->params['avatar']; !$model->isNewRecord ? !empty($model->student->students_profile_image) ? $img = Yii::$app->request->baseUrl . '/uploads/students/' . $model->student->students_profile_image : ($img = $avatar) : ''; !$model->isNewRecord ? !empty(trim($model->student->middle_name)) ? $middle = ucfirst(substr($model->student->middle_name, 0, 1)) . '.' : ($middle = '') : ''; !$model->isNewRecord ? $this->title = implode(' ', [$model->student->first_name, $middle, $model->student->last_name]) : 'New'; $model->isNewRecord ? $this->title = 'New' : ($this->title = implode(' ', [$model->student->first_name, $middle, $model->student->last_name])); $form = ActiveForm::begin(); ?> <div class="ui three column stackable grid"> <div class="four wide rounded column">
/** * @return \yii\db\ActiveQuery */ public function getGradeLevel() { return $this->hasOne(GradeLevel::className(), ['id' => 'grade_level_id']); }
<?php use yii\helpers\Html; use yii\bootstrap\ActiveForm; use app\models\GradeLevel; use yii\helpers\ArrayHelper; $grade_level = GradeLevel::find()->all(); $listData = ArrayHelper::map($grade_level, 'id', 'name'); ?> <p></p> <?php $form = ActiveForm::begin(); ?> <div class="ui three column stackable grid"> <div class="twelve wide rounded column"> <div class="panel panel-default rounded-edge"> <div class="panel-body"> <div class="row"> <div class="col-lg-6 col-md-6 col-sm-12"><?php echo $form->field($model, 'section_name', ['inputTemplate' => '<label>Section Name</label>{input}', 'inputOptions' => []])->label(false)->textInput(['class' => 'form-control pva-form-control'], ['maxlength' => true]); ?> </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, ['class' => 'form-control pva-form-control'])->label(false); ?> </div> </div> </div> </div>
<div class="col-lg-6 col-md-6 col-sm-12"> <?php echo $form->field($model, 'teacher_id')->widget(Select2::classname(), ['data' => ArrayHelper::map(app\models\User::find()->joinWith('role')->where(['item_name' => 'teacher'])->orderBy(['first_name' => SORT_ASC])->all(), 'id', function ($model) { if ($model->first_name === '') { return $model->username; } else { return implode(' ', [$model->first_name, $model->middle_name, $model->last_name]); } }), 'language' => 'en', 'options' => ['id' => 'auto-suggest', 'placeholder' => 'Select Teacher'], '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(' ');\n \$('#header-content').html(' ');\n \$('#meta-content').html(' ');\n \$('#left-content').html(' ');\n \$('#right-content').addClass('hidden');\n }else {\n \$.ajax({\n type: 'POST',\n url: {$card_url} + JSON.stringify({uid:\$('#auto-suggest').val(),}),\n contentType: 'application/json; charset=utf-8',\n dataType: 'json',\n success: function(data){\n \$('#header-label').html('<em>' + data.email + '</em>');\n \$('#header-content').html(data.name);\n \$('#meta-content').html(data.username);\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 }\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(ArrayHelper::map(GradeLevel::find()->all(), 'id', 'name'), ['class' => 'form-control pva-form-control', 'onchange' => ' $.post( "' . Yii::$app->urlManager->createUrl('assign-subject/lists?id=') . '"+$(this).val(), function( data ) { console.log(data); $( "select#assignedform-subject_id" ).html(data); $.post( "' . Yii::$app->urlManager->createUrl('assign-subject/section?id=') . '"+parseInt($("#assignedform-grade_level_id").val()), function( data ) { $("#assignedform-section_id").find("option").remove(); $("#assignedform-section_id").each(function(){ $(this).append(data); }); }); })'])->label(false); ?> </div> </div> <div class="row"> <div class="col-lg-4 col-md-12 col-sm-12">
<?php use yii\helpers\Html; use app\models\UiListView; use yii\widgets\Pjax; use app\helpers\CssHelper; use app\models\GradeLevel; use app\models\EnrolledForm; use app\models\EnrolledFormSearch; /* @var $this yii\web\View */ /* @var $searchModel app\models\EnrolledFormSearch */ /* @var $dataProvider yii\data\ActiveDataProvider */ $gradeLevel = GradeLevel::find()->select('id')->all(); $this->title = 'Enroll'; $this->params['breadcrumbs'][] = ['label' => 'Enroll', 'url' => ['index']]; ?> <div class="ui two column stackable grid"> <div class="twelve wide rounded column"> <div class="ui raised segment"> <div class="ui black ribbon label" style="margin-left: -2px;"> <h4>Enroll</h4> </div> <div class="pull-right"> <?php echo Html::a('<i class="icon plus"></i>', ['create'], ['class' => 'ui large green icon button']); ?> </div> <p></p> <?php Pjax::begin(['id' => 'enroll-list', 'timeout' => 60000]); ?>
<div class="col-lg-6 col-md-6 col-sm-12"> <?php echo $form->field($model, 'teacher_id')->widget(Select2::classname(), ['data' => ArrayHelper::map(app\models\User::find()->joinWith('role')->where(['item_name' => 'teacher'])->orderBy(['first_name' => SORT_ASC])->all(), 'id', function ($model) { if ($model->first_name === '') { return $model->username; } else { return implode(' ', [$model->first_name, $model->middle_name, $model->last_name]); } }), 'language' => 'en', 'options' => ['id' => 'auto-suggest', 'placeholder' => 'Select Teacher'], '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(' ');\n \$('#header-content').html(' ');\n \$('#meta-content').html(' ');\n \$('#left-content').html(' ');\n \$('#right-content').addClass('hidden');\n }else {\n \$.ajax({\n type: 'POST',\n url: {$card_url} + JSON.stringify({uid:\$('#auto-suggest').val(),}),\n contentType: 'application/json; charset=utf-8',\n dataType: 'json',\n success: function(data){\n \$('#header-label').html('<em>' + data.email + '</em>');\n \$('#header-content').html(data.name);\n \$('#meta-content').html(data.username);\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 }\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(ArrayHelper::map(GradeLevel::find()->all(), 'id', 'name'), ['onchange' => "\n \$.post('" . Yii::$app->urlManager->createUrl('enroll/section?id=') . "'+parseInt(\$('#classadviserform-grade_level_id').val()), function(data){\n \$('#classadviserform-section_id').find('option').remove();\n \$('#classadviserform-section_id').each(function(){\n \$(this).append(data);\n });\n });\n ", ['class' => 'form-control pva-form-control']])->label(false); ?> </div> </div> <div class="row"> <div class="col-lg-4 col-md-12 col-sm-12"> <?php echo $form->field($model, 'section_id', ['inputTemplate' => '<label style="padding: 0; color: #555; font-weight: 600;">Section</label>{input}', 'inputOptions' => ['class' => 'form-control pva-form-control']])->dropDownList(ArrayHelper::map(Section::find()->all(), 'id', 'section_name'), ['id', 'section_name'])->label(false); ?> </div> </div> </div> </div> <div class="three wide rounded column"> <div class="column"> <?php
public function getGradeList() { $grade_level = GradeLevel::find()->orderBy(['id' => SORT_ASC])->all(); $levelArray = [null => null]; for ($i = 0; $i < count($grade_level); $i++) { $levelArray[$grade_level[$i]->id] = $grade_level[$i]->name; } return $levelArray; }
use yii\bootstrap\Dropdown; use app\models\Tuition; use app\models\GradeLevel; use app\models\SiblingDiscount; $sbm = new SiblingDiscount(); $sbd = SiblingDiscount::find()->all(); if (!empty($array)) { $enrollment_float = $array[0]['enrollment']; $admission_float = $array[0]['admission']; $tuition_fee_float = $array[0]['tuition_fee']; $misc_fee_float = $array[0]['misc_fee']; $ancillary_float = $array[0]['ancillary']; $monthly_float = $array[0]['monthly']; $yearly_float = $array[0]['yearly']; $books_float = $array[0]['books']; $grade_level = GradeLevel::findOne($array[0]['grade_level_id'])['name']; $enrollment = number_format($array[0]['enrollment'], 2); $admission = number_format($array[0]['admission'], 2); $tuition_fee = number_format($array[0]['tuition_fee'], 2); $misc_fee = number_format($array[0]['misc_fee'], 2); $ancillary = number_format($array[0]['ancillary'], 2); $monthly = number_format($array[0]['monthly'], 2); $yearly = number_format($array[0]['yearly'], 2); $books = number_format($array[0]['books'], 2); } else { $grade_level = 0; $enrollment = 0; $admission = 0; $tuition_fee = 0; $misc_fee = 0; $ancillary = 0;
</div> <div class="col-lg-6 col-md-6 col-sm-12"><?php echo $form->field($model, 'guardians_employer', ['inputTemplate' => '<label>Employer</label>{input}', 'inputOptions' => []])->label(false)->textInput(['class' => 'form-control pva-form-control'], ['maxlength' => true]); ?> </div> </div> </div> </div> </div> </div> </div> </div> <div class="ui tab segment hidden" data-tab="fourth"> <div class="row"> <div class="col-lg-4 col-md-4 col-sm-12"><?php echo $form->field($model, 'previous_school_grade_level', ['inputTemplate' => '<label>Grade Level</label>{input}', 'inputOptions' => ['class' => 'form-control pva-form-control']])->dropDownList(ArrayHelper::map(GradeLevel::find()->all(), 'id', 'name'), ['id', 'name'])->label(false); ?> </div> <div class="col-lg-4 col-md-4 col-sm-12"><?php echo $form->field($model, 'previous_school_from_school_year', ['inputTemplate' => '<label>From</label>{input}', 'inputOptions' => []])->label(false)->widget(DatePicker::className(), ['options' => ['class' => 'form-control pva-form-control']]); ?> </div> <div class="col-lg-4 col-md-4 col-sm-12"><?php echo $form->field($model, 'previous_school_to_school_year', ['inputTemplate' => '<label>To</label>{input}', 'inputOptions' => []])->label(false)->widget(DatePicker::className(), ['options' => ['class' => 'form-control pva-form-control']]); ?> </div> </div> <div class="row"> <div class="col-lg-6 col-md-6 col-sm-12"> <?php echo $form->field($model, 'previous_school_teacher_in_charge', ['inputTemplate' => '<label>Teacher-in-charge</label>{input}', 'inputOptions' => []])->label(false)->textInput(['class' => 'form-control pva-form-control'], ['maxlength' => true]);
/** * Finds the GradeLevel model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return GradeLevel the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = GradeLevel::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }