示例#1
0
 public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
 {
     $keys = EmployeeLeavePeer::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->setLeaveTypeId($arr[$keys[6]]);
     }
     if (array_key_exists($keys[7], $arr)) {
         $this->setCode($arr[$keys[7]]);
     }
     if (array_key_exists($keys[8], $arr)) {
         $this->setLeaveLength($arr[$keys[8]]);
     }
     if (array_key_exists($keys[9], $arr)) {
         $this->setStart($arr[$keys[9]]);
     }
     if (array_key_exists($keys[10], $arr)) {
         $this->setEnd($arr[$keys[10]]);
     }
     if (array_key_exists($keys[11], $arr)) {
         $this->setDetail($arr[$keys[11]]);
     }
     if (array_key_exists($keys[12], $arr)) {
         $this->setAddress($arr[$keys[12]]);
     }
     if (array_key_exists($keys[13], $arr)) {
         $this->setStatus($arr[$keys[13]]);
     }
 }
示例#2
0
 public function executeDelete()
 {
     $employee_leave = EmployeeLeavePeer::retrieveByPk($this->getRequestParameter('id'));
     $this->forward404Unless($employee_leave);
     $employee_id = $employee_leave->getEmployeeId();
     $ref_error = 0;
     foreach ($employee_leave->getRefCountMethods() as $ref) {
         $method = "count" . $ref['affix'];
         $count = $employee_leave->{$method}();
         if ($count > 0) {
             ++$ref_error;
             $this->getRequest()->setError('employee_leave/delete/' . sfInflector::camelize($ref['table']), $count);
         }
     }
     if ($ref_error > 0) {
         $this->getRequest()->setError('employee_leave/delete', '_ERR_DELETE_ (' . $employee_leave->toString() . ' - id:' . $employee_leave->getId() . ')');
     } else {
         $employee_leave->delete();
     }
     return $this->redirect('employee_leave/list?employee_id=' . $employee_id);
 }
示例#3
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(EmployeeLeavePeer::ID, $pks, Criteria::IN);
         $objs = EmployeeLeavePeer::doSelect($criteria, $con);
     }
     return $objs;
 }
示例#4
0
 public function getEmployeeLeavesJoinLeaveType($criteria = null, $con = null)
 {
     include_once 'lib/model/om/BaseEmployeeLeavePeer.php';
     if ($criteria === null) {
         $criteria = new Criteria();
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     if ($this->collEmployeeLeaves === null) {
         if ($this->isNew()) {
             $this->collEmployeeLeaves = array();
         } else {
             $criteria->add(EmployeeLeavePeer::EMPLOYEE_LEVEL_ID, $this->getId());
             $this->collEmployeeLeaves = EmployeeLeavePeer::doSelectJoinLeaveType($criteria, $con);
         }
     } else {
         $criteria->add(EmployeeLeavePeer::EMPLOYEE_LEVEL_ID, $this->getId());
         if (!isset($this->lastEmployeeLeaveCriteria) || !$this->lastEmployeeLeaveCriteria->equals($criteria)) {
             $this->collEmployeeLeaves = EmployeeLeavePeer::doSelectJoinLeaveType($criteria, $con);
         }
     }
     $this->lastEmployeeLeaveCriteria = $criteria;
     return $this->collEmployeeLeaves;
 }
示例#5
0
 public function executeShowLeave()
 {
     $employee_leave = EmployeeLeavePeer::retrieveByPk($this->getRequestParameter('id'));
     $this->forward404Unless($employee_leave);
     $this->subtitle = $employee_leave->toString() . ' - id:' . $employee_leave->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/listLeave?academic_calendar_id=' . $academic_calendar->getId() . '&department_id=' . $department->getId(), 'color' => 'black'));
     $this->actions = $actions;
     $this->employee_leave = $employee_leave;
     $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' => 'sun', 'type' => 'direct'));
     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' => '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_leave->getEmployeeId());
     $this->employee_detail = EmployeeDetailPeer::doSelectOne($cd);
     $this->academic_calendar = $academic_calendar;
     $this->department = $department;
 }
示例#6
0
 public function filterLeave($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, EmployeeLeavePeer::EMPLOYEE_ID);
             $c->addJoin(EmployeeDetailPeer::EMPLOYEE_ID, EmployeePeer::ID);
             $column = EmployeeDetailPeer::getTableMap()->getColumn('EXTRA_CODE');
         } elseif ($key == 'LEVEL') {
             $c->addJoin(EmployeeLevelPeer::ID, EmployeeLeavePeer::EMPLOYEE_LEVEL_ID);
             $column = EmployeeLevelPeer::getTableMap()->getColumn('LEVEL');
         } elseif ($key == 'EMP_NO') {
             $c->addJoin(EmployeePeer::ID, EmployeeLeavePeer::EMPLOYEE_ID);
             $column = EmployeePeer::getTableMap()->getColumn('CODE');
         } elseif ($key == 'EMP_NAME') {
             $c->addJoin(EmployeePeer::ID, EmployeeLeavePeer::EMPLOYEE_ID);
             $column = EmployeePeer::getTableMap()->getColumn('NAME');
         } else {
             $column = EmployeeLeavePeer::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);
                 }
             }
         }
     }
 }