Dokumentenakt

This commit is contained in:
Andreas Moik
2016-07-27 17:18:38 +02:00
parent 4edc917b3d
commit 6d0f5d2bec
6 changed files with 400 additions and 1 deletions
+28 -1
View File
@@ -16,6 +16,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*
* Authors: Andreas Oesterreicher <andreas.oesterreicher@technikum-wien.at> and
* Andreas Moik <moik@technikum-wien.at>.
*/
require_once(dirname(__FILE__).'/vorlage.class.php');
require_once(dirname(__FILE__).'/addon.class.php');
@@ -37,8 +38,11 @@ class dokument_export
/**
* Konstruktor
*/
public function __construct($vorlage, $oe_kurzbz=0, $version=null)
public function __construct($vorlage = null, $oe_kurzbz=0, $version=null)
{
if(!isset($vorlage))
return;
//Vorlage aus der Datenbank holen
$this->vorlage = new vorlage();
if(!$this->vorlage->getAktuelleVorlage($oe_kurzbz, $vorlage, $version))
@@ -389,5 +393,28 @@ class dokument_export
}
return $_xml_data->asXML();
}
/**
* Konvertiert ein Dokument in ein anderes Format
* @param string $inFile Origin File Path
* @param string $outFile Output file
* @param string $format Format to export To
* @return boolean
*/
public function convert($inFile, $outFile, $format = "pdf")
{
$command = 'unoconv --format %s --output %s %s';
$command = sprintf($command, $format, $outFile, $inFile);
exec($command, $out, $ret);
if($ret!=0)
{
$this->errormsg = 'Dokumentenkonvertierung ist derzeit nicht möglich. Bitte informieren Sie den Administrator';
return false;
}
return true;
}
}
?>