public function actionStudbatch($id) { $rows = \app\modules\course\models\Batches::find()->where(['batch_course_id' => $id, 'is_status' => 0])->all(); echo "<option value=''>---Select Batch---</option>"; if (count($rows) > 0) { foreach ($rows as $row) { echo "<option value='{$row->batch_id}'>{$row->batch_name}</option>"; } } else { echo ""; } }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Batches::find()->where(['<>', 'is_status', 2]); $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['batch_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(['batch_id' => $this->batch_id, 'batch_course_id' => $this->batch_course_id, 'start_date' => $this->dbDateSearch($this->start_date), 'end_date' => $this->dbDateSearch($this->end_date), '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', 'batch_name', $this->batch_name])->andFilterWhere(['like', 'batch_alias', $this->batch_alias]); unset($_SESSION['exportData']); $_SESSION['exportData'] = $dataProvider; return $dataProvider; }
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); }
/** * @return all batches */ public static function getStuBatches() { $dataTmp = Batches::find()->where(['is_status' => 0])->orderBy('batch_name')->all(); $result = yii\helpers\ArrayHelper::map($dataTmp, 'batch_id', 'batch_name'); return $result; }
/** * @return \yii\db\ActiveQuery */ public function getSectionBatch() { return $this->hasOne(Batches::className(), ['batch_id' => 'section_batch_id']); }
$i = 1; $add_city_c = $add_c = $add_city = $add_s = $add_co = $add_city_c = ''; foreach ($student_data as $t => $sd) { if ($i % 2 == 0) { $bgcolor = "#FFFFFF"; } else { $bgcolor = "#E3E3E3"; } 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>"; }
?> </span> </div><!-- /.info-box-content --> </div><!-- /.info-box --> </div> <div class="col-md-4 col-sm-6 col-xs-12"> <div class="edusec-link-box"> <span class="edusec-link-box-icon bg-teal"><i class="fa fa-users"></i></span> <div class="edusec-link-box-content"> <span class="edusec-link-box-text"><?php echo Html::a(Yii::t('course', 'Manage Batches'), ['/course/batches']); ?> </span> <span class="edusec-link-box-number"><?php echo app\modules\course\models\Batches::find()->where(['is_status' => 0])->count(); ?> </span> <span class="edusec-link-box-desc"></span> <span class="edusec-link-box-bottom"><?php echo Html::a('<i class="fa fa-plus-square"></i> ' . Yii::t('course', 'Create New'), ['/course/batches/create']); ?> </span> </div><!-- /.info-box-content --> </div><!-- /.info-box --> </div> <div class="col-md-4 col-sm-6 col-xs-12"> <div class="edusec-link-box"> <span class="edusec-link-box-icon bg-green"><i class="fa fa-sitemap"></i></span> <div class="edusec-link-box-content">
/** * Finds the Batches model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Batches the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Batches::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
public function getRelBatchData() { return $this->hasOne(\app\modules\course\models\Batches::className(), ['batch_id' => 'fees_pay_tran_batch_id']); }
} } } } } echo "</tr>"; $i = 1; foreach ($student_data as $t => $sd) { echo "<tr>"; echo "<td class='text-center'>" . $i . "</td>"; foreach ($selected_list as $s) { if ($s == 'batch_name') { if ($sd['stu_master_batch_id'] == 0) { echo "<td class='text-center'><i>" . Yii::t('report', 'Not Set') . "</i></td>"; } else { echo "<td class='text-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> " . Yii::t('report', '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> " . Yii::t('report', 'Not Set') . " </td>"; } else { echo "<td>" . Section::findOne($sd['stu_master_section_id'])->{$s} . "</td>"; }
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]; }
/** * Deletes an existing Courses model. * If deletion is successful, the browser will be redirected to the 'index' page. * @param integer $id * @return mixed */ public function actionDelete($id) { $batch = Batches::find()->where('batch_course_id=' . $id . ' AND is_status!=2')->exists(); if ($batch) { $err_msg = 'Batch'; } else { $err_msg = ''; } if (!empty($err_msg)) { throw new HttpException(400, 'You can not delete this record because it is used in ' . $err_msg . ' table.'); } else { $model = Courses::findOne($id); $model->is_status = 2; $model->update(); } return $this->redirect(['index']); }
public function getFeesCollectBatch() { return $this->hasOne(Batches::className(), ['batch_id' => 'fees_collect_batch_id']); }
$i = 1; $add_c = $add_s = $add_city = $add_co = $add_city_c = ''; $student_info = new StuInfo(); echo "</br></br><h1>" . Yii::t('report', 'Students List') . "</h1>"; foreach ($student_data as $t => $sd) { echo "<h3>" . $sd['stu_first_name'] . " " . $sd['stu_last_name'] . "</h3>"; echo "<table>"; echo '<tr >'; echo "<td class='label'>" . Yii::t('report', 'SI No.') . "</td><td>" . $i . "</td>"; foreach ($selected_list as $s) { if ($s == 'batch_name') { echo "<tr><td class='label'>" . Yii::t('report', 'Batch') . " </td>"; if ($sd['stu_master_batch_id'] == 0) { echo "<td ><i>" . Yii::t('report', 'Not Set') . "</i></td></tr>"; } else { echo "<td>" . Batches::findOne($sd['stu_master_batch_id'])->{$s} . "</td></tr>"; } } else { if ($s == 'course_name') { echo "<tr><td class='label'>" . Yii::t('report', 'Course') . "</td>"; if ($sd['stu_master_batch_id'] == 0) { echo "<td><i>" . Yii::t('report', 'Not Set') . "</i></td></tr>"; } else { echo "<td>" . Courses::findOne($sd['stu_master_course_id'])->{$s} . "</td></tr>"; } } else { if ($s == 'section_name') { echo "<tr><td class='label'>" . Yii::t('report', 'Section') . " </td>"; if ($sd['stu_master_section_id'] == 0) { echo "<td ><i>" . Yii::t('report', 'Not Set') . "</i></td></tr>"; } else {
/** * @return \yii\db\ActiveQuery */ public function getStuMasterBatch() { return $this->hasOne(\app\modules\course\models\Batches::className(), ['batch_id' => 'stu_master_batch_id']); }
/** * @return \yii\db\ActiveQuery */ public function getBatches() { return $this->hasMany(Batches::className(), ['batch_course_id' => 'course_id']); }