Example #1
1
 function _testXPath($xpath_expression)
 {
     if (!class_exists('DOMDocument') || !class_exists('DOMXPath')) {
         if (function_exists('domxml_open_mem')) {
             $dom = domxml_open_mem($this->_response);
             if (!$dom) {
                 $this->fail('Error parsing doc');
                 return false;
             }
             var_dump($dom);
             $xpath = $dom->xpath_init();
             var_dump($xpath);
             $ctx = $dom->xpath_new_context();
             var_dump($xpath_expression);
             $result = $ctx->xpath_eval($xpath_expression);
             var_dump($result);
             $return = new stdClass();
             $return->length = count($result->nodeset);
             return $return;
         }
         $this->fail('No xpath support built in');
         return false;
     } else {
         if (extension_loaded('domxml')) {
             $this->fail('Please disable the domxml extension. Only php5 builtin domxml is supported');
             return false;
         }
     }
     $dom = new DOMDocument();
     $dom->loadHtml($this->_response);
     $xpath = new DOMXPath($dom);
     $node = $xpath->query($xpath_expression);
     return $node;
 }
 function Main()
 {
     $this->tpl->set_block("rptsTemplate", "MunicipalityCityList", "MunicipalityCityListBlock");
     $MunicipalityCityList = new SoapObject(NCCBIZ . "MunicipalityCityList.php", "urn:Object");
     if (!($xmlStr = $MunicipalityCityList->getMunicipalityCityList(0, " WHERE " . MUNICIPALITYCITY_TABLE . ".status='active'"))) {
         $this->tpl->set_var("municipalityCityID", "");
         $this->tpl->set_var("description", "empty list");
         $this->tpl->parse("MunicipalityCityListBlock", "MunicipalityCityList", true);
     } else {
         if (!($domDoc = domxml_open_mem($xmlStr))) {
             $this->tpl->set_var("municipalityCityID", "");
             $this->tpl->set_var("description", "empty list");
             $this->tpl->parse("MunicipalityCityListBlock", "MunicipalityCityList", true);
         } else {
             $municipalityCityRecords = new MunicipalityCityRecords();
             $municipalityCityRecords->parseDomDocument($domDoc);
             $list = $municipalityCityRecords->getArrayList();
             foreach ($list as $municipalityCity) {
                 $this->tpl->set_var("municipalityCityID", $municipalityCity->getMunicipalityCityID());
                 $this->tpl->set_var("description", $municipalityCity->getDescription());
                 $this->tpl->parse("MunicipalityCityListBlock", "MunicipalityCityList", true);
             }
         }
     }
     $this->setForm();
     $this->tpl->set_var("uname", $this->user["uname"]);
     $this->tpl->set_var("today", date("F j, Y"));
     $this->setPageDetailPerms();
     $this->tpl->set_var("Session", $this->sess->url(""));
     $this->tpl->parse("templatePage", "rptsTemplate");
     $this->tpl->finish("templatePage");
     $this->tpl->p("templatePage");
 }
 /**
  * Main parser dispatcher method.
  * This is where the first-level parsing gets dispatched to specific parser methods.
  * Accepts (requires) a single string, containing HTML to be parsed for uFormats.
  * Returns an xArray of parsed uFormats' objects.
  * @param $str HTML to be parsed.
  * @return xArray of uFormat objects.
  */
 function parseSource($str)
 {
     @($this->_dom =& domxml_open_mem($str));
     if (!$this->_dom) {
         return false;
     }
     $root = $this->_dom->get_elements_by_tagname('body');
     $root = $root[0];
     $children = $root->child_nodes();
     $elems = new xArray();
     foreach ($children as $child) {
         if ($this->_parseHCard) {
             $e = $this->parseCard($child);
             $elems->append($e->toArray());
         }
         if ($this->_parseHCalendar) {
             $e = $this->parseCalendar($child);
             $elems->append($e->toArray());
         }
         if ($this->_parseHReview) {
             $e = $this->parseReview($child);
             $elems->append($e->toArray());
         }
         if ($this->_parseRelTags) {
             $e = $this->parseRel($child);
             $elems->append($e->toArray());
         }
     }
     return $elems->compact();
 }
Example #4
0
 function parseDomDocument($domDoc)
 {
     $baseNode = $domDoc->document_element();
     // IF statement for bug fix of December 04, 2003
     // when an error occured on a blank FAAS list
     if (!is_object($baseNode)) {
         return false;
     }
     if ($baseNode->has_child_nodes()) {
         $child = $baseNode->first_child();
         while ($child) {
             //if ($child->tagname=="OD") {
             if ($child->tagname) {
                 $tempXmlStr = $domDoc->dump_node($child);
                 $tempDomDoc = domxml_open_mem($tempXmlStr);
                 $od = new OD();
                 if ($od->parseDomDocument($tempDomDoc)) {
                     $this->arrayList[] = $od;
                 }
             }
             $child = $child->next_sibling();
         }
     }
     $ret = $this->setDomDocument() ? true : false;
     return $ret;
 }
Example #5
0
 /**
  * AkTestApplication->_testXPath()
  *
  * @author Bermi Ferrer Martinez
  * @license LGPL
  */
 public function _testXPath($xpath_expression)
 {
     if (false === class_exists('DOMDocument') or false === class_exists('DOMXPath')) {
         if (function_exists('domxml_open_mem') === true) {
             $dom = domxml_open_mem($this->_response);
             if (false === $dom) {
                 $this->fail('Error parsing the document.');
                 return false;
             }
             #var_dump($dom);
             $xpath = $dom->xpath_init();
             #var_dump($xpath);
             $ctx = $dom->xpath_new_context();
             #var_dump($xpath_expression);
             $result = $ctx->xpath_eval($xpath_expression);
             #var_dump($result);
             $return = new stdClass();
             $return->length = count($result->nodeset);
             return $return;
         }
         $this->fail('No xpath support built in.');
         return false;
     } elseif (extension_loaded('domxml')) {
         $this->fail('Please disable the domxml extension. Only php5 builtin domxml is supported');
         return false;
     }
     $dom = new DOMDocument();
     $response = preg_replace('/(<!DOCTYPE.*?>)/is', '', $this->_response);
     $dom->loadHtml($response);
     $xpath = new DOMXPath($dom);
     $node = $xpath->query($xpath_expression);
     return $node;
 }
Example #6
0
 function initBarangayList()
 {
     $this->tpl->set_block("rptsTemplate", "BarangayList", "BarangayListBlock");
     $BarangayList = new SoapObject(NCCBIZ . "BarangayList.php", "urn:Object");
     if (!($xmlStr = $BarangayList->getBarangayList(0, " WHERE " . BARANGAY_TABLE . ".status='active' ORDER BY description"))) {
         $this->tpl->set_var("barangayID", "");
         $this->tpl->set_var("barangay", "empty barangay list");
         $this->tpl->parse("BarangayListBlock", "BarangayList", true);
     } else {
         if (!($domDoc = domxml_open_mem($xmlStr))) {
             $this->tpl->set_var("barangayID", "");
             $this->tpl->set_var("barangay", "empty barangay list");
             $this->tpl->parse("BarangayListBlock", "BarangayList", true);
         } else {
             $barangayRecords = new BarangayRecords();
             $barangayRecords->parseDomDocument($domDoc);
             if (is_array($barangayRecords->arrayList)) {
                 foreach ($barangayRecords->arrayList as $key => $value) {
                     $this->tpl->set_var("barangayID", $value->getBarangayID());
                     $this->tpl->set_var("barangay", $value->getDescription());
                     $this->tpl->parse("BarangayListBlock", "BarangayList", true);
                 }
             }
         }
     }
 }
Example #7
0
 function Main($referer = "")
 {
     if (!$referer || !isset($referer)) {
         $referer = "OwnerList.php";
     }
     $this->tpl->set_var("referer", $referer);
     switch ($this->formArray["formAction"]) {
         case "save" || "view" || "viewOnly":
             $this->tpl->set_var("referer", $referer);
             $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();
                 }
             }
             if ($this->formArray["formAction"] == "viewOnly") {
                 $this->tpl->set_block("rptsTemplate", "ViewOnly", "ViewOnlyBlock");
                 $this->tpl->set_var("ViewOnlyBlock", "");
             }
             break;
         case "cancel":
             //header("location: CompanyList.php");
             exit;
             break;
         default:
             $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");
 }
Example #8
0
function votable_parse_text($result)
{
    $xml = domxml_open_mem($result);
    if (!$xml) {
        return "XML parsing error";
    }
    $s = "";
    // root: votable
    $n = $xml->document_element();
    // definitions
    $n = $n->first_child();
    // resource
    $n = $n->next_sibling();
    // description
    $n = $n->first_child();
    // table
    $n = $n->next_sibling();
    // fields
    $n = $n->first_child();
    while ($n->node_name() == 'FIELD') {
        $s .= $n->get_attribute("name");
        $s .= "\t";
        $n = $n->next_sibling();
    }
    $s .= "\r\n";
    // data
    // tabledata
    $n = $n->first_child();
    // tr
    $r = $n->first_child();
    while ($r) {
        if ($r->node_name() == 'TR') {
            $f = $r->first_child();
            while ($f) {
                // td
                if ($f->node_name() == 'TD') {
                    $v = $f->first_child();
                    if ($v) {
                        $v2 = $v->node_value();
                        if ($v2 == "t") {
                            $v2 = "TRUE";
                        }
                        if ($v2 == "f") {
                            $v2 = "FALSE";
                        }
                        $s .= $v2 . "\t";
                    } else {
                        $s .= "\t";
                    }
                }
                $f = $f->next_sibling();
            }
            $s .= "\r\n";
        }
        $r = $r->next_sibling();
    }
    return $s;
}
Example #9
0
 function Main()
 {
     switch ($this->formArray["formAction"]) {
         case "delete":
             if (count($this->formArray["propAssessKindsID"]) > 0) {
                 $PropAssessKindsList = new SoapObject(NCCBIZ . "PropAssessKindsList.php", "urn:Object");
                 if (!($deletedRows = $PropAssessKindsList->deletePropAssessKinds($this->formArray["propAssessKindsID"]))) {
                     $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 "activate":
             $PropAssessKindsList = new SoapObject(NCCBIZ . "PropAssessKindsList.php", "urn:Object");
             if (!($activeRows = $PropAssessKindsList->updateStatus($this->formArray["status"]))) {
                 $this->tpl->set_var("msg", "All records have status made <i>inactive</i>");
             } else {
                 $this->tpl->set_var("msg", $activeRows . " records have status made <i>active</i>");
             }
             break;
         case "cancel":
             header("location: PropAssessKindsList.php");
             exit;
             break;
         default:
             $this->tpl->set_var("msg", "");
     }
     $PropAssessKindsList = new SoapObject(NCCBIZ . "PropAssessKindsList.php", "urn:Object");
     if (!($xmlStr = $PropAssessKindsList->getPropAssessKindsList())) {
         $this->tpl->set_block("rptsTemplate", "Table", "TableBlock");
         $this->tpl->set_var("TableBlock", "database is empty");
     } else {
         if (!($domDoc = domxml_open_mem($xmlStr))) {
             $this->tpl->set_block("rptsTemplate", "Table", "TableBlock");
             $this->tpl->set_var("TableBlock", "error xmlDoc");
         } else {
             $propAssessKindsRecords = new PropAssessKindsRecords();
             $propAssessKindsRecords->parseDomDocument($domDoc);
             $list = $propAssessKindsRecords->getArrayList();
             $this->tpl->set_block("rptsTemplate", "PropAssessKindsList", "PropAssessKindsListBlock");
             foreach ($list as $key => $listValue) {
                 $this->tpl->set_var("propAssessKindsID", $listValue->getPropAssessKindsID());
                 $this->tpl->set_var("code", $listValue->getCode());
                 $this->tpl->set_var("description", $listValue->getDescription());
                 $this->tpl->set_var("value", $listValue->getValue());
                 $this->tpl->set_var("status", $listValue->getStatus());
                 $this->tpl->set_var("statusCheck", $this->getStatusCheck($listValue->getStatus()));
                 $this->tpl->parse("PropAssessKindsListBlock", "PropAssessKindsList", true);
             }
         }
     }
     $this->tpl->parse("templatePage", "rptsTemplate");
     $this->tpl->finish("templatePage");
     $this->tpl->p("templatePage");
 }
Example #10
0
 function Main()
 {
     switch ($this->formArray["formAction"]) {
         case "save":
             $AFSDetails = new SoapObject(NCCBIZ . "AFSDetails.php", "urn:Object");
             if (!($xmlStr = $AFSDetails->getAFS($this->formArray["afsID"]))) {
                 exit("error xml");
             } else {
                 if (!($domDoc = domxml_open_mem($xmlStr))) {
                     exit("error domDoc");
                 } else {
                     $AFSEncode = new SoapObject(NCCBIZ . "AFSEncode.php", "urn:Object");
                     $afs = new AFS();
                     $afs->parseDomDocument($domDoc);
                     $afs->setArpNumber($this->formArray["arpNumber"]);
                     $afs->setPropertyIndexNumber($this->formArray["propertyIndexNumber"]);
                     $afs->setTaxability($this->formArray["taxability"]);
                     $afs->setEffectivity($this->formArray["effectivity"]);
                     $afs->setDomDocument();
                     $doc = $afs->getDomDocument();
                     $xmlStr = $doc->dump_mem(true);
                     if (!($ret = $AFSEncode->updateAFS($xmlStr))) {
                         exit("error update");
                     }
                 }
             }
             header("location: RPUIdentificationClose.php" . $this->sess->url("") . $this->sess->add_query(array("afsID" => $this->formArray["afsID"])));
             exit;
             break;
         default:
             $AFSDetails = new SoapObject(NCCBIZ . "AFSDetails.php", "urn:Object");
             $AFSDetails = new SoapObject(NCCBIZ . "AFSDetails.php", "urn:Object");
             if (!($xmlStr = $AFSDetails->getAFS($this->formArray["afsID"]))) {
                 exit("error xml");
             } else {
                 //echo $xmlStr;
                 if (!($domDoc = domxml_open_mem($xmlStr))) {
                     exit("error domDoc");
                 } else {
                     $afs = new AFS();
                     $afs->parseDomDocument($domDoc);
                     $this->formArray["afsID"] = $afs->getAfsID();
                     $this->formArray["arpNumber"] = $afs->getArpNumber();
                     $this->formArray["taxability"] = $afs->getTaxability();
                     $this->formArray["effectivity"] = $afs->getEffectivity();
                     $this->formArray["propertyIndexNumber"] = $afs->getPropertyIndexNumber();
                 }
             }
             break;
     }
     $this->setForm();
     $this->tpl->set_var("Session", $this->sess->url("") . $this->sess->add_query(array("afsID" => $this->formArray["afsID"])));
     $this->tpl->parse("templatePage", "rptsTemplate");
     $this->tpl->finish("templatePage");
     $this->tpl->p("templatePage");
 }
Example #11
0
 function updateDue($xmlStr)
 {
     if (!($domDoc = domxml_open_mem($xmlStr))) {
         return false;
     }
     $due = new Due();
     $due->parseDomDocument($domDoc);
     $ret = $due->updateRecord();
     return $ret;
 }
Example #12
0
 function updateLandSubclasses($xmlStr)
 {
     if (!($domDoc = domxml_open_mem($xmlStr))) {
         return false;
     }
     $landSubclasses = new LandSubclasses();
     $landSubclasses->parseDomDocument($domDoc);
     $ret = $landSubclasses->updateRecord();
     return $ret;
 }
 function updateMachineriesDepreciation($xmlStr)
 {
     if (!($domDoc = domxml_open_mem($xmlStr))) {
         return false;
     }
     $machineriesDepreciation = new MachineriesDepreciation();
     $machineriesDepreciation->parseDomDocument($domDoc);
     $ret = $machineriesDepreciation->updateRecord();
     return $ret;
 }
Example #14
0
 function updatePropAssessKinds($xmlStr)
 {
     if (!($domDoc = domxml_open_mem($xmlStr))) {
         return false;
     }
     $propAssessKinds = new PropAssessKinds();
     $propAssessKinds->parseDomDocument($domDoc);
     $ret = $propAssessKinds->updateRecord();
     return $ret;
 }
Example #15
0
 function updateCollection($xmlStr)
 {
     if (!($domDoc = domxml_open_mem($xmlStr))) {
         return false;
     }
     $collection = new Collection();
     $collection->parseDomDocument($domDoc);
     $ret = $collection->updateRecord();
     return $ret;
 }
Example #16
0
 function updatePropertyInfo($xmlStr)
 {
     if (!($domDoc = domxml_open_mem($xmlStr))) {
         $ret = false;
     }
     $od = new OD();
     $od->parseDomDocument($domDoc);
     $ret = $od->updateRecord();
     return $ret;
 }
Example #17
0
 function updateAssessor($xmlStr)
 {
     if (!($domDoc = domxml_open_mem($xmlStr))) {
         return false;
     }
     $assessor = new Assessor();
     $assessor->parseDomDocument($domDoc);
     $ret = $assessor->updateRecord();
     return $ret;
 }
Example #18
0
 function updateBacktaxTD($xmlStr)
 {
     if (!($domDoc = domxml_open_mem($xmlStr))) {
         return false;
     }
     $backtaxTD = new BacktaxTD();
     $backtaxTD->parseDomDocument($domDoc);
     $ret = $backtaxTD->updateRecord();
     return $ret;
 }
Example #19
0
 function updatePayment($xmlStr)
 {
     if (!($domDoc = domxml_open_mem($xmlStr))) {
         return false;
     }
     $payment = new Payment();
     $payment->parseDomDocument($domDoc);
     $ret = $payment->updateRecord();
     return $ret;
 }
Example #20
0
 function updateProvince($xmlStr)
 {
     if (!($domDoc = domxml_open_mem($xmlStr))) {
         return false;
     }
     $province = new Province();
     $province->parseDomDocument($domDoc);
     $ret = $province->updateRecord();
     return $ret;
 }
Example #21
0
 function updateAFS($xmlStr)
 {
     if (!($domDoc = domxml_open_mem($xmlStr))) {
         return false;
     }
     $afs = new AFS();
     $afs->parseDomDocument($domDoc);
     $ret = $afs->updateRecord();
     return $ret;
 }
Example #22
0
 function updateDistrict($xmlStr)
 {
     if (!($domDoc = domxml_open_mem($xmlStr))) {
         return false;
     }
     $district = new District();
     $district->parseDomDocument($domDoc);
     $ret = $district->updateRecord();
     return $ret;
 }
Example #23
0
 function updateBarangay($xmlStr)
 {
     if (!($domDoc = domxml_open_mem($xmlStr))) {
         return false;
     }
     $barangay = new Barangay();
     $barangay->parseDomDocument($domDoc);
     $ret = $barangay->updateRecord();
     return $ret;
 }
Example #24
0
 function updateERPTSSettings($xmlStr)
 {
     if (!($domDoc = domxml_open_mem($xmlStr))) {
         return false;
     }
     $erptsSettings = new eRPTSSettings();
     $erptsSettings->parseDomDocument($domDoc);
     $ret = $erptsSettings->updateRecord();
     return $ret;
 }
Example #25
0
 function updateRPTOPtotals($xmlStr)
 {
     if (!($domDoc = domxml_open_mem($xmlStr))) {
         return false;
     }
     $rptop = new RPTOP();
     $rptop->parseDomDocument($domDoc);
     $ret = $rptop->updateRecordTotals();
     return $ret;
 }
Example #26
0
 function updateMunicipalityCity($xmlStr)
 {
     if (!($domDoc = domxml_open_mem($xmlStr))) {
         return false;
     }
     $municipalityCity = new MunicipalityCity();
     $municipalityCity->parseDomDocument($domDoc);
     $ret = $municipalityCity->updateRecord();
     return $ret;
 }
 function updateImprovementsBuildingsDepreciation($xmlStr)
 {
     if (!($domDoc = domxml_open_mem($xmlStr))) {
         return false;
     }
     $improvementsBuildingsDepreciation = new ImprovementsBuildingsDepreciation();
     $improvementsBuildingsDepreciation->parseDomDocument($domDoc);
     $ret = $improvementsBuildingsDepreciation->updateRecord();
     return $ret;
 }
Example #28
0
 function updateUser($xmlStr)
 {
     if (!($domDoc = domxml_open_mem($xmlStr))) {
         return false;
     }
     $user = new User();
     $user->parseDomDocument($domDoc);
     $ret = $user->updateRecord();
     return $ret;
 }
Example #29
0
 function updateStorey($xmlStr)
 {
     if (!($domDoc = domxml_open_mem($xmlStr))) {
         return false;
     }
     $storey = new Storey();
     $storey->parseDomStorey($domDoc);
     $ret = $storey->updateStorey();
     return $ret;
 }
Example #30
0
 function updatePlantsTreesClasses($xmlStr)
 {
     if (!($domDoc = domxml_open_mem($xmlStr))) {
         return false;
     }
     $plantsTreesClasses = new PlantsTreesClasses();
     $plantsTreesClasses->parseDomDocument($domDoc);
     $ret = $plantsTreesClasses->updateRecord();
     return $ret;
 }