public function executeLogout(sfWebRequest $request) { $newLog = new AuditLog(); $action = 'User has logged out from Student Record Management System'; $newLog->addNewLogInfo($this->getUser()->getAttribute('userId'), $action); $this->getUser()->setAuthenticated(false); $this->getUser()->getAttributeHolder()->remove('userId'); $this->getUser()->getAttributeHolder()->remove('departmentId'); $this->getUser()->getAttributeHolder()->remove('departmentName'); $this->getUser()->getAttributeHolder()->remove('sectionIds'); $this->getUser()->setFlash('notice', 'You have been logged out!'); $this->redirect('student/index'); }
public function executeCancelregrade(sfWebRequest $request) { #1. get requests $this->departmentName = $this->getUser()->getAttribute('departmentName'); $this->programSectionId = $request->getParameter('sectionId'); $this->studentId = $request->getParameter('studentId'); $this->enrollmentId = $request->getParameter('enrollmentId'); $this->studentCourseGradeId = $request->getParameter('studentCourseGradeId'); ## for new course #2. Update new course - Deactivate new course $newCourse = Doctrine_Core::getTable('StudentCourseGrade')->findOneById($this->studentCourseGradeId); $this->forward404Unless($newCourse); $newCourse->setRegradeStatus(6); $newCourse->save(); #3. Update old course - Deactivate the course regrade_status=5 #3.1 Get normal registraion by enrollmentInfoId $normalRegistration = Doctrine_Core::getTable('Registration')->getNormalRegistrationByEnrollmentId($this->enrollmentId); #3.2 Get Old course/ Old course registered under normal registration $oldCourse = Doctrine_Core::getTable('StudentCourseGrade')->getOneNormalRegistrationCourse($normalRegistration->getId(), $newCourse->getCourseId()); $oldCourse->setRegradeStatus(5); $oldCourse->save(); #4 Redirect to where it was $newLog = new AuditLog(); $action = 'User has Cancelled Regrade Process .....'; $newLog->addNewLogInfo($this->getUser()->getAttribute('userId'), $action); $this->getUser()->setFlash('notice', 'Regrade Cancellation Was Successful'); $this->redirect('regrade/studentRegradeDetail?sectionId=' . $this->programSectionId . '&studentId=' . $this->studentId . '&enrollmentId=' . $this->enrollmentId); }
public function executeStudentTransferDetail(sfWebRequest $request) { ## <SectionDetail>, <StudentDetail>, <GradedCourses> <CreateForm> <activatedRegrades> ## THESE ARE NEEDED STEP BY STEP $this->showToSectionForm = FALSE; $this->sectionIdNamePairArray = array(); $this->departmentName = $this->getUser()->getAttribute('departmentName'); $this->departmentId = $this->getUser()->getAttribute('departmentId'); $this->programSectionId = $request->getParameter('sectionId'); $this->studentId = $request->getParameter('studentId'); $this->enrollmentId = $request->getParameter('enrollmentId'); $this->sectionDetail = Doctrine_Core::getTable('ProgramSection')->findOneById($this->programSectionId); $this->forward404Unless($this->sectionDetail); $this->studentDetail = Doctrine_Core::getTable('Student')->getStudentDetailById($this->studentId); $this->forward404Unless($this->studentDetail); ## Prepare program section ID Name Pair if (Doctrine_Core::getTable('Department')->findOneById($this->departmentId)->checkIfActiveProgramSectionsExist($this->sectionDetail->getId(), $this->sectionDetail->getYear(), $this->sectionDetail->getSemester(), $this->sectionDetail->getAcademicYear())) { $this->showToSectionForm = TRUE; $this->sectionIdNamePairArray[''] = '--- Please Select New Section --- '; $this->departmentDetail = Doctrine_Core::getTable('Department')->findOneById($this->departmentId)->getWithActiveProgramSections($this->sectionDetail->getId(), $this->sectionDetail->getYear(), $this->sectionDetail->getSemester(), $this->sectionDetail->getAcademicYear()); $this->forward404Unless($this->departmentDetail); foreach ($this->departmentDetail->getPrograms() as $p) { foreach ($p->getProgramSections() as $ps) { $this->sectionIdNamePairArray[$ps->getId()] = 'Center ' . $ps->getCenter() . ' ' . $ps->getProgram() . ' Year: ' . $ps->getYear() . ' Semester: ' . $ps->getSemester() . ' A.Year: ' . $ps->getAcademicYear(); } } } $this->transferForm = new FrontendTransferForm($this->studentDetail->getId(), $this->sectionDetail->getId(), $this->sectionIdNamePairArray); ### PROCESS THE FORM IF SUBMITTED ### if ($request->isMethod('post')) { $this->transferForm->bind($request->getParameter('transferform')); if ($this->transferForm->isValid()) { $formData = $this->transferForm->getValues(); $fromSectionId = $formData['from_section_id']; $toSectionId = $formData['to_section_id']; $studentId = $formData['student_id']; if ($fromSectionId == '' || $toSectionId == '' || $studentId == '') { $this->getUser()->setFlash('error', 'Error occured: nothing performed, please redo actions '); $this->redirect('transfer/studentTransferDetail?sectionId=' . $this->programSectionId . '&studentId=' . $this->studentId . '&enrollmentId=' . $this->enrollmentId); } ##Do saving here!! #1. Find EnrollmentInfo and update it $enrollmentToUpdate = Doctrine_Core::getTable('EnrollmentInfo')->findOneById($this->enrollmentId)->updateCenterChange($toSectionId); #2. Add to Transfer //$studentTransfer = new StudentProgramSectionTransfer(); $newSection = Doctrine_Core::getTable('ProgramSection')->findOneById($toSectionId); $toSection = $newSection->getCenter() . ' Center ' . $newSection->getProgram() . ' Year ' . $newSection->getYear() . ' Sememster' . $newSection->getSemester() . ' AC Year ' . $newSection->getAcademicYear(); $newTransfer = new StudentProgramSectionTransfer(); $newTransfer->addNewStudentProgramSectionTransfer($studentId, $fromSectionId, $toSection); ##Do Logging!! $newLog = new AuditLog(); $action = "User has changed student Center to "; $action .= $newSection->getCenter() . ' Center ' . $newSection->getProgram() . ' Year ' . $newSection->getYear() . ' Sememster' . $newSection->getSemester() . ' AC Year ' . $newSection->getAcademicYear(); $newLog->addNewLogInfo($this->getUser()->getAttribute('userId'), $action); $this->getUser()->setFlash('notice', 'Successfuly Transferred Student' . ' ' . $fromSectionId . ' ' . $toSectionId . ' ' . $studentId . ' ' . $this->enrollmentId); $this->redirect('transfer/sectiondetail?id=' . $this->programSectionId); } } }
public function processSectionCourseOffering(sfWebRequest $request, sfForm $courseChecklistForm) { $courseChecklistForm->bind($request->getParameter('courseChecklist')); if ($courseChecklistForm->isValid()) { ## get form values $formData = $this->courseChecklistForm->getValues(); $courseIds = $formData['course_id']; if ($courseIds == NULL) { $this->getUser()->setFlash('error', 'Courses must be added to bucket'); $this->redirect('sectioncourseoffering/index'); } $section = $this->getUser()->getAttribute('sectionDetail'); $numberOfAssignedCourses = SectionCourseOffering::assignCoursesToOneSection($courseIds, $section->getId()); if ($numberOfAssignedCourses == 0) { $this->getUser()->setFlash('notice', 'Selected courses are already defined'); } else { ##Do Logging!! $newLog = new AuditLog(); $action = 'User has performed Course Offering for section '; $newLog->addNewLogInfo($this->getUser()->getAttribute('userId'), $action); $this->getUser()->setFlash('notice', $numberOfAssignedCourses . ' courses have been assigned to section'); $this->redirect('sectioncourseoffering/index'); } } $this->getUser()->setFlash('error', 'System error occured !'); $this->redirect('sectioncourseoffering/index'); }
public function executeWithdrawstudent(sfWebRequest $request) { $this->showWithdrawalForm = FALSE; $enrollmentId = null; $studentId = $request->getParameter('studentId'); $this->student = Doctrine_Core::getTable('Student')->findOneById($studentId); $this->forward404Unless($this->student); foreach ($this->student->getEnrollmentInfos() as $enrollment) { if (!$enrollment->getLeftout()) { if ($enrollment->getSemesterAction() == sfConfig::get('app_registered_semester_action') || $enrollment->getSemesterAction() == sfConfig::get('app_enrolled_semester_action')) { $enrollmentId = $enrollment->getId(); $this->showWithdrawalForm = TRUE; } } } $this->withdrawalForm = new FrontendStudentWithdrawalForm($enrollmentId); if ($request->isMethod('POST')) { $this->withdrawalForm->bind($request->getParameter('withdrawalform')); if ($this->withdrawalForm->isValid()) { $formData = $this->withdrawalForm->getValues(); $ac = $formData['ac']; $remark = $formData['remark']; $enrollmentId = $formData['enrollment_info_id']; ##ID of either ADR or WITHDRAWAL if ($enrollmentId == '' || $ac == '') { $this->getUser()->setFlash('error', 'Error with Add Form'); $this->redirect('readmission/withdraw/?studentId=' . $this->student->getId()); } $studentWitdrawal = new StudentWithdrawal(); $studentWitdrawal->setEnrollmentInfoId($enrollmentId); $studentWitdrawal->setAC($ac); $studentWitdrawal->setRemark($remark); $studentWitdrawal->setWithdrawalDate(date('Y-m-d H:m:s')); $studentWitdrawal->save(); $enrollmentToWithdraw = Doctrine_Core::getTable('EnrollmentInfo')->findOneById($enrollmentId); $enrollmentToWithdraw->withdrawEnrollment(); $enrollmentToWithdraw->save(); $auditlog = new AuditLog(); $auditlog->addNewLogInfo($this->getUser()->getAttribute('userId'), 'Performed Student Withdrawal'); $this->getUser()->setFlash('notice', 'Student Withdrawal was Successful '); $this->redirect('withdraw/index'); } else { $this->getUser()->setFlash('error', 'Error with Withdrawal Form'); } } }
public function executeApproveexemption(sfWebRequest $request) { #1. get requests $this->departmentName = $this->getUser()->getAttribute('departmentName'); $this->programSectionId = $request->getParameter('sectionId'); $this->studentId = $request->getParameter('studentId'); $this->enrollmentId = $request->getParameter('enrollmentId'); $this->studentNewCourseGradeId = $request->getParameter('studentCourseGradeId'); $studentNewCourseGrade = Doctrine_Core::getTable('StudentCourseGrade')->findOneById($this->studentNewCourseGradeId); $studentNewCourseGrade->setIsCalculated(0); $studentNewCourseGrade->setIsExempted(1); $studentNewCourseGrade->save(); ##Do Logging!! $newLog = new AuditLog(); $action = 'Department Head has Approved Exemption Grade '; $newLog->addNewLogInfo($this->getUser()->getAttribute('userId'), $action); #Redirect to where it was $this->getUser()->setFlash('notice', 'Exemption Approval Was Successful'); $this->redirect('exemption/studentExemptionDetail?sectionId=' . $this->programSectionId . '&studentId=' . $this->studentId . '&enrollmentId=' . $this->enrollmentId); }
public function executeRegisterwithadd(sfWebRequest $request) { $courseToAddRegisterArray = array(); ##get course and enrollmentInfoObj for Add Registration $courseToAddRegisterArray[] = $request->getParameter('courseId'); $enrollmentInfoObjToAdd = Doctrine_Core::getTable('EnrollmentInfo')->findOneById($request->getParameter('enrollmentId')); $this->forward404Unless($enrollmentInfoObjToAdd); ##Disable previous course $oneScg = Doctrine_Core::getTable('StudentCourseGrade')->getOneStudentOneCourseGrade($enrollmentInfoObjToAdd->getStudentId(), $request->getParameter('courseId')); $this->forward404Unless($oneScg); $oneScg->setIsCalculated(FALSE); $oneScg->save(); $addRegistration = new Registration(); $anyValue = $addRegistration->doRegistration(sfConfig::get('app_add_registration'), $enrollmentInfoObjToAdd, $courseToAddRegisterArray); ## clear attributes holding session values $this->getUser()->getAttributeHolder()->remove('courseIdToAdd'); $this->getUser()->getAttributeHolder()->remove('enrollmentInfoObjToAdd'); $newLog = new AuditLog(); $action = 'User Registered Student With Add System - Student has Added Course'; $newLog->addNewLogInfo($this->getUser()->getAttribute('userId'), $action); $this->getUser()->setFlash('notice', 'Registration was successfull ' . $anyValue); $this->redirect('registration/index'); }
public function executeEditstudent(sfWebRequest $request) { $sectionId = $request->getParameter('sectionId'); $this->program_section = Doctrine_Core::getTable('ProgramSection')->findOneById($sectionId); $this->forward404Unless($this->program_section); $this->forward404Unless($this->student = Doctrine_Core::getTable('Student')->find(array($request->getParameter('studentId'))), sprintf('Object student does not exist (%s).', $request->getParameter('studentId'))); $this->frontendStudentForm = new FrontendStudentForm($this->student); if ($request->isMethod('POST')) { $this->frontendStudentForm->bind($request->getParameter('studentform')); if ($this->frontendStudentForm->isValid()) { $formData = $this->frontendStudentForm->getValues(); $studentUID = $formData['student_uid']; $name = $formData['name']; $fathersName = $formData['fathers_name']; $grandfathersName = $formData['grandfathers_name']; $motherName = $formData['mother_name']; $dateOfBirth = $formData['date_of_birth']; $sex = $formData['sex']; $nationality = $formData['nationality']; $birthLocation = $formData['birth_location']; $residenceCity = $formData['residence_city']; $residenceWoreda = $formData['residence_woreda']; $residenceKebele = $formData['residence_kebele']; $residenceHourseNumber = $formData['residence_house_number']; $ethnicity = $formData['ethnicity']; $telephone = $formData['telephone']; $email = $formData['email']; if (!Doctrine_Core::getTable('Student')->findOneByStudentUid($studentUID)) { $this->student->setStudentUid($studentUID); $this->student->setName($name); $this->student->setFathersName($fathersName); $this->student->setGrandfathersName($grandfathersName); $this->student->setMotherName($motherName); $this->student->setDateOfBirth($dateOfBirth); $this->student->setSex($sex); $this->student->setAdmissionYear(date('Y')); $this->student->setNationality($nationality); $this->student->setBirthLocation($birthLocation); $this->student->setResidenceCity($residenceCity); $this->student->setResidenceWoreda($residenceWoreda); $this->student->setResidenceKebele($residenceKebele); $this->student->setResidenceHouseNumber($residenceHourseNumber); $this->student->setEthinicity($ethnicity); $this->student->setTelephone($telephone); $this->student->setEmail($email); $this->student->save(); $auditlog = new AuditLog(); $auditlog->addNewLogInfo($this->getUser()->getAttribute('userId'), 'Performed Student Profile Edit'); $this->getUser()->setFlash('notice', 'Student Profile Edit Was Successful '); $this->redirect('programsection/sectiondetail?id=' . $sectionId); } else { $this->getUser()->setFlash('error', 'Error: Duplicate Student ID Number Is Not Allowed'); } } else { $this->getUser()->setFlash('error', 'Error with student edit form'); } } }
public function executeAdd(sfWebRequest $request) { $this->failedCoursesIdNamePairArray = array(); $failedCourseIdsArray = array(); $this->programSectionsIdNamePairArray = array(); $this->coursePoolsArray = array(); $this->showFailedCourses = FALSE; $this->showClearanceEnrollmentForm = FALSE; $this->showAddEnrollmentForm = FALSE; $this->programSectionId = $request->getParameter('sectionId'); ##SECTION $this->studentId = $request->getParameter('studentId'); ##STUDENT $this->courseId = $request->getParameter('courseId'); ##COURSE BEING ADDED ##1 $this->sectionDetail = Doctrine_Core::getTable('ProgramSection')->findOneById($this->programSectionId); ##GET SECTION $this->forward404Unless($this->programSectionId); ##2 && 3 $this->student = Doctrine_Core::getTable('Student')->findOneById($this->studentId)->getWithActiveCourses(); $this->forward404Unless($this->student); ##4 $this->courseDetail = Doctrine_Core::getTable('Course')->findOneById($this->courseId); $this->forward404Unless($this->courseDetail); $this->failedCoursesIdNamePairArray[$this->courseDetail->getId()] = $this->courseDetail->getName(); //$this->studentInfo = $this->student->getSectionEnrollmentInfo($this->sectionDetail->getId()); $coursesInPool = Doctrine_Core::getTable('CoursePool')->getCoursesInCoursePool(); if (!is_null($coursesInPool)) { foreach ($coursesInPool as $coursePool) { $this->coursePoolsArray[] = $coursePool->getCourseId(); } } #1. Display Failed courses! foreach ($this->student->getEnrollmentInfos() as $enrollment) { foreach ($enrollment->getRegistrations() as $registration) { foreach ($registration->getStudentCourseGrades() as $scg) { if ($scg->checkIfStudentCourseIsFailed()) { $this->showFailedCourses = TRUE; if (!in_array($scg->getCourseId(), $this->coursePoolsArray)) { $failedCourseIdsArray[] = $scg->getCourseId(); } } } } } if ($this->showFailedCourses) { #Get ProgramSections offering these courses! $departments = Doctrine_Core::getTable('Department')->getAllDepartments(); $this->forward404Unless($departments); foreach ($departments as $department) { if ($department->checkCourseOffering($failedCourseIdsArray, $this->sectionDetail->getId())) { $this->showClearanceEnrollmentForm = TRUE; foreach ($department->getWithActiveProgramSectionCourseOfferings($failedCourseIdsArray, $this->sectionDetail->getId())->getPrograms() as $program) { foreach ($program->getProgramSections() as $programSection) { $section = $programSection->getProgram() . ' at ' . $programSection->getCenter() . ' center, Year-' . $programSection->getYear() . ' Sem-' . $programSection->getSemester(); $this->programSectionsIdNamePairArray[$programSection->getId()] = $section; } } } } } ##Display form if there are available active sections! if ($this->showClearanceEnrollmentForm) { $this->courseAddEnrollmentForm = new FrontendCourseAddEnrollmentForm($this->student->getId(), $this->programSectionsIdNamePairArray, $this->failedCoursesIdNamePairArray, sfConfig::get('app_clearance_enrollment')); } if ($request->isMethod('POST')) { $this->courseAddEnrollmentForm->bind($request->getParameter('courseaddenrollmentform')); if ($this->courseAddEnrollmentForm->isValid()) { $formData = $this->courseAddEnrollmentForm->getValues(); $courseId = $formData['course_id']; $sectionId = $formData['section_id']; $enrollmentAction = $formData['enrollment_action']; $studentId = $formData['student_id']; if ($courseId == '' || $sectionId == '' || $enrollmentAction == '' || $studentId == '') { $this->getUser()->setFlash('error', 'Error with Add Form'); $this->redirect('dropadd/add/?studentId=' . $this->student->getId() . '§ionId=' . $this->sectionDetail->getId()); } ## 1. find enrollment for the course to clear $studentWithEnrollment = Doctrine_Core::getTable('Student')->findOneById($studentId)->getEnrollmentInfoByCourse($courseId); $this->forward404Unless($studentWithEnrollment); foreach ($studentWithEnrollment->getEnrollmentInfos() as $enrollment) { $studentCourseEnrollment = $enrollment; } ## 2. find section to which student is going to enrolled to $newSection = Doctrine_Core::getTable('ProgramSection')->findOneById($sectionId); $this->forward404Unless($newSection); #makeEnrollment $newEnrollment = new EnrollmentInfo(); $newEnrollment->makeEnrollment($studentCourseEnrollment, $this->sectionDetail->getAcademicYear(), $this->sectionDetail->getYear(), $this->sectionDetail->getSemester(), $newSection->getId(), $enrollmentAction); $newEnrollment->save(); ## 2. createCoursePool $coursePool = new CoursePool(); $coursePool->createCoursePool($newEnrollment->getId(), $courseId); $coursePool->save(); ##Do Logging!! $newLog = new AuditLog(); $action = 'User has performed add enrollment for student '; $newLog->addNewLogInfo($this->getUser()->getAttribute('userId'), $action); $this->getUser()->setFlash('notice', 'Add was successful - studentId:' . $studentId . ' courseId:' . $courseId . ' sectionId:' . $sectionId . ' enrollmentAction:' . $enrollmentAction); $this->redirect('dropadd/sectiondetail/?id=' . $this->sectionDetail->getId()); } else { $this->getUser()->setFlash('error', 'Error with Add Form'); } } }
public function executeAdmissionEdit(sfWebRequest $request) { $departmentId = $this->getUser()->getAttribute('departmentId'); $this->programs = Doctrine_Core::getTable('Program')->getProgramsByDepartmentId($departmentId); ## Pass Program infomation $this->centers = Doctrine_Core::getTable('Center')->getAllCenters(); $this->years = FormChoices::getYearChoices(); $this->academicYears = FormChoices::getAcademicYear(); $this->semesters = FormChoices::getSemesterChoices(); $departmentId = $this->getUser()->getAttribute('departmentId'); $this->programs = Doctrine_Core::getTable('Program')->getProgramsByDepartmentId($departmentId); $sectionId = $request->getParameter('sectionId'); $this->program_section = Doctrine_Core::getTable('ProgramSection')->findOneById($sectionId); $this->forward404Unless($this->program_section); ## GET Admissions, if there are any! $this->admission_enrollments = Doctrine_Core::getTable('EnrollmentInfo')->getAdmissions($this->program_section); $this->forward404Unless($this->student = Doctrine_Core::getTable('Student')->find(array($request->getParameter('studentId'))), sprintf('Object student does not exist (%s).', $request->getParameter('studentId'))); $this->frontendStudentForm = new FrontendStudentForm($this->student); if ($request->isMethod('POST')) { $this->frontendStudentForm->bind($request->getParameter('studentform')); if ($this->frontendStudentForm->isValid()) { $formData = $this->frontendStudentForm->getValues(); $studentUID = $formData['student_uid']; $name = $formData['name']; $fathersName = $formData['fathers_name']; $grandfathersName = $formData['grandfathers_name']; $motherName = $formData['mother_name']; $dateOfBirth = $formData['date_of_birth']; $sex = $formData['sex']; $nationality = $formData['nationality']; $birthLocation = $formData['birth_location']; $residenceCity = $formData['residence_city']; $residenceWoreda = $formData['residence_woreda']; $residenceKebele = $formData['residence_kebele']; $residenceHourseNumber = $formData['residence_house_number']; $ethnicity = $formData['ethnicity']; $telephone = $formData['telephone']; $email = $formData['email']; $this->student->setStudentUid($studentUID); $this->student->setName($name); $this->student->setFathersName($fathersName); $this->student->setGrandfathersName($grandfathersName); $this->student->setMotherName($motherName); $this->student->setDateOfBirth($dateOfBirth); $this->student->setSex($sex); $this->student->setAdmissionYear(date('Y')); $this->student->setNationality($nationality); $this->student->setBirthLocation($birthLocation); $this->student->setResidenceCity($residenceCity); $this->student->setResidenceWoreda($residenceWoreda); $this->student->setResidenceKebele($residenceKebele); $this->student->setResidenceHouseNumber($residenceHourseNumber); $this->student->setEthinicity($ethnicity); $this->student->setTelephone($telephone); $this->student->setEmail($email); $this->student->save(); $auditlog = new AuditLog(); $auditlog->addNewLogInfo($this->getUser()->getAttribute('userId'), 'Performed Student Admission Profile Edit'); $this->getUser()->setFlash('notice', 'Admission Profile Edit Was Successful '); $this->redirect('student/admissionList/?sectionId=' . $sectionId); } else { $this->getUser()->setFlash('error', 'Error with Admission Form'); } } }
public function executeReadmitstudent(sfWebRequest $request) { $this->showReadmissionForm = FALSE; $programSectionIdNamePairArray = array(); $programSectionIdNamePairArray[''] = 'Select Program Section'; ## Create form $enrollmentId = $request->getParameter('enrollmentId'); $this->enrollmentDetail = Doctrine_Core::getTable('EnrollmentInfo')->findOneById($enrollmentId); $this->forward404Unless($this->enrollmentDetail); $this->student = $this->enrollmentDetail->getStudent(); ## get sections available $programSections = Doctrine_Core::getTable('ProgramSection')->getActiveProgramSectionsForReadmission($this->enrollmentDetail->getProgramId(), $this->enrollmentDetail->getYear(), $this->enrollmentDetail->getSemester()); if (!is_null($programSections)) { $this->showReadmissionForm = TRUE; foreach ($programSections as $ps) { $programSectionIdNamePairArray[$ps->getId()] = $ps->getProgram() . ' at ' . $ps->getCenter() . ' Year' . $ps->getYear() . ' Semester' . $ps->getSemester() . ', ' . $ps->getAcademicYear(); } } ## the form $this->readmissionForm = new FrontendReadmissionForm($enrollmentId, $programSectionIdNamePairArray); if ($request->isMethod('POST')) { $this->readmissionForm->bind($request->getParameter('readmissionform')); if ($this->readmissionForm->isValid()) { $formData = $this->readmissionForm->getValues(); $sectionId = $formData['section_id']; $enrollmentId = $formData['enrollment_id']; ##ID of either ADR or WITHDRAWAL if ($enrollmentId == '' || $sectionId == '') { $this->getUser()->setFlash('error', 'Error with Add Form'); $this->redirect('readmission/readmitstudent/?enrollmentId=' . $this->enrollmentDetail->getId()); } $auditlog = new AuditLog(); $auditlog->addNewLogInfo($this->getUser()->getAttribute('userId'), 'Performed Student Readmission'); $enrollment = new EnrollmentInfo(); $enrollment->makeEnrollment($this->enrollmentDetail, null, null, null, $sectionId, sfConfig::get('app_readmission_enrollment')); $this->getUser()->setFlash('notice', 'Student Readmission was Successful ' . $enrollmentId . ' ' . $sectionId); $this->redirect('readmission/index'); } else { $this->getUser()->setFlash('error', 'Error with Readmission Form'); } } }
public function processDogradesubmission(sfWebRequest $request, sfForm $gradeForm) { $gradeForm->bind($request->getParameter('gradeform')); if ($gradeForm->isValid()) { ## get form values $formData = $this->gradeForm->getValues(); //$enrollmentGradeIdPair = $formData['grade'] $courseId = $formData['course_id']; # GET sessions and delete them, $sectionDetail = $this->getUser()->getAttribute('sectionStudentsForGradeSubmission'); $sectionId = $this->getUser()->getAttribute('sectionId'); $courseDetail = Doctrine_Core::getTable('Course')->findOneById($courseId); $enrollmentIdsArray = $this->getUser()->getAttribute('enrollmentIdsArray'); $this->forward404Unless($courseDetail); ##update only EnrollmentInfo foreach ($enrollmentIdsArray as $enrollmentId) { $gradeId = $formData['grade_id_' . $enrollmentId]; $enrollmentTosave = Doctrine_Core::getTable('EnrollmentInfo')->findOneById($enrollmentId); $this->forward404Unless($enrollmentTosave); $gradeDetail = Doctrine_Core::getTable('Grade')->findOneById($gradeId); $this->forward404Unless($gradeDetail); $enrollmentTosave->updateEnrollmentInfoForGradeSubmission($courseDetail, $gradeDetail); } foreach ($enrollmentIdsArray as $enrollmentId) { $gradeId = $formData['grade_id_' . $enrollmentId]; $enrollmentTosave = Doctrine_Core::getTable('EnrollmentInfo')->findOneById($enrollmentId)->getWithStudentCourseGrade($sectionId, $courseId); $this->forward404Unless($enrollmentTosave); foreach ($enrollmentTosave->getRegistrations() as $registration) { foreach ($registration->getStudentCourseGrades() as $scg) { $scg->updateGrade($gradeId); $scg->updateGradeStatus($gradeId); } } } ##update SectionCourseOffering that grade has been submitted ... $sectionCourseOffering = Doctrine_Core::getTable('SectionCourseOffering')->getOneSectionsOneCourse($sectionId, $courseId); $sectionCourseOffering->updateCourseGradeStatusGradeSubmitted(); ##Do Logging!! $newLog = new AuditLog(); $action = 'User has submitted Student Grades'; $newLog->addNewLogInfo($this->getUser()->getAttribute('userId'), $action); $this->getUser()->setFlash('notice', 'Grade submission was successfull '); $this->redirect('submitgrade/sectiondetail/?sectionId=' . $sectionId); } }