GAP-4
This commit is contained in:
@@ -1,4 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use ProcessMaker\Core\AppEvent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class xmlformTemplate
|
* Class xmlformTemplate
|
||||||
*
|
*
|
||||||
@@ -350,6 +353,10 @@ class xmlformTemplate extends Smarty
|
|||||||
//(with the method "printTemplate") and painting takes less than 1 second
|
//(with the method "printTemplate") and painting takes less than 1 second
|
||||||
//so the new template resource generally will had the same timestamp.
|
//so the new template resource generally will had the same timestamp.
|
||||||
$output = $this->fetch ( 'mem:defaultTemplate' . $form->name );
|
$output = $this->fetch ( 'mem:defaultTemplate' . $form->name );
|
||||||
|
$output = AppEvent::getAppEvent()
|
||||||
|
->setHtml($output)
|
||||||
|
->dispatch(AppEvent::XMLFORM_RENDER, $form)
|
||||||
|
->getHtml();
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
96
workflow/engine/src/ProcessMaker/Core/AppEvent.php
Normal file
96
workflow/engine/src/ProcessMaker/Core/AppEvent.php
Normal file
@@ -0,0 +1,96 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace ProcessMaker\Core;
|
||||||
|
|
||||||
|
class AppEvent
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Identify XML Form type elements
|
||||||
|
*/
|
||||||
|
const XMLFORM_RENDER = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents the AppEvent object.
|
||||||
|
*
|
||||||
|
* @var object
|
||||||
|
*/
|
||||||
|
private static $appEvent = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of closure elements.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
private $callbacks = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents the html string.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $html = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get an AppEvent object.
|
||||||
|
*
|
||||||
|
* @return object
|
||||||
|
*/
|
||||||
|
public static function getAppEvent()
|
||||||
|
{
|
||||||
|
if (self::$appEvent === null) {
|
||||||
|
self::$appEvent = new AppEvent();
|
||||||
|
}
|
||||||
|
return self::$appEvent;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Process all closure elements.
|
||||||
|
*
|
||||||
|
* @param int $type
|
||||||
|
* @param object $object
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function dispatch($type, $object)
|
||||||
|
{
|
||||||
|
foreach ($this->callbacks as $callback) {
|
||||||
|
$callback($type, $object, $this);
|
||||||
|
}
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a closure function.
|
||||||
|
*
|
||||||
|
* @param function $callback
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function addEvent($callback)
|
||||||
|
{
|
||||||
|
if (is_callable($callback)) {
|
||||||
|
$this->callbacks[] = $callback;
|
||||||
|
}
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get html value.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getHtml()
|
||||||
|
{
|
||||||
|
return $this->html;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set html value.
|
||||||
|
*
|
||||||
|
* @param string $html
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function setHtml($html)
|
||||||
|
{
|
||||||
|
$this->html = $html;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,6 +4,7 @@ use Illuminate\Foundation\Http\Kernel;
|
|||||||
use Maveriks\WebApplication;
|
use Maveriks\WebApplication;
|
||||||
use Maveriks\Http\Response;
|
use Maveriks\Http\Response;
|
||||||
use Maveriks\Pattern\Mvc\PhtmlView;
|
use Maveriks\Pattern\Mvc\PhtmlView;
|
||||||
|
use ProcessMaker\Core\AppEvent;
|
||||||
use ProcessMaker\Exception\RBACException;
|
use ProcessMaker\Exception\RBACException;
|
||||||
|
|
||||||
// Because laravel has a __ helper function, it's important we include the class.g file to ensure our __ is used.
|
// Because laravel has a __ helper function, it's important we include the class.g file to ensure our __ is used.
|
||||||
@@ -11,6 +12,7 @@ require_once __DIR__ . '/../../gulliver/system/class.g.php';
|
|||||||
require_once __DIR__ . '/../../bootstrap/autoload.php';
|
require_once __DIR__ . '/../../bootstrap/autoload.php';
|
||||||
require_once __DIR__ . '/../../bootstrap/app.php';
|
require_once __DIR__ . '/../../bootstrap/app.php';
|
||||||
|
|
||||||
|
AppEvent::getAppEvent();
|
||||||
|
|
||||||
register_shutdown_function(
|
register_shutdown_function(
|
||||||
create_function(
|
create_function(
|
||||||
|
|||||||
Reference in New Issue
Block a user