コード例 #1
0
 public function actionIndex()
 {
     if (Yii::$app->session->get('stu_id') || Yii::$app->session->get('emp_id')) {
         return $this->redirect(['/course/courses/index']);
     }
     $actCourseData = \app\modules\course\models\Courses::find()->where(['is_status' => 0])->all();
     return $this->render('index', ['actCourseData' => $actCourseData]);
 }
コード例 #2
0
ファイル: CoursesSearch.php プロジェクト: aoopvn/EduSec4.0.0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Courses::find()->where('is_status != 2');
     $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['course_id' => SORT_DESC]]]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['course_id' => $this->course_id, 'created_at' => $this->created_at, 'created_by' => $this->created_by, 'updated_at' => $this->updated_at, 'updated_by' => $this->updated_by, 'is_status' => $this->is_status]);
     $query->andFilterWhere(['like', 'course_name', $this->course_name])->andFilterWhere(['like', 'course_code', $this->course_code])->andFilterWhere(['like', 'course_alias', $this->course_alias]);
     unset($_SESSION['exportData']);
     $_SESSION['exportData'] = $dataProvider;
     return $dataProvider;
 }
コード例 #3
0
 public function actionStudentProfilePdf($sid)
 {
     $nationality = $stuAdd = [];
     $stuMaster = StuMaster::findOne($sid);
     $stuDocs = StuDocs::find()->where(['stu_docs_stu_master_id' => $sid])->join('join', 'document_category dc', 'dc.doc_category_id = stu_docs_category_id AND dc.is_status <> 2')->all();
     $stuInfo = StuInfo::find()->where(['stu_info_stu_master_id' => $sid])->one();
     $stuCourse = Courses::findOne($stuMaster->stu_master_course_id);
     $stuBatch = Batches::findOne($stuMaster->stu_master_batch_id);
     $stuSection = Section::findOne($stuMaster->stu_master_section_id);
     $stuGuard = StuGuardians::findAll(['guardia_stu_master_id' => $sid]);
     $sDocs = new StuDocs();
     if ($stuMaster->stu_master_nationality_id !== null) {
         $nationality = Nationality::findOne($stuMaster->stu_master_nationality_id)->nationality_name;
     }
     if ($stuMaster->stu_master_stu_address_id !== null) {
         $stuAdd = StuAddress::findOne($stuMaster->stu_master_stu_address_id);
     }
     $html = $this->renderPartial('/stu-master/stuprofilepdf', ['stuDocs' => $stuDocs, 'stuMaster' => $stuMaster, 'stuInfo' => $stuInfo, 'nationality' => $nationality, 'stuBatch' => $stuBatch, 'stuCourse' => $stuCourse, 'stuSection' => $stuSection, 'stuAdd' => $stuAdd, 'stuGuard' => $stuGuard, 'sDocs' => $sDocs]);
     $fName = $stuInfo->stu_first_name . "_" . $stuInfo->stu_last_name . "_" . date('Ymd-His');
     return Yii::$app->pdf->exportData(Yii::t('report', 'Student Report'), $fName, $html);
 }
コード例 #4
0
ファイル: Batches.php プロジェクト: anazhd/EduSec
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getBatchCourse()
 {
     return $this->hasOne(Courses::className(), ['course_id' => 'batch_course_id']);
 }
コード例 #5
0
 }
 echo '<tr align=center bgcolor=' . $bgcolor . '>';
 echo "<td style='text-align:center;'>" . $i . "</td>";
 foreach ($selected_list as $s) {
     if ($s == 'batch_name') {
         if ($sd['stu_master_batch_id'] == 0) {
             echo "<td style='text-align:center;'><i>Not Set</i></td>";
         } else {
             echo "<td style='text-align:center;'>" . Batches::findOne($sd['stu_master_batch_id'])->{$s} . "</td>";
         }
     } else {
         if ($s == 'course_name') {
             if ($sd['stu_master_course_id'] == 0) {
                 echo "<td></i> Not Set</i></td>";
             } else {
                 echo "<td>" . Courses::findOne($sd['stu_master_course_id'])->{$s} . "</td>";
             }
         } else {
             if ($s == 'section_name') {
                 if ($sd['stu_master_section_id'] == 0) {
                     echo "<td> Not Set </td>";
                 } else {
                     echo "<td>" . Section::findOne($sd['stu_master_section_id'])->{$s} . "</td>";
                 }
             } else {
                 if ($s == 'stu_cadd') {
                     if ($sd['stu_master_stu_address_id'] != 0) {
                         if (!empty(StuAddress::findOne($sd['stu_master_stu_address_id'])->stu_cadd_city)) {
                             $add_c = City::findOne(StuAddress::findOne($sd['stu_master_stu_address_id'])->stu_cadd_city);
                             if (!empty($add_c)) {
                                 $add_city = $add_c->city_name . " , ";
コード例 #6
0
 public function actionIndex()
 {
     $fYearWiseAdm = [];
     /**
      * @Start Display Category Wise Student Details Graph
      */
     $stuCateDataTmp = StuCategory::find()->where(['is_status' => 0])->asArray()->all();
     foreach ($stuCateDataTmp as $cv) {
         $stuCatWiseDisp[] = $cv['stu_category_name'];
         $maleCount = (new \yii\db\Query())->from('stu_master sm')->join('JOIN', 'stu_info si', 'si.stu_info_stu_master_id = sm.stu_master_id')->where(['sm.is_status' => '0', 'si.stu_gender' => 'Male', 'sm.stu_master_category_id' => $cv['stu_category_id']])->count();
         $femaleCount = (new \yii\db\Query())->from('stu_master sm')->join('JOIN', 'stu_info si', 'si.stu_info_stu_master_id = sm.stu_master_id')->where(['sm.is_status' => '0', 'si.stu_gender' => 'Female', 'sm.stu_master_category_id' => $cv['stu_category_id']])->count();
         $stuCatWiseDataMale[] = $maleCount;
         $stuCatWiseDataFemale[] = $femaleCount;
     }
     $stuCatWiseDisp[] = 'Not Set';
     $stuCatWiseDataMale[] = (new \yii\db\Query())->from('stu_master sm')->join('JOIN', 'stu_info si', 'si.stu_info_stu_master_id = sm.stu_master_id')->where(['sm.is_status' => 0, 'sm.stu_master_category_id' => NULL, 'si.stu_gender' => 'Male'])->count();
     $stuCatWiseDataFemale[] = (new \yii\db\Query())->from('stu_master sm')->join('JOIN', 'stu_info si', 'si.stu_info_stu_master_id = sm.stu_master_id')->where(['sm.is_status' => 0, 'sm.stu_master_category_id' => NULL, 'si.stu_gender' => 'Female'])->count();
     /**
      * @Start Display Student Status Wise Details in combine graph
      */
     $dataRegTmp = $courseData = [];
     $stuRegStat = StuMaster::find()->where(['is_status' => 0, 'stu_master_stu_status_id' => 0])->count();
     $stuStatusWise[] = ['name' => "Default ({$stuRegStat})", 'y' => $stuRegStat, 'color' => '#77C730'];
     $courseDataTmp = Courses::find()->where(['is_status' => 0])->asArray()->limit(10)->orderBy('course_id DESC')->all();
     $stuStatusDataTmp = StuStatus::find()->where(['is_status' => 0])->orderBy('stu_status_id')->asArray()->all();
     foreach ($courseDataTmp as $v) {
         $stuCourseRegStat = StuMaster::find()->where(['is_status' => 0, 'stu_master_stu_status_id' => 0, 'stu_master_course_id' => $v['course_id']])->count();
         $dataRegTmp[] = $stuCourseRegStat;
         $courseData[] = $v['course_name'];
     }
     $stuStatusData[] = ['name' => "Default ({$stuRegStat})", 'type' => 'column', 'data' => $dataRegTmp, 'color' => '#77C730'];
     //print_r($stuStatusData); exit;
     foreach ($stuStatusDataTmp as $k => $sv) {
         $dataTmp = [];
         foreach ($courseDataTmp as $v) {
             $stuCourseStat = StuMaster::find()->where(['is_status' => 0, 'stu_master_course_id' => $v['course_id'], 'stu_master_stu_status_id' => $sv['stu_status_id']])->count();
             $dataTmp[] = $stuCourseStat;
         }
         $stuStatusWiseCount = StuMaster::find()->where(['is_status' => 0, 'stu_master_stu_status_id' => $sv['stu_status_id']])->count();
         $stuStatusData[] = ['name' => $sv['stu_status_name'] . "({$stuStatusWiseCount})", 'type' => 'column', 'data' => $dataTmp];
         $stuStatusWise[] = ['name' => $sv['stu_status_name'] . ' (' . $stuStatusWiseCount . ')', 'y' => $stuStatusWiseCount, 'color' => new JsExpression('Highcharts.getOptions().colors[' . $k . ']')];
     }
     /**
      * @Start Gender Wise Data Display For Student
      */
     $stuGenWise = (new \yii\db\Query())->select(["CONCAT(IFNULL(si.stu_gender, 'Not Set'), ' (', COUNT( stu_master_id ), ')') AS '0'", 'COUNT(stu_master_id) AS "1"'])->from('stu_master sm')->join('JOIN', 'stu_info si', 'si.stu_info_stu_master_id = sm.stu_master_id')->where(['sm.is_status' => '0'])->groupBy('si.stu_gender')->orderBy('si.stu_gender ASC')->all();
     if ($stuGenWise) {
         $stuGenWise[0][0] = "Not Set" . $stuGenWise[0][0];
     }
     /**
      * @Start Gender Wise Data Display For Employee
      */
     $empGenWise = (new \yii\db\Query())->select(["CONCAT(IFNULL(ei.emp_gender, 'Not Set'), ' (', COUNT( emp_master_id ), ')') AS '0'", 'COUNT(emp_master_id) AS "1"'])->from('emp_master em')->join('JOIN', 'emp_info ei', 'ei.emp_info_emp_master_id = em.emp_master_id')->where(['em.is_status' => '0'])->groupBy('ei.emp_gender')->orderBy('ei.emp_gender ASC')->all();
     if ($empGenWise) {
         $empGenWise[0][0] = "Not Set" . $empGenWise[0][0];
     }
     /**
      * @Start Year wise employee joining
      */
     $empYearWiseJoin = $depDisp = [];
     $empYearJoin = (new \yii\db\Query())->select(["CONCAT(DATE_FORMAT(ei.emp_joining_date, '%Y'), ' (', COUNT(em.emp_master_id), ')') AS 'yearDisp'", 'DATE_FORMAT(ei.emp_joining_date, "%Y") as "year"'])->from('emp_master em')->join('JOIN', 'emp_info ei', 'ei.emp_info_emp_master_id = em.emp_master_id')->where(['em.is_status' => '0'])->groupBy(['DATE_FORMAT(ei.emp_joining_date, "%Y")'])->orderBy('YEAR(ei.emp_joining_date) DESC')->limit('3')->all();
     foreach ($empYearJoin as $k => $v) {
         $yearResults = $deptCount = $depDisp = [];
         $deptData = \app\modules\employee\models\EmpDepartment::find()->where(['is_status' => 0])->limit(10)->orderBy('emp_department_id DESC')->asArray()->all();
         foreach ($deptData as $k => $dv) {
             $deptCountTmp = (new \yii\db\Query())->from('emp_master em')->join('JOIN', 'emp_info ei', 'ei.emp_info_emp_master_id = em.emp_master_id')->where(['YEAR(ei.emp_joining_date)' => $v['year'], 'emp_master_department_id' => $dv['emp_department_id'], 'is_status' => 0])->count();
             $deptCount[] = $deptCountTmp;
             $depDisp[] = $dv['emp_department_alias'];
         }
         $yearResults = ['name' => !empty($v['yearDisp']) ? $v['yearDisp'] : "Not Set", 'data' => $deptCount];
         $empYearWiseJoin[] = $yearResults;
     }
     return $this->render('index', ['stuCatWiseDataMale' => $stuCatWiseDataMale, 'stuCatWiseDataFemale' => $stuCatWiseDataFemale, 'stuCatWiseDisp' => $stuCatWiseDisp, 'stuStatusWise' => $stuStatusWise, 'stuGenWise' => $stuGenWise, 'empYearWiseJoin' => $empYearWiseJoin, 'depDisp' => $depDisp, 'courseData' => $courseData, 'stuStatusData' => $stuStatusData, 'empGenWise' => $empGenWise]);
 }
コード例 #7
0
 public function getRelCourseData()
 {
     return $this->hasOne(\app\modules\course\models\Courses::className(), ['course_id' => 'fees_pay_tran_course_id']);
 }
コード例 #8
0
ファイル: index.php プロジェクト: EduSec/EduSec
        </div>
        <div class="col-xs-4 left-padding">
            <?php 
echo Html::a(Yii::t('course', 'EXCEL'), ['/export-data/export-excel', 'model' => get_class($searchModel)], ['class' => 'btn btn-block btn-primary', 'target' => '_blank']);
?>
        </div>
    </div>
</div>

<div class="col-xs-12" style="padding-top: 10px;">
    <div class="box">
        <div class="box-body table-responsive">
            <div class="batches-index">
	<?php 
\yii\widgets\Pjax::begin(['id' => 'batch-id', 'enablePushState' => false, 'enableReplaceState' => false]);
?>
	    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'summary' => '', 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'batch_name', 'batch_alias', ['label' => Yii::t('app', 'Course'), 'attribute' => 'batch_course_id', 'value' => 'batchCourse.course_name', 'filter' => ArrayHelper::map(app\modules\course\models\Courses::find()->all(), 'course_id', 'course_name')], ['attribute' => 'start_date', 'value' => function ($data) {
    return !empty($data->start_date) ? Yii::$app->formatter->asDate($data->start_date) : ' - ';
}, 'filter' => \yii\jui\DatePicker::widget(['model' => $searchModel, 'attribute' => 'start_date', 'clientOptions' => ['dateFormat' => 'dd-mm-yyyy', 'changeMonth' => true, 'changeYear' => true, 'defaultValue' => null, 'yearRange' => '1900:' . (date('Y') + 1), 'defaultDate' => null], 'options' => ['id' => 'start_date', 'value' => NULL, 'class' => 'form-control']]), 'format' => 'html'], ['attribute' => 'end_date', 'value' => function ($data) {
    return !empty($data->end_date) ? Yii::$app->formatter->asDate($data->end_date) : ' - ';
}, 'filter' => \yii\jui\DatePicker::widget(['model' => $searchModel, 'attribute' => 'end_date', 'clientOptions' => ['dateFormat' => 'dd-mm-yyyy', 'changeMonth' => true, 'changeYear' => true, 'defaultValue' => null, 'defaultDate' => null, 'yearRange' => '1900:' . (date('Y') + 1)], 'options' => ['id' => 'end_date', 'value' => NULL, 'class' => 'form-control']]), 'format' => 'html'], ['class' => '\\pheme\\grid\\ToggleColumn', 'contentOptions' => ['class' => 'text-center'], 'attribute' => 'is_status', 'enableAjax' => false, 'filter' => ['1' => 'InActive', '0' => 'Active']], ['class' => 'app\\components\\CustomActionColumn']]]);
?>
	<?php 
\yii\widgets\Pjax::end();
?>
	</div>
      </div>
    </div>
</div>
コード例 #9
0
ファイル: StuImportController.php プロジェクト: EduSec/EduSec
 public function importStuData($model)
 {
     $dispResults = [];
     $totalSuccess = 0;
     $objPHPExcel = PHPExcel_IOFactory::load($model->importFilePath . $model->importFile);
     $sheetData = $objPHPExcel->getActiveSheet()->toArray(null, true, true, true);
     //print_r($sheetData); exit;
     unset($sheetData[1]);
     //start import student row by row
     foreach ($sheetData as $k => $line) {
         //print_r($line); exit;
         if (!array_filter($line)) {
             continue;
         }
         $line = array_map('trim', $line);
         $line = array_map(function ($value) {
             return empty($value) ? NULL : $value;
         }, $line);
         $stuMaster = new StuMaster();
         $stuInfo = new StuInfo();
         $stuInfo->scenario = 'import-stu';
         $stuAddress = new StuAddress();
         $user = new User();
         $auth_assign = new AuthAssignment();
         //set student info attributes
         $stuInfo->stu_unique_id = $stuInfo->getUniqueId();
         // Student Unique Id
         $stuInfo->stu_title = $this->valueReplace($line['A'], $stuInfo->getTitleOptions());
         //Title Name
         $stuInfo->stu_first_name = $line['B'];
         //First Name
         $stuInfo->stu_last_name = $line['C'];
         //Last Name
         $stuInfo->stu_dob = Yii::$app->dateformatter->getDateFormat($line['D']);
         //Date of Birth
         $stuInfo->stu_admission_date = Yii::$app->dateformatter->getDateFormat($line['H']);
         //Student Admission Date
         $stuInfo->stu_gender = $this->valueReplace($line['I'], $stuInfo->getGenderOptions());
         // Gender
         $stuInfo->stu_email_id = $line['J'];
         // Email ID
         $stuInfo->stu_mobile_no = $line['K'];
         // Mobile No
         //set student master attribute
         $stuMaster->stu_master_course_id = $this->valueReplace($line['E'], Courses::getStuCourse());
         // Course
         $stuMaster->stu_master_batch_id = $this->valueReplace($line['F'], Batches::getStuBatches());
         // Batch
         $stuMaster->stu_master_section_id = $this->valueReplace($line['G'], Section::getStuSection());
         // Section
         $stuMaster->stu_master_category_id = $this->valueReplace($line['L'], StuCategory::getStuCategoryId());
         //Admission Category
         $stuMaster->stu_master_nationality_id = $this->valueReplace($line['M'], Nationality::getNationality());
         //Nationality
         //set student address attribute
         $stuAddress->stu_cadd = $line['N'];
         //Current Address
         $stuAddress->stu_cadd_city = $this->valueReplace($line['O'], City::getAllCity());
         //City
         $stuAddress->stu_cadd_state = $this->valueReplace($line['P'], State::getAllState());
         //State
         $stuAddress->stu_cadd_country = $this->valueReplace($line['Q'], Country::getAllCountry());
         //Country
         $stuAddress->stu_cadd_pincode = $line['R'];
         //Pincode
         $stuAddress->stu_cadd_house_no = $line['S'];
         //House No
         $stuAddress->stu_cadd_phone_no = $line['T'];
         //Phone No
         //set user login info attributes
         $uniq_id = $stuInfo->getUniqueId();
         $login_id = \app\models\Organization::find()->one()->org_stu_prefix . $uniq_id;
         $user->user_login_id = $login_id;
         //user login id
         $user->user_password = md5($user->user_login_id . $user->user_login_id);
         //user password
         $user->user_type = "S";
         //user type
         $user->created_by = Yii::$app->getid->getId();
         //created by
         $user->created_at = new \yii\db\Expression('NOW()');
         //created at
         if ($user->validate() && $stuInfo->validate() && $stuAddress->validate()) {
             $transaction = Yii::$app->db->beginTransaction();
             try {
                 if ($stuInfo->save() && $user->save() && $stuAddress->save()) {
                     $stuMaster->stu_master_stu_info_id = $stuInfo->stu_info_id;
                     $stuMaster->stu_master_user_id = $user->user_id;
                     $stuMaster->stu_master_stu_address_id = $stuAddress->stu_address_id;
                     $stuMaster->created_by = Yii::$app->getid->getId();
                     $stuMaster->created_at = new \yii\db\Expression('NOW()');
                     if ($stuMaster->save()) {
                         $stuInfo->stu_info_stu_master_id = $stuMaster->stu_master_id;
                         if ($stuInfo->save(false)) {
                             $auth_assign->item_name = 'Student';
                             $auth_assign->user_id = $user->user_id;
                             $auth_assign->created_at = date_format(date_create(), 'U');
                             $auth_assign->save(false);
                             $transaction->commit();
                             $totalSuccess += 1;
                             $dispResults[] = array_merge($line, ['type' => 'S', 'stuMasterId' => $stuMaster->stu_master_id, 'message' => 'Success']);
                         }
                     } else {
                         $dispResults[] = array_merge($line, ['type' => 'E', 'message' => Html::errorSummary($stuMaster)]);
                     }
                 }
                 // end stuInfo, user, StuAddress
                 $transaction->rollback();
             } catch (\Exception $e) {
                 $transaction->rollBack();
                 $dispResults[] = array_merge($line, ['type' => 'E', 'message' => $e->getMessage()]);
             }
         } else {
             $dispResults[] = array_merge($line, ['type' => 'E', 'message' => Html::errorSummary([$user, $stuInfo, $stuMaster, $stuAddress])]);
         }
         //end validated if
     }
     //end foreach
     return ['dispResults' => $dispResults, 'totalSuccess' => $totalSuccess];
 }
コード例 #10
0
ファイル: stu_report_view.php プロジェクト: anazhd/EduSec
 
<div class="box box-info box-solid">
   <div class="box-header with-border">
 	<h4 class="box-title"><i class="fa fa-search"></i> <?php 
echo Yii::t('report', 'Select Criteria');
?>
</h4>
   </div>
   <?php 
$form = ActiveForm::begin(['id' => 'stu_info-form']);
?>
   <div class="box-body">   	
      <div class="row">
	<div class="col-xs-12 col-sm-4 col-lg-4">
	<?php 
echo $form->field($model, 'stu_master_course_id')->dropDownList(ArrayHelper::map(app\modules\course\models\Courses::find()->where(['is_status' => 0])->all(), 'course_id', 'course_name'), ['prompt' => Yii::t('course', '--- Select Course ---'), 'required' => 'true', 'onchange' => '
                        $.get( "' . Url::toRoute('dependent/studbatch') . '", { id: $(this).val() } )
                            .done(function( data ) {
                                $( "#' . Html::getInputId($model, 'report_batch_id') . '" ).html( data );
                            }
                        );
                    ']);
?>
	</div>
	<div class="col-xs-12 col-sm-4 col-lg-4">
		 <?php 
echo $form->field($model, 'report_batch_id')->dropDownList([], ['prompt' => Yii::t('stu', '--- Select Batch ---'), 'onchange' => '
		                $.get( "' . Url::toRoute('dependent/studsection') . '", { id: $(this).val() } )
		                    .done(function( data ) {
		                        $( "#' . Html::getInputId($model, 'report_section_id') . '" ).html( data );
		                    }
コード例 #11
0
 /**
  * Finds the Courses model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Courses the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Courses::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
コード例 #12
0
ファイル: StuMaster.php プロジェクト: aoopvn/EduSec4.0.0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getStuMasterCourse()
 {
     return $this->hasOne(\app\modules\course\models\Courses::className(), ['course_id' => 'stu_master_course_id']);
 }
コード例 #13
0
ファイル: Courses.php プロジェクト: EduSec/EduSec
 /**
  * @return all course
  */
 public static function getStuCourse()
 {
     $dataTmp = Courses::find()->where(['is_status' => 0])->orderBy('course_name')->all();
     $result = yii\helpers\ArrayHelper::map($dataTmp, 'course_id', 'course_name');
     return $result;
 }