public function edit($news_id) { //form validation $rules = array(array("field" => "input_newstype", "label" => "ประเภทข่าว", "rules" => "greater_than[0]"), array("field" => "input_topic", "label" => "หัวข้อข่าว", "rules" => "trim|required|max_length[200]")); $this->form_validation->set_rules($rules); $this->form_validation->set_message("greater_than", "- เลือกประเภทข่าว"); $this->form_validation->set_message("required", "- กรอกหัวข้อข่าว"); if ($this->form_validation->run() === true) { $this->_save_edit(); redirect("admin/News"); exit; } else { //get data news $query = $this->news->get_detail_by_id($news_id); $query = $query->row_array(); if (count($query) > 0) { //get data news image $query_image = $this->newsimage->get_list_by_news_id($news_id); $query_image = $query_image->result_array(); //set data $data = array(); $data["dropdownlist_newstype"] = $this->newstype->get_list_for_dropdownlist(); $data["value_newstype"] = $query["news_newstype_id"]; $data["value_topic"] = $query["news_topic"]; $data["value_detail"] = $query["news_detail"]; $data["value_show_start_date"] = dateThaiFormatUn543FromDB($query["news_show_start_date"]); $data["value_show_end_date"] = dateThaiFormatUn543FromDB($query["news_show_end_date"]); $data["value_news_image"] = $query_image; $data["value_news_id"] = $news_id; //load view parent::setHeaderAdmin($this->lang->line("title_page_news_edit")); $this->load->view("admin/News/Add", $data); parent::setFooterAdmin(); } else { redirect("admin/News"); } } }
<div class="row"> <div class="col s12 m8 offset-m2 l6 offset-l3 center-align"> <table class="bordered highlight"> <thead> <tr> <th>วันที่</th> <th>ชื่อวันหยุด</th> </tr> </thead> <tbody> <?php foreach ($query as $row) { ?> <tr> <td><?php echo dateThaiFormatUn543FromDB($row["HDate"]); ?> </td> <td><?php echo $row["HName"]; ?> </td> </tr> <?php } ?> </tbody> </table> </div> </div> </div>
"> <label for="txtStartDate">วันที่ขอลา</label> </div> <div class="input-field col s2"> <input readonly="true" type="text" id="txtStartTime" name="txtStartTime" value="<?php echo timeFormatNotSecond($leave_detail['LStartTime']); ?> "> <label for="txtStartTime">เวลา</label> </div> <div class="input-field col s2"> </div> <div class="input-field col s3"> <input readonly="true" type="text" id="txtEndDate" name="txtEndDate" value="<?php echo dateThaiFormatUn543FromDB($leave_detail['LEndDate']); ?> "> <label readonly="true" for="txtEndDate">ลาถึงวันที่</label> </div> <div class="input-field col s2"> <input readonly="true" type="text" id="txtEndTime" name="txtEndTime" value="<?php echo timeFormatNotSecond($leave_detail['LEndTime']); ?> "> <label for="txtEndTime">เวลา</label> </div> </div> </div> <div class="row">
public function Detail($empID) { if (!$this->acl->hasPermission("manage_employee")) { redirect("hr/Employees"); exit; } $user_id = 0; $data = $this->setDefaultDataPage(); $data["nowTitle"] = "แก้ไขข้อมูลพนักงาน"; $data["FormUrl"] = site_url("hr/Employees/EditEmployee"); $data["menu_sub_header"] = "Edit Employee"; $data["menu_header_medium"] = "Edit / แก้ไขข้อมูลพนักงาน"; $data["menu_header_small"] = "Edit / แก้ไขข้อมูลพนักงาน"; $query = $this->employees->getDetailByEmpID($empID); if ($query->num_rows() > 0) { $query = $query->result_array(); $query = $query[0]; $user_id = $query["UserID"]; $data["empID"] = $empID; $data['queryDepartment'] = $this->department->getListForDropdownlist(); $data["empDepartmentID"] = $query['Emp_DepartmentID']; $data["empSectionID"] = $query["Emp_SectionID"]; $data["empUnitID"] = $query["Emp_UnitID"]; $data["empGroupID"] = $query["Emp_GroupID"]; if ($data["empDepartmentID"] != 0) { $data["querySection"] = $this->section->getListForDropdownlist($data["empDepartmentID"]); if ($data["empSectionID"] != 0) { $data["queryUnit"] = $this->unit->getListForDropdownlist($data["empSectionID"]); if ($data["empUnitID"] != 0) { $data["queryGroup"] = $this->group->getListForDropdownlist($data["empUnitID"]); } } } $data['queryPosition'] = $this->position->getListForDropdownlist(); $data['empPositionID'] = $query['Emp_PositionID']; //get headman //gen headman dropdown by department $query_headman = $this->empheadman->get_list_by_user_id($user_id); $headman_rows = $query_headman->num_rows(); if ($headman_rows > 0) { $query_headman = $query_headman->result_array(); for ($i = 0; $i < $headman_rows; $i++) { $headman_level = $query_headman[$i]["eh_headman_level"]; $data["empHeadmanID_level_" . $query_headman[$i]["eh_headman_level"]] = $query_headman[$i]["eh_headman_user_id"]; if ($headman_level == 1) { $data["queryHeadman_level_1"] = $this->get_list_headman($data["empSectionID"], $data["empID"]); } else { if ($headman_level == 2) { $data["queryHeadman_level_2"] = $this->get_list_headman($data["empSectionID"], $data["empID"], $data["empHeadmanID_level_1"]); } else { $data["queryHeadman_level_3"] = $this->get_list_headman($data["empSectionID"], $data["empID"], $data["empHeadmanID_level_1"], $data["empHeadmanID_level_2"]); } } } } else { $data["queryHeadman_level_1"] = $this->get_list_headman($data["empSectionID"], $data["empID"]); } //dateThaiFormatFromDB is function from common_helper. $data['empStartWorkDate'] = dateThaiFormatUn543FromDB($query['EmpStartWorkDate']); $data['empSuccessTrialWorkDate'] = dateThaiFormatUn543FromDB($query['EmpSuccessTrialWorkDate']); $data['empSalary'] = $query['EmpSalary']; $data["empUsername"] = $query['Username']; $data["empPassword"] = $query['Password']; $data["empNameTitleThai"] = $query['EmpNameTitleThai']; $data["empFirstnameThai"] = $query['EmpFirstnameThai']; $data["empLastnameThai"] = $query['EmpLastnameThai']; $data["empNameTitleEnglish"] = $query['EmpNameTitleEnglish']; $data["empFirstnameEnglish"] = $query['EmpFirstnameEnglish']; $data["empLastnameEnglish"] = $query['EmpLastnameEnglish']; $data["empCallName"] = $query['EmpCallname']; $data["empTelePhone"] = $query['EmpTelephone']; $data["empMobilePhone"] = $query['EmpMobilePhone']; $data["empEmail"] = $query['EmpEmail']; $data["empBirthPlace"] = $query['EmpBirthPlace']; $data["empSex"] = $query['EmpSex']; $data["empHeight"] = $query['EmpHeight']; $data["empWeight"] = $query['EmpWeight']; $data["empBlood"] = $query['EmpBlood']; $data["empNationality"] = $query['EmpNationality']; $data["empRace"] = $query['EmpRace']; $data["empReligion"] = $query['EmpReligion']; $data["empMartialStatus"] = $query['Emp_MARSID']; $data["empMilitaryStatus"] = $query['EmpMilitaryStatus']; $data["empMilitaryReason"] = $query['EmpMilitaryReason']; $data["empNumberOfChildren"] = $query["EmpNumberOfChildren"]; $data["empNumberOfBrother"] = $query["EmpNumberOfBrother"]; $data["empIDCard"] = $query['EmpIDCard']; $data["empIDCardImg"] = $query['EmpIDCardImg']; $data["empAddressNumber"] = $query['EmpAddressNumber']; $data["empAddressMoo"] = $query['EmpAddressMoo']; $data["empAddressRoad"] = $query['EmpAddressRoad']; //bind dropdownlist district,amphur,province $data["empAddressProvince"] = $query['Emp_ProvinceID']; $data['queryAmphur'] = $this->amphur->getListForDropDown($data['empAddressProvince']); $data["empAddressAmphur"] = $query['Emp_AmphurID']; $data['queryDistrict'] = $this->district->getListForDropDown($data['empAddressProvince'], $data['empAddressAmphur']); $data["empAddressDistrict"] = $query['Emp_DistrictID']; $data['queryZipcode'] = $this->zipcode->getListForDropDown($data['empAddressProvince'], $data['empAddressAmphur'], $data['empAddressDistrict']); $data["empAddressZipcode"] = $query['Emp_ZipcodeID']; $data["empAddressImg"] = $query['EmpAddressImg']; $data["empPictureImg"] = $query['EmpPictureImg']; #### บุคคลอื่นที่ติดต่อได้ #### $data["empNameTitleFriend"] = $query['EmpFriendNameTitleThai']; $data["empFirstnameFriend"] = $query['EmpFriendFirstnameThai']; $data["empLastnameFriend"] = $query['EmpFriendLastnameThai']; $data["empAddressNumberFriend"] = $query['EmpFriendAddressNumber']; $data["empAddressMooFriend"] = $query['EmpFriendAddressMoo']; $data["empAddressRoadFriend"] = $query['EmpFriendAddressRoad']; $data["empAddressProvinceFriend"] = $query['EmpFriend_ProvinceID']; $data["empAddressAmphurFriend"] = $query['EmpFriend_AmphurID']; $data["empAddressDistrictFriend"] = $query['EmpFriend_DistrictID']; $data["empAddressZipcodeFriend"] = $query['EmpFriend_ZipcodeID']; if ($data['empAddressProvinceFriend'] != 0) { $data['queryAmphurFriend'] = $this->amphur->getListForDropDown($data['empAddressProvinceFriend']); $data['queryDistrictFriend'] = $this->district->getListForDropDown($data['empAddressProvinceFriend'], $data['empAddressAmphurFriend']); $data['queryZipcodeFriend'] = $this->zipcode->getListForDropDown($data['empAddressProvinceFriend'], $data['empAddressAmphurFriend'], $data['empAddressDistrictFriend']); } $data["empTelePhoneFriend"] = $query['EmpFriendTelephone']; $data["empMobilePhoneFriend"] = $query['EmpFriendMobilePhone']; #### ประวัติบิดา #### $data["empNameTitleFather"] = $query['EmpFatherNameTitleThai']; $data["empFirstnameFather"] = $query['EmpFatherFirstnameThai']; $data["empLastnameFather"] = $query['EmpFatherLastnameThai']; $data["empAddressNumberFather"] = $query['EmpFatherAddressNumber']; $data["empAddressMooFather"] = $query['EmpFatherAddressMoo']; $data["empAddressRoadFather"] = $query['EmpFatherAddressRoad']; $data["empAddressProvinceFather"] = $query['EmpFather_ProvinceID']; $data["empAddressAmphurFather"] = $query['EmpFather_AmphurID']; $data["empAddressDistrictFather"] = $query['EmpFather_DistrictID']; $data["empAddressZipcodeFather"] = $query['EmpFather_ZipcodeID']; if ($data['empAddressProvinceFather'] != 0) { $data['queryAmphurFather'] = $this->amphur->getListForDropDown($data['empAddressProvinceFather']); $data['queryDistrictFather'] = $this->district->getListForDropDown($data['empAddressProvinceFather'], $data['empAddressAmphurFather']); $data['queryZipcodeFather'] = $this->zipcode->getListForDropDown($data['empAddressProvinceFather'], $data['empAddressAmphurFather'], $data['empAddressDistrictFather']); } $data["empTelePhoneFather"] = $query['EmpFatherTelephone']; $data["empMobilePhoneFather"] = $query['EmpFatherMobilePhone']; #### ประวัติมารดา #### $data["empNameTitleMother"] = $query['EmpMotherNameTitleThai']; $data["empFirstnameMother"] = $query['EmpMotherFirstnameThai']; $data["empLastnameMother"] = $query['EmpMotherLastnameThai']; $data["empAddressNumberMother"] = $query['EmpMotherAddressNumber']; $data["empAddressMooMother"] = $query['EmpMotherAddressMoo']; $data["empAddressRoadMother"] = $query['EmpMotherAddressRoad']; $data["empAddressProvinceMother"] = $query['EmpMother_ProvinceID']; $data["empAddressAmphurMother"] = $query['EmpMother_AmphurID']; $data["empAddressDistrictMother"] = $query['EmpMother_DistrictID']; $data["empAddressZipcodeMother"] = $query['EmpMother_ZipcodeID']; if ($data['empAddressProvinceMother'] != 0) { $data['queryAmphurMother'] = $this->amphur->getListForDropDown($data['empAddressProvinceMother']); $data['queryDistrictMother'] = $this->district->getListForDropDown($data['empAddressProvinceMother'], $data['empAddressAmphurMother']); $data['queryZipcodeMother'] = $this->zipcode->getListForDropDown($data['empAddressProvinceMother'], $data['empAddressAmphurMother'], $data['empAddressDistrictMother']); } $data["empTelePhoneMother"] = $query['EmpMotherTelephone']; $data["empMobilePhoneMother"] = $query['EmpMotherMobilePhone']; #### ที่อยู่ตามทะเบียนบ้าน #### $data["empAddressNumberHouseReg"] = $query['EmpHouseRegAddressNumber']; $data["empAddressMooHouseReg"] = $query['EmpHouseRegAddressMoo']; $data["empAddressRoadHouseReg"] = $query['EmpHouseRegAddressRoad']; $data["empAddressProvinceHouseReg"] = $query['EmpHouseReg_ProvinceID']; $data["empAddressAmphurHouseReg"] = $query['EmpHouseReg_AmphurID']; $data["empAddressDistrictHouseReg"] = $query['EmpHouseReg_DistrictID']; $data["empAddressZipcodeHouseReg"] = $query['EmpHouseReg_ZipcodeID']; if ($data['empAddressProvinceHouseReg'] != 0) { $data['queryAmphurHouseReg'] = $this->amphur->getListForDropDown($data['empAddressProvinceHouseReg']); $data['queryDistrictHouseReg'] = $this->district->getListForDropDown($data['empAddressProvinceHouseReg'], $data['empAddressAmphurHouseReg']); $data['queryZipcodeHouseReg'] = $this->zipcode->getListForDropDown($data['empAddressProvinceHouseReg'], $data['empAddressAmphurHouseReg'], $data['empAddressDistrictHouseReg']); } #### เอกสารการสมัครงาน #### $data["empDocumentRegisterJobImg"] = $query['EmpDocRegisterJobImg']; #### วันเกิด #### $empBirthDay = $query['EmpBirthday']; if ($empBirthDay !== '0000-00-00' && $empBirthDay !== null) { $empBirthDay = array(); $empBirthDay = explode('-', $query['EmpBirthday']); $data["birthDayDay"] = $empBirthDay[2]; $data["birthDayMonth"] = $empBirthDay[1]; $data["birthDayYear"] = $empBirthDay[0]; } #### ธนาคาร #### $data["empBankID"] = $query['Emp_BankID']; $data["empBankType"] = $query['Emp_BankTypeID']; $data["empBankBranch"] = $query['EmpBankBranch']; $data["empBankNumber"] = $query['EmpBankNumber']; $data["empBankImg"] = $query['EmpBankImg']; #### ประวัติการทำงาน #### $query = $this->hiswork->get_list_by_user_id($user_id); $data["query_history_work"] = $query->result_array(); #### ประวัติการศึกษา #### $query = $this->hisstudy->get_list_by_user_id($user_id); $data["query_history_study"] = $query->result_array(); #### กะงาน #### $queryEmpShiftwork = $this->empshiftwork->getListByUserId($user_id); $data["queryEmpShiftwork"] = $queryEmpShiftwork->result_array(); } parent::setHeader('รายละเอียดพนักงาน', "HR", FALSE, FALSE); $this->load->view("hr/Employee/Register", $data); parent::setFooter(); }
public function edit($ot_id) { if ($_POST) { $this->_save($ot_id); exit; } $query = $this->ot->get_detail_by_id($ot_id)->row_array(); if (count($query) > 0) { $data = array(); $data["value_ot_date"] = dateThaiFormatUn543FromDB($query["wot_date"]); $data["value_ot_time_from"] = $query["wot_time_from"]; $data["value_ot_time_to"] = $query["wot_time_to"]; $data["value_ot_remark"] = $query["wot_remark"]; parent::setHeader("แก้ไขใบขอทำงานล่วงเวลา", "OT"); $this->load->view('worktime/ot_add', $data); parent::setFooter(); } }
public function edit($hid) { //form validation $rules = array(array("field" => "input_name", "label" => "ชื่อวันหยุด", "rules" => "trim|required|max_length[200]"), array("field" => "input_date", "label" => "วันหยุด", "rules" => "trim|required")); $this->form_validation->set_rules($rules); $this->form_validation->set_message("max_length", "- ข้อความไม่เกิน 200 ตัวอักษร"); $this->form_validation->set_message("required", "- กรอกหัวข้อข่าว"); if ($this->form_validation->run() === TRUE) { $this->_save(); redirect("hr/Holiday"); exit; } else { $query = $this->holiday->get_detail_by_id($hid); $query = $query->row_array(); $data = array(); $data["value_name"] = $query["HName"]; $data["value_desc"] = $query["HDesc"]; $data["value_date"] = dateThaiFormatUn543FromDB($query["HDate"]); $data["value_hid"] = $hid; parent::setHeader("แก้ไขวันหยุด", "HR"); $this->load->view("hr/Holiday/add", $data); parent::setFooter(); } }
public function edit($userID, $leaveID) { $this->load->model("Configuration_Model", "configuration"); $this->load->model("LeaveQuota_Model", "leavequota"); $query = $this->leave->getDetail($this->user_id, $leaveID); $query = $query->row_array(); $leaveTypeID = $query["L_LTID"]; $data = array(); $data['pagetype'] = 'edit'; if ($query["L_WFID"] == 11) { $data['pagetype'] = 'editdoc'; } $data["FormUrl"] = site_url("Leave/save"); $data["leaveID"] = $query["LID"]; $data["empID"] = $this->emp_id; $data["userID"] = $this->user_id; $data["nowTitle"] = "แก้ไขใบลา"; $data["title"] = $data["nowTitle"]; $data["ddlLeaveType"] = $this->leavetype->getListForDropDown(); $data["vddlLeaveType"] = $query["L_LTID"]; $data["queryEmployee"] = getEmployeeDetail($data["empID"]); $queryLeaveType = $this->leavetype->getDetailByID($leaveTypeID)->result_array(); $queryLeaveType = $queryLeaveType[0]; $queryQuota = $this->leavequota->getQuota($this->user_id, $leaveTypeID)->result_array(); $queryQuota = $queryQuota[0]; $quotaDetail = "<p>คุณมีสิทธิ์ในการลาได้ทั้งหมด " . $queryQuota["LQQuota"] . " วัน"; $quotaDetail .= "<br/>คุณใช้สิทธิ์ในการลาไปแล้ว " . $queryQuota["LQUsedDay"] . " วัน " . $queryQuota["LQUsedHour"] . " ชั่วโมง</p>"; $data["vdetailLeave"] = $queryLeaveType["LTDesc"] . $quotaDetail; $data["vleaveBecause"] = $query["LBecause"]; $queryWork = $this->configuration->getWorkTimeStartTimeEnd()->result_array(); $data["workTimeStart"] = $queryWork[0]["CFValue"]; $data["workTimeEnd"] = $queryWork[1]["CFValue"]; $queryWork = $this->configuration->getWorkDateStartDateEnd()->result_array(); $data["workDateStart"] = $queryWork[0]["CFValue"]; $data["workDateEnd"] = $queryWork[1]["CFValue"]; //ที่ใช้แตกต่างกับอันอื่นเพราะเป็นหน้าข้างในต่างหาก ไม่เหมือนพวกหน้ารายการ $data["vworkDateStart"] = dateThaiFormatUn543FromDB($query["LStartDate"]); $data["vworkDateEnd"] = dateThaiFormatUn543FromDB($query["LEndDate"]); $data["vworkTimeStart"] = timeFormatNotSecond($query["LStartTime"]); $data["vworkTimeEnd"] = timeFormatNotSecond($query["LEndTime"]); //get leave documents $query = $this->leavedoc->get_list_by_leave_id($leaveID); $data["query_leave_doc"] = $query->result_array(); parent::setHeader('แก้ไขใบลา', "Leave"); $this->load->view("Leave/Add", $data); parent::setFooter(); }