/** * Save registration. */ function execute() { $registrationDao =& DAORegistry::getDAO('RegistrationDAO'); $schedConf =& Request::getSchedConf(); if (isset($this->registrationId)) { $registration =& $registrationDao->getRegistration($this->registrationId); } if (!isset($registration)) { $registration = new Registration(); $registration->setDateRegistered(time()); } $registration->setSchedConfId($schedConf->getId()); $registration->setUserId($this->getData('userId')); $registration->setTypeId($this->getData('typeId')); $registration->setApplicationForm($this->getData('applicationForm')); $registration->setSurvey($this->getData('survey')); $registration->setMembership($this->getData('membership') ? $this->getData('membership') : null); $registration->setDomain($this->getData('domain') ? $this->getData('domain') : null); $registration->setIPRange($this->getData('ipRange') ? $this->getData('ipRange') : null); $registration->setSpecialRequests($this->getData('specialRequests') ? $this->getData('specialRequests') : null); // Send an email to the registrant informing them that their payment was received if ($this->getData('notifyPaymentEmail')) { $userDao =& DAORegistry::getDAO('UserDAO'); $schedConfName = $schedConf->getSchedConfTitle(); $schedConfId = $schedConf->getId(); $user =& $userDao->getUser($this->getData('userId')); list($registrationEmail, $registrationName, $registrationContactSignature) = $this->getRegistrationContactInformation($schedConfId); $paramArray = array('registrantName' => $user->getFullName(), 'schedConfName' => $schedConfName, 'registrationContactSignature' => $registrationContactSignature); import('mail.MailTemplate'); $mail = new MailTemplate('MANUAL_PAYMENT_RECEIVED'); $mail->setFrom($registrationEmail, $registrationName); $mail->assignParams($paramArray); $mail->addRecipient($user->getEmail(), $user->getFullName()); $mail->send(); } $registration->setDatePaid($this->getData('datePaid')); // Update or insert registration if ($registration->getId() != null) { $registrationDao->updateRegistration($registration); } else { $registrationDao->insertRegistration($registration); } $registrationOptionDao =& DAORegistry::getDAO('RegistrationOptionDAO'); $registrationOptions =& $registrationOptionDao->getRegistrationOptionsBySchedConfId($schedConf->getId()); $registrationOptionIds = (array) $this->getData('registrationOptionIds'); $registrationOptionDao->deleteRegistrationOptionAssocByRegistrationId($this->registrationId); while ($registrationOption =& $registrationOptions->next()) { $optionId = (int) $registrationOption->getOptionId(); if (in_array($optionId, $registrationOptionIds)) { $registrationOptionDao->insertRegistrationOptionAssoc($this->registrationId, $registrationOption->getOptionId()); } unset($registrationOption); } if ($this->getData('notifyEmail')) { // Send user registration notification email $userDao =& DAORegistry::getDAO('UserDAO'); $registrationTypeDao =& DAORegistry::getDAO('RegistrationTypeDAO'); $schedConfName = $schedConf->getSchedConfTitle(); $schedConfId = $schedConf->getId(); $user =& $userDao->getUser($this->getData('userId')); $registrationType =& $registrationTypeDao->getRegistrationType($this->getData('typeId')); list($registrationEmail, $registrationName, $registrationContactSignature) = $this->getRegistrationContactInformation($schedConfId); $paramArray = array('registrantName' => $user->getFullName(), 'schedConfName' => $schedConfName, 'registrationType' => $registrationType->getSummaryString(), 'username' => $user->getEmail(), 'registrationContactSignature' => $registrationContactSignature); import('mail.MailTemplate'); $mail = new MailTemplate('REGISTRATION_NOTIFY', null, null, null, null, false); $mail->setFrom($registrationEmail, $registrationName); $mail->assignParams($paramArray); $mail->addRecipient($user->getEmail(), $user->getFullName()); $mail->send(); } }
public function executeStudentRegradeDetail(sfWebRequest $request) { ## <SectionDetail>, <StudentDetail>, <GradedCourses> <CreateForm> <activatedRegrades> ## THESE ARE NEEDED STEP BY STEP $this->showCourseGrades = FALSE; $this->showFormResult = FALSE; $this->showActivatedRegrade = FALSE; $this->registrationIdsArray = array(); $this->coursesIdsArray = array(); $this->regradeRegistrationIdsArray = array(); $this->activatedCourseIdsArray = array(); $this->departmentName = $this->getUser()->getAttribute('departmentName'); $this->programSectionId = $request->getParameter('sectionId'); $this->studentId = $request->getParameter('studentId'); $this->enrollmentId = $request->getParameter('enrollmentId'); $this->sectionDetail = Doctrine_Core::getTable('ProgramSection')->getOneProgramSectionById($this->programSectionId); $this->studentDetail = Doctrine_Core::getTable('Student')->getStudentDetailById($this->studentId); $this->programName = Doctrine_Core::getTable('ProgramSection')->getOneProgramSectionById($this->programSectionId)->getProgram(); ## RETRIEVE STUDENT REGISTERED COURSES UNDER ONE SEMESTER ENROLLMENT, #1. Find enrollment $this->enrollment = Doctrine_Core::getTable('EnrollmentInfo')->findOneStudentEnrollmentInforById($this->enrollmentId); $this->forward404Unless($this->enrollment); #2. Find all Registrations per enrollment above $this->registrations = Doctrine_Core::getTable('Registration')->getEnrollmentRegistrations($this->enrollment->getId()); $this->forward404Unless($this->registrations); foreach ($this->registrations as $registration) { $this->registrationIdsArray[$registration->getId()] = $registration->getId(); if ($registration->getIsGradeComplain() == TRUE || $registration->getIsMakeup() == TRUE || $registration->getIsReexam() == TRUE) { $this->regradeRegistrationIdsArray[$registration->getId()] = $registration->getId(); } } #3. Find all courses [StudentCourseGrade] under each Registration, a)Calculatables, b)Have Grade $this->activeGradedStudentCourses = Doctrine_Core::getTable('StudentCourseGrade')->getActiveRegistrationCourses($this->registrationIdsArray, $this->studentId); $this->forward404Unless($this->activeGradedStudentCourses); #3.1 Check if there graded courses if ($this->activeGradedStudentCourses->count() != 0) { $this->showCourseGrades = TRUE; } #3.2 Find all courses [StudentCourseGrade] under each Registration, a)Calculatables, b)Have Grade c)not under regrade process (not activated) $this->activeNotReGradedStudentCourses = Doctrine_Core::getTable('StudentCourseGrade')->getActiveRegistrationNotRegradedCourses($this->registrationIdsArray, $this->studentId); $this->forward404Unless($this->activeNotReGradedStudentCourses); #4. PREPARE REGRADE REQUEST FORM ##COURSE $this->coursesIdsArray[''] = 'Select Course to Regrade'; foreach ($this->activeNotReGradedStudentCourses as $course) { $this->coursesIdsArray[$course->getCourseId()] = $course->getCourse(); } ##REGRADE - FROM FormChoices ##AC MINUTE, REMARK ## THE FORM $this->frontendRegradeRequestForm = new FrontendRegradeRequestForm($this->enrollmentId, $this->studentId, $this->coursesIdsArray); #5. ACTIVATED REGRADES #5.1 - Get all special / regrade registrations $this->activatedCoursesForRegrade = Doctrine_Core::getTable('StudentCourseGrade')->getActivatedCoursesForRegrade($this->regradeRegistrationIdsArray, $this->studentId); $this->forward404Unless($this->activatedCoursesForRegrade); #5.2 - Arrange activated regradable courses for form if ($this->activatedCoursesForRegrade->count() != 0) { $this->showActivatedRegrade = TRUE; $this->activatedCourseIdsArray[''] = '-- Select Course To Regrade --'; foreach ($this->activatedCoursesForRegrade as $activatedCFR) { $this->activatedCourseIdsArray[$activatedCFR->getId()] = $activatedCFR->getCourse(); } #KEEP COURSE ID ARRAY ON SESSION, TO BE USED WHEN REGRADE VALUE IS ENTERED $this->getUser()->setAttribute('activatedCourseIdsArray', $this->activatedCourseIdsArray); } #6. DATAWORKER FOR VIEW $gradeChoices = Doctrine_Core::getTable('Grade')->getAllLetterGradeChoices(); $this->getUser()->setAttribute('gradeChoices', $gradeChoices); ## created for use when new regrade value is entered, $this->frontendRegradeSubmissionForm = new FrontendRegradeSubmissionForm($this->enrollmentId, $this->studentId, $this->activatedCourseIdsArray, $gradeChoices); ### PROCESS THE FORM IF SUBMITTED ### if ($request->isMethod('post')) { $this->frontendRegradeRequestForm->bind($request->getParameter('regraderequestform')); if ($this->frontendRegradeRequestForm->isValid()) { $formData = $this->frontendRegradeRequestForm->getValues(); $this->courseId = $formData['course_id']; $this->regradeReason = $formData['regrade_reason']; $this->studentId = $formData['student_id']; $this->enrollmentInfoId = $formData['enrollment_info_id']; $this->remark = $formData['remark']; $this->ac = $formData['ac']; if ($this->courseId == '' || $this->regradeReason == '' || $this->studentId == '' || $this->enrollmentInfoId == '') { $this->getUser()->setFlash('error', 'Error occured: nothing performed, please redo actions '); $this->redirect('regrade/studentRegradeDetail?sectionId=' . $this->programSectionId . '&studentId=' . $this->studentId . '&enrollmentId=' . $this->enrollmentId); } ## REGISTER STUDENT BASED ON ENROLLMENTINFO FOR SPECIFIED REGRADE REASON $registration = new Registration(); $registration->setEnrollmentInfoId($this->enrollmentInfoId); $registration->setAc($this->ac); $registration->setDate(date('m-d-Y')); $registration->setRemark($this->remark); if ($this->regradeReason == 'gradecomplain') { $registration->setIsGradeComplain(TRUE); } if ($this->regradeReason == 'reexam') { $registration->setIsReexam(TRUE); } if ($this->regradeReason == 'makeup') { $registration->setIsMakeup(TRUE); } $registration->save(); ## STUDENTCOURSEGRADE -----------> NEW COURSE RE-REGISTERED $student = new StudentCourseGrade(); $student->setStudentId($this->studentId); $student->setRegistrationId($registration->getId()); $student->setCourseId($this->courseId); $student->setIsRepeated(TRUE); $student->setIsCalculated(FALSE); $student->setRegradeStatus(2); $student->save(); ## STUDENTCOURSEGRADE ------------> EXISTING COURSE / ONE NEEDED TO BE CHANGED $normalRegistration = Doctrine_Core::getTable('Registration')->getNormalRegistrationByEnrollmentId($this->enrollmentInfoId); $oldStudentCourseGrade = Doctrine_Core::getTable('StudentCourseGrade')->getRegisteredGradedCourse($normalRegistration->getId(), $this->studentId, $this->courseId); $oldStudentCourseGrade->setRegradeStatus(4); $oldStudentCourseGrade->save(); //$this->showFormResult=TRUE; ##Do Logging!! $newLog = new AuditLog(); $action = 'The Department Head has Activated Student Regreade Process'; $newLog->addNewLogInfo($this->getUser()->getAttribute('userId'), $action); $this->getUser()->setFlash('notice', 'Successfuly Activated Regrade Process'); $this->redirect('regrade/studentRegradeDetail?sectionId=' . $this->programSectionId . '&studentId=' . $this->studentId . '&enrollmentId=' . $this->enrollmentId); } } #$this->sectionCourses = Doctrine_Core::getTable('Course')->getCoursesByCourseIds($courseIds); }
public function processRegistration(sfWebRequest $request, sfForm $registrationForm) { $registrationForm->bind($request->getParameter('courseregistrationform')); if ($registrationForm->isValid()) { ## get form values $formData = $this->registrationForm->getValues(); $courseIds = $formData['course_id']; $enrollmentInfoIds = $formData['student_id']; foreach ($enrollmentInfoIds as $enrollmentId) { $enrollmentDetail = Doctrine_Core::getTable('EnrollmentInfo')->findOneStudentEnrollmentInforById($enrollmentId); $checkIfStudentCanRegister = Doctrine_Core::getTable('StudentCourseGrade')->checkIfStudentCanRegister($enrollmentDetail->getStudentId(), $courseIds); if ($checkIfStudentCanRegister) { Doctrine_Core::getTable('EnrollmentInfo')->setSemesterActionToRegistered($enrollmentId); $registration = new Registration(); $registration->setEnrollmentInfoId($enrollmentId); $registration->setDate(date('m-d-Y')); $registration->save(); foreach ($courseIds as $courseId) { $studentCourse = new StudentCourseGrade(); $studentCourse->setCourseId($courseId); $studentCourse->setRegistrationId($registration->getId()); $studentCourse->setStudentId(Doctrine_Core::getTable('EnrollmentInfo')->getEnrollmentDetailById($enrollmentId)->getStudentId()); $studentCourse->save(); } } } $this->getUser()->setFlash('notice', 'Registration was successfull ' . $enrollmentDetail->getStudentId()); $this->redirect('programsection/index'); ## Check filter combination availability [program_id, academic_year, year, semester], then return section] } }
public function processRegistration(sfWebRequest $request, sfForm $registrationForm) { $registrationForm->bind($request->getParameter('courseregistrationform')); if ($registrationForm->isValid()) { ## get form values $formData = $this->registrationForm->getValues(); $courseIds = $formData['course_id']; $enrollmentInfoIds = $formData['student_id']; if ($courseIds == '' || $enrollmentInfoIds == '') { $this->getUser()->setFlash('error', 'Error occured, please redo actions '); $this->redirect('registration/index'); } foreach ($enrollmentInfoIds as $enrollmentId) { $enrollmentDetail = Doctrine_Core::getTable('EnrollmentInfo')->findOneStudentEnrollmentInforById($enrollmentId); $sectionId = $enrollmentDetail->getSectionId(); $enrollmentDetail->updateEnrollmentSemesterAction(sfConfig::get('app_registered_semester_action')); $registration = new Registration(); $registration->setEnrollmentInfoId($enrollmentId); $registration->setDate(date('m-d-Y')); $registration->save(); foreach ($courseIds as $courseId) { $studentCourse = new StudentCourseGrade(); $studentCourse->setCourseId($courseId); $studentCourse->setRegistrationId($registration->getId()); $studentCourse->setStudentId(Doctrine_Core::getTable('EnrollmentInfo')->getEnrollmentDetailById($enrollmentId)->getStudentId()); $studentCourse->save(); } } $newLog = new AuditLog(); $action = 'User has Registered Students Student Record Management System'; $newLog->addNewLogInfo($this->getUser()->getAttribute('userId'), $action); $this->getUser()->setFlash('notice', 'Student Registration was successfull '); $this->redirect('registration/sectiondetail?id=' . $sectionId); ## Check filter combination availability [program_id, academic_year, year, semester], then return section] } }
/** * Save registration. */ function execute() { $registrationDao = DAORegistry::getDAO('RegistrationDAO'); $schedConf =& Request::getSchedConf(); if (isset($this->registrationId)) { $registration =& $registrationDao->getRegistration($this->registrationId); } if (!isset($registration)) { $registration = new Registration(); $registration->setDateRegistered(time()); } $registration->setSchedConfId($schedConf->getId()); $registration->setUserId($this->getData('userId')); $registration->setTypeId($this->getData('typeId')); $registration->setMembership($this->getData('membership') ? $this->getData('membership') : null); $registration->setDomain($this->getData('domain') ? $this->getData('domain') : null); $registration->setIPRange($this->getData('ipRange') ? $this->getData('ipRange') : null); $registration->setSpecialRequests($this->getData('specialRequests') ? $this->getData('specialRequests') : null); // Send an email to the registrant informing them that their payment was received if ($this->getData('notifyPaymentEmail')) { $userDao = DAORegistry::getDAO('UserDAO'); $schedConfName = $schedConf->getLocalizedName(); $schedConfId = $schedConf->getId(); $user =& $userDao->getById($this->getData('userId')); list($registrationEmail, $registrationName, $registrationContactSignature) = $this->getRegistrationContactInformation($schedConfId); $paramArray = array('registrantName' => $user->getFullName(), 'schedConfName' => $schedConfName, 'registrationContactSignature' => $registrationContactSignature); import('classes.mail.MailTemplate'); $mail = new MailTemplate('MANUAL_PAYMENT_RECEIVED'); $mail->setFrom($registrationEmail, $registrationName); $mail->assignParams($paramArray); $mail->addRecipient($user->getEmail(), $user->getFullName()); $mail->send(); } $registration->setDatePaid($this->getData('datePaid')); // Update or insert registration if ($registration->getId() != null) { $registrationDao->updateRegistration($registration); } else { $registrationDao->insertRegistration($registration); } $registrationOptionDao = DAORegistry::getDAO('RegistrationOptionDAO'); $registrationOptions =& $registrationOptionDao->getRegistrationOptionsBySchedConfId($schedConf->getId()); $registrationOptionIds = (array) $this->getData('registrationOptionIds'); $registrationOptionDao->deleteRegistrationOptionAssocByRegistrationId($this->registrationId); $registrationTypeDao = DAORegistry::getDAO('RegistrationTypeDAO'); $registrationType =& $registrationTypeDao->getRegistrationType($registration->getTypeId()); // Present the itemized costs in the notification email $totalCost = $registrationType->getCost(); $registrationOptionCosts = $registrationTypeDao->getRegistrationOptionCosts($registration->getTypeId()); $registrationOptionText = ''; // Record registration options (and tally up itemized costs for the email) while ($registrationOption =& $registrationOptions->next()) { $optionId = (int) $registrationOption->getOptionId(); $optionCost = isset($registrationOptionCosts[$optionId]) ? $registrationOptionCosts[$optionId] : 0; if (in_array($optionId, $registrationOptionIds)) { $registrationOptionDao->insertRegistrationOptionAssoc($this->registrationId, $registrationOption->getOptionId()); $registrationOptionText .= $registrationOption->getRegistrationOptionName() . ' - ' . sprintf('%.2f', $optionCost) . ' ' . $registrationType->getCurrencyCodeAlpha() . "\n"; $totalCost += $optionCost; } unset($registrationOption); } if ($this->getData('notifyEmail')) { // Send user registration notification email $userDao = DAORegistry::getDAO('UserDAO'); $registrationTypeDao = DAORegistry::getDAO('RegistrationTypeDAO'); $schedConfName = $schedConf->getLocalizedName(); $schedConfId = $schedConf->getId(); $user =& $userDao->getById($this->getData('userId')); $registrationType =& $registrationTypeDao->getRegistrationType($this->getData('typeId')); list($registrationEmail, $registrationName, $registrationContactSignature) = $this->getRegistrationContactInformation($schedConfId); $paramArray = array('registrantName' => $user->getFullName(), 'schedConfName' => $schedConfName, 'registrationType' => $registrationType->getSummaryString(), 'registrationOptions' => $registrationOptionText, 'totalCost' => $totalCost, 'username' => $user->getUsername(), 'registrationContactSignature' => $registrationContactSignature); import('classes.mail.MailTemplate'); $mail = new MailTemplate('REGISTRATION_NOTIFY', null, null, null, null, false); $mail->setFrom($registrationEmail, $registrationName); $mail->assignParams($paramArray); $mail->addRecipient($user->getEmail(), $user->getFullName()); $mail->send(); } }