function getLocation($locID) { $loc = new LocationAddress(); $loc->selectRecord($locID); if (!($domDoc = $loc->getDomDocument())) { return false; } else { $xmlStr = $domDoc->dump_mem(true); return $xmlStr; } }
function selectRecord($odID) { if ($odID == "") { return; } $this->setDB(); $sql = sprintf("SELECT * FROM %s WHERE odID=%s;", OD_TABLE, $odID); $this->db->query($sql); if ($this->db->next_record()) { $this->setOdID($this->db->f("odID")); $this->setLandArea($this->db->f("landArea")); $this->setHouseTagNumber($this->db->f("houseTagNumber")); $this->setLotNumber($this->db->f("lotNumber")); $this->setZoneNumber($this->db->f("zoneNumber")); $this->setBlockNumber($this->db->f("blockNumber")); $this->setPsd13($this->db->f("psd13")); $this->setAffidavitOfOwnership($this->db->f("affidavitOfOwnership")); $this->setBarangayCertificate($this->db->f("barangayCertificate")); $this->setLandTagging($this->db->f("landTagging")); $this->setDateCreated($this->db->f("dateCreated")); $this->setCreatedBy($this->db->f("createdBy")); $this->setDateModified($this->db->f("dateModified")); $this->setModifiedBy($this->db->f("modifiedBy")); $this->setArchive($this->db->f("archive")); $this->setTransactionCode($this->db->f("transactionCode")); $sql = sprintf("SELECT ownerID FROM %s WHERE odID = %s;", OWNER_TABLE, $this->odID); $this->db->query($sql); while ($this->db->next_record()) { $owner = new Owner(); $owner->selectRecord($this->db->f("ownerID")); $this->owner = $owner; } $sql = sprintf("SELECT locationAddressID FROM %s WHERE odID = %s;", LOCATION_TABLE, $this->odID); $this->db->query($sql); while ($this->db->next_record()) { $locationAddress = new LocationAddress(); $locationAddress->selectRecord($this->db->f("locationAddressID")); $this->locationAddress = $locationAddress; } $sql = sprintf("SELECT previousOdID FROM %s WHERE presentOdID = %s;", ODHISTORY_TABLE, $this->odID); $this->db->query($sql); while ($this->db->next_record()) { $this->oldODArray[] = $this->db->f("previousOdID"); } $this->setDomDocument(); return true; } else { return false; } }
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"); }
function Main() { switch ($this->formArray["formAction"]) { case "edit": $CompanyDetails = new SoapObject(NCCBIZ . "CompanyDetails.php", "urn:Object"); if (!($xmlStr = $CompanyDetails->getCompanyDetails($this->formArray["companyID"]))) { $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 { $company = new Company(); $company->parseDomDocument($domDoc); $this->formArray["companyID"] = $company->getCompanyID(); $this->formArray["companyName"] = $company->getCompanyName(); $this->formArray["tin"] = $company->getTin(); $this->formArray["telephone"] = $company->getTelephone(); $this->formArray["fax"] = $company->getFax(); $address = $company->addressArray[0]; if (is_a($address, Address)) { $this->formArray["addressID"] = $address->getAddressID(); $this->formArray["number"] = $address->getNumber(); $this->formArray["street"] = $address->getStreet(); $this->formArray["barangay"] = $address->getBarangay(); $this->formArray["district"] = $address->getDistrict(); $this->formArray["municipalityCity"] = $address->getMunicipalitycity(); $this->formArray["province"] = $address->getProvince(); } $this->formArray["email"] = $company->getEmail(); $this->formArray["website"] = $company->getWebsite(); } } break; case "save": $CompanyEncode = new SoapObject(NCCBIZ . "CompanyEncode.php", "urn:Object"); if ($this->formArray["companyID"] != "") { $CompanyDetails = new SoapObject(NCCBIZ . "CompanyDetails.php", "urn:Object"); if (!($xmlStr = $CompanyDetails->getCompanyDetails($this->formArray["companyID"]))) { $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 { $company = new Company(); $company->parseDomDocument($domDoc); $address = $company->addressArray[0]; if (is_a($address, Address)) { $address->setAddressID($this->formArray["addressID"]); $address->setNumber($this->formArray["number"]); $address->setStreet($this->formArray["street"]); $address->setBarangay($this->formArray["barangay"]); $address->setDistrict($this->formArray["district"]); $address->setMunicipalityCity($this->formArray["municipalityCity"]); $address->setProvince($this->formArray["province"]); $address->setDomDocument(); } //$company->selectRecord($this->formArray["companyID"]); $company->setCompanyID($this->formArray["companyID"]); $company->setCompanyName($this->formArray["companyName"]); $company->setTin($this->formArray["tin"]); $company->setTelephone($this->formArray["telephone"]); $company->setFax($this->formArray["fax"]); $company->setAddressArray($address); $company->setEmail($this->formArray["email"]); $company->setWebsite($this->formArray["website"]); $company->setDomDocument(); $doc = $company->getDomDocument(); $xmlStr = $doc->dump_mem(true); if (!($ret = $CompanyEncode->updateCompany($xmlStr))) { exit("error update"); } } } } else { $address = new Address(); $address->setNumber($this->formArray["number"]); $address->setStreet($this->formArray["street"]); $address->setBarangay($this->formArray["barangay"]); $address->setDistrict($this->formArray["district"]); $address->setMunicipalityCity($this->formArray["municipalityCity"]); $address->setProvince($this->formArray["province"]); $address->setDomDocument(); $company = new Company(); $company->setCompanyID($this->formArray["companyID"]); $company->setCompanyName($this->formArray["companyName"]); $company->setTelephone($this->formArray["telephone"]); $company->setFax($this->formArray["fax"]); $company->setTin($this->formArray["tin"]); $company->setAddressArray($address); $company->setEmail($this->formArray["email"]); $company->setWebsite($this->formArray["website"]); $company->setDomDocument(); $doc = $company->getDomDocument(); $xmlStr = $doc->dump_mem(true); if (!($ret = $CompanyEncode->saveCompany($xmlStr, $this->formArray["ownerID"]))) { exit("error save"); } } $this->formArray["companyID"] = $ret; //echo $ret; //} header("location: CompanyClose.php?parentURL=" . urlencode($this->formArray["parentURL"])); exit; //*/ //else echo "tumpak!"; break; case "cancel": header("location: CompanyList.php"); exit; break; default: if ($this->formArray["locID"]) { $ODDetails = new SoapObject(NCCBIZ . "ODDetails.php", "urn:Object"); if (!($xmlStr = $ODDetails->getLocation($this->formArray["locID"]))) { exit("xml failed"); } else { if (!($domDoc = domxml_open_mem($xmlStr))) { } else { $loc = new LocationAddress(); $loc->parseDomDocument($domDoc); foreach ($loc as $key => $value) { $this->formArray[$key] = $value; } } } } $this->tpl->set_block("rptsTemplate", "companyID", "companyIDBlock"); $this->tpl->set_var("companyIDBlock", ""); $this->tpl->set_block("rptsTemplate", "ACK", "ACKBlock"); $this->tpl->set_var("ACKBlock", ""); } //*/ $this->setForm(); $this->tpl->parse("templatePage", "rptsTemplate"); $this->tpl->finish("templatePage"); $this->tpl->p("templatePage"); }
function Main() { switch ($this->formArray["formAction"]) { case "edit": $PersonDetails = new SoapObject(NCCBIZ . "PersonDetails.php", "urn:Object"); if (!($xmlStr = $PersonDetails->getPersonDetails($this->formArray["personID"]))) { $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 { $person = new Person(); $person->parseDomDocument($domDoc); list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $person->getBirthday()); $this->formArray["personID"] = $person->getPersonID(); $this->formArray["lastName"] = $person->getLastName(); $this->formArray["firstName"] = $person->getFirstName(); $this->formArray["middleName"] = $person->getMiddleName(); $this->formArray["gender"] = $person->getGender(); $this->formArray["birth_year"] = removePreZero($dateArr["year"]); $this->formArray["birth_month"] = removePreZero($dateArr["month"]); $this->formArray["birth_day"] = removePreZero($dateArr["day"]); $this->formArray["maritalStatus"] = $person->getMaritalStatus(); $this->formArray["tin"] = $person->getTin(); $address = $person->addressArray[0]; if (is_a($address, Address)) { $this->formArray["addressID"] = $address->getAddressID(); $this->formArray["number"] = $address->getNumber(); $this->formArray["street"] = $address->getStreet(); $this->formArray["barangay"] = $address->getBarangay(); $this->formArray["district"] = $address->getDistrict(); $this->formArray["municipalityCity"] = $address->getMunicipalitycity(); $this->formArray["province"] = $address->getProvince(); } $this->formArray["telephone"] = $person->getTelephone(); $this->formArray["mobileNumber"] = $person->getMobileNumber(); $this->formArray["email"] = $person->getEmail(); } } break; case "save": $PersonEncode = new SoapObject(NCCBIZ . "PersonEncode.php", "urn:Object"); if ($this->formArray["personID"] != "") { $PersonDetails = new SoapObject(NCCBIZ . "PersonDetails.php", "urn:Object"); if (!($xmlStr = $PersonDetails->getPersonDetails($this->formArray["personID"]))) { $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 { $person = new Person(); $person->parseDomDocument($domDoc); $address = $person->addressArray[0]; if (is_a($address, Address)) { $address->setAddressID($this->formArray["addressID"]); $address->setNumber($this->formArray["number"]); $address->setStreet($this->formArray["street"]); $address->setBarangay($this->formArray["barangay"]); $address->setDistrict($this->formArray["district"]); $address->setMunicipalityCity($this->formArray["municipalityCity"]); $address->setProvince($this->formArray["province"]); $address->setDomDocument(); } $person->setPersonID($this->formArray["personID"]); $person->setLastName($this->formArray["lastName"]); $person->setFirstName($this->formArray["firstName"]); $person->setMiddleName($this->formArray["middleName"]); $person->setGender($this->formArray["gender"]); $person->setBirthday($this->birthdate); $person->setMaritalStatus($this->formArray["maritalStatus"]); $person->setTin($this->formArray["tin"]); $person->setAddressArray($address); $person->setTelephone($this->formArray["telephone"]); $person->setMobileNumber($this->formArray["mobileNumber"]); $person->setEmail($this->formArray["email"]); $person->setDomDocument(); $doc = $person->getDomDocument(); $xmlStr = $doc->dump_mem(true); if (!($ret = $PersonEncode->updatePerson($xmlStr))) { exit("error update"); } } } } else { $address = new Address(); $address->setNumber($this->formArray["number"]); $address->setStreet($this->formArray["street"]); $address->setBarangay($this->formArray["barangay"]); $address->setDistrict($this->formArray["district"]); $address->setMunicipalityCity($this->formArray["municipalityCity"]); $address->setProvince($this->formArray["province"]); $address->setDomDocument(); $person = new Person(); $person->setPersonID($this->formArray["personID"]); $person->setLastName($this->formArray["lastName"]); $person->setFirstName($this->formArray["firstName"]); $person->setMiddleName($this->formArray["middleName"]); $person->setGender($this->formArray["gender"]); $person->setBirthday($this->birthdate); $person->setMaritalStatus($this->formArray["maritalStatus"]); $person->setTin($this->formArray["tin"]); $person->setAddressArray($address); $person->setTelephone($this->formArray["telephone"]); $person->setMobileNumber($this->formArray["mobileNumber"]); $person->setEmail($this->formArray["email"]); $person->setDomDocument(); $doc = $person->getDomDocument(); $xmlStr = $doc->dump_mem(true); //echo $this->formArray["ownerID"].$xmlStr; if (!($ret = $PersonEncode->savePerson($xmlStr, $this->formArray["ownerID"]))) { exit("error save"); } } $this->formArray["personID"] = $ret; header("location: ChangeOfOwnershipPropertyInfoClose.php" . $this->sess->url("") . $this->sess->add_query(array("odID" => $this->formArray["odID"], "personID" => $ret, "formAction" => "view"))); exit; break; case "cancel": header("location: PersonList.php"); exit; break; default: if ($this->formArray["locID"]) { $ODDetails = new SoapObject(NCCBIZ . "ODDetails.php", "urn:Object"); if (!($xmlStr = $ODDetails->getLocation($this->formArray["locID"]))) { exit("xml failed"); } else { if (!($domDoc = domxml_open_mem($xmlStr))) { } else { $loc = new LocationAddress(); $loc->parseDomDocument($domDoc); foreach ($loc as $key => $value) { $this->formArray[$key] = $value; } } } } $this->tpl->set_block("rptsTemplate", "personID", "personIDBlock"); $this->tpl->set_var("personIDBlock", ""); $this->tpl->set_block("rptsTemplate", "ACK", "ACKBlock"); $this->tpl->set_var("ACKBlock", ""); } $this->setForm(); $this->tpl->parse("templatePage", "rptsTemplate"); $this->tpl->finish("templatePage"); $this->tpl->p("templatePage"); }
$this->db->resetErrors(); $ret = false; } else { $this->db->endTransaction(); $ret = $rows; } return $ret; } function updateRecord() { $sql = sprintf("update %s set " . "number = '%s'" . ", street = '%s'" . ", barangayID = '%s'" . ", district = '%s'" . ", municipalityCity = '%s'" . ", province = '%s'" . " where locationAddressID = %s", LOCATIONADDRESS_TABLE, fixQuotes($this->number), fixQuotes($this->street), fixQuotes($this->barangay), fixQuotes($this->district), fixQuotes($this->municipalityCity), fixQuotes($this->province), $this->locationAddressID); //echo $sql; $this->setDB(); $this->db->beginTransaction(); $this->db->query($sql); $locationAddressID = $this->db->insert_id(); if ($this->db->Errno != 0) { $this->db->rollbackTransaction(); $this->db->resetErrors(); $ret = false; } else { $this->db->endTransaction(); $ret = $this->locationAddressID; } return $ret; } } $locationAddress = new LocationAddress(); $locationAddress->selectRecordFromTdID(1); echo $locationAddress->number; echo "blablabla";