function Main() { $RPUEncode = new SoapObject(NCCBIZ . "RPUEncode.php", "urn:Object"); if (!($newOdID = $RPUEncode->CreateNewRPU_AFS_TD($this->formArray["odID"], $this->formArray["uid"], $this->formArray["transactionCode"]))) { echo $this->formArray["odID"] . "<br>"; exit("create failed"); } else { $ODList = new SoapObject(NCCBIZ . "ODList.php", "urn:Object"); $archiveValue = "true"; $userID = $this->formArray["uid"]; $odIDArray[] = $this->formArray["odID"]; if (!($archiveRows = $ODList->archiveOD($odIDArray, $archiveValue, $userID))) { exit("archive failed"); } else { $this->formArray["odID"] = $newOdID; $AFSEncode = new SoapObject(NCCBIZ . "AFSEncode.php", "urn:Object"); if ($newAfsID = $AFSEncode->getAfsID($newOdID)) { $this->formArray["afsID"] = $newAfsID; header("location: AFSDetails.php" . $this->sess->url("") . "&odID=" . $newOdID . "&afsID=" . $newAfsID . "&transactionCode=" . $this->formArray["transactionCode"]); } else { header("location: ODDetails.php" . $this->sess->url("") . "&odID=" . $newOdID); } } } $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() { //echo $this->formArray["formAction"]; switch ($this->formArray["formAction"]) { case "delete": if (count($this->formArray["personID"]) > 0) { $PersonList = new SoapObject(NCCBIZ . "PersonList.php", "urn:Object"); if (!($deletedRows = $PersonList->deleteRecord($this->formArray["personID"]))) { $this->tpl->set_var("msg", "SOAP failed"); } else { $this->tpl->set_var("msg", $deletedRows . " records deleted"); } } else { $this->tpl->set_var("msg", "0 records deleted"); } if (count($this->formArray["companyID"]) > 0) { $CompanyList = new SoapObject(NCCBIZ . "CompanyList.php", "urn:Object"); if (!($deletedRows = $CompanyList->deleteRecord($this->formArray["companyID"]))) { $this->tpl->set_var("msg", "SOAP failed"); } else { $this->tpl->set_var("msg", $deletedRows . " records deleted"); } } else { $this->tpl->set_var("msg", "0 records deleted"); } header("location: ODDetails.php" . $this->sess->url("") . $this->sess->add_query(array("odID" => $this->formArray["odID"]))); exit; break; case "remove": if (count($this->formArray["personID"])) { $OwnerList = new SoapObject(NCCBIZ . "OwnerList.php", "urn:Object"); if (!($deletedRows = $OwnerList->removeOwnerPerson($this->formArray["ownerID"], $this->formArray["personID"]))) { $this->tpl->set_var("msg", "SOAP failed"); } else { $this->tpl->set_var("msg", $deletedRows . " records deleted"); } } else { $this->tpl->set_var("msg", "0 records deleted"); } if (count($this->formArray["companyID"]) > 0) { $OwnerList = new SoapObject(NCCBIZ . "OwnerList.php", "urn:Object"); if (!($deletedRows = $OwnerList->removeOwnerCompany($this->formArray["ownerID"], $this->formArray["companyID"]))) { $this->tpl->set_var("msg", "SOAP failed"); } else { $this->tpl->set_var("msg", $deletedRows . " records deleted"); } } else { $this->tpl->set_var("msg", "0 records deleted"); } header("location: ODDetails.php" . $this->sess->url("") . $this->sess->add_query(array("odID" => $this->formArray["odID"]))); exit; break; case "split": $this->splitOD(); $ODList = new SoapObject(NCCBIZ . "ODList.php", "urn:Object"); $archiveValue = "true"; $userID = $this->formArray["uid"]; $odIDArray[] = $this->formArray["odID"]; if (!($archiveRows = $ODList->archiveOD($odIDArray, $archiveValue, $userID))) { // archive failed } else { // archive succeeded } header("location: ODDetails.php" . $this->sess->url("") . $this->sess->add_query(array("odID" => $this->formArray["odID"]))); break; default: $this->tpl->set_var("msg", ""); } $ODDetails = new SoapObject(NCCBIZ . "ODDetails.php", "urn:Object"); if (!($xmlStr = $ODDetails->getOD($this->formArray["odID"]))) { exit("xml failed"); } else { //exit($xmlStr); 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; } } $this->formArray["landArea"] = number_format($od->getLandArea(), 4, '.', ','); $ODEncode = new SoapObject(NCCBIZ . "ODEncode.php", "urn:Object"); $this->formArray["ownerID"] = $ODEncode->getOwnerID($this->formArray["odID"]); //$OwnerList = new SoapObject(NCCBIZ."OwnerList.php", "urn:Object"); $xmlStr = $od->owner->domDocument->dump_mem(true); if (!$xmlStr) { //exit(print_r($OwnerList)); $this->tpl->set_block("rptsTemplate", "OwnerListTable", "OwnerListTableBlock"); $this->tpl->set_var("OwnerListTableBlock", ""); } else { //echo $xmlStr; if (!($domDoc = domxml_open_mem($xmlStr))) { $this->tpl->set_block("rptsTemplate", "OwnerListTable", "OwnerListTableBlock"); $this->tpl->set_var("OwnerListTableBlock", "error xmlDoc"); } else { $this->displayOwnerList($domDoc); } } } } $AFSEncode = new SoapObject(NCCBIZ . "AFSEncode.php", "urn:Object"); if (!($afsID = $AFSEncode->getAfsID($this->formArray["odID"]))) { //$this->tpl->set_block("rptsTemplate", "AFSDetails", "AFSDetailsBlock"); //$this->tpl->set_var("AFSDetailsBlock", ""); //echo "1afsID=".$afsID."=>".$this->formArray["odID"]; $afs = new AFS(); $afs->setOdID($this->formArray["odID"]); $afs->setDomDocument(); $doc = $afs->getDomDocument(); $xmlStr = $doc->dump_mem(true); //echo $xmlStr; if (!($afsID = $AFSEncode->saveAFS($xmlStr))) { echo "ret=" . $afsID; } //echo "<br>afsID=".$afsID; } else { //echo "2afsID=".$afsID."=>".$this->formArray["odID"]; //$this->tpl->set_block("rptsTemplate", "AFSEncode", "AFSEncodeBlock"); //$this->tpl->set_var("AFSEncodeBlock", ""); } $this->displayODHistory(); $this->formArray["afsID"] = $afsID; $this->setForm(); $this->tpl->set_var("uname", $this->user["uname"]); $this->tpl->set_var("today", date("F j, Y")); $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() { $this->mergeBasketMain(); switch ($this->formArray["formAction"]) { case "delete": //print_r($this->formArray); if (count($this->formArray["odID"]) > 0) { $ODList = new SoapObject(NCCBIZ . "ODList.php", "urn:Object"); if (!($deletedRows = $ODList->deleteOD($this->formArray["odID"]))) { $this->tpl->set_var("msg", "SOAP failed"); } else { $this->tpl->set_var("msg", $deletedRows . " records deleted"); } } else { $this->tpl->set_var("msg", "0 records deleted"); } break; case "consolidate": $odIDArray = $this->formArray["mergeBasketArray"]; $RPUEncode = new SoapObject(NCCBIZ . "RPUEncode.php", "urn:Object"); $newOdID = $RPUEncode->ConsolidateRPU($odIDArray, $this->formArray["transactionCode"]); $ODList = new SoapObject(NCCBIZ . "ODList.php", "urn:Object"); $archiveValue = "true"; $userID = $this->formArray["uid"]; if (!($archiveRows = $ODList->archiveOD($odIDArray, $archiveValue, $userID))) { // archive failed } else { // archive succeeded } $sess = $this->sess->name . "=" . $this->sess->id; header("Location: ODDetails.php?" . $sess . "&odID=" . $newOdID); exit; break; case "archive": $ODList = new SoapObject(NCCBIZ . "ODList.php", "urn:Object"); $odIDArray = $this->formArray["odIDArray"]; $archiveValue = $this->formArray["archiveValue"]; $userID = $this->formArray["uid"]; if (!($archiveRows = $ODList->archiveOD($odIDArray, $archiveValue, $userID))) { $this->tpl->set_var("msg", "SOAP failed"); } else { $sess = $this->sess->name . "=" . $this->sess->id; header("Location: ODList.php?" . $sess . "&viewArchives=" . $this->formArray["viewArchives"]); exit; } break; case "filterBarangay": $ODList = new SoapObject(NCCBIZ . "ODList.php", "urn:Object"); $this->tpl->set_block("rptsTemplate", "Pages", "PagesBlock"); $this->tpl->set_block("rptsTemplate", "PagesList", "PagesListBlock"); $condition = $this->filterArchives(); if (!($count = $ODList->filterByBarangayCount($this->formArray["barangay"], $condition))) { $this->tpl->set_var("PagesBlock", ""); $this->tpl->set_var("PagesListBlock", ""); $this->tpl->set_block("rptsTemplate", "PageNavigator", "PageNavigatorBlock"); $this->tpl->set_var("PageNavigatorBlock", ""); $numOfPages = 1; } else { $numOfPages = ceil($count / PAGE_BY); // page list nav $this->formArray["pageLinksInLine"] = 7; if ($this->formArray["page"] < round($this->formArray["pageLinksInLine"] / 2)) { $startPageLinks = 1; } else { $startPageLinks = $this->formArray["page"] - round($this->formArray["pageLinksInLine"] / 2); if ($startPageLinks < 1) { $startPageLinks = 1; } } $endPageLinks = $startPageLinks + ($this->formArray["pageLinksInLine"] - 1); if ($endPageLinks > $numOfPages) { $endPageLinks = $numOfPages; } for ($i = $startPageLinks; $i <= $endPageLinks; $i++) { if ($i == $this->formArray["page"]) { $this->tpl->set_var("pageListPages", ""); $this->tpl->set_var("pageListPagesUrl", ""); $this->tpl->set_var("pageListPaged", $i); } else { $this->tpl->set_var("pageListPages", $i); $this->tpl->set_var("pageListPagesUrl", $i . "&formAction=filterBarangay&barangay=" . urlencode($this->formArray["barangay"])); $this->tpl->set_var("pageListPaged", ""); } $this->tpl->parse("PagesListBlock", "PagesList", true); } // drop down nav for ($i = 1; $i <= $numOfPages; $i++) { if ($i == $this->formArray["page"]) { $this->tpl->set_var("pages", $i); $this->tpl->set_var("pagesUrl", $i . "&formAction=filterBarangay&barangay=" . urlencode($this->formArray["barangay"])); $this->tpl->set_var("paged", "selected"); } else { $this->tpl->set_var("pages", $i); $this->tpl->set_var("pagesUrl", $i . "&formAction=filterBarangay&barangay=" . urlencode($this->formArray["barangay"])); $this->tpl->set_var("paged", ""); } $this->tpl->parse("PagesBlock", "Pages", true); } } if ($numOfPages == $this->formArray["page"]) { $this->tpl->set_var("nextTxt", ""); } else { $this->tpl->set_var("next", $this->formArray["page"] + 1 . "&formAction=filterBarangay&barangay=" . urlencode($this->formArray["barangay"])); $this->tpl->set_var("nextTxt", "next"); } if ($this->formArray["page"] == 1) { $this->tpl->set_var("previousTxt", ""); } else { $this->tpl->set_var("previous", $this->formArray["page"] - 1 . "&formAction=filterBarangay&barangay=" . urlencode($this->formArray["barangay"])); $this->tpl->set_var("previousTxt", "previous"); } $condition = $this->filterArchives(); $condition .= $this->sortBlocks(); $this->tpl->set_var("pageOf", $this->formArray["page"] . " of " . $numOfPages); if (!($xmlStr = $ODList->filterByBarangay($this->formArray["page"], $this->formArray["barangay"], $condition))) { $this->tpl->set_var("pageOf", ""); $this->tpl->set_block("rptsTemplate", "ODTable", "ODTableBlock"); $this->tpl->set_var("ODTableBlock", ""); $this->tpl->set_block("rptsTemplate", "ODDBEmpty", "ODDBEmptyBlock"); $this->tpl->set_var("ODDBEmptyBlock", ""); $this->tpl->set_block("rptsTemplate", "Pages", "PagesBlock"); $this->tpl->set_var("PagesBlock", ""); $this->tpl->set_var("PagesListBlock", ""); $this->tpl->set_var("previousTxt", ""); $this->tpl->set_var("nextTxt", ""); } else { if (!($domDoc = domxml_open_mem($xmlStr))) { $this->tpl->set_block("rptsTemplate", "ODListTable", "ODListTableBlock"); $this->tpl->set_var("ODListTableBlock", "error xmlDoc"); } else { $this->tpl->set_block("rptsTemplate", "NotFound", "NotFoundBlock"); $this->tpl->set_var("NotFoundBlock", ""); $odRecords = new ODRecords(); $odRecords->parseDomDocument($domDoc); $list = $odRecords->getArrayList(); if (count($list)) { $this->tpl->set_block("rptsTemplate", "ODDBEmpty", "ODDBEmptyBlock"); $this->tpl->set_var("ODDBEmptyBlock", ""); $this->tpl->set_block("rptsTemplate", "ODList", "ODListBlock"); $this->tpl->set_block("ODList", "PersonList", "PersonListBlock"); $this->tpl->set_block("ODList", "CompanyList", "CompanyListBlock"); foreach ($list as $key => $value) { $this->tpl->set_var("odID", $value->getOdID()); $propertyType = $this->getPropertyTypeFromOD($value); if ($propertyType != "Land") { $this->tpl->set_var("checkbox_status", "disabled"); $this->tpl->set_var("checkbox_style", "style='display:none;'"); } else { $this->tpl->set_var("checkbox_status", ""); $this->tpl->set_var("checkbox_style", ""); if (is_array($this->formArray["mergeBasketArray"])) { if (in_array($value->getOdID(), $this->formArray["mergeBasketArray"])) { $this->tpl->set_var("checkbox_status", "checked disabled"); } } } switch ($propertyType) { case "Land": $this->tpl->set_var("propertyType", "L/P"); break; case "ImprovementsBuildings": $this->tpl->set_var("propertyType", "I/B"); break; case "Machineries": $this->tpl->set_var("propertyType", "M"); break; default: $this->tpl->set_var("propertyType", "-"); break; } $oValue = $value->owner; $pOwnerStr = ""; if (count($oValue->personArray)) { foreach ($oValue->personArray as $pKey => $pValue) { $this->tpl->set_var("personID", $pValue->getPersonID()); $this->tpl->set_var("OwnerPerson", $pValue->getFullName()); $this->tpl->parse("PersonListBlock", "PersonList", true); } } if (count($oValue->companyArray)) { foreach ($oValue->companyArray as $cKey => $cValue) { $this->tpl->set_var("companyID", $cValue->getCompanyID()); $this->tpl->set_var("OwnerCompany", $cValue->getCompanyName()); $this->tpl->parse("CompanyListBlock", "CompanyList", true); } } if (count($oValue->personArray) || count($oValue->companyArray)) { $this->tpl->set_var("none", ""); } else { $this->tpl->set_var("none", "none"); } //*/ //echo method_exists($value->location,getFullAddress); $this->tpl->set_var("locationAddress", $value->locationAddress->getFullAddress()); $this->tpl->set_var("landArea", number_format($value->getLandArea(), 2, '.', ',')); $this->tpl->parse("ODListBlock", "ODList", true); $this->tpl->set_var("PersonListBlock", ""); $this->tpl->set_var("CompanyListBlock", ""); } } else { $this->tpl->set_block("rptsTemplate", "ODList", "ODListBlock"); $this->tpl->set_var("ODListBlock", "huh"); } } } break; case "search": $ODList = new SoapObject(NCCBIZ . "ODList.php", "urn:Object"); $this->tpl->set_block("rptsTemplate", "Pages", "PagesBlock"); $this->tpl->set_block("rptsTemplate", "PagesList", "PagesListBlock"); $condition = $this->filterArchives(); if (!($count = $ODList->getSearchCount($this->formArray["searchKey"], $condition))) { $this->tpl->set_var("PagesBlock", ""); $this->tpl->set_var("PagesListBlock", ""); $this->tpl->set_block("rptsTemplate", "PageNavigator", "PageNavigatorBlock"); $this->tpl->set_var("PageNavigatorBlock", ""); $numOfPages = 1; } else { $numOfPages = ceil($count / PAGE_BY); // page list nav $this->formArray["pageLinksInLine"] = 7; if ($this->formArray["page"] < round($this->formArray["pageLinksInLine"] / 2)) { $startPageLinks = 1; } else { $startPageLinks = $this->formArray["page"] - round($this->formArray["pageLinksInLine"] / 2); if ($startPageLinks < 1) { $startPageLinks = 1; } } $endPageLinks = $startPageLinks + ($this->formArray["pageLinksInLine"] - 1); if ($endPageLinks > $numOfPages) { $endPageLinks = $numOfPages; } for ($i = $startPageLinks; $i <= $endPageLinks; $i++) { if ($i == $this->formArray["page"]) { $this->tpl->set_var("pageListPages", ""); $this->tpl->set_var("pageListPagesUrl", ""); $this->tpl->set_var("pageListPaged", $i); } else { $this->tpl->set_var("pageListPages", $i); $this->tpl->set_var("pageListPagesUrl", $i . "&formAction=search&searchKey=" . urlencode($this->formArray["searchKey"])); $this->tpl->set_var("pageListPaged", ""); } $this->tpl->parse("PagesListBlock", "PagesList", true); } // drop down nav for ($i = 1; $i <= $numOfPages; $i++) { if ($i == $this->formArray["page"]) { $this->tpl->set_var("pages", $i); $this->tpl->set_var("pagesUrl", $i . "&formAction=search&searchKey=" . urlencode($this->formArray["searchKey"])); $this->tpl->set_var("paged", "selected"); } else { $this->tpl->set_var("pages", $i); $this->tpl->set_var("pagesUrl", $i . "&formAction=search&searchKey=" . urlencode($this->formArray["searchKey"])); $this->tpl->set_var("paged", ""); } $this->tpl->parse("PagesBlock", "Pages", true); } } if ($numOfPages == $this->formArray["page"]) { $this->tpl->set_var("nextTxt", ""); } else { $this->tpl->set_var("next", $this->formArray["page"] + 1 . "&formAction=search&searchKey=" . urlencode($this->formArray["searchKey"])); $this->tpl->set_var("nextTxt", "next"); } if ($this->formArray["page"] == 1) { $this->tpl->set_var("previousTxt", ""); } else { $this->tpl->set_var("previous", $this->formArray["page"] - 1 . "&formAction=search&searchKey=" . urlencode($this->formArray["searchKey"])); $this->tpl->set_var("previousTxt", "previous"); } $condition = $this->filterArchives(); $condition .= $this->sortBlocks(); $this->tpl->set_var("pageOf", $this->formArray["page"] . " of " . $numOfPages); if (!($xmlStr = $ODList->searchOD($this->formArray["page"], $this->formArray["searchKey"], $condition))) { $this->tpl->set_var("pageOf", ""); $this->tpl->set_block("rptsTemplate", "ODTable", "ODTableBlock"); $this->tpl->set_var("ODTableBlock", ""); $this->tpl->set_block("rptsTemplate", "ODDBEmpty", "ODDBEmptyBlock"); $this->tpl->set_var("ODDBEmptyBlock", ""); $this->tpl->set_block("rptsTemplate", "Pages", "PagesBlock"); $this->tpl->set_var("PagesBlock", ""); $this->tpl->set_var("PagesListBlock", ""); $this->tpl->set_var("previousTxt", ""); $this->tpl->set_var("nextTxt", ""); $this->tpl->set_block("rptsTemplate", "ArchiveButton", "ArchiveButtonBlock"); $this->tpl->set_var("ArchiveButtonBlock", ""); $this->tpl->set_block("rptsTemplate", "UnArchiveButton", "UnArchiveButtonBlock"); $this->tpl->set_var("UnArchiveButtonBlock", ""); } else { if (!($domDoc = domxml_open_mem($xmlStr))) { $this->tpl->set_block("rptsTemplate", "ODListTable", "ODListTableBlock"); $this->tpl->set_var("ODListTableBlock", "error xmlDoc"); } else { $this->tpl->set_block("rptsTemplate", "NotFound", "NotFoundBlock"); $this->tpl->set_var("NotFoundBlock", ""); $odRecords = new ODRecords(); $odRecords->parseDomDocument($domDoc); $list = $odRecords->getArrayList(); if (count($list)) { $this->tpl->set_block("rptsTemplate", "ODDBEmpty", "ODDBEmptyBlock"); $this->tpl->set_var("ODDBEmptyBlock", ""); $this->tpl->set_block("rptsTemplate", "ODList", "ODListBlock"); $this->tpl->set_block("ODList", "PersonList", "PersonListBlock"); $this->tpl->set_block("ODList", "CompanyList", "CompanyListBlock"); foreach ($list as $key => $value) { $this->tpl->set_var("odID", $value->getOdID()); $propertyType = $this->getPropertyTypeFromOD($value); if ($propertyType != "Land") { $this->tpl->set_var("checkbox_status", "disabled"); $this->tpl->set_var("checkbox_style", "style='display:none;'"); } else { $this->tpl->set_var("checkbox_status", ""); $this->tpl->set_var("checkbox_style", ""); if (is_array($this->formArray["mergeBasketArray"])) { if (in_array($value->getOdID(), $this->formArray["mergeBasketArray"])) { $this->tpl->set_var("checkbox_status", "checked disabled"); } } } switch ($propertyType) { case "Land": $this->tpl->set_var("propertyType", "L/P"); break; case "ImprovementsBuildings": $this->tpl->set_var("propertyType", "I/B"); break; case "Machineries": $this->tpl->set_var("propertyType", "M"); break; default: $this->tpl->set_var("propertyType", "-"); break; } $oValue = $value->owner; $pOwnerStr = ""; if (count($oValue->personArray)) { foreach ($oValue->personArray as $pKey => $pValue) { $this->tpl->set_var("personID", $pValue->getPersonID()); $this->tpl->set_var("OwnerPerson", $pValue->getFullName()); $this->tpl->parse("PersonListBlock", "PersonList", true); } } if (count($oValue->companyArray)) { foreach ($oValue->companyArray as $cKey => $cValue) { $this->tpl->set_var("companyID", $cValue->getCompanyID()); $this->tpl->set_var("OwnerCompany", $cValue->getCompanyName()); $this->tpl->parse("CompanyListBlock", "CompanyList", true); } } if (count($oValue->personArray) || count($oValue->companyArray)) { $this->tpl->set_var("none", ""); } else { $this->tpl->set_var("none", "none"); } //*/ //echo method_exists($value->location,getFullAddress); $this->tpl->set_var("locationAddress", $value->locationAddress->getFullAddress()); $this->tpl->set_var("landArea", number_format($value->getLandArea(), 2, '.', ',')); $this->tpl->parse("ODListBlock", "ODList", true); $this->tpl->set_var("PersonListBlock", ""); $this->tpl->set_var("CompanyListBlock", ""); } } else { $this->tpl->set_block("rptsTemplate", "ODList", "ODListBlock"); $this->tpl->set_var("ODListBlock", "huh"); } } } break; case "cancel": header("location: ODList.php"); exit; break; default: $this->tpl->set_var("msg", ""); $ODList = new SoapObject(NCCBIZ . "ODList.php", "urn:Object"); $this->tpl->set_block("rptsTemplate", "Pages", "PagesBlock"); $this->tpl->set_block("rptsTemplate", "PagesList", "PagesListBlock"); $this->tpl->set_block("rptsTemplate", "NotFound", "NotFoundBlock"); $this->tpl->set_var("NotFoundBlock", ""); $condition = $this->filterArchives(); if (!($count = $ODList->getODCount($condition))) { $this->tpl->set_var("PagesBlock", ""); $this->tpl->set_var("PagesListBlock", ""); $this->tpl->set_block("rptsTemplate", "PageNavigator", "PageNavigatorBlock"); $this->tpl->set_var("PageNavigatorBlock", ""); } else { $numOfPages = ceil($count / PAGE_BY); // page list nav $this->formArray["pageLinksInLine"] = 7; if ($this->formArray["page"] < round($this->formArray["pageLinksInLine"] / 2)) { $startPageLinks = 1; } else { $startPageLinks = $this->formArray["page"] - round($this->formArray["pageLinksInLine"] / 2); if ($startPageLinks < 1) { $startPageLinks = 1; } } $endPageLinks = $startPageLinks + ($this->formArray["pageLinksInLine"] - 1); if ($endPageLinks > $numOfPages) { $endPageLinks = $numOfPages; } for ($i = $startPageLinks; $i <= $endPageLinks; $i++) { if ($i == $this->formArray["page"]) { $this->tpl->set_var("pageListPages", ""); $this->tpl->set_var("pageListPagesUrl", ""); $this->tpl->set_var("pageListPaged", $i); } else { $this->tpl->set_var("pageListPages", $i); $this->tpl->set_var("pageListPagesUrl", $i); $this->tpl->set_var("pageListPaged", ""); } $this->tpl->parse("PagesListBlock", "PagesList", true); } // drop down nav for ($i = 1; $i <= $numOfPages; $i++) { if ($i == $this->formArray["page"]) { $this->tpl->set_var("pages", $i); $this->tpl->set_var("pagesUrl", $i); $this->tpl->set_var("paged", "selected"); } else { $this->tpl->set_var("pages", $i); $this->tpl->set_var("pagesUrl", $i); $this->tpl->set_var("paged", ""); } $this->tpl->parse("PagesBlock", "Pages", true); } } if ($numOfPages == $this->formArray["page"] || $numOfPages == "") { $this->tpl->set_var("nextTxt", ""); } else { $this->tpl->set_var("next", $this->formArray["page"] + 1); $this->tpl->set_var("nextTxt", "next"); } if ($this->formArray["page"] == 1) { $this->tpl->set_var("previousTxt", ""); } else { $this->tpl->set_var("previous", $this->formArray["page"] - 1); $this->tpl->set_var("previousTxt", "previous"); } if ($numOfPages == "") { $this->tpl->set_var("pageOf", ""); } else { $this->tpl->set_var("pageOf", $this->formArray["page"] . " of " . $numOfPages); } $condition = $this->filterArchives(); $condition .= $this->sortBlocks(); if (!($xmlStr = $ODList->getODList($this->formArray["page"], $condition))) { $this->tpl->set_block("rptsTemplate", "ODTable", "ODTableBlock"); $this->tpl->set_var("ODTableBlock", ""); $this->tpl->set_var("PagesBlock", ""); $this->tpl->set_var("PagesListBlock", ""); $this->tpl->set_block("rptsTemplate", "PageNavigator", "PageNavigatorBlock"); $this->tpl->set_var("PageNavigatorBlock", ""); $this->tpl->set_block("rptsTemplate", "ArchiveButton", "ArchiveButtonBlock"); $this->tpl->set_var("ArchiveButtonBlock", ""); $this->tpl->set_block("rptsTemplate", "UnArchiveButton", "UnArchiveButtonBlock"); $this->tpl->set_var("UnArchiveButtonBlock", ""); } else { //echo $xmlStr; if (!($domDoc = domxml_open_mem($xmlStr))) { $this->tpl->set_block("rptsTemplate", "ODListTable", "ODListTableBlock"); $this->tpl->set_var("ODListTableBlock", ""); $this->tpl->set_var("PagesBlock", ""); $this->tpl->set_var("PagesListBlock", ""); $this->tpl->set_block("rptsTemplate", "PageNavigator", "PageNavigatorBlock"); $this->tpl->set_var("PageNavigatorBlock", ""); $this->tpl->set_block("rptsTemplate", "ArchiveButton", "ArchiveButtonBlock"); $this->tpl->set_var("ArchiveButtonBlock", ""); $this->tpl->set_block("rptsTemplate", "UnArchiveButton", "UnArchiveButtonBlock"); $this->tpl->set_var("UnArchiveButtonBlock", ""); } else { $odRecords = new ODRecords(); $odRecords->parseDomDocument($domDoc); $list = $odRecords->getArrayList(); if (count($list)) { $this->tpl->set_block("rptsTemplate", "ODDBEmpty", "ODDBEmptyBlock"); $this->tpl->set_var("ODDBEmptyBlock", ""); $this->tpl->set_block("rptsTemplate", "ODList", "ODListBlock"); $this->tpl->set_block("ODList", "PersonList", "PersonListBlock"); $this->tpl->set_block("ODList", "CompanyList", "CompanyListBlock"); foreach ($list as $key => $value) { //print_r($value); //echo "<br>"; $this->tpl->set_var("odID", $value->getOdID()); $propertyType = $this->getPropertyTypeFromOD($value); if ($propertyType != "Land") { $this->tpl->set_var("checkbox_status", "disabled"); $this->tpl->set_var("checkbox_style", "style='display:none;'"); } else { $this->tpl->set_var("checkbox_status", ""); $this->tpl->set_var("checkbox_style", ""); if (is_array($this->formArray["mergeBasketArray"])) { if (in_array($value->getOdID(), $this->formArray["mergeBasketArray"])) { $this->tpl->set_var("checkbox_status", "checked disabled"); } } } switch ($propertyType) { case "Land": $this->tpl->set_var("propertyType", "L/P"); break; case "ImprovementsBuildings": $this->tpl->set_var("propertyType", "I/B"); break; case "Machineries": $this->tpl->set_var("propertyType", "M"); break; default: $this->tpl->set_var("propertyType", "-"); break; } $propertyType = $this->getPropertyTypeFromOD($value); if ($propertyType != "Land") { $this->tpl->set_var("checkbox_status", "disabled"); $this->tpl->set_var("checkbox_style", "style='display:none;'"); } else { $this->tpl->set_var("checkbox_status", ""); $this->tpl->set_var("checkbox_style", ""); if (is_array($this->formArray["mergeBasketArray"])) { if (in_array($value->getOdID(), $this->formArray["mergeBasketArray"])) { $this->tpl->set_var("checkbox_status", "checked disabled"); } } } $oValue = $value->owner; $pOwnerStr = ""; if (count($oValue->personArray)) { foreach ($oValue->personArray as $pKey => $pValue) { $this->tpl->set_var("personID", $pValue->getPersonID()); $this->tpl->set_var("OwnerPerson", $pValue->getFullName()); $this->tpl->parse("PersonListBlock", "PersonList", true); } } if (count($oValue->companyArray)) { foreach ($oValue->companyArray as $cKey => $cValue) { $this->tpl->set_var("companyID", $cValue->getCompanyID()); $this->tpl->set_var("OwnerCompany", $cValue->getCompanyName()); $this->tpl->parse("CompanyListBlock", "CompanyList", true); } } if (count($oValue->personArray) || count($oValue->companyArray)) { $this->tpl->set_var("none", ""); } else { $this->tpl->set_var("none", "none"); } //*/ //if (method_exists($value->locationAddress,$value->locationAddress->getFullAddress())) if ($value->locationAddress != "") { $this->tpl->set_var("locationAddress", $value->locationAddress->getFullAddress()); } //Begin Edited, Decimal 2 was change to 4 **************** $this->tpl->set_var("landArea", number_format($value->getLandArea(), 4, '.', ',')); //End $this->tpl->parse("ODListBlock", "ODList", true); $this->tpl->set_var("PersonListBlock", ""); $this->tpl->set_var("CompanyListBlock", ""); } } else { $this->tpl->set_block("rptsTemplate", "ODList", "ODListBlock"); $this->tpl->set_var("ODListBlock", "huh"); } } } } $this->initBarangayList(); $this->setForm(); $this->tpl->set_var("uname", $this->user["uname"]); $this->tpl->set_var("today", date("F j, Y")); $this->tpl->set_var("Session", $this->sess->url("")); $this->tpl->parse("templatePage", "rptsTemplate"); $this->tpl->finish("templatePage"); $this->tpl->p("templatePage"); }