Beispiel #1
0
 function Main()
 {
     switch ($this->formArray["formAction"]) {
         case "edit":
             $ODDetails = new SoapObject(NCCBIZ . "ODDetails.php", "urn:Object");
             if (!($xmlStr = $ODDetails->getOD($this->formArray["odID"]))) {
                 exit("xml failed");
             } else {
                 if (!($domDoc = domxml_open_mem($xmlStr))) {
                     $this->tpl->set_block("rptsTemplate", "OwnerListTable", "OwnerListTableBlock");
                     $this->tpl->set_var("OwnerListTableBlock", "error xmlDoc");
                 } else {
                     $od = new OD();
                     $od->parseDomDocument($domDoc);
                     foreach ($od as $key => $value) {
                         if ($key == "locationAddress" && is_object($value)) {
                             foreach ($value as $lkey => $lvalue) {
                                 $this->formArray[$lkey] = $lvalue;
                             }
                         } else {
                             $this->formArray[$key] = $value;
                         }
                     }
                     $ODEncode = new SoapObject(NCCBIZ . "ODEncode.php", "urn:Object");
                     $this->formArray["ownerID"] = $ODEncode->getOwnerID($this->formArray["odID"]);
                     $OwnerList = new SoapObject(NCCBIZ . "OwnerList.php", "urn:Object");
                     if (!($xmlStr = $OwnerList->getOwnerList($this->formArray["ownerID"]))) {
                         //exit(print_r($OwnerList));
                         $this->tpl->set_block("rptsTemplate", "OwnerListTable", "OwnerListTableBlock");
                         $this->tpl->set_var("OwnerListTableBlock", "");
                     } else {
                         if (!($domDoc = domxml_open_mem($xmlStr))) {
                             $this->tpl->set_block("rptsTemplate", "OwnerListTable", "OwnerListTableBlock");
                             $this->tpl->set_var("OwnerListTableBlock", "error xmlDoc");
                         } else {
                         }
                     }
                 }
             }
             break;
         case "save":
             $PropertyInfoEncode = new SoapObject(NCCBIZ . "PropertyInfoEncode.php", "urn:Object");
             if ($this->formArray["odID"] != "") {
                 if (!($xmlStr = $PropertyInfoEncode->getPropertyInfoDetails($this->formArray["odID"]))) {
                     $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 {
                         $od = new OD();
                         $od->parseDomDocument($domDoc);
                         $locationAddress = $od->locationAddress;
                         if (is_a($locationAddress, LocationAddress)) {
                             $locationAddress->setLocationAddressID($this->formArray["locationAddressID"]);
                             $locationAddress->setNumber($this->formArray["number"]);
                             $locationAddress->setStreet($this->formArray["street"]);
                             $locationAddress->setBarangay($this->formArray["barangay"]);
                             $locationAddress->setDistrict($this->formArray["district"]);
                             $locationAddress->setMunicipalityCity($this->formArray["municipalityCity"]);
                             $locationAddress->setProvince($this->formArray["province"]);
                             $locationAddress->setDomDocument();
                         }
                         $od->setOdID($this->formArray["odID"]);
                         $od->setlocationAddress($locationAddress);
                         $od->setHouseTagNumber($this->formArray["houseTagNumber"]);
                         $od->setLandArea($this->formArray["landArea"]);
                         $od->setLotNumber($this->formArray["lotNumber"]);
                         $od->setZoneNumber($this->formArray["zoneNumber"]);
                         $od->setBlockNumber($this->formArray["blockNumber"]);
                         $od->setPsd13($this->formArray["psd13"]);
                         $od->setAffidavitOfOwnership($this->formArray["affidavitOfOwnership"]);
                         $od->setBarangayCertificate($this->formArray["barangayCertificate"]);
                         $od->setLandTagging($this->formArray["landTagging"]);
                         $od->setCreatedBy($this->userID);
                         $od->setModifiedBy($this->userID);
                         $od->setDomDocument();
                         $doc = $od->getDomDocument();
                         $xmlStr = $doc->dump_mem(true);
                         if (!($ret = $PropertyInfoEncode->updatePropertyInfo($xmlStr))) {
                             echo "error update";
                         }
                         header("location: PropertyInfoEncodeClose.php" . $this->sess->url("") . $this->sess->add_query(array("odID" => $ret)));
                         exit;
                     }
                 }
             } else {
                 $locationAddress = new LocationAddress();
                 $locationAddress->setNumber($this->formArray["number"]);
                 $locationAddress->setStreet($this->formArray["street"]);
                 $locationAddress->setBarangay($this->formArray["barangay"]);
                 $locationAddress->setDistrict($this->formArray["district"]);
                 $locationAddress->setMunicipalityCity($this->formArray["municipalityCity"]);
                 $locationAddress->setProvince($this->formArray["province"]);
                 $locationAddress->setDomDocument();
                 $od = new OD();
                 $od->setlocationAddress($locationAddress);
                 $od->setHouseTagNumber($this->formArray["houseTagNumber"]);
                 $od->setLandArea($this->formArray["landArea"]);
                 $od->setLotNumber($this->formArray["lotNumber"]);
                 $od->setZoneNumber($this->formArray["zoneNumber"]);
                 $od->setBlockNumber($this->formArray["blockNumber"]);
                 $od->setPsd13($this->formArray["psd13"]);
                 $od->setAffidavitOfOwnership($this->formArray["affidavitOfOwnership"]);
                 $od->setBarangayCertificate($this->formArray["barangayCertificate"]);
                 $od->setLandTagging($this->formArray["landTagging"]);
                 $od->setCreatedBy($this->userID);
                 $od->setModifiedBy($this->userID);
                 $od->setDomDocument();
                 //echo hello;
                 $doc = $od->getDomDocument();
                 $xmlStr = $doc->dump_mem(true);
                 if (!($ret = $PropertyInfoEncode->savePropertyInfo($xmlStr))) {
                     //echo("ret=".$ret);
                 }
                 $this->formArray["odID"] = $ret;
                 header("location: PropertyInfoEncodeClose.php" . $this->sess->url("") . $this->sess->add_query(array("odID" => $ret)));
                 //echo $PropertyInfoEncode->getPropertyInfoDetails($ret);
                 exit($ret);
             }
             break;
         case "cancel":
             header("location: PropertyInfoList.php");
             exit;
             break;
         default:
             $this->tpl->set_block("rptsTemplate", "odID", "odIDBlock");
             $this->tpl->set_var("odIDBlock", "");
             $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("odID" => $this->formArray["odID"], "ownerID" => $this->formArray["ownerID"])));
     $this->tpl->parse("templatePage", "rptsTemplate");
     $this->tpl->finish("templatePage");
     $this->tpl->p("templatePage");
 }