function Main() { switch ($this->formArray["formAction"]) { case "edit": $RPTOPDetails = new SoapObject(NCCBIZ . "RPTOPDetails.php", "urn:Object"); if (!($xmlStr = $RPTOPDetails->getRPTOP($this->formArray["rptopID"]))) { exit("xml failed"); } else { if (!($domDoc = domxml_open_mem($xmlStr))) { $this->tpl->set_block("rptsTemplate", "FORM", "FORMBlock"); $this->tpl->set_var("FORMBlock", "error xmlDoc"); } else { $rptop = new RPTOP(); $rptop->parseDomDocument($domDoc); foreach ($rptop as $key => $value) { $this->formArray[$key] = $value; } } } break; case "save": $RPTOPEncode = new SoapObject(NCCBIZ . "RPTOPEncode.php", "urn:Object"); if ($this->formArray["rptopID"] != "") { $RPTOPDetails = new SoapObject(NCCBIZ . "RPTOPDetails.php", "urn:Object"); if (!($xmlStr = $RPTOPDetails->getRPTOPDetails($this->formArray["rptopID"]))) { $this->tpl->set_block("rptsTemplate", "Table", "TableBlock"); $this->tpl->set_var("TableBlock", "record not found"); } else { if (!($domDoc = domxml_open_mem($xmlStr))) { $this->tpl->set_block("rptsTemplate", "Table", "TableBlock"); $this->tpl->set_var("TableBlock", "error xmlDoc"); } else { $rptop = new RPTOP(); $rptop->parseDomDocument($domDoc); //$rptop->selectRecord($this->formArray["rptopID"]); $rptop->setRptopID($this->formArray["rptopID"]); $rptop->setRptopNumber($this->formArray["rptopNumber"]); $rptop->setTaxableYear($this->formArray["taxableYear"]); $rptop->setCityAssessor($this->formArray["cityAssessorID"]); $rptop->setCityTreasurer($this->formArray["cityTreasurerID"]); $rptop->setCreatedBy($this->userID); $rptop->setModifiedBy($this->userID); $rptop->setDomDocument(); $doc = $rptop->getDomDocument(); $xmlStr = $doc->dump_mem(true); //echo $xmlStr; if (!($ret = $RPTOPEncode->updateRPTOP($xmlStr))) { echo "error update"; } header("location: RPTOPClose.php" . $this->sess->url("") . $this->sess->add_query(array("rptopID" => $ret))); //header("location: RPTOPEncode.php".$this->sess->url("").$this->sess->add_query(array("rptopID"=>$ret,"formAction"=>"edit"))); exit; } } } else { $rptop = new RPTOP(); $rptop->setRptopNumber($this->formArray["rptopNumber"]); $rptop->setTaxableYear($this->formArray["taxableYear"]); $rptop->setCityAssessor($this->formArray["cityAssessorID"]); $rptop->setCityTreasurer($this->formArray["cityTreasurerID"]); $rptop->setCreatedBy($this->userID); $rptop->setModifiedBy($this->userID); $rptop->setDomDocument(); //echo hello; $doc = $rptop->getDomDocument(); $xmlStr = $doc->dump_mem(true); //echo $xmlStr; if (!($ret = $RPTOPEncode->saveRPTOP($xmlStr))) { echo "ret=" . $ret; } $this->formArray["rptopID"] = $ret; header("location: RPTOPClose.php" . $this->sess->url("") . $this->sess->add_query(array("rptopID" => $ret))); exit($ret); } break; case "cancel": header("location: RPTOPList.php"); exit; break; default: $this->tpl->set_block("rptsTemplate", "rptopID", "rptopIDBlock"); $this->tpl->set_var("rptopIDBlock", ""); $this->tpl->set_block("rptsTemplate", "ACK", "ACKBlock"); $this->tpl->set_var("ACKBlock", ""); } $this->setForm(); $this->tpl->set_var("Session", $this->sess->url("") . $this->sess->add_query(array("rptopID" => $this->formArray["rptopID"], "ownerID" => $this->formArray["ownerID"]))); $this->tpl->parse("templatePage", "rptsTemplate"); $this->tpl->finish("templatePage"); $this->tpl->p("templatePage"); }