<?
////////////////////////////////////////////////////
// Conciliación: gestión de conciliación de activos
// Version: 1.0
//
// Copyright (C) 2014  Eustotem Multimedia, S.L.
//
// License: MIT, see LICENSE
////////////////////////////////////////////////////


include("../conf/preferences.php");
session_name(SYS_APP_SESSNAME);
session_start();
include("../conf/langs/".$langs[$_SESSION['userlang']][0]."/MAIN.php");
include("../conf/connections.php");
include("../phplib/auth.php");
require_once("../phplib/utils.php");
require_once("../core/plugins.php");
error_reporting(E_STRICT | E_ALL | E_DEPRECATED);
ini_set("display_errors", 1);


ini_set("memory_limit","128M");
if(!isset($_GET['resId'])) header("Location:error.php");
$resId=$_GET['resId'];
if(isset($_GET['parentId'])) $parentId=$_GET['parentId'];
$conf=simplexml_load_file("../conf/resources/".$langs[$_SESSION['userlang']][0]."/".$_SESSION['conf'][$resId]->masterview);
$titulogeneral=$conf->title!=NULL ? $conf->title : $_SESSION['conf'][$resId]->title;



$uu=$_SERVER['HTTP_REFERER'];
$aa=explode("/",$uu);
array_pop($aa); array_shift($aa);
$url="http:/".implode("/",$aa)."/template_export_pdf1.php?".$_SERVER['QUERY_STRING']."&rfile=".$_SESSION['conf'][$resId]->masterview;
$cadena=Content::parse(disguise_curl($url));
$base_path=rawurlencode(SYS_APP_URL_PROT."/admin/phplib/dompdf/");


require_once("dompdf/dompdf_config.inc.php");
$dompdf = new DOMPDF();
$dompdf->set_paper("a4","landscape");
$dompdf->load_html($cadena);
$dompdf->render();
$dompdf->stream("[".date('Y-m-d')."] $titulogeneral.pdf");
?>
