예제 #1
0
 public function executeGetChild()
 {
     $id = $this->getRequestParameter('id');
     $accal_id = $this->getRequestParameter('accal_id');
     $groups = $this->getRequestParameter('groups');
     $regulation_type = $this->getRequestParameter('regulation_type');
     $level = $this->getRequestParameter('level');
     if ($level == null) {
         $level = 0;
     }
     $group_id = $this->getContext()->getUser()->getAttribute('group_id', null, 'bo');
     $cd = new Criteria();
     $cd->add(JobPeer::CODE, $this->getModuleName());
     $job = JobPeer::doSelectOne($cd);
     $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;
     $c = new Criteria();
     $c->addJoin(EmployeeRegulationPeer::STAFF_TYPE_ID, StaffTypePeer::ID);
     $c->add(EmployeeRegulationPeer::ACADEMIC_CALENDAR_ID, $accal_id);
     $c->add(EmployeeRegulationPeer::GROUPS, $groups);
     $c->add(EmployeeRegulationPeer::REGULATION_TYPE, $regulation_type);
     $c->addAscendingOrderByColumn(EmployeeRegulationPeer::ID);
     $this->rows = EmployeeRegulationPeer::doSelect($c);
     $this->level = $level + 1;
     $this->parent_id = $id;
     $this->parent_class = $this->getRequestParameter('parent_class');
     $this->reg_type = $regulation_type;
 }
예제 #2
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(EmployeeRegulationPeer::ID, $pks, Criteria::IN);
         $objs = EmployeeRegulationPeer::doSelect($criteria, $con);
     }
     return $objs;
 }
예제 #3
0
 public function getEmployeeRegulations($criteria = null, $con = null)
 {
     include_once 'lib/model/om/BaseEmployeeRegulationPeer.php';
     if ($criteria === null) {
         $criteria = new Criteria();
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     if ($this->collEmployeeRegulations === null) {
         if ($this->isNew()) {
             $this->collEmployeeRegulations = array();
         } else {
             $criteria->add(EmployeeRegulationPeer::EMPLOYEE_LEVEL_ID, $this->getId());
             EmployeeRegulationPeer::addSelectColumns($criteria);
             $this->collEmployeeRegulations = EmployeeRegulationPeer::doSelect($criteria, $con);
         }
     } else {
         if (!$this->isNew()) {
             $criteria->add(EmployeeRegulationPeer::EMPLOYEE_LEVEL_ID, $this->getId());
             EmployeeRegulationPeer::addSelectColumns($criteria);
             if (!isset($this->lastEmployeeRegulationCriteria) || !$this->lastEmployeeRegulationCriteria->equals($criteria)) {
                 $this->collEmployeeRegulations = EmployeeRegulationPeer::doSelect($criteria, $con);
             }
         }
     }
     $this->lastEmployeeRegulationCriteria = $criteria;
     return $this->collEmployeeRegulations;
 }
예제 #4
0
 public function executeList()
 {
     $group_id = $this->getContext()->getUser()->getAttribute('group_id', null, 'bo');
     $cd = new Criteria();
     $cd->add(JobPeer::CODE, $this->getModuleName());
     $job = JobPeer::doSelectOne($cd);
     $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;
     $c = new Criteria();
     $dept = $this->getContext()->getUser()->getAttribute('department', null, 'bo');
     $c->add(EmployeePeer::DEPARTMENT_ID, $dept->getChildRecurs(), Criteria::IN);
     $c->addJoin(VEmployeeMedicalPeer::EMPLOYEE_ID, EmployeePeer::ID);
     $this->sort($c);
     if ($this->getRequest()->hasParameter('filters')) {
         $filters = $this->getRequestParameter('filters');
         if ($filters == 'clear') {
             $this->filters = null;
         } else {
             $defined_filter = false;
             foreach ($filters as $f) {
                 if (is_array($f)) {
                     if (strlen($f['from']) > 0 || strlen($f['to']) > 0) {
                         $defined_filter = true;
                         break;
                     }
                 } else {
                     if ($f != null && $f != '') {
                         $defined_filter = true;
                         break;
                     }
                 }
             }
             if ($defined_filter) {
                 $this->filters = $filters;
                 $this->filter($c, $this->getRequestParameter('filters'));
             }
         }
     }
     $rpp = $this->getRequestParameter('max_per_page', $this->getUser()->getAttribute('max_per_page', ParamsPeer::retrieveByCode('row_per_page')->getValue(), 'emp_medical'));
     $this->getUser()->setAttribute('max_per_page', $rpp, 'emp_medical');
     $pager = new sfPropelPager('VEmployeeMedical', $rpp);
     $pager->setCriteria($c);
     $page = $this->getRequestParameter('page', $this->getUser()->getAttribute('page', 1, 'emp_medical'));
     $this->getUser()->setAttribute('page', $page, 'emp_medical');
     $pager->setPage($page);
     $pager->init();
     $this->pager = $pager;
     $actions = array();
     $filter_string = "";
     if ($this->filters) {
         foreach ($this->filters as $key => $val) {
             $filter_string .= "&filters[{$key}]={$val}";
         }
         $filter_string = preg_replace('/^&/', '', $filter_string);
     }
     array_unshift($actions, array('name' => 'Print Excel', 'url' => "employee_medical_recapt/listAsCSV?{$filter_string}", 'color' => 'black', 'type' => 'direct'));
     array_unshift($actions, array('name' => 'Print PDF', 'url' => "employee_medical_recapt/listAsPDF?{$filter_string}", 'color' => 'black', 'type' => 'direct'));
     $this->actions = $actions;
     $this->subtitle = '';
     $cli = new Criteria();
     $cli->add(EmployeeRegulationPeer::REGULATION_TYPE, EmployeeRegulation::MEDICAL);
     $employ_regulations = EmployeeRegulationPeer::doSelect($cli);
     $accals = array();
     $levels = array();
     $groups = array();
     $types = array();
     $alls = array();
     foreach ($employ_regulations as $emp_reg) {
         $accals[$emp_reg->getAcademicCalendarId()] = $emp_reg->getAmountSubsidy();
         $levels[$emp_reg->getAcademicCalendarId() . '#' . $emp_reg->getEmployeeLevelId()] = $emp_reg->getAmountSubsidy();
         $groups[$emp_reg->getAcademicCalendarId() . '#' . $emp_reg->getGroups()] = $emp_reg->getAmountSubsidy();
         $types[$emp_reg->getAcademicCalendarId() . '#' . $emp_reg->getStaffTypeId()] = $emp_reg->getAmountSubsidy();
         $alls[$emp_reg->getAcademicCalendarId() . '#' . $emp_reg->getStaffTypeId() . '#' . $emp_reg->getEmployeeLevelId() . '#' . $emp_reg->getGroups()] = $emp_reg->getAmountSubsidy();
     }
     $this->employ_regulations = $employ_regulations;
     $this->alls = $alls;
     $this->accals = $accals;
     $this->levels = $levels;
     $this->groups = $groups;
     $this->types = $types;
 }
예제 #5
0
 public function executePrintAbsenceXLS()
 {
     $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);
     $month_id = $this->getRequestParameter('month_id');
     $month = MonthPeer::retrieveByPK($month_id);
     $this->forward404Unless($month);
     $tgl_absen1 = $this->getRequestParameter('tgl_absen1');
     $tgl_absen2 = $this->getRequestParameter('tgl_absen2');
     $time = $this->getRequestParameter('time');
     $time2 = $this->getRequestParameter('time2');
     $tgl_cetak = $this->getRequestParameter('tgl_cetak');
     $cr = new Criteria();
     $cr->add(TempTablePeer::COUNSELING_ID, $academic_calendar->getId());
     $cr->add(TempTablePeer::STUDENT_ID, $department->getId());
     $cr->add(TempTablePeer::TIME, $time);
     $cr->addJoin(EmployeePeer::ID, TempTablePeer::EMPLOYEE_ID);
     $cr->addAscendingOrderByColumn(EmployeePeer::ID);
     $employees = EmployeePeer::doSelect($cr);
     $this->academic_calendar = $academic_calendar;
     $this->department = $department;
     $this->time = $time;
     $this->time2 = $time2;
     $this->tgl_cetak = $tgl_cetak;
     $this->tgl_absen1 = $tgl_absen1;
     $this->tgl_absen2 = $tgl_absen2;
     $this->employees = $employees;
     $this->month = $month;
     $cli = new Criteria();
     $cli->add(EmployeeRegulationPeer::REGULATION_TYPE, EmployeeRegulation::ABSENCE);
     $employ_regulations = EmployeeRegulationPeer::doSelect($cli);
     $groups = array();
     $types = array();
     $alls = array();
     foreach ($employ_regulations as $emp_reg) {
         $groups[$emp_reg->getAcademicCalendarId() . '#' . $emp_reg->getGroups()] = $emp_reg->getId();
         $types[$emp_reg->getAcademicCalendarId() . '#' . $emp_reg->getStaffTypeId()] = $emp_reg->getId();
         $alls[$emp_reg->getAcademicCalendarId() . '#' . $emp_reg->getStaffTypeId() . '#' . $emp_reg->getGroups()] = $emp_reg->getId();
     }
     $this->employ_regulations = $employ_regulations;
     $this->alls = $alls;
     $this->groups = $groups;
     $this->types = $types;
     $this->setLayout(false);
     $this->getResponse()->setHttpHeader('Content-Type', 'application/vnd-ms-excel');
     $this->getResponse()->setHttpHeader('Content-Disposition', 'attachment; filename="' . $this->getModuleName() . '.xls"');
 }