public function parseUpdateData($postArr) { $leaveId = $postArr['leaveId']; $leaveStatus = $postArr['leaveStatus']; $leaveComments = $postArr['leaveComments']; $leaveYear = $postArr['leaveYear']; $noHours = $postArr['noHours']; $leaveTypeId = $postArr['leaveTypeId']; $employeeId = $postArr['employeeId']; $objArr = null; for ($i = 0; $i < count($leaveId); $i++) { if ($leaveStatus[$i] == 0) { $updateValues = new LeaveTakenRequests(); $updateValues->setLeaveId($leaveId[$i]); $updateValues->setLeaveStatus($leaveStatus[$i]); $updateValues->setLeaveComments($leaveComments[$i]); $updateValues->setLeaveYear($leaveYear[$i]); $updateValues->setNoHours($noHours[$i]); $updateValues->setLeaveTypeId($leaveTypeId[$i]); $updateValues->setEmployeeID($employeeId[$i]); $objArr[] = $updateValues; } } return $objArr; }
protected function _buildObjArr($result) { if (!$result) { return false; } $objArr = null; while ($row = mysql_fetch_array($result)) { $leaveTakenArray = new LeaveTakenRequests(); $leaveTakenArray->setLeaveId($row['leave_id']); $leaveTakenArray->setLeaveDate($row['leave_date']); $leaveTakenArray->setEmployeeName($row['emp_firstname'] . " " . $row['emp_lastname']); $leaveTakenArray->setNoHours($row['leave_length_hours']); $leaveTakenArray->setLeaveComments($row['leave_comments']); $leaveTakenArray->setLeaveTypeId($row['leave_type_id']); $leaveTakenArray->setLeaveTypeName($row['leave_type_name']); $leaveTakenArray->setEmployeeId($row['employee_id']); $objArr[] = $leaveTakenArray; } return $objArr; }