Date.php 664 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * QuickForm rule to check a date
  5. * @package chamilo.include
  6. */
  7. /**
  8. * Code
  9. */
  10. require_once ('HTML/QuickForm/Rule.php');
  11. /**
  12. * QuickForm rule to check a date
  13. * @package chamilo.include
  14. */
  15. class Html_Quickform_Rule_Date extends HTML_QuickForm_Rule
  16. {
  17. /**
  18. * Function to check a date
  19. * @see HTML_QuickForm_Rule
  20. * @param array $date An array with keys F (month), d (day) and Y (year)
  21. * @return boolean True if date is valid
  22. */
  23. function validate($date, $options)
  24. {
  25. $compareDate = create_function('$a', 'return checkdate($a[\'M\'],$a[\'d\'],$a[\'Y\']);');
  26. return $compareDate($date);
  27. }
  28. }