Esempio n. 1
0
 public function executeShowEmployee()
 {
     $employee = EmployeePeer::retrieveByPk($this->getRequestParameter('id'));
     $this->forward404Unless($employee);
     $this->subtitle = $employee->toString() . ' - id:' . $employee->getId();
     $c = new Criteria();
     $c->add(EmployeeDetailPeer::EMPLOYEE_ID, $employee->getId());
     $employee_detail = EmployeeDetailPeer::doSelectOne($c);
     $academic_calendar = AcademicCalendarPeer::retrieveByPk($this->getRequestParameter('accal_id'));
     $this->forward404Unless($academic_calendar);
     if ($academic_calendar->getCourseModel() == 'A') {
         $actions = array(array('name' => 'back', 'url' => 'employee_agenda/list', 'color' => 'black'));
     } else {
         $actions = array(array('name' => 'back', 'url' => 'employee_agenda/list2', 'color' => 'black'));
     }
     $this->actions = $actions;
     $this->employee = $employee;
     $this->employee_detail = $employee_detail;
     $this->academic_calendar = $academic_calendar;
 }
Esempio n. 2
0
 public function executeUpdate()
 {
     $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');
     if ($action_type == $action_i18n || !$this->getRequestParameter('id')) {
         $employee = new Employee();
     } else {
         $employee = EmployeePeer::retrieveByPk($this->getRequestParameter('id'));
         $this->forward404Unless($employee);
     }
     $employee->setId($this->getRequestParameter('id'));
     $employee->setName($this->getRequestParameter('name'));
     $employee->setDepartmentId($this->getRequestParameter('department_id'));
     $employee->setStaffTypeId($this->getRequestParameter('staff_type_id'));
     $employee->setEmpNo($this->getRequestParameter('emp_no'));
     $employee->setCode($this->getRequestParameter('code'));
     $employee->setIsCounselor($this->getRequestParameter('is_counselor'));
     $employee->setIsThesisAdvisor($this->getRequestParameter('is_thesis_advisor'));
     $employee->setIsComprehensiveReviewer($this->getRequestParameter('is_comprehensive_reviewer'));
     $employee->save();
     // fd3cf92194f1a6b8b5fa60a1aba8129c1753d6e2 = admin
     if ($this->getRequestParameter('password') != null && strlen($this->getRequestParameter('password')) > 0) {
         // password set
         $crypted = sha1(sfConfig::get('app_salt') . $this->getRequestParameter('password'));
         if ($employee->getPassword() != $crypted && strlen($this->getRequestParameter('password')) > 0) {
             // password changed
             $employee->setPassword($crypted);
         }
     } elseif ($employee->getPassword() == null || $employee->getPassword() == '') {
         // create
         $crypted = sha1(sfConfig::get('app_salt') . $employee->getEmpNo());
         $employee->setPassword($crypted);
     }
     $employee->save();
     if ($action_type == $action_i18n || !$this->getRequestParameter('employee_detail_id')) {
         $employee_detail = new EmployeeDetail();
     } else {
         $employee_detail = EmployeeDetailPeer::retrieveByPk($this->getRequestParameter('employee_detail_id'));
         $this->forward404Unless($employee_detail);
     }
     $employee_detail->setId($this->getRequestParameter('employee_detail_id'));
     $employee_detail->setEmployee($employee);
     if ($this->getRequestParameter('date_in')) {
         $employee_detail->setDateIn($this->getRequestParameter('date_in'));
     }
     if ($this->getRequestParameter('date_out')) {
         $employee_detail->setDateOut($this->getRequestParameter('date_out'));
     }
     $employee_detail->setNickname($this->getRequestParameter('nickname'));
     $employee_detail->setSex($this->getRequestParameter('sex'));
     $employee_detail->setPob($this->getRequestParameter('pob'));
     if ($this->getRequestParameter('dob')) {
         $employee_detail->setDob($this->getRequestParameter('dob'));
     }
     $employee_detail->setReligionId($this->getRequestParameter('religion_id'));
     $employee_detail->setNationality($this->getRequestParameter('nationality'));
     $employee_detail->setStatusInFamily($this->getRequestParameter('status_in_family'));
     $employee_detail->setMotherLanguage($this->getRequestParameter('mother_language'));
     $employee_detail->setHobby($this->getRequestParameter('hobby'));
     $employee_detail->setAddress($this->getRequestParameter('address'));
     $employee_detail->setPhone($this->getRequestParameter('phone'));
     $employee_detail->setResidenceStatus($this->getRequestParameter('residence_status'));
     $employee_detail->setVehicle($this->getRequestParameter('vehicle'));
     $employee_detail->setWorkplaceDistance($this->getRequestParameter('workplace_distance'));
     $employee_detail->setLastEducation($this->getRequestParameter('last_education'));
     $employee_detail->setGraduationYear($this->getRequestParameter('graduation_year'));
     $employee_detail->setCertificateNumber($this->getRequestParameter('certificate_number'));
     $employee_detail->setFaculty($this->getRequestParameter('faculty'));
     $employee_detail->setProgram($this->getRequestParameter('program'));
     $employee_detail->setMayor($this->getRequestParameter('mayor'));
     $employee_detail->setTeachingLicense($this->getRequestParameter('teaching_license'));
     $employee_detail->setMaritalStatusId($this->getRequestParameter('marital_status_id'));
     $employee_detail->setSpouseName($this->getRequestParameter('spouse_name'));
     $employee_detail->setBloodType($this->getRequestParameter('blood_type'));
     $employee_detail->setSpousePob($this->getRequestParameter('spouse_pob'));
     if ($this->getRequestParameter('spouse_dob')) {
         $employee_detail->setSpouseDob($this->getRequestParameter('spouse_dob'));
     }
     $employee_detail->setContactDetail($this->getRequestParameter('contact_detail'));
     $employee_detail->setSpouseEducation($this->getRequestParameter('spouse_education'));
     $employee_detail->setSpouseReligionId($this->getRequestParameter('spouse_religion_id'));
     $employee_detail->setNumberOfChild($this->getRequestParameter('number_of_child'));
     $employee_detail->setChild1Name($this->getRequestParameter('child1_name'));
     $employee_detail->setChild2Name($this->getRequestParameter('child2_name'));
     $employee_detail->setTall($this->getRequestParameter('tall'));
     $employee_detail->setWeight($this->getRequestParameter('weight'));
     $employee_detail->setIllness($this->getRequestParameter('illness'));
     $employee_detail->setEmployeeDivisionId($this->getRequestParameter('employee_division_id'));
     $employee_detail->setEmployeeLevelId($this->getRequestParameter('employee_level_id'));
     $employee_detail->setExtraCode($this->getRequestParameter('extra_code'));
     $employee_detail->setAccountNumber($this->getRequestParameter('account_number'));
     $employee_detail->setGroups($this->getRequestParameter('groups'));
     $employee_detail->setFingercode($this->getRequestParameter('fingercode'));
     $employee_detail->setStatus($this->getRequestParameter('status'));
     $employee_detail->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(EmployeePhotoPeer::EMPLOYEE_ID, $employee_detail->getEmployeeId());
         $employee_photo = EmployeePhotoPeer::doSelectOne($c);
         if ($employee_photo == null) {
             $employee_photo = new EmployeePhoto();
             $employee_photo->setEmployee($employee_detail->getEmployee());
         }
         // save photo
         imagepng($photo, $photo_file);
         $employee_photo->setPhoto(base64_encode(file_get_contents($photo_file)));
         imagepng($thumb, $photo_file);
         $employee_photo->setThumbnail(base64_encode(file_get_contents($photo_file)));
         $employee_photo->save();
         unlink($photo_dir . 'tmp' . DIRECTORY_SEPARATOR . $this->getRequestParameter('photoFile'));
     }
     ## Ayah
     if ($this->hasRequestParameter('father') && $this->getRequestParameter('father')) {
         $cdi = new Criteria();
         $cdi->add(EmployeeParentsPeer::EMPLOYEE_ID, $employee->getId());
         $cdi->add(EmployeeParentsPeer::RELATION, EmployeeParents::RELATION_FATHER);
         $father = EmployeeParentsPeer::doSelectOne($cdi);
         if ($father == null) {
             $father = new EmployeeParents();
         }
         $father->setName($this->getRequestParameter('father'));
         $father->setEmployee($employee);
         $father->setRelation(EmployeeParents::RELATION_FATHER);
         $father->save();
     }
     # Ibu
     if ($this->hasRequestParameter('mother') && $this->getRequestParameter('mother')) {
         $cti = new Criteria();
         $cti->add(EmployeeParentsPeer::EMPLOYEE_ID, $employee->getId());
         $cti->add(EmployeeParentsPeer::RELATION, EmployeeParents::RELATION_MOTHER);
         $mother = EmployeeParentsPeer::doSelectOne($cti);
         if ($mother == null) {
             $mother = new EmployeeParents();
         }
         $mother->setName($this->getRequestParameter('mother'));
         $mother->setEmployee($employee);
         $mother->setRelation(EmployeeParents::RELATION_MOTHER);
         $mother->save();
     }
     # Ayah Mertua
     if ($this->hasRequestParameter('father_inlaw_name') && $this->getRequestParameter('father_inlaw_name')) {
         $cmi = new Criteria();
         $cmi->add(EmployeeParentsPeer::EMPLOYEE_ID, $employee->getId());
         $cmi->add(EmployeeParentsPeer::RELATION, EmployeeParents::RELATION_FATHER_INLAW);
         $father_inlaw = EmployeeParentsPeer::doSelectOne($cmi);
         if ($father_inlaw == null) {
             $father_inlaw = new EmployeeParents();
         }
         $father_inlaw->setName($this->getRequestParameter('father_inlaw_name'));
         $father_inlaw->setEmployee($employee);
         $father_inlaw->setRelation(EmployeeParents::RELATION_FATHER_INLAW);
         $father_inlaw->save();
     }
     # Ibu Mertua
     if ($this->hasRequestParameter('mother_inlaw_name') && $this->getRequestParameter('mother_inlaw_name')) {
         $cki = new Criteria();
         $cki->add(EmployeeParentsPeer::EMPLOYEE_ID, $employee->getId());
         $cki->add(EmployeeParentsPeer::RELATION, EmployeeParents::RELATION_MOTHER_INLAW);
         $mother_inlaw = EmployeeParentsPeer::doSelectOne($cki);
         if ($mother_inlaw == null) {
             $mother_inlaw = new EmployeeParents();
         }
         $mother_inlaw->setName($this->getRequestParameter('mother_inlaw_name'));
         $mother_inlaw->setEmployee($employee);
         $mother_inlaw->setRelation(EmployeeParents::RELATION_MOTHER_INLAW);
         $mother_inlaw->save();
     }
     # Anak 1
     if ($this->hasRequestParameter('child1_name') && $this->getRequestParameter('child1_name')) {
         $cwi = new Criteria();
         $cwi->add(EmployeeChildsPeer::EMPLOYEE_ID, $employee->getId());
         $cwi->add(EmployeeChildsPeer::RELATION, EmployeeChilds::RELATION_SON1);
         $son1 = EmployeeChildsPeer::doSelectOne($cwi);
         if ($son1 == null) {
             $son1 = new EmployeeChilds();
         }
         $son1->setName($this->getRequestParameter('child1_name'));
         $son1->setPob($this->getRequestParameter('pob1'));
         $son1->setDob($this->getRequestParameter('dob1'));
         $son1->setEmployee($employee);
         $son1->setRelation(EmployeeChilds::RELATION_SON1);
         $son1->setSex($this->getRequestParameter('sex1'));
         $son1->save();
     }
     # Anak 2
     if ($this->hasRequestParameter('child2_name') && $this->getRequestParameter('child2_name')) {
         $cwi = new Criteria();
         $cwi->add(EmployeeChildsPeer::EMPLOYEE_ID, $employee->getId());
         $cwi->add(EmployeeChildsPeer::RELATION, EmployeeChilds::RELATION_SON2);
         $son2 = EmployeeChildsPeer::doSelectOne($cwi);
         if ($son2 == null) {
             $son2 = new EmployeeChilds();
         }
         $son2->setName($this->getRequestParameter('child2_name'));
         $son2->setPob($this->getRequestParameter('pob2'));
         $son2->setDob($this->getRequestParameter('dob2'));
         $son2->setEmployee($employee);
         $son2->setRelation(EmployeeChilds::RELATION_SON2);
         $son2->setSex($this->getRequestParameter('sex2'));
         $son2->save();
     }
     # Anak 3
     if ($this->hasRequestParameter('child3_name') && $this->getRequestParameter('child3_name')) {
         $cwi = new Criteria();
         $cwi->add(EmployeeChildsPeer::EMPLOYEE_ID, $employee->getId());
         $cwi->add(EmployeeChildsPeer::RELATION, EmployeeChilds::RELATION_SON3);
         $son3 = EmployeeChildsPeer::doSelectOne($cwi);
         if ($son3 == null) {
             $son3 = new EmployeeChilds();
         }
         $son3->setName($this->getRequestParameter('child3_name'));
         $son3->setPob($this->getRequestParameter('pob3'));
         $son3->setDob($this->getRequestParameter('dob3'));
         $son3->setEmployee($employee);
         $son3->setRelation(EmployeeChilds::RELATION_SON3);
         $son3->setSex($this->getRequestParameter('sex3'));
         $son3->save();
     }
     # Anak 4
     if ($this->hasRequestParameter('child4_name') && $this->getRequestParameter('child4_name')) {
         $cwi = new Criteria();
         $cwi->add(EmployeeChildsPeer::EMPLOYEE_ID, $employee->getId());
         $cwi->add(EmployeeChildsPeer::RELATION, EmployeeChilds::RELATION_SON4);
         $son4 = EmployeeChildsPeer::doSelectOne($cwi);
         if ($son4 == null) {
             $son4 = new EmployeeChilds();
         }
         $son4->setName($this->getRequestParameter('child4_name'));
         $son4->setPob($this->getRequestParameter('pob4'));
         $son4->setDob($this->getRequestParameter('dob4'));
         $son4->setEmployee($employee);
         $son4->setRelation(EmployeeChilds::RELATION_SON4);
         $son4->setSex($this->getRequestParameter('sex4'));
         $son4->save();
     }
     # Anak 5
     if ($this->hasRequestParameter('child5_name') && $this->getRequestParameter('child5_name')) {
         $cwi = new Criteria();
         $cwi->add(EmployeeChildsPeer::EMPLOYEE_ID, $employee->getId());
         $cwi->add(EmployeeChildsPeer::RELATION, EmployeeChilds::RELATION_SON5);
         $son5 = EmployeeChildsPeer::doSelectOne($cwi);
         if ($son5 == null) {
             $son5 = new EmployeeChilds();
         }
         $son5->setName($this->getRequestParameter('child5_name'));
         $son5->setPob($this->getRequestParameter('pob5'));
         $son5->setDob($this->getRequestParameter('dob5'));
         $son5->setEmployee($employee);
         $son5->setRelation(EmployeeChilds::RELATION_SON5);
         $son5->setSex($this->getRequestParameter('sex5'));
         $son5->save();
     }
     return $this->redirect('employee/list');
 }
Esempio n. 3
0
 public function executeShow()
 {
     $group_id = $this->getContext()->getUser()->getAttribute('group_id', null, 'bo');
     $usertype = $this->getContext()->getUser()->getAttribute('usertype', null, 'bo');
     $jobtemplate = $this->getContext()->getUser()->getAttribute('job_template_id', null, 'bo');
     if ($jobtemplate == 1) {
         $c = new Criteria();
         $c->add(JobPeer::CODE, $this->getModuleName());
         $job = JobPeer::doSelectOne($c);
         $acl = AclPeer::retrieveByPK($group_id, $job->getId());
         if (!$acl) {
             $this->forward('default', 'error404');
         }
         $this->can_edit = $acl->getEditPriv() == 1;
         $this->can_remove = $acl->getRemovePriv() == 1;
         $byEmployee = false;
     } else {
         $c = new Criteria();
         $c->add(JobPeer::CODE, 'employee_job_history_l');
         $job = JobPeer::doSelectOne($c);
         $acl = AclPeer::retrieveByPK($group_id, $job->getId());
         if (!$acl) {
             $this->forward('default', 'error404');
         }
         $this->can_edit = $acl->getEditPriv() == 1;
         $this->can_remove = $acl->getRemovePriv() == 1;
         $byEmployee = true;
     }
     $employee_job_history = EmployeeJobHistoryPeer::retrieveByPk($this->getRequestParameter('id'));
     $this->forward404Unless($employee_job_history);
     $this->subtitle = $employee_job_history->toString() . ' - id:' . $employee_job_history->getId();
     $actions = array(array('name' => 'Kembali', 'url' => 'employee_job_history/list?employee_id=' . $employee_job_history->getEmployeeId() . '&byEmployee=' . $byEmployee, 'color' => 'black'));
     if ($acl->getEditPriv()) {
         array_push($actions, array('name' => 'Ubah', 'url' => 'employee_job_history/edit?id=' . $employee_job_history->getId() . '&byEmployee=' . $byEmployee, 'color' => 'blue'));
     }
     if ($acl->getRemovePriv()) {
         array_push($actions, array('name' => 'Hapus', 'url' => 'employee_job_history/delete?id=' . $employee_job_history->getId(), 'color' => 'red'));
     }
     $this->actions = $actions;
     $this->employee_job_history = $employee_job_history;
     $employee = $employee_job_history->getEmployee();
     if ($byEmployee == false) {
         $actions2 = array(array('name' => '<span>Catatan Kepegawaian</span>', 'url' => 'employee_list/list', 'color' => 'sky'));
         array_push($actions2, array('name' => '<span>Mutasi Jabatan</span>', 'url' => 'employee_job_history/list?employee_id=' . $employee->getId(), 'color' => 'sun', 'type' => 'direct'));
         array_push($actions2, array('name' => '<span>Absensi Pegawai</span>', 'url' => 'employee_absence/list?employee_id=' . $employee->getId(), 'color' => 'sky'));
         array_push($actions2, array('name' => '<span>Administrasi Cuti</span>', 'url' => 'employee_leave/list?employee_id=' . $employee->getId(), 'color' => 'sky'));
         array_push($actions2, array('name' => '<span>Administrasi Izin</span>', 'url' => 'employee_permit/list?employee_id=' . $employee->getId(), 'color' => 'sky'));
         array_push($actions2, array('name' => '<span>Administrasi Pengobatan</span>', 'url' => 'employee_medical/list?employee_id=' . $employee->getId(), 'color' => 'sky'));
         array_push($actions2, array('name' => '<span>Gaji Pegawai</span>', 'url' => 'employee_salary/list?employee_id=' . $employee->getId(), 'color' => 'sky'));
         $this->actions2 = $actions2;
     }
     $this->byEmployee = $byEmployee;
     $cd = new Criteria();
     $cd->add(EmployeeDetailPeer::EMPLOYEE_ID, $employee_job_history->getEmployeeId());
     $this->employee_detail = EmployeeDetailPeer::doSelectOne($cd);
 }
Esempio n. 4
0
 public function executeUpdate()
 {
     $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');
     if ($action_type == $action_i18n || !$this->getRequestParameter('id')) {
         $employee_medical = new EmployeeMedical();
     } else {
         $employee_medical = EmployeeMedicalPeer::retrieveByPk($this->getRequestParameter('id'));
         $this->forward404Unless($employee_medical);
     }
     $employee_medical->setId($this->getRequestParameter('id'));
     $employee_medical->setEmployeeId($this->getRequestParameter('employee_id'));
     $employee = EmployeePeer::retrieveByPK($this->getRequestParameter('employee_id'));
     if ($employee) {
         $cd = new Criteria();
         $cd->add(EmployeeDetailPeer::EMPLOYEE_ID, $employee->getId());
         $employee_detail = EmployeeDetailPeer::doSelectOne($cd);
         if ($employee_detail->getEmployeeDivisionId()) {
             $employee_medical->setEmployeeDivisionId($employee_detail->getEmployeeDivisionId());
         }
         if ($employee->getDepartmentId()) {
             $employee_medical->setDepartmentId($employee->getDepartmentId());
         }
     }
     $employee_medical->setStaffTypeId($this->getRequestParameter('staff_type_id'));
     $employee_medical->setEmployeeLevelId($this->getRequestParameter('employee_level_id'));
     $employee_medical->setIllnessId($this->getRequestParameter('illness_id'));
     $employee_medical->setDetailMedical($this->getRequestParameter('detail_medical'));
     $employee_medical->setHospital($this->getRequestParameter('hospital'));
     $employee_medical->setPatientName($this->getRequestParameter('patient_name'));
     $employee_medical->setTotal($this->getRequestParameter('total'));
     $employee_medical->setRelation($this->getRequestParameter('relation'));
     $employee_medical->setStatus($this->getRequestParameter('status'));
     $employee_medical->setMedicine($this->getRequestParameter('medicine'));
     $employee_medical->setHospitalization($this->getRequestParameter('hospitalization'));
     $employee_medical->setCode($this->getRequestParameter('code'));
     $employee_medical->setAcademicCalendarId($this->getRequestParameter('academic_calendar_id'));
     if ($this->getRequestParameter('medical_date')) {
         $employee_medical->setMedicalDate($this->getRequestParameter('medical_date'));
     }
     $employee_medical->save();
     return $this->redirect('employee_medical/list?employee_id=' . $this->getRequestParameter('employee_id'));
 }
Esempio n. 5
0
 public function filterPermit($c, $filters)
 {
     $filters_key = array_keys($filters);
     foreach ($filters_key as $key) {
         $value = $filters[$key];
         if ($value == '' || $value == null) {
             continue;
         }
         if ($key == 'EXTRA_CODE') {
             $c->addJoin(EmployeePeer::ID, EmployeePermitPeer::EMPLOYEE_ID);
             $c->addJoin(EmployeeDetailPeer::EMPLOYEE_ID, EmployeePeer::ID);
             $column = EmployeeDetailPeer::getTableMap()->getColumn('EXTRA_CODE');
         } elseif ($key == 'LEVEL') {
             $c->addJoin(EmployeeLevelPeer::ID, EmployeePermitPeer::EMPLOYEE_LEVEL_ID);
             $column = EmployeeLevelPeer::getTableMap()->getColumn('LEVEL');
         } elseif ($key == 'EMP_NO') {
             $c->addJoin(EmployeePeer::ID, EmployeePermitPeer::EMPLOYEE_ID);
             $column = EmployeePeer::getTableMap()->getColumn('CODE');
         } elseif ($key == 'EMP_NAME') {
             $c->addJoin(EmployeePeer::ID, EmployeePermitPeer::EMPLOYEE_ID);
             $column = EmployeePeer::getTableMap()->getColumn('NAME');
         } else {
             $column = EmployeePermitPeer::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);
             }
         } elseif ($creoleType == CreoleTypes::DATE) {
             $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) {
                 $c->add($name, $value, Criteria::EQUAL);
             } else {
                 if ($creoleType == CreoleTypes::VARCHAR || $creoleType == CreoleTypes::CHAR) {
                     $c->add($name, "%{$value}%", Criteria::LIKE);
                 }
             }
         }
     }
 }
Esempio n. 6
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(EmployeeDetailPeer::ID, $pks, Criteria::IN);
         $objs = EmployeeDetailPeer::doSelect($criteria, $con);
     }
     return $objs;
 }
Esempio n. 7
0
 public function executeShowEmployee()
 {
     $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);
     $employee = EmployeePeer::retrieveByPk($this->getRequestParameter('id'));
     $this->forward404Unless($employee);
     $this->subtitle = $employee->toString() . ' - id:' . $employee->getId();
     $c = new Criteria();
     $c->add(EmployeeDetailPeer::EMPLOYEE_ID, $employee->getId());
     $employee_detail = EmployeeDetailPeer::doSelectOne($c);
     $student_id = $this->getRequestParameter('student_id');
     $student = StudentPeer::retrieveByPK($this->getRequestParameter('student_id'));
     $this->forward404Unless($student);
     $actions = array(array('name' => 'back', 'url' => 'counseling_detail/listEkskul?student_id=' . $student->getId() . '&counseling_id=' . $counseling->getId() . '&accal_id=' . $academic_calendar->getId(), 'color' => 'black'));
     $this->actions = $actions;
     $this->counseling = $counseling;
     $this->counseling_id = $counseling_id;
     $this->student = $student;
     $this->employee = $employee;
     $this->employee_detail = $employee_detail;
     $this->academic_calendar = $academic_calendar;
 }
Esempio n. 8
0
 public function getEmployeeDetailsJoinReligionRelatedBySpouseReligionId($criteria = null, $con = null)
 {
     include_once 'lib/model/om/BaseEmployeeDetailPeer.php';
     if ($criteria === null) {
         $criteria = new Criteria();
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     if ($this->collEmployeeDetails === null) {
         if ($this->isNew()) {
             $this->collEmployeeDetails = array();
         } else {
             $criteria->add(EmployeeDetailPeer::EMPLOYEE_ID, $this->getId());
             $this->collEmployeeDetails = EmployeeDetailPeer::doSelectJoinReligionRelatedBySpouseReligionId($criteria, $con);
         }
     } else {
         $criteria->add(EmployeeDetailPeer::EMPLOYEE_ID, $this->getId());
         if (!isset($this->lastEmployeeDetailCriteria) || !$this->lastEmployeeDetailCriteria->equals($criteria)) {
             $this->collEmployeeDetails = EmployeeDetailPeer::doSelectJoinReligionRelatedBySpouseReligionId($criteria, $con);
         }
     }
     $this->lastEmployeeDetailCriteria = $criteria;
     return $this->collEmployeeDetails;
 }
Esempio n. 9
0
 protected static function doOnDeleteCascade(Criteria $criteria, Connection $con)
 {
     $affectedRows = 0;
     $objects = ReligionPeer::doSelect($criteria, $con);
     foreach ($objects as $obj) {
         include_once 'lib/model/EmployeeDetail.php';
         $c = new Criteria();
         $c->add(EmployeeDetailPeer::RELIGION_ID, $obj->getId());
         $affectedRows += EmployeeDetailPeer::doDelete($c, $con);
         include_once 'lib/model/EmployeeDetail.php';
         $c = new Criteria();
         $c->add(EmployeeDetailPeer::SPOUSE_RELIGION_ID, $obj->getId());
         $affectedRows += EmployeeDetailPeer::doDelete($c, $con);
     }
     return $affectedRows;
 }
Esempio n. 10
0
 public function getEmployeeDetail($con = null)
 {
     include_once 'lib/model/om/BaseEmployeeDetailPeer.php';
     if ($this->aEmployeeDetail === null && $this->employee_detail_id !== null) {
         $this->aEmployeeDetail = EmployeeDetailPeer::retrieveByPK($this->employee_detail_id, $con);
     }
     return $this->aEmployeeDetail;
 }
Esempio n. 11
0
 public function executeShowEmployee()
 {
     $student_id = sfContext::getInstance()->getUser()->getAttribute('user_id', null, 'bo');
     $student = StudentPeer::retrieveByPK($student_id);
     $this->forward404Unless($student);
     $employee = EmployeePeer::retrieveByPk($this->getRequestParameter('id'));
     $this->forward404Unless($employee);
     $academic_calendar = AcademicCalendarPeer::retrieveByPk($this->getRequestParameter('accal_id'));
     $this->forward404Unless($academic_calendar);
     $this->subtitle = $employee->toString() . ' - id:' . $employee->getId();
     $c = new Criteria();
     $c->add(EmployeeDetailPeer::EMPLOYEE_ID, $employee->getId());
     $employee_detail = EmployeeDetailPeer::doSelectOne($c);
     $actions = array();
     $this->actions = $actions;
     if ($academic_calendar->getCourseModel() == 'A') {
         $actions2 = array(array('name' => '<span>Semester 1 ' . $academic_calendar->getParentName() . '</span>', 'url' => 'student_ekskul/list', 'color' => 'sun'));
     } else {
         $actions2 = array(array('name' => '<span>Semester 2 ' . $academic_calendar->getParentName() . '</span>', 'url' => 'student_ekskul/list2', 'color' => 'sun'));
     }
     array_push($actions2, array('name' => '<span>Detail Pembina / Pendamping</span>', 'url' => 'student_ekskul/showEmployee?id=' . $employee->getId() . '&accal_id=' . $academic_calendar->getId(), 'color' => 'sun', 'type' => 'direct'));
     $this->actions2 = $actions2;
     $this->student = $student;
     $this->employee = $employee;
     $this->employee_detail = $employee_detail;
 }
Esempio n. 12
0
 public function executeShowMedical()
 {
     $employee_medical = EmployeeMedicalPeer::retrieveByPk($this->getRequestParameter('id'));
     $this->forward404Unless($employee_medical);
     $this->subtitle = $employee_medical->toString() . ' - id:' . $employee_medical->getId();
     $academic_calendar_id = $this->getRequestParameter('academic_calendar_id');
     $academic_calendar = AcademicCalendarPeer::retrieveByPK($academic_calendar_id);
     $this->forward404Unless($academic_calendar);
     $department_id = $this->getRequestParameter('department_id');
     $department = DepartmentPeer::retrieveByPK($department_id);
     $this->forward404Unless($department);
     $actions = array(array('name' => 'Kembali', 'url' => 'employee_report/lisMedical?academic_calendar_id=' . $academic_calendar->getId() . '&department_id=' . $department->getId(), 'color' => 'black'));
     $this->actions = $actions;
     $this->employee_medical = $employee_medical;
     $actions2 = array(array('name' => '<span>Rekap Kepegawaian</span>', 'url' => 'employee_report/list', 'color' => 'sky'));
     array_push($actions2, array('name' => '<span>Mutasi Jabatan</span>', 'url' => 'employee_report/listJob?academic_calendar_id=' . $academic_calendar->getId() . '&department_id=' . $department->getId(), 'color' => 'sky'));
     array_push($actions2, array('name' => '<span>Absensi Pegawai</span>', 'url' => 'employee_report/listAbsence?academic_calendar_id=' . $academic_calendar->getId() . '&department_id=' . $department->getId(), 'color' => 'sky'));
     array_push($actions2, array('name' => '<span>Absen Per Pegawai</span>', 'url' => 'employee_report/listAbsenceEmployee?academic_calendar_id=' . $academic_calendar->getId() . '&department_id=' . $department->getId(), 'color' => 'sky'));
     array_push($actions2, array('name' => '<span>Cuti Pegawai</span>', 'url' => 'employee_report/listLeave?academic_calendar_id=' . $academic_calendar->getId() . '&department_id=' . $department->getId(), 'color' => 'sky'));
     array_push($actions2, array('name' => '<span>Izin Pegawai</span>', 'url' => 'employee_report/listPermit?academic_calendar_id=' . $academic_calendar->getId() . '&department_id=' . $department->getId(), 'color' => 'sky'));
     array_push($actions2, array('name' => '<span>Pengobatan</span>', 'url' => 'employee_report/listMedical?academic_calendar_id=' . $academic_calendar->getId() . '&department_id=' . $department->getId(), 'color' => 'sun', 'type' => 'direct'));
     array_push($actions2, array('name' => '<span>Gaji Pegawai</span>', 'url' => 'employee_report/listSalary?academic_calendar_id=' . $academic_calendar->getId() . '&department_id=' . $department->getId(), 'color' => 'sky'));
     $this->actions2 = $actions2;
     $cd = new Criteria();
     $cd->add(EmployeeDetailPeer::EMPLOYEE_ID, $employee_permit->getEmployeeId());
     $this->employee_detail = EmployeeDetailPeer::doSelectOne($cd);
     $this->academic_calendar = $academic_calendar;
     $this->department = $department;
 }
Esempio n. 13
0
 public function filterAbsence($c, $filters)
 {
     $filters_key = array_keys($filters);
     foreach ($filters_key as $key) {
         $value = $filters[$key];
         if ($value == '' || $value == null) {
             continue;
         }
         if ($key == 'EXTRA_CODE') {
             $c->addJoin(EmployeePeer::ID, EmployeeAbsenceDevPeer::EMPLOYEE_ID);
             $c->addJoin(EmployeeDetailPeer::EMPLOYEE_ID, EmployeePeer::ID);
             $column = EmployeeDetailPeer::getTableMap()->getColumn('EXTRA_CODE');
         } elseif ($key == 'FINGERCODE') {
             $c->addJoin(EmployeePeer::ID, EmployeeAbsenceDevPeer::EMPLOYEE_ID);
             $c->addJoin(EmployeeDetailPeer::EMPLOYEE_ID, EmployeePeer::ID);
             $column = EmployeeDetailPeer::getTableMap()->getColumn('FINGERCODE');
         } elseif ($key = 'EMP_NO') {
             $c->addJoin(EmployeePeer::ID, EmployeeAbsenceDevPeer::EMPLOYEE_ID);
             $column = EmployeePeer::getTableMap()->getColumn('CODE');
         } elseif ($key = 'EMP_NAME') {
             $c->addJoin(EmployeePeer::ID, EmployeeAbsenceDevPeer::EMPLOYEE_ID);
             $column = EmployeePeer::getTableMap()->getColumn('NAME');
         } elseif ($key = 'DEPARTMENT_ID') {
             $c->addJoin(EmployeePeer::ID, EmployeeAbsenceDevPeer::EMPLOYEE_ID);
             $c->addJoin(DepartmentPeer::ID, EmployeePeer::DEPARTMENT_ID);
             $column = DepartmentPeer::getTableMap()->getColumn('ID');
         } elseif ($key = 'STATUS') {
             $column = EmployeeAbsenceDevPeer::getTableMap()->getColumn('STATUS');
         } else {
             $column = EmployeeAbsenceDevPeer::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);
             }
         } elseif ($creoleType == CreoleTypes::DATE) {
             #$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);
             $c->add($name, $value, Criteria::EQUAL);
         } elseif ($creoleType == CreoleTypes::INTEGER) {
             $c->add($name, $value, Criteria::EQUAL);
         } elseif ($creoleType == CreoleTypes::VARCHAR || $creoleType == CreoleTypes::CHAR) {
             $c->add($name, "%{$value}%", Criteria::LIKE);
         }
     }
 }
Esempio n. 14
0
 public function executeShowEmployee()
 {
     $employee = EmployeePeer::retrieveByPk($this->getRequestParameter('id'));
     $this->forward404Unless($employee);
     $this->subtitle = $employee->toString() . ' - id:' . $employee->getId();
     $c = new Criteria();
     $c->add(EmployeeDetailPeer::EMPLOYEE_ID, $employee->getId());
     $employee_detail = EmployeeDetailPeer::doSelectOne($c);
     $course_schedule = CourseSchedulePeer::retrieveByPk($this->getRequestParameter('course_id'));
     $this->forward404Unless($course_schedule);
     $actions2 = array(array('name' => '<span>Detail Guru</span>', 'url' => 'student_agenda/showEmployee?id=' . $employee->getId() . '&course_id=' . $course_schedule->getId(), 'color' => 'sun', 'type' => 'direct'));
     if ($course_schedule->getAcademicCalendar()->getCourseModel() == 'A') {
         array_unshift($actions2, array('name' => '<span>' . $course_schedule->getAcademicCalendar()->getName() . '</span>', 'url' => 'student_agenda/list', 'color' => 'sky'));
     } else {
         array_unshift($actions2, array('name' => '<span>' . $course_schedule->getAcademicCalendar()->getName() . '</span>', 'url' => 'student_agenda/list2', 'color' => 'sky'));
     }
     $this->actions = array();
     $this->actions2 = $actions2;
     $this->employee = $employee;
     $this->employee_detail = $employee_detail;
     $this->course_schedule = $course_schedule;
 }
Esempio n. 15
0
 public function executeUpdateEmployee()
 {
     $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 employee
     if ($action_type == $action_i18n || !$this->getRequestParameter('employee_id')) {
         $employee = new Employee();
     } else {
         $employee = EmployeePeer::retrieveByPk($this->getRequestParameter('employee_id'));
         $this->forward404Unless($employee);
     }
     $employee->setId($this->getRequestParameter('id'));
     $employee->setName($this->getRequestParameter('name'));
     $employee->setDepartmentId($this->getRequestParameter('department_id'));
     $employee->setStaffTypeId($this->getRequestParameter('staff_type_id'));
     $employee->setEmpNo($this->getRequestParameter('emp_no'));
     $employee->setIsCounselor($this->getRequestParameter('is_counselor'));
     $employee->setIsThesisAdvisor($this->getRequestParameter('is_thesis_advisor'));
     $employee->setIsComprehensiveReviewer($this->getRequestParameter('is_comprehensive_reviewer'));
     $employee->setCode($this->getRequestParameter('code'));
     $employee->save();
     if ($this->getRequestParameter('password') != null && strlen($this->getRequestParameter('password')) > 0) {
         // password set
         $crypted = sha1(sfConfig::get('app_salt') . $this->getRequestParameter('password'));
         if ($employee->getPassword() != $crypted && strlen($this->getRequestParameter('password')) > 0) {
             // password changed
             $employee->setPassword($crypted);
         }
     } elseif ($employee->getPassword() == null || $employee->getPassword() == '') {
         // create
         $crypted = sha1(sfConfig::get('app_salt') . $employee->getEmpNo());
         $employee->setPassword($crypted);
     }
     $employee->save();
     // add employee_detail
     if ($action_type == $action_i18n || !$this->getRequestParameter('employee_detail_id')) {
         $employee_detail = new EmployeeDetail();
     } else {
         $employee_detail = EmployeeDetailPeer::retrieveByPk($this->getRequestParameter('employee_detail_id'));
         $this->forward404Unless($employee_detail);
     }
     $employee_detail->setId($this->getRequestParameter('id'));
     $employee_detail->setEmployee($employee);
     if ($this->getRequestParameter('date_in')) {
         $employee_detail->setDateIn($this->getRequestParameter('date_in'));
     }
     if ($this->getRequestParameter('date_out')) {
         $employee_detail->setDateOut($this->getRequestParameter('date_out'));
     }
     $employee_detail->setNickname($this->getRequestParameter('nickname'));
     $employee_detail->setSex($this->getRequestParameter('sex'));
     $employee_detail->setPob($this->getRequestParameter('pob'));
     if ($this->getRequestParameter('dob')) {
         $employee_detail->setDob($this->getRequestParameter('dob'));
     }
     $employee_detail->setReligionId($this->getRequestParameter('religion_id'));
     $employee_detail->setNationality($this->getRequestParameter('nationality'));
     $employee_detail->setStatusInFamily($this->getRequestParameter('status_in_family'));
     $employee_detail->setMotherLanguage($this->getRequestParameter('mother_language'));
     $employee_detail->setHobby($this->getRequestParameter('hobby'));
     $employee_detail->setAddress($this->getRequestParameter('address'));
     $employee_detail->setPhone($this->getRequestParameter('phone'));
     $employee_detail->setResidenceStatus($this->getRequestParameter('residence_status'));
     $employee_detail->setVehicle($this->getRequestParameter('vehicle'));
     $employee_detail->setWorkplaceDistance($this->getRequestParameter('workplace_distance'));
     $employee_detail->setLastEducation($this->getRequestParameter('last_education'));
     $employee_detail->setGraduationYear($this->getRequestParameter('graduation_year'));
     $employee_detail->setCertificateNumber($this->getRequestParameter('certificate_number'));
     $employee_detail->setFaculty($this->getRequestParameter('faculty'));
     $employee_detail->setProgram($this->getRequestParameter('program'));
     $employee_detail->setMayor($this->getRequestParameter('mayor'));
     $employee_detail->setTeachingLicense($this->getRequestParameter('teaching_license'));
     $employee_detail->setMaritalStatus($this->getRequestParameter('marital_status'));
     $employee_detail->setSpouseName($this->getRequestParameter('spouse_name'));
     $employee_detail->setBloodType($this->getRequestParameter('blood_type'));
     $employee_detail->setSpousePob($this->getRequestParameter('spouse_pob'));
     if ($this->getRequestParameter('spouse_dob')) {
         $employee_detail->setSpouseDob($this->getRequestParameter('spouse_dob'));
     }
     $employee_detail->setSpouseEducation($this->getRequestParameter('spouse_education'));
     $employee_detail->setSpouseReligionId($this->getRequestParameter('spouse_religion_id'));
     $employee_detail->setNumberOfChild($this->getRequestParameter('number_of_child'));
     $employee_detail->setChild1Name($this->getRequestParameter('child1_name'));
     $employee_detail->setChild2Name($this->getRequestParameter('child2_name'));
     $employee_detail->setTall($this->getRequestParameter('tall'));
     $employee_detail->setWeight($this->getRequestParameter('weight'));
     $employee_detail->setIllness($this->getRequestParameter('illness'));
     $employee_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->setEmployeeDetail($employee_detail);
     $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'));
     $member->setStaffTypeId($this->getRequestParameter('staff_type_id'));
     $member->setEmpNo($this->getRequestParameter('emp_no'));
     $member->setIsCounselor($this->getRequestParameter('is_counselor'));
     $member->setIsThesisAdvisor($this->getRequestParameter('is_thesis_advisor'));
     $member->setIsComprehensiveReviewer($this->getRequestParameter('is_comprehensive_reviewer'));
     $old_status = $member->getStatus();
     $member->setStatus($this->getRequestParameter('status'));
     $member->setType('2');
     // $member->setMemberDetail($member_detail);
     // fd3cf92194f1a6b8b5fa60a1aba8129c1753d6e2 = admin
     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->setEmployeeDetail($employee_detail);
     $member->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 Employee 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(EmployeePhotoPeer::EMPLOYEE_ID, $employee_detail->getEmployeeId());
         $employee_photo = EmployeePhotoPeer::doSelectOne($c);
         if ($employee_photo == null) {
             $employee_photo = new EmployeePhoto();
             $employee_photo->setEmployee($employee_detail->getEmployee());
         }
         // save photo
         imagepng($photo, $photo_file);
         $employee_photo->setPhoto(base64_encode(file_get_contents($photo_file)));
         imagepng($thumb, $photo_file);
         $employee_photo->setThumbnail(base64_encode(file_get_contents($photo_file)));
         $employee_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/listEmployee?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/listEmployee?filters[CODE]=' . $this->getRequestParameter('filter_code'));
     } elseif ($this->hasRequestParameter('filter_deptid') && $this->getRequestParameter('filter_deptid') != '' && $this->getRequestParameter('filter_deptid') != null) {
         return $this->redirect('member/listEmployee?filters[DEPARTMENT_ID]=' . $this->getRequestParameter('filter_deptid'));
     } elseif ($this->hasRequestParameter('filter_stafftype') && $this->getRequestParameter('filter_stafftype') != '' && $this->getRequestParameter('filter_stafftype') != null) {
         return $this->redirect('member/listEmployee?filters[STAFF_TYPE_ID]=' . $this->getRequestParameter('filter_stafftype'));
     } elseif ($this->hasRequestParameter('filter_name') && $this->getRequestParameter('filter_name') != '' && $this->getRequestParameter('filter_name') != null) {
         return $this->redirect('member/listEmployee?filters[NAME]=' . $this->getRequestParameter('name'));
     } else {
         return $this->redirect('member/listEmployee');
     }
 }
Esempio n. 16
0
 public function executeDelete()
 {
     $employee_detail = EmployeeDetailPeer::retrieveByPk($this->getRequestParameter('id'));
     $this->forward404Unless($employee_detail);
     $ref_error = 0;
     foreach ($employee_detail->getRefCountMethods() as $ref) {
         $method = "count" . $ref['affix'];
         $count = $employee_detail->{$method}();
         if ($count > 0) {
             ++$ref_error;
             $this->getRequest()->setError('employee_detail/delete/' . sfInflector::camelize($ref['table']), $count);
         }
     }
     if ($ref_error > 0) {
         $this->getRequest()->setError('employee_detail/delete', '_ERR_DELETE_ (' . $employee_detail->toString() . ' - id:' . $employee_detail->getId() . ')');
     } else {
         $employee_detail->delete();
     }
     return $this->forward('employee_detail', 'list');
 }
Esempio n. 17
0
 public function executeShowEmployee()
 {
     $group_id = $this->getContext()->getUser()->getAttribute('group_id', null, 'bo');
     $c = new Criteria();
     $c->add(JobPeer::CODE, 'sm_book/listEmployee');
     $job = JobPeer::doSelectOne($c);
     $acl = AclPeer::retrieveByPK($group_id, $job->getId());
     if (!$acl) {
         $this->forward('default', 'error404');
     }
     $employee = EmployeePeer::retrieveByPk($this->getRequestParameter('id'));
     $this->forward404Unless($employee);
     $this->subtitle = $employee->toString() . ' - id:' . $employee->getId();
     $c = new Criteria();
     $c->add(EmployeeDetailPeer::EMPLOYEE_ID, $employee->getId());
     $employee_detail = EmployeeDetailPeer::doSelectOne($c);
     $actions = array(array('name' => 'back', 'url' => 'sm_book/listEmployee', 'color' => 'black'));
     $this->actions = $actions;
     $this->employee = $employee;
     $this->employee_detail = $employee_detail;
 }
Esempio n. 18
0
 public function executeUpdate()
 {
     $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');
     if ($action_type == $action_i18n || !$this->getRequestParameter('id')) {
         $employee_leave = new EmployeeLeave();
     } else {
         $employee_leave = EmployeeLeavePeer::retrieveByPk($this->getRequestParameter('id'));
         $this->forward404Unless($employee_leave);
     }
     $employee_leave->setId($this->getRequestParameter('id'));
     $employee_leave->setEmployeeId($this->getRequestParameter('employee_id'));
     if ($this->getRequestParameter('start')) {
         $employee_leave->setStart($this->getRequestParameter('start'));
     }
     if ($this->getRequestParameter('end')) {
         $employee_leave->setEnd($this->getRequestParameter('end'));
     }
     $employee = EmployeePeer::retrieveByPK($this->getRequestParameter('employee_id'));
     if ($employee) {
         $cd = new Criteria();
         $cd->add(EmployeeDetailPeer::EMPLOYEE_ID, $employee->getId());
         $employee_detail = EmployeeDetailPeer::doSelectOne($cd);
         if ($employee_detail->getEmployeeDivisionId()) {
             $employee_leave->setEmployeeDivisionId($employee_detail->getEmployeeDivisionId());
         }
         if ($employee->getDepartmentId()) {
             $employee_leave->setDepartmentId($employee->getDepartmentId());
         }
     }
     $employee_leave->setCode($this->getRequestParameter('code'));
     $employee_leave->setEmployeeLevelId($this->getRequestParameter('employee_level_id'));
     $employee_leave->setLeaveTypeId($this->getRequestParameter('leave_type_id'));
     $employee_leave->setLeaveLength($this->getRequestParameter('leave_length'));
     $employee_leave->setDetail($this->getRequestParameter('detail'));
     $employee_leave->setAddress($this->getRequestParameter('address'));
     $employee_leave->setStatus($this->getRequestParameter('status'));
     $employee_leave->setAcademicCalendarId($this->getRequestParameter('academic_calendar_id'));
     $employee_leave->save();
     return $this->redirect('employee_leave/list?employee_id=' . $this->getRequestParameter('employee_id'));
 }
Esempio n. 19
0
 public static function doSelectJoinAllExceptStudent(Criteria $c, $con = null)
 {
     $c = clone $c;
     if ($c->getDbName() == Propel::getDefaultDB()) {
         $c->setDbName(self::DATABASE_NAME);
     }
     MemberPeer::addSelectColumns($c);
     $startcol2 = MemberPeer::NUM_COLUMNS - MemberPeer::NUM_LAZY_LOAD_COLUMNS + 1;
     MemberDetailPeer::addSelectColumns($c);
     $startcol3 = $startcol2 + MemberDetailPeer::NUM_COLUMNS;
     DepartmentPeer::addSelectColumns($c);
     $startcol4 = $startcol3 + DepartmentPeer::NUM_COLUMNS;
     StaffTypePeer::addSelectColumns($c);
     $startcol5 = $startcol4 + StaffTypePeer::NUM_COLUMNS;
     EmployeeDetailPeer::addSelectColumns($c);
     $startcol6 = $startcol5 + EmployeeDetailPeer::NUM_COLUMNS;
     $c->addJoin(MemberPeer::MEMBER_DETAIL_ID, MemberDetailPeer::ID);
     $c->addJoin(MemberPeer::DEPARTMENT_ID, DepartmentPeer::ID);
     $c->addJoin(MemberPeer::STAFF_TYPE_ID, StaffTypePeer::ID);
     $c->addJoin(MemberPeer::EMPLOYEE_DETAIL_ID, EmployeeDetailPeer::ID);
     $rs = BasePeer::doSelect($c, $con);
     $results = array();
     while ($rs->next()) {
         $omClass = MemberPeer::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->addMember($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj2->initMembers();
             $obj2->addMember($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->addMember($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj3->initMembers();
             $obj3->addMember($obj1);
         }
         $omClass = StaffTypePeer::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->getStaffType();
             if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj4->addMember($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj4->initMembers();
             $obj4->addMember($obj1);
         }
         $omClass = EmployeeDetailPeer::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->getEmployeeDetail();
             if ($temp_obj5->getPrimaryKey() === $obj5->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj5->addMember($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj5->initMembers();
             $obj5->addMember($obj1);
         }
         $results[] = $obj1;
     }
     return $results;
 }
Esempio n. 20
0
 public function executeShowEmployeeSched2()
 {
     $employee = EmployeePeer::retrieveByPk($this->getRequestParameter('id'));
     $this->forward404Unless($employee);
     $this->subtitle = $employee->toString() . ' - id:' . $employee->getId();
     $c = new Criteria();
     $c->add(EmployeeDetailPeer::EMPLOYEE_ID, $employee->getId());
     $employee_detail = EmployeeDetailPeer::doSelectOne($c);
     $actions = array(array('name' => 'back', 'url' => 'student_schedule/listSched2', 'color' => 'black'));
     $this->setTemplate('showEmployee');
     $this->actions = $actions;
     $this->employee = $employee;
     $this->employee_detail = $employee_detail;
 }
Esempio n. 21
0
 public function executeShow()
 {
     $group_id = $this->getContext()->getUser()->getAttribute('group_id', null, 'bo');
     $c = new Criteria();
     $c->add(JobPeer::CODE, $this->getModuleName());
     $job = JobPeer::doSelectOne($c);
     $acl = AclPeer::retrieveByPK($group_id, $job->getId());
     if (!$acl) {
         $this->forward('default', 'error404');
     }
     $this->can_edit = $acl->getEditPriv() == 1;
     $this->can_remove = $acl->getRemovePriv() == 1;
     $employee_job_history = EmployeeJobHistoryPeer::retrieveByPk($this->getRequestParameter('id'));
     $this->forward404Unless($employee_job_history);
     $this->subtitle = $employee_job_history->toString() . ' - id:' . $employee_job_history->getId();
     $actions = array(array('name' => 'Kembali', 'url' => 'employee_job_history_o/list', 'color' => 'black'));
     if ($acl->getEditPriv()) {
         array_push($actions, array('name' => 'Ubah', 'url' => 'employee_job_history_o/edit?id=' . $employee_job_history->getId(), 'color' => 'blue'));
     }
     if ($acl->getRemovePriv()) {
         array_push($actions, array('name' => 'Hapus', 'url' => 'employee_job_history_o/delete?id=' . $employee_job_history->getId(), 'color' => 'red'));
     }
     $this->actions = $actions;
     $this->employee_job_history = $employee_job_history;
     $cd = new Criteria();
     $cd->add(EmployeeDetailPeer::EMPLOYEE_ID, $employee_job_history->getEmployeeId());
     $this->employee_detail = EmployeeDetailPeer::doSelectOne($cd);
 }
Esempio n. 22
0
        echo $i + ($pager->getPage() - 1) * $pager->getMaxPerPage();
        ?>
</td>
                            <td class='first'><?php 
        echo $employee_leave->getAcademicCalendarId() ? $employee_leave->getAcademicCalendar()->toString() : '-';
        ?>
</td>
                            <td align='left'><?php 
        echo $employee_leave->getEmployee() && $employee_leave->getEmployee()->getCode() ? $employee_leave->getEmployee()->getCode() : '-';
        ?>
</td>
                            <td align='left'>    
                                <?php 
        $c = new Criteria();
        $c->add(EmployeeDetailPeer::EMPLOYEE_ID, $employee_leave->getEmployeeId());
        $employee_detail = EmployeeDetailPeer::doSelectOne($c);
        echo $employee_detail->getExtraCode() ? $employee_detail->getExtraCode() : 'N/A';
        ?>
</td>
                            <td align='left'><?php 
        echo $employee_leave->getEmployee() && $employee_leave->getEmployee()->getName() ? $employee_leave->getEmployee()->getName() : '-';
        ?>
</td>
                            <td align="left"><?php 
        echo $employee_leave->getCode() ? $employee_leave->getCode() : '-';
        ?>
</td>
                            <td align="left"><?php 
        echo $employee_leave->getLeaveType() ? $employee_leave->getLeaveType()->toString() : '-';
        ?>
</td>
Esempio n. 23
0
 public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
 {
     $keys = EmployeeDetailPeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setId($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setEmployeeId($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setDateIn($arr[$keys[2]]);
     }
     if (array_key_exists($keys[3], $arr)) {
         $this->setDateOut($arr[$keys[3]]);
     }
     if (array_key_exists($keys[4], $arr)) {
         $this->setNickname($arr[$keys[4]]);
     }
     if (array_key_exists($keys[5], $arr)) {
         $this->setSex($arr[$keys[5]]);
     }
     if (array_key_exists($keys[6], $arr)) {
         $this->setPob($arr[$keys[6]]);
     }
     if (array_key_exists($keys[7], $arr)) {
         $this->setDob($arr[$keys[7]]);
     }
     if (array_key_exists($keys[8], $arr)) {
         $this->setReligionId($arr[$keys[8]]);
     }
     if (array_key_exists($keys[9], $arr)) {
         $this->setNationality($arr[$keys[9]]);
     }
     if (array_key_exists($keys[10], $arr)) {
         $this->setStatusInFamily($arr[$keys[10]]);
     }
     if (array_key_exists($keys[11], $arr)) {
         $this->setMotherLanguage($arr[$keys[11]]);
     }
     if (array_key_exists($keys[12], $arr)) {
         $this->setHobby($arr[$keys[12]]);
     }
     if (array_key_exists($keys[13], $arr)) {
         $this->setAddress($arr[$keys[13]]);
     }
     if (array_key_exists($keys[14], $arr)) {
         $this->setPhone($arr[$keys[14]]);
     }
     if (array_key_exists($keys[15], $arr)) {
         $this->setResidenceStatus($arr[$keys[15]]);
     }
     if (array_key_exists($keys[16], $arr)) {
         $this->setVehicle($arr[$keys[16]]);
     }
     if (array_key_exists($keys[17], $arr)) {
         $this->setWorkplaceDistance($arr[$keys[17]]);
     }
     if (array_key_exists($keys[18], $arr)) {
         $this->setLastEducation($arr[$keys[18]]);
     }
     if (array_key_exists($keys[19], $arr)) {
         $this->setGraduationYear($arr[$keys[19]]);
     }
     if (array_key_exists($keys[20], $arr)) {
         $this->setCertificateNumber($arr[$keys[20]]);
     }
     if (array_key_exists($keys[21], $arr)) {
         $this->setFaculty($arr[$keys[21]]);
     }
     if (array_key_exists($keys[22], $arr)) {
         $this->setProgram($arr[$keys[22]]);
     }
     if (array_key_exists($keys[23], $arr)) {
         $this->setMayor($arr[$keys[23]]);
     }
     if (array_key_exists($keys[24], $arr)) {
         $this->setTeachingLicense($arr[$keys[24]]);
     }
     if (array_key_exists($keys[25], $arr)) {
         $this->setSpouseName($arr[$keys[25]]);
     }
     if (array_key_exists($keys[26], $arr)) {
         $this->setBloodType($arr[$keys[26]]);
     }
     if (array_key_exists($keys[27], $arr)) {
         $this->setSpousePob($arr[$keys[27]]);
     }
     if (array_key_exists($keys[28], $arr)) {
         $this->setSpouseDob($arr[$keys[28]]);
     }
     if (array_key_exists($keys[29], $arr)) {
         $this->setSpouseEducation($arr[$keys[29]]);
     }
     if (array_key_exists($keys[30], $arr)) {
         $this->setSpouseReligionId($arr[$keys[30]]);
     }
     if (array_key_exists($keys[31], $arr)) {
         $this->setNumberOfChild($arr[$keys[31]]);
     }
     if (array_key_exists($keys[32], $arr)) {
         $this->setChild1Name($arr[$keys[32]]);
     }
     if (array_key_exists($keys[33], $arr)) {
         $this->setChild2Name($arr[$keys[33]]);
     }
     if (array_key_exists($keys[34], $arr)) {
         $this->setTall($arr[$keys[34]]);
     }
     if (array_key_exists($keys[35], $arr)) {
         $this->setWeight($arr[$keys[35]]);
     }
     if (array_key_exists($keys[36], $arr)) {
         $this->setIllness($arr[$keys[36]]);
     }
     if (array_key_exists($keys[37], $arr)) {
         $this->setContactDetail($arr[$keys[37]]);
     }
     if (array_key_exists($keys[38], $arr)) {
         $this->setEmployeeLevelId($arr[$keys[38]]);
     }
     if (array_key_exists($keys[39], $arr)) {
         $this->setMaritalStatusId($arr[$keys[39]]);
     }
     if (array_key_exists($keys[40], $arr)) {
         $this->setExtraCode($arr[$keys[40]]);
     }
     if (array_key_exists($keys[41], $arr)) {
         $this->setAccountNumber($arr[$keys[41]]);
     }
     if (array_key_exists($keys[42], $arr)) {
         $this->setEmployeeDivisionId($arr[$keys[42]]);
     }
     if (array_key_exists($keys[43], $arr)) {
         $this->setGroups($arr[$keys[43]]);
     }
     if (array_key_exists($keys[44], $arr)) {
         $this->setFingercode($arr[$keys[44]]);
     }
     if (array_key_exists($keys[45], $arr)) {
         $this->setStatus($arr[$keys[45]]);
     }
 }