CODE STYLE OutputDocument.php
Formatting files to PSR2
This commit is contained in:
@@ -24,8 +24,8 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require_once 'classes/model/om/BaseOutputDocument.php';
|
require_once ("classes/model/om/BaseOutputDocument.php");
|
||||||
require_once 'classes/model/Content.php';
|
require_once ("classes/model/Content.php");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Skeleton subclass for representing a row from the 'OUTPUT_DOCUMENT' table.
|
* Skeleton subclass for representing a row from the 'OUTPUT_DOCUMENT' table.
|
||||||
@@ -38,8 +38,8 @@ require_once 'classes/model/Content.php';
|
|||||||
*
|
*
|
||||||
* @package workflow.engine.classes.model
|
* @package workflow.engine.classes.model
|
||||||
*/
|
*/
|
||||||
class OutputDocument extends BaseOutputDocument {
|
class OutputDocument extends BaseOutputDocument
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
* This value goes in the content table
|
* This value goes in the content table
|
||||||
* @var string
|
* @var string
|
||||||
@@ -64,20 +64,23 @@ class OutputDocument extends BaseOutputDocument {
|
|||||||
*/
|
*/
|
||||||
protected $out_doc_template = '';
|
protected $out_doc_template = '';
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
function __construct() {
|
{
|
||||||
$javaInput = PATH_C . 'javaBridgePM' . PATH_SEP . 'input' . PATH_SEP;
|
$javaInput = PATH_C . 'javaBridgePM' . PATH_SEP . 'input' . PATH_SEP;
|
||||||
$javaOutput = PATH_C . 'javaBridgePM' . PATH_SEP . 'output' . PATH_SEP;
|
$javaOutput = PATH_C . 'javaBridgePM' . PATH_SEP . 'output' . PATH_SEP;
|
||||||
G::mk_dir ( $javaInput );
|
|
||||||
G::mk_dir ( $javaOutput );
|
G::mk_dir($javaInput);
|
||||||
|
G::mk_dir($javaOutput);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getByUid($sOutDocUid)
|
public function getByUid($sOutDocUid)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$oOutputDocument = OutputDocumentPeer::retrieveByPK( $sOutDocUid );
|
$oOutputDocument = OutputDocumentPeer::retrieveByPK($sOutDocUid);
|
||||||
if( is_null($oOutputDocument) )
|
|
||||||
|
if (is_null($oOutputDocument)) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$aFields = $oOutputDocument->toArray(BasePeer::TYPE_FIELDNAME);
|
$aFields = $oOutputDocument->toArray(BasePeer::TYPE_FIELDNAME);
|
||||||
$aFields['OUT_DOC_TITLE'] = $oOutputDocument->getOutDocTitle();
|
$aFields['OUT_DOC_TITLE'] = $oOutputDocument->getOutDocTitle();
|
||||||
@@ -85,10 +88,10 @@ class OutputDocument extends BaseOutputDocument {
|
|||||||
$aFields['OUT_DOC_FILENAME'] = $oOutputDocument->getOutDocFilename();
|
$aFields['OUT_DOC_FILENAME'] = $oOutputDocument->getOutDocFilename();
|
||||||
$aFields['OUT_DOC_TEMPLATE'] = $oOutputDocument->getOutDocTemplate();
|
$aFields['OUT_DOC_TEMPLATE'] = $oOutputDocument->getOutDocTemplate();
|
||||||
$this->fromArray($aFields, BasePeer::TYPE_FIELDNAME);
|
$this->fromArray($aFields, BasePeer::TYPE_FIELDNAME);
|
||||||
|
|
||||||
return $aFields;
|
return $aFields;
|
||||||
}
|
} catch (Exception $oError) {
|
||||||
catch (Exception $oError) {
|
throw ($oError);
|
||||||
throw($oError);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -100,23 +103,22 @@ class OutputDocument extends BaseOutputDocument {
|
|||||||
public function load($sOutDocUid)
|
public function load($sOutDocUid)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$oOutputDocument = OutputDocumentPeer::retrieveByPK( $sOutDocUid );
|
$oOutputDocument = OutputDocumentPeer::retrieveByPK($sOutDocUid);
|
||||||
if (!is_null($oOutputDocument))
|
|
||||||
{
|
if (!is_null($oOutputDocument)) {
|
||||||
$aFields = $oOutputDocument->toArray(BasePeer::TYPE_FIELDNAME);
|
$aFields = $oOutputDocument->toArray(BasePeer::TYPE_FIELDNAME);
|
||||||
$aFields['OUT_DOC_TITLE'] = $oOutputDocument->getOutDocTitle();
|
$aFields['OUT_DOC_TITLE'] = $oOutputDocument->getOutDocTitle();
|
||||||
$aFields['OUT_DOC_DESCRIPTION'] = $oOutputDocument->getOutDocDescription();
|
$aFields['OUT_DOC_DESCRIPTION'] = $oOutputDocument->getOutDocDescription();
|
||||||
$aFields['OUT_DOC_FILENAME'] = $oOutputDocument->getOutDocFilename();
|
$aFields['OUT_DOC_FILENAME'] = $oOutputDocument->getOutDocFilename();
|
||||||
$aFields['OUT_DOC_TEMPLATE'] = $oOutputDocument->getOutDocTemplate();
|
$aFields['OUT_DOC_TEMPLATE'] = $oOutputDocument->getOutDocTemplate();
|
||||||
$this->fromArray($aFields, BasePeer::TYPE_FIELDNAME);
|
$this->fromArray($aFields, BasePeer::TYPE_FIELDNAME);
|
||||||
|
|
||||||
return $aFields;
|
return $aFields;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
throw(new Exception('This row doesn\'t exist!'));
|
throw(new Exception('This row doesn\'t exist!'));
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception $oError) {
|
||||||
catch (Exception $oError) {
|
throw ($oError);
|
||||||
throw($oError);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -128,49 +130,62 @@ class OutputDocument extends BaseOutputDocument {
|
|||||||
public function create($aData)
|
public function create($aData)
|
||||||
{
|
{
|
||||||
$oConnection = Propel::getConnection(OutputDocumentPeer::DATABASE_NAME);
|
$oConnection = Propel::getConnection(OutputDocumentPeer::DATABASE_NAME);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if ( isset ( $aData['OUT_DOC_UID'] ) && $aData['OUT_DOC_UID']== '' )
|
if (isset($aData['OUT_DOC_UID']) && $aData['OUT_DOC_UID']== '') {
|
||||||
unset ( $aData['OUT_DOC_UID'] );
|
unset($aData['OUT_DOC_UID']);
|
||||||
if ( !isset ( $aData['OUT_DOC_UID'] ) )
|
}
|
||||||
|
|
||||||
|
if (!isset($aData['OUT_DOC_UID'])) {
|
||||||
$aData['OUT_DOC_UID'] = G::generateUniqueID();
|
$aData['OUT_DOC_UID'] = G::generateUniqueID();
|
||||||
|
}
|
||||||
|
|
||||||
if (!isset($aData['OUT_DOC_GENERATE'])) {
|
if (!isset($aData['OUT_DOC_GENERATE'])) {
|
||||||
$aData['OUT_DOC_GENERATE'] = 'BOTH';
|
$aData['OUT_DOC_GENERATE'] = 'BOTH';
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
if ($aData['OUT_DOC_GENERATE'] == '') {
|
if ($aData['OUT_DOC_GENERATE'] == '') {
|
||||||
$aData['OUT_DOC_GENERATE'] = 'BOTH';
|
$aData['OUT_DOC_GENERATE'] = 'BOTH';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$oOutputDocument = new OutputDocument();
|
$oOutputDocument = new OutputDocument();
|
||||||
$oOutputDocument->fromArray($aData, BasePeer::TYPE_FIELDNAME);
|
$oOutputDocument->fromArray($aData, BasePeer::TYPE_FIELDNAME);
|
||||||
|
|
||||||
if ($oOutputDocument->validate()) {
|
if ($oOutputDocument->validate()) {
|
||||||
$oConnection->begin();
|
$oConnection->begin();
|
||||||
|
|
||||||
if (isset($aData['OUT_DOC_TITLE'])) {
|
if (isset($aData['OUT_DOC_TITLE'])) {
|
||||||
$oOutputDocument->setOutDocTitle($aData['OUT_DOC_TITLE']);
|
$oOutputDocument->setOutDocTitle($aData['OUT_DOC_TITLE']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($aData['OUT_DOC_DESCRIPTION'])) {
|
if (isset($aData['OUT_DOC_DESCRIPTION'])) {
|
||||||
$oOutputDocument->setOutDocDescription($aData['OUT_DOC_DESCRIPTION']);
|
$oOutputDocument->setOutDocDescription($aData['OUT_DOC_DESCRIPTION']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$oOutputDocument->setOutDocFilename($aData['OUT_DOC_FILENAME']);
|
$oOutputDocument->setOutDocFilename($aData['OUT_DOC_FILENAME']);
|
||||||
|
|
||||||
if (isset($aData['OUT_DOC_TEMPLATE'])) {
|
if (isset($aData['OUT_DOC_TEMPLATE'])) {
|
||||||
$oOutputDocument->setOutDocTemplate($aData['OUT_DOC_TEMPLATE']);
|
$oOutputDocument->setOutDocTemplate($aData['OUT_DOC_TEMPLATE']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$iResult = $oOutputDocument->save();
|
$iResult = $oOutputDocument->save();
|
||||||
$oConnection->commit();
|
$oConnection->commit();
|
||||||
|
|
||||||
return $aData['OUT_DOC_UID'];
|
return $aData['OUT_DOC_UID'];
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$sMessage = '';
|
$sMessage = '';
|
||||||
$aValidationFailures = $oOutputDocument->getValidationFailures();
|
$aValidationFailures = $oOutputDocument->getValidationFailures();
|
||||||
foreach($aValidationFailures as $oValidationFailure) {
|
|
||||||
|
foreach ($aValidationFailures as $oValidationFailure) {
|
||||||
$sMessage .= $oValidationFailure->getMessage() . '<br />';
|
$sMessage .= $oValidationFailure->getMessage() . '<br />';
|
||||||
}
|
}
|
||||||
throw(new Exception('The registry cannot be created!<br />'.$sMessage));
|
|
||||||
|
throw (new Exception('The registry cannot be created!<br />'.$sMessage));
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception $oError) {
|
||||||
catch (Exception $oError) {
|
|
||||||
$oConnection->rollback();
|
$oConnection->rollback();
|
||||||
throw($oError);
|
|
||||||
|
throw ($oError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -182,49 +197,53 @@ class OutputDocument extends BaseOutputDocument {
|
|||||||
public function update($aData)
|
public function update($aData)
|
||||||
{
|
{
|
||||||
$oConnection = Propel::getConnection(OutputDocumentPeer::DATABASE_NAME);
|
$oConnection = Propel::getConnection(OutputDocumentPeer::DATABASE_NAME);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$oOutputDocument = OutputDocumentPeer::retrieveByPK($aData['OUT_DOC_UID']);
|
$oOutputDocument = OutputDocumentPeer::retrieveByPK($aData['OUT_DOC_UID']);
|
||||||
if (!is_null($oOutputDocument))
|
|
||||||
{
|
if (!is_null($oOutputDocument)) {
|
||||||
$oOutputDocument->fromArray($aData, BasePeer::TYPE_FIELDNAME);
|
$oOutputDocument->fromArray($aData, BasePeer::TYPE_FIELDNAME);
|
||||||
|
|
||||||
if ($oOutputDocument->validate()) {
|
if ($oOutputDocument->validate()) {
|
||||||
$oConnection->begin();
|
$oConnection->begin();
|
||||||
if (isset($aData['OUT_DOC_TITLE']))
|
|
||||||
{
|
if (isset($aData['OUT_DOC_TITLE'])) {
|
||||||
$oOutputDocument->setOutDocTitle($aData['OUT_DOC_TITLE']);
|
$oOutputDocument->setOutDocTitle($aData['OUT_DOC_TITLE']);
|
||||||
}
|
}
|
||||||
if (isset($aData['OUT_DOC_DESCRIPTION']))
|
|
||||||
{
|
if (isset($aData['OUT_DOC_DESCRIPTION'])) {
|
||||||
$oOutputDocument->setOutDocDescription($aData['OUT_DOC_DESCRIPTION']);
|
$oOutputDocument->setOutDocDescription($aData['OUT_DOC_DESCRIPTION']);
|
||||||
}
|
}
|
||||||
if (isset($aData['OUT_DOC_FILENAME']))
|
|
||||||
{
|
if (isset($aData['OUT_DOC_FILENAME'])) {
|
||||||
$oOutputDocument->setOutDocFilename($aData['OUT_DOC_FILENAME']);
|
$oOutputDocument->setOutDocFilename($aData['OUT_DOC_FILENAME']);
|
||||||
}
|
}
|
||||||
if (isset($aData['OUT_DOC_TEMPLATE']))
|
|
||||||
{
|
if (isset($aData['OUT_DOC_TEMPLATE'])) {
|
||||||
$oOutputDocument->setOutDocTemplate($aData['OUT_DOC_TEMPLATE']);
|
$oOutputDocument->setOutDocTemplate($aData['OUT_DOC_TEMPLATE']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$iResult = $oOutputDocument->save();
|
$iResult = $oOutputDocument->save();
|
||||||
$oConnection->commit();
|
$oConnection->commit();
|
||||||
|
|
||||||
return $iResult;
|
return $iResult;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$sMessage = '';
|
$sMessage = '';
|
||||||
$aValidationFailures = $oOutputDocument->getValidationFailures();
|
$aValidationFailures = $oOutputDocument->getValidationFailures();
|
||||||
foreach($aValidationFailures as $oValidationFailure) {
|
|
||||||
|
foreach ($aValidationFailures as $oValidationFailure) {
|
||||||
$sMessage .= $oValidationFailure->getMessage() . '<br />';
|
$sMessage .= $oValidationFailure->getMessage() . '<br />';
|
||||||
}
|
}
|
||||||
throw(new Exception('The registry cannot be updated!<br />'.$sMessage));
|
|
||||||
|
throw (new Exception('The registry cannot be updated!<br />'.$sMessage));
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
throw (new Exception('This row doesn\'t exist!'));
|
||||||
}
|
}
|
||||||
else {
|
} catch (Exception $oError) {
|
||||||
throw(new Exception('This row doesn\'t exist!'));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception $oError) {
|
|
||||||
$oConnection->rollback();
|
$oConnection->rollback();
|
||||||
throw($oError);
|
|
||||||
|
throw ($oError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -236,10 +255,11 @@ class OutputDocument extends BaseOutputDocument {
|
|||||||
public function remove($sOutDocUid)
|
public function remove($sOutDocUid)
|
||||||
{
|
{
|
||||||
$oConnection = Propel::getConnection(OutputDocumentPeer::DATABASE_NAME);
|
$oConnection = Propel::getConnection(OutputDocumentPeer::DATABASE_NAME);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$oOutputDocument = OutputDocumentPeer::retrieveByPK($sOutDocUid);
|
$oOutputDocument = OutputDocumentPeer::retrieveByPK($sOutDocUid);
|
||||||
if (!is_null($oOutputDocument))
|
|
||||||
{
|
if (!is_null($oOutputDocument)) {
|
||||||
$oConnection->begin();
|
$oConnection->begin();
|
||||||
Content::removeContent('OUT_DOC_TITLE', '', $oOutputDocument->getOutDocUid());
|
Content::removeContent('OUT_DOC_TITLE', '', $oOutputDocument->getOutDocUid());
|
||||||
Content::removeContent('OUT_DOC_DESCRIPTION', '', $oOutputDocument->getOutDocUid());
|
Content::removeContent('OUT_DOC_DESCRIPTION', '', $oOutputDocument->getOutDocUid());
|
||||||
@@ -247,15 +267,15 @@ class OutputDocument extends BaseOutputDocument {
|
|||||||
Content::removeContent('OUT_DOC_TEMPLATE', '', $oOutputDocument->getOutDocUid());
|
Content::removeContent('OUT_DOC_TEMPLATE', '', $oOutputDocument->getOutDocUid());
|
||||||
$iResult = $oOutputDocument->delete();
|
$iResult = $oOutputDocument->delete();
|
||||||
$oConnection->commit();
|
$oConnection->commit();
|
||||||
|
|
||||||
return $iResult;
|
return $iResult;
|
||||||
|
} else {
|
||||||
|
throw (new Exception('This row doesn\'t exist!'));
|
||||||
}
|
}
|
||||||
else {
|
} catch (Exception $oError) {
|
||||||
throw(new Exception('This row doesn\'t exist!'));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception $oError) {
|
|
||||||
$oConnection->rollback();
|
$oConnection->rollback();
|
||||||
throw($oError);
|
|
||||||
|
throw ($oError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -267,12 +287,17 @@ class OutputDocument extends BaseOutputDocument {
|
|||||||
{
|
{
|
||||||
if ($this->out_doc_title == '') {
|
if ($this->out_doc_title == '') {
|
||||||
try {
|
try {
|
||||||
$this->out_doc_title = Content::load('OUT_DOC_TITLE', '', $this->getOutDocUid(), (defined('SYS_LANG') ? SYS_LANG : 'en'));
|
$this->out_doc_title = Content::load(
|
||||||
}
|
'OUT_DOC_TITLE',
|
||||||
catch (Exception $oError) {
|
'',
|
||||||
throw($oError);
|
$this->getOutDocUid(),
|
||||||
|
(defined('SYS_LANG')? SYS_LANG : 'en')
|
||||||
|
);
|
||||||
|
} catch (Exception $oError) {
|
||||||
|
throw ($oError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->out_doc_title;
|
return $this->out_doc_title;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -287,15 +312,22 @@ class OutputDocument extends BaseOutputDocument {
|
|||||||
if ($sValue !== null && !is_string($sValue)) {
|
if ($sValue !== null && !is_string($sValue)) {
|
||||||
$sValue = (string)$sValue;
|
$sValue = (string)$sValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->out_doc_title !== $sValue || $sValue === '') {
|
if ($this->out_doc_title !== $sValue || $sValue === '') {
|
||||||
try {
|
try {
|
||||||
$this->out_doc_title = $sValue;
|
$this->out_doc_title = $sValue;
|
||||||
|
|
||||||
$iResult = Content::addContent('OUT_DOC_TITLE', '', $this->getOutDocUid(), (defined('SYS_LANG') ? SYS_LANG : 'en'), $this->out_doc_title);
|
$iResult = Content::addContent(
|
||||||
}
|
'OUT_DOC_TITLE',
|
||||||
catch (Exception $oError) {
|
'',
|
||||||
|
$this->getOutDocUid(),
|
||||||
|
(defined('SYS_LANG')? SYS_LANG : 'en'),
|
||||||
|
$this->out_doc_title
|
||||||
|
);
|
||||||
|
} catch (Exception $oError) {
|
||||||
$this->out_doc_title = '';
|
$this->out_doc_title = '';
|
||||||
throw($oError);
|
|
||||||
|
throw ($oError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -308,12 +340,17 @@ class OutputDocument extends BaseOutputDocument {
|
|||||||
{
|
{
|
||||||
if ($this->out_doc_description == '') {
|
if ($this->out_doc_description == '') {
|
||||||
try {
|
try {
|
||||||
$this->out_doc_description = Content::load('OUT_DOC_DESCRIPTION', '', $this->getOutDocUid(), (defined('SYS_LANG') ? SYS_LANG : 'en'));
|
$this->out_doc_description = Content::load(
|
||||||
}
|
'OUT_DOC_DESCRIPTION',
|
||||||
catch (Exception $oError) {
|
'',
|
||||||
throw($oError);
|
$this->getOutDocUid(),
|
||||||
|
(defined('SYS_LANG')? SYS_LANG : 'en')
|
||||||
|
);
|
||||||
|
} catch (Exception $oError) {
|
||||||
|
throw ($oError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->out_doc_description;
|
return $this->out_doc_description;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -328,15 +365,22 @@ class OutputDocument extends BaseOutputDocument {
|
|||||||
if ($sValue !== null && !is_string($sValue)) {
|
if ($sValue !== null && !is_string($sValue)) {
|
||||||
$sValue = (string)$sValue;
|
$sValue = (string)$sValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->out_doc_description !== $sValue || $sValue === '') {
|
if ($this->out_doc_description !== $sValue || $sValue === '') {
|
||||||
try {
|
try {
|
||||||
$this->out_doc_description = $sValue;
|
$this->out_doc_description = $sValue;
|
||||||
|
|
||||||
$iResult = Content::addContent('OUT_DOC_DESCRIPTION', '', $this->getOutDocUid(), (defined('SYS_LANG') ? SYS_LANG : 'en'), $this->out_doc_description);
|
$iResult = Content::addContent(
|
||||||
}
|
'OUT_DOC_DESCRIPTION',
|
||||||
catch (Exception $oError) {
|
'',
|
||||||
|
$this->getOutDocUid(),
|
||||||
|
(defined('SYS_LANG')? SYS_LANG : 'en'),
|
||||||
|
$this->out_doc_description
|
||||||
|
);
|
||||||
|
} catch (Exception $oError) {
|
||||||
$this->out_doc_description = '';
|
$this->out_doc_description = '';
|
||||||
throw($oError);
|
|
||||||
|
throw ($oError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -349,12 +393,17 @@ class OutputDocument extends BaseOutputDocument {
|
|||||||
{
|
{
|
||||||
if ($this->out_doc_filename == '') {
|
if ($this->out_doc_filename == '') {
|
||||||
try {
|
try {
|
||||||
$this->out_doc_filename = Content::load('OUT_DOC_FILENAME', '', $this->getOutDocUid(), (defined('SYS_LANG') ? SYS_LANG : 'en'));
|
$this->out_doc_filename = Content::load(
|
||||||
}
|
'OUT_DOC_FILENAME',
|
||||||
catch (Exception $oError) {
|
'',
|
||||||
throw($oError);
|
$this->getOutDocUid(),
|
||||||
|
(defined('SYS_LANG')? SYS_LANG : 'en')
|
||||||
|
);
|
||||||
|
} catch (Exception $oError) {
|
||||||
|
throw ($oError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->out_doc_filename;
|
return $this->out_doc_filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -369,14 +418,22 @@ class OutputDocument extends BaseOutputDocument {
|
|||||||
if ($sValue !== null && !is_string($sValue)) {
|
if ($sValue !== null && !is_string($sValue)) {
|
||||||
$sValue = (string)$sValue;
|
$sValue = (string)$sValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->out_doc_filename !== $sValue || $sValue === '') {
|
if ($this->out_doc_filename !== $sValue || $sValue === '') {
|
||||||
try {
|
try {
|
||||||
$this->out_doc_filename = $sValue;
|
$this->out_doc_filename = $sValue;
|
||||||
$iResult = Content::addContent('OUT_DOC_FILENAME', '', $this->getOutDocUid(), (defined('SYS_LANG') ? SYS_LANG : 'en'), $this->out_doc_filename);
|
|
||||||
}
|
$iResult = Content::addContent(
|
||||||
catch (Exception $oError) {
|
'OUT_DOC_FILENAME',
|
||||||
|
'',
|
||||||
|
$this->getOutDocUid(),
|
||||||
|
(defined('SYS_LANG')? SYS_LANG : 'en'),
|
||||||
|
$this->out_doc_filename
|
||||||
|
);
|
||||||
|
} catch (Exception $oError) {
|
||||||
$this->out_doc_filename = '';
|
$this->out_doc_filename = '';
|
||||||
throw($oError);
|
|
||||||
|
throw ($oError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -389,12 +446,17 @@ class OutputDocument extends BaseOutputDocument {
|
|||||||
{
|
{
|
||||||
if ($this->out_doc_template == '') {
|
if ($this->out_doc_template == '') {
|
||||||
try {
|
try {
|
||||||
$this->out_doc_template = Content::load('OUT_DOC_TEMPLATE', '', $this->getOutDocUid(), (defined('SYS_LANG') ? SYS_LANG : 'en'));
|
$this->out_doc_template = Content::load(
|
||||||
}
|
'OUT_DOC_TEMPLATE',
|
||||||
catch (Exception $oError) {
|
'',
|
||||||
throw($oError);
|
$this->getOutDocUid(),
|
||||||
|
(defined('SYS_LANG')? SYS_LANG : 'en')
|
||||||
|
);
|
||||||
|
} catch (Exception $oError) {
|
||||||
|
throw ($oError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->out_doc_template;
|
return $this->out_doc_template;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -409,14 +471,22 @@ class OutputDocument extends BaseOutputDocument {
|
|||||||
if ($sValue !== null && !is_string($sValue)) {
|
if ($sValue !== null && !is_string($sValue)) {
|
||||||
$sValue = (string)$sValue;
|
$sValue = (string)$sValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->out_doc_template !== $sValue || $sValue === '') {
|
if ($this->out_doc_template !== $sValue || $sValue === '') {
|
||||||
try {
|
try {
|
||||||
$this->out_doc_template = $sValue;
|
$this->out_doc_template = $sValue;
|
||||||
$iResult = Content::addContent('OUT_DOC_TEMPLATE', '', $this->getOutDocUid(), (defined('SYS_LANG') ? SYS_LANG : 'en'), $this->out_doc_template);
|
|
||||||
}
|
$iResult = Content::addContent(
|
||||||
catch (Exception $oError) {
|
'OUT_DOC_TEMPLATE',
|
||||||
|
'',
|
||||||
|
$this->getOutDocUid(),
|
||||||
|
(defined('SYS_LANG')? SYS_LANG : 'en'),
|
||||||
|
$this->out_doc_template
|
||||||
|
);
|
||||||
|
} catch (Exception $oError) {
|
||||||
$this->out_doc_template = '';
|
$this->out_doc_template = '';
|
||||||
throw($oError);
|
|
||||||
|
throw ($oError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -428,7 +498,16 @@ class OutputDocument extends BaseOutputDocument {
|
|||||||
* @param string $sPath
|
* @param string $sPath
|
||||||
* @return variant
|
* @return variant
|
||||||
*/
|
*/
|
||||||
public function generate($sUID, $aFields, $sPath, $sFilename, $sContent, $sLandscape = false, $sTypeDocToGener = 'BOTH', $aProperties = array()) {
|
public function generate(
|
||||||
|
$sUID,
|
||||||
|
$aFields,
|
||||||
|
$sPath,
|
||||||
|
$sFilename,
|
||||||
|
$sContent,
|
||||||
|
$sLandscape=false,
|
||||||
|
$sTypeDocToGener='BOTH',
|
||||||
|
$aProperties=array()
|
||||||
|
) {
|
||||||
if (($sUID != '') && is_array($aFields) && ($sPath != '')) {
|
if (($sUID != '') && is_array($aFields) && ($sPath != '')) {
|
||||||
$sContent = G::unhtmlentities($sContent);
|
$sContent = G::unhtmlentities($sContent);
|
||||||
$strContentAux = str_replace(array("\n", "\r", "\t"), array(null, null, null), $sContent);
|
$strContentAux = str_replace(array("\n", "\r", "\t"), array(null, null, null), $sContent);
|
||||||
@@ -450,7 +529,9 @@ class OutputDocument extends BaseOutputDocument {
|
|||||||
$strContentAux1 = $strContentAux;
|
$strContentAux1 = $strContentAux;
|
||||||
$strContentAux = null;
|
$strContentAux = null;
|
||||||
|
|
||||||
while (preg_match("/^(.*)@>" . $grdName . "(.*)@<" . $grdName . "(.*)$/", $strContentAux1, $arrayMatch2)) {
|
$ereg = "/^(.*)@>" . $grdName . "(.*)@<" . $grdName . "(.*)$/";
|
||||||
|
|
||||||
|
while (preg_match($ereg, $strContentAux1, $arrayMatch2)) {
|
||||||
$strData = null;
|
$strData = null;
|
||||||
|
|
||||||
if (isset($aFields[$grdName]) && is_array($aFields[$grdName])) {
|
if (isset($aFields[$grdName]) && is_array($aFields[$grdName])) {
|
||||||
@@ -487,6 +568,7 @@ class OutputDocument extends BaseOutputDocument {
|
|||||||
|
|
||||||
//Start - Create .doc
|
//Start - Create .doc
|
||||||
$oFile = fopen($sPath . $sFilename . '.doc', 'wb');
|
$oFile = fopen($sPath . $sFilename . '.doc', 'wb');
|
||||||
|
|
||||||
$size = array();
|
$size = array();
|
||||||
$size["Letter"] = "216mm 279mm";
|
$size["Letter"] = "216mm 279mm";
|
||||||
$size["Legal"] = "216mm 357mm";
|
$size["Legal"] = "216mm 357mm";
|
||||||
@@ -530,29 +612,39 @@ class OutputDocument extends BaseOutputDocument {
|
|||||||
$sizeLandscape["Screenshot800"] = "600mm 800mm";
|
$sizeLandscape["Screenshot800"] = "600mm 800mm";
|
||||||
$sizeLandscape["Screenshot1024"] = "768mm 1024mm";
|
$sizeLandscape["Screenshot1024"] = "768mm 1024mm";
|
||||||
|
|
||||||
if(!isset($aProperties['media']))
|
if (!isset($aProperties['media'])) {
|
||||||
$aProperties['media'] = 'Letter';
|
$aProperties['media'] = 'Letter';
|
||||||
|
}
|
||||||
|
|
||||||
if($sLandscape)
|
if ($sLandscape) {
|
||||||
$media = $sizeLandscape[$aProperties['media']];
|
$media = $sizeLandscape[$aProperties['media']];
|
||||||
else
|
} else {
|
||||||
$media = $size[$aProperties['media']];
|
$media = $size[$aProperties['media']];
|
||||||
|
}
|
||||||
|
|
||||||
$marginLeft = '15';
|
$marginLeft = '15';
|
||||||
if(isset($aProperties['margins']['left']))
|
|
||||||
|
if (isset($aProperties['margins']['left'])) {
|
||||||
$marginLeft = $aProperties['margins']['left'];
|
$marginLeft = $aProperties['margins']['left'];
|
||||||
|
}
|
||||||
|
|
||||||
$marginRight = '15';
|
$marginRight = '15';
|
||||||
if(isset($aProperties['margins']['right']))
|
|
||||||
|
if (isset($aProperties['margins']['right'])) {
|
||||||
$marginRight = $aProperties['margins']['right'];
|
$marginRight = $aProperties['margins']['right'];
|
||||||
|
}
|
||||||
|
|
||||||
$marginTop = '15';
|
$marginTop = '15';
|
||||||
if(isset($aProperties['margins']['top']))
|
|
||||||
|
if (isset($aProperties['margins']['top'])) {
|
||||||
$marginTop = $aProperties['margins']['top'];
|
$marginTop = $aProperties['margins']['top'];
|
||||||
|
}
|
||||||
|
|
||||||
$marginBottom = '15';
|
$marginBottom = '15';
|
||||||
if(isset($aProperties['margins']['bottom']))
|
|
||||||
|
if (isset($aProperties['margins']['bottom'])) {
|
||||||
$marginBottom = $aProperties['margins']['bottom'];
|
$marginBottom = $aProperties['margins']['bottom'];
|
||||||
|
}
|
||||||
|
|
||||||
fwrite($oFile, '<html xmlns:v="urn:schemas-microsoft-com:vml"
|
fwrite($oFile, '<html xmlns:v="urn:schemas-microsoft-com:vml"
|
||||||
xmlns:o="urn:schemas-microsoft-com:office:office"
|
xmlns:o="urn:schemas-microsoft-com:office:office"
|
||||||
@@ -599,12 +691,13 @@ class OutputDocument extends BaseOutputDocument {
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class=WordSection1>');
|
<div class=WordSection1>');
|
||||||
|
|
||||||
fwrite($oFile, $sContent);
|
fwrite($oFile, $sContent);
|
||||||
fwrite($oFile, "\n</div></body></html>\n\n");
|
fwrite($oFile, "\n</div></body></html>\n\n");
|
||||||
fclose($oFile);
|
fclose($oFile);
|
||||||
/* End - Create .doc */
|
/* End - Create .doc */
|
||||||
|
|
||||||
if($sTypeDocToGener == 'BOTH' || $sTypeDocToGener == 'PDF'){
|
if ($sTypeDocToGener == 'BOTH' || $sTypeDocToGener == 'PDF') {
|
||||||
/* Start - Create .pdf */
|
/* Start - Create .pdf */
|
||||||
$oFile = fopen($sPath . $sFilename . '.html', 'wb');
|
$oFile = fopen($sPath . $sFilename . '.html', 'wb');
|
||||||
fwrite($oFile, $sContent);
|
fwrite($oFile, $sContent);
|
||||||
@@ -612,10 +705,13 @@ class OutputDocument extends BaseOutputDocument {
|
|||||||
|
|
||||||
define('PATH_OUTPUT_FILE_DIRECTORY', PATH_HTML . 'files/' . $_SESSION['APPLICATION'] . '/outdocs/');
|
define('PATH_OUTPUT_FILE_DIRECTORY', PATH_HTML . 'files/' . $_SESSION['APPLICATION'] . '/outdocs/');
|
||||||
G::verifyPath(PATH_OUTPUT_FILE_DIRECTORY, true);
|
G::verifyPath(PATH_OUTPUT_FILE_DIRECTORY, true);
|
||||||
require_once(PATH_THIRDPARTY . 'html2ps_pdf/config.inc.php');
|
require_once (PATH_THIRDPARTY . 'html2ps_pdf/config.inc.php');
|
||||||
require_once(PATH_THIRDPARTY . 'html2ps_pdf/pipeline.factory.class.php');
|
require_once (PATH_THIRDPARTY . 'html2ps_pdf/pipeline.factory.class.php');
|
||||||
|
|
||||||
parse_config_file(PATH_THIRDPARTY . 'html2ps_pdf/html2ps.config');
|
parse_config_file(PATH_THIRDPARTY . 'html2ps_pdf/html2ps.config');
|
||||||
$GLOBALS['g_config'] = array('cssmedia' => 'screen',
|
|
||||||
|
$GLOBALS['g_config'] = array(
|
||||||
|
'cssmedia' => 'screen',
|
||||||
'media' => 'Letter',
|
'media' => 'Letter',
|
||||||
'scalepoints' => false,
|
'scalepoints' => false,
|
||||||
'renderimages' => true,
|
'renderimages' => true,
|
||||||
@@ -638,7 +734,9 @@ class OutputDocument extends BaseOutputDocument {
|
|||||||
'debugbox' => false,
|
'debugbox' => false,
|
||||||
'html2xhtml' => true,
|
'html2xhtml' => true,
|
||||||
'mode' => 'html',
|
'mode' => 'html',
|
||||||
'smartpagebreak' => true);
|
'smartpagebreak' => true
|
||||||
|
);
|
||||||
|
|
||||||
$GLOBALS['g_config']= array_merge($GLOBALS['g_config'],$aProperties);
|
$GLOBALS['g_config']= array_merge($GLOBALS['g_config'],$aProperties);
|
||||||
$g_media = Media::predefined($GLOBALS['g_config']['media']);
|
$g_media = Media::predefined($GLOBALS['g_config']['media']);
|
||||||
$g_media->set_landscape($GLOBALS['g_config']['landscape']);
|
$g_media->set_landscape($GLOBALS['g_config']['landscape']);
|
||||||
@@ -646,81 +744,86 @@ class OutputDocument extends BaseOutputDocument {
|
|||||||
$g_media->set_pixels($GLOBALS['g_config']['pagewidth']);
|
$g_media->set_pixels($GLOBALS['g_config']['pagewidth']);
|
||||||
|
|
||||||
|
|
||||||
if(isset($GLOBALS['g_config']['pdfSecurity'])){
|
if (isset($GLOBALS['g_config']['pdfSecurity'])) {
|
||||||
if (isset($GLOBALS['g_config']['pdfSecurity']['openPassword']) && $GLOBALS['g_config']['pdfSecurity']['openPassword'] != "") {
|
if (isset($GLOBALS['g_config']['pdfSecurity']['openPassword']) &&
|
||||||
$GLOBALS['g_config']['pdfSecurity']['openPassword'] = G::decrypt($GLOBALS['g_config']['pdfSecurity']['openPassword'], $sUID);
|
$GLOBALS['g_config']['pdfSecurity']['openPassword'] != ""
|
||||||
|
) {
|
||||||
|
$GLOBALS['g_config']['pdfSecurity']['openPassword'] = G::decrypt(
|
||||||
|
$GLOBALS['g_config']['pdfSecurity']['openPassword'],
|
||||||
|
$sUID
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if (isset($GLOBALS['g_config']['pdfSecurity']['ownerPassword']) && $GLOBALS['g_config']['pdfSecurity']['ownerPassword'] != "") {
|
|
||||||
$GLOBALS['g_config']['pdfSecurity']['ownerPassword'] = G::decrypt($GLOBALS['g_config']['pdfSecurity']['ownerPassword'], $sUID);
|
if (isset($GLOBALS['g_config']['pdfSecurity']['ownerPassword']) &&
|
||||||
|
$GLOBALS['g_config']['pdfSecurity']['ownerPassword'] != ""
|
||||||
|
) {
|
||||||
|
$GLOBALS['g_config']['pdfSecurity']['ownerPassword'] = G::decrypt(
|
||||||
|
$GLOBALS['g_config']['pdfSecurity']['ownerPassword'],
|
||||||
|
$sUID
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$g_media->set_security($GLOBALS['g_config']['pdfSecurity']);
|
$g_media->set_security($GLOBALS['g_config']['pdfSecurity']);
|
||||||
|
|
||||||
require_once(HTML2PS_DIR . 'pdf.fpdf.encryption.php');
|
require_once (HTML2PS_DIR . 'pdf.fpdf.encryption.php');
|
||||||
}
|
}
|
||||||
|
|
||||||
$pipeline = new Pipeline();
|
$pipeline = new Pipeline();
|
||||||
if (extension_loaded('curl'))
|
|
||||||
{
|
if (extension_loaded('curl')) {
|
||||||
require_once(HTML2PS_DIR . 'fetcher.url.curl.class.php');
|
require_once (HTML2PS_DIR . 'fetcher.url.curl.class.php');
|
||||||
|
|
||||||
$pipeline->fetchers = array(new FetcherURLCurl());
|
$pipeline->fetchers = array(new FetcherURLCurl());
|
||||||
|
|
||||||
if (isset($proxy)) {
|
if (isset($proxy)) {
|
||||||
if ($proxy != '')
|
if ($proxy != '') {
|
||||||
{
|
|
||||||
$pipeline->fetchers[0]->set_proxy($proxy);
|
$pipeline->fetchers[0]->set_proxy($proxy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
require_once (HTML2PS_DIR . 'fetcher.url.class.php');
|
||||||
{
|
|
||||||
require_once(HTML2PS_DIR . 'fetcher.url.class.php');
|
|
||||||
$pipeline->fetchers[] = new FetcherURL();
|
$pipeline->fetchers[] = new FetcherURL();
|
||||||
}
|
}
|
||||||
|
|
||||||
$pipeline->data_filters[] = new DataFilterDoctype();
|
$pipeline->data_filters[] = new DataFilterDoctype();
|
||||||
$pipeline->data_filters[] = new DataFilterUTF8($GLOBALS['g_config']['encoding']);
|
$pipeline->data_filters[] = new DataFilterUTF8($GLOBALS['g_config']['encoding']);
|
||||||
if ($GLOBALS['g_config']['html2xhtml'])
|
|
||||||
{
|
if ($GLOBALS['g_config']['html2xhtml']) {
|
||||||
$pipeline->data_filters[] = new DataFilterHTML2XHTML();
|
$pipeline->data_filters[] = new DataFilterHTML2XHTML();
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$pipeline->data_filters[] = new DataFilterXHTML2XHTML();
|
$pipeline->data_filters[] = new DataFilterXHTML2XHTML();
|
||||||
}
|
}
|
||||||
|
|
||||||
$pipeline->parser = new ParserXHTML();
|
$pipeline->parser = new ParserXHTML();
|
||||||
$pipeline->pre_tree_filters = array();
|
$pipeline->pre_tree_filters = array();
|
||||||
$header_html = '';
|
$header_html = '';
|
||||||
$footer_html = '';
|
$footer_html = '';
|
||||||
$filter = new PreTreeFilterHeaderFooter($header_html, $footer_html);
|
$filter = new PreTreeFilterHeaderFooter($header_html, $footer_html);
|
||||||
$pipeline->pre_tree_filters[] = $filter;
|
$pipeline->pre_tree_filters[] = $filter;
|
||||||
if ($GLOBALS['g_config']['renderfields'])
|
|
||||||
{
|
if ($GLOBALS['g_config']['renderfields']) {
|
||||||
$pipeline->pre_tree_filters[] = new PreTreeFilterHTML2PSFields();
|
$pipeline->pre_tree_filters[] = new PreTreeFilterHTML2PSFields();
|
||||||
}
|
}
|
||||||
if ($GLOBALS['g_config']['method'] === 'ps')
|
|
||||||
{
|
if ($GLOBALS['g_config']['method'] === 'ps') {
|
||||||
$pipeline->layout_engine = new LayoutEnginePS();
|
$pipeline->layout_engine = new LayoutEnginePS();
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$pipeline->layout_engine = new LayoutEngineDefault();
|
$pipeline->layout_engine = new LayoutEngineDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
$pipeline->post_tree_filters = array();
|
$pipeline->post_tree_filters = array();
|
||||||
if ($GLOBALS['g_config']['pslevel'] == 3)
|
|
||||||
{
|
if ($GLOBALS['g_config']['pslevel'] == 3) {
|
||||||
$image_encoder = new PSL3ImageEncoderStream();
|
$image_encoder = new PSL3ImageEncoderStream();
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$image_encoder = new PSL2ImageEncoderStream();
|
$image_encoder = new PSL2ImageEncoderStream();
|
||||||
}
|
}
|
||||||
switch ($GLOBALS['g_config']['method'])
|
|
||||||
{
|
switch ($GLOBALS['g_config']['method']) {
|
||||||
case 'fastps':
|
case 'fastps':
|
||||||
if ($GLOBALS['g_config']['pslevel'] == 3)
|
if ($GLOBALS['g_config']['pslevel'] == 3) {
|
||||||
{
|
|
||||||
$pipeline->output_driver = new OutputDriverFastPS($image_encoder);
|
$pipeline->output_driver = new OutputDriverFastPS($image_encoder);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$pipeline->output_driver = new OutputDriverFastPSLevel2($image_encoder);
|
$pipeline->output_driver = new OutputDriverFastPSLevel2($image_encoder);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -739,46 +842,46 @@ class OutputDocument extends BaseOutputDocument {
|
|||||||
default:
|
default:
|
||||||
die('Unknown output method');
|
die('Unknown output method');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($GLOBALS['g_config']['watermarkhtml'])) {
|
if (isset($GLOBALS['g_config']['watermarkhtml'])) {
|
||||||
$watermark_text = $GLOBALS['g_config']['watermarkhtml'];
|
$watermark_text = $GLOBALS['g_config']['watermarkhtml'];
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$watermark_text = '';
|
$watermark_text = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$pipeline->output_driver->set_watermark($watermark_text);
|
$pipeline->output_driver->set_watermark($watermark_text);
|
||||||
if ($watermark_text != '')
|
|
||||||
{
|
if ($watermark_text != '') {
|
||||||
$dispatcher =& $pipeline->getDispatcher();
|
$dispatcher =& $pipeline->getDispatcher();
|
||||||
}
|
}
|
||||||
if ($GLOBALS['g_config']['debugbox'])
|
|
||||||
{
|
if ($GLOBALS['g_config']['debugbox']) {
|
||||||
$pipeline->output_driver->set_debug_boxes(true);
|
$pipeline->output_driver->set_debug_boxes(true);
|
||||||
}
|
}
|
||||||
if ($GLOBALS['g_config']['draw_page_border'])
|
|
||||||
{
|
if ($GLOBALS['g_config']['draw_page_border']) {
|
||||||
$pipeline->output_driver->set_show_page_border(true);
|
$pipeline->output_driver->set_show_page_border(true);
|
||||||
}
|
}
|
||||||
if ($GLOBALS['g_config']['ps2pdf'])
|
|
||||||
{
|
if ($GLOBALS['g_config']['ps2pdf']) {
|
||||||
$pipeline->output_filters[] = new OutputFilterPS2PDF($GLOBALS['g_config']['pdfversion']);
|
$pipeline->output_filters[] = new OutputFilterPS2PDF($GLOBALS['g_config']['pdfversion']);
|
||||||
}
|
}
|
||||||
if ($GLOBALS['g_config']['compress'] && $GLOBALS['g_config']['method'] == 'fastps')
|
|
||||||
{
|
if ($GLOBALS['g_config']['compress'] && $GLOBALS['g_config']['method'] == 'fastps') {
|
||||||
$pipeline->output_filters[] = new OutputFilterGZip();
|
$pipeline->output_filters[] = new OutputFilterGZip();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset($GLOBALS['g_config']['process_mode'])) {
|
if (!isset($GLOBALS['g_config']['process_mode'])) {
|
||||||
$GLOBALS['g_config']['process_mode'] = '';
|
$GLOBALS['g_config']['process_mode'] = '';
|
||||||
}
|
}
|
||||||
if ($GLOBALS['g_config']['process_mode'] == 'batch')
|
|
||||||
{
|
if ($GLOBALS['g_config']['process_mode'] == 'batch') {
|
||||||
$filename = 'batch';
|
$filename = 'batch';
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$filename = $sFilename;
|
$filename = $sFilename;
|
||||||
}
|
}
|
||||||
switch ($GLOBALS['g_config']['output'])
|
|
||||||
{
|
switch ($GLOBALS['g_config']['output']) {
|
||||||
case 0:
|
case 0:
|
||||||
$pipeline->destination = new DestinationBrowser($filename);
|
$pipeline->destination = new DestinationBrowser($filename);
|
||||||
break;
|
break;
|
||||||
@@ -789,25 +892,26 @@ class OutputDocument extends BaseOutputDocument {
|
|||||||
$pipeline->destination = new DestinationFile($filename);
|
$pipeline->destination = new DestinationFile($filename);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
copy($sPath . $sFilename . '.html', PATH_OUTPUT_FILE_DIRECTORY . $sFilename . '.html');
|
copy($sPath . $sFilename . '.html', PATH_OUTPUT_FILE_DIRECTORY . $sFilename . '.html');
|
||||||
$status = $pipeline->process(( (isset($_SERVER['HTTPS']))&&($_SERVER['HTTPS']=='on') ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . '/files/' . $_SESSION['APPLICATION'] . '/outdocs/' . $sFilename . '.html', $g_media);
|
$status = $pipeline->process(((isset($_SERVER['HTTPS']))&&($_SERVER['HTTPS']=='on') ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . '/files/' . $_SESSION['APPLICATION'] . '/outdocs/' . $sFilename . '.html', $g_media);
|
||||||
|
|
||||||
copy(PATH_OUTPUT_FILE_DIRECTORY . $sFilename . '.pdf', $sPath . $sFilename . '.pdf');
|
copy(PATH_OUTPUT_FILE_DIRECTORY . $sFilename . '.pdf', $sPath . $sFilename . '.pdf');
|
||||||
unlink(PATH_OUTPUT_FILE_DIRECTORY . $sFilename . '.pdf');
|
unlink(PATH_OUTPUT_FILE_DIRECTORY . $sFilename . '.pdf');
|
||||||
unlink(PATH_OUTPUT_FILE_DIRECTORY . $sFilename . '.html');
|
unlink(PATH_OUTPUT_FILE_DIRECTORY . $sFilename . '.html');
|
||||||
|
|
||||||
}//end if $sTypeDocToGener
|
|
||||||
/* End - Create .pdf */
|
|
||||||
}
|
}
|
||||||
else
|
//end if $sTypeDocToGener
|
||||||
{
|
/* End - Create .pdf */
|
||||||
return PEAR::raiseError(null,
|
} else {
|
||||||
|
return PEAR::raiseError(
|
||||||
|
null,
|
||||||
G_ERROR_USER_UID,
|
G_ERROR_USER_UID,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
'You tried to call to a generate method without send the Output Document UID, fields to use and the file path!',
|
'You tried to call to a generate method without send the Output Document UID, fields to use and the file path!',
|
||||||
'G_Error',
|
'G_Error',
|
||||||
true);
|
true
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -817,20 +921,22 @@ class OutputDocument extends BaseOutputDocument {
|
|||||||
*
|
*
|
||||||
* @param string $sUid the uid of the Prolication
|
* @param string $sUid the uid of the Prolication
|
||||||
*/
|
*/
|
||||||
|
public function OutputExists($sUid)
|
||||||
function OutputExists ( $sUid ) {
|
{
|
||||||
$con = Propel::getConnection(OutputDocumentPeer::DATABASE_NAME);
|
$con = Propel::getConnection(OutputDocumentPeer::DATABASE_NAME);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$oObj = OutputDocumentPeer::retrieveByPk( $sUid );
|
$oObj = OutputDocumentPeer::retrieveByPk( $sUid );
|
||||||
|
|
||||||
if (is_object($oObj) && get_class ($oObj) == 'OutputDocument' ) {
|
if (is_object($oObj) && get_class ($oObj) == 'OutputDocument' ) {
|
||||||
return true;
|
return true;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception $oError) {
|
||||||
catch (Exception $oError) {
|
throw ($oError);
|
||||||
throw($oError);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // OutputDocument
|
}
|
||||||
|
// OutputDocument
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user