public function configure() { $this->widgetSchema['department_id'] = new sfWidgetFormInputHidden(array(), array('value' => $this->departmentId)); $this->validatorSchema['department_id'] = new sfValidatorNumber(); $this->widgetSchema['credit_houre'] = new sfWidgetFormChoice(array('choices' => FormChoices::getCreditHourChoices())); $this->validatorSchema['credit_houre'] = new sfValidatorNumber(); unset($this['created_at'], $this['updated_at'], $this['aproval_date'], $this['ac_minutes']); }
public function configure() { ## WIDGETS ################### $this->widgetSchema['date_of_birth'] = new sfWidgetFormDate(array('can_be_empty' => true, 'years' => FormChoices::getYearsForDateOfBirth())); $this->widgetSchema['sex'] = new sfWidgetFormChoice(array('choices' => FormChoices::getGenderChoices(), 'expanded' => true)); $this->widgetSchema['admission_year'] = new sfWidgetFormChoice(array('choices' => FormChoices::getAdmissionYearChoices())); $this->widgetSchema['email'] = new sfWidgetFormInputText(); ## VALIDATORS ## $this->validatorSchema['name'] = new sfValidatorRegex(array('pattern' => '/^[a-zA-Z\\s]{2,}$/'), array('invalid' => 'Name is invalid, Enter Any character in the range a-z or A-Z, spaces and minimum two characters')); $this->validatorSchema['fathers_name'] = new sfValidatorRegex(array('pattern' => '/^[a-zA-Z\\s]{2,}$/'), array('invalid' => 'Father name is invalid, Enter Any character in the range a-z or A-Z, spaces and minimum two characters')); $this->validatorSchema['grandfathers_name'] = new sfValidatorRegex(array('pattern' => '/^[a-zA-Z\\s]{2,}$/', 'required' => false), array('invalid' => 'Grand Father name is invalid, Enter Any character in the range a-z or A-Z, spaces and minimum two characters')); $this->setValidatorSchema['date_of_birth'] = new sfValidatorDate(); $this->validatorSchema['sex'] = new sfValidatorChoice(array('choices' => array_keys(FormChoices::getGenderChoices()), 'required' => true)); $this->validatorSchema['admission_year'] = new sfValidatorChoice(array('choices' => array_keys(FormChoices::getAdmissionYearChoices()), 'required' => true)); $this->setValidatorSchema['email'] = new sfValidatorEmail(); $this->validatorSchema['nationality'] = new sfValidatorRegex(array('pattern' => '/^[a-zA-Z\\s]{2,}$/', 'required' => false), array('invalid' => 'Nationlity is invalid, Enter Any character in the range a-z or A-Z, spaces and minimum two characters')); $this->validatorSchema['birth_location'] = new sfValidatorRegex(array('pattern' => '/^[a-zA-Z\\s]{2,}$/', 'required' => false), array('invalid' => 'Birth location is invalid, Enter Any character in the range a-z or A-Z, spaces and minimum two characters')); $this->validatorSchema['residence_city'] = new sfValidatorRegex(array('pattern' => '/^[a-zA-Z\\s]{2,}$/', 'required' => false), array('invalid' => 'Residence city is invalid, Enter Any character in the range a-z or A-Z, spaces and minimum two characters')); $this->validatorSchema['residence_woreda'] = new sfValidatorRegex(array('pattern' => '/^[a-zA-Z\\s]{2,}$/', 'required' => false), array('invalid' => 'Woreda is invalid, Enter Any character in the range a-z or A-Z, spaces and minimum two characters')); $this->validatorSchema['ethnicity'] = new sfValidatorRegex(array('pattern' => '/^[a-zA-Z\\s]{2,}$/', 'required' => false), array('invalid' => 'Ethnicity is invalid, Enter Any character in the range a-z or A-Z, spaces and minimum two characters')); $this->validatorSchema['email'] = new sfValidatorEmail(array('required' => false)); $this->validatorSchema['telephone'] = new sfValidatorRegex(array('pattern' => '/\\+[0-9]{6,}/', 'required' => false)); ## PREVENT REPETITION IN REGISTRATION $this->validatorSchema->setPostValidator(new sfValidatorDoctrineUnique(array('model' => 'Student', 'column' => array('first_name', 'middle_name', 'last_name', 'date_of_birth')), array('invalid' => 'This student is already registered ! ! '))); $this->widgetSchema->setLabels(array('name' => 'Name *', 'fathers_name' => 'Fathers Name *', 'grandfathers_name' => 'Grandfathers Name *', 'mother_name' => 'Mother Name *', 'date_of_birth' => 'Date of Birth *', 'admission_year' => 'Admission Year *', 'nationality' => 'Nationality *', 'sex' => 'Sex *')); ## Unset some values not needed in the process unset($this['created_at'], $this['updated_at'], $this['photo'], $this['student_uid']); if (!is_null($this->sectionId)) { $sectionDetail = Doctrine_Core::getTable('ProgramSection')->findOneById($this->sectionId); $studentCenter = new StudentCenter(); $studentCenter->setCenterId($sectionDetail->getCenterId()); $studentCenter->Student = $this->getObject(); $studentCenterForm = new FrontendStudentCenterForm($studentCenter); $this->embedForm('studentcenter', $studentCenterForm); $enrollmentInfoObj = new EnrollmentInfo(); $enrollmentInfoObj->setProgramId($sectionDetail->getProgramId()); $enrollmentInfoObj->setAcademicYear($sectionDetail->getAcademicYear()); $enrollmentInfoObj->Student = $this->getObject(); $enrollmentForm = new FrontendEnrollmentInfoForm($enrollmentInfoObj, $this->departmentId); $this->embedForm('studentEnrollment', $enrollmentForm); } else { ## Embedd StudentCenterForm $studentCenter = new StudentCenter(); $studentCenter->Student = $this->getObject(); $studentCenterForm = new StudentCenterForm($studentCenter); $this->embedForm('studentcenter', $studentCenterForm); ## Embed EnrollmentInfoForm, some are to be saved to EnrollmentInfo Table $enrollmentInfoObj = new EnrollmentInfo(); $enrollmentInfoObj->Student = $this->getObject(); $enrollmentForm = new EnrollmentInfoForm($enrollmentInfoObj, $this->departmentId); $this->embedForm('studentEnrollment', $enrollmentForm); ## Embed EnrollmentInfoForm, some are to be saved to EnrollmentInfo Table $enrollmentInfoObj = new EnrollmentInfo(); $enrollmentInfoObj->Student = $this->getObject(); $enrollmentForm = new EnrollmentInfoForm($enrollmentInfoObj, $this->departmentId); $this->embedForm('studentEnrollment', $enrollmentForm); } }
public function configure() { $this->widgetSchema['course_id'] = new sfWidgetFormChoice(array('multiple' => true, 'choices' => $this->courseIds, 'renderer_class' => 'sfWidgetFormSelectDoubleList', 'renderer_options' => array('associated_first' => false, 'label_unassociated' => 'Courses To Add To Curriculum', 'label_associated' => 'Curriculum Courses'))); $this->validatorSchema['course_id'] = new sfValidatorPass(); $this->widgetSchema['program_id'] = new sfWidgetFormInputHidden(array(), array('value' => $this->programId)); $this->validatorSchema['program_id'] = new sfValidatorNumber(); $this->widgetSchema['year'] = new sfWidgetFormChoice(array('choices' => FormChoices::getYearChoices())); $this->validatorSchema['year'] = new sfValidatorNumber(); $this->widgetSchema['semester'] = new sfWidgetFormChoice(array('choices' => FormChoices::getSemesterChoices())); $this->validatorSchema['semester'] = new sfValidatorNumber(); $this->widgetSchema->setNameFormat('coursechecklistform[%s]'); }
public function configure() { $this->widgetSchema['course_id'] = new sfWidgetFormChoice(array('choices' => $this->courseArray)); $this->validatorSchema['course_id'] = new sfValidatorString(); $this->widgetSchema['grade_id'] = new sfWidgetFormChoice(array('choices' => FormChoices::getGradeChoicesAsArray($this->gradeChoices))); $this->validatorSchema['grade_id'] = new sfValidatorNumber(); $this->widgetSchema['student_id'] = new sfWidgetFormInputHidden(array(), array('value' => $this->studentId)); $this->validatorSchema['student_id'] = new sfValidatorNumber(); $this->widgetSchema['registration_id'] = new sfWidgetFormInputHidden(array(), array('value' => $this->registrationId)); $this->validatorSchema['registration_id'] = new sfValidatorNumber(); $this->widgetSchema->setNameFormat('exemptionsubmissionform[%s]'); }
public function configure() { $this->useFields(array('program_id', 'year', 'semester', 'course_type', 'status')); $programIdArray = Doctrine_Core::getTable('Program')->getProgramsByDepartmentId($this->departmentId); $this->widgetSchema['course_type'] = new sfWidgetFormChoice(array('choices' => FormChoices::getCourseTypeChoices())); $this->setValidator['course_type'] = new sfWidgetFormChoice(array('choices' => FormChoices::getCourseTypeChoices())); $this->widgetSchema['semester'] = new sfWidgetFormChoice(array('choices' => FormChoices::getSemesterChoices())); $this->setValidator['Semester'] = new sfWidgetFormChoice(array('choices' => FormChoices::getSemesterChoices())); $this->widgetSchema['year'] = new sfWidgetFormChoice(array('choices' => FormChoices::getYearChoices())); $this->setValidator['year'] = new sfWidgetFormChoice(array('choices' => FormChoices::getYearChoices())); $this->widgetSchema['program_id'] = new sfWidgetFormChoice(array('choices' => $programIdArray)); $this->setValidator['program_id'] = new sfWidgetFormChoice(array('choices' => $programIdArray)); }
/** * 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(); }
public function configure() { ## SET WIDGETS$this->setWidgets(array( $sNum = 1; foreach ($this->studentExemptionObj as $seObj) { ## checkIfEnrollment is clearance enrollment $this->setWidget('s_exemption_id' . $seObj->getId(), new sfWidgetFormChoice(array('choices' => FormChoices::getExemptionGradeTypes(), 'label' => $sNum . '. ' . $seObj->getCourse()))); $sNum++; } ## SET VALIDATORS foreach ($this->studentExemptionObj as $seObj) { $this->setValidator('s_exemption_id' . $seObj->getId(), new sfValidatorString()); } $this->widgetSchema->setNameFormat('exemptiongradesubmissionform[%s]'); }
public function 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_semester'] = new sfWidgetFormChoice(array('choices' => FormChoices::getSemesterChoices())); $this->widgetSchema['to_year'] = new sfWidgetFormChoice(array('choices' => FormChoices::getYearChoices())); $this->widgetSchema['to_semester'] = new sfWidgetFormChoice(array('choices' => FormChoices::getSemesterChoices())); ## Validators $this->validatorSchema['current_year'] = new sfValidatorString(); $this->validatorSchema['current_semester'] = 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)); $this->widgetSchema->setNameFormat('promotionsettingform[%s]'); }
public function configure() { $this->widgetSchema['course_id'] = new sfWidgetFormChoice(array('choices' => $this->courseArray)); $this->validatorSchema['course_id'] = new sfValidatorString(); $this->widgetSchema['regrade_reason'] = new sfWidgetFormChoice(array('choices' => FormChoices::getRegradeTypeChoices())); $this->validatorSchema['regrade_reason'] = new sfValidatorString(); $this->widgetSchema['ac'] = new sfWidgetFormInput(); $this->validatorSchema['ac'] = new sfValidatorString(); $this->widgetSchema['remark'] = new sfWidgetFormInput(); $this->validatorSchema['remark'] = new sfValidatorString(); $this->widgetSchema['student_id'] = new sfWidgetFormInputHidden(array(), array('value' => $this->studentId)); $this->validatorSchema['student_id'] = new sfValidatorNumber(); $this->widgetSchema['enrollment_info_id'] = new sfWidgetFormInputHidden(array(), array('value' => $this->enrollmentInfoId)); $this->validatorSchema['enrollment_info_id'] = new sfValidatorNumber(); $this->widgetSchema->setNameFormat('regraderequestform[%s]'); }
public function configure() { $this->widgetSchema['program_id'] = new sfWidgetFormInputHidden(array(), array('value' => $this->programId)); $this->widgetSchema['year'] = new sfWidgetFormChoice(array('choices' => FormChoices::getYearChoices())); $this->widgetSchema['semester'] = new sfWidgetFormChoice(array('choices' => FormChoices::getSemesterChoices())); $this->widgetSchema['semester_type_id'] = new sfWidgetFormChoice(array('choices' => Doctrine::getTable('SemesterType')->getAllSemesterTypesArray())); $this->widgetSchema['semester_min_chr'] = new sfWidgetFormInputText(); $this->widgetSchema['semester_max_chr'] = new sfWidgetFormInputText(); ## Validators $this->validatorSchema['semester_min_chr'] = new sfValidatorNumber(); $this->validatorSchema['semester_max_chr'] = new sfValidatorNumber(); $this->validatorSchema['semester_type_id'] = new sfValidatorNumber(); $this->validatorSchema['year'] = new sfValidatorString(); $this->validatorSchema['semester'] = new sfValidatorNumber(array('required' => true)); $this->validatorSchema['program_id'] = new sfValidatorNumber(array('required' => true)); $this->widgetSchema->setNameFormat('promotionsettingform[%s]'); }
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]'); }
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']); }
public function configure() { parent::configure(); unset($this['admission_year'], $this['id']); ## WIDGETS ################### $this->widgetSchema['name'] = new sfWidgetFormInput(); $this->validatorSchema['name'] = new sfValidatorRegex(array('pattern' => '/^[a-zA-Z\\s]{2,}$/'), array('invalid' => 'Name is invalid, Enter Any character in the range a-z or A-Z, spaces and minimum two characters')); $this->widgetSchema['fathers_name'] = new sfWidgetFormInput(); $this->validatorSchema['fathers_name'] = new sfValidatorRegex(array('pattern' => '/^[a-zA-Z\\s]{2,}$/'), array('invalid' => 'Father name is invalid, Enter Any character in the range a-z or A-Z, spaces and minimum two characters')); $this->widgetSchema['grandfathers_name'] = new sfWidgetFormInput(); $this->validatorSchema['grandfathers_name'] = new sfValidatorRegex(array('pattern' => '/^[a-zA-Z\\s]{2,}$/', 'required' => true), array('invalid' => 'Grand Father name is invalid, Enter Any character in the range a-z or A-Z, spaces and minimum two characters')); $this->widgetSchema['mother_name'] = new sfWidgetFormInput(); $this->validatorSchema['mother_name'] = new sfValidatorRegex(array('pattern' => '/^[a-zA-Z\\s]{2,}$/', 'required' => true), array('invalid' => 'Mother name is invalid, Enter Any character in the range a-z or A-Z, spaces and minimum two characters')); //$this->widgetSchema['name'] = new sfWidgetFormInput(); $this->widgetSchema['date_of_birth'] = new sfWidgetFormDate(array('can_be_empty' => true, 'years' => FormChoices::getYearsForDateOfBirth())); $this->validatorSchema['date_of_birth'] = new sfValidatorDate(array('required' => true)); $this->widgetSchema['sex'] = new sfWidgetFormChoice(array('choices' => FormChoices::getGenderChoices(), 'expanded' => true)); $this->validatorSchema['sex'] = new sfValidatorChoice(array('choices' => array_keys(FormChoices::getGenderChoices()), 'required' => true)); $this->widgetSchema['nationality'] = new sfWidgetFormInput(); $this->validatorSchema['nationality'] = new sfValidatorRegex(array('pattern' => '/^[a-zA-Z\\s]{2,}$/', 'required' => true), array('invalid' => 'Nationlity is invalid, Enter Any character in the range a-z or A-Z, spaces and minimum two characters')); //$this->widgetSchema['admission_year'] = new sfWidgetFormChoice(array('choices'=> FormChoices::getAdmissionYearChoices() )); $this->widgetSchema['birth_location'] = new sfWidgetFormInput(); $this->validatorSchema['birth_location'] = new sfValidatorRegex(array('pattern' => '/^[a-zA-Z\\s]{2,}$/', 'required' => false), array('invalid' => 'Birth location is invalid, Enter Any character in the range a-z or A-Z, spaces and minimum two characters')); $this->widgetSchema['residence_city'] = new sfWidgetFormInput(); $this->validatorSchema['residence_city'] = new sfValidatorRegex(array('pattern' => '/^[a-zA-Z\\s]{2,}$/', 'required' => false), array('invalid' => 'Residence city is invalid, Enter Any character in the range a-z or A-Z, spaces and minimum two characters')); $this->widgetSchema['residence_woreda'] = new sfWidgetFormInput(); $this->validatorSchema['residence_woreda'] = new sfValidatorRegex(array('pattern' => '/^[a-zA-Z\\s]{2,}$/', 'required' => false), array('invalid' => 'Woreda is invalid, Enter Any character in the range a-z or A-Z, spaces and minimum two characters')); $this->widgetSchema['residence_kebele'] = new sfWidgetFormInput(); $this->validatorSchema['residence_kebele'] = new sfValidatorString(array('required' => false)); $this->widgetSchema['residence_house_number'] = new sfWidgetFormInput(); $this->validatorSchema['residence_house_number'] = new sfValidatorString(array('required' => false)); $this->widgetSchema['ethnicity'] = new sfWidgetFormInput(); $this->validatorSchema['ethnicity'] = new sfValidatorRegex(array('pattern' => '/^[a-zA-Z\\s]{2,}$/', 'required' => false), array('invalid' => 'Ethnicity is invalid, Enter Any character in the range a-z or A-Z, spaces and minimum two characters')); $this->widgetSchema['telephone'] = new sfWidgetFormInput(); $this->validatorSchema['telephone'] = new sfValidatorString(array('required' => true)); //$this->validatorSchema['telephone'] = new sfValidatorRegex(array('pattern'=>'/\+[0-9]{6,}/', 'required' => true)); $this->validatorSchema['telephone'] = new sfValidatorRegex(array('pattern'=>'/\+[0-9]{6,}/', 'required' => true)); $this->widgetSchema['email'] = new sfWidgetFormInputText(); $this->validatorSchema['email'] = new sfValidatorEmail(array('required' => false)); //$this->validatorSchema['admission_year'] = new sfValidatorChoice(array('choices' => array_keys(FormChoices::getAdmissionYearChoices()), 'required' => true )); ## PREVENT REPETITION IN REGISTRATION $this->validatorSchema->setPostValidator(new sfValidatorDoctrineUnique(array('model' => 'Student', 'column' => array('first_name', 'middle_name', 'last_name', 'date_of_birth')), array('invalid' => 'This student is already registered ! ! '))); $this->widgetSchema->setLabels(array('student_uid' => 'Student ID No. *', 'name' => 'Name *', 'fathers_name' => 'Fathers Name *', 'grandfathers_name' => 'Grandfathers Name *', 'mother_name' => 'Mother Name *', 'date_of_birth' => 'Date of Birth *', 'sex' => 'Sex *', 'nationality' => 'Nationality *', 'telephone' => 'Telephone *')); $this->widgetSchema->setNameFormat('studentform[%s]'); }
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 )); }
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']); }
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)); }
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]'); }
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()); } } }
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'); }
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 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'); }
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'); } } }