예제 #1
0
 /**
  * Pares delete data in the UI form
  *
  * @param mixed $postArr
  * @return Leave[]
  */
 public function parseDeleteData($postArr)
 {
     $objLeave = null;
     if (isset($postArr['deletHoliday'])) {
         for ($i = 0; $i < count($postArr['deletHoliday']); $i++) {
             if (!empty($postArr['deletHoliday'][$i])) {
                 $tmpObj = new Holidays();
                 $tmpObj->setHolidayId($postArr['deletHoliday'][$i]);
                 $objLeave[] = $tmpObj;
             }
         }
     }
     return $objLeave;
 }
 /**
  * Builds an array of Holidays.
  *
  * @access private
  * @param resource $result
  * @return Holidays $objArr
  */
 private static function _buildObjArr($result)
 {
     $objArr = null;
     if ($result) {
         while ($row = mysql_fetch_assoc($result)) {
             $tmpObjHolidays = new Holidays();
             if (isset($row[self::HOLIDAYS_TABLE_HOLIDAY_ID])) {
                 $tmpObjHolidays->setHolidayId($row[self::HOLIDAYS_TABLE_HOLIDAY_ID]);
             }
             if (isset($row[self::HOLIDAYS_TABLE_DESCRIPTION])) {
                 $tmpObjHolidays->setDescription($row[self::HOLIDAYS_TABLE_DESCRIPTION]);
             }
             if (isset($row[self::HOLIDAYS_TABLE_DATE])) {
                 $tmpObjHolidays->setDate($row[self::HOLIDAYS_TABLE_DATE]);
             } else {
                 if (isset($row['a'])) {
                     $tmpObjHolidays->setDate($row['a']);
                 }
             }
             if (isset($row[self::HOLIDAYS_TABLE_RECURRING])) {
                 $tmpObjHolidays->setRecurring($row[self::HOLIDAYS_TABLE_RECURRING]);
             }
             if (isset($row[self::HOLIDAYS_TABLE_LENGTH])) {
                 $tmpObjHolidays->setLength($row[self::HOLIDAYS_TABLE_LENGTH]);
             }
             $objArr[] = $tmpObjHolidays;
         }
     }
     return $objArr;
 }