/** * @see parent::getValue() */ function getValue($object, $smarty = null, $params = array()) { $value = $object->{$this->fieldName}; if (isset($params["advanced"]) && $params["advanced"]) { $message = new CHL7v2Message(); $message->parse($value); return $message->flatten(true); } return CHL7v2Message::highlight($value); }
$msg->version = "2.5"; $msg->name = "ADT_A08"; //$msg->fieldSeparator = "a"; //$msg->componentSeparator = "b"; //$msg->subcomponentSeparator = "e"; //$msg->repetitionSeparator = "c"; //$msg->escapeCharacter = "d"; $segment = CHL7v2Segment::create("MSH", $msg); $data = array(null, null, "Mediboard", "Mediboard_finess", "no_receiver", null, CMbDT::dateTime(), null, null, "Msg ctrl id", "A", null, 15, null, null, null, null, "8859/1", null, null, null); $segment->fill($data); $msg->appendChild($segment); $segment = CHL7v2Segment::create("PID", $msg); $data = array(0 => 1, 1 => null, 2 => array(0 => array(0 => '323241', 1 => null, 2 => null, 3 => array(0 => 'Mediboard', 1 => '1.2.250.1.2.3.4', 2 => 'OpenXtrem'), 4 => 'RI'), 1 => array(0 => 'fgfg', 1 => null, 2 => null, 3 => array(0 => null, 1 => '1.2.250.1.213.1.4.2', 2 => 'ISO'), 4 => 'INS-C', 5 => null, 6 => '1946-10-17')), 3 => null, 4 => array(0 => array(0 => 'EZZHJ', 1 => 'Rtaso', 2 => 'qldax', 3 => null, 4 => 'dr', 5 => null, 6 => 'D', 7 => 'A'), 1 => array(0 => 'MEBJO', 1 => 'Rtaso', 2 => 'qldax', 3 => null, 4 => 'dr', 5 => null, 6 => 'L', 7 => 'A')), 5 => null, 6 => '1987-09-24', 7 => 'F', 8 => null, 9 => null, 10 => array(0 => array(0 => "adresse test \r\n \\ | & ^ ~", 1 => null, 2 => 'rtckkljfgrw', 3 => null, 4 => '4294967295', 5 => null, 6 => 'H'), 1 => array(0 => null, 1 => null, 2 => 'vlfxif', 3 => null, 4 => '40048', 5 => '000', 6 => 'BR')), 11 => null, 12 => array(0 => array(0 => '43502', 1 => 'PRN', 2 => 'PH'), 1 => array(0 => '42287', 1 => 'ORN', 2 => 'CP'), 2 => array(0 => 'oezym', 1 => 'ORN', 2 => 'PH')), 13 => null, 14 => null, 15 => null, 16 => null, 17 => null, 18 => null, 19 => null, 20 => null, 21 => null, 22 => null, 23 => null, 24 => null, 25 => null, 26 => null, 27 => null, 28 => '1905-05-06', 29 => 'Y'); $segment->fill($data); $msg->appendChild($segment); $msg->validate(); foreach ($msg->errors as $error) { mbTrace(@$error->entity->getPathString(), CAppUI::tr("CHL7v2Exception-" . $error->code) . " - " . $error->data); } echo "Généré"; echo $msg->flatten(true); $message_str = $msg->flatten(); echo "Parsé"; $msg2 = new CHL7v2Message(); $msg2->parse($message_str); $msg2->validate(); foreach ($msg2->errors as $error) { mbTrace(@$error->entity->getPathString(), CAppUI::tr("CHL7v2Exception-" . $error->code) . " - " . $error->data); } echo $msg2->flatten(true);