コード例 #1
0
ファイル: actions.class_1.php プロジェクト: eyumay/srms.psco
 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
 public function executeIndex(sfWebRequest $request)
 {
     #$this->gradeFilterForm = new FilterForm($this->getUser()->getAttribute('departmentId'));
     $departmentId = $this->getUser()->getAttribute('departmentId');
     $this->programs = Doctrine_Core::getTable('Program')->getProgramsByDepartmentId($departmentId);
     if (!empty($this->programs)) {
         $this->program_sections = Doctrine_Core::getTable('ProgramSection')->createQuery('a')->whereIn('program_id', array_keys($this->programs))->execute();
     }
     ## Pass Program infomation
     $this->centers = Doctrine_Core::getTable('Center')->getAllCenters();
     $this->years = FormChoices::getYearChoices();
     $this->academicYears = FormChoices::getAcademicYear();
     $this->semesters = FormChoices::getSemesterChoices();
 }
コード例 #2
0
 public function configure()
 {
     $this->setWidget('program_id', new sfWidgetFormChoice(array('choices' => Doctrine_Core::getTable('Program')->getProgramsByDepartmentId($this->departmentId))));
     $this->setWidget('academic_year', new sfWidgetFormChoice(array('choices' => FormChoices::getAcademicYear())));
     $this->setWidget('year', new sfWidgetFormChoice(array('choices' => FormChoices::getYearChoices())));
     $this->setWidget('semester', new sfWidgetFormChoice(array('choices' => FormChoices::getSemesterChoices())));
     $this->setWidget('center_id', new sfWidgetFormDoctrineChoice(array('model' => 'Center', 'add_empty' => 'Select Center')));
     $this->setWidget('course_id', new sfWidgetFormDoctrineChoice(array('multiple' => true, 'model' => 'Course', 'renderer_class' => 'sfWidgetFormSelectDoubleList', 'renderer_options' => array('associated_first' => false, 'label_unassociated' => 'All courses', 'label_associated' => 'Semester Courses'))));
     $this->widgetSchema->setLabels(array('program_id' => 'Program', 'academic_year' => 'Academic Year'));
     $this->validatorSchema['program_id'] = new sfValidatorNumber(array('required' => true));
     $this->validatorSchema['center_id'] = new sfValidatorNumber(array('required' => true));
     $this->validatorSchema['academic_year'] = new sfValidatorString(array('required' => true));
     $this->validatorSchema['year'] = new sfValidatorNumber(array('required' => true));
     $this->validatorSchema['semester'] = new sfValidatorNumber(array('required' => true));
     $this->validatorSchema['course_id'] = new sfValidatorPass();
     $this->widgetSchema->setNameFormat('filterform[%s]');
 }
コード例 #3
0
 public function configure()
 {
     $programIdArray = Doctrine_Core::getTable('Program')->getProgramsByDepartmentId($this->departmentId);
     $this->useFields(array('program_id', 'academic_year'));
     ##   Student Program information
     $this->widgetSchema['academic_year'] = new sfWidgetFormInputHidden(array(), array('value' => $this->getObject()->getAcademicYear()));
     /* $this->setWidget['program_id'] = new sfWidgetFormDoctrineChoice(array(
           'model' => $this->getRelatedModelName('Program'),
           'add_empty' => 'Select Program ',
        ));
         * 
         */
     $this->widgetSchema['program_id'] = new sfWidgetFormInputHidden(array(), array('value' => $this->getObject()->getProgramId()));
     ##   Validator
     $this->setValidator['program_id'] = new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Program')));
     $this->validatorSchema['academic_year'] = new sfValidatorChoice(array('choices' => array_keys(FormChoices::getAcademicYear()), 'required' => true));
     unset($this['created_at'], $this['updated_at']);
 }
コード例 #4
0
 public function configure()
 {
     //parent::configure();
     //$this->widgetSchema['program_id'] = new sfWidgetFormInputHidden(array(), array('value'=>$this->programId));
     $this->widgetSchema['current_year'] = new sfWidgetFormChoice(array('choices' => FormChoices::getYearChoices()));
     $this->widgetSchema['current_academic_year'] = new sfWidgetFormChoice(array('choices' => FormChoices::getAcademicYear()));
     $this->widgetSchema['current_semester'] = new sfWidgetFormChoice(array('choices' => FormChoices::getSemesterChoices()));
     $this->widgetSchema['to_academic_year'] = new sfWidgetFormChoice(array('choices' => FormChoices::getAcademicYear()));
     $this->widgetSchema['to_year'] = new sfWidgetFormChoice(array('choices' => FormChoices::getYearChoices()));
     $this->widgetSchema['to_semester'] = new sfWidgetFormChoice(array('choices' => FormChoices::getSemesterChoices()));
     ## Validators
     $this->validatorSchema['current_academic_year'] = new sfValidatorString();
     $this->validatorSchema['current_year'] = new sfValidatorString();
     $this->validatorSchema['current_semester'] = new sfValidatorString();
     $this->validatorSchema['to_academic_year'] = new sfValidatorString();
     $this->validatorSchema['to_year'] = new sfValidatorString();
     $this->validatorSchema['to_semester'] = new sfValidatorNumber(array('required' => true));
     //$this->validatorSchema['program_id'] = new sfValidatorNumber(array( 'required' => true ));
 }
コード例 #5
0
 public function configure()
 {
     ## Widget
     $this->setWidget['program_id'] = new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Program'), 'add_empty' => 'Select Program'));
     $this->setWidget['center_id'] = new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Center'), 'add_empty' => 'Select Center'));
     $this->widgetSchema['academic_year'] = new sfWidgetFormChoice(array('choices' => FormChoices::getAcademicYear()));
     $this->widgetSchema['year'] = new sfWidgetFormChoice(array('choices' => FormChoices::getYearChoices()));
     $this->widgetSchema['semester'] = new sfWidgetFormChoice(array('choices' => FormChoices::getSemesterChoices()));
     $this->widgetSchema['section_number'] = new sfWidgetFormChoice(array('choices' => FormChoices::getSectionChoices()));
     ## Validator
     $this->setValidator['program_id'] = new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Program')));
     $this->setValidator['center_id'] = new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Center')));
     $this->validatorSchema['academic_year'] = new sfValidatorChoice(array('choices' => array_keys(FormChoices::getAcademicYear()), 'required' => true));
     $this->validatorSchema['year'] = new sfValidatorChoice(array('choices' => array_keys(FormChoices::getSemesterChoices()), 'required' => true));
     $this->validatorSchema['semester'] = new sfValidatorChoice(array('choices' => array_keys(FormChoices::getYearChoices()), 'required' => true));
     $this->validatorSchema['section_number'] = new sfValidatorChoice(array('choices' => array_keys(FormChoices::getSectionChoices()), 'required' => true));
     $this->widgetSchema->setLabels(array('program_id' => 'Program *', 'center_id' => 'Center *', 'academic_year' => 'Academic Year *', 'semester' => 'Semester *', 'year' => 'Year * '));
     ## unset the following fields
     unset($this['created_at'], $this['updated_at'], $this['number_of_student'], $this['is_promoted']);
 }
コード例 #6
0
 public function configure()
 {
     /* $this->widgetSchema['section_id'] = new sfWidgetFormInputHidden( array(), array('value'=>$this->sectionId) );
        $this->widgetSchema['current_year'] = new sfWidgetFormInputHidden(array(), array('value'=>$this->currentYear));
        $this->widgetSchema['current_academic_year'] = new sfWidgetFormInputHidden(array(), array('value'=>$this->currentAcademicYear));
        $this->widgetSchema['current_semester'] = new sfWidgetFormInputHidden(array(), array('value'=>$this->currentSemester));
         * 
         */
     $this->widgetSchema['program_id'] = new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Program'), 'add_empty' => 'Please select Program'));
     $this->widgetSchema['current_year'] = new sfWidgetFormChoice(array('choices' => FormChoices::getYearChoices()));
     $this->widgetSchema['current_academic_year'] = new sfWidgetFormChoice(array('choices' => FormChoices::getAcademicYear()));
     $this->widgetSchema['current_semester'] = new sfWidgetFormChoice(array('choices' => FormChoices::getSemesterChoices()));
     $this->widgetSchema['to_academic_year'] = new sfWidgetFormChoice(array('choices' => FormChoices::getAcademicYear()));
     $this->widgetSchema['to_year'] = new sfWidgetFormChoice(array('choices' => FormChoices::getYearChoices()));
     $this->widgetSchema['to_semester'] = new sfWidgetFormChoice(array('choices' => FormChoices::getSemesterChoices()));
     ## Validators
     $this->validatorSchema['current_academic_year'] = new sfValidatorString();
     $this->validatorSchema['current_year'] = new sfValidatorString();
     $this->validatorSchema['current_semester'] = new sfValidatorString();
     $this->validatorSchema['to_academic_year'] = new sfValidatorString();
     $this->validatorSchema['to_year'] = new sfValidatorString();
     $this->validatorSchema['to_semester'] = new sfValidatorNumber(array('required' => true));
 }
コード例 #7
0
ファイル: FilterForm.class.php プロジェクト: eyumay/srms.psco
 public function configure()
 {
     /*$this->setWidgets(array(
       'program_id'		=>new sfWidgetFormDoctrineChoice(array(
       						'model' => 'Program',
       						'add_empty' => 'Select Program'
       						)), 
       'academic_year'	=>new sfWidgetFormChoice(array(
       						'choices' => FormChoices::getAcademicYear(),
       						)), 
       'year'				=>new sfWidgetFormChoice(array(
       						'choices' => FormChoices::getYearChoices()    						
       						)),	 
       'semester'			=>new sfWidgetFormChoice(array(
       						'choices' => FormChoices::getSemesterChoices() 
       						)), 
       'center_id'		=>new sfWidgetFormDoctrineChoice(array(
       						'model' => 'Center',
       						'add_empty' => 'Select Center'
       						))
       ));
         * 
         */
     $this->setWidget('program_id', new sfWidgetFormChoice(array('choices' => Doctrine_Core::getTable('Program')->getProgramsByDepartmentId($this->departmentId))));
     $this->setWidget('academic_year', new sfWidgetFormChoice(array('choices' => FormChoices::getAcademicYear())));
     $this->setWidget('year', new sfWidgetFormChoice(array('choices' => FormChoices::getYearChoices())));
     $this->setWidget('semester', new sfWidgetFormChoice(array('choices' => FormChoices::getSemesterChoices())));
     $this->setWidget('center_id', new sfWidgetFormDoctrineChoice(array('model' => 'Center', 'add_empty' => 'Select Center')));
     $this->widgetSchema->setLabels(array('program_id' => 'Program', 'academic_year' => 'Academic Year'));
     $this->validatorSchema['program_id'] = new sfValidatorNumber();
     $this->validatorSchema['academic_year'] = new sfValidatorString();
     $this->validatorSchema['year'] = new sfValidatorString();
     $this->validatorSchema['semester'] = new sfValidatorNumber(array('required' => true));
     $this->validatorSchema['center_id'] = new sfValidatorNumber(array('required' => true));
     $this->widgetSchema->setNameFormat('filterform[%s]');
 }
コード例 #8
0
ファイル: actions.class.php プロジェクト: eyumay/srms.psco
 public function executeEnrolltosection(sfWebRequest $request)
 {
     ## Data to redisplay the filter, later to be binded to the form
     $departmentId = $this->getUser()->getAttribute('departmentId');
     $this->programs = Doctrine_Core::getTable('Program')->getProgramsByDepartmentId($departmentId);
     $this->years = FormChoices::getYearChoices();
     $this->academicYears = FormChoices::getAcademicYear();
     $this->semesters = FormChoices::getSemesterChoices();
     ## Retrieve $enrollmentInfoIds and $sectionIds from session variable, and delete it
     $enrollmentInfoIds = $this->getUser()->getAttribute('enrollmentInfoIds');
     $sectionIds = $this->getUser()->getAttribute('sectionIds');
     $this->studentsToEnroll = new StudentToSectionEnrollmentForm($enrollmentInfoIds, $sectionIds);
     if ($this->processEnrolltosectionform($request, $this->studentsToEnroll)) {
         ## do saving form here ...
         $this->getUser()->setFlash('notice', 'perfecto');
         $this->setTemplate('enrolltosection');
     }
     $this->getUser()->setFlash('error', 'No selected student to enroll to section ');
     $this->setTemplate('enrolltosection');
 }
コード例 #9
0
ファイル: actions.class.php プロジェクト: eyumay/srms.psco
 public function executeSectionformfilter(sfWebRequest $request)
 {
     ## Data from filter form
     $year = $request->getParameter('year');
     $semester = $request->getParameter('semester');
     $academicYear = $request->getParameter('academic_year');
     $programId = $request->getParameter('program_id');
     $centerId = $request->getParameter('center_id');
     $this->program_id = $request->getParameter('program_id');
     ##
     # save above data temporarily, and delete it on the next action,
     ## Data to redisplay the filter, later to be binded to the form
     $this->programs = Doctrine_Core::getTable('Program')->getProgramsByDepartmentId($this->getUser()->getAttribute('departmentId'));
     $this->centers = Doctrine_Core::getTable('Center')->getAllCenters();
     $this->years = FormChoices::getYearChoices();
     $this->academicYears = FormChoices::getAcademicYear();
     $this->semesters = FormChoices::getSemesterChoices();
     ## Process filtering,
     if ($year == 0 || $semester == 0 || $programId == 0 || $academicYear == 0 || $centerId == 0) {
         $this->getUser()->setFlash('error', "All filters should be selected");
         $this->redirect('programsection/sectionformfilter');
     } else {
         $this->getUser()->setAttribute('selectedYear', $year);
         $this->getUser()->setAttribute('selectedSemester', $semester);
         $this->getUser()->setAttribute('selectedAcademicYear', $academicYear);
         $this->getUser()->setAttribute('selectedProgramId', $programId);
         $this->getUser()->setAttribute('selectedCenterId', $centerId);
         # Check if section exists, or is ready!
         if (Doctrine_Core::getTable('ProgramSection')->checkIfSectionIsCreated($programId, $academicYear, $year, $semester, $centerId)) {
             ## Redirect and display class information
             $this->oneSectionDetail = Doctrine_Core::getTable('ProgramSection')->getBatchSection($programId, $academicYear, $year, $semester, $centerId);
         } else {
             $this->getUser()->setFlash('error', "This section not yet created");
             $this->redirect('programsection/index');
         }
     }
 }
コード例 #10
0
ファイル: actions.class.php プロジェクト: eyumay/srms.psco
 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');
         }
     }
 }
コード例 #11
0
ファイル: actions.class.php プロジェクト: eyumay/srms.psco
 public function executeDogradesubmission(sfWebRequest $request)
 {
     $programSectionId = $request->getParameter('sectionId');
     $courseId = $request->getParameter('courseId');
     $this->studentIdsArray = array();
     $this->studentIdNamePairArray = array();
     $this->enrollmentIdNamePairArray = array();
     $enrollmentIdsArray = array();
     $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();
     $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);
     ## Also show filter form
     $this->gradeFilterForm = new FilterForm($this->getUser()->getAttribute('departmentId'));
     ## Recreate the GRADE SUBMISSION Form,
     $this->gradeForm = new FrontendGradeSubmissionForm($this->getUser()->getAttribute('studentIdNamePairArray'), $this->getUser()->getAttribute('courseId'), $this->gradeChoices = submitgradeActions::getGradeChoicesAsArray(Doctrine_Core::getTable('Grade')->getAllLetterGradeChoices()));
     $this->processDogradesubmission($request, $this->gradeForm);
     $this->setTemplate('dogradesubmission');
 }
コード例 #12
0
ファイル: actions.class.php プロジェクト: eyumay/srms.psco
 public function executeEdit(sfWebRequest $request)
 {
     $departmentId = $this->getUser()->getAttribute('departmentId');
     $this->programs = Doctrine_Core::getTable('Program')->getProgramsByDepartmentId($departmentId);
     if (!empty($this->programs)) {
         $this->program_sections = Doctrine_Core::getTable('ProgramSection')->getActiveProgramSections(array_keys($this->programs));
     }
     $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);
     $programSectionId = $request->getParameter('programSectionId');
     $this->forward404Unless($programSection = Doctrine_Core::getTable('ProgramSection')->find(array($request->getParameter('programSectionId'))), sprintf('Object program_section does not exist (%s).', $request->getParameter('programSectionId')));
     if ($programSection->checkToEdit()) {
         $this->programSectionForm = new FrontendProgramSectionForm($programSection, $departmentId);
     } else {
         $this->getUser()->setFlash('error', 'Cannot Be Editted: Editting Allowed Only For Year 1 and Semester 1 Program Sections!!');
         $this->redirect('managesection/index');
     }
     if ($request->isMethod('post')) {
         $this->programSectionForm->bind($request->getParameter($this->programSectionForm->getName()), $request->getFiles($this->programSectionForm->getName()));
         if ($this->programSectionForm->isValid()) {
             $programSectionData = $this->programSectionForm->getValues();
             $this->programSectionForm->save();
             if ($programSection->hasEnrollments()) {
                 $programSection->updateEnrollments($programSectionData['program_id'], $programSectionData['academic_year'], $programSectionData['year'], $programSectionData['semester']);
             }
             $this->getUser()->setFlash('notice', 'Program Section Information Updated Successfully! ');
             $this->redirect('managesection/index');
         } else {
             $this->getUser()->setFlash('error', 'The Form Has Errors, Please Correct And Try Again.' . $this->programSectionForm->getName());
         }
     }
 }