function updateLandSubclasses($xmlStr) { if (!($domDoc = domxml_open_mem($xmlStr))) { return false; } $landSubclasses = new LandSubclasses(); $landSubclasses->parseDomDocument($domDoc); $ret = $landSubclasses->updateRecord(); return $ret; }
function parseDomDocument($domDoc) { $baseNode = $domDoc->document_element(); if ($baseNode->has_child_nodes()) { $child = $baseNode->first_child(); while ($child) { //if ($child->tagname=="LandSubclasses") { if ($child->tagname) { $tempXmlStr = $domDoc->dump_node($child); $tempDomDoc = domxml_open_mem($tempXmlStr); $landSubclasses = new LandSubclasses(); $landSubclasses->parseDomDocument($tempDomDoc); $this->arrayList[] = $landSubclasses; } $child = $child->next_sibling(); } } else { return false; } return $this->setDomDocument(); }
function Main() { switch ($this->formArray["formAction"]) { case "edit": $this->tpl->set_var("MessageBlock", ""); $LandSubclassesDetails = new SoapObject(NCCBIZ . "LandSubclassesDetails.php", "urn:Object"); if (!($xmlStr = $LandSubclassesDetails->getLandSubclassesDetails($this->formArray["landSubclassesID"]))) { $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 { $landSubclasses = new LandSubclasses(); $landSubclasses->parseDomDocument($domDoc); $this->formArray["landSubclassesID"] = $landSubclasses->getLandSubclassesID(); $this->formArray["code"] = $landSubclasses->getCode(); $this->formArray["description"] = $landSubclasses->getDescription(); $this->formArray["value"] = $landSubclasses->getValue(); $this->formArray["status"] = $landSubclasses->getStatus(); } } break; case "save": if ($this->codeAlreadyExists() == true) { $this->message = "Error. Cannot Save. Code already exists."; $this->tpl->set_var("message", $this->message); $this->tpl->parse("MessageBlock", "Message", true); break; } else { $this->tpl->set_var("MessageBlock", ""); } $LandSubclassesEncode = new SoapObject(NCCBIZ . "LandSubclassesEncode.php", "urn:Object"); if ($this->formArray["landSubclassesID"] != "") { $LandSubclassesDetails = new SoapObject(NCCBIZ . "LandSubclassesDetails.php", "urn:Object"); if (!($xmlStr = $LandSubclassesDetails->getLandSubclassesDetails($this->formArray["landSubclassesID"]))) { exit("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 { $landSubclasses = new LandSubclasses(); $landSubclasses->parseDomDocument($domDoc); $landSubclasses->setLandSubclassesID($this->formArray["landSubclassesID"]); $landSubclasses->setCode($this->formArray["code"]); $landSubclasses->setDescription($this->formArray["description"]); $landSubclasses->setValue($this->formArray["value"]); $landSubclasses->setStatus($this->formArray["status"]); $landSubclasses->setDomDocument(); $doc = $landSubclasses->getDomDocument(); $xmlStr = $doc->dump_mem(true); if (!($ret = $LandSubclassesEncode->updateLandSubclasses($xmlStr))) { exit("error update"); } } } } else { $landSubclasses = new LandSubclasses(); $landSubclasses->setLandSubclassesID($this->formArray["landSubclassesID"]); $landSubclasses->setCode($this->formArray["code"]); $landSubclasses->setDescription($this->formArray["description"]); $landSubclasses->setValue($this->formArray["value"]); $landSubclasses->setStatus($this->formArray["status"]); $landSubclasses->setDomDocument(); $doc = $landSubclasses->getDomDocument(); $xmlStr = $doc->dump_mem(true); if (!($ret = $LandSubclassesEncode->saveLandSubclasses($xmlStr))) { exit("error save"); } } $this->formArray["landSubclassesID"] = $ret; header("location: LandSubclassesClose.php" . $this->sess->url("") . $this->sess->add_query(array("landSubclassesID" => $ret))); //header("location: LandSubclassesEncode.php"); exit; break; case "cancel": header("location: LandSubclassesClose.php" . $this->sess->url("") . $this->sess->add_query(array("landSubclassesID" => $ret))); //header("location: LandSubclassesList.php"); exit; break; default: $this->tpl->set_block("rptsTemplate", "LandSubclassesID", "LandSubclassesIDBlock"); $this->tpl->set_var("LandSubclassesIDBlock", ""); $this->tpl->set_block("rptsTemplate", "ACK", "ACKBlock"); $this->tpl->set_var("ACKBlock", ""); $this->tpl->set_var("MessageBlock", ""); } $this->setForm(); $this->tpl->parse("templatePage", "rptsTemplate"); $this->tpl->finish("templatePage"); $this->tpl->p("templatePage"); }