Source for file PrimitiveIO_datetime.class.php

Documentation is available at PrimitiveIO_datetime.class.php

  1. <?php
  2. /**
  3. * @package polyphony.datamanager_gui
  4. *
  5. * @copyright Copyright &copy; 2005, Middlebury College
  6. * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
  7. *
  8. * @version $Id: PrimitiveIO_datetime.class.php,v 1.8 2007/09/19 14:04:44 adamfranco Exp $
  9. */
  10.  
  11. /**
  12. *
  13. *
  14. * @package polyphony.datamanager_gui
  15. *
  16. * @copyright Copyright &copy; 2005, Middlebury College
  17. * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
  18. *
  19. * @version $Id: PrimitiveIO_datetime.class.php,v 1.8 2007/09/19 14:04:44 adamfranco Exp $
  20. */
  21. class PrimitiveIO_datetime extends WTextField /* implements PrimitiveIO */ {
  22.  
  23. function PrimitiveIO_datetime() {
  24. $this->setErrorText(dgettext("polyphony", "Enter a date/time string. (example: YYYY-MM-DD HH:MM:SS)"));
  25. // $this->setErrorRule(new WECNonZeroRegex("[\\w]+"));
  26. }
  27. /**
  28. * Returns true if this component (and all child components if applicable) have valid values.
  29. * By default, this will just return TRUE. Validate should be called usually before a save event
  30. * is handled, to make sure everything went smoothly.
  31. * @access public
  32. * @return boolean
  33. */
  34. function validate () {
  35. $parse = StringParser::getParserFor($this->_value);
  36. if (!$parse) {
  37. $this->_showError = true;
  38. return false;
  39. }
  40. return true;
  41. }
  42.  
  43. /**
  44. * Sets the value of this Component to the {@link SObject} passed.
  45. * @param ref object $value The {@link SObject} value to use.
  46. *
  47. * @return void
  48. ***/
  49. function setValue($value)
  50. {
  51. parent::setValue($value->asString());
  52. }
  53.  
  54. /**
  55. * Sets the value of this Component to the {@link SObject} passed.
  56. * @param ref object $value The {@link SObject} value to use.
  57. *
  58. * @return void
  59. ***/
  60. function setValueFromSObject($value)
  61. {
  62. $this->setValue($value);
  63. }
  64.  
  65. /**
  66. * Returns the values of wizard-components. Should return an array if children are involved,
  67. * otherwise a whatever type of object is expected.
  68. * @access public
  69. * @return mixed
  70. */
  71. function getAllValues () {
  72. $obj = DateAndTime::fromString($this->_value);
  73. // print "<pre>"; var_dump($this->_value); print "</pre>";
  74. // printpre($obj);
  75. return $obj;
  76. }
  77. }

Documentation generated on Wed, 19 Sep 2007 10:25:39 -0400 by phpDocumentor 1.3.0RC3