本文整理汇总了PHP中Person::parseDomDocument方法的典型用法代码示例。如果您正苦于以下问题:PHP Person::parseDomDocument方法的具体用法?PHP Person::parseDomDocument怎么用?PHP Person::parseDomDocument使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Person
的用法示例。
在下文中一共展示了Person::parseDomDocument方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updatePerson
function updatePerson($xmlStr)
{
if (!($domDoc = domxml_open_mem($xmlStr))) {
return false;
}
$person = new Person();
$person->parseDomDocument($domDoc);
$ret = $person->updateRecord();
return $ret;
}
示例2: parseDomDocument
function parseDomDocument($domDoc)
{
$baseNode = $domDoc->document_element();
if ($baseNode->has_child_nodes()) {
$child = $baseNode->first_child();
while ($child) {
//if ($child->tagname=="Person") {
if ($child->tagname) {
$tempXmlStr = $domDoc->dump_node($child);
$tempDomDoc = domxml_open_mem($tempXmlStr);
$person = new Person();
$person->parseDomDocument($tempDomDoc);
$this->arrayList[] = $person;
}
$child = $child->next_sibling();
}
} else {
return false;
}
return $this->setDomDocument();
}
示例3: getPersonName
function getPersonName($personID)
{
$PersonDetails = new SoapObject(NCCBIZ . "PersonDetails.php", "urn:Object");
if (!($xmlStr = $PersonDetails->getPersonDetails($personID))) {
// error xmlStr
return "xmlStr";
} else {
if (!($domDoc = domxml_open_mem($xmlStr))) {
// error domDoc
return "domDoc";
} else {
$person = new Person();
$person->parseDomDocument($domDoc);
$personName = $person->getFirstName();
if ($person->getMiddleName() != "") {
$personName .= " " . substr($person->getMiddleName(), 0, 1) . ".";
}
$personName .= " " . $person->getLastName();
//$personName = $person->getFullName();
return $personName;
}
}
}
示例4: parseDomDocument
function parseDomDocument($domDoc)
{
//echo "<br>parsing<br>";
$ret = true;
if (is_object($domDoc)) {
$baseNode = $domDoc->document_element();
if ($baseNode->has_child_nodes()) {
$child = $baseNode->first_child();
while ($child) {
//echo "parse->".$child->tagname."<br>";
switch ($child->tagname) {
case "propertyAdministrator":
//echo "location<br>";
$propertyAdministratorNode = $child->first_child();
while ($propertyAdministratorNode) {
//if ($propertyAdministratorNode->tagname=="Person") {
if ($propertyAdministratorNode->tagname) {
$tempXmlStr = $domDoc->dump_node($propertyAdministratorNode);
$tempDomDoc = domxml_open_mem($tempXmlStr);
$propertyAdministrator = new Person();
$ret = $propertyAdministrator->parseDomDocument($tempDomDoc);
$this->propertyAdministrator = $propertyAdministrator;
}
$propertyAdministratorNode = $propertyAdministratorNode->next_sibling();
}
break;
default:
//eval("\$this->".$child->tagname."= \"".$child->get_content()."\";");
// test varvars
$varvar = $child->tagname;
$trans = array_flip(get_html_translation_table(HTML_ENTITIES));
$childContent = strtr(html_entity_decode($child->get_content()), $trans);
$this->{$varvar} = html_entity_decode($childContent);
//$this->$varvar = $child->get_content();
}
$child = $child->next_sibling();
}
}
$this->setDomDocument();
$ret = true;
} else {
$ret = false;
}
return $ret;
}
示例5: parseDomDocument
function parseDomDocument($domDoc)
{
//echo $domDoc->dump_mem(true);
$ret = true;
$baseNode = $domDoc->document_element();
if ($baseNode->has_child_nodes()) {
$child = $baseNode->first_child();
while ($child) {
switch ($child->tagname) {
case "personArray":
$personNode = $child->first_child();
while ($personNode) {
if ($personNode->tagname == "Person") {
//if ($personNode->tagname) {
$tempXmlStr = $domDoc->dump_node($personNode);
$tempDomDoc = domxml_open_mem($tempXmlStr);
$person = new Person();
$ret = $person->parseDomDocument($tempDomDoc);
$this->setPersonArray($person);
}
$personNode = $personNode->next_sibling();
}
break;
case "companyArray":
$companyNode = $child->first_child();
while ($companyNode) {
if ($companyNode->tagname == "Company") {
//if ($companyNode->tagname) {
$tempXmlStr = $domDoc->dump_node($companyNode);
$tempDomDoc = domxml_open_mem($tempXmlStr);
$company = new Company();
$ret = $company->parseDomDocument($tempDomDoc);
$this->setCompanyArray($company);
}
$companyNode = $companyNode->next_sibling();
}
break;
default:
//eval("\$this->".$child->tagname." = \"".$child->get_content()."\";");
// test varvars
$varvar = $child->tagname;
$trans = array_flip(get_html_translation_table(HTML_ENTITIES));
$childContent = strtr(html_entity_decode($child->get_content()), $trans);
$this->{$varvar} = html_entity_decode($childContent);
//$this->$varvar = html_entity_decode($child->get_content());
}
$child = $child->next_sibling();
}
}
$this->setDomDocument();
return $ret;
}
示例6: Main
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"]);
//.........这里部分代码省略.........
示例7: Main
function Main()
{
switch ($this->formArray["formAction"]) {
case "edit":
$UserDetails = new SoapObject(NCCBIZ . "UserDetails.php", "urn:Object");
if (!($xmlStr = $UserDetails->getUserDetails($this->formArray["userID"]))) {
$this->tpl->set_block("rptsTemplate", "Table", "TableBlock");
$this->tpl->set_var("TableBlock", "User 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 {
$user = new User();
$user->parseDomDocument($domDoc);
$this->formArray["userID"] = $user->getUserID();
$this->formArray["userType"] = $user->getUserType();
$this->formArray["username"] = $user->getUsername();
$this->formArray["password"] = $user->getPassword();
$this->formArray["personID"] = $user->getPersonID();
$this->formArray["status"] = $user->getStatus();
}
}
$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", "Person 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();
}
}
$this->tpl->set_block("rptsTemplate", "NewUserPassword", "NewUserPasswordBlock");
$this->tpl->set_var("NewUserPasswordBlock", "");
$this->tpl->set_block("rptsTemplate", "OldUserPassword", "OldUserPasswordBlock");
$this->tpl->set_var("oldNewUserRowspan", 5);
//$this->tpl->set_var("oldNewUserRowspan", 3);
$this->tpl->parse("OldUserPasswordBlock", "OldUserPassword", true);
break;
case "save":
/*
if($this->isOldPasswordCorrect()==false){
$this->message = "Error. Cannot Save. Old password incorrect to create new password.";
$this->tpl->set_var("message", $this->message);
$this->tpl->parse("MessageBlock", "Message", true);
$this->tpl->set_block("rptsTemplate", "NewUserPassword", "NewUserPasswordBlock");
$this->tpl->set_var("NewUserPasswordBlock", "");
$this->tpl->set_block("rptsTemplate", "OldUserPassword", "OldUserPasswordBlock");
$this->tpl->set_var("oldNewUserRowspan", 3);
$this->tpl->parse("OldUserPasswordBlock", "OldUserPassword", true);
break;
}
*/
if ($this->formArray["newPassword"] != "" && $this->formArray["newPassword"] != "null") {
$this->formArray["password"] = md5($this->formArray["newPassword"]);
}
if ($this->usernameAlreadyExists() == true) {
$this->message = "Error. Cannot Save. Username already exists.";
$this->tpl->set_var("message", $this->message);
$this->tpl->parse("MessageBlock", "Message", true);
$this->tpl->set_block("rptsTemplate", "NewUserPassword", "NewUserPasswordBlock");
$this->tpl->set_block("rptsTemplate", "OldUserPassword", "OldUserPasswordBlock");
if ($this->formArray["personID"] != "") {
$this->tpl->set_var("NewUserPasswordBlock", "");
$this->tpl->set_var("oldNewUserRowspan", 3);
$this->tpl->parse("OldUserPasswordBlock", "OldUserPassword", true);
} else {
$this->tpl->set_var("oldNewUserRowspan", 2);
$this->tpl->parse("NewUserPasswordBlock", "NewUserPassword", true);
$this->tpl->set_var("OldUserPasswordBlock", "");
//.........这里部分代码省略.........
示例8: Main
function Main($referer = "")
{
//if (trim($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);
$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);
$this->formArray["personID"] = $person->getPersonID();
$this->formArray["personName"] = $person->getFullName();
$this->formArray["lastName"] = $person->getLastName();
$this->formArray["firstName"] = $person->getFirstName();
$this->formArray["middleName"] = $person->getMiddleName();
$this->formArray["gender"] = $person->getGender();
$this->formArray["birthday"] = $person->getBirthday();
$this->formArray["maritalStatus"] = $person->getMaritalStatus();
$this->formArray["tin"] = $person->getTin();
$address = $person->addressArray[0];
if (is_a($address, Address)) {
$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();
}
}
if ($this->formArray["formAction"] == "viewOnly") {
$this->tpl->set_block("rptsTemplate", "ViewOnly", "ViewOnlyBlock");
$this->tpl->set_var("ViewOnlyBlock", "");
}
break;
case "cancel":
//header("location: PersonList.php");
exit;
break;
default:
$this->tpl->set_block("rptsTemplate", "ACK", "ACKBlock");
$this->tpl->set_var("ACKBlock", "");
}
//*/
$this->tpl->set_var("Session", $this->sess->url(""));
$this->setForm();
$this->tpl->parse("templatePage", "rptsTemplate");
$this->tpl->finish("templatePage");
$this->tpl->p("templatePage");
}