function displayPageHeading() { $BarangayList = new SoapObject(NCCBIZ . "BarangayList.php", "urn:Object"); if (!($this->formArray["noBgys"] = $BarangayList->getBarangayCount("WHERE " . BARANGAY_TABLE . ".status='active'"))) { $this->formArray["noBgys"] = 0; } $MunicipalityCityDetails = new SoapObject(NCCBIZ . "MunicipalityCityDetails.php", "urn:Object"); if (!($xmlStr = $MunicipalityCityDetails->getMunicipalityCityDetails($this->formArray["municipalityCityID"]))) { exit("no municipality/city selected"); } else { if (!($domDoc = domxml_open_mem($xmlStr))) { exit("no municipality/city selected"); } else { $municipalityCity = new MunicipalityCity(); $municipalityCity->parseDomDocument($domDoc); $this->formArray["municipalityCity"] = $municipalityCity->getDescription(); $this->formArray["provinceID"] = $municipalityCity->getProvinceID(); $ProvinceDetails = new SoapObject(NCCBIZ . "ProvinceDetails.php", "urn:Object"); if (!($xmlStr = $ProvinceDetails->getProvinceDetails($this->formArray["provinceID"]))) { exit("no province associated with selected municipality/city"); } else { if (!($domDoc = domxml_open_mem($xmlStr))) { exit("no province associated with selected municipality/city"); } else { $province = new Province(); $province->parseDomDocument($domDoc); $this->formArray["province"] = $province->getDescription(); } } } } $quarterEndingDateArray = array("Q1" => "March 31", "Q2" => "June 30", "Q3" => "September 30", "Q4" => "December 31"); $quarterBeginningDateArray = array("Q1" => "January 1", "Q2" => "April 1", "Q3" => "July 1", "Q4" => "October 1"); $this->formArray["quarterEndingDate"] = $quarterEndingDateArray[$this->formArray["quarter"]]; $this->formArray["quarterBeginningDate"] = $quarterBeginningDateArray[$this->formArray["quarter"]]; }
function Main() { switch ($this->formArray["formAction"]) { case "edit": $this->tpl->set_var("MessageBlock", ""); $MunicipalityCityDetails = new SoapObject(NCCBIZ . "MunicipalityCityDetails.php", "urn:Object"); if (!($xmlStr = $MunicipalityCityDetails->getMunicipalityCityDetails($this->formArray["municipalityCityID"]))) { $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 { $municipalityCity = new MunicipalityCity(); $municipalityCity->parseDomDocument($domDoc); $this->formArray["municipalityCityID"] = $municipalityCity->getMunicipalityCityID(); $this->formArray["code"] = $municipalityCity->getCode(); $this->formArray["provinceID"] = $municipalityCity->getProvinceID(); $this->formArray["description"] = $municipalityCity->getDescription(); $this->formArray["status"] = $municipalityCity->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", ""); } $MunicipalityCityEncode = new SoapObject(NCCBIZ . "MunicipalityCityEncode.php", "urn:Object"); if ($this->formArray["municipalityCityID"] != "") { $MunicipalityCityDetails = new SoapObject(NCCBIZ . "MunicipalityCityDetails.php", "urn:Object"); if (!($xmlStr = $MunicipalityCityDetails->getMunicipalityCityDetails($this->formArray["municipalityCityID"]))) { 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 { $municipalityCity = new MunicipalityCity(); $municipalityCity->parseDomDocument($domDoc); $municipalityCity->setMunicipalityCityID($this->formArray["municipalityCityID"]); $municipalityCity->setCode($this->formArray["code"]); $municipalityCity->setProvinceID($this->formArray["provinceID"]); $municipalityCity->setDescription($this->formArray["description"]); $municipalityCity->setStatus($this->formArray["status"]); $municipalityCity->setDomDocument(); $doc = $municipalityCity->getDomDocument(); $xmlStr = $doc->dump_mem(true); if (!($ret = $MunicipalityCityEncode->updateMunicipalityCity($xmlStr))) { exit("error update"); } } } } else { $municipalityCity = new MunicipalityCity(); $municipalityCity->setMunicipalityCityID($this->formArray["municipalityCityID"]); $municipalityCity->setCode($this->formArray["code"]); $municipalityCity->setProvinceID($this->formArray["provinceID"]); $municipalityCity->setDescription($this->formArray["description"]); $municipalityCity->setStatus($this->formArray["status"]); $municipalityCity->setDomDocument(); $doc = $municipalityCity->getDomDocument(); $xmlStr = $doc->dump_mem(true); if (!($ret = $MunicipalityCityEncode->saveMunicipalityCity($xmlStr))) { exit("error save"); } } $this->formArray["municipalityCityID"] = $ret; header("location: MunicipalityCityClose.php" . $this->sess->url("") . $this->sess->add_query(array("municipalityCityID" => $ret))); //header("location: MunicipalityCityEncode.php?".$this->sess->name."=".$this->sess->id."&municipalityCityID=".$ret.".&formAction=edit"); exit; break; case "cancel": header("location: MunicipalityCityClose.php" . $this->sess->url("") . $this->sess->add_query(array("municipalityCityID" => $ret))); //header("location: MunicipalityCityList.php?".$this->sess->name."=".$this->sess->id."&municipalityCityID=".$ret.".&formAction=edit"); exit; break; default: $this->tpl->set_block("rptsTemplate", "MunicipalityCityID", "MunicipalityCityIDBlock"); $this->tpl->set_var("MunicipalityCityIDBlock", ""); $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"); }