Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if(isset($_GET['act']) && $_GET['act']=='doApprove') {
- include_once "../db.class.notification.php";
- include_once "../db.class.semester.php";
- include_once "../db.class.user.php";
- $studentId = $_POST['studentId'];
- $semester = $_POST['semester'];
- $schoolYear = $_POST['schoolYear'];
- $reg = new DBReg($academicConfig,$studentId,$schoolYear,$semester);
- $notif = new NotificationDb($academicConfig);
- $semesterObj = new DBSemester($academicConfig);
- $notification = new NotificationDb($frameworkConfig);
- $user = new DBUser($frameworkConfig);
- $temp = $semesterObj->GetCurrentSemester();
- $currentSemester = $temp['SCHOOLYEAR']."/".$temp['SEMESTER'];
- $selectedSemester = "$schoolYear/$semester";
- // if($currentSemester==$selectedSemester) {
- if($data = $reg->GetRegistrationTypeByPeriod($studentId,$schoolYear,$semester)) {
- $registrationTypeId = $data['REGISTRATIONTYPEID'];
- }
- else {
- $registrationTypeId = $reg->GetLastRegistrationType();
- }
- $regAdmin = new DBRegAdmin($academicConfig);
- $financeObj = new DBFinance($financeConfig);
- $studentData = $reg->GetStudentData($studentId);
- //DebugVariable($studentData);
- $studentStartYear = $studentData[0]['STUDENTSCHOOLYEAR'];
- $studyProgramId = $studentData[0]['STUDYPROGRAMID'];
- $facultyId = $studentData[0]['FACULTYID'];
- //if can approved
- if($regAdmin->CheckUserGroupPrivilege($_SESSION['groupid'],4,$registrationTypeId)) {
- //cek jadwal
- if($reg->CheckRegistrationPeriod($registrationTypeId, $studentStartYear, $studyProgramId, $facultyId)) {
- //set current step to ACC
- if($reg->SetRegistrationCurrentStep(2)) {
- //set status to ACC
- $reg->InsertRegistrationStatus($registrationTypeId,2);
- //insert registration action history
- $reg->InsertRegistrationActionHistory('ACC',$studentId,$schoolYear,$semester);
- //kirim notif SMS
- $notif->SendNotificationRegistration("ACC",$_SESSION['username'],$studentId);
- //tambah notif facebook
- $studentAccount = $user->GetUserDataByUsername($studentId);
- $arrNotification = array(
- 'NOTIFICATIONID' => $notification->GetNextNotificationId(),
- 'APPLICATIONID' => APPLICATION_ID,
- 'LINK' => "'registration/index.php?pageid=761'",
- 'NOTIFICATIONDATE' => "SYSDATE",
- 'SENDER' => "'".$_SESSION['userid']."'",
- 'RECEIVER' => "'".$studentAccount['USERID']."'",
- 'NOTIFICATIONTYPEID' => 11,
- 'MESSAGEID' => "''"
- );
- $notification->InsertNotification($arrNotification);
- //03112017 auto cetak ksm setelah approve wali
- $isSettled = $financeObj->CheckSettledStatusDueDate($studentId,$schoolYear,$semester); //sudah lunas
- if($isSettled && $registrationTypeId != 1) {
- //set current step
- if($reg->SetRegistrationCurrentStep(3)) {
- //set status sudah cetak KSM
- $reg->InsertRegistrationStatus($registrationTypeId,3);
- //insert registration action history
- $reg->InsertRegistrationActionHistory('CETAK KSM');
- //insert new ksm
- $reg->InsertStudentStudyCard();
- echo json_encode(array("status"=>"success"));
- }
- else echo json_encode(array("status"=>"failed"));
- }
- else echo json_encode(array("status"=>"unsettled"));
- //echo json_encode(array("status"=>"success"));
- }
- else echo json_encode(array("status"=>"failed"));
- }
- else echo json_encode(array("status"=>"overdue"));
- }
- else echo json_encode(array("status"=>"unauthorized"));
- // }
- // else echo json_encode(array("status"=>"failed"));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement