echo $sectionDetail->getAcademicYear();
?>
 <br />
                Current Year: <?php 
echo $promotionInfo->getCurrentYear();
?>
 <br />
                Current Semester: <?php 
echo $promotionInfo->getCurrentSemester();
?>
 <br /> <br />
                
                <strong> To next level class: </strong> <br />
                To Academic Year: <?php 
/*echo $promotionInfo->getToAcademicYear(); */
echo ProgramSectionActions::getNextACYearForSection($promotionInfo->getCurrentYear(), $promotionInfo->getCurrentSemester(), $sectionDetail->getAcademicYear());
?>
 <br />
                To Year: <?php 
echo $promotionInfo->getToYear();
?>
 <br />
                To Semester: <?php 
echo $promotionInfo->getToSemester();
?>
 <br /><br /><br /><br />
                
                
                <a href="<?php 
echo url_for('programsection/doPromotion?id=' . $sectionDetail->getId());
?>
示例#2
0
 public function executeDoPromotion(sfWebRequest $request)
 {
     ## find section detail
     $i = 1;
     $this->programSectionId = $request->getParameter('id');
     $this->sectionDetail = Doctrine_Core::getTable('ProgramSection')->getOneProgramSectionById($this->programSectionId);
     $enrollments = Doctrine_Core::getTable('EnrollmentInfo')->getEnrollmentsBySectionId($this->programSectionId);
     ## Get promotion information if available for existing class,
     $this->promotionInfo = Doctrine_Core::getTable('PromotionSetting')->getOnePromotionSetting($this->sectionDetail->getProgramId(), $this->sectionDetail->getYear(), $this->sectionDetail->getSemester());
     $this->forward404Unless($this->promotionInfo);
     //$this->enrollmentsToCreate[] = Array();
     ## Create section,
     $this->sectionToCreate = new ProgramSection();
     $this->sectionToCreate->setProgramId($this->sectionDetail->getProgramId());
     $this->sectionToCreate->setCenterId($this->sectionDetail->getCenterId());
     $this->sectionToCreate->setAcademicCalendarId($this->sectionDetail->getAcademicCalendarId());
     $academicYearToSave = ProgramSectionActions::getNextACYearForSection($this->sectionDetail->getYear(), $this->sectionDetail->getSemester(), $this->sectionDetail->getAcademicYear());
     $this->sectionToCreate->setAcademicYear($academicYearToSave);
     $this->sectionToCreate->setYear($this->promotionInfo->getToYear());
     $this->sectionToCreate->setSemester($this->promotionInfo->getToSemester());
     $this->sectionToCreate->setSectionNumber($this->sectionDetail->getSectionNumber());
     $this->sectionToCreate->setIsActivated(TRUE);
     $this->sectionToCreate->save();
     $this->sectionDetail->setIsPromoted(TRUE);
     //$this->sectionDetail->setIsActivated(TRUE);
     $this->sectionDetail->save();
     foreach ($enrollments as $enrollment) {
         ## get student status with given ENROLLMENT,
         $status = Statuses::getStudentStatus($enrollment);
         if ($status == 'PASS' || $status == 'WARNING') {
             $this->enrollmentsToCreate = new EnrollmentInfo();
             $this->enrollmentsToCreate->setStudentId($enrollment->getStudentId());
             $this->enrollmentsToCreate->setAcademicYear($this->promotionInfo->getToAcademicYear());
             $this->enrollmentsToCreate->setYear($this->promotionInfo->getToYear());
             $this->enrollmentsToCreate->setSemester($this->promotionInfo->getToSemester());
             $this->enrollmentsToCreate->setSectionId($this->sectionToCreate->getId());
             $this->enrollmentsToCreate->setProgramId($enrollment->getProgramId());
             $this->enrollmentsToCreate->setTotalChrs($enrollment->getTotalChrs());
             $this->enrollmentsToCreate->setTotalGradePoints($enrollment->getTotalGradePoints());
             $this->enrollmentsToCreate->setTotalRepeatedChrs($enrollment->getTotalRepeatedChrs());
             $this->enrollmentsToCreate->setTotalRepeatedGradePoints($enrollment->getTotalRepeatedGradePoints());
             $this->enrollmentsToCreate->setPreviousChrs($enrollment->getSemesterChrs());
             $this->enrollmentsToCreate->setPreviousGradePoints($enrollment->getSemesterGradePoints());
             $this->enrollmentsToCreate->setPreviousRepeatedChrs($enrollment->getSemesterRepeatedChrs());
             $this->enrollmentsToCreate->setPreviousRepeatedGradePoints($enrollment->getSemesterRepeatedGradePoints());
             $this->enrollmentsToCreate->save();
             $studentIds[] = $enrollment->getStudentId();
             $this->enrollmentCount = $i;
             $i++;
         }
     }
     $this->getUser()->setFlash('notice', 'Promotion was successfull');
     $this->redirect('programsection/index');
 }
示例#3
0
 public function executeDoPromotion(sfWebRequest $request)
 {
     ## find section detail
     $studentIdsArray = array();
     $this->programSectionId = $request->getParameter('id');
     $this->sectionDetail = Doctrine_Core::getTable('ProgramSection')->findOneById($this->programSectionId);
     $this->forward404Unless($this->sectionDetail);
     foreach ($this->sectionDetail->getEnrollmentInfos() as $enrollmentInfo) {
         if (!$enrollmentInfo->getLeftout()) {
             $studentIdsArray[] = $enrollmentInfo->getStudentId();
         }
     }
     ##GET ALL students, in given sectionId, year and semester, with all enrollmentInfos
     $this->students = Doctrine_Core::getTable('Student')->getStudents($studentIdsArray, $this->sectionDetail);
     ## Get promotion information if available for existing class,
     $this->promotionInfo = Doctrine_Core::getTable('PromotionSetting')->getOnePromotionSetting($this->sectionDetail->getProgramId(), $this->sectionDetail->getYear(), $this->sectionDetail->getSemester());
     $this->forward404Unless($this->promotionInfo);
     //$this->enrollmentsToCreate[] = Array();
     ## Create section,
     $this->sectionToCreate = new ProgramSection();
     $this->sectionToCreate->setProgramId($this->sectionDetail->getProgramId());
     $this->sectionToCreate->setCenterId($this->sectionDetail->getCenterId());
     $this->sectionToCreate->setAcademicCalendarId($this->sectionDetail->getAcademicCalendarId());
     $academicYearToSave = ProgramSectionActions::getNextACYearForSection($this->promotionInfo->getCurrentYear(), $this->promotionInfo->getCurrentSemester(), $this->sectionDetail->getAcademicYear());
     $this->sectionToCreate->setAcademicYear($academicYearToSave);
     $this->sectionToCreate->setYear($this->promotionInfo->getToYear());
     $this->sectionToCreate->setSemester($this->promotionInfo->getToSemester());
     $this->sectionToCreate->setSectionNumber($this->sectionDetail->getSectionNumber());
     $this->sectionToCreate->setIsActivated(TRUE);
     $this->sectionToCreate->save();
     $this->sectionDetail->setIsPromoted(TRUE);
     $this->sectionDetail->setIsActivated(FALSE);
     $this->sectionDetail->save();
     foreach ($this->students as $student) {
         foreach ($student->getEnrollmentInfos() as $enrollmentObj) {
             if (!$enrollmentObj->getLeftout()) {
                 $leftoutEnrollments = Doctrine_Core::getTable('EnrollmentInfo')->getLeftoutEnrollments($enrollmentObj);
                 if (!is_null($leftoutEnrollments)) {
                     foreach ($leftoutEnrollments as $loe) {
                         ##modify existing $enrollment Module
                         $enrollmentObj->setTotalChrs($enrollmentObj->getTotalChrs() + $loe->getTotalChrs());
                         $enrollmentObj->setTotalGradePoints($enrollmentObj->getTotalGradePoints() + $loe->getTotalGradePoints());
                         $enrollmentObj->setTotalRepeatedChrs($enrollmentObj->getTotalRepeatedChrs() + $loe->getTotalRepeatedChrs());
                         $enrollmentObj->setTotalRepeatedGradePoints($enrollmentObj->getTotalRepeatedGradePoints() + $loe->getTotalRepeatedGradePoints());
                     }
                 }
             }
         }
     }
     foreach ($this->students as $student) {
         foreach ($student->getEnrollmentInfos() as $enrollment) {
             if (!$enrollment->getLeftout()) {
                 ## get student status with given ENROLLMENT,
                 $status = Statuses::getStudentStatus($student->getEnrollmentInfos(), $this->sectionDetail->getYear(), $this->sectionDetail->getSemester());
                 if ($status == 'PASS' || $status == 'WARNING') {
                     $enrollmentsToCreate = new EnrollmentInfo();
                     $toAcademicYear = ProgramSectionActions::getNextACYearForSection($this->promotionInfo->getCurrentYear(), $this->promotionInfo->getCurrentSemester(), $this->sectionDetail->getAcademicYear());
                     if ($status == 'PASS') {
                         $enrollment->setAcademicStatus(sfConfig::get('app_passing_status'));
                     }
                     if ($status == 'WARNING') {
                         $enrollment->setAcademicStatus(sfConfig::get('app_warning_status'));
                     }
                     $enrollmentsToCreate->makeEnrollment($enrollment, $toAcademicYear, $this->promotionInfo->getToYear(), $this->promotionInfo->getToSemester(), $this->sectionToCreate->getId(), sfConfig::get('app_promotion_enrollment'));
                 } else {
                     if ($status == 'AD') {
                         $enrollment->setAcademicStatus(sfConfig::get('app_ad_status'));
                     }
                     if ($status == 'ADR') {
                         $enrollment->setAcademicStatus(sfConfig::get('app_adr_status'));
                         $enrollment->setSemesterAction(sfConfig::get('app_dismissed_semester_action'));
                         $enrollment->setLeftout(TRUE);
                     }
                     if ($status == 'WITHDRAWAL') {
                         $enrollment->setAcademicStatus(sfConfig::get('app_withdrawal_status'));
                     }
                     if ($status == 'DROPOUT') {
                         $enrollment->setAcademicStatus(sfConfig::get('app_dropout_status'));
                     }
                     $enrollment->setSemesterAction(sfConfig::get('app_dismissed_semester_action'));
                     $enrollment->save();
                 }
             }
         }
     }
     $this->getUser()->setFlash('notice', 'Promotion was successfull');
     $this->redirect('programsection/index');
 }