コード例 #1
0
 public static function assignCoursesToOneSection($courseIds = null, $sectionId = null)
 {
     $countAssignedCourses = 0;
     foreach ($courseIds as $courseId) {
         $sectionCourse = new SectionCourseOffering();
         if (!Doctrine_Core::getTable('SectionCourseOffering')->checkIfCourseIsAssigned($courseId, $sectionId)) {
             $sectionCourse->setOneCourseForOneSection($courseId, $sectionId);
             $countAssignedCourses++;
         }
     }
     return $countAssignedCourses;
 }
コード例 #2
0
ファイル: actions.class.php プロジェクト: eyumay/srms.psco
 public function processCourseOfferingFilterForm(sfWebRequest $request, sfForm $filterform)
 {
     ## Bind form
     //$filterform->bind($request->getParameter($filterform->getName()), $request->getFiles($filterform->getName()));
     $filterform->bind($request->getParameter('filterform'));
     if ($filterform->isValid()) {
         ## get form values
         $formData = $this->filterform->getValues();
         $courseIds = $formData['course_id'];
         if ($courseIds == NULL) {
             $this->getUser()->setFlash('error', 'Courses must be added to bucket');
             $this->redirect('course/index');
         }
         $programId = $formData['program_id'];
         $academicYear = $formData['academic_year'];
         $year = $formData['year'];
         $semester = $formData['semester'];
         $centerId = $formData['center_id'];
         ## Check filter combination availability [program_id, academic_year, year, semester], then return section]
         if (Doctrine_Core::getTable('ProgramSection')->checkIfSectionIsCreated($programId, $academicYear, $year, $semester, $centerId)) {
             ## Assign courses to one section
             $sections = Doctrine_Core::getTable('ProgramSection')->getBatchSection($programId, $academicYear, $year, $semester, $centerId);
             $sectionId = $sections->getId();
             $numberOfAssignedCourses = SectionCourseOffering::assignCoursesToOneSection($courseIds, $sectionId);
             if ($numberOfAssignedCourses == 0) {
                 $this->getUser()->setFlash('notice', 'Selected courses are already defined');
             } else {
                 $center = Doctrine_Core::getTable('Center')->getCenterById($centerId);
                 $this->getUser()->setFlash('notice', $numberOfAssignedCourses . ' courses have been assigned to section at: ' . $center->getName());
             }
         } else {
             $this->getUser()->setFlash('error', 'This Program has not a section defined!');
             $this->redirect('course/index');
         }
         //$this->getUser()->setFlash('notice', 'Success');
         //$this->redirect('course/index');
     }
 }
コード例 #3
0
ファイル: actions.class.php プロジェクト: eyumay/srms.psco
 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');
 }