Date.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. // $Id: Date.php 6187 2005-09-07 10:23:57Z bmol $
  3. /*
  4. ==============================================================================
  5. Dokeos - elearning and course management software
  6. Copyright (c) 2004-2005 Dokeos S.A.
  7. Copyright (c) Bart Mollet, Hogeschool Gent
  8. For a full list of contributors, see "credits.txt".
  9. The full license can be read in "license.txt".
  10. This program is free software; you can redistribute it and/or
  11. modify it under the terms of the GNU General Public License
  12. as published by the Free Software Foundation; either version 2
  13. of the License, or (at your option) any later version.
  14. See the GNU General Public License for more details.
  15. Contact address: Dokeos, 44 rue des palais, B-1030 Brussels, Belgium
  16. Mail: info@dokeos.com
  17. ==============================================================================
  18. */
  19. require_once ('HTML/QuickForm/Rule.php');
  20. /**
  21. * QuickForm rule to check a date
  22. */
  23. class HTML_QuickForm_Rule_Date extends HTML_QuickForm_Rule
  24. {
  25. /**
  26. * Function to check a date
  27. * @see HTML_QuickForm_Rule
  28. * @param array $date An array with keys F (month), d (day) and Y (year)
  29. * @return boolean True if date is valid
  30. */
  31. function validate($date, $options)
  32. {
  33. return checkdate($date['F'], $date['d'], $date['Y']);
  34. }
  35. }