Пример #1
0
 public function parseEditData($postArr)
 {
     $historyItems = array();
     $empNum = trim($postArr['txtEmpID']);
     // Get job title history
     if (isset($postArr['jobTitleHisId'])) {
         $jobTitleIds = $postArr['jobTitleHisId'];
         $jobTitleCodes = $postArr['jobTitleHisCode'];
         $jobTitleFromDates = $postArr['jobTitleHisFromDate'];
         $jobTitleToDates = $postArr['jobTitleHisToDate'];
         for ($i = 0; $i < count($jobTitleIds); $i++) {
             $history = new JobTitleHistory();
             $id = $jobTitleIds[$i];
             $code = $jobTitleCodes[$i];
             $startDate = LocaleUtil::getInstance()->convertToStandardDateFormat($jobTitleFromDates[$i]);
             $endDate = LocaleUtil::getInstance()->convertToStandardDateFormat($jobTitleToDates[$i]);
             $history->setId($id);
             $history->setCode($code);
             $history->setEmpNumber($empNum);
             $history->setStartDate($startDate);
             $history->setEndDate($endDate);
             $historyItems[] = $history;
         }
     }
     // Get sub division history
     if (isset($postArr['subDivHisId'])) {
         $subDivIds = $postArr['subDivHisId'];
         $subDivCodes = $postArr['subDivHisCode'];
         $subDivFromDates = $postArr['subDivHisFromDate'];
         $subDivToDates = $postArr['subDivHisToDate'];
         for ($i = 0; $i < count($subDivIds); $i++) {
             $history = new SubDivisionHistory();
             $id = $subDivIds[$i];
             $code = $subDivCodes[$i];
             $startDate = LocaleUtil::getInstance()->convertToStandardDateFormat($subDivFromDates[$i]);
             $endDate = LocaleUtil::getInstance()->convertToStandardDateFormat($subDivToDates[$i]);
             $history->setId($id);
             $history->setCode($code);
             $history->setEmpNumber($empNum);
             $history->setStartDate($startDate);
             $history->setEndDate($endDate);
             $historyItems[] = $history;
         }
     }
     // Get location history
     if (isset($postArr['locHisId'])) {
         $locIds = $postArr['locHisId'];
         $locCodes = $postArr['locHisCode'];
         $locFromDates = $postArr['locHisFromDate'];
         $locToDates = $postArr['locHisToDate'];
         for ($i = 0; $i < count($locIds); $i++) {
             $history = new LocationHistory();
             $id = $locIds[$i];
             $startDate = LocaleUtil::getInstance()->convertToStandardDateFormat($locFromDates[$i]);
             $endDate = LocaleUtil::getInstance()->convertToStandardDateFormat($locToDates[$i]);
             $history->setId($id);
             $code = $locCodes[$i];
             $history->setCode($code);
             $history->setEmpNumber($empNum);
             $history->setStartDate($startDate);
             $history->setEndDate($endDate);
             $historyItems[] = $history;
         }
     }
     return $historyItems;
 }
Пример #2
0
 /**
  * Gets a sub division history object with the given parameters
  */
 private function _getSubDivisionHistory($empNum, $subDivisionCode, $jobTitleName, $startDate, $endDate)
 {
     if (!empty($startDate)) {
         $startDate = date(LocaleUtil::STANDARD_TIMESTAMP_FORMAT, strtotime($startDate));
     }
     if (!empty($endDate)) {
         $endDate = date(LocaleUtil::STANDARD_TIMESTAMP_FORMAT, strtotime($endDate));
     }
     $jobHis = new SubDivisionHistory();
     $jobHis->setEmpNumber($empNum);
     $jobHis->setCode($subDivisionCode);
     $jobHis->setName($jobTitleName);
     $jobHis->setStartDate($startDate);
     $jobHis->setEndDate($endDate);
     return $jobHis;
 }