当前位置: 首页>>代码示例>>PHP>>正文


PHP Array2XML::init方法代码示例

本文整理汇总了PHP中Array2XML::init方法的典型用法代码示例。如果您正苦于以下问题:PHP Array2XML::init方法的具体用法?PHP Array2XML::init怎么用?PHP Array2XML::init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Array2XML的用法示例。


在下文中一共展示了Array2XML::init方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setDocument

 function setDocument($xml)
 {
     $this->document = $this->XmlToArray($xml);
     unset($this->document['ClinicalDocument']['@attributes']);
     Array2XML::init('1.0', 'UTF-8', true, ['xml-stylesheet' => 'type="text/xsl" href="' . URL . '/lib/CCRCDA/schema/cda2.xsl"']);
     $data = ['@attributes' => ['xmlns' => 'urn:hl7-org:v3', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation' => 'urn:hl7-org:v3 CDA.xsd']];
     foreach ($this->document['ClinicalDocument'] as $i => $com) {
         $data[$i] = $com;
     }
     // Building the document
     $this->styledXml = Array2XML::createXML('ClinicalDocument', $data)->saveXML();
     unset($data);
     $this->index = [];
     foreach ($this->document['ClinicalDocument']['component']['structuredBody']['component'] as $index => $component) {
         $code = isset($component['section']['code']['@attributes']['code']) ? $component['section']['code']['@attributes']['code'] : '';
         //Advance Directives ???
         switch ($code) {
             case '48765-2':
                 $this->index['allergies'] = $index;
                 break;
             case '10160-0':
                 $this->index['medications'] = $index;
                 break;
             case '11450-4':
                 $this->index['problems'] = $index;
                 break;
             case '47519-4':
                 $this->index['procedures'] = $index;
                 break;
             case '30954-2':
                 $this->index['results'] = $index;
                 break;
             case '46240-8':
                 $this->index['encounters'] = $index;
                 break;
             case '51847-2':
                 $this->index['assessments'] = $index;
                 break;
             case '46239-0':
                 $this->index['chiefcomplaint'] = $index;
                 break;
             default:
                 $tplId = isset($component['section']['templateId']['@attributes']['root']) ? $component['section']['templateId']['@attributes']['root'] : '';
                 if ($tplId == '2.16.840.1.113883.10.20.22.2.21.1') {
                     $this->index['advancedirectives'] = $index;
                 }
                 break;
         }
     }
 }
开发者ID:igez,项目名称:gaiaehr,代码行数:50,代码来源:CCDDocumentParse.php

示例2: getXMLDocument

 function getXMLDocument()
 {
     try {
         $filePointer = "../reports/{$this->reportDir}/reportStatement.sql";
         if (file_exists($filePointer) && is_readable($filePointer)) {
             // Important connection parameter, this will allow multiple
             // prepare tags with the same name.
             $this->conn = Matcha::getConn();
             $this->conn->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
             // Get the report SQL statement content
             $fileContent = file_get_contents($filePointer);
             // Copy all the request variables into the Prepared Values,
             // also check if it came from the grid form and normal form.
             // This because we need to do a POST-PREPARE the SQL statement
             foreach ($this->request as $field) {
                 $PrepareField[':' . $field['name']]['operator'] = isset($field['operator']) ? $field['operator'] : '=';
                 $PrepareField[':' . $field['name']]['value'] = $field['value'];
             }
             // Copy all the request filter variables to the XML,
             // also check if it came from the grid form and normal form.
             // This because we need to do a POST-PREPARE the SQL statement
             foreach ($this->request as $field) {
                 $ReturnFilter[$field['name']]['operator'] = isset($field['operator']) ? $field['operator'] : '=';
                 $ReturnFilter[$field['name']]['value'] = $field['value'];
             }
             // Prepare all the variable fields in the SQL Statement
             $PreparedSQL = $this->PostPrepare($fileContent, $PrepareField);
             $Queries = explode(';', $PreparedSQL);
             // Run all the SQL Statement separated by `;` in the file
             foreach ($Queries as $Query) {
                 if (strlen(trim($Query)) > 0) {
                     $SQL = $this->conn->prepare($Query);
                     $SQL->execute();
                     $records[] = $SQL->fetchAll(PDO::FETCH_ASSOC);
                 }
             }
             $ExtraAttributes['xml-stylesheet'] = 'type="text/xsl" href="report.xsl"';
             Array2XML::init('1.0', 'UTF-8', true, $ExtraAttributes);
             $xml = Array2XML::createXML('records', array('filters' => $ReturnFilter, 'record' => $records[count($records) - 1]));
             return $xml->saveXML();
         } else {
             throw new Exception('Error: Not SQL Statement file was found or readable.');
         }
     } catch (Exception $Error) {
         error_log(print_r($Error, true));
         return $Error;
     }
 }
开发者ID:igez,项目名称:gaiaehr,代码行数:48,代码来源:ReportGenerator.php

示例3: translateOneNode


//.........这里部分代码省略.........
        //	If yes, return the node# and alias in an array
        //	otherwise, $oldNodeID_ary['number'] == ''
        $oldNodeID_ary = findOldTranslation($currentNodeID, $to_language);
        $oldNodeID = $oldNodeID_ary['number'];
        $oldNodeIDalias = $oldNodeID_ary['url_alias'];
        if ($oldNodeID != "") {
            echo "\nFound old node number -- old={$oldNodeID}\n";
        }
        if ($oldNodeIDalias != "") {
            echo "\nFound old node number alias -- old={$oldNodeIDalias}\n";
        }
        // Update the nid and tnid fields
        //    For new nodes, nid=''
        //    and tnid = the current nid value
        $XMLarray['node_export']['node']['tnid'] = $currentNodeID;
        $XMLarray['node_export']['node']['nid'] = $oldNodeID;
        // $XMLarray['node_export']['node']['language'] = $oldNodeID['drupal_lang_code'];
        $XMLarray['node_export']['node']['language'] = $drupalLanguageCode;
        // // // $XMLarray['node_export']['node']['path'] = $oldNodeID['url_alias'];
        if (isset($XMLarray['node_export']['node']['xmlsitemap']['language'])) {
            //	$XMLarray['node_export']['node']['xmlsitemap']['language'] = $oldNodeID['drupal_lang_code'];
            $XMLarray['node_export']['node']['xmlsitemap']['language'] = $drupalLanguageCode;
        }
        //echo "XMLARRAY = \n";
        //print_r($XMLarray);
        $FOO = $XMLarray['node_export']['node']['nodewords']['location']['latitude'];
        $BAR = $XMLarray['node_export']['node']['nodewords']['location']['longitude'];
        echo "FOO = {$FOO}\nBAR = {$BAR}\n";
        // If lat or long > 8 chars, set to zero, otherwise node will not import
        if (isset($XMLarray['node_export']['node']['nodewords']['location']['latitude'])) {
            if (strlen($XMLarray['node_export']['node']['nodewords']['location']['latitude']) > 8) {
                $XMLarray['node_export']['node']['nodewords']['location']['latitude'] = 0;
            }
        }
        if (isset($XMLarray['node_export']['node']['nodewords']['location']['longitude'])) {
            if (strlen($XMLarray['node_export']['node']['nodewords']['location']['longitude']) > 8) {
                $XMLarray['node_export']['node']['nodewords']['location']['longitude'] = 0;
            }
        }
        // Adjust the menu references
        $this_plid = $XMLarray['node_export']['node']['menu']['plid'];
        $this_menu_name = $XMLarray['node_export']['node']['menu']['menu_name'];
        if ($this_menu_name == "primary-links") {
            $mquery = "SELECT t_menuid from sovee.menus LEFT JOIN sovee.languages on sovee.menus.language_code = sovee.languages.id  WHERE drupal_code = \"" . $drupalLanguageCode . "\" and Eng_menuid = \"" . $this_plid . "\"";
            echo "MQ = {$mquery}\n";
            $rmquery = mysql_query($mquery, $db);
            $err_msg = trim(mysql_error($db));
            if (strlen($err_msg) > 0) {
                echo "{$mquery}\n{$err_msg}\n\n\n";
            }
            while ($m1 = mysql_fetch_assoc($rmquery)) {
                $newPlid = $m1['t_menuid'];
                $XMLarray['node_export']['node']['menu']['plid'] = $newPlid;
            }
            mysql_free_result($rmquery);
        }
        // Convert array back to XML
        $encoding = "UTF-8";
        $xmlVersion = "1.0";
        Array2XML::init($xmlVersion, $encoding);
        $xmlobj = Array2XML::createXML('DELETE_ME', $XMLarray);
        // Convert a PHP array to XML, using 'DELETE_ME' as the root_node_name
        $translated_xml = $xmlobj->saveXML();
        //  Returned object is of type DOMDocument
        $translated_xml = preg_replace("/<[\\/]?DELETE_ME>[\n]/u", "", $translated_xml);
        $fn = getcwd() . "/TRANSLATED_" . $drupalLanguageCode . "_" . $currentNodeID . ".XML";
        echo "WRITING {$fn}\n";
        $fh = fopen($fn, "w");
        fwrite($fh, $translated_xml);
        fclose($fh);
        // If node translation was successful,
        // import the translated node back into Drupal
        if ($error_IncompleteNodeFlag == 0) {
            $cmd = "/usr/bin/drush --root=/var/www/pressflow node-export-import --file={$fn}";
            echo "COMMAND = {$cmd}\n";
            $success = `{$cmd}`;
            $error = "DRUSH IMPORT RESULTS: {$success}\n";
            echo $error;
            fwrite($error_log, $error);
            $cmd = "/bin/rm {$fn}";
            #$success = `$cmd`;
            $q1 = "INSERT INTO sovee.progress (node, status, type, language) VALUES(\"" . $currentNodeID . "\", \"1\", \"" . $derivedContentType . "\", \"" . $to_language . "\") ON DUPLICATE KEY UPDATE status=VALUES(status)";
            echo "Q1={$q1}\n";
            $r1 = mysql_query($q1, $db);
        } else {
            $error = "Node {$currentNodeID} ({$content_type}) not completely translated. Not importing into Drupal.\n";
            echo $error;
            $q1 = "INSERT INTO sovee.progress (node, status, type, language) VALUES(\"" . $currentNodeID . "\", \"0\", \"" . $derivedContentType . "\", \"" . $to_language . "\")  ON DUPLICATE KEY UPDATE status=VALUES(status)";
            $r1 = mysql_query($q1, $db);
            $err_msg = trim(mysql_error($db));
            if (strlen($err_msg) > 0) {
                echo "{$q1}\n{$err_msg}\n\n\n";
            }
            fwrite($error_log, $error);
        }
        echo "==========                                                                 ==========\n=====================================================================================\n";
    }
    $translated_xml_array = array('status' => $error_IncompleteNodeFlag, 'translated_xml' => $translated_xml);
    return $translated_xml_array;
}
开发者ID:nightbeacons,项目名称:translate,代码行数:101,代码来源:content.php

示例4: array

        $nodo = array();
        foreach ($campos as $x => $val) {
            $nodo[$val] = $_POST[$val][$i];
            if (!$nodo[$val] || empty($nodo[$val])) {
                $errores[] = "No value for " . $val . " " . $i;
            }
        }
        $nodo["@attributes"] = array("id" => $_POST['id'][$i]);
        $TelevisionArrForm[] = $nodo;
        //krumo($nodo);
    }
    //krumo($TelevisionArrForm);
    $Television = array("Televisions" => array("Television" => $TelevisionArrForm, "@attributes" => array("noNamespaceSchemaLocation" => "Televisions.xsd")));
    //krumo($Televisions);
    if (empty($errores)) {
        $Array2XML = Array2XML::init('1.0', 'iso-8859-1');
        $outputDestXML = Array2XML::createXML('Televisions', $Television);
        $xmlString = $outputDestXML->saveXML();
        $xmlString = utf8_encode($xmlString);
        $xmlDestinoFile = $_SESSION['workfolder_webdir'] . "Television.xml";
        $fp = fopen($xmlDestinoFile, 'w');
        fwrite($fp, $xmlString);
        fclose($fp);
    } else {
        $message = "<h3>Errores al parsear </h3>" . implode("<br>", $errores);
    }
}
/*$xml = simplexml_load_file($xmlDestino, 'SimpleXMLElement',LIBXML_NOCDATA); 
$json = json_encode($xml);
$XMLarray = json_decode($json,TRUE);
krumo($XMLarray);*/
开发者ID:TahicheVivo,项目名称:CREditor,代码行数:31,代码来源:CR_television_form2.php

示例5: createCCD

 /**
  * Method buildCCD()
  */
 public function createCCD()
 {
     try {
         if (!isset($this->pid)) {
             throw new Exception('PID variable not set');
         }
         $this->xmlData = ['@attributes' => ['xmlns' => 'urn:hl7-org:v3', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation' => 'urn:hl7-org:v3 CDA.xsd']];
         if (isset($this->eid)) {
             $this->encounter = $this->Encounter->getEncounter((int) $this->eid, false, false);
             $this->encounter = isset($this->encounter['encounter']) ? $this->encounter['encounter'] : $this->encounter;
             $this->encounterProvider = $this->User->getUserByUid($this->encounter['provider_uid']);
             $this->encounterFacility = $this->Facilities->getFacility($this->encounter['facility']);
         }
         $this->setRequirements();
         $this->setHeader();
         /**
          * Array of sections to include in CCD
          */
         $sections = ['ReasonOfVisit', 'Instructions', 'ReasonForReferral', 'Procedures', 'Vitals', 'Immunizations', 'Medications', 'MedicationsAdministered', 'PlanOfCare', 'CareOfPlan', 'Problems', 'Allergies', 'SocialHistory', 'Results', 'FunctionalStatus'];
         /**
          * Run Section method for each section
          */
         foreach ($sections as $Section) {
             call_user_func([$this, "set{$Section}Section"]);
         }
         /**
          * Build the CCR XML Object
          */
         Array2XML::init('1.0', 'UTF-8', true, ['xml-stylesheet' => 'type="text/xsl" href="' . URL . '/lib/CCRCDA/schema/cda2.xsl"']);
         $this->xml = Array2XML::createXML('ClinicalDocument', $this->xmlData);
     } catch (Exception $e) {
         print $e->getMessage();
     }
 }
开发者ID:igez,项目名称:gaiaehr,代码行数:37,代码来源:CCDDocument.php

示例6: getXMLDocument

 function getXMLDocument()
 {
     try {
         $this->conn = Matcha::getConn();
         $filePointer = "../reports/{$this->reportDir}/reportStatement.sql";
         // Important connection parameter, this will allow multiple
         // prepare tags with the same name.
         $this->conn->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
         if (file_exists($filePointer) && is_readable($filePointer)) {
             // Get the SQL content
             $fileContent = file_get_contents($filePointer);
             $RunSQL = $this->conn->prepare($fileContent);
             // Copy all the request variables into the ExecuteValues
             foreach ($this->request as $field) {
                 $PrepareField[':' . $field['name']] = $field['value'];
             }
             // Also copy all the request variables to Return variable to XML
             foreach ($this->request as $field) {
                 $ReturnFilter[$field['name']] = $field['value'];
             }
             $RunSQL->execute($PrepareField);
             $records = $RunSQL->fetchAll(PDO::FETCH_ASSOC);
             $ExtraAttributes['xml-stylesheet'] = 'type="text/xsl" href="report.xsl"';
             Array2XML::init('1.0', 'UTF-8', true, $ExtraAttributes);
             $xml = Array2XML::createXML('records', array('filters' => $ReturnFilter, 'record' => $records));
             return $xml->saveXML();
         } else {
             throw new Exception('Error: Not SQL Statement file was found or is readable.');
         }
     } catch (Exception $Error) {
         error_log(print_r($Error, true));
         return $Error;
     }
 }
开发者ID:andrewbhandari,项目名称:gaiaehr,代码行数:34,代码来源:ReportGenerator.php

示例7: array

    /**
     * Build the CCR XML Object
     */
    Array2XML::init('1.0', 'UTF-8', true, array('xml-stylesheet' => 'type="text/xsl" href="' . $_SESSION['url'] . 'lib/CCRCDA/schema/ccr.xsl"'));
    $xml = Array2XML::createXML('ContinuityOfCareRecord', $ccrArray);
    /**
     * Show the document inline
     */
    header('Content-type: application/xml');
    echo $xml->saveXML();
}
if ($_REQUEST['action'] == 'ccrexport') {
    /**
     * Build the CCR XML Object
     */
    Array2XML::init('1.0', 'UTF-8', true, array('xml-stylesheet' => 'type="text/xsl" href="ccr.xsl"'));
    $xml = Array2XML::createXML('ContinuityOfCareRecord', $ccrArray);
    /**
     * Create a ZIP archive for delivery
     */
    $zip = new ZipArchive();
    $tempDirectory = $_SESSION['site']['temp']['path'] . '/';
    $filename = $pid . "-" . $patientData['fname'] . $patientData['lname'];
    if ($zip->open($tempDirectory . $filename . ".zip", ZipArchive::CREATE) !== TRUE) {
        exit("cannot open <{$filename}.zip>\n");
    }
    $zip->addFromString($filename . ".xml", $xml->saveXML());
    $zip->addFromString("ccr.xsl", file_get_contents(ROOT . '/lib/CCRCDA/schema/ccr.xsl'));
    $zip->close();
    /**
     * Stream the file to the client
开发者ID:igez,项目名称:gaiaehr,代码行数:31,代码来源:ccrDocument.php


注:本文中的Array2XML::init方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。