Пример #1
0
                            ?>
  							<option value="<?php 
                            echo $key;
                            ?>
"><?php 
                            echo $value;
                            ?>
</option>
  					<?php 
                        }
                    }
                    ?>
  				</select>
  			<?php 
                } else {
                    $holiday = Holidays::getHolidayForDate($record->getLeaveDate());
                    if (!empty($holiday) && is_a($holiday, 'Holidays')) {
                        echo $holiday->getDescription();
                    } else {
                        echo $lang_Leave_Closed;
                    }
                    ?>
  				<input type="hidden" name="cmbStatus[]" value="<?php 
                    echo $record->getLeaveStatus();
                    ?>
" />
  			<?php 
                }
                ?>
    	<?php 
            } else {
Пример #2
0
 public function testGetHolidayForDate()
 {
     // exact day for recurring holiday
     $holiday = Holidays::getHolidayForDate(date('Y') . '-07-04');
     $this->assertNotNull($holiday);
     $this->assertEquals('Independence', $holiday->getDescription());
     $this->assertEquals(10, $holiday->getHolidayId());
     $this->assertEquals(date('Y') . '-07-04', $holiday->getDate());
     $this->assertEquals(Holidays::HOLIDAYS_RECURRING, $holiday->getRecurring());
     $this->assertEquals(8, $holiday->getLength());
     // next year for recurring holiday
     $holiday = Holidays::getHolidayForDate(date('Y') + 1 . '-07-04', true);
     $this->assertNotNull($holiday);
     $this->assertEquals('Independence', $holiday->getDescription());
     $this->assertEquals(10, $holiday->getHolidayId());
     $this->assertEquals(date('Y') . '-07-04', $holiday->getDate());
     $this->assertEquals(Holidays::HOLIDAYS_RECURRING, $holiday->getRecurring());
     $this->assertEquals(8, $holiday->getLength());
     // previous year for recurring holiday
     $holiday = Holidays::getHolidayForDate(date('Y') - 1 . '-07-04', true);
     $this->assertNull($holiday);
     // exact day for non-recurring holiday
     $holiday = Holidays::getHolidayForDate(date('Y') . '-01-04');
     $this->assertNotNull($holiday);
     $this->assertEquals('Poya', $holiday->getDescription());
     $this->assertEquals(11, $holiday->getHolidayId());
     $this->assertEquals(date('Y') . '-01-04', $holiday->getDate());
     $this->assertEquals(Holidays::HOLIDAYS_NOT_RECURRING, $holiday->getRecurring());
     $this->assertEquals(4, $holiday->getLength());
     // next year for non-recurring holiday
     $holiday = Holidays::getHolidayForDate(date('Y') + 1 . '-01-04', true);
     $this->assertNull($holiday);
     // random non-holiday
     $holiday = Holidays::getHolidayForDate(date('Y') + 1 . '-03-04');
     $this->assertNull($holiday);
     $holiday = Holidays::getHolidayForDate(date('Y') + 1 . '-03-04', true);
     $this->assertNull($holiday);
 }