Example #1
0
    if (!$Second->isValid()) {
        $V =& $Second->getValidator();
        echo '<p>Validation failed:</p>';
        while ($error = $V->fetch()) {
            echo $error->toString() . '<br>';
        }
    } else {
        echo '<p>Validation success.</p>';
        echo '<p>New timestamp is: ' . $Second->getTimeStamp() . ' which could be used to update a database, for example';
    }
} else {
    $Year = new Calendar_Year($_POST['y']);
    $Month = new Calendar_Month($_POST['y'], $_POST['m']);
    $Day = new Calendar_Day($_POST['y'], $_POST['m'], $_POST['d']);
    $Hour = new Calendar_Hour($_POST['y'], $_POST['m'], $_POST['d'], $_POST['h']);
    $Minute = new Calendar_Minute($_POST['y'], $_POST['m'], $_POST['d'], $_POST['h'], $_POST['i']);
    $Second = new Calendar_Second($_POST['y'], $_POST['m'], $_POST['d'], $_POST['h'], $_POST['i'], $_POST['s']);
    ?>
<p><b>Set the alarm clock</p></p>
<form action="<?php 
    echo $_SERVER['PHP_SELF'];
    ?>
" method="post">
Year: <input type="text" name="y" value="<?php 
    echo $_POST['y'];
    ?>
" size="4">&nbsp;
Month:<select name="m">
<?php 
    $selection = array($Month);
    $Year->build($selection);
 function testMinute()
 {
     $Unit = new Calendar_Minute(2000, 12, 20, 23, 60);
     $Validator =& $Unit->getValidator();
     $this->assertFalse($Validator->isValidMinute());
 }