/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model = new EmployeeTransaction(); $info = new EmployeeInfo(); $user = new User(); $photo = new EmployeePhotos(); $address = new EmployeeAddress(); $lang = new LanguagesKnown(); $auth_assign = new AuthAssignment(); // Uncomment the following line if AJAX validation is needed $this->performAjaxValidation(array($info, $model, $user)); if (!empty($_POST['EmployeeTransaction']) || !empty($_POST['EmployeeInfo'])) { $model->attributes = $_POST['EmployeeTransaction']; $info->attributes = $_POST['EmployeeInfo']; $user->attributes = $_POST['User']; $doa = $info->employee_joining_date; $dateofadmission = date("Y-m-d", strtotime($doa)); $info->employee_joining_date = $dateofadmission; /** fix the attendece id card length */ $cardid_length = strlen((string) $info->employee_attendance_card_id); $cardid = $info->employee_attendance_card_id; $digit = 0; $diff = 10 - $cardid_length; for ($i = 1; $i <= $diff; $i++) { $cardid = $digit . $cardid; } $info->employee_attendance_card_id = $cardid; $info->employee_private_email = strtolower($user->user_organization_email_id); $info->employee_created_by = Yii::app()->user->id; $info->employee_creation_date = new CDbExpression('NOW()'); $user->user_organization_email_id = $info->employee_private_email; $user->user_password = md5($info->employee_private_email . $info->employee_private_email); $user->user_created_by = Yii::app()->user->id; $user->user_creation_date = new CDbExpression('NOW()'); //$user->user_organization_id = Yii::app()->user->getState('org_id'); $user->user_type = "employee"; if ($info->save(false)) { $user->save(false); $address->save(false); $lang->save(false); $photo->employee_photos_path = "no-images"; $photo->save(false); } $model->employee_transaction_employee_id = $info->employee_id; $model->employee_transaction_user_id = $user->user_id; $model->employee_transaction_emp_photos_id = $photo->employee_photos_id; $model->employee_transaction_emp_address_id = $address->employee_address_id; $model->employee_transaction_languages_known_id = $lang->languages_known_id; $model->employee_transaction_organization_id = Yii::app()->user->getState('org_id'); $model->employee_status = 0; $model->save(false); // not false because it hasn't been validated $auth_assign->itemname = 'Employee'; $auth_assign->userid = $user->user_id; $auth_assign->save(); $this->redirect(array('update', 'id' => $model->employee_transaction_id)); } else { $this->render('create', array('model' => $model, 'info' => $info, 'user' => $user)); } }
/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model = new StudentTransaction(); $info = new StudentInfo(); $user = new User(); $photo = new StudentPhotos(); $address = new StudentAddress(); $lang = new LanguagesKnown(); $auth_assign = new AuthAssignment(); // Uncomment the following line if AJAX validation is needed $this->performAjaxValidation(array($info, $model, $user)); if (!empty($_POST['StudentTransaction']) || !empty($_POST['StudentInfo'])) { //print_r($_POST['StudentTransaction']); exit; $model->attributes = $_POST['StudentTransaction']; $info->attributes = $_POST['StudentInfo']; $user->attributes = $_POST['User']; $info->student_created_by = Yii::app()->user->id; $info->student_creation_date = new CDbExpression('NOW()'); $info->student_email_id_1 = strtolower($user->user_organization_email_id); $info->student_adm_date = date('Y-m-d', strtotime($_POST['StudentInfo']['student_adm_date'])); $user->user_organization_email_id = strtolower($info->student_email_id_1); $user->user_password = md5($info->student_email_id_1 . $info->student_email_id_1); $user->user_created_by = Yii::app()->user->id; $user->user_creation_date = new CDbExpression('NOW()'); $user->user_organization_id = Yii::app()->user->getState('org_id'); $user->user_type = "student"; if ($info->save(false)) { $user->save(false); $address->save(false); $lang->save(false); $photo->student_photos_path = "no-images"; $photo->save(); } if (empty($model->student_transaction_batch_id)) { $model->student_transaction_batch_id = 0; } $model->student_transaction_languages_known_id = $lang->languages_known_id; $model->student_transaction_student_id = $info->student_id; $model->student_transaction_user_id = $user->user_id; $model->student_transaction_student_address_id = $address->student_address_id; $model->student_transaction_student_photos_id = $photo->student_photos_id; $model->student_transaction_organization_id = Yii::app()->user->getState('org_id'); $model->save(); $auth_assign->itemname = 'Student'; $auth_assign->userid = $user->user_id; $auth_assign->save(); StudentInfo::model()->updateByPk($model->student_transaction_student_id, array('student_info_transaction_id' => $model->student_transaction_id)); $this->redirect(array('admin')); } else { $this->render('create', array('model' => $model, 'info' => $info, 'user' => $user)); } }
/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model = new LanguagesKnown(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['LanguagesKnown'])) { $model->attributes = $_POST['LanguagesKnown']; if ($model->save()) { $this->redirect(array('view', 'id' => $model->languages_known_id)); } } $this->render('create', array('model' => $model)); }
/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model=new EmployeeTransaction; $info=new EmployeeInfo; $user =new User; $photo =new EmployeePhotos; $address=new EmployeeAddress; $lang=new LanguagesKnown; $auth_assign = new AuthAssignment; // Uncomment the following line if AJAX validation is needed $this->performAjaxValidation(array($info,$model,$user)); if(!empty($_POST['EmployeeTransaction']) || !empty($_POST['EmployeeInfo'])) { $model->attributes=$_POST['EmployeeTransaction']; $info->attributes=$_POST['EmployeeInfo']; $user->attributes=$_POST['User']; $emp_roll_no = EmployeeInfo::model()->findAll(); if(empty($emp_roll_no)) { $empno=$info->employee_unique_id=1; } else { //$rand=mt_rand(1,2000); foreach($emp_roll_no as $s) { $emp[]=$s['employee_unique_id']; $empno_m=MAX($emp)+1; } if(EmployeeInfo::model()->exists('employee_unique_id='.$empno_m)) { $empno=$empno_m+1; } else { $empno=$empno_m; } } $doa = $info->employee_joining_date; $dateofadmission = date("Y-m-d", strtotime($doa)); $info->employee_joining_date = $dateofadmission; $info->employee_unique_id=$empno; $cardid_length = strlen((string) $info->employee_attendance_card_id); $cardid = $info->employee_attendance_card_id; $digit = 0; $diff = 10-$cardid_length; for($i=1;$i<=$diff;$i++) { $cardid = $digit.$cardid; } $info->employee_attendance_card_id = $cardid; $info->employee_private_email =strtolower($user->user_organization_email_id); $info->employee_created_by = Yii::app()->user->id; $info->employee_creation_date = new CDbExpression('NOW()'); $user->user_organization_email_id = $info->employee_private_email; $user->user_password = md5($info->employee_private_email.$info->employee_private_email); $user->user_created_by = Yii::app()->user->id; $user->user_creation_date = new CDbExpression('NOW()'); $user->user_type = "employee"; if($info->save(false)) { $user->save(false); $address->save(false); $lang->save(false); $photo->employee_photos_path = "no-images" ; $photo->save(false); } $model->employee_transaction_employee_id = $info->employee_id; $model->employee_transaction_user_id = $user->user_id; $model->employee_transaction_emp_photos_id = $photo->employee_photos_id; $model->employee_transaction_emp_address_id = $address->employee_address_id; $model->employee_transaction_languages_known_id=$lang->languages_known_id; $model->employee_status = 0; $model->save(false); EmployeeInfo::model()->updateByPk($model->employee_transaction_employee_id, array('employee_info_transaction_id'=>$model->employee_transaction_id)); $auth_assign->itemname = 'Employee'; $auth_assign->userid = $user->user_id; $auth_assign->bizrule = ''; $auth_assign->data = ''; $auth_assign->save(false); $this->redirect(array('update','id'=>$model->employee_transaction_id)); } else { $this->render('create',array( 'model'=>$model,'info'=>$info,'user'=>$user, )); } }
/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model=new StudentTransaction; $info =new StudentInfo; $user =new User; $photo =new StudentPhotos; $address=new StudentAddress; $lang=new LanguagesKnown; $auth_assign = new AuthAssignment; // Uncomment the following line if AJAX validation is needed $this->performAjaxValidation(array($info,$model,$user)); if(!empty($_POST['StudentTransaction']) || !empty($_POST['StudentInfo'] )) { $stud_roll_no = StudentInfo::model()->findAll(); if(Yii::app()->controller->action->id=='create'){ if(empty($stud_roll_no)) { $rollno=$info->student_roll_no=1; } else { //$rand=mt_rand(1,2000); foreach($stud_roll_no as $s) { $stud[]=$s['student_roll_no']; $rollno_m=MAX($stud)+1; } if(StudentInfo::model()->exists('student_roll_no='.$rollno_m)) { $rollno=$rollno_m+1; } else { $rollno=$rollno_m; } } } else { } //echo $rollno; exit; /*$batch_id=$_POST['StudentTransaction']['student_transaction_batch_id']; $batch=Batch::model()->findByPk($batch_id); $course=$batch->course_id; $academic_year=AcademicTerm::model()->findByPk($course); $model->academic_term_period_id=$academic_year->academic_term_period_id; $model->course_id=$batch->course_id; $model->academic_term_id=$batch->academic_term_id; */ $model->attributes=$_POST['StudentTransaction']; $info->attributes=$_POST['StudentInfo']; $user->attributes=$_POST['User']; $info->student_created_by = Yii::app()->user->id; $info->student_creation_date = new CDbExpression('NOW()'); $info->student_email_id_1=strtolower($user->user_organization_email_id); $info->student_adm_date = date('Y-m-d',strtotime($_POST['StudentInfo']['student_adm_date'])); $info->student_roll_no=$rollno; $info->passport_exp_date=date('Y-m-d',strtotime($_POST['StudentInfo']['passport_exp_date'])); $user->user_organization_email_id = strtolower($info->student_email_id_1); $user->user_password = md5($info->student_email_id_1.$info->student_email_id_1); $user->user_created_by = Yii::app()->user->id; $user->user_creation_date = new CDbExpression('NOW()'); $user->user_type = "student"; if($info->save(false)) { $user->save(false); $address->save(false); $lang->save(false); $photo->student_photos_path = "no-images"; $photo->save(); } //if(empty($model->student_transaction_batch_id)) //$model->student_transaction_batch_id=0; //$model->academic_term_id=$_POST['StudentTransaction']['academic_term_id']; //$model->academic_term_period_id=$_POST['StudentTransaction']['academic_term_period_id']; $model->course_id=$_POST['StudentTransaction']['course_id']; $model->student_transaction_languages_known_id= $lang->languages_known_id; $model->student_transaction_student_id = $info->student_id; $model->student_transaction_user_id = $user->user_id; $model->student_transaction_student_address_id = $address->student_address_id; $model->student_transaction_student_photos_id = $photo->student_photos_id; $flag = Studentstatusmaster::model()->findByAttributes(array('status_name'=>'Regular'))->id; $model->student_transaction_detain_student_flag = 1; $model->save(false); StudentInfo::model()->updateByPk($model->student_transaction_student_id, array('student_info_transaction_id'=>$model->student_transaction_id)); $auth_assign->itemname = 'Student'; $auth_assign->userid = $user->user_id; $auth_assign->bizrule = ''; $auth_assign->data = ''; $auth_assign->save(true); $this->redirect(array('update','id'=>$model->student_transaction_id)); } //end of isset if else { $this->render('create',array( 'model'=>$model,'info'=>$info,'user'=>$user )); } }
/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model = new StudentTransaction(); $info = new StudentInfo(); $user = new User(); $photo = new StudentPhotos(); $address = new StudentAddress(); $lang = new LanguagesKnown(); $auth_assign = new AuthAssignment(); $student_fees_master = new StudentFeesMaster(); // Uncomment the following line if AJAX validation is needed $this->performAjaxValidation(array($info, $model, $user)); if (!empty($_POST['StudentTransaction']) || !empty($_POST['StudentInfo'])) { //print_r($_POST['StudentTransaction']); exit; $model->attributes = $_POST['StudentTransaction']; $info->attributes = $_POST['StudentInfo']; $user->attributes = $_POST['User']; $info->student_created_by = Yii::app()->user->id; $info->student_creation_date = new CDbExpression('NOW()'); $info->student_email_id_1 = strtolower($user->user_organization_email_id); $info->student_adm_date = date('Y-m-d', strtotime($_POST['StudentInfo']['student_adm_date'])); $user->user_organization_email_id = strtolower($info->student_email_id_1); $user->user_password = md5($info->student_email_id_1 . $info->student_email_id_1); $user->user_created_by = Yii::app()->user->id; $user->user_creation_date = new CDbExpression('NOW()'); $user->user_organization_id = Yii::app()->user->getState('org_id'); $user->user_type = "student"; if ($info->save(false)) { $user->save(false); $address->save(false); $lang->save(false); $photo->student_photos_path = "no-images"; $photo->save(); } if (empty($model->student_transaction_batch_id)) { $model->student_transaction_batch_id = 0; } $model->student_transaction_languages_known_id = $lang->languages_known_id; $model->student_transaction_student_id = $info->student_id; $model->student_transaction_user_id = $user->user_id; $model->student_transaction_student_address_id = $address->student_address_id; $model->student_transaction_student_photos_id = $photo->student_photos_id; $model->student_transaction_organization_id = Yii::app()->user->getState('org_id'); $flag = Studentstatusmaster::model()->findByAttributes(array('status_name' => 'Regular'))->id; $model->student_transaction_detain_student_flag = $flag; $model->save(); //Fees Assignment to a student=========== By Ravi Bhalodiya========================================================= $fees_data = FeesMaster::model()->findByAttributes(array('fees_branch_id' => $model->student_transaction_branch_id, 'fees_academic_term_id' => $model->student_academic_term_period_tran_id, 'fees_academic_term_name_id' => $model->student_academic_term_name_id, 'fees_quota_id' => $model->student_transaction_quota_id)); if ($fees_data) { $fees_master = FeesMasterTransaction::model()->findAll(array('condition' => 'fees_master_id=' . $fees_data->fees_master_id)); foreach ($fees_master as $list) { $fees_detail = FeesDetailsTable::model()->findByPk($list['fees_desc_id']); $student_fees_master->setIsNewRecord(true); $student_fees_master->student_fees_master_id = null; $student_fees_master->student_fees_master_student_transaction_id = $model->student_transaction_id; $student_fees_master->fees_master_table_id = $fees_data->fees_master_id; $student_fees_master->student_fees_master_details_id = $fees_detail->fees_details_name; $student_fees_master->fees_details_amount = $fees_detail->fees_details_amount; $student_fees_master->student_fees_master_org_id = Yii::app()->user->getState('org_id'); $student_fees_master->student_fees_master_created_by = Yii::app()->user->id; $student_fees_master->student_fees_master_creation_date = new CDbExpression('NOW()'); $student_fees_master->save(); } } //================================================================================================================== StudentInfo::model()->updateByPk($model->student_transaction_student_id, array('student_info_transaction_id' => $model->student_transaction_id)); $auth_assign->itemname = 'Student'; $auth_assign->userid = $user->user_id; $auth_assign->save(); $this->redirect(array('update', 'id' => $model->student_transaction_id)); } else { $this->render('create', array('model' => $model, 'info' => $info, 'user' => $user)); } }
public function actionAprove($id) { $model= StudentRegistrationInfo::model()->findByPk($id); $info = new StudentInfo; $stud_trans = new StudentTransaction; $user =new User; $photo =new StudentPhotos; $address=new StudentAddress; $lang=new LanguagesKnown; $ass_comp = new assignCompanyUserTable; $auth_assign = new AuthAssignment; $qualification=new StudentAcademicRecordTrans; if(isset($_REQUEST['StudentRegistrationInfo'])) { $org_id = $model->organization_id; if($model->student_status==1){ $acd = Yii::app()->db->createCommand() ->select("academic_term_id,academic_term_name,academic_term_period_id") ->from('academic_term') ->where('current_sem=1 and academic_term_name =1 and academic_term_organization_id='.$org_id) ->queryAll(); if(!$acd){ Yii::app()->user->setFlash('notice','Semester-1 is not an Active semester'); $this->redirect(array('admin')); } $info->student_dtod_regular_status = 'Regular'; } elseif($model->student_status==2){ $acd = Yii::app()->db->createCommand() ->select("academic_term_id,academic_term_name,academic_term_period_id") ->from('academic_term') ->where('current_sem=1 and academic_term_name =3 and academic_term_organization_id='.$org_id) ->queryAll(); if(!$acd){ Yii::app()->user->setFlash('notice','Semester-3 is not an Active semester'); $this->redirect(array('admin')); } $info->student_dtod_regular_status = 'DTOD'; } $info->title = $model->student_title; $info->student_merit_no = $model->student_merit_no; $info->student_first_name = $model->student_first_name; $info->student_middle_name =$model->student_middle_name; $info->student_last_name = $model->student_last_name; $info->student_father_name = $model->student_father_name; $info->student_mother_name = $model->student_mother_name; $info->student_dob = $model->student_dob; $info->student_adm_date = new CDbExpression('NOW()'); $info->student_birthplace = $model->student_place_of_birth; $info->student_gender = $model->student_gender; $info->student_email_id_1 = $model->student_email_id; $info->student_mobile_no = $model->student_mobile; $info->student_created_by = Yii::app()->user->id; $info->student_creation_date = new CDbExpression('NOW()'); $user->user_organization_email_id = strtolower($info->student_email_id_1); $user->user_password = md5($info->student_email_id_1.$info->student_email_id_1); $user->user_created_by = Yii::app()->user->id; $user->user_creation_date = new CDbExpression('NOW()'); $user->user_organization_id = $org_id; $user->user_type = "student"; $photo->student_photos_path = $model->student_photo; $address->student_address_c_line1 = $model->student_address_c_line1; $address->student_address_c_line2 = $model->student_address_c_line2; $address->student_address_c_taluka = $model->student_address_c_taluka; $address->student_address_c_district = $model->student_address_c_district; $address->student_address_c_country = $model->student_address_c_country; $address->student_address_c_city = $model->student_address_c_city; $address->student_address_c_pin = $model->student_address_c_pin ; $address->student_address_c_state = $model->student_address_c_state; $address->student_address_p_line1 = $model->student_address_p_line1; $address->student_address_p_line2 = $model->student_address_p_line2; $address->student_address_p_taluka = $model->student_address_p_taluka; $address->student_address_p_district = $model->student_address_p_district; $address->student_address_p_country = $model->student_address_p_country; $address->student_address_p_city = $model->student_address_p_city; $address->student_address_p_pin = $model->student_address_p_pin ; $address->student_address_p_state = $model->student_address_p_state; $address->student_address_phone = $model->student_phoneno; $address->student_address_mobile = $model->student_mobile; if($info->save(false)){ $user->save(false); $photo->save(false); $address->save(false); $lang->save(false); $stud_trans->student_transaction_user_id = $user->user_id; $stud_trans->student_transaction_student_id = $info->student_id; //$stud_trans->student_transaction_branch_id = $model->student_branch_id; if(!empty($model->student_category_id)) $stud_trans->student_transaction_category_id = $model->student_category_id; $stud_trans->student_transaction_organization_id = $org_id; $stud_trans->student_transaction_student_address_id = $address->student_address_id; $stud_trans->student_transaction_languages_known_id= $lang->languages_known_id; $stud_trans->student_transaction_detain_student_flag='5'; $stud_trans->student_transaction_student_photos_id = $photo->student_photos_id; $stud_trans->student_transaction_branch_id=$_POST['StudentRegistrationInfo']['student_branch_id']; $stud_trans->student_academic_term_period_tran_id = $acd[0]['academic_term_period_id']; $stud_trans->student_academic_term_name_id = $acd[0]['academic_term_id']; $stud_trans->save(false); StudentInfo::model()->updateByPk($stud_trans->student_transaction_student_id, array('student_info_transaction_id'=>$stud_trans->student_transaction_id)); $org_data = Organization::model()->findByPk($org_id); $org_name = $org_data->organization_name; $org_arr = explode(' ',$org_name); $suffix_lab = ''; foreach($org_arr as $list) $suffix_lab .= $list[0]; $bizrule = 'return Yii::app()->user->getState("org_id")=='.$org_id.";"; $var_data = serialize(Yii::app()->user->getState('org_id')); $auth_assign->itemname = 'Student of '.$suffix_lab; $auth_assign->userid = $user->user_id; $auth_assign->bizrule = $bizrule; $auth_assign->data = $var_data; $auth_assign->save(); $ass_comp->assign_user_id = $user->user_id; $ass_comp->assign_org_id = $org_id; $ass_comp->assign_created_by = Yii::app()->user->id; $ass_comp->assign_creation_date = new CDbExpression('NOW()'); $ass_comp->save(); StudentRegistrationInfo::model()->updateByPk($id, array( 'student_aproved'=>'1', )); $this->redirect(array('admin')); } } $this->render('aprove',array('model'=>$model)); }