function POST($chkrecent = 3) { //1=to,2=from,3=logical OR global $_STATE; if (!isset($_POST["radRange"])) { return false; } //can happen on a goback if ($this->uses & DATE_SELECT::FROM) { //From date //pagename,DBname,load from DB?,write to DB?,required?,maxlength,disabled,value $from = new DATE_FIELD("txtFrom", "", FALSE, FALSE, FALSE, 0, FALSE, $this->from); $chk = $chkrecent & DATE_SELECT::FROM; if (($msg = $from->audit($chk)) !== true) { $_STATE->msgStatus = "From Date error: " . $msg; return false; } } if ($this->uses & DATE_SELECT::TO) { //To date $to = new DATE_FIELD("txtTo", "", FALSE, FALSE, FALSE, 0, FALSE, $this->to); $chk = $chkrecent & DATE_SELECT::TO; if (($msg = $to->audit($chk)) !== true) { $_STATE->msgStatus = "To Date error: " . $msg; return false; } } $this->checked = $_POST["radRange"]; switch ($this->checked) { case "a": break; case "b": break; case "m": $from->value->modify("first day of this month"); $to->value = clone $from->value; $to->value->modify("last day of this month"); break; case "p": break; case "s": break; case "w": if ($from->format("w") != 0 && $from->format("N") != 1) { $from->value->modify("last monday"); } $to->value = clone $from->value; $to->value->add(new DateInterval('P6D')); //P=period, 6=number, D=days } if ($this->uses & 3 && $from->value > $to->value) { $_STATE->msgStatus = "Error: From Date must be less than To Date"; return false; } if ($this->uses & DATE_SELECT::TO) { $now = COM_NOW(); $diff = date_diff($to->value, $now, true); if ($diff->m > 2) { if ($_STATE->msgStatus != "") { $_STATE->msgStatus .= "<br>"; } $_STATE->msgStatus .= "These dates are suspect - proceeding anyway"; } } $this->from = clone $from->value; $this->to = clone $to->value; return true; }