Example #1
0
 public static function toXml($data, $rootNodeName = 'data', $xml = null, $dataGroup = null)
 {
     if ($xml === null) {
         $rootNodeXml = "<{$rootNodeName}";
         if ($dataGroup == true) {
             $rootNodeXml .= " xfa:dataNode='dataGroup'";
         }
         $rootNodeXml .= "/>";
         $xml = simplexml_load_string("<?xml version='1.0' encoding='utf-8'?>" . $rootNodeXml);
     }
     // loop through the data passed in.
     foreach ($data as $key => $value) {
         // no numeric keys in our xml please!
         if (is_numeric($key)) {
             // make string key...
             $key = "unknownNode_" . (string) $key;
         }
         // replace anything not alpha numeric
         $key = preg_replace('/[^a-z_0-9]/i', '', $key);
         // if there is another array found recrusively call this function
         if (strpos($key, '_') === 0) {
             continue;
         } elseif (strtolower($key) == "patientpicture") {
             //todo: nsdr load pat picture
         } elseif (strtolower($key) == "estimatedencounterfee") {
             //todo: reimplement fee estimator
         } else {
             if (is_array($value) || is_object($value)) {
                 $node = $xml->addChild($key);
                 // recrusive call.
                 PDFController::toXml($value, $rootNodeName, $node);
             } else {
                 // add single node.
                 if (is_resource($value)) {
                     $value = "resource";
                 }
                 $value = htmlentities($value);
                 $node = $xml->addChild($key, $value);
             }
         }
     }
     // pass back as string. or simple xml object if you want!
     $xmlstr = $xml->asXML();
     $xmlstr = preg_replace('/dataNode=/', 'xfa:dataNode=', $xmlstr);
     return preg_replace('/<\\?.*\\?>/', '', $xmlstr);
 }
Example #2
0
 public static function imprimirRepresentantes()
 {
     $seleccionar = ResponsableController::consultasResponsables();
     $cuerpoTabla = '';
     $i = 0;
     $periodo = "";
     $fecha = PDFController::getFecha();
     foreach ($seleccionar as $value) {
         $i = $i + 1;
         $resNombre = $value['resNombre'];
         $resCorreo = $value['resCorreo'];
         $cuerpoTabla = $cuerpoTabla . '<tr>
         <td width="3%" >
           <div align="center">
           <CODE  style="font-size: 80%;">' . $i . '</code>
           </div>
         </td>
         <td>
           <div align="center">
           <CODE>' . $resNombre . '</code>
           </div>
         </td>
         <td>
           <div align="center">
           <CODE>' . $resCorreo . '</code>
           </div>
         </td>
       </tr>';
     }
     $html = '<html><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/><body>' . '<h5 align="right">Sistema de Noticias </h5><h5 align="right">Vázquez Hernández Contadores, S.C.</h5>' . '<h3 align="center">Representantes de Equipo</h3>' . '<table cellspacing="0"  border="1" align="center" width="400" >
     <tbody >
       <tr>
         <td width="3%" >
           <div align="center">
           </div>
         </td>
         <td width="20%" >
           <div align="center">
             <h5><strong>Nombre</strong> </h5>
           </div>
         </td>
         <td width="20%" >
           <div align="center">
             <h5><strong>Correo</strong> </h5>
           </div>
         </td>
       </tr>' . $cuerpoTabla . '</tbody
    </table>' . '<br><p> Fecha de generación:  <CODE>' . $fecha . '</CODE></p>' . '</body></html>';
     return PDF::load($html, 'letter', 'portrait')->show();
 }