Ejemplo n.º 1
0
 public function getStudentDetail($con = null)
 {
     include_once 'lib/model/om/BaseStudentDetailPeer.php';
     if ($this->aStudentDetail === null && $this->student_detail_id !== null) {
         $this->aStudentDetail = StudentDetailPeer::retrieveByPK($this->student_detail_id, $con);
     }
     return $this->aStudentDetail;
 }
Ejemplo n.º 2
0
 public static function doSelectJoinAllExceptStudent(Criteria $c, $con = null)
 {
     $c = clone $c;
     if ($c->getDbName() == Propel::getDefaultDB()) {
         $c->setDbName(self::DATABASE_NAME);
     }
     VMemberStudentPeer::addSelectColumns($c);
     $startcol2 = VMemberStudentPeer::NUM_COLUMNS - VMemberStudentPeer::NUM_LAZY_LOAD_COLUMNS + 1;
     MemberDetailPeer::addSelectColumns($c);
     $startcol3 = $startcol2 + MemberDetailPeer::NUM_COLUMNS;
     DepartmentPeer::addSelectColumns($c);
     $startcol4 = $startcol3 + DepartmentPeer::NUM_COLUMNS;
     AcademicCalendarPeer::addSelectColumns($c);
     $startcol5 = $startcol4 + AcademicCalendarPeer::NUM_COLUMNS;
     ClassGroupPeer::addSelectColumns($c);
     $startcol6 = $startcol5 + ClassGroupPeer::NUM_COLUMNS;
     StudentDetailPeer::addSelectColumns($c);
     $startcol7 = $startcol6 + StudentDetailPeer::NUM_COLUMNS;
     $c->addJoin(VMemberStudentPeer::MEMBER_DETAIL_ID, MemberDetailPeer::ID);
     $c->addJoin(VMemberStudentPeer::DEPARTMENT_ID, DepartmentPeer::ID);
     $c->addJoin(VMemberStudentPeer::ACADEMIC_CALENDAR_ID, AcademicCalendarPeer::ID);
     $c->addJoin(VMemberStudentPeer::CLASS_GROUP_ID, ClassGroupPeer::ID);
     $c->addJoin(VMemberStudentPeer::STUDENT_DETAIL_ID, StudentDetailPeer::ID);
     $rs = BasePeer::doSelect($c, $con);
     $results = array();
     while ($rs->next()) {
         $omClass = VMemberStudentPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj1 = new $cls();
         $obj1->hydrate($rs);
         $omClass = MemberDetailPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj2 = new $cls();
         $obj2->hydrate($rs, $startcol2);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj2 = $temp_obj1->getMemberDetail();
             if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj2->addVMemberStudent($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj2->initVMemberStudents();
             $obj2->addVMemberStudent($obj1);
         }
         $omClass = DepartmentPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj3 = new $cls();
         $obj3->hydrate($rs, $startcol3);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj3 = $temp_obj1->getDepartment();
             if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj3->addVMemberStudent($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj3->initVMemberStudents();
             $obj3->addVMemberStudent($obj1);
         }
         $omClass = AcademicCalendarPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj4 = new $cls();
         $obj4->hydrate($rs, $startcol4);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj4 = $temp_obj1->getAcademicCalendar();
             if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj4->addVMemberStudent($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj4->initVMemberStudents();
             $obj4->addVMemberStudent($obj1);
         }
         $omClass = ClassGroupPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj5 = new $cls();
         $obj5->hydrate($rs, $startcol5);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj5 = $temp_obj1->getClassGroup();
             if ($temp_obj5->getPrimaryKey() === $obj5->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj5->addVMemberStudent($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj5->initVMemberStudents();
             $obj5->addVMemberStudent($obj1);
         }
         $omClass = StudentDetailPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj6 = new $cls();
         $obj6->hydrate($rs, $startcol6);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj6 = $temp_obj1->getStudentDetail();
             if ($temp_obj6->getPrimaryKey() === $obj6->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj6->addVMemberStudent($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj6->initVMemberStudents();
             $obj6->addVMemberStudent($obj1);
         }
         $results[] = $obj1;
     }
     return $results;
 }
Ejemplo n.º 3
0
 public function executeUpdateParent()
 {
     $i18n = new sfI18N();
     $i18n->initialize($this->getContext());
     $i18n->setCulture($this->getUser()->getCulture());
     $action_i18n = $i18n->globalMessageFormat->format('save as new');
     $action_type = $this->getRequestParameter('action_type');
     $counseling_id = $this->getRequestParameter('counseling_id');
     $counseling = CounselingPeer::retrieveByPK($counseling_id);
     $this->forward404Unless($counseling);
     $accal_id = $this->getRequestParameter('academic_calendar_id');
     $academic_calendar = AcademicCalendarPeer::retrieveByPK($accal_id);
     $this->forward404Unless($academic_calendar);
     $student_detail = StudentDetailPeer::retrieveByPk($this->getRequestParameter('student_detail_id'));
     $this->forward404Unless($student_detail);
     $student_detail->setFather($this->getRequestParameter('father'));
     $student_detail->setMother($this->getRequestParameter('mother'));
     $student_detail->save();
     $student = StudentPeer::retrieveByPk($this->getRequestParameter('id'));
     $this->forward404Unless($student);
     $father = StudentParentsPeer::retrieveByPK($this->getRequestParameter('father_id'));
     if ($father == null) {
         $father = new StudentParents();
     }
     $father->setId($this->getRequestParameter('father_id'));
     $father->setStudent($student);
     $father->setRelation(StudentParents::RELATION_FATHER);
     $father->setName($this->getRequestParameter('father'));
     $father->setPob($this->getRequestParameter('father_pob'));
     if ($this->getRequestParameter('father_dob')) {
         $father->setDob($this->getRequestParameter('father_dob'));
     }
     $father->setReligionId($this->getRequestParameter('religion_father'));
     $father->setCountryId($this->getRequestParameter('father_country'));
     $father->setDegreeId($this->getRequestParameter('degree_father'));
     $father->setJob($this->getRequestParameter('father_job'));
     $father->setNoteDetail($this->getRequestParameter('father_notedetail'));
     $father->setMonthlyRevenue($this->getRequestParameter('father_revenue'));
     $father->setOfficePhone($this->getRequestParameter('father_officephone'));
     $father->setEmail($this->getRequestParameter('father_email'));
     $father->setAddress($this->getRequestParameter('father_address'));
     $father->setCellphone($this->getRequestParameter('father_cellphone'));
     $father->save();
     $mother = StudentParentsPeer::retrieveByPK($this->getRequestParameter('mother_id'));
     if ($mother == null) {
         $mother = new StudentParents();
     }
     $mother->setId($this->getRequestParameter('mother_id'));
     $mother->setStudent($student);
     $mother->setRelation(StudentParents::RELATION_MOTHER);
     $mother->setName($this->getRequestParameter('mother'));
     $mother->setPob($this->getRequestParameter('mother_pob'));
     if ($this->getRequestParameter('mother_dob')) {
         $mother->setDob($this->getRequestParameter('mother_dob'));
     }
     $mother->setReligionId($this->getRequestParameter('religion_mother'));
     $mother->setCountryId($this->getRequestParameter('mother_country'));
     $mother->setDegreeId($this->getRequestParameter('degree_mother'));
     $mother->setJob($this->getRequestParameter('mother_job'));
     $mother->setNoteDetail($this->getRequestParameter('mother_notedetail'));
     $mother->setMonthlyRevenue($this->getRequestParameter('mother_revenue'));
     $mother->setOfficePhone($this->getRequestParameter('mother_officephone'));
     $mother->setEmail($this->getRequestParameter('mother_email'));
     $mother->setAddress($this->getRequestParameter('mother_address'));
     $mother->setCellphone($this->getRequestParameter('mother_cellphone'));
     $mother->save();
     return $this->redirect('counseling_sd/listStudent?accal_id=' . $academic_calendar->getId() . '&counseling_id=' . $counseling->getId());
 }
Ejemplo n.º 4
0
 public function filter($c, $filters)
 {
     $filters_key = array_keys($filters);
     foreach ($filters_key as $key) {
         $value = $filters[$key];
         if ($value == '' || $value == null) {
             continue;
         }
         if ($key == 'DEPARTMENT_ID') {
             $c->addJoin(AcademicCalendarPeer::ID, StudentPeer::ACADEMIC_CALENDAR_ID);
             $c->addJoin(DepartmentPeer::ID, AcademicCalendarPeer::DEPARTMENT_ID);
             $column = DepartmentPeer::getTableMap()->getColumn('ID');
         } elseif ($key == 'PAYER_TYPE_ID') {
             $c->addJoin(StudentTypePeer::STUDENT_ID, StudentPeer::ID);
             $c->addJoin(PayerTypePeer::ID, StudentTypePeer::PAYER_TYPE_ID);
             $column = PayerTypePeer::getTableMap()->getColumn('ID');
         } elseif ($key == 'CLASS_NAME') {
             $c->addJoin(ClassGroupPeer::ID, StudentPeer::CLASS_GROUP_ID);
             $column = ClassGroupPeer::getTableMap()->getColumn('NAME');
         } elseif ($key == 'JOB_TITLE') {
             $c->addJoin(StudentDetailPeer::ID, StudentPeer::STUDENT_DETAIL_ID);
             $column = StudentDetailPeer::getTableMap()->getColumn('JOB_TITLE');
         } else {
             $column = StudentPeer::getTableMap()->getColumn($key);
         }
         $name = $column->getFullyQualifiedName();
         $creoleType = $column->getCreoleType();
         if ($creoleType == CreoleTypes::TIMESTAMP) {
             $from = $value['from'];
             $to = $value['to'];
             if ($from != '' && $from != null) {
                 $c->add($name, $from, Criteria::GREATER_EQUAL);
             }
             if ($to != '' && $to != null) {
                 $c->add($name, $to, Criteria::LESS_EQUAL);
             }
         } else {
             if ($creoleType == CreoleTypes::INTEGER) {
                 if ($name == StudentPeer::CLASS_GROUP_ID) {
                     $cg = ClassGroupPeer::retrieveByPK($value);
                     $c->add($name, $cg->getChildRecurs(), Criteria::IN);
                 } elseif ($name == PayerTypePeer::ID) {
                     $pt = PayerTypePeer::retrieveByPK($value);
                     $c->add($name, $pt->getChildRecurs(), Criteria::IN);
                 } else {
                     $c->add($name, $value, Criteria::EQUAL);
                 }
             } else {
                 if ($creoleType == CreoleTypes::VARCHAR || $creoleType == CreoleTypes::CHAR) {
                     $c->add($name, "%{$value}%", Criteria::LIKE);
                 }
             }
         }
     }
 }
Ejemplo n.º 5
0
 public function getStudentDetailsJoinCountry($criteria = null, $con = null)
 {
     include_once 'lib/model/om/BaseStudentDetailPeer.php';
     if ($criteria === null) {
         $criteria = new Criteria();
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     if ($this->collStudentDetails === null) {
         if ($this->isNew()) {
             $this->collStudentDetails = array();
         } else {
             $criteria->add(StudentDetailPeer::REGION_ID, $this->getId());
             $this->collStudentDetails = StudentDetailPeer::doSelectJoinCountry($criteria, $con);
         }
     } else {
         $criteria->add(StudentDetailPeer::REGION_ID, $this->getId());
         if (!isset($this->lastStudentDetailCriteria) || !$this->lastStudentDetailCriteria->equals($criteria)) {
             $this->collStudentDetails = StudentDetailPeer::doSelectJoinCountry($criteria, $con);
         }
     }
     $this->lastStudentDetailCriteria = $criteria;
     return $this->collStudentDetails;
 }
Ejemplo n.º 6
0
</td>
                        <td align="left"><?php 
        echo $student->getAcademicCalendarId() ? $student->getAcademicCalendar()->toString() : '-';
        ?>
</td>
                        <td><?php 
        echo $student->getClassGroupId() ? $student->getClassGroup()->toString() : '-';
        ?>
</td>
                        <td><?php 
        echo $student->getClassName() ? $student->getClassName() : '-';
        ?>
</td>
                        <td align="left">
                            <?php 
        $student_detail = StudentDetailPeer::retrieveByPK($student->getStudentDetailId());
        echo $student_detail ? $student_detail->getCellphone() ? $student_detail->getCellphone() : '-' : '-';
        ?>
                        </td>
                        <td align="left"><?php 
        echo $student_detail ? $student_detail->getShortName() ? $student_detail->getShortName() : '-' : '-';
        ?>
</td>
                        <td align="left">
							<?php 
        if ($student_detail) {
            if ($student_detail->getSex() == 'L') {
                echo __('Laki-laki');
            } elseif ($student_detail->getSex() == 'P') {
                echo __('Perempuan');
            }
Ejemplo n.º 7
0
 public function executeUpdateParent()
 {
     $i18n = new sfI18N();
     $i18n->initialize($this->getContext());
     $i18n->setCulture($this->getUser()->getCulture());
     $action_i18n = $i18n->globalMessageFormat->format('save as new');
     $action_type = $this->getRequestParameter('action_type');
     $student = StudentPeer::retrieveByPk($this->getRequestParameter('id'));
     $this->forward404Unless($student);
     $student_detail = StudentDetailPeer::retrieveByPk($this->getRequestParameter('student_detail_id'));
     $this->forward404Unless($student_detail);
     $c = new Criteria();
     $c->add(StudentParentsPeer::STUDENT_ID, $student->getId());
     $c->add(StudentParentsPeer::RELATION, StudentParents::RELATION_FATHER);
     $father = StudentParentsPeer::doSelectOne($c);
     if ($father == null) {
         $father = new StudentParents();
     }
     $father->setRelation(StudentParents::RELATION_FATHER);
     $father->setStudentId($student->getId());
     $father->setName($this->getRequestParameter('father_name'));
     $father->setPob($this->getRequestParameter('father_pob'));
     if ($this->getRequestParameter('father_dob')) {
         $father->setDob($this->getRequestParameter('father_dob'));
     }
     $father->setJob($this->getRequestParameter('father_job_note'));
     $father->setDegreeId($this->getRequestParameter('father_degree'));
     $father->setMonthlyRevenue($this->getRequestParameter('father_revenue'));
     $father->setAddress($this->getRequestParameter('father_address'));
     $father->setPostCode($this->getRequestParameter('father_postcode'));
     $father->setHomePhone($this->getRequestParameter('father_homephone'));
     $father->save();
     $ct = new Criteria();
     $ct->add(StudentParentsPeer::STUDENT_ID, $student->getId());
     $ct->add(StudentParentsPeer::RELATION, StudentParents::RELATION_MOTHER);
     $mother = StudentParentsPeer::doSelectOne($ct);
     if ($mother == null) {
         $mother = new StudentParents();
     }
     $mother->setRelation(StudentParents::RELATION_MOTHER);
     $mother->setStudentId($student->getId());
     $mother->setName($this->getRequestParameter('mother_name'));
     $mother->setPob($this->getRequestParameter('mother_pob'));
     if ($this->getRequestParameter('mother_dob')) {
         $mother->setDob($this->getRequestParameter('mother_dob'));
     }
     $mother->setJob($this->getRequestParameter('mother_job_note'));
     $mother->setDegreeId($this->getRequestParameter('mother_degree'));
     $mother->setMonthlyRevenue($this->getRequestParameter('mother_revenue'));
     $mother->setAddress($this->getRequestParameter('mother_address'));
     $mother->setPostCode($this->getRequestParameter('mother_postcode'));
     $mother->setHomePhone($this->getRequestParameter('mother_homephone'));
     $mother->save();
     $cr = new Criteria();
     $cr->add(StudentParentsPeer::STUDENT_ID, $student->getId());
     $cr->add(StudentParentsPeer::RELATION, StudentParents::RELATION_GUARDIAN);
     $guardian = StudentParentsPeer::doSelectOne($cr);
     if ($guardian == null) {
         $guardian = new StudentParents();
     }
     $guardian->setRelation(StudentParents::RELATION_GUARDIAN);
     $guardian->setStudentId($student->getId());
     $guardian->setName($this->getRequestParameter('guardian_name'));
     $guardian->setPob($this->getRequestParameter('guardian_pob'));
     if ($this->getRequestParameter('guardian_dob')) {
         $guardian->setDob($this->getRequestParameter('guardian_dob'));
     }
     $guardian->setJob($this->getRequestParameter('guardian_job_note'));
     $guardian->setDegreeId($this->getRequestParameter('guardian_degree'));
     $guardian->setMonthlyRevenue($this->getRequestParameter('guardian_revenue'));
     $guardian->setAddress($this->getRequestParameter('guardian_address'));
     $guardian->setPostCode($this->getRequestParameter('guardian_postcode'));
     $guardian->setHomePhone($this->getRequestParameter('guardian_homephone'));
     $guardian->save();
     $student_detail->setFather($father->getName());
     $student_detail->setMother($mother->getName());
     $student_detail->setFatherJob($this->getRequestParameter('father_job'));
     $student_detail->setMotherJob($this->getRequestParameter('mother_job'));
     $student_detail->setDetailFatherJob($this->getRequestParameter('detail_father_job'));
     $student_detail->setDetailMotherJob($this->getRequestParameter('detail_mother_job'));
     $student_detail->save();
     return $this->redirect('scholar/listPhysical?id=' . $student->getId());
 }
Ejemplo n.º 8
0
        ?>
</td>
							<td><?php 
        echo $student->getName() ? $student->getName() : '-';
        ?>
</td>
							<td><?php 
        echo $student->getAcademicCalendar() ? $student->getAcademicCalendar()->toString() : '-';
        ?>
</td>
                            <td><?php 
        echo $student->getClassGroup() ? $student->getClassGroup()->toString() : '-';
        ?>
</td>
							<td><?php 
        echo $student->getStudentDetailId() ? StudentDetailPeer::retrieveByPK($student->getStudentDetailId())->getJobTitle() ? StudentDetailPeer::retrieveByPK($student->getStudentDetailId())->getJobTitle() : '-' : '-';
        ?>
</td>
                            <td><?php 
        $c = new Criteria();
        $c->add(StudentTypePeer::STUDENT_ID, $student->getId());
        $stu_type = StudentTypePeer::doSelectOne($c);
        if ($stu_type) {
            if ($stu_type->getPayerTypeId() != null) {
                if ($stu_type->getPayerType()->getParent() == 7) {
                    echo "<font class='level_blue'>" . $stu_type->getPayerType()->getParentName() . ' - ' . $stu_type->getPayerType()->getDescription() . "</font>";
                } elseif ($stu_type->getPayerType()->getParent() == 8) {
                    echo "<font class='level_green'>" . $stu_type->getPayerType()->getParentName() . ' - ' . $stu_type->getPayerType()->getDescription() . "</font>";
                } else {
                    echo "<font class='level_green'>" . $stu_type->getPayerType()->getParentName() . ' - ' . $stu_type->getPayerType()->getDescription() . "</font>";
                }
Ejemplo n.º 9
0
 public static function retrieveByPKs($pks, $con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(self::DATABASE_NAME);
     }
     $objs = null;
     if (empty($pks)) {
         $objs = array();
     } else {
         $criteria = new Criteria();
         $criteria->add(StudentDetailPeer::ID, $pks, Criteria::IN);
         $objs = StudentDetailPeer::doSelect($criteria, $con);
     }
     return $objs;
 }
Ejemplo n.º 10
0
 public function executeUpdateStudent()
 {
     $i18n = new sfI18N();
     $i18n->initialize($this->getContext());
     $i18n->setCulture($this->getUser()->getCulture());
     $action_i18n = $i18n->globalMessageFormat->format('save as new');
     $action_type = $this->getRequestParameter('action_type');
     $counseling_id = $this->getRequestParameter('counseling_id');
     $counseling = CounselingPeer::retrieveByPK($counseling_id);
     $this->forward404Unless($counseling);
     $accal_id = $this->getRequestParameter('accal_id');
     $academic_calendar = AcademicCalendarPeer::retrieveByPK($accal_id);
     $this->forward404Unless($academic_calendar);
     // add/update student_detail
     if ($action_type == $action_i18n || !$this->getRequestParameter('student_detail_id')) {
         $student_detail = new StudentDetail();
     } else {
         $student_detail = StudentDetailPeer::retrieveByPk($this->getRequestParameter('student_detail_id'));
         $this->forward404Unless($student_detail);
     }
     $student_detail->setId($this->getRequestParameter('student_detail_id'));
     $student_detail->setShortName($this->getRequestParameter('short_name'));
     $student_detail->setPob($this->getRequestParameter('pob'));
     if ($this->getRequestParameter('dob')) {
         $student_detail->setDob($this->getRequestParameter('dob'));
     }
     $student_detail->setSex($this->getRequestParameter('sex'));
     $student_detail->setReligionId($this->getRequestParameter('religion_id'));
     $student_detail->setCountryId($this->getRequestParameter('country_id'));
     $student_detail->setNativeLanguage($this->getRequestParameter('native_language'));
     $student_detail->setFather($this->getRequestParameter('father'));
     $student_detail->setMother($this->getRequestParameter('mother'));
     $student_detail->setFatherJob($this->getRequestParameter('father_job'));
     $student_detail->setMotherJob($this->getRequestParameter('mother_job'));
     $student_detail->setDetailFatherJob($this->getRequestParameter('detail_father_job'));
     $student_detail->setDetailMotherJob($this->getRequestParameter('detail_mother_job'));
     $student_detail->setAddress($this->getRequestParameter('address'));
     $student_detail->setPostCode($this->getRequestParameter('post_code'));
     $student_detail->setRegionId($this->getRequestParameter('region_id'));
     $student_detail->setPhone($this->getRequestParameter('phone'));
     $student_detail->setCellphone($this->getRequestParameter('cellphone'));
     $student_detail->setCompany($this->getRequestParameter('company'));
     $student_detail->setParentName($this->getRequestParameter('father'));
     $student_detail->setJobTitle($this->getRequestParameter('job_title'));
     $student_detail->setSchoolOfOrigin($this->getRequestParameter('school_of_origin'));
     $student_detail->setSchoolOfOriginAddress($this->getRequestParameter('school_of_origin_address'));
     $student_detail->setRegNote($this->getRequestParameter('reg_note'));
     $student_detail->setChildNumber($this->getRequestParameter('child_number'));
     $student_detail->setBloodSiblings($this->getRequestParameter('blood_siblings'));
     $student_detail->setStepSiblings($this->getRequestParameter('step_siblings'));
     $student_detail->setOrphanageStatus($this->getRequestParameter('orphanage_status'));
     $student_detail->setResidenceStatus($this->getRequestParameter('residence_status'));
     $student_detail->setHomeDistance($this->getRequestParameter('home_distance'));
     $student_detail->setTransport($this->getRequestParameter('transport'));
     $student_detail->setAcademicCalendarId($this->getRequestParameter('department2'));
     $student_detail->setIllness($this->getRequestParameter('illness'));
     $student_detail->setIllnessNote($this->getRequestParameter('illness_note'));
     $student_detail->setGraduationGrade($this->getRequestParameter('graduation_grade'));
     $student_detail->setGraduationYear($this->getRequestParameter('graduation_year'));
     $student_detail->setBloodType($this->getRequestParameter('blood_type'));
     $student_detail->setTall($this->getRequestParameter('tall'));
     $student_detail->setDepartmentOfOrigin($this->getRequestParameter('department_of_origin'));
     $student_detail->setWeight($this->getRequestParameter('weight'));
     $student_detail->save();
     if ($action_type == $action_i18n || !$this->getRequestParameter('id')) {
         $student = new Student();
     } else {
         $student = StudentPeer::retrieveByPk($this->getRequestParameter('id'));
         $this->forward404Unless($student);
     }
     $student->setId($this->getRequestParameter('id'));
     $student->setCode($this->getRequestParameter('code'));
     $student->setCode2($this->getRequestParameter('code2'));
     $student->setCode3($this->getRequestParameter('code3'));
     $student->setName($this->getRequestParameter('name'));
     $student->setClassName($this->getRequestParameter('class_name'));
     $student->setAcademicCalendarId($this->getRequestParameter('academic_calendar_id'));
     $student->setCurriculumId($this->getRequestParameter('curriculum_id'));
     $student->setClassGroupId($this->getRequestParameter('class_group_id'));
     $student->setStatus($this->getRequestParameter('status'));
     $student->setStudentDetail($student_detail);
     if ($this->getRequestParameter('password') != null && strlen($this->getRequestParameter('password')) > 0) {
         // password set
         $crypted = sha1(sfConfig::get('app_salt') . $this->getRequestParameter('password'));
         if ($student->getPassword() != $crypted && strlen($this->getRequestParameter('password')) > 0) {
             // password changed
             $student->setPassword($crypted);
         }
     } elseif ($student->getPassword() == null || $student->getPassword() == '') {
         // create
         $crypted = sha1(sfConfig::get('app_salt') . $student_detail->getDob('dmY'));
         $student->setPassword($crypted);
     }
     $student->save();
     if ($student->getStatus() == Student::STATUS_GRADUATE) {
         $student->setGraduationDate(date('Y/m/d'));
         $student->save();
     }
     // save photo
     $photo_dir = sfConfig::get('sf_data_dir') . DIRECTORY_SEPARATOR . 'photos' . DIRECTORY_SEPARATOR;
     if ($this->hasRequestParameter('photoFile') && $this->getRequestParameter('photoFile') != '' && $this->getRequestParameter('photoFile') != null) {
         // get photo content
         $photo_file = $photo_dir . 'tmp' . DIRECTORY_SEPARATOR . $this->getRequestParameter('photoFile');
         $content = file_get_contents($photo_file);
         $im = imagecreatefromstring($content);
         list($w, $h) = getimagesize($photo_file);
         // generate photo
         $photo = imagecreatetruecolor(150, 195);
         imagecopyresized($photo, $im, 0, 0, 0, 0, 150, 195, $w, $h);
         // generate thumbnail
         $thumb = imagecreatetruecolor(100, 130);
         imagecopyresized($thumb, $im, 0, 0, 0, 0, 100, 130, $w, $h);
         // get photo record
         $c = new Criteria();
         $c->add(StudentPhotoPeer::STUDENT_ID, $student->getId());
         $student_photo = StudentPhotoPeer::doSelectOne($c);
         if ($student_photo == null) {
             $student_photo = new StudentPhoto();
             $student_photo->setStudent($student);
         }
         // save photo
         imagepng($photo, $photo_file);
         $student_photo->setPhoto(base64_encode(file_get_contents($photo_file)));
         imagepng($thumb, $photo_file);
         $student_photo->setThumbnail(base64_encode(file_get_contents($photo_file)));
         $student_photo->save();
         unlink($photo_dir . 'tmp' . DIRECTORY_SEPARATOR . $this->getRequestParameter('photoFile'));
     }
     if ($student_detail->getDetailFatherJob() == 1) {
         $father_job = 'Guru / Pengajar / Karyawan AlAzhar';
     } elseif ($student_detail->getDetailFatherJob() == 2) {
         $father_job = 'Guru / Pengajar Non ALAzhar';
     } elseif ($student_detail->getDetailFatherJob() == 3) {
         $father_job = 'Pegawai Swasta';
     } elseif ($student_detail->getDetailFatherJob() == 4) {
         $father_job = 'Pegawai Negeri Sipil';
     } elseif ($student_detail->getDetailFatherJob() == 5) {
         $father_job = 'Wiraswasta';
     } elseif ($student_detail->getDetailFatherJob() == 6) {
         $father_job = 'Tidak Bekerja';
     } else {
         $father_job = '';
     }
     if ($student_detail->getDetailMotherJob() == 1) {
         $mother_job = 'Guru / Pengajar / Karyawan AlAzhar';
     } elseif ($student_detail->getDetailMotherJob() == 2) {
         $mother_job = 'Guru / Pengajar Non ALAzhar';
     } elseif ($student_detail->getDetailMotherJob() == 3) {
         $mother_job = 'Pegawai Swasta';
     } elseif ($student_detail->getDetailMotherJob() == 4) {
         $mother_job = 'Pegawai Negeri Sipil';
     } elseif ($student_detail->getDetailMotherJob() == 5) {
         $mother_job = 'Wiraswasta';
     } elseif ($student_detail->getDetailMotherJob() == 6) {
         $mother_job = 'Tidak Bekerja';
     } else {
         $mother_job = '';
     }
     #Data Orang Tua (Ayah)
     $student_father = StudentParentsPeer::retrieveByPk($this->getRequestParameter('father_id'));
     $this->forward404Unless($student_father);
     $student_father->setId($this->getRequestParameter('father_id'));
     $student_father->setName($this->getRequestParameter('father'));
     $student_father->setStudent($student);
     $student_father->setPob($this->getRequestParameter('father_pob'));
     if ($this->getRequestParameter('father_dob')) {
         $student_father->setDob($this->getRequestParameter('father_dob'));
     }
     $student_father->setReligionId($this->getRequestParameter('religion_father'));
     $student_father->setDegreeId($this->getRequestParameter('degree_father'));
     $student_father->setJob($father_job);
     $student_father->setAddress($this->getRequestParameter('father_address'));
     $student_father->setOfficePhone($this->getRequestParameter('father_office_phone'));
     $student_father->setPostCode($this->getRequestParameter('post_code'));
     $student_father->setRegionId($this->getRequestParameter('region_id'));
     $student_father->setHomePhone($this->getRequestParameter('home_phone'));
     $student_father->setCellphone($this->getRequestParameter('father_cellphone'));
     $student_father->setCountryId($this->getRequestParameter('father_country'));
     $student_father->setMonthlyRevenue($this->getRequestParameter('father_revenue'));
     $student_father->setEmail($this->getRequestParameter('father_email'));
     $student_father->setNote($this->getRequestParameter('father_note'));
     $student_father->setNoteDetail($this->getRequestParameter('father_note_detail'));
     if ($this->getRequestParameter('father_date_note')) {
         $student_father->setNoteDate($this->getRequestParameter('father_date_note'));
     }
     $student_father->setRelation(StudentParents::RELATION_FATHER);
     $student_father->save();
     #Data Orang Tua (Ibu)
     $student_mother = StudentParentsPeer::retrieveByPk($this->getRequestParameter('mother_id'));
     $this->forward404Unless($student_mother);
     $student_mother->setId($this->getRequestParameter('mother_id'));
     $student_mother->setName($this->getRequestParameter('mother'));
     $student_mother->setStudent($student);
     if ($this->getRequestParameter('mother_dob')) {
         $student_mother->setDob($this->getRequestParameter('mother_dob'));
     }
     $student_mother->setPob($this->getRequestParameter('mother_pob'));
     $student_mother->setReligionId($this->getRequestParameter('religion_mother'));
     $student_mother->setDegreeId($this->getRequestParameter('degree_mother'));
     $student_mother->setJob($mother_job);
     $student_mother->setAddress($this->getRequestParameter('mother_address'));
     $student_mother->setOfficePhone($this->getRequestParameter('mother_office_phone'));
     $student_mother->setPostCode($this->getRequestParameter('post_code'));
     $student_mother->setRegionId($this->getRequestParameter('region_id'));
     $student_mother->setHomePhone($this->getRequestParameter('home_phone'));
     $student_mother->setCellphone($this->getRequestParameter('mother_cellphone'));
     $student_mother->setCountryId($this->getRequestParameter('mother_country'));
     $student_mother->setMonthlyRevenue($this->getRequestParameter('mother_revenue'));
     $student_mother->setEmail($this->getRequestParameter('mother_email'));
     $student_mother->setNote($this->getRequestParameter('mother_note'));
     $student_mother->setNoteDetail($this->getRequestParameter('mother_note_detail'));
     if ($this->getRequestParameter('mother_date_note')) {
         $student_mother->setNoteDate($this->getRequestParameter('mother_date_note'));
     }
     $student_mother->setRelation(StudentParents::RELATION_MOTHER);
     $student_mother->save();
     return $this->redirect('counseling/listStudentByEmployee?accal_id=' . $academic_calendar->getId() . '&counseling_id=' . $counseling->getId());
 }
Ejemplo n.º 11
0
 public function executeUpdateStudent()
 {
     $i18n = new sfI18N();
     $i18n->initialize($this->getContext());
     $i18n->setCulture($this->getUser()->getCulture());
     $action_i18n = $i18n->globalMessageFormat->format('save as new');
     $action_type = $this->getRequestParameter('action_type');
     // add/update member_detail
     if ($action_type == $action_i18n || !$this->getRequestParameter('member_detail_id')) {
         $member_detail = new MemberDetail();
     } else {
         $member_detail = MemberDetailPeer::retrieveByPk($this->getRequestParameter('member_detail_id'));
         $this->forward404Unless($member_detail);
     }
     $member_detail->setId($this->getRequestParameter('member_detail_id'));
     $member_detail->setPob($this->getRequestParameter('pob'));
     if ($this->getRequestParameter('dob')) {
         $member_detail->setDob($this->getRequestParameter('dob'));
     }
     $member_detail->setSex($this->getRequestParameter('sex'));
     $member_detail->setAddress($this->getRequestParameter('address'));
     $member_detail->setRegionId($this->getRequestParameter('region_id'));
     $member_detail->setPostCode($this->getRequestParameter('post_code'));
     $member_detail->setPhone($this->getRequestParameter('phone'));
     $member_detail->setCellphone($this->getRequestParameter('cellphone'));
     $member_detail->setReligionId($this->getRequestParameter('religion_id'));
     $member_detail->setSchoolOfOrigin($this->getRequestParameter('school_of_origin'));
     $member_detail->setGraduationYear($this->getRequestParameter('graduation_year'));
     $member_detail->setGraduationGrade($this->getRequestParameter('graduation_grade'));
     $member_detail->setCompany($this->getRequestParameter('company'));
     $member_detail->setJobTitle($this->getRequestParameter('job_title'));
     $member_detail->setCollegeOfOrigin($this->getRequestParameter('college_of_origin'));
     $member_detail->setDepartmentOfOrigin($this->getRequestParameter('department_of_origin'));
     $member_detail->setRegYear($this->getRequestParameter('reg_year'));
     $member_detail->setParentName($this->getRequestParameter('parent_name'));
     $member_detail->save();
     // add student detail
     if ($action_type == $action_i18n || !$this->getRequestParameter('student_detail_id')) {
         $student_detail = new StudentDetail();
     } else {
         $student_detail = StudentDetailPeer::retrieveByPk($this->getRequestParameter('student_detail_id'));
         $this->forward404Unless($student_detail);
     }
     $student_detail->setId($this->getRequestParameter('student_detail_id'));
     $student_detail->setPob($this->getRequestParameter('pob'));
     if ($this->getRequestParameter('dob')) {
         $student_detail->setDob($this->getRequestParameter('dob'));
     }
     $student_detail->setSex($this->getRequestParameter('sex'));
     $student_detail->setAddress($this->getRequestParameter('address'));
     $student_detail->setRegionId($this->getRequestParameter('region_id'));
     $student_detail->setPostCode($this->getRequestParameter('post_code'));
     $student_detail->setPhone($this->getRequestParameter('phone'));
     $student_detail->setCellphone($this->getRequestParameter('cellphone'));
     $student_detail->setReligionId($this->getRequestParameter('religion_id'));
     $student_detail->setSchoolOfOrigin($this->getRequestParameter('school_of_origin'));
     $student_detail->setGraduationYear($this->getRequestParameter('graduation_year'));
     $student_detail->setGraduationGrade($this->getRequestParameter('graduation_grade'));
     $student_detail->setCompany($this->getRequestParameter('company'));
     $student_detail->setJobTitle($this->getRequestParameter('job_title'));
     $student_detail->setCollegeOfOrigin($this->getRequestParameter('college_of_origin'));
     $student_detail->setDepartmentOfOrigin($this->getRequestParameter('department_of_origin'));
     $student_detail->setRegYear($this->getRequestParameter('reg_year'));
     $student_detail->setParentName($this->getRequestParameter('parent_name'));
     $student_detail->save();
     if ($action_type == $action_i18n || !$this->getRequestParameter('id')) {
         $member = new Member();
     } else {
         $member = MemberPeer::retrieveByPk($this->getRequestParameter('id'));
         $this->forward404Unless($member);
     }
     $member->setId($this->getRequestParameter('id'));
     $member->setCode($this->getRequestParameter('code'));
     $member->setNoReg($this->getRequestParameter('no_reg'));
     $member->setName($this->getRequestParameter('name'));
     $member->setClassName($this->getRequestParameter('class_name'));
     $member->setDepartmentId($this->getRequestParameter('department_id'));
     $old_status = $member->getStatus();
     $member->setStatus($this->getRequestParameter('status'));
     $member->setType('1');
     $member->setMemberDetail($member_detail);
     if ($this->getRequestParameter('password') != null && strlen($this->getRequestParameter('password')) > 0) {
         // password set
         $crypted = sha1(sfConfig::get('app_salt') . $this->getRequestParameter('password'));
         if ($member->getPassword() != $crypted && strlen($this->getRequestParameter('password')) > 0) {
             // password changed
             $member->setPassword($crypted);
         }
     } elseif ($member->getPassword() == null || $member->getPassword() == '') {
         // create
         $crypted = sha1(sfConfig::get('app_salt') . $this->getRequestParameter('code') . $member_detail->getDob('dm'));
         $member->setPassword($crypted);
     }
     $member->save();
     if ($action_type == $action_i18n || !$this->getRequestParameter('student_id')) {
         $student = new Student();
     } else {
         $student = StudentPeer::retrieveByPk($this->getRequestParameter('student_id'));
         $this->forward404Unless($student);
     }
     $student->setId($this->getRequestParameter('student_id'));
     $student->setCode($this->getRequestParameter('code'));
     $student->setName($this->getRequestParameter('name'));
     $old_status = $student->getStatus();
     $student->setMemberId($member);
     $student->setStatus($this->getRequestParameter('status'));
     $student->setStudentDetail($student_detail);
     if ($this->getRequestParameter('password') != null && strlen($this->getRequestParameter('password')) > 0) {
         // password set
         $crypted = sha1(sfConfig::get('app_salt') . $this->getRequestParameter('password'));
         if ($student->getPassword() != $crypted && strlen($this->getRequestParameter('password')) > 0) {
             // password changed
             $student->setPassword($crypted);
         }
     } elseif ($student->getPassword() == null || $student->getPassword() == '') {
         // create
         $crypted = sha1(sfConfig::get('app_salt') . $this->getRequestParameter('code') . $student_detail->getDob('dm'));
         $student->setPassword($crypted);
     }
     $student->save();
     // save member photo
     $photo_dir = sfConfig::get('sf_data_dir') . DIRECTORY_SEPARATOR . 'photos' . DIRECTORY_SEPARATOR;
     if ($this->hasRequestParameter('photoFile') && $this->getRequestParameter('photoFile') != '' && $this->getRequestParameter('photoFile') != null) {
         // get photo content
         $photo_file = $photo_dir . 'tmp' . DIRECTORY_SEPARATOR . $this->getRequestParameter('photoFile');
         $content = file_get_contents($photo_file);
         $im = imagecreatefromstring($content);
         list($w, $h) = getimagesize($photo_file);
         // generate photo
         $photo = imagecreatetruecolor(150, 200);
         imagecopyresized($photo, $im, 0, 0, 0, 0, 150, 200, $w, $h);
         // generate thumbnail
         $thumb = imagecreatetruecolor(100, 150);
         imagecopyresized($thumb, $im, 0, 0, 0, 0, 100, 150, $w, $h);
         // get photo record
         $c = new Criteria();
         $c->add(MemberPhotoPeer::MEMBER_ID, $member->getId());
         $member_photo = MemberPhotoPeer::doSelectOne($c);
         if ($member_photo == null) {
             $member_photo = new MemberPhoto();
             $member_photo->setMember($member);
         }
         // save photo
         imagepng($photo, $photo_file);
         $member_photo->setPhoto(base64_encode(file_get_contents($photo_file)));
         imagepng($thumb, $photo_file);
         $member_photo->setThumbnail(base64_encode(file_get_contents($photo_file)));
         $member_photo->save();
         unlink($photo_dir . 'tmp' . DIRECTORY_SEPARATOR . $this->getRequestParameter('photoFile'));
     }
     // save student photo
     $photo_dir = sfConfig::get('sf_data_dir') . DIRECTORY_SEPARATOR . 'photos' . DIRECTORY_SEPARATOR;
     if ($this->hasRequestParameter('photoFile') && $this->getRequestParameter('photoFile') != '' && $this->getRequestParameter('photoFile') != null) {
         // get photo content
         $photo_file = $photo_dir . 'tmp' . DIRECTORY_SEPARATOR . $this->getRequestParameter('photoFile');
         $content = file_get_contents($photo_file);
         $im = imagecreatefromstring($content);
         list($w, $h) = getimagesize($photo_file);
         // generate photo
         $photo = imagecreatetruecolor(150, 195);
         imagecopyresized($photo, $im, 0, 0, 0, 0, 150, 195, $w, $h);
         // generate thumbnail
         $thumb = imagecreatetruecolor(100, 130);
         imagecopyresized($thumb, $im, 0, 0, 0, 0, 100, 130, $w, $h);
         // get photo record
         $c = new Criteria();
         $c->add(StudentPhotoPeer::STUDENT_ID, $student->getId());
         $student_photo = StudentPhotoPeer::doSelectOne($c);
         if ($student_photo == null) {
             $student_photo = new StudentPhoto();
             $student_photo->setStudent($student);
         }
         // save photo
         imagepng($photo, $photo_file);
         $student_photo->setPhoto(base64_encode(file_get_contents($photo_file)));
         imagepng($thumb, $photo_file);
         $student_photo->setThumbnail(base64_encode(file_get_contents($photo_file)));
         $student_photo->save();
         unlink($photo_dir . 'tmp' . DIRECTORY_SEPARATOR . $this->getRequestParameter('photoFile'));
     }
     if ($this->hasRequestParameter('filter_noreg') && $this->getRequestParameter('filter_noreg') != '' && $this->getRequestParameter('filter_noreg') != null) {
         return $this->redirect('member/listStudent?filters[NO_REG]=' . $this->getRequestParameter('no_reg'));
     } elseif ($this->hasRequestParameter('filter_code') && $this->getRequestParameter('filter_code') != '' && $this->getRequestParameter('filter_code') != null) {
         return $this->redirect('member/listStudent?filters[CODE]=' . $this->getRequestParameter('filter_code'));
     } elseif ($this->hasRequestParameter('filter_deptid') && $this->getRequestParameter('filter_deptid') != '' && $this->getRequestParameter('filter_deptid') != null) {
         return $this->redirect('member/listStudent?filters[DEPARTMENT_ID]=' . $this->getRequestParameter('filter_deptid'));
     } elseif ($this->hasRequestParameter('filter_status') && $this->getRequestParameter('filter_status') != '' && $this->getRequestParameter('filter_status') != null) {
         return $this->redirect('member/listStudent?filters[STATUS]=' . $this->getRequestParameter('filter_status'));
     } elseif ($this->hasRequestParameter('filter_name') && $this->getRequestParameter('filter_name') != '' && $this->getRequestParameter('filter_name') != null) {
         return $this->redirect('member/listStudent?filters[NAME]=' . $this->getRequestParameter('name'));
     } else {
         return $this->redirect('member/listStudent');
     }
 }
Ejemplo n.º 12
0
 public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
 {
     $keys = StudentDetailPeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setId($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setShortName($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setPob($arr[$keys[2]]);
     }
     if (array_key_exists($keys[3], $arr)) {
         $this->setDob($arr[$keys[3]]);
     }
     if (array_key_exists($keys[4], $arr)) {
         $this->setSex($arr[$keys[4]]);
     }
     if (array_key_exists($keys[5], $arr)) {
         $this->setAddress($arr[$keys[5]]);
     }
     if (array_key_exists($keys[6], $arr)) {
         $this->setRegionId($arr[$keys[6]]);
     }
     if (array_key_exists($keys[7], $arr)) {
         $this->setPostCode($arr[$keys[7]]);
     }
     if (array_key_exists($keys[8], $arr)) {
         $this->setPhone($arr[$keys[8]]);
     }
     if (array_key_exists($keys[9], $arr)) {
         $this->setCellphone($arr[$keys[9]]);
     }
     if (array_key_exists($keys[10], $arr)) {
         $this->setReligionId($arr[$keys[10]]);
     }
     if (array_key_exists($keys[11], $arr)) {
         $this->setSchoolOfOrigin($arr[$keys[11]]);
     }
     if (array_key_exists($keys[12], $arr)) {
         $this->setGraduationYear($arr[$keys[12]]);
     }
     if (array_key_exists($keys[13], $arr)) {
         $this->setGraduationGrade($arr[$keys[13]]);
     }
     if (array_key_exists($keys[14], $arr)) {
         $this->setCompany($arr[$keys[14]]);
     }
     if (array_key_exists($keys[15], $arr)) {
         $this->setJobTitle($arr[$keys[15]]);
     }
     if (array_key_exists($keys[16], $arr)) {
         $this->setCollegeOfOrigin($arr[$keys[16]]);
     }
     if (array_key_exists($keys[17], $arr)) {
         $this->setDepartmentOfOrigin($arr[$keys[17]]);
     }
     if (array_key_exists($keys[18], $arr)) {
         $this->setRegYear($arr[$keys[18]]);
     }
     if (array_key_exists($keys[19], $arr)) {
         $this->setParentName($arr[$keys[19]]);
     }
     if (array_key_exists($keys[20], $arr)) {
         $this->setNationality($arr[$keys[20]]);
     }
     if (array_key_exists($keys[21], $arr)) {
         $this->setChildNumber($arr[$keys[21]]);
     }
     if (array_key_exists($keys[22], $arr)) {
         $this->setSiblings($arr[$keys[22]]);
     }
     if (array_key_exists($keys[23], $arr)) {
         $this->setBloodSiblings($arr[$keys[23]]);
     }
     if (array_key_exists($keys[24], $arr)) {
         $this->setStepSiblings($arr[$keys[24]]);
     }
     if (array_key_exists($keys[25], $arr)) {
         $this->setAdoptSiblings($arr[$keys[25]]);
     }
     if (array_key_exists($keys[26], $arr)) {
         $this->setSiblingsStatus($arr[$keys[26]]);
     }
     if (array_key_exists($keys[27], $arr)) {
         $this->setNativeLanguage($arr[$keys[27]]);
     }
     if (array_key_exists($keys[28], $arr)) {
         $this->setHomeDistance($arr[$keys[28]]);
     }
     if (array_key_exists($keys[29], $arr)) {
         $this->setResidenceStatus($arr[$keys[29]]);
     }
     if (array_key_exists($keys[30], $arr)) {
         $this->setOrphanageStatus($arr[$keys[30]]);
     }
     if (array_key_exists($keys[31], $arr)) {
         $this->setTransport($arr[$keys[31]]);
     }
     if (array_key_exists($keys[32], $arr)) {
         $this->setFather($arr[$keys[32]]);
     }
     if (array_key_exists($keys[33], $arr)) {
         $this->setMother($arr[$keys[33]]);
     }
     if (array_key_exists($keys[34], $arr)) {
         $this->setFatherJob($arr[$keys[34]]);
     }
     if (array_key_exists($keys[35], $arr)) {
         $this->setMotherJob($arr[$keys[35]]);
     }
     if (array_key_exists($keys[36], $arr)) {
         $this->setDetailFatherJob($arr[$keys[36]]);
     }
     if (array_key_exists($keys[37], $arr)) {
         $this->setDetailMotherJob($arr[$keys[37]]);
     }
     if (array_key_exists($keys[38], $arr)) {
         $this->setRegNote($arr[$keys[38]]);
     }
     if (array_key_exists($keys[39], $arr)) {
         $this->setAcademicCalendarId($arr[$keys[39]]);
     }
     if (array_key_exists($keys[40], $arr)) {
         $this->setAgeYear($arr[$keys[40]]);
     }
     if (array_key_exists($keys[41], $arr)) {
         $this->setAgeMonth($arr[$keys[41]]);
     }
     if (array_key_exists($keys[42], $arr)) {
         $this->setResidenceDetail($arr[$keys[42]]);
     }
     if (array_key_exists($keys[43], $arr)) {
         $this->setResidenceElse($arr[$keys[43]]);
     }
     if (array_key_exists($keys[44], $arr)) {
         $this->setIllness($arr[$keys[44]]);
     }
     if (array_key_exists($keys[45], $arr)) {
         $this->setIllnessNote($arr[$keys[45]]);
     }
     if (array_key_exists($keys[46], $arr)) {
         $this->setNeed($arr[$keys[46]]);
     }
     if (array_key_exists($keys[47], $arr)) {
         $this->setNeedNote($arr[$keys[47]]);
     }
     if (array_key_exists($keys[48], $arr)) {
         $this->setBloodType($arr[$keys[48]]);
     }
     if (array_key_exists($keys[49], $arr)) {
         $this->setScholarship($arr[$keys[49]]);
     }
     if (array_key_exists($keys[50], $arr)) {
         $this->setGraduationNo($arr[$keys[50]]);
     }
     if (array_key_exists($keys[51], $arr)) {
         $this->setGraduationDate($arr[$keys[51]]);
     }
     if (array_key_exists($keys[52], $arr)) {
         $this->setVillage($arr[$keys[52]]);
     }
     if (array_key_exists($keys[53], $arr)) {
         $this->setSubDistrict($arr[$keys[53]]);
     }
     if (array_key_exists($keys[54], $arr)) {
         $this->setDistrict($arr[$keys[54]]);
     }
     if (array_key_exists($keys[55], $arr)) {
         $this->setIsAlazhar($arr[$keys[55]]);
     }
     if (array_key_exists($keys[56], $arr)) {
         $this->setAcceptanceClass($arr[$keys[56]]);
     }
     if (array_key_exists($keys[57], $arr)) {
         $this->setSchoolOfOriginAddress($arr[$keys[57]]);
     }
     if (array_key_exists($keys[58], $arr)) {
         $this->setCountryId($arr[$keys[58]]);
     }
     if (array_key_exists($keys[59], $arr)) {
         $this->setTall($arr[$keys[59]]);
     }
     if (array_key_exists($keys[60], $arr)) {
         $this->setWeight($arr[$keys[60]]);
     }
     if (array_key_exists($keys[61], $arr)) {
         $this->setIntelligency($arr[$keys[61]]);
     }
     if (array_key_exists($keys[62], $arr)) {
         $this->setTestDate($arr[$keys[62]]);
     }
 }
Ejemplo n.º 13
0
 protected static function doOnDeleteCascade(Criteria $criteria, Connection $con)
 {
     $affectedRows = 0;
     $objects = SchoolPeer::doSelect($criteria, $con);
     foreach ($objects as $obj) {
         include_once 'lib/model/StudentDetail.php';
         $c = new Criteria();
         $c->add(StudentDetailPeer::SCHOOL_OF_ORIGIN, $obj->getId());
         $affectedRows += StudentDetailPeer::doDelete($c, $con);
         include_once 'lib/model/TestApplicantDetail.php';
         $c = new Criteria();
         $c->add(TestApplicantDetailPeer::SCHOOL_OF_ORIGIN, $obj->getId());
         $affectedRows += TestApplicantDetailPeer::doDelete($c, $con);
     }
     return $affectedRows;
 }
Ejemplo n.º 14
0
 public function executeUpdate()
 {
     $student_detail = StudentDetailPeer::retrieveByPk($this->getRequestParameter('student_detail_id'));
     $student_detail->setId($this->getRequestParameter('student_detail_id'));
     $student_detail->setShortName($this->getRequestParameter('short_name'));
     $student_detail->setPob($this->getRequestParameter('pob'));
     if ($this->getRequestParameter('dob')) {
         $student_detail->setDob($this->getRequestParameter('dob'));
     }
     $student_detail->setSex($this->getRequestParameter('sex'));
     $student_detail->setReligionId($this->getRequestParameter('religion_id'));
     $student_detail->setCountryId($this->getRequestParameter('country_id'));
     $student_detail->setNativeLanguage($this->getRequestParameter('native_language'));
     $student_detail->setFather($this->getRequestParameter('father'));
     $student_detail->setMother($this->getRequestParameter('mother'));
     $student_detail->setFatherJob($this->getRequestParameter('father_job'));
     $student_detail->setMotherJob($this->getRequestParameter('mother_job'));
     $student_detail->setDetailFatherJob($this->getRequestParameter('detail_father_job'));
     $student_detail->setDetailMotherJob($this->getRequestParameter('detail_mother_job'));
     $student_detail->setAddress($this->getRequestParameter('address'));
     $student_detail->setPostCode($this->getRequestParameter('post_code'));
     $student_detail->setRegionId($this->getRequestParameter('region_id'));
     $student_detail->setPhone($this->getRequestParameter('phone'));
     $student_detail->setCellphone($this->getRequestParameter('cellphone'));
     $student_detail->setCompany($this->getRequestParameter('company'));
     $student_detail->setParentName($this->getRequestParameter('father'));
     $student_detail->setJobTitle($this->getRequestParameter('job_title'));
     $student_detail->setSchoolOfOrigin($this->getRequestParameter('school_of_origin'));
     $student_detail->setSchoolOfOriginAddress($this->getRequestParameter('school_of_origin_address'));
     $student_detail->setRegNote($this->getRequestParameter('reg_note'));
     $student_detail->setChildNumber($this->getRequestParameter('child_number'));
     $student_detail->setBloodSiblings($this->getRequestParameter('blood_siblings'));
     $student_detail->setStepSiblings($this->getRequestParameter('step_siblings'));
     $student_detail->setOrphanageStatus($this->getRequestParameter('orphanage_status'));
     $student_detail->setResidenceStatus($this->getRequestParameter('residence_status'));
     $student_detail->setHomeDistance($this->getRequestParameter('home_distance'));
     $student_detail->setTransport($this->getRequestParameter('transport'));
     $student_detail->setAcademicCalendarId($this->getRequestParameter('department2'));
     $student_detail->setIllness($this->getRequestParameter('illness'));
     $student_detail->setIllnessNote($this->getRequestParameter('illness_note'));
     $student_detail->setGraduationGrade($this->getRequestParameter('graduation_grade'));
     $student_detail->setGraduationYear($this->getRequestParameter('graduation_year'));
     $student_detail->setBloodType($this->getRequestParameter('blood_type'));
     $student_detail->setTall($this->getRequestParameter('tall'));
     $student_detail->setDepartmentOfOrigin($this->getRequestParameter('department_of_origin'));
     $student_detail->setWeight($this->getRequestParameter('weight'));
     $student_detail->save();
     $student = StudentPeer::retrieveByPk($this->getRequestParameter('id'));
     $this->forward404Unless($student);
     $student->setId($this->getRequestParameter('id'));
     $student->setCode($this->getRequestParameter('code'));
     $student->setCode2($this->getRequestParameter('code2'));
     $student->setCode3($this->getRequestParameter('code3'));
     $student->setName($this->getRequestParameter('name'));
     $student->setClassName($this->getRequestParameter('class_name'));
     $student->setAcademicCalendarId($this->getRequestParameter('academic_calendar_id'));
     $student->setCurriculumId($this->getRequestParameter('curriculum_id'));
     $student->setClassGroupId($this->getRequestParameter('class_group_id'));
     $student->setStatus($this->getRequestParameter('status'));
     $student->setStudentDetail($student_detail);
     if ($this->getRequestParameter('password') != null && strlen($this->getRequestParameter('password')) > 0) {
         // password set
         $crypted = sha1(sfConfig::get('app_salt') . $this->getRequestParameter('password'));
         if ($student->getPassword() != $crypted && strlen($this->getRequestParameter('password')) > 0) {
             // password changed
             $student->setPassword($crypted);
         }
     } elseif ($student->getPassword() == null || $student->getPassword() == '') {
         // create
         $crypted = sha1(sfConfig::get('app_salt') . $student_detail->getDob('dmY'));
         $student->setPassword($crypted);
     }
     $student->save();
     if ($student_detail->getDetailFatherJob() == 1) {
         $father_job = 'Guru / Pengajar / Karyawan AlAzhar';
     } elseif ($student_detail->getDetailFatherJob() == 2) {
         $father_job = 'Guru / Pengajar Non ALAzhar';
     } elseif ($student_detail->getDetailFatherJob() == 3) {
         $father_job = 'Pegawai Swasta';
     } elseif ($student_detail->getDetailFatherJob() == 4) {
         $father_job = 'Pegawai Negeri Sipil';
     } elseif ($student_detail->getDetailFatherJob() == 5) {
         $father_job = 'Wiraswasta';
     } elseif ($student_detail->getDetailFatherJob() == 6) {
         $father_job = 'Tidak Bekerja';
     } else {
         $father_job = '';
     }
     if ($student_detail->getDetailMotherJob() == 1) {
         $mother_job = 'Guru / Pengajar / Karyawan AlAzhar';
     } elseif ($student_detail->getDetailMotherJob() == 2) {
         $mother_job = 'Guru / Pengajar Non ALAzhar';
     } elseif ($student_detail->getDetailMotherJob() == 3) {
         $mother_job = 'Pegawai Swasta';
     } elseif ($student_detail->getDetailMotherJob() == 4) {
         $mother_job = 'Pegawai Negeri Sipil';
     } elseif ($student_detail->getDetailMotherJob() == 5) {
         $mother_job = 'Wiraswasta';
     } elseif ($student_detail->getDetailMotherJob() == 6) {
         $mother_job = 'Tidak Bekerja';
     } else {
         $mother_job = '';
     }
     #Data Orang Tua (Ayah)
     $student_father = StudentParentsPeer::retrieveByPk($this->getRequestParameter('father_id'));
     $this->forward404Unless($student_father);
     $student_father->setId($this->getRequestParameter('father_id'));
     $student_father->setName($this->getRequestParameter('father'));
     $student_father->setStudent($student);
     $student_father->setPob($this->getRequestParameter('father_pob'));
     if ($this->getRequestParameter('father_dob')) {
         $student_father->setDob($this->getRequestParameter('father_dob'));
     }
     $student_father->setReligionId($this->getRequestParameter('religion_father'));
     $student_father->setDegreeId($this->getRequestParameter('degree_father'));
     $student_father->setJob($father_job);
     $student_father->setAddress($this->getRequestParameter('father_address'));
     $student_father->setOfficePhone($this->getRequestParameter('father_office_phone'));
     $student_father->setPostCode($this->getRequestParameter('post_code'));
     $student_father->setRegionId($this->getRequestParameter('region_id'));
     $student_father->setHomePhone($this->getRequestParameter('home_phone'));
     $student_father->setCellphone($this->getRequestParameter('father_cellphone'));
     $student_father->setCountryId($this->getRequestParameter('father_country'));
     $student_father->setMonthlyRevenue($this->getRequestParameter('father_revenue'));
     $student_father->setEmail($this->getRequestParameter('father_email'));
     $student_father->setNote($this->getRequestParameter('father_note'));
     $student_father->setNoteDetail($this->getRequestParameter('father_note_detail'));
     if ($this->getRequestParameter('father_date_note')) {
         $student_father->setNoteDate($this->getRequestParameter('father_date_note'));
     }
     $student_father->setRelation(StudentParents::RELATION_FATHER);
     $student_father->save();
     #Data Orang Tua (Ibu)
     $student_mother = StudentParentsPeer::retrieveByPk($this->getRequestParameter('mother_id'));
     $this->forward404Unless($student_mother);
     $student_mother->setId($this->getRequestParameter('mother_id'));
     $student_mother->setName($this->getRequestParameter('mother'));
     $student_mother->setStudent($student);
     if ($this->getRequestParameter('mother_dob')) {
         $student_mother->setDob($this->getRequestParameter('mother_dob'));
     }
     $student_mother->setPob($this->getRequestParameter('mother_pob'));
     $student_mother->setReligionId($this->getRequestParameter('religion_mother'));
     $student_mother->setDegreeId($this->getRequestParameter('degree_mother'));
     $student_mother->setJob($mother_job);
     $student_mother->setAddress($this->getRequestParameter('mother_address'));
     $student_mother->setOfficePhone($this->getRequestParameter('mother_office_phone'));
     $student_mother->setPostCode($this->getRequestParameter('post_code'));
     $student_mother->setRegionId($this->getRequestParameter('region_id'));
     $student_mother->setHomePhone($this->getRequestParameter('home_phone'));
     $student_mother->setCellphone($this->getRequestParameter('mother_cellphone'));
     $student_mother->setCountryId($this->getRequestParameter('mother_country'));
     $student_mother->setMonthlyRevenue($this->getRequestParameter('mother_revenue'));
     $student_mother->setEmail($this->getRequestParameter('mother_email'));
     $student_mother->setNote($this->getRequestParameter('mother_note'));
     $student_mother->setNoteDetail($this->getRequestParameter('mother_note_detail'));
     if ($this->getRequestParameter('mother_date_note')) {
         $student_mother->setNoteDate($this->getRequestParameter('mother_date_note'));
     }
     $student_mother->setRelation(StudentParents::RELATION_MOTHER);
     $student_mother->save();
     return $this->redirect('user_profile/index');
 }
Ejemplo n.º 15
0
 public static function doSelectJoinAllExceptAcademicCalendar(Criteria $c, $con = null)
 {
     $c = clone $c;
     if ($c->getDbName() == Propel::getDefaultDB()) {
         $c->setDbName(self::DATABASE_NAME);
     }
     VStudentPeer::addSelectColumns($c);
     $startcol2 = VStudentPeer::NUM_COLUMNS - VStudentPeer::NUM_LAZY_LOAD_COLUMNS + 1;
     CurriculumPeer::addSelectColumns($c);
     $startcol3 = $startcol2 + CurriculumPeer::NUM_COLUMNS;
     ClassGroupPeer::addSelectColumns($c);
     $startcol4 = $startcol3 + ClassGroupPeer::NUM_COLUMNS;
     TestApplicantPeer::addSelectColumns($c);
     $startcol5 = $startcol4 + TestApplicantPeer::NUM_COLUMNS;
     StudentDetailPeer::addSelectColumns($c);
     $startcol6 = $startcol5 + StudentDetailPeer::NUM_COLUMNS;
     $c->addJoin(VStudentPeer::CURRICULUM_ID, CurriculumPeer::ID);
     $c->addJoin(VStudentPeer::CLASS_GROUP_ID, ClassGroupPeer::ID);
     $c->addJoin(VStudentPeer::TEST_APPLICANT_ID, TestApplicantPeer::ID);
     $c->addJoin(VStudentPeer::STUDENT_DETAIL_ID, StudentDetailPeer::ID);
     $rs = BasePeer::doSelect($c, $con);
     $results = array();
     while ($rs->next()) {
         $omClass = VStudentPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj1 = new $cls();
         $obj1->hydrate($rs);
         $omClass = CurriculumPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj2 = new $cls();
         $obj2->hydrate($rs, $startcol2);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj2 = $temp_obj1->getCurriculum();
             if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj2->addVStudent($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj2->initVStudents();
             $obj2->addVStudent($obj1);
         }
         $omClass = ClassGroupPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj3 = new $cls();
         $obj3->hydrate($rs, $startcol3);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj3 = $temp_obj1->getClassGroup();
             if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj3->addVStudent($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj3->initVStudents();
             $obj3->addVStudent($obj1);
         }
         $omClass = TestApplicantPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj4 = new $cls();
         $obj4->hydrate($rs, $startcol4);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj4 = $temp_obj1->getTestApplicant();
             if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj4->addVStudent($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj4->initVStudents();
             $obj4->addVStudent($obj1);
         }
         $omClass = StudentDetailPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj5 = new $cls();
         $obj5->hydrate($rs, $startcol5);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj5 = $temp_obj1->getStudentDetail();
             if ($temp_obj5->getPrimaryKey() === $obj5->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj5->addVStudent($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj5->initVStudents();
             $obj5->addVStudent($obj1);
         }
         $results[] = $obj1;
     }
     return $results;
 }
Ejemplo n.º 16
0
 public function executeUpdateProfile()
 {
     $i18n = new sfI18N();
     $i18n->initialize($this->getContext());
     $i18n->setCulture($this->getUser()->getCulture());
     $action_i18n = $i18n->globalMessageFormat->format('save as new');
     $action_type = $this->getRequestParameter('action_type');
     // add/update student_detail
     if ($action_type == $action_i18n || !$this->getRequestParameter('student_detail_id')) {
         $student_detail = new StudentDetail();
     } else {
         $student_detail = StudentDetailPeer::retrieveByPk($this->getRequestParameter('student_detail_id'));
         #$this->forward404Unless($student_detail);
     }
     $student_detail->setId($this->getRequestParameter('student_detail_id'));
     $student_detail->setPob($this->getRequestParameter('pob'));
     if ($this->getRequestParameter('dob')) {
         $student_detail->setDob($this->getRequestParameter('dob'));
     }
     $student_detail->setSex($this->getRequestParameter('sex'));
     $student_detail->setAddress($this->getRequestParameter('address'));
     $student_detail->setRegionId($this->getRequestParameter('region_id'));
     $student_detail->setPostCode($this->getRequestParameter('post_code'));
     $student_detail->setParentName($this->getRequestParameter('parent_name'));
     $student_detail->setPhone($this->getRequestParameter('phone'));
     $student_detail->setCellphone($this->getRequestParameter('cellphone'));
     $student_detail->setReligionId($this->getRequestParameter('religion_id'));
     $student_detail->setSchoolOfOrigin($this->getRequestParameter('school_of_origin'));
     $student_detail->setGraduationYear($this->getRequestParameter('graduation_year'));
     $student_detail->setGraduationGrade($this->getRequestParameter('graduation_grade'));
     $student_detail->setCompany($this->getRequestParameter('company'));
     $student_detail->setJobTitle($this->getRequestParameter('job_title'));
     $student_detail->setCollegeOfOrigin($this->getRequestParameter('college_of_origin'));
     $student_detail->setDepartmentOfOrigin($this->getRequestParameter('department_of_origin'));
     $student_detail->setRegYear($this->getRequestParameter('reg_year'));
     $student_detail->setResidenceStatus($this->getRequestParameter('residence_status'));
     $student_detail->setHomeDistance($this->getRequestParameter('home_distance'));
     $student_detail->setTransport($this->getRequestParameter('transport'));
     $student_detail->setNativeLanguage($this->getRequestParameter('native_language'));
     $student_detail->setChildNumber($this->getRequestParameter('child_number'));
     $student_detail->setBloodSiblings($this->getRequestParameter('blood_siblings'));
     $student_detail->setStepSiblings($this->getRequestParameter('step_siblings'));
     $student_detail->setAdoptSiblings($this->getRequestParameter('adopt_siblings'));
     $student_detail->setOrphanageStatus($this->getRequestParameter('orphanage_status'));
     $student_detail->setNationality($this->getRequestParameter('nationality'));
     $student_detail->setShortName($this->getRequestParameter('short_name'));
     $student_detail->setIntelligency($this->getRequestParameter('intelligency'));
     if ($this->getRequestParameter('test_date') != '') {
         $student_detail->setTestDate($this->getRequestParameter('test_date'));
     }
     $student_detail->save();
     ### Member Detail ###
     if ($action_type == $action_i18n || !$this->getRequestParameter('member_detail_id')) {
         $member_detail = new MemberDetail();
     } else {
         $member_detail = MemberDetailPeer::retrieveByPk($this->getRequestParameter('member_detail_id'));
         #$this->forward404Unless($member_detail);
     }
     $member_detail->setId($this->getRequestParameter('member_detail_id'));
     $member_detail->setPob($this->getRequestParameter('pob'));
     if ($this->getRequestParameter('dob')) {
         $member_detail->setDob($this->getRequestParameter('dob'));
     }
     $member_detail->setSex($this->getRequestParameter('sex'));
     $member_detail->setAddress($this->getRequestParameter('address'));
     $member_detail->setRegionId($this->getRequestParameter('region_id'));
     $member_detail->setPostCode($this->getRequestParameter('post_code'));
     $member_detail->setPhone($this->getRequestParameter('phone'));
     $member_detail->setCellphone($this->getRequestParameter('cellphone'));
     $member_detail->setReligionId($this->getRequestParameter('religion_id'));
     $member_detail->setSchoolOfOrigin($this->getRequestParameter('school_of_origin'));
     $member_detail->setGraduationYear($this->getRequestParameter('graduation_year'));
     $member_detail->setGraduationGrade($this->getRequestParameter('graduation_grade'));
     $member_detail->setCompany($this->getRequestParameter('company'));
     $member_detail->setJobTitle($this->getRequestParameter('job_title'));
     $member_detail->setCollegeOfOrigin($this->getRequestParameter('college_of_origin'));
     $member_detail->setDepartmentOfOrigin($this->getRequestParameter('department_of_origin'));
     $member_detail->setRegYear($this->getRequestParameter('reg_year'));
     $member_detail->setResidenceStatus($this->getRequestParameter('residence_status'));
     $member_detail->setHomeDistance($this->getRequestParameter('home_distance'));
     $member_detail->setTransport($this->getRequestParameter('transport'));
     $member_detail->setNativeLanguage($this->getRequestParameter('native_language'));
     $member_detail->setChildNumber($this->getRequestParameter('child_number'));
     $member_detail->setBloodSiblings($this->getRequestParameter('blood_siblings'));
     $member_detail->setStepSiblings($this->getRequestParameter('step_siblings'));
     $member_detail->setAdoptSiblings($this->getRequestParameter('adopt_siblings'));
     $member_detail->setOrphanageStatus($this->getRequestParameter('orphanage_status'));
     $member_detail->setNationality($this->getRequestParameter('nationality'));
     $member_detail->setShortName($this->getRequestParameter('short_name'));
     $member_detail->setIntelligency($this->getRequestParameter('intelligency'));
     if ($this->getRequestParameter('test_date') != '') {
         $member_detail->setTestDate($this->getRequestParameter('test_date'));
     }
     $member_detail->save();
     if ($action_type == $action_i18n || !$this->getRequestParameter('member_id')) {
         $member = new Member();
     } else {
         $member = MemberPeer::retrieveByPk($this->getRequestParameter('member_id'));
         #$this->forward404Unless($member);
     }
     $member->setId($this->getRequestParameter('member_id'));
     $member->setCode($this->getRequestParameter('code'));
     $member->setName($this->getRequestParameter('name'));
     $old_status = $member->getStatus();
     $member->setStatus($this->getRequestParameter('status'));
     $member->setType('1');
     $member->setMemberDetail($member_detail);
     if ($this->getRequestParameter('password') != null && strlen($this->getRequestParameter('password')) > 0) {
         // password set
         $crypted = sha1(sfConfig::get('app_salt') . $this->getRequestParameter('password'));
         if ($member->getPassword() != $crypted && strlen($this->getRequestParameter('password')) > 0) {
             // password changed
             $member->setPassword($crypted);
         }
     } elseif ($member->getPassword() == null || $member->getPassword() == '') {
         // create
         $crypted = sha1(sfConfig::get('app_salt') . $this->getRequestParameter('code') . $member_detail->getDob('dm'));
         $member->setPassword($crypted);
     }
     $member->save();
     if ($action_type == $action_i18n || !$this->getRequestParameter('id')) {
         $student = new Student();
     } else {
         $student = StudentPeer::retrieveByPk($this->getRequestParameter('id'));
         #$this->forward404Unless($student);
     }
     $student->setId($this->getRequestParameter('id'));
     $student->setCode($this->getRequestParameter('code'));
     $student->setCode2($this->getRequestParameter('code2'));
     $student->setName($this->getRequestParameter('name'));
     $student->setClassName($this->getRequestParameter('class_name'));
     $student->setAcademicCalendarId($this->getRequestParameter('academic_calendar_id'));
     $student->setClassGroupId($this->getRequestParameter('class_group_id'));
     $student->setTestApplicantId($this->getRequestParameter('test_applicant_id'));
     $old_status = $student->getStatus();
     $student->setStatus($this->getRequestParameter('status'));
     $student->setStudentDetail($student_detail);
     $student->setMember($member);
     if ($this->getRequestParameter('password') != null && strlen($this->getRequestParameter('password')) > 0) {
         // password set
         $crypted = sha1(sfConfig::get('app_salt') . $this->getRequestParameter('password'));
         if ($student->getPassword() != $crypted && strlen($this->getRequestParameter('password')) > 0) {
             // password changed
             $student->setPassword($crypted);
         }
     } elseif ($student->getPassword() == null || $student->getPassword() == '') {
         // create
         $crypted = sha1(sfConfig::get('app_salt') . $student_detail->getDob('dmY'));
         $student->setPassword($crypted);
     }
     $student->save();
     if ($student->getStatus() == Student::STATUS_FINAL) {
         $c = new Criteria();
         $c->add(SubjectPeer::IS_COMPREHENSIVE_SUBJECT, true);
         $c->addJoin(SubjectPeer::ID, SubjectAccalPeer::SUBJECT_ID);
         $c->addJoin(SubjectAccalPeer::ID, StudentCoursePeer::SUBJECT_ACCAL_ID);
         $c->add(StudentCoursePeer::STATUS, StudentCourse::STATUS_ACTIVE);
         $c->add(StudentCoursePeer::STUDENT_ID, $student->getId());
         $sc = StudentCoursePeer::doSelectOne($c);
         if ($sc) {
             $accal_id = $sc->getSubjectAccal()->getAcademicCalendarId();
             $st = new StudentThesis();
             $st->setStudentid($student->getId());
             $st->setStatus(StudentThesis::STATUS_ACTIVE);
             $st->setAcademicCalendarId($accal_id);
             $st->save();
         } else {
             $student->setStatus($old_status);
             $student->save();
         }
     } elseif ($student->getStatus() == Student::STATUS_GRADUATE) {
         $student->setGraduationDate(date('Y/m/d'));
         $student->save();
     }
     // save photo
     $photo_dir = sfConfig::get('sf_data_dir') . DIRECTORY_SEPARATOR . 'photos' . DIRECTORY_SEPARATOR;
     if ($this->hasRequestParameter('photoFile') && $this->getRequestParameter('photoFile') != '' && $this->getRequestParameter('photoFile') != null) {
         // get photo content
         $photo_file = $photo_dir . 'tmp' . DIRECTORY_SEPARATOR . $this->getRequestParameter('photoFile');
         $content = file_get_contents($photo_file);
         $im = imagecreatefromstring($content);
         list($w, $h) = getimagesize($photo_file);
         // generate photo
         $photo = imagecreatetruecolor(150, 195);
         imagecopyresized($photo, $im, 0, 0, 0, 0, 150, 195, $w, $h);
         // generate thumbnail
         $thumb = imagecreatetruecolor(100, 130);
         imagecopyresized($thumb, $im, 0, 0, 0, 0, 100, 130, $w, $h);
         // get photo record
         $c = new Criteria();
         $c->add(StudentPhotoPeer::STUDENT_ID, $student->getId());
         $student_photo = StudentPhotoPeer::doSelectOne($c);
         if ($student_photo == null) {
             $student_photo = new StudentPhoto();
             $student_photo->setStudent($student);
         }
         // save photo
         imagepng($photo, $photo_file);
         $student_photo->setPhoto(base64_encode(file_get_contents($photo_file)));
         imagepng($thumb, $photo_file);
         $student_photo->setThumbnail(base64_encode(file_get_contents($photo_file)));
         $student_photo->save();
         unlink($photo_dir . 'tmp' . DIRECTORY_SEPARATOR . $this->getRequestParameter('photoFile'));
     }
     // save member photo
     $photo_dir = sfConfig::get('sf_data_dir') . DIRECTORY_SEPARATOR . 'photos' . DIRECTORY_SEPARATOR;
     if ($this->hasRequestParameter('photoFile') && $this->getRequestParameter('photoFile') != '' && $this->getRequestParameter('photoFile') != null) {
         // get photo content
         $photo_file = $photo_dir . 'tmp' . DIRECTORY_SEPARATOR . $this->getRequestParameter('photoFile');
         $content = file_get_contents($photo_file);
         $im = imagecreatefromstring($content);
         list($w, $h) = getimagesize($photo_file);
         // generate photo
         $photo = imagecreatetruecolor(150, 200);
         imagecopyresized($photo, $im, 0, 0, 0, 0, 150, 200, $w, $h);
         // generate thumbnail
         $thumb = imagecreatetruecolor(100, 150);
         imagecopyresized($thumb, $im, 0, 0, 0, 0, 100, 150, $w, $h);
         // get photo record
         $c = new Criteria();
         $c->add(MemberPhotoPeer::MEMBER_ID, $member->getId());
         $member_photo = MemberPhotoPeer::doSelectOne($c);
         if ($member_photo == null) {
             $member_photo = new MemberPhoto();
             $member_photo->setMember($member);
         }
         // save photo
         imagepng($photo, $photo_file);
         $member_photo->setPhoto(base64_encode(file_get_contents($photo_file)));
         imagepng($thumb, $photo_file);
         $member_photo->setThumbnail(base64_encode(file_get_contents($photo_file)));
         $member_photo->save();
         unlink($photo_dir . 'tmp' . DIRECTORY_SEPARATOR . $this->getRequestParameter('photoFile'));
     }
     $filter_class = $this->getRequestParameter('filter_class');
     $filter_name = $this->getRequestParameter('filter_name');
     $filter_code = $this->getRequestParameter('filter_code');
     $filter_code2 = $this->getRequestParameter('filter_code2');
     if ($filter_class) {
         return $this->redirect('student/listProfile?filters[CLASS_NAME]=' . $filter_class);
     } elseif ($filter_name) {
         return $this->redirect('student/listProfile?filters[NAME]=' . $filter_name);
     } elseif ($filter_code) {
         return $this->redirect('student/listProfile?filters[CODE]=' . $filter_code);
     } elseif ($filter_code2) {
         return $this->redirect('student/listProfile?filters[CODE2]=' . $filter_code2);
     } else {
         return $this->redirect('student/listProfile');
     }
 }