예제 #1
0
 /**
  * Repair HTML/XML and return array
  * @param  string        $xml XML for processing
  * @return array|boolean      Array on success, false on failure
  */
 public static function htmlFixXmlToArray($xml)
 {
     $xmltoarray = new xmltoarray_parser_htmlfix();
     //create instance of class
     $xmltoarray->xmlparser_setoption(XML_OPTION_SKIP_WHITE, 1);
     //set options same as xml_parser_set_option
     $xmltoarray->xmlparser_setoption(XML_OPTION_CASE_FOLDING, 0);
     $xmltoarray->xmlparser_fix_into_struct(base64_decode($xml));
     //fixes html values for XML
     $array = $xmltoarray->createArray();
     //creates an array with fixed html values
     foreach ($array as $key => $value) {
         $array[$key] = $xmltoarray->fix_html_entities($value);
         //returns proper html values
     }
     if (array_key_exists('NewDataSet', $array) && array_key_exists('Table', $array['NewDataSet'])) {
         $array = $array['NewDataSet']['Table'];
     } else {
         $array = false;
     }
     return $array;
 }
$xml1_0['patientRequest']['PatientId'] = $patientid;
$xml1_0['prescriptionHistoryRequest']['StartHistory'] = '2011-01-01T00:00:00.000';
$xml1_0['prescriptionHistoryRequest']['EndHistory'] = date('Y-m-d') . 'T23:59:59.000';
$xml1_0['prescriptionHistoryRequest']['PrescriptionStatus'] = 'C';
$xml1_0['prescriptionHistoryRequest']['PrescriptionSubStatus'] = '%';
$xml1_0['prescriptionHistoryRequest']['PrescriptionArchiveStatus'] = 'N';
$user_details = sqlQuery("SELECT * FROM users WHERE id = ?", array($_SESSION['authUserID']));
$xml1_0['patientInformationRequester']['UserType'] = 'D';
$xml1_0['patientInformationRequester']['UserId'] = $user_details['id'];
$xml1_0['patientIdType'] = '';
$xml1_0['includeSchema'] = '';
$xml = $client->GetPatientFullMedicationHistory6($xml1_0);
$xml_response = $xml->GetPatientFullMedicationHistory6Result->XmlResponse;
$xml_response_count = $xml->GetPatientFullMedicationHistory6Result->RowCount;
$xml_response = base64_decode($xml_response);
$xmltoarray = new xmltoarray_parser_htmlfix();
//create instance of class
$xmltoarray->xmlparser_setoption(XML_OPTION_SKIP_WHITE, 1);
//set options same as xml_parser_set_option
$xmltoarray->xmlparser_setoption(XML_OPTION_CASE_FOLDING, 0);
$xmltoarray->xmlparser_fix_into_struct($xml_response);
//fixes html values for XML
$array = $xmltoarray->createArray();
//creates an array with fixed html values
foreach ($array as $key => $value) {
    $array[$key] = $xmltoarray->fix_html_entities($value);
    //returns proper html values
}
$medArray = $array['NewDataSet']['Table'];
//print_r($medArray);die;
sqlQuery("update prescriptions set active=0 where patient_id=? and erx_source='1'", array($patientid));