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); } } } } }
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(EmployeePermitPeer::ID, $pks, Criteria::IN); $objs = EmployeePermitPeer::doSelect($criteria, $con); } return $objs; }
public function executeShowPermit() { $employee_permit = EmployeePermitPeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($employee_permit); $this->subtitle = $employee_permit->toString() . ' - id:' . $employee_permit->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/lisPermit?academic_calendar_id=' . $academic_calendar->getId() . '&department_id=' . $department->getId(), 'color' => 'black')); $this->actions = $actions; $this->employee_permit = $employee_permit; $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' => 'sun', 'type' => 'direct')); array_push($actions2, array('name' => '<span>Pengobatan</span>', 'url' => 'employee_report/listMedical?academic_calendar_id=' . $academic_calendar->getId() . '&department_id=' . $department->getId(), 'color' => 'sky')); 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; }
public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = EmployeePermitPeer::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->setDepartmentId($arr[$keys[2]]); } if (array_key_exists($keys[3], $arr)) { $this->setAcademicCalendarId($arr[$keys[3]]); } if (array_key_exists($keys[4], $arr)) { $this->setEmployeeLevelId($arr[$keys[4]]); } if (array_key_exists($keys[5], $arr)) { $this->setEmployeeDivisionId($arr[$keys[5]]); } if (array_key_exists($keys[6], $arr)) { $this->setCode($arr[$keys[6]]); } if (array_key_exists($keys[7], $arr)) { $this->setLeaveLength($arr[$keys[7]]); } if (array_key_exists($keys[8], $arr)) { $this->setStart($arr[$keys[8]]); } if (array_key_exists($keys[9], $arr)) { $this->setEnd($arr[$keys[9]]); } if (array_key_exists($keys[10], $arr)) { $this->setDetail($arr[$keys[10]]); } if (array_key_exists($keys[11], $arr)) { $this->setAddress($arr[$keys[11]]); } if (array_key_exists($keys[12], $arr)) { $this->setStatus($arr[$keys[12]]); } }
public function executeDelete() { $employee_permit = EmployeePermitPeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($employee_permit); $employee_id = $employee_permit->getEmployeeId(); $ref_error = 0; foreach ($employee_permit->getRefCountMethods() as $ref) { $method = "count" . $ref['affix']; $count = $employee_permit->{$method}(); if ($count > 0) { ++$ref_error; $this->getRequest()->setError('employee_permit/delete/' . sfInflector::camelize($ref['table']), $count); } } if ($ref_error > 0) { $this->getRequest()->setError('employee_permit/delete', '_ERR_DELETE_ (' . $employee_permit->toString() . ' - id:' . $employee_permit->getId() . ')'); } else { $employee_permit->delete(); } return $this->redirect('employee_permit/list?employee_id=' . $employee_id); }