. */ use Models\Upload; use Plugins\ExportFE\FatturaElettronica; include_once __DIR__.'/../../core.php'; try { $fattura_pa = new FatturaElettronica($id_record); } catch (UnexpectedValueException $e) { echo '
'.tr('Questo documento non è una fattura elettronica').'
'; return; } $file = Upload::where('filename', $fattura_pa->getFilename()) ->where('id_record', $id_record) ->first(); $file = Models\Upload::find($file['id']); if (empty($file)) { echo '
'.tr('Questo documento non è una fattura elettronica').'
'; return; } $link = base_path().'/'.$file->filepath; if ($file->isFatturaElettronica()) { $content = file_get_contents(base_dir().'/'.$file->filepath); // Individuazione stylesheet $default_stylesheet = 'asso-invoice'; $name = basename($file->original_name); $filename = explode('.', $name)[0]; $pieces = explode('_', $filename); $stylesheet = $pieces[2]; $stylesheet = base_dir().'/plugins/xml/'.$stylesheet.'.xsl'; $stylesheet = file_exists($stylesheet) ? $stylesheet : base_dir().'/plugins/xml/'.$default_stylesheet.'.xsl'; // XML $xml = new DOMDocument(); $xml->loadXML($content); // XSL $xsl = new DOMDocument(); $xsl->load($stylesheet); // XSLT $xslt = new XSLTProcessor(); $xslt->importStylesheet($xsl); echo $xslt->transformToXML($xml); echo ' '; } else { echo ' '; if ($file->isImage()) { echo ' '; } else { if ($file->isPDF()) { $src = \Prints::getPDFLink($file->filepath); } echo ' '; } }