if ($s == 'stu_email_id') { if (StuInfo::findOne($sd['stu_master_stu_info_id'])->{$s} != null) { echo "<td style='text-align:center;width:250px;'>" . StuInfo::findOne($sd['stu_master_stu_info_id'])->{$s} . "</td>"; } else { echo "<td style='text-align:center;'> </td>"; } } else { if ($s == 'stu_admission_date') { $date = StuInfo::findOne($sd['stu_master_stu_info_id'])->{$s}; echo "<td style='text-align:center; width:107px;'>" . date('d-m-Y', strtotime($date)) . "</td>"; } else { if ($s == 'stu_dob') { $dob = StuInfo::findOne($sd['stu_master_stu_info_id'])->{$s}; echo "<td style='text-align:center; width:107px;'>" . date('d-m-Y', strtotime($dob)) . "</td>"; } else { echo "<td style='text-align:center;'>" . StuInfo::findOne($sd['stu_master_stu_info_id'])->{$s} . "</td>"; } } } } } } } } } } $i++; echo "</tr>"; } echo "</table>"; } else {
if ($s == 'stu_email_id') { if (StuInfo::findOne($sd['stu_master_stu_info_id'])->{$s} != null) { echo "<td class='text-center'>" . StuInfo::findOne($sd['stu_master_stu_info_id'])->{$s} . "</td>"; } else { echo "<td class='text-center'> </td>"; } } else { if ($s == 'stu_admission_date') { $date = StuInfo::findOne($sd['stu_master_stu_info_id'])->{$s}; echo "<td class='text-center'>" . date('d-m-Y', strtotime($date)) . "</td>"; } else { if ($s == 'stu_dob') { $dob = StuInfo::findOne($sd['stu_master_stu_info_id'])->{$s}; echo "<td class='text-center'>" . date('d-m-Y', strtotime($dob)) . "</td>"; } else { echo "<td class='text-center'>" . StuInfo::findOne($sd['stu_master_stu_info_id'])->{$s} . "</td>"; } } } } } } } } } } $i++; echo "</tr>"; } echo "</table>"; }
public function actionStuPhoto($sid) { $model = $this->findModel($sid); $info = StuInfo::findOne($model->stu_master_stu_info_id); $old_info = StuInfo::findOne($model->stu_master_stu_info_id); $info->scenario = 'photo-upload'; if ($info->load(Yii::$app->request->post())) { $info->attributes = $_POST['StuInfo']; $info->stu_photo = UploadedFile::getInstance($info, 'stu_photo'); $old_photo = $old_info->stu_photo; $model->updated_by = Yii::$app->getid->getId(); $model->updated_at = new \yii\db\Expression('NOW()'); if ($info->stu_photo == NULL) { $old_photo = $old_info->stu_photo; $valid_photo = true; } else { $valid_photo = $info->validate(); } if ($valid_photo) { if ($info->stu_photo != NULL) { $newfname = ''; $ext = substr(strrchr($info->stu_photo, '.'), 1); //following thing done for deleting previously uploaded photo $photo = $old_photo; $dir1 = Yii::getAlias('@webroot') . '/data/stu_images/'; if (file_exists($dir1 . $photo) && $photo != NULL) { unlink($dir1 . $photo); } if ($ext != null) { $newfname = $info->stu_first_name . "_" . $info->stu_unique_id . '.' . $ext; $info->stu_photo->saveAs(Yii::getAlias('@webroot') . '/data/stu_images/' . ($info->stu_photo = $newfname)); } } } if ($info->save(false)) { return $this->redirect(['view', 'id' => $model->stu_master_id]); } else { return $this->renderAjax('photo_form', ['model' => $model, 'info' => $info]); } } else { return $this->renderAjax('photo_form', ['model' => $model, 'info' => $info]); } }
/** * Finds the StuInfo model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return StuInfo the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = StuInfo::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
if (StuInfo::findOne($sd['stu_master_stu_info_id'])->{$s} != null) { echo "<tr><td class='label'>" . Yii::t('report', 'Email Id') . "</td> <td>" . StuInfo::findOne($sd['stu_master_stu_info_id'])->{$s} . "</td> </tr>"; } else { echo "<tr><td class='label'>" . Yii::t('report', 'Email ID') . "</td> <td > </td></tr>"; } } else { if ($s == 'stu_admission_date') { $date = StuInfo::findOne($sd['stu_master_stu_info_id'])->{$s}; echo "<tr><td class='label'>" . Yii::t('report', 'Admission Date') . "</td><td >" . Yii::$app->formatter->asDate($date) . "</td></tr>"; } else { if ($s == 'stu_dob') { $dob = StuInfo::findOne($sd['stu_master_stu_info_id'])->{$s}; echo "<tr><td class='label'>Birth Date</td><td >" . Yii::$app->formatter->asDate($dob) . "</td></tr>"; } else { echo "<tr><td class='label'>" . Html::ActiveLabel($student_info, $s) . "</td>"; echo "<td>" . StuInfo::findOne($sd['stu_master_stu_info_id'])->{$s} . "</td></tr>"; } } } } } } } } } } echo "</table>"; $i++; } } else { echo "<h1 style=\"color:red;text-align:center;margin-top:10%;margin-right:60%\">" . Yii::t('report', 'No Record To Display') . "</h1>";
public function actionUpdatestudloginid($id) { $model = $this->findModel($id); $student_data = StuMaster::find()->where(['stu_master_user_id' => $_REQUEST['id']])->one(); $student_info = StuInfo::findOne($student_data->stu_master_stu_info_id)->stu_first_name; if (isset($_POST['User'])) { $model->attributes = $_POST['User']; $model->user_login_id = $_POST['User']['user_login_id']; \Yii::$app->session->setFlash('resetstudloginid', "<i class='glyphicon glyphicon-info-sign'></i> " . $student_info . "'s Login id is Reset"); if ($model->save()) { \Yii::$app->session->setFlash('resetstudloginid', "<i class='glyphicon glyphicon-info-sign'></i> " . $student_info . "'s Login id is Reset"); return $this->redirect(['resetstudloginid']); } } return $this->render('updatestudloginid', ['model' => $model]); }