public function executeDeleteChild() { $employee = EmployeePeer::retrieveByPk($this->getRequestParameter('employee_id')); $this->forward404Unless($employee); $empl_child = EmployeeChildsPeer::retrieveByPK($this->getRequestParameter('id')); $this->forward404Unless($empl_child); $empl_child->delete(); return $this->redirect('employee/edit?id=' . $employee->getId()); }
</thead> <tbody> <?php $i = 0; while ($i < 5) { $i++; ?> <tr> <td style="text-align: center;"><?php echo $i . '.'; ?> </td> <?php $id_child = $childs[$i]; $emplo_child = EmployeeChildsPeer::retrieveByPK($id_child); ?> <td><?php echo $emplo_child ? $emplo_child->getName() ? $emplo_child->getName() : '' : ''; ?> </td> <td> <?php echo $emplo_child ? $emplo_child->getPob() ? $emplo_child->getPob() . ', ' : '' : ''; ?> <?php echo $emplo_child ? $emplo_child->getDob() ? DateToIndo($emplo_child->getDob()) : '' : ''; ?> </td> <td>
public function executeSimpan() { $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_childs = new EmployeeChilds(); } else { $employee_childs = EmployeeChildsPeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($employee_childs); } $employee_childs->setId($this->getRequestParameter('id')); $employee_childs->setEmployeeId($this->getRequestParameter('employee_id')); if ($this->getRequestParameter('dob')) { $employee_childs->setDob($this->getRequestParameter('dob')); } $employee_childs->setName($this->getRequestParameter('name')); $employee_childs->setPob($this->getRequestParameter('pob')); $employee_childs->setReligionId($this->getRequestParameter('religion_id')); $employee_childs->setRelation($this->getRequestParameter('relation')); $employee_childs->setSex($this->getRequestParameter('sex')); $employee_childs->save(); return $this->redirect('user_profile_l/listChilds?employee_id=' . $this->getRequestParameter('employee_id')); }
public function executeShowEmployee() { $group_id = $this->getContext()->getUser()->getAttribute('group_id', null, 'bo'); $c = new Criteria(); #$c->add(JobPeer::CODE, $this->getModuleName()); $c->add(JobPeer::ID, 208); $job = JobPeer::doSelectOne($c); $acl = AclPeer::retrieveByPK($group_id, $job->getId()); if (!$acl) { $this->forward('default', 'error404'); } #$member = MemberPeer::retrieveByPk($this->getRequestParameter('id')); #$this->forward404Unless($member); #$this->subtitle = $member->toString().' - id:'.$member->getId(); $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); if ($this->hasRequestParameter('no_reg') && $this->getRequestParameter('no_reg') != '' && $this->getRequestParameter('no_reg') != null) { $actions = array(array('name' => 'back', 'url' => 'member/listEmployee?filters[NO_REG]=' . $this->getRequestParameter('no_reg'), 'color' => 'white')); } elseif ($this->hasRequestParameter('code') && $this->getRequestParameter('code') != '' && $this->getRequestParameter('code') != null) { $actions = array(array('name' => 'back', 'url' => 'member/listEmployee?filters[CODE]=' . $this->getRequestParameter('code'), 'color' => 'white')); } elseif ($this->hasRequestParameter('dept_id') && $this->getRequestParameter('dept_id') != '' && $this->getRequestParameter('dept_id') != null) { $actions = array(array('name' => 'back', 'url' => 'member/listEmployee?filters[DEPARTMENT_ID]=' . $this->getRequestParameter('dept_id'), 'color' => 'white')); } elseif ($this->hasRequestParameter('staff_type') && $this->getRequestParameter('staff_type') != '' && $this->getRequestParameter('staff_type') != null) { $actions = array(array('name' => 'back', 'url' => 'member/listEmployee?filters[STAFF_TYPE_ID]=' . $this->getRequestParameter('staff_type'), 'color' => 'white')); } elseif ($this->hasRequestParameter('name') && $this->getRequestParameter('name') != '' && $this->getRequestParameter('name') != null) { $actions = array(array('name' => 'back', 'url' => 'member/listEmployee?filters[NAME]=' . $this->getRequestParameter('name'), 'color' => 'white')); } else { $actions = array(array('name' => 'back', 'url' => 'member/listEmployee', 'color' => 'white')); } $this->actions = $actions; $this->employee = $employee; $this->employee_detail = $employee_detail; #Father $cw = new Criteria(); $cw->add(EmployeeParentsPeer::EMPLOYEE_ID, $employee->getId()); $cw->add(EmployeeParentsPeer::RELATION, EmployeeParents::RELATION_FATHER); $father = EmployeeParentsPeer::doSelectOne($cw); if ($father == null) { $father = new EmployeeParents(); } #Mother $ct = new Criteria(); $ct->add(EmployeeParentsPeer::EMPLOYEE_ID, $employee->getId()); $ct->add(EmployeeParentsPeer::RELATION, EmployeeParents::RELATION_MOTHER); $mother = EmployeeParentsPeer::doSelectOne($ct); if ($mother == null) { $mother = new EmployeeParents(); } #Father In Law $cwi = new Criteria(); $cwi->add(EmployeeParentsPeer::EMPLOYEE_ID, $employee->getId()); $cwi->add(EmployeeParentsPeer::RELATION, EmployeeParents::RELATION_FATHER_INLAW); $father_inlaw = EmployeeParentsPeer::doSelectOne($cwi); if ($father_inlaw == null) { $father_inlaw = new EmployeeParents(); } #Mother In Law $cti = new Criteria(); $cti->add(EmployeeParentsPeer::EMPLOYEE_ID, $employee->getId()); $cti->add(EmployeeParentsPeer::RELATION, EmployeeParents::RELATION_MOTHER_INLAW); $mother_inlaw = EmployeeParentsPeer::doSelectOne($cti); if ($mother_inlaw == null) { $mother_inlaw = new EmployeeParents(); } $this->father = $father; $this->mother = $mother; $this->father_inlaw = $father_inlaw; $this->mother_inlaw = $mother_inlaw; $cli = new Criteria(); $cli->add(EmployeeChildsPeer::EMPLOYEE_ID, $employee->getId()); $employee_childs = EmployeeChildsPeer::doSelect($cli); $childs = array(); foreach ($employee_childs as $emp_child) { $childs[$emp_child->getRelation()] = $emp_child->getId(); } $this->childs = $childs; $this->employee_childs = $employee_childs; }
public function executeEdit() { $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_add = $acl->getAddPriv() == 1; $this->can_edit = $acl->getEditPriv() == 1; $this->can_remove = $acl->getRemovePriv() == 1; $employee = EmployeePeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($employee); $c = new Criteria(); $c->add(EmployeeDetailPeer::EMPLOYEE_ID, $employee->getId()); $employee_detail = EmployeeDetailPeer::doSelectOne($c); $actions = array(array('name' => 'save', 'type' => 'submit', 'options' => array('class' => 'save_button', 'onclick' => "action_type.value=this.value"))); if ($acl->getRemovePriv()) { array_push($actions, array('name' => 'delete', 'url' => 'employee/delete?id=' . $employee->getId(), 'color' => 'red')); } array_push($actions, array('name' => 'cancel', 'url' => 'employee/list', 'color' => 'black')); $this->subtitle = $employee->toString() . ' - id:' . $employee->getId(); $this->type = 'edit'; $this->employee = $employee; $this->employee_detail = $employee_detail; $this->actions = $actions; #Father $cw = new Criteria(); $cw->add(EmployeeParentsPeer::EMPLOYEE_ID, $employee->getId()); $cw->add(EmployeeParentsPeer::RELATION, EmployeeParents::RELATION_FATHER); $father = EmployeeParentsPeer::doSelectOne($cw); if ($father == null) { $father = new EmployeeParents(); } #Mother $ct = new Criteria(); $ct->add(EmployeeParentsPeer::EMPLOYEE_ID, $employee->getId()); $ct->add(EmployeeParentsPeer::RELATION, EmployeeParents::RELATION_MOTHER); $mother = EmployeeParentsPeer::doSelectOne($ct); if ($mother == null) { $mother = new EmployeeParents(); } #Father In Law $cwi = new Criteria(); $cwi->add(EmployeeParentsPeer::EMPLOYEE_ID, $employee->getId()); $cwi->add(EmployeeParentsPeer::RELATION, EmployeeParents::RELATION_FATHER_INLAW); $father_inlaw = EmployeeParentsPeer::doSelectOne($cwi); if ($father_inlaw == null) { $father_inlaw = new EmployeeParents(); } #Mother In Law $cti = new Criteria(); $cti->add(EmployeeParentsPeer::EMPLOYEE_ID, $employee->getId()); $cti->add(EmployeeParentsPeer::RELATION, EmployeeParents::RELATION_MOTHER_INLAW); $mother_inlaw = EmployeeParentsPeer::doSelectOne($cti); if ($mother_inlaw == null) { $mother_inlaw = new EmployeeParents(); } $this->father = $father; $this->mother = $mother; $this->father_inlaw = $father_inlaw; $this->mother_inlaw = $mother_inlaw; $cli = new Criteria(); $cli->add(EmployeeChildsPeer::EMPLOYEE_ID, $employee->getId()); $employee_childs = EmployeeChildsPeer::doSelect($cli); $childs = array(); foreach ($employee_childs as $emp_child) { $childs[$emp_child->getRelation()] = $emp_child->getId(); } $this->childs = $childs; $this->employee_childs = $employee_childs; }
public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = EmployeeChildsPeer::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->setName($arr[$keys[2]]); } if (array_key_exists($keys[3], $arr)) { $this->setPob($arr[$keys[3]]); } if (array_key_exists($keys[4], $arr)) { $this->setDob($arr[$keys[4]]); } if (array_key_exists($keys[5], $arr)) { $this->setSex($arr[$keys[5]]); } if (array_key_exists($keys[6], $arr)) { $this->setReligionId($arr[$keys[6]]); } if (array_key_exists($keys[7], $arr)) { $this->setRelation($arr[$keys[7]]); } }
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(EmployeeChildsPeer::ID, $pks, Criteria::IN); $objs = EmployeeChildsPeer::doSelect($criteria, $con); } return $objs; }