Exemplo n.º 1
0
 /**
  * Pares edit data in the UI form
  *
  * @param mixed $postArr
  * @return Leave[]
  */
 public function parseEditData($postArr)
 {
     $objLeave = null;
     for ($i = 0; $i < count($postArr['txtLeaveTypeId']); $i++) {
         $tmpObj = new LeaveQuota();
         $tmpObj->setYear($postArr['year']);
         $tmpObj->setEmployeeId($postArr['txtEmployeeId'][$i]);
         $tmpObj->setLeaveTypeId($postArr['txtLeaveTypeId'][$i]);
         $tmpObj->setNoOfDaysAllotted($postArr['txtLeaveEntitled'][$i]);
         $objLeave[] = $tmpObj;
     }
     return $objLeave;
 }
 /**
  * Apply leave Quota multiple Years
  *
  */
 private function _addLeaveQuota()
 {
     $fromYearArray = explode("-", $this->getLeaveFromDate());
     $toYearArray = explode("-", $this->getLeaveToDate());
     if (trim($fromYearArray[0]) == trim($toYearArray[0])) {
         $leaveQuata = new LeaveQuota();
         $leaveQuata->setEmployeeId($this->getEmployeeId());
         $leaveQuata->setLeaveTypeId($this->getLeaveTypeId());
         $leaveQuata->setNoOfDaysAllotted(0);
         $leaveQuata->setYear(trim($fromYearArray[0]));
         if ($leaveQuata->addLeaveQuotaAdmin()) {
             return true;
         } else {
             return false;
         }
     } else {
         $leaveQuata = new LeaveQuota();
         $leaveQuata->setEmployeeId($this->getEmployeeId());
         $leaveQuata->setLeaveTypeId($this->getLeaveTypeId());
         $leaveQuata->setNoOfDaysAllotted(0);
         $leaveQuata->setYear(trim($fromYearArray[0]));
         $quotaFrom = $leaveQuata->addLeaveQuotaAdmin();
         $leaveQuata->setYear(trim($toYearArray[0]));
         $quotaTo = $leaveQuata->addLeaveQuotaAdmin();
         if ($quotaFrom && $quotaTo) {
             return true;
         } else {
             return false;
         }
     }
 }
Exemplo n.º 3
0
 protected function _buildObjArr($result)
 {
     $objArr = null;
     while ($row = mysql_fetch_row($result)) {
         $tmpLeaveArr = new LeaveQuota();
         $tmpLeaveArr->setYear($row[0]);
         $tmpLeaveArr->setLeaveTypeId($row[1]);
         $tmpLeaveArr->setLeaveTypeName($row[2]);
         $tmpLeaveArr->setNoOfDaysAllotted($row[3]);
         $objArr[] = $tmpLeaveArr;
     }
     return $objArr;
 }