diff --git a/framework/src/Maveriks/Extension/Restler.php b/framework/src/Maveriks/Extension/Restler.php
index c4769a9f3..eee8feeab 100644
--- a/framework/src/Maveriks/Extension/Restler.php
+++ b/framework/src/Maveriks/Extension/Restler.php
@@ -4,6 +4,7 @@ namespace Maveriks\Extension;
use Luracast\Restler\Defaults;
use Luracast\Restler\Format\JsonFormat;
use Luracast\Restler\Format\UrlEncodedFormat;
+use ProcessMaker\Plugins\PluginRegistry;
use ProcessMaker\Services\Api;
use Luracast\Restler\RestException;
@@ -174,7 +175,7 @@ class Restler extends \Luracast\Restler\Restler
{
$classReflection = new \ReflectionClass($object);
$classShortName = $classReflection->getShortName();
- $registry = &\PMPluginRegistry::getSingleton();
+ $registry = PluginRegistry::loadSingleton();
$pluginsApiExtend = $registry->getExtendsRestService($classShortName);
if ($pluginsApiExtend) {
$classFilePath = $pluginsApiExtend['filePath'];
diff --git a/gulliver/bin/tasks/pakeGulliver.php b/gulliver/bin/tasks/pakeGulliver.php
index 745dbbe22..60f7e1bb4 100644
--- a/gulliver/bin/tasks/pakeGulliver.php
+++ b/gulliver/bin/tasks/pakeGulliver.php
@@ -519,7 +519,7 @@ function run_pack_plugin($task, $args) {
require_once ($pluginFilename);
- $oPluginRegistry = & PMPluginRegistry::getSingleton();
+ $oPluginRegistry = PluginsRegistry::loadSingleton();
$pluginDetail = $oPluginRegistry->getPluginDetails($pluginName . '.php');
$fileTar = $pluginHome . PATH_SEP . $pluginName . '-' . $pluginDetail->iVersion . '.tar';
@@ -2228,7 +2228,7 @@ function run_update_plugin_attributes($task, $args)
$pluginName = $args[0];
//Update plugin attributes
- $pmPluginRegistry = &PMPluginRegistry::getSingleton();
+ $pmPluginRegistry = \ProcessMaker\Plugins\PluginRegistry::loadSingleton();
$pmPluginRegistry->updatePluginAttributesInAllWorkspaces($pluginName);
diff --git a/gulliver/methods/defaultAjax.php b/gulliver/methods/defaultAjax.php
index c0ad336a0..e7dfda21c 100644
--- a/gulliver/methods/defaultAjax.php
+++ b/gulliver/methods/defaultAjax.php
@@ -44,7 +44,7 @@ if (! is_file( XMLFORM_AJAX_PATH . $xmlFile )) {
$aux = explode( PATH_SEP, $xmlFile );
//check if G_PLUGIN_CLASS is defined, because publisher can be called without an environment
if (count( $aux ) == 2 && defined( 'G_PLUGIN_CLASS' )) {
- $oPluginRegistry = & PMPluginRegistry::getSingleton();
+ $oPluginRegistry = \ProcessMaker\Plugins\PluginRegistry::loadSingleton();
if ($oPluginRegistry->isRegisteredFolder( $aux[0] )) {
$sPath = PATH_PLUGINS;
}
diff --git a/gulliver/methods/propelTableAjax.php b/gulliver/methods/propelTableAjax.php
index 6ca4aaaa9..36a002dd7 100644
--- a/gulliver/methods/propelTableAjax.php
+++ b/gulliver/methods/propelTableAjax.php
@@ -39,7 +39,7 @@ if (isset($ntable->filterForm_Id) && ($ntable->filterForm_Id!=='')) {
$aux = explode ( PATH_SEP, G::getUIDName( $ntable->filterForm_Id ) );
//check if G_PLUGIN_CLASS is defined, because publisher can be called without an environment
if ( count($aux) == 2 && defined ( 'G_PLUGIN_CLASS' ) ) {
- $oPluginRegistry =& PMPluginRegistry::getSingleton();
+ $oPluginRegistry = \ProcessMaker\Plugins\PluginRegistry::loadSingleton();
if ( $oPluginRegistry->isRegisteredFolder($aux[0]) ) {
$sPath = PATH_PLUGINS;
}
diff --git a/gulliver/system/class.headPublisher.php b/gulliver/system/class.headPublisher.php
index af11a0e73..e4979b5f5 100644
--- a/gulliver/system/class.headPublisher.php
+++ b/gulliver/system/class.headPublisher.php
@@ -389,8 +389,9 @@ class headPublisher
if (class_exists('PMPluginRegistry') && defined('SYS_SYS')) {
$oPluginRegistry = & PMPluginRegistry::getSingleton();
$registeredCss = $oPluginRegistry->getRegisteredCss();
+ /** @var \ProcessMaker\Plugins\Interfaces\CssFile $cssFile */
foreach ($registeredCss as $cssFile) {
- $script .= " \n";
+ $script .= " \n";
}
}
return $script;
@@ -551,7 +552,7 @@ class headPublisher
//hook for registered javascripts from plugins
if (class_exists('PMPluginRegistry') && defined('SYS_SYS')) {
- $oPluginRegistry = & PMPluginRegistry::getSingleton();
+ $oPluginRegistry = \ProcessMaker\Plugins\PluginRegistry::loadSingleton();
$pluginJavascripts = $oPluginRegistry->getRegisteredJavascriptBy($filename);
} else {
$pluginJavascripts = array();
diff --git a/gulliver/system/class.menu.php b/gulliver/system/class.menu.php
index e539f2417..a50fc0b26 100644
--- a/gulliver/system/class.menu.php
+++ b/gulliver/system/class.menu.php
@@ -31,6 +31,8 @@
*
*/
+use ProcessMaker\Plugins\PluginRegistry;
+
/**
*
*
@@ -91,7 +93,7 @@ class Menu
if (!is_file($fMenu)) {
$aux = explode(PATH_SEP, $strMenuName);
if (count($aux) == 2) {
- $oPluginRegistry = & PMPluginRegistry::getSingleton();
+ $oPluginRegistry = PluginRegistry::loadSingleton();
if ($oPluginRegistry->isRegisteredFolder($aux[0])) {
$fMenu = PATH_PLUGINS . $aux[0] . PATH_SEP . $aux[1] . ".php";
}
@@ -103,7 +105,7 @@ class Menu
}
include ($fMenu);
//this line will add options to current menu.
- $oPluginRegistry = & PMPluginRegistry::getSingleton();
+ $oPluginRegistry = PluginRegistry::loadSingleton();
$oPluginRegistry->getMenus($strMenuName);
$oMenuFromPlugin = array();
diff --git a/gulliver/system/class.publisher.php b/gulliver/system/class.publisher.php
index 275a976d7..a9010fff2 100644
--- a/gulliver/system/class.publisher.php
+++ b/gulliver/system/class.publisher.php
@@ -25,7 +25,7 @@
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
-
+use ProcessMaker\Plugins\PluginRegistry;
/**
* Publisher class definition
* It is to publish all content in a page
@@ -174,7 +174,7 @@ class Publisher
$aux[1] = $filename;
}
if (count( $aux ) == 2 && defined( 'G_PLUGIN_CLASS' )) {
- $oPluginRegistry = & PMPluginRegistry::getSingleton();
+ $oPluginRegistry = PluginRegistry::loadSingleton();
if ($response = $oPluginRegistry->isRegisteredFolder( $aux[0] )) {
if ($response !== true) {
$sPath = PATH_PLUGINS . $response . PATH_SEP;
@@ -314,7 +314,7 @@ class Publisher
if (! is_file( $sPath . $Part['File'] )) {
$aux = explode( PATH_SEP, $Part['File'] );
if (count( $aux ) == 2) {
- $oPluginRegistry = & PMPluginRegistry::getSingleton();
+ $oPluginRegistry = PluginRegistry::loadSingleton();
if ($oPluginRegistry->isRegisteredFolder( $aux[0] )) {
$sPath = PATH_PLUGINS; // . $aux[0] . PATH_SEP ;
}
@@ -400,7 +400,7 @@ class Publisher
//search in PLUGINS folder, probably the file is in plugin
if (count( $aux ) == 2) {
- $oPluginRegistry = & PMPluginRegistry::getSingleton();
+ $oPluginRegistry = PluginRegistry::loadSingleton();
if ($oPluginRegistry->isRegisteredFolder( $aux[0] )) {
$sPath = PATH_PLUGINS; // . $aux[0] . PATH_SEP ;
}
@@ -573,7 +573,7 @@ class Publisher
// verify if there are templates folders registered, template and method folders are the same
$folderTemplate = explode( '/', $Part['Template'] );
- $oPluginRegistry = & PMPluginRegistry::getSingleton();
+ $oPluginRegistry = PluginRegistry::loadSingleton();
if ($oPluginRegistry->isRegisteredFolder( $folderTemplate[0] )) {
$template->templateFile = PATH_PLUGINS . $Part['Template'] . '.html';
} else {
@@ -621,7 +621,7 @@ class Publisher
$userTemplate = G::ExpandPath( 'templates' ) . $Part['Template'];
$globalTemplate = PATH_TEMPLATE . $Part['Template'];
if (! is_file( $userTemplate ) && ! is_file( $globalTemplate )) {
- $oPluginRegistry = & PMPluginRegistry::getSingleton();
+ $oPluginRegistry = PluginRegistry::loadSingleton();
if ($oPluginRegistry->isRegisteredFolder( $aux[0] )) {
$pluginTemplate = PATH_PLUGINS . $Part['Template'] . '.php';
include ($pluginTemplate);
diff --git a/gulliver/system/class.xmlform.php b/gulliver/system/class.xmlform.php
index 16d0ae874..8c8e71236 100644
--- a/gulliver/system/class.xmlform.php
+++ b/gulliver/system/class.xmlform.php
@@ -24,6 +24,9 @@
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
+
+use ProcessMaker\Plugins\PluginRegistry;
+
/**
* Class XmlForm_Field
*
@@ -5492,7 +5495,7 @@ class XmlForm
$aux[1] = $filename;
}
if (count( $aux ) == 2 && defined( 'G_PLUGIN_CLASS' )) {
- $oPluginRegistry = & PMPluginRegistry::getSingleton();
+ $oPluginRegistry = PluginRegistry::loadSingleton();
if ($response = $oPluginRegistry->isRegisteredFolder( $aux[0] )) {
if ($response !== true) {
$sPath = PATH_PLUGINS . $response . PATH_SEP;
diff --git a/rbac/engine/classes/model/RbacUsers.php b/rbac/engine/classes/model/RbacUsers.php
index 760a9c9b2..07abdecc1 100644
--- a/rbac/engine/classes/model/RbacUsers.php
+++ b/rbac/engine/classes/model/RbacUsers.php
@@ -28,6 +28,8 @@
* @access public
*/
+use ProcessMaker\Plugins\PluginRegistry;
+
/**
* Skeleton subclass for representing a row from the 'USERS' table.
*
@@ -196,7 +198,7 @@ class RbacUsers extends BaseRbacUsers
public function create($aData)
{
if (class_exists('PMPluginRegistry')) {
- $pluginRegistry = & PMPluginRegistry::getSingleton();
+ $pluginRegistry = PluginRegistry::loadSingleton();
if ($pluginRegistry->existsTrigger(PM_BEFORE_CREATE_USER)) {
try {
$pluginRegistry->executeTriggers(PM_BEFORE_CREATE_USER, null);
diff --git a/workflow/engine/bin/cron_single.php b/workflow/engine/bin/cron_single.php
index 407db80b6..afc098598 100644
--- a/workflow/engine/bin/cron_single.php
+++ b/workflow/engine/bin/cron_single.php
@@ -256,9 +256,6 @@ try {
define('TIME_ZONE', ini_get('date.timezone'));
- //Enable Monolog
-
-
//Processing
eprintln('Processing workspace: ' . $workspace, 'green');
@@ -314,7 +311,7 @@ function processWorkspace()
{
try {
- $oPluginRegistry =& PMPluginRegistry::getSingleton();
+ $oPluginRegistry = \ProcessMaker\Plugins\PluginRegistry::loadSingleton();
if (file_exists(PATH_DATA_SITE . 'plugin.singleton')) {
$oPluginRegistry->unSerializeInstance(file_get_contents(PATH_DATA_SITE . 'plugin.singleton'));
}
@@ -422,8 +419,6 @@ function unpauseApplications()
setExecutionMessage("Unpausing applications");
try {
-
-
$oCases = new Cases();
$oCases->ThrowUnpauseDaemon($sNow, 1);
@@ -467,7 +462,7 @@ function executePlugins()
// Executing registered cron files
// -> Get registered cron files
- $oPluginRegistry =& PMPluginRegistry::getSingleton();
+ $oPluginRegistry = \ProcessMaker\Plugins\PluginRegistry::loadSingleton();
$cronFiles = $oPluginRegistry->getCronFiles();
// -> Execute functions
diff --git a/workflow/engine/bin/tasks/cliWorkspaces.php b/workflow/engine/bin/tasks/cliWorkspaces.php
index 46c3206ff..cba1c6302 100644
--- a/workflow/engine/bin/tasks/cliWorkspaces.php
+++ b/workflow/engine/bin/tasks/cliWorkspaces.php
@@ -1098,6 +1098,7 @@ function run_migrate_indexing_acv($args, $opts) {
function run_migrate_plugin($args, $opts) {
$workspaces = get_workspaces_from_args($args);
//Check if the command is executed by a specific workspace
+ /** @var workspaceTools $workspace */
if (count($workspaces) === 1) {
$workspace = array_shift($workspaces);
print_r('Regenerating Singleton in: ' . pakeColor::colorize($workspace->name, 'INFO') . "\n");
@@ -1106,7 +1107,6 @@ function run_migrate_plugin($args, $opts) {
} else {
CLI::logging("> Migrating and populating data...\n");
$start = microtime(true);
- /** @var workspaceTools $workspace */
foreach ($workspaces as $workspace) {
passthru('./processmaker migrate-plugins-singleton-information '.$workspace->name);
}
diff --git a/workflow/engine/classes/class.applications.php b/workflow/engine/classes/class.applications.php
index f34ce1222..69d8e53bd 100644
--- a/workflow/engine/classes/class.applications.php
+++ b/workflow/engine/classes/class.applications.php
@@ -1,4 +1,7 @@
getAllCaseSteps( $proUid, $tasUid, $appUid );
//getting externals steps
- $oPluginRegistry = &PMPluginRegistry::getSingleton();
+ $oPluginRegistry = PluginRegistry::loadSingleton();
$eSteps = $oPluginRegistry->getSteps();
$externalSteps = array ();
-
+ /** @var \ProcessMaker\Plugins\Interfaces\StepDetail $externalStep */
foreach ($eSteps as $externalStep) {
- $externalSteps[$externalStep->sStepId] = $externalStep;
+ $externalSteps[$externalStep->getStepId()] = $externalStep;
}
//getting the case record
@@ -1195,11 +1198,11 @@ class Applications
break;
case 'EXTERNAL':
$stepTitle = 'unknown ' . $caseStep->getStepUidObj();
- $oPluginRegistry = PMPluginRegistry::getSingleton();
+ $oPluginRegistry = PluginRegistry::loadSingleton();
$externalStep = $externalSteps[$caseStep->getStepUidObj()];
- $stepItem['id'] = $externalStep->sStepId;
- $stepItem['title'] = $externalStep->sStepTitle;
- $stepItem['url'] = "cases/cases_Step?UID={$externalStep->sStepId}&TYPE=EXTERNAL&POSITION=$stepPosition&ACTION=EDIT";
+ $stepItem['id'] = $externalStep->getStepId();
+ $stepItem['title'] = $externalStep->getStepTitle();
+ $stepItem['url'] = "cases/cases_Step?UID={$externalStep->getStepId()}&TYPE=EXTERNAL&POSITION=$stepPosition&ACTION=EDIT";
break;
}
diff --git a/workflow/engine/classes/class.case.php b/workflow/engine/classes/class.case.php
index 9e7654072..d97c76d59 100644
--- a/workflow/engine/classes/class.case.php
+++ b/workflow/engine/classes/class.case.php
@@ -25,6 +25,7 @@
*
*/
+use ProcessMaker\Plugins\PluginRegistry;
/**
* A Cases object where you can do start, load, update, refresh about cases
@@ -2267,7 +2268,7 @@ class Cases
$newValues['APP_TITLE'],
$sUsrUid
);
- $oPluginRegistry = &PMPluginRegistry::getSingleton();
+ $oPluginRegistry = PluginRegistry::loadSingleton();
$oPluginRegistry->executeTriggers(PM_CREATE_CASE, $folderData);
}
$this->getExecuteTriggerProcess($sAppUid, 'CREATE');
@@ -3539,7 +3540,7 @@ class Cases
$_SESSION['PROCESS'], $sApplicationUID, $_SESSION['TASK'], $_SESSION['USER_LOGGED'], $ACTION = 'DELETE'
);
$listing = false;
- $oPluginRegistry = & PMPluginRegistry::getSingleton();
+ $oPluginRegistry = PluginRegistry::loadSingleton();
if ($oPluginRegistry->existsTrigger(PM_CASE_DOCUMENT_LIST)) {
$folderData = new folderData(null, null, $sApplicationUID, null, $_SESSION['USER_LOGGED']);
$folderData->PMType = "INPUT";
@@ -3880,7 +3881,7 @@ class Cases
}
//Plugin Hook PM_UPLOAD_DOCUMENT for upload document
- $pluginRegistry = &PMPluginRegistry::getSingleton();
+ $pluginRegistry = PluginRegistry::loadSingleton();
if ($pluginRegistry->existsTrigger(PM_UPLOAD_DOCUMENT) && class_exists("uploadDocumentData")) {
$triggerDetail = $pluginRegistry->getTriggerInfo(PM_UPLOAD_DOCUMENT);
@@ -4637,12 +4638,11 @@ class Cases
$confEnvSetting = $conf->getFormats();
$listing = false;
- $oPluginRegistry = & PMPluginRegistry::getSingleton();
+ $oPluginRegistry = PluginRegistry::loadSingleton();
if ($oPluginRegistry->existsTrigger(PM_CASE_DOCUMENT_LIST)) {
$folderData = new folderData(null, null, $sApplicationUID, null, $sUserUID);
$folderData->PMType = "INPUT";
$folderData->returnList = true;
- //$oPluginRegistry = & PMPluginRegistry::getSingleton();
$listing = $oPluginRegistry->executeTriggers(PM_CASE_DOCUMENT_LIST, $folderData);
}
@@ -4944,12 +4944,11 @@ class Cases
$confEnvSetting = $conf->getFormats();
$listing = false;
- $oPluginRegistry = & PMPluginRegistry::getSingleton();
+ $oPluginRegistry = PluginRegistry::loadSingleton();
if ($oPluginRegistry->existsTrigger(PM_CASE_DOCUMENT_LIST)) {
$folderData = new folderData(null, null, $sApplicationUID, null, $sUserUID);
$folderData->PMType = "OUTPUT";
$folderData->returnList = true;
- //$oPluginRegistry = & PMPluginRegistry::getSingleton();
$listing = $oPluginRegistry->executeTriggers(PM_CASE_DOCUMENT_LIST, $folderData);
}
diff --git a/workflow/engine/classes/class.plugin.php b/workflow/engine/classes/class.plugin.php
index f044db803..16d4ed8d6 100644
--- a/workflow/engine/classes/class.plugin.php
+++ b/workflow/engine/classes/class.plugin.php
@@ -23,6 +23,8 @@
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
+use ProcessMaker\Plugins\PluginRegistry;
+
require_once 'class.pluginRegistry.php';
define('G_PLUGIN_CLASS', 1);
@@ -84,9 +86,8 @@ class PMPlugin
*/
public function registerMenu($menuId, $menuFilename)
{
- $oPluginRegistry =& PMPluginRegistry::getSingleton();
$sMenuFilename = ($this->sClassName == 'enterprisePlugin') ? PATH_CORE . 'methods' . PATH_SEP . 'enterprise' . PATH_SEP . $menuFilename : PATH_PLUGINS . $this->sPluginFolder . PATH_SEP . $menuFilename;
- $oPluginRegistry->registerMenu($this->sNamespace, $menuId, $sMenuFilename);
+ PluginRegistry::loadSingleton()->registerMenu($this->sNamespace, $menuId, $sMenuFilename);
}
/**
@@ -96,8 +97,7 @@ class PMPlugin
*/
public function registerDashlets()
{
- $oPluginRegistry =& PMPluginRegistry::getSingleton();
- $oPluginRegistry->registerDashlets($this->sNamespace);
+ PluginRegistry::loadSingleton()->registerDashlets($this->sNamespace);
}
/**
@@ -107,8 +107,7 @@ class PMPlugin
*/
public function registerReport()
{
- $oPluginRegistry =& PMPluginRegistry::getSingleton();
- $oPluginRegistry->registerReport($this->sNamespace);
+ PluginRegistry::loadSingleton()->registerReport($this->sNamespace);
}
/**
@@ -118,8 +117,7 @@ class PMPlugin
*/
public function registerPmFunction()
{
- $oPluginRegistry =& PMPluginRegistry::getSingleton();
- $oPluginRegistry->registerPmFunction($this->sNamespace);
+ PluginRegistry::loadSingleton()->registerPmFunction($this->sNamespace);
}
/**
@@ -129,8 +127,7 @@ class PMPlugin
*/
public function setCompanyLogo($filename)
{
- $oPluginRegistry =& PMPluginRegistry::getSingleton();
- $oPluginRegistry->setCompanyLogo($this->sNamespace, $filename);
+ PluginRegistry::loadSingleton()->setCompanyLogo($this->sNamespace, $filename);
}
/**
@@ -140,8 +137,7 @@ class PMPlugin
*/
public function redirectLogin($role, $pathMethod)
{
- $oPluginRegistry =& PMPluginRegistry::getSingleton();
- $oPluginRegistry->registerRedirectLogin($this->sNamespace, $role, $pathMethod);
+ PluginRegistry::loadSingleton()->registerRedirectLogin($this->sNamespace, $role, $pathMethod);
}
/**
@@ -151,8 +147,7 @@ class PMPlugin
*/
public function registerFolder($sFolderId, $sFolderName)
{
- $oPluginRegistry =& PMPluginRegistry::getSingleton();
- $oPluginRegistry->registerFolder($this->sNamespace, $sFolderId, $sFolderName);
+ PluginRegistry::loadSingleton()->registerFolder($this->sNamespace, $sFolderId, $sFolderName);
}
/**
@@ -162,8 +157,7 @@ class PMPlugin
*/
public function registerStep($sStepId, $sStepName, $sStepTitle, $sSetupStepPage = '')
{
- $oPluginRegistry =& PMPluginRegistry::getSingleton();
- $oPluginRegistry->registerStep( $this->sNamespace, $sStepId, $sStepName, $sStepTitle, $sSetupStepPage );
+ PluginRegistry::loadSingleton()->registerStep( $this->sNamespace, $sStepId, $sStepName, $sStepTitle, $sSetupStepPage );
}
/**
@@ -174,8 +168,7 @@ class PMPlugin
*/
public function registerTrigger($sTriggerId, $sTriggerName)
{
- $oPluginRegistry =& PMPluginRegistry::getSingleton();
- $oPluginRegistry->registerTrigger($this->sNamespace, $sTriggerId, $sTriggerName);
+ PluginRegistry::loadSingleton()->registerTrigger($this->sNamespace, $sTriggerId, $sTriggerName);
}
/**
@@ -243,9 +236,8 @@ class PMPlugin
*/
public function registerBreakPageTemplate($pageId, $templateFilename)
{
- $oPluginRegistry =& PMPluginRegistry::getSingleton();
$sPageFilename = PATH_PLUGINS . $this->sPluginFolder . PATH_SEP . $templateFilename;
- $oPluginRegistry->registerBreakPageTemplate ($this->sNamespace, $pageId, $sPageFilename);
+ PluginRegistry::loadSingleton()->registerBreakPageTemplate ($this->sNamespace, $pageId, $sPageFilename);
}
/**
@@ -255,8 +247,7 @@ class PMPlugin
*/
public function registerCss($sCssFile)
{
- $oPluginRegistry =& PMPluginRegistry::getSingleton();
- $oPluginRegistry->registerCss($this->sNamespace, $sCssFile);
+ PluginRegistry::loadSingleton()->registerCss($this->sNamespace, $sCssFile);
}
/**
@@ -267,9 +258,8 @@ class PMPlugin
*/
public function registerToolbarFile($sToolbarId, $filename)
{
- $oPluginRegistry =& PMPluginRegistry::getSingleton();
$sFilename = PATH_PLUGINS . $this->sPluginFolder . PATH_SEP . $filename;
- $oPluginRegistry->registerToolbarFile($this->sNamespace, $sToolbarId, $sFilename);
+ PluginRegistry::loadSingleton()->registerToolbarFile($this->sNamespace, $sToolbarId, $sFilename);
}
/**
@@ -284,8 +274,7 @@ class PMPlugin
$sActionExecute,
$sActionGetFields
) {
- $oPluginRegistry =& PMPluginRegistry::getSingleton();
- $oPluginRegistry->registerCaseSchedulerPlugin(
+ PluginRegistry::loadSingleton()->registerCaseSchedulerPlugin(
$this->sNamespace, $sActionId, $sActionForm, $sActionSave, $sActionExecute, $sActionGetFields
);
}
@@ -297,8 +286,7 @@ class PMPlugin
*/
public function registerTaskExtendedProperty($sPage, $sName, $sIcon="")
{
- $oPluginRegistry =& PMPluginRegistry::getSingleton();
- $oPluginRegistry->registerTaskExtendedProperty ( $this->sNamespace, $sPage, $sName, $sIcon );
+ PluginRegistry::loadSingleton()->registerTaskExtendedProperty ( $this->sNamespace, $sPage, $sName, $sIcon );
}
/**
@@ -309,8 +297,7 @@ class PMPlugin
*/
function registerJavascript($sCoreJsFile, $pluginJsFile)
{
- $oPluginRegistry =& PMPluginRegistry::getSingleton();
- $oPluginRegistry->registerJavascript($this->sNamespace, $sCoreJsFile, $pluginJsFile);
+ PluginRegistry::loadSingleton()->registerJavascript($this->sNamespace, $sCoreJsFile, $pluginJsFile);
}
/**
@@ -321,8 +308,7 @@ class PMPlugin
*/
public function unregisterJavascript($sCoreJsFile, $pluginJsFile)
{
- $oPluginRegistry =& PMPluginRegistry::getSingleton();
- $oPluginRegistry->unregisterJavascript($this->sNamespace, $sCoreJsFile, $pluginJsFile);
+ PluginRegistry::loadSingleton()->unregisterJavascript($this->sNamespace, $sCoreJsFile, $pluginJsFile);
}
public function registerDashboard()
@@ -331,8 +317,7 @@ class PMPlugin
public function getExternalStepAction()
{
- $oPluginRegistry =& PMPluginRegistry::getSingleton();
- return $oPluginRegistry->getSteps();
+ return PluginRegistry::loadSingleton()->getSteps();
}
/**
@@ -345,8 +330,7 @@ class PMPlugin
*/
function registerRestService()
{
- $oPluginRegistry =& PMPluginRegistry::getSingleton();
- $oPluginRegistry->registerRestService($this->sNamespace);
+ PluginRegistry::loadSingleton()->registerRestService($this->sNamespace);
}
/**
@@ -356,8 +340,7 @@ class PMPlugin
*/
function registerExtendsRestService($className)
{
- $oPluginRegistry =& PMPluginRegistry::getSingleton();
- $oPluginRegistry->registerExtendsRestService($this->sNamespace, $className);
+ PluginRegistry::loadSingleton()->registerExtendsRestService($this->sNamespace, $className);
}
/**
@@ -367,8 +350,7 @@ class PMPlugin
*/
function disableExtendsRestService($className)
{
- $oPluginRegistry =& PMPluginRegistry::getSingleton();
- $oPluginRegistry->disableExtendsRestService($this->sNamespace, $className);
+ PluginRegistry::loadSingleton()->disableExtendsRestService($this->sNamespace, $className);
}
/**
@@ -381,8 +363,7 @@ class PMPlugin
*/
function unregisterRestService($classname, $path)
{
- $oPluginRegistry =& PMPluginRegistry::getSingleton();
- $oPluginRegistry->unregisterRestService($this->sNamespace, $classname, $path);
+ PluginRegistry::loadSingleton()->unregisterRestService($this->sNamespace, $classname, $path);
}
/**
@@ -392,14 +373,12 @@ class PMPlugin
*/
public function registerCronFile($cronFile)
{
- $oPluginRegistry =& PMPluginRegistry::getSingleton();
- $oPluginRegistry->registerCronFile($this->sNamespace, $cronFile);
+ PluginRegistry::loadSingleton()->registerCronFile($this->sNamespace, $cronFile);
}
function enableRestService($enable)
{
- $oPluginRegistry =& PMPluginRegistry::getSingleton();
- $oPluginRegistry->enableRestService($this->sNamespace, $enable);
+ PluginRegistry::loadSingleton()->enableRestService($this->sNamespace, $enable);
}
/**
@@ -412,8 +391,7 @@ class PMPlugin
public function registerDesignerMenu($file)
{
try {
- $pluginRegistry = &PMPluginRegistry::getSingleton();
- $pluginRegistry->registerDesignerMenu($this->sNamespace, $file);
+ PluginRegistry::loadSingleton()->registerDesignerMenu($this->sNamespace, $file);
} catch (Exception $e) {
throw $e;
}
@@ -431,8 +409,7 @@ class PMPlugin
public function registerMenuOptionsToReplace($from = array(), $options = array())
{
try {
- $oPluginRegistry =& PMPluginRegistry::getSingleton();
- $oPluginRegistry->registerMenuOptionsToReplace($this->sNamespace, $from, $options);
+ PluginRegistry::loadSingleton()->registerMenuOptionsToReplace($this->sNamespace, $from, $options);
} catch (Exception $e) {
throw $e;
}
@@ -448,8 +425,7 @@ class PMPlugin
public function registerImportProcessCallback($callBackFile = '')
{
try {
- $oPluginRegistry =& PMPluginRegistry::getSingleton();
- $oPluginRegistry->registerImportProcessCallback($this->sNamespace, $callBackFile);
+ PluginRegistry::loadSingleton()->registerImportProcessCallback($this->sNamespace, $callBackFile);
} catch (Exception $e) {
throw $e;
}
@@ -465,8 +441,7 @@ class PMPlugin
public function registerOpenReassignCallback($callBackFile = '')
{
try {
- $oPluginRegistry =& PMPluginRegistry::getSingleton();
- $oPluginRegistry->registerOpenReassignCallback($callBackFile);
+ PluginRegistry::loadSingleton()->registerOpenReassignCallback($callBackFile);
} catch (Exception $e) {
throw $e;
}
@@ -484,8 +459,7 @@ class PMPlugin
$scope = '/plugin/' . $this->sNamespace . '/';
}
try {
- $pluginRegistry = &PMPluginRegistry::getSingleton();
- $pluginRegistry->registerDesignerSourcePath($this->sNamespace, $scope . $pathFile);
+ PluginRegistry::loadSingleton()->registerDesignerSourcePath($this->sNamespace, $scope . $pathFile);
} catch (Exception $e) {
throw $e;
}
diff --git a/workflow/engine/classes/class.pluginRegistry.php b/workflow/engine/classes/class.pluginRegistry.php
index e1080ce34..1f663c983 100644
--- a/workflow/engine/classes/class.pluginRegistry.php
+++ b/workflow/engine/classes/class.pluginRegistry.php
@@ -142,7 +142,7 @@ class PMPluginRegistry
*/
public static function getSingleton()
{
- return \ProcessMaker\Plugins\PluginsRegistry::loadSingleton();
+ return \ProcessMaker\Plugins\PluginRegistry::loadSingleton();
}
/**
@@ -154,7 +154,7 @@ class PMPluginRegistry
*/
public static function loadSingleton($file)
{
- return \ProcessMaker\Plugins\PluginsRegistry::loadSingleton();
+ return \ProcessMaker\Plugins\PluginRegistry::loadSingleton();
}
/**
diff --git a/workflow/engine/classes/class.pmDashlet.php b/workflow/engine/classes/class.pmDashlet.php
index 6df43488a..fdaf5d295 100644
--- a/workflow/engine/classes/class.pmDashlet.php
+++ b/workflow/engine/classes/class.pmDashlet.php
@@ -1,5 +1,7 @@
getDashlets();
foreach ($pluginsDashlets as $pluginDashlet) {
@@ -381,12 +383,8 @@ class PMDashlet extends DashletInstance implements DashletInterface
if (strpos( $file, '.php', 1 ) && is_file( PATH_PLUGINS . $file )) {
include_once (PATH_PLUGINS . $file);
$pluginDetail = $oPluginRegistry->getPluginDetails( $file );
- if ($pluginDetail->sNamespace == $pluginName) {
- if ($pluginDetail->enabled == '1') {
- return true;
- } else {
- return false;
- }
+ if ($pluginDetail->getNamespace() == $pluginName) {
+ return $pluginDetail->isEnabled();
}
}
}
@@ -398,7 +396,7 @@ class PMDashlet extends DashletInstance implements DashletInterface
private static function setIncludePath ()
{
- $oPluginRegistry = &PMPluginRegistry::getSingleton();
+ $oPluginRegistry = PluginRegistry::loadSingleton();
$pluginsDashlets = $oPluginRegistry->getDashlets();
foreach ($pluginsDashlets as $pluginDashlet) {
set_include_path( get_include_path() . PATH_SEPARATOR . PATH_PLUGINS . $pluginDashlet . PATH_SEP );
diff --git a/workflow/engine/classes/class.pmFunctions.php b/workflow/engine/classes/class.pmFunctions.php
index e06e49940..20f5a8622 100644
--- a/workflow/engine/classes/class.pmFunctions.php
+++ b/workflow/engine/classes/class.pmFunctions.php
@@ -28,6 +28,7 @@
//
// License: LGPL, see LICENSE
////////////////////////////////////////////////////
+use ProcessMaker\Plugins\PluginRegistry;
use ProcessMaker\Util\ElementTranslation;
@@ -248,9 +249,6 @@ function executeQuery ($SqlStatement, $DBConnectionUID = 'workflow', $aParameter
((isset($blackList['tables']))? $blackList['tables'] : '') .
((isset($blackList['pmtables']))? $blackList['pmtables'] : '')
);
- if (!class_exists('PHPSQLParser')) {
-
- }
$parseSqlStm = new PHPSQLParser($SqlStatement);
try {
//Parsing queries and check the blacklist
@@ -1840,10 +1838,11 @@ function PMFGenerateOutputDocument ($outputID, $sApplication = null, $index = nu
//Plugin Hook PM_UPLOAD_DOCUMENT for upload document
- $oPluginRegistry = & PMPluginRegistry::getSingleton();
+ $oPluginRegistry = PluginRegistry::loadSingleton();
if ($oPluginRegistry->existsTrigger( PM_UPLOAD_DOCUMENT ) && class_exists( 'uploadDocumentData' )) {
+ /** @var \ProcessMaker\Plugins\Interfaces\TriggerDetail $triggerDetail */
$triggerDetail = $oPluginRegistry->getTriggerInfo( PM_UPLOAD_DOCUMENT );
- $aFields['APP_DOC_PLUGIN'] = $triggerDetail->sNamespace;
+ $aFields['APP_DOC_PLUGIN'] = $triggerDetail->getNamespace();
$oAppDocument1 = new AppDocument();
$oAppDocument1->update( $aFields );
diff --git a/workflow/engine/classes/class.pmLicenseManager.php b/workflow/engine/classes/class.pmLicenseManager.php
index e5c079877..3e8b4cade 100644
--- a/workflow/engine/classes/class.pmLicenseManager.php
+++ b/workflow/engine/classes/class.pmLicenseManager.php
@@ -1,4 +1,7 @@
result=="OK") {
//Disable
if (file_exists ( PATH_PLUGINS . 'enterprise/data/data' )) {
- $oPluginRegistry = & PMPluginRegistry::getSingleton ();
+ $oPluginRegistry = PluginRegistry::loadSingleton();
$aPlugins = unserialize ( trim ( file_get_contents ( PATH_PLUGINS . 'enterprise/data/data' ) ) );
foreach ($aPlugins as $aPlugin) {
$sClassName = substr ( $aPlugin ['sFilename'], 0, strpos ( $aPlugin ['sFilename'], '-' ) );
require_once PATH_PLUGINS . $sClassName . '.php';
$oDetails = $oPluginRegistry->getPluginDetails ( $sClassName . '.php' );
- $oPluginRegistry->disablePlugin ( $oDetails->sNamespace );
- file_put_contents ( PATH_DATA_SITE . 'plugin.singleton', $oPluginRegistry->serializeInstance () );
+ $oPluginRegistry->disablePlugin ( $oDetails->getNamespace() );
+ $oPluginRegistry->savePlugin($oDetails->getNamespace());
}
unlink(PATH_PLUGINS . 'enterprise/data/data');
}
//Enable
- $oPluginRegistry = &PMPluginRegistry::getSingleton();
+ $oPluginRegistry = PluginRegistry::loadSingleton();
$aPlugins = unserialize(trim(file_get_contents(PATH_PLUGINS . "enterprise/data/default")));
foreach ($aPlugins as $aPlugin) {
@@ -154,8 +157,8 @@ class pmLicenseManager
$sClassName = substr($aPlugin["sFilename"], 0, strpos($aPlugin["sFilename"], "-"));
require_once (PATH_PLUGINS . $sClassName . ".php");
$oDetails = $oPluginRegistry->getPluginDetails($sClassName . ".php");
- $oPluginRegistry->enablePlugin($oDetails->sNamespace);
- file_put_contents ( PATH_DATA_SITE . 'plugin.singleton', $oPluginRegistry->serializeInstance () );
+ $oPluginRegistry->enablePlugin($oDetails->getNamespace());
+ $oPluginRegistry->savePlugin($oDetails->getNamespace());
}
}
@@ -168,9 +171,9 @@ class pmLicenseManager
if (file_exists(PATH_PLUGINS . $sClassName . '.php')) {
require_once PATH_PLUGINS . $sClassName . '.php';
$oDetails = $oPluginRegistry->getPluginDetails ( $sClassName . '.php' );
- $oPluginRegistry->disablePlugin ( $oDetails->sNamespace );
- file_put_contents ( PATH_DATA_SITE . 'plugin.singleton', $oPluginRegistry->serializeInstance () );
- $aDenied[]=$oDetails->sNamespace;
+ $oPluginRegistry->disablePlugin($oDetails->getNamespace());
+ $oPluginRegistry->savePlugin($oDetails->getNamespace());
+ $aDenied[]=$oDetails->getNamespace();
}
}
}
@@ -182,7 +185,7 @@ class pmLicenseManager
}
} else {
//Disable
- $oPluginRegistry = & PMPluginRegistry::getSingleton ();
+ $oPluginRegistry = PluginRegistry::loadSingleton();
$aPlugins = unserialize ( trim ( file_get_contents ( PATH_PLUGINS . 'enterprise/data/default' ) ) );
foreach ($aPlugins as $aPlugin) {
$sClassName = substr ( $aPlugin ['sFilename'], 0, strpos ( $aPlugin ['sFilename'], '-' ) );
@@ -190,13 +193,14 @@ class pmLicenseManager
if (($sClassName != "pmLicenseManager") && ($sClassName != "pmTrial") && ($sClassName != "enterprise")) {
require_once PATH_PLUGINS . $sClassName . '.php';
$oDetails = $oPluginRegistry->getPluginDetails ( $sClassName . '.php' );
- $oPluginRegistry->disablePlugin ( $oDetails->sNamespace );
+ $oPluginRegistry->disablePlugin($oDetails->getNamespace());
} else {
//Enable default and required plugins
require_once PATH_PLUGINS . $sClassName . '.php';
$oDetails = $oPluginRegistry->getPluginDetails ( $sClassName . '.php' );
- $oPluginRegistry->enablePlugin ( $oDetails->sNamespace );
+ $oPluginRegistry->enablePlugin($oDetails->getNamespace());
}
+ $oPluginRegistry->savePlugin($oDetails->getNamespace());
}
if (file_exists(PATH_DATA_SITE.'ee')) {
@@ -210,12 +214,12 @@ class pmLicenseManager
}
$oDetails = $oPluginRegistry->getPluginDetails ( $sClassName . '.php' );
if ($oDetails) {
- $oPluginRegistry->disablePlugin ( $oDetails->sNamespace );
+ $oPluginRegistry->disablePlugin($oDetails->getNamespace());
+ $oPluginRegistry->savePlugin($oDetails->getNamespace());
}
}
}
}
- file_put_contents ( PATH_DATA_SITE . 'plugin.singleton', $oPluginRegistry->serializeInstance () );
}
}
}
diff --git a/workflow/engine/classes/class.pmScript.php b/workflow/engine/classes/class.pmScript.php
index 2d9f2811e..31d6b2e20 100644
--- a/workflow/engine/classes/class.pmScript.php
+++ b/workflow/engine/classes/class.pmScript.php
@@ -33,6 +33,7 @@
// License: LGPL, see LICENSE
////////////////////////////////////////////////////
+use ProcessMaker\Plugins\PluginRegistry;
/**
* PMScript - PMScript class
@@ -59,7 +60,7 @@ if (defined('SYS_SYS') && (!defined('PATH_DATA_SITE') || !defined('PATH_WORKSPAC
//call plugin
if (class_exists( 'folderData' )) {
//$folderData = new folderData($sProUid, $proFields['PRO_TITLE'], $sAppUid, $Fields['APP_TITLE'], $sUsrUid);
- $oPluginRegistry = &PMPluginRegistry::getSingleton();
+ $oPluginRegistry = PluginRegistry::loadSingleton();
$aAvailablePmFunctions = $oPluginRegistry->getPmFunctions();
foreach ($aAvailablePmFunctions as $key => $class) {
$filePlugin = PATH_PLUGINS . $class . PATH_SEP . 'classes' . PATH_SEP . 'class.pmFunctions.php';
diff --git a/workflow/engine/classes/class.processMap.php b/workflow/engine/classes/class.processMap.php
new file mode 100644
index 000000000..e69de29bb
diff --git a/workflow/engine/classes/class.propelTable.php b/workflow/engine/classes/class.propelTable.php
index 5da42ff76..2dae0fa68 100644
--- a/workflow/engine/classes/class.propelTable.php
+++ b/workflow/engine/classes/class.propelTable.php
@@ -25,6 +25,8 @@
*
*/
+use ProcessMaker\Plugins\PluginRegistry;
+
/**
* Class pagedTable
*
@@ -581,7 +583,7 @@ class propelTable
$time = $time_end - $time_start;
// verify if there are templates folders registered, template and method folders are the same
$folderTemplate = explode( '/', $this->template );
- $oPluginRegistry = & PMPluginRegistry::getSingleton();
+ $oPluginRegistry = PluginRegistry::loadSingleton();
if ($oPluginRegistry->isRegisteredFolder( $folderTemplate[0] )) {
$templateFile = PATH_PLUGINS . $this->template . '.html';
} else {
diff --git a/workflow/engine/classes/class.triggerLibrary.php b/workflow/engine/classes/class.triggerLibrary.php
index 32a89d9eb..506b906be 100644
--- a/workflow/engine/classes/class.triggerLibrary.php
+++ b/workflow/engine/classes/class.triggerLibrary.php
@@ -6,7 +6,7 @@
* This class Helps registering and implementing Wizard for Triggers
*/
-
+use ProcessMaker\Plugins\PluginRegistry;
/**
*
@@ -33,7 +33,7 @@ class triggerLibrary
//Register all registered PLugin Functions
if (class_exists( 'folderData' )) {
//$folderData = new folderData($sProUid, $proFields['PRO_TITLE'], $sAppUid, $Fields['APP_TITLE'], $sUsrUid);
- $oPluginRegistry = &PMPluginRegistry::getSingleton();
+ $oPluginRegistry = PluginRegistry::loadSingleton();
$aAvailablePmFunctions = $oPluginRegistry->getPmFunctions();
$oPluginRegistry->setupPlugins(); //Get and setup enabled plugins
foreach ($aAvailablePmFunctions as $key => $class) {
diff --git a/workflow/engine/classes/class.wsTools.php b/workflow/engine/classes/class.wsTools.php
index 406cfc79e..2f52233d2 100644
--- a/workflow/engine/classes/class.wsTools.php
+++ b/workflow/engine/classes/class.wsTools.php
@@ -6,6 +6,8 @@
* @author Alexandre Rosenfeld
*/
+use ProcessMaker\Plugins\Adapters\PluginAdapter;
+
/**
* class workspaceTools
*
@@ -1892,8 +1894,6 @@ class workspaceTools
}
if ($swv == 1) {
-
-
//Extract
$tar = new Archive_Tar($f);
@@ -2862,7 +2862,6 @@ class workspaceTools
public function checkRbacPermissions(){
CLI::logging("-> Verifying roles permissions in RBAC \n");
//Update table RBAC permissions
-
$RBAC = &RBAC::getSingleton();
$RBAC->initRBAC();
$result = $RBAC->verifyPermissions();
@@ -3887,15 +3886,15 @@ class workspaceTools
if (!$bExist = $conf->exists('MIGRATED_PLUGIN', 'singleton')) {
$pathSingleton = PATH_DATA . 'sites' . PATH_SEP . $workspace . PATH_SEP . 'plugin.singleton';
$oPluginRegistry = unserialize(file_get_contents($pathSingleton));
- $pluginAdapter = new \ProcessMaker\Plugins\Adapters\PluginAdapter();
- $pluginAdapter->save($oPluginRegistry);
- $data["CFG_UID"] = 'MIGRATED_PLUGIN';
- $data["OBJ_UID"] = 'singleton';
- $data["CFG_VALUE"] = 'true';
- $data["PRO_UID"] = '';
- $data["USR_UID"] = '';
- $data["APP_UID"] = '';
- $conf->create($data);
+ $pluginAdapter = new PluginAdapter();
+ $pluginAdapter->migrate($oPluginRegistry);
+// $data["CFG_UID"] = 'MIGRATED_PLUGIN';
+// $data["OBJ_UID"] = 'singleton';
+// $data["CFG_VALUE"] = 'true';
+// $data["PRO_UID"] = '';
+// $data["USR_UID"] = '';
+// $data["APP_UID"] = '';
+// $conf->create($data);
}
}
}
diff --git a/workflow/engine/classes/model/AddonsManager.php b/workflow/engine/classes/model/AddonsManager.php
index 709b009a6..85a34f5ef 100644
--- a/workflow/engine/classes/model/AddonsManager.php
+++ b/workflow/engine/classes/model/AddonsManager.php
@@ -1,4 +1,7 @@
isInstalled()) {
return false;
}
- $oPluginRegistry = &PMPluginRegistry::getSingleton();
- $status = $oPluginRegistry->getStatusPlugin($this->getAddonName());
- return (strcmp($status, "enabled") == 0);
+ $oPluginRegistry = PluginRegistry::loadSingleton();
+ return $oPluginRegistry->isEnable($this->getAddonName());
} else {
throw new Exception("Addon type '{$this->getAddonType()}' unsupported");
}
@@ -130,7 +132,7 @@ class AddonsManager extends BaseAddonsManager
return false;
}
- $oPluginRegistry = &PMPluginRegistry::getSingleton();
+ $oPluginRegistry = PluginRegistry::loadSingleton();
$filter = new InputFilter();
@@ -139,17 +141,12 @@ class AddonsManager extends BaseAddonsManager
require_once ($requiredPath);
if ($enable) {
- //$oDetails = $oPluginRegistry->getPluginDetails($this->getAddonName());
- //$oPluginRegistry->enablePlugin($oDetails->sNamespace);
- //require_once (PATH_PLUGINS . $this->getAddonName() . ".php"); //ok
$oPluginRegistry->enablePlugin($this->getAddonName());
$oPluginRegistry->setupPlugins(); //get and setup enabled plugins
} else {
- //$oDetails = $oPluginRegistry->getPluginDetails($this->getAddonName());
- //$oPluginRegistry->disablePlugin($oDetails->sNamespace);
$oPluginRegistry->disablePlugin($this->getAddonName());
}
- $oPluginRegistry->pluginAdapter->savePlugin($this->getAddonName(), $oPluginRegistry);
+ $oPluginRegistry->savePlugin($this->getAddonName());
return true;
}
@@ -168,9 +165,9 @@ class AddonsManager extends BaseAddonsManager
return (null);
}
- $oPluginRegistry = &PMPluginRegistry::getSingleton();
+ $oPluginRegistry = PluginRegistry::loadSingleton();
$details = $oPluginRegistry->getPluginDetails($this->getAddonName() . ".php");
- $v = (!($details == null))? $details->iVersion : null;
+ $v = (!($details == null))? $details->getVersion() : null;
if ($v != "") {
return ($v);
@@ -385,7 +382,7 @@ class AddonsManager extends BaseAddonsManager
$_SESSION["__ENTERPRISE_INSTALL__"] = 1;
}
- $oPluginRegistry = &ProcessMaker\Plugins\PluginsRegistry::loadSingleton();
+ $oPluginRegistry = PluginRegistry::loadSingleton();
$oPluginRegistry->installPluginArchive($filename, $this->getAddonName());
$this->setState();
@@ -408,7 +405,7 @@ class AddonsManager extends BaseAddonsManager
return false;
}
- $oPluginRegistry = &PMPluginRegistry::getSingleton();
+ $oPluginRegistry = PluginRegistry::loadSingleton();
$oPluginRegistry->uninstallPlugin($this->getAddonName());
return true;
diff --git a/workflow/engine/classes/model/AddonsStore.php b/workflow/engine/classes/model/AddonsStore.php
index bab75fa2e..1c482f765 100644
--- a/workflow/engine/classes/model/AddonsStore.php
+++ b/workflow/engine/classes/model/AddonsStore.php
@@ -1,4 +1,7 @@
getPluginDetails($sClassName . '.php');
if ($oDetails) {
- $sStatus = $oDetails->enabled ? G::LoadTranslation('ID_ENABLED') : G::LoadTranslation('ID_DISABLED');
+ $sStatus = $oDetails->isEnabled() ? G::LoadTranslation('ID_ENABLED') : G::LoadTranslation('ID_DISABLED');
- if (isset($oDetails->aWorkspaces)) {
- if (!in_array(SYS_SYS, $oDetails->aWorkspaces)) {
+ if ($oDetails->getWorkspaces()) {
+ if (!in_array(SYS_SYS, $oDetails->getWorkspaces())) {
continue;
}
}
@@ -380,16 +383,16 @@ class AddonsStore extends BaseAddonsStore
continue;
}
- $sEdit = (($oDetails->sSetupPage != '') && ($oDetails->enabled)? G::LoadTranslation('ID_SETUP') : ' ');
+ $sEdit = (($oDetails->getSetupPage() != '') && ($oDetails->isEnabled())? G::LoadTranslation('ID_SETUP') : ' ');
$aPlugin = array();
$aPluginId = $sClassName;
- $aPluginTitle = $oDetails->sFriendlyName;
- $aPluginDescription = $oDetails->sDescription;
- $aPluginVersion = $oDetails->iVersion;
+ $aPluginTitle = $oDetails->getFriendlyName();
+ $aPluginDescription = $oDetails->getDescription();
+ $aPluginVersion = $oDetails->getVersion();
if (@in_array($sClassName, $pmLicenseManagerO->features)) {
$aPluginStatus = $sStatus;
- $aPluginLinkStatus = 'pluginsChange?id=' . $sClassName . '.php&status=' . $oDetails->enabled;
+ $aPluginLinkStatus = 'pluginsChange?id=' . $sClassName . '.php&status=' . $oDetails->isEnabled();
$aPluginEdit = $sEdit;
$aPluginLinkEdit = 'pluginsSetup?id=' . $sClassName . '.php';
$aPluginStatusA = $sStatus == "Enabled" ? "installed" : 'disabled';
diff --git a/workflow/engine/classes/model/AppDelegation.php b/workflow/engine/classes/model/AppDelegation.php
index 0130d0adc..349d625ea 100644
--- a/workflow/engine/classes/model/AppDelegation.php
+++ b/workflow/engine/classes/model/AppDelegation.php
@@ -292,7 +292,7 @@ class AppDelegation extends BaseAppDelegation
}
if ($flagActionsByEmail) {
- $oPluginRegistry = &PMPluginRegistry::getSingleton();
+ $oPluginRegistry = PluginRegistry::loadSingleton();
$oPluginRegistry->executeTriggers(PM_CREATE_NEW_DELEGATION, $data);
}
}
diff --git a/workflow/engine/classes/model/AppFolder.php b/workflow/engine/classes/model/AppFolder.php
index 8bf09e6cd..af60b9012 100644
--- a/workflow/engine/classes/model/AppFolder.php
+++ b/workflow/engine/classes/model/AppFolder.php
@@ -7,6 +7,7 @@
//require_once 'classes/model/om/BaseAppFolder.php';
//require_once 'classes/model/Application.php';
+use ProcessMaker\Plugins\PluginRegistry;
/**
* Skeleton subclass for representing a row from the 'APP_FOLDER' table.
@@ -724,7 +725,7 @@ class AppFolder extends BaseAppFolder
}
if (! empty( $row1["APP_DOC_PLUGIN"] )) {
- $pluginRegistry = &PMPluginRegistry::getSingleton();
+ $pluginRegistry = PluginRegistry::loadSingleton();
$pluginName = $row1["APP_DOC_PLUGIN"];
$fieldValue = "";
@@ -732,7 +733,7 @@ class AppFolder extends BaseAppFolder
$pluginDetail = $pluginRegistry->getPluginDetails( $pluginName . ".php" );
if ($pluginDetail) {
- if ($pluginDetail->enabled) {
+ if ($pluginDetail->isEnabled()) {
require_once (PATH_PLUGINS . $pluginName . ".php");
$pluginNameClass = $pluginName . "Plugin";
$objPluginClass = new $pluginNameClass( $pluginName );
diff --git a/workflow/engine/classes/model/CaseScheduler.php b/workflow/engine/classes/model/CaseScheduler.php
index ac84e1451..bff5804f3 100644
--- a/workflow/engine/classes/model/CaseScheduler.php
+++ b/workflow/engine/classes/model/CaseScheduler.php
@@ -9,6 +9,7 @@
//require_once 'classes/model/Process.php';
//require_once 'classes/model/Task.php';
+use ProcessMaker\Plugins\PluginRegistry;
/**
* Skeleton subclass for representing a row from the 'CASE_SCHEDULER' table.
@@ -448,6 +449,8 @@ class CaseScheduler extends BaseCaseScheduler
$params = array("sessionId" => $sessionId, "processId" => $processId, "taskId" => $taskId, "variables" => array());
+ //Here we are loading all plugins registered
+ $oPluginRegistry = PluginRegistry::loadSingleton();
//If this Job was was registered to be performed by a plugin
if (isset($row["CASE_SH_PLUGIN_UID"]) && $row["CASE_SH_PLUGIN_UID"] != "") {
//Check if the plugin is active
@@ -455,18 +458,7 @@ class CaseScheduler extends BaseCaseScheduler
if (count($pluginParts) == 2) {
- //Here we are loading all plugins registered
- //The singleton has a list of enabled plugins
- $sSerializedFile = PATH_DATA_SITE . "plugin.singleton";
- $oPluginRegistry = &PMPluginRegistry::getSingleton();
-
- if (file_exists($sSerializedFile)) {
- $oPluginRegistry->unSerializeInstance(file_get_contents($sSerializedFile));
- }
-
- $oPluginRegistry = &PMPluginRegistry::getSingleton();
$activePluginsForCaseScheduler = $oPluginRegistry->getCaseSchedulerPlugins();
-
foreach ($activePluginsForCaseScheduler as $key => $caseSchedulerPlugin) {
if (isset($caseSchedulerPlugin->sNamespace) && $caseSchedulerPlugin->sNamespace == $pluginParts[0] && isset($caseSchedulerPlugin->sActionId) && $caseSchedulerPlugin->sActionId == $pluginParts[1]) {
$caseSchedulerSelected = $caseSchedulerPlugin;
@@ -498,8 +490,6 @@ class CaseScheduler extends BaseCaseScheduler
$paramsAux = $params;
$paramsAux["executeTriggers"] = 1;
- $oPluginRegistry = &PMPluginRegistry::getSingleton();
-
if ($oPluginRegistry->existsTrigger(PM_SCHEDULER_CREATE_CASE_BEFORE)) {
$oPluginRegistry->executeTriggers(PM_SCHEDULER_CREATE_CASE_BEFORE, $paramsAux);
}
diff --git a/workflow/engine/classes/model/PluginsRegistry.php b/workflow/engine/classes/model/PluginsRegistry.php
index 37699243e..cf3c2fbdd 100644
--- a/workflow/engine/classes/model/PluginsRegistry.php
+++ b/workflow/engine/classes/model/PluginsRegistry.php
@@ -17,23 +17,44 @@ require_once 'classes/model/om/BasePluginsRegistry.php';
class PluginsRegistry extends BasePluginsRegistry
{
/**
+ * Load all Plugins
+ * @param string $keyType
* @return array
- * @throws Exception
+ * @throws \Exception
*/
- public static function loadPlugins()
+ public static function loadPlugins($keyType = BasePeer::TYPE_FIELDNAME)
{
- $oCriteria = new Criteria();
- $oDataset = PluginsRegistryPeer::doSelectRS($oCriteria);
- $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
- $rows = array();
- while ($oDataset->next()) {
- $rows[] = $oDataset->getRow();
+ $criteria = new Criteria();
+ $dataSet = PluginsRegistryPeer::doSelect($criteria);
+ $plugins = [];
+ /** @var PluginsRegistry $row */
+ foreach ($dataSet as $row) {
+ $plugins[] = $row->toArray($keyType);
}
- return $rows;
+ return $plugins;
}
/**
- * @param $prUid
+ * Get all Plugins Enabled
+ * @param string $keyType
+ * @return array
+ */
+ public static function getPluginsEnabled($keyType = BasePeer::TYPE_FIELDNAME)
+ {
+ $criteria = new Criteria();
+ $criteria->add(PluginsRegistryPeer::PLUGIN_ENABLE, true);
+ $dataSet = PluginsRegistryPeer::doSelect($criteria);
+ $plugins = [];
+ /** @var PluginsRegistry $row */
+ foreach ($dataSet as $row) {
+ $plugins[] = $row->toArray($keyType);
+ }
+ return $plugins;
+ }
+
+ /**
+ * Load plugin with Uid
+ * @param string $prUid
* @return array
* @throws Exception
*/
@@ -50,6 +71,7 @@ class PluginsRegistry extends BasePluginsRegistry
}
/**
+ * Check if there is a plugin uid
* @param $prUid
* @return mixed|bool
*/
@@ -64,11 +86,14 @@ class PluginsRegistry extends BasePluginsRegistry
}
/**
- * @param $prUid
+ * Load or creates if the record does not exist
+ * Load and makes a union with the data sent
+ *
+ * @param string $prUid
* @param array $pluginData
- * @return mixed|array|bool
+ * @return array
*/
- public static function loadOrCreateIfNotExists($prUid, $pluginData = array())
+ public static function loadOrCreateIfNotExists($prUid, $pluginData = [])
{
if (!self::exists($prUid)) {
$pluginData['PR_UID'] = $prUid;
@@ -135,4 +160,64 @@ class PluginsRegistry extends BasePluginsRegistry
throw ($oError);
}
}
+
+ public static function enable($Namespace)
+ {
+ $oConnection = Propel::getConnection(PluginsRegistryPeer::DATABASE_NAME);
+ try {
+ $oPluginsRegistry = PluginsRegistryPeer::retrieveByPK(md5($Namespace));
+ if ($oPluginsRegistry) {
+ $oPluginsRegistry->fromArray(['PLUGIN_ENABLE' => true], BasePeer::TYPE_FIELDNAME);
+ if ($oPluginsRegistry->validate()) {
+ $oConnection->begin();
+ $iResult = $oPluginsRegistry->save();
+ $oConnection->commit();
+ return $iResult;
+ } else {
+ $sMessage = '';
+ $aValidationFailures = $oPluginsRegistry->getValidationFailures();
+ /** @var ValidationFailed $oValidationFailure */
+ foreach ($aValidationFailures as $oValidationFailure) {
+ $sMessage .= $oValidationFailure->getMessage() . '
';
+ }
+ throw (new Exception('The registry cannot be updated!
' . $sMessage));
+ }
+ } else {
+ throw (new Exception('This Plugin doesn\'t exist!'));
+ }
+ } catch (Exception $oError) {
+ $oConnection->rollback();
+ throw ($oError);
+ }
+ }
+
+ public static function disable($Namespace)
+ {
+ $oConnection = Propel::getConnection(PluginsRegistryPeer::DATABASE_NAME);
+ try {
+ $oPluginsRegistry = PluginsRegistryPeer::retrieveByPK(md5($Namespace));
+ if ($oPluginsRegistry) {
+ $oPluginsRegistry->fromArray(['PLUGIN_ENABLE' => false], BasePeer::TYPE_FIELDNAME);
+ if ($oPluginsRegistry->validate()) {
+ $oConnection->begin();
+ $iResult = $oPluginsRegistry->save();
+ $oConnection->commit();
+ return $iResult;
+ } else {
+ $sMessage = '';
+ $aValidationFailures = $oPluginsRegistry->getValidationFailures();
+ /** @var ValidationFailed $oValidationFailure */
+ foreach ($aValidationFailures as $oValidationFailure) {
+ $sMessage .= $oValidationFailure->getMessage() . '
';
+ }
+ throw (new Exception('The registry cannot be updated!
' . $sMessage));
+ }
+ } else {
+ throw (new Exception('This Plugin doesn\'t exist!'));
+ }
+ } catch (Exception $oError) {
+ $oConnection->rollback();
+ throw ($oError);
+ }
+ }
}
diff --git a/workflow/engine/classes/model/UsersProperties.php b/workflow/engine/classes/model/UsersProperties.php
index 91487e5cc..7065f5a8f 100644
--- a/workflow/engine/classes/model/UsersProperties.php
+++ b/workflow/engine/classes/model/UsersProperties.php
@@ -1,5 +1,7 @@
aUserInfo['PROCESSMAKER']['ROLE']['ROL_CODE'];
}
- $oPluginRegistry = &PMPluginRegistry::getSingleton();
+ $oPluginRegistry = PluginRegistry::loadSingleton();
$aRedirectLogin = $oPluginRegistry->getRedirectLogins();
if (isset( $aRedirectLogin ) && is_array( $aRedirectLogin )) {
foreach ($aRedirectLogin as $key => $detail) {
diff --git a/workflow/engine/classes/model/map/PluginsRegistryMapBuilder.php b/workflow/engine/classes/model/map/PluginsRegistryMapBuilder.php
index 2a8e2c1f0..69733f7a6 100644
--- a/workflow/engine/classes/model/map/PluginsRegistryMapBuilder.php
+++ b/workflow/engine/classes/model/map/PluginsRegistryMapBuilder.php
@@ -73,14 +73,20 @@ class PluginsRegistryMapBuilder
$tMap->addColumn('PLUGIN_DESCRIPTION', 'PluginDescription', 'string', CreoleTypes::VARCHAR, false, 200);
- $tMap->addColumn('CLASS_NAME', 'ClassName', 'string', CreoleTypes::VARCHAR, true, 100);
+ $tMap->addColumn('PLUGIN_CLASS_NAME', 'PluginClassName', 'string', CreoleTypes::VARCHAR, true, 100);
- $tMap->addColumn('FRIENDLY_NAME', 'FriendlyName', 'string', CreoleTypes::VARCHAR, false, 150);
+ $tMap->addColumn('PLUGIN_FRIENDLY_NAME', 'PluginFriendlyName', 'string', CreoleTypes::VARCHAR, false, 150);
- $tMap->addColumn('FILE_NAME', 'FileName', 'string', CreoleTypes::VARCHAR, true, 250);
+ $tMap->addColumn('PLUGIN_FILE', 'PluginFile', 'string', CreoleTypes::VARCHAR, true, 250);
$tMap->addColumn('PLUGIN_FOLDER', 'PluginFolder', 'string', CreoleTypes::VARCHAR, true, 100);
+ $tMap->addColumn('PLUGIN_SETUP_PAGE', 'PluginSetupPage', 'string', CreoleTypes::VARCHAR, false, 100);
+
+ $tMap->addColumn('PLUGIN_COMPANY_LOGO', 'PluginCompanyLogo', 'string', CreoleTypes::VARCHAR, false, 100);
+
+ $tMap->addColumn('PLUGIN_WORKSPACES', 'PluginWorkspaces', 'string', CreoleTypes::VARCHAR, false, 100);
+
$tMap->addColumn('PLUGIN_VERSION', 'PluginVersion', 'string', CreoleTypes::VARCHAR, false, 50);
$tMap->addColumn('PLUGIN_ENABLE', 'PluginEnable', 'boolean', CreoleTypes::BOOLEAN, false, null);
diff --git a/workflow/engine/classes/model/om/BasePluginsRegistry.php b/workflow/engine/classes/model/om/BasePluginsRegistry.php
index 263294137..40fdba1ca 100644
--- a/workflow/engine/classes/model/om/BasePluginsRegistry.php
+++ b/workflow/engine/classes/model/om/BasePluginsRegistry.php
@@ -52,22 +52,22 @@ abstract class BasePluginsRegistry extends BaseObject implements Persistent
protected $plugin_description = '';
/**
- * The value for the class_name field.
+ * The value for the plugin_class_name field.
* @var string
*/
- protected $class_name;
+ protected $plugin_class_name;
/**
- * The value for the friendly_name field.
+ * The value for the plugin_friendly_name field.
* @var string
*/
- protected $friendly_name = '';
+ protected $plugin_friendly_name = '';
/**
- * The value for the file_name field.
+ * The value for the plugin_file field.
* @var string
*/
- protected $file_name = '';
+ protected $plugin_file = '';
/**
* The value for the plugin_folder field.
@@ -75,6 +75,24 @@ abstract class BasePluginsRegistry extends BaseObject implements Persistent
*/
protected $plugin_folder = '';
+ /**
+ * The value for the plugin_setup_page field.
+ * @var string
+ */
+ protected $plugin_setup_page = '';
+
+ /**
+ * The value for the plugin_company_logo field.
+ * @var string
+ */
+ protected $plugin_company_logo = '';
+
+ /**
+ * The value for the plugin_workspaces field.
+ * @var string
+ */
+ protected $plugin_workspaces = '';
+
/**
* The value for the plugin_version field.
* @var string
@@ -212,36 +230,36 @@ abstract class BasePluginsRegistry extends BaseObject implements Persistent
}
/**
- * Get the [class_name] column value.
+ * Get the [plugin_class_name] column value.
*
* @return string
*/
- public function getClassName()
+ public function getPluginClassName()
{
- return $this->class_name;
+ return $this->plugin_class_name;
}
/**
- * Get the [friendly_name] column value.
+ * Get the [plugin_friendly_name] column value.
*
* @return string
*/
- public function getFriendlyName()
+ public function getPluginFriendlyName()
{
- return $this->friendly_name;
+ return $this->plugin_friendly_name;
}
/**
- * Get the [file_name] column value.
+ * Get the [plugin_file] column value.
*
* @return string
*/
- public function getFileName()
+ public function getPluginFile()
{
- return $this->file_name;
+ return $this->plugin_file;
}
/**
@@ -255,6 +273,39 @@ abstract class BasePluginsRegistry extends BaseObject implements Persistent
return $this->plugin_folder;
}
+ /**
+ * Get the [plugin_setup_page] column value.
+ *
+ * @return string
+ */
+ public function getPluginSetupPage()
+ {
+
+ return $this->plugin_setup_page;
+ }
+
+ /**
+ * Get the [plugin_company_logo] column value.
+ *
+ * @return string
+ */
+ public function getPluginCompanyLogo()
+ {
+
+ return $this->plugin_company_logo;
+ }
+
+ /**
+ * Get the [plugin_workspaces] column value.
+ *
+ * @return string
+ */
+ public function getPluginWorkspaces()
+ {
+
+ return $this->plugin_workspaces;
+ }
+
/**
* Get the [plugin_version] column value.
*
@@ -487,12 +538,12 @@ abstract class BasePluginsRegistry extends BaseObject implements Persistent
} // setPluginDescription()
/**
- * Set the value of [class_name] column.
+ * Set the value of [plugin_class_name] column.
*
* @param string $v new value
* @return void
*/
- public function setClassName($v)
+ public function setPluginClassName($v)
{
// Since the native PHP type for this column is string,
@@ -501,20 +552,20 @@ abstract class BasePluginsRegistry extends BaseObject implements Persistent
$v = (string) $v;
}
- if ($this->class_name !== $v) {
- $this->class_name = $v;
- $this->modifiedColumns[] = PluginsRegistryPeer::CLASS_NAME;
+ if ($this->plugin_class_name !== $v) {
+ $this->plugin_class_name = $v;
+ $this->modifiedColumns[] = PluginsRegistryPeer::PLUGIN_CLASS_NAME;
}
- } // setClassName()
+ } // setPluginClassName()
/**
- * Set the value of [friendly_name] column.
+ * Set the value of [plugin_friendly_name] column.
*
* @param string $v new value
* @return void
*/
- public function setFriendlyName($v)
+ public function setPluginFriendlyName($v)
{
// Since the native PHP type for this column is string,
@@ -523,20 +574,20 @@ abstract class BasePluginsRegistry extends BaseObject implements Persistent
$v = (string) $v;
}
- if ($this->friendly_name !== $v || $v === '') {
- $this->friendly_name = $v;
- $this->modifiedColumns[] = PluginsRegistryPeer::FRIENDLY_NAME;
+ if ($this->plugin_friendly_name !== $v || $v === '') {
+ $this->plugin_friendly_name = $v;
+ $this->modifiedColumns[] = PluginsRegistryPeer::PLUGIN_FRIENDLY_NAME;
}
- } // setFriendlyName()
+ } // setPluginFriendlyName()
/**
- * Set the value of [file_name] column.
+ * Set the value of [plugin_file] column.
*
* @param string $v new value
* @return void
*/
- public function setFileName($v)
+ public function setPluginFile($v)
{
// Since the native PHP type for this column is string,
@@ -545,12 +596,12 @@ abstract class BasePluginsRegistry extends BaseObject implements Persistent
$v = (string) $v;
}
- if ($this->file_name !== $v || $v === '') {
- $this->file_name = $v;
- $this->modifiedColumns[] = PluginsRegistryPeer::FILE_NAME;
+ if ($this->plugin_file !== $v || $v === '') {
+ $this->plugin_file = $v;
+ $this->modifiedColumns[] = PluginsRegistryPeer::PLUGIN_FILE;
}
- } // setFileName()
+ } // setPluginFile()
/**
* Set the value of [plugin_folder] column.
@@ -574,6 +625,72 @@ abstract class BasePluginsRegistry extends BaseObject implements Persistent
} // setPluginFolder()
+ /**
+ * Set the value of [plugin_setup_page] column.
+ *
+ * @param string $v new value
+ * @return void
+ */
+ public function setPluginSetupPage($v)
+ {
+
+ // Since the native PHP type for this column is string,
+ // we will cast the input to a string (if it is not).
+ if ($v !== null && !is_string($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->plugin_setup_page !== $v || $v === '') {
+ $this->plugin_setup_page = $v;
+ $this->modifiedColumns[] = PluginsRegistryPeer::PLUGIN_SETUP_PAGE;
+ }
+
+ } // setPluginSetupPage()
+
+ /**
+ * Set the value of [plugin_company_logo] column.
+ *
+ * @param string $v new value
+ * @return void
+ */
+ public function setPluginCompanyLogo($v)
+ {
+
+ // Since the native PHP type for this column is string,
+ // we will cast the input to a string (if it is not).
+ if ($v !== null && !is_string($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->plugin_company_logo !== $v || $v === '') {
+ $this->plugin_company_logo = $v;
+ $this->modifiedColumns[] = PluginsRegistryPeer::PLUGIN_COMPANY_LOGO;
+ }
+
+ } // setPluginCompanyLogo()
+
+ /**
+ * Set the value of [plugin_workspaces] column.
+ *
+ * @param string $v new value
+ * @return void
+ */
+ public function setPluginWorkspaces($v)
+ {
+
+ // Since the native PHP type for this column is string,
+ // we will cast the input to a string (if it is not).
+ if ($v !== null && !is_string($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->plugin_workspaces !== $v || $v === '') {
+ $this->plugin_workspaces = $v;
+ $this->modifiedColumns[] = PluginsRegistryPeer::PLUGIN_WORKSPACES;
+ }
+
+ } // setPluginWorkspaces()
+
/**
* Set the value of [plugin_version] column.
*
@@ -873,46 +990,52 @@ abstract class BasePluginsRegistry extends BaseObject implements Persistent
$this->plugin_description = $rs->getString($startcol + 3);
- $this->class_name = $rs->getString($startcol + 4);
+ $this->plugin_class_name = $rs->getString($startcol + 4);
- $this->friendly_name = $rs->getString($startcol + 5);
+ $this->plugin_friendly_name = $rs->getString($startcol + 5);
- $this->file_name = $rs->getString($startcol + 6);
+ $this->plugin_file = $rs->getString($startcol + 6);
$this->plugin_folder = $rs->getString($startcol + 7);
- $this->plugin_version = $rs->getString($startcol + 8);
+ $this->plugin_setup_page = $rs->getString($startcol + 8);
- $this->plugin_enable = $rs->getBoolean($startcol + 9);
+ $this->plugin_company_logo = $rs->getString($startcol + 9);
- $this->plugin_private = $rs->getBoolean($startcol + 10);
+ $this->plugin_workspaces = $rs->getString($startcol + 10);
- $this->plugin_menus = $rs->getString($startcol + 11);
+ $this->plugin_version = $rs->getString($startcol + 11);
- $this->plugin_folders = $rs->getString($startcol + 12);
+ $this->plugin_enable = $rs->getBoolean($startcol + 12);
- $this->plugin_triggers = $rs->getString($startcol + 13);
+ $this->plugin_private = $rs->getBoolean($startcol + 13);
- $this->plugin_pm_functions = $rs->getString($startcol + 14);
+ $this->plugin_menus = $rs->getString($startcol + 14);
- $this->plugin_redirect_login = $rs->getString($startcol + 15);
+ $this->plugin_folders = $rs->getString($startcol + 15);
- $this->plugin_steps = $rs->getString($startcol + 16);
+ $this->plugin_triggers = $rs->getString($startcol + 16);
- $this->plugin_css = $rs->getString($startcol + 17);
+ $this->plugin_pm_functions = $rs->getString($startcol + 17);
- $this->plugin_js = $rs->getString($startcol + 18);
+ $this->plugin_redirect_login = $rs->getString($startcol + 18);
- $this->plugin_rest_service = $rs->getString($startcol + 19);
+ $this->plugin_steps = $rs->getString($startcol + 19);
- $this->plugin_attributes = $rs->getString($startcol + 20);
+ $this->plugin_css = $rs->getString($startcol + 20);
+
+ $this->plugin_js = $rs->getString($startcol + 21);
+
+ $this->plugin_rest_service = $rs->getString($startcol + 22);
+
+ $this->plugin_attributes = $rs->getString($startcol + 23);
$this->resetModified();
$this->setNew(false);
// FIXME - using NUM_COLUMNS may be clearer.
- return $startcol + 21; // 21 = PluginsRegistryPeer::NUM_COLUMNS - PluginsRegistryPeer::NUM_LAZY_LOAD_COLUMNS).
+ return $startcol + 24; // 24 = PluginsRegistryPeer::NUM_COLUMNS - PluginsRegistryPeer::NUM_LAZY_LOAD_COLUMNS).
} catch (Exception $e) {
throw new PropelException("Error populating PluginsRegistry object", $e);
@@ -1129,54 +1252,63 @@ abstract class BasePluginsRegistry extends BaseObject implements Persistent
return $this->getPluginDescription();
break;
case 4:
- return $this->getClassName();
+ return $this->getPluginClassName();
break;
case 5:
- return $this->getFriendlyName();
+ return $this->getPluginFriendlyName();
break;
case 6:
- return $this->getFileName();
+ return $this->getPluginFile();
break;
case 7:
return $this->getPluginFolder();
break;
case 8:
- return $this->getPluginVersion();
+ return $this->getPluginSetupPage();
break;
case 9:
- return $this->getPluginEnable();
+ return $this->getPluginCompanyLogo();
break;
case 10:
- return $this->getPluginPrivate();
+ return $this->getPluginWorkspaces();
break;
case 11:
- return $this->getPluginMenus();
+ return $this->getPluginVersion();
break;
case 12:
- return $this->getPluginFolders();
+ return $this->getPluginEnable();
break;
case 13:
- return $this->getPluginTriggers();
+ return $this->getPluginPrivate();
break;
case 14:
- return $this->getPluginPmFunctions();
+ return $this->getPluginMenus();
break;
case 15:
- return $this->getPluginRedirectLogin();
+ return $this->getPluginFolders();
break;
case 16:
- return $this->getPluginSteps();
+ return $this->getPluginTriggers();
break;
case 17:
- return $this->getPluginCss();
+ return $this->getPluginPmFunctions();
break;
case 18:
- return $this->getPluginJs();
+ return $this->getPluginRedirectLogin();
break;
case 19:
- return $this->getPluginRestService();
+ return $this->getPluginSteps();
break;
case 20:
+ return $this->getPluginCss();
+ break;
+ case 21:
+ return $this->getPluginJs();
+ break;
+ case 22:
+ return $this->getPluginRestService();
+ break;
+ case 23:
return $this->getPluginAttributes();
break;
default:
@@ -1203,23 +1335,26 @@ abstract class BasePluginsRegistry extends BaseObject implements Persistent
$keys[1] => $this->getPrUid(),
$keys[2] => $this->getPluginNamespace(),
$keys[3] => $this->getPluginDescription(),
- $keys[4] => $this->getClassName(),
- $keys[5] => $this->getFriendlyName(),
- $keys[6] => $this->getFileName(),
+ $keys[4] => $this->getPluginClassName(),
+ $keys[5] => $this->getPluginFriendlyName(),
+ $keys[6] => $this->getPluginFile(),
$keys[7] => $this->getPluginFolder(),
- $keys[8] => $this->getPluginVersion(),
- $keys[9] => $this->getPluginEnable(),
- $keys[10] => $this->getPluginPrivate(),
- $keys[11] => $this->getPluginMenus(),
- $keys[12] => $this->getPluginFolders(),
- $keys[13] => $this->getPluginTriggers(),
- $keys[14] => $this->getPluginPmFunctions(),
- $keys[15] => $this->getPluginRedirectLogin(),
- $keys[16] => $this->getPluginSteps(),
- $keys[17] => $this->getPluginCss(),
- $keys[18] => $this->getPluginJs(),
- $keys[19] => $this->getPluginRestService(),
- $keys[20] => $this->getPluginAttributes(),
+ $keys[8] => $this->getPluginSetupPage(),
+ $keys[9] => $this->getPluginCompanyLogo(),
+ $keys[10] => $this->getPluginWorkspaces(),
+ $keys[11] => $this->getPluginVersion(),
+ $keys[12] => $this->getPluginEnable(),
+ $keys[13] => $this->getPluginPrivate(),
+ $keys[14] => $this->getPluginMenus(),
+ $keys[15] => $this->getPluginFolders(),
+ $keys[16] => $this->getPluginTriggers(),
+ $keys[17] => $this->getPluginPmFunctions(),
+ $keys[18] => $this->getPluginRedirectLogin(),
+ $keys[19] => $this->getPluginSteps(),
+ $keys[20] => $this->getPluginCss(),
+ $keys[21] => $this->getPluginJs(),
+ $keys[22] => $this->getPluginRestService(),
+ $keys[23] => $this->getPluginAttributes(),
);
return $result;
}
@@ -1264,54 +1399,63 @@ abstract class BasePluginsRegistry extends BaseObject implements Persistent
$this->setPluginDescription($value);
break;
case 4:
- $this->setClassName($value);
+ $this->setPluginClassName($value);
break;
case 5:
- $this->setFriendlyName($value);
+ $this->setPluginFriendlyName($value);
break;
case 6:
- $this->setFileName($value);
+ $this->setPluginFile($value);
break;
case 7:
$this->setPluginFolder($value);
break;
case 8:
- $this->setPluginVersion($value);
+ $this->setPluginSetupPage($value);
break;
case 9:
- $this->setPluginEnable($value);
+ $this->setPluginCompanyLogo($value);
break;
case 10:
- $this->setPluginPrivate($value);
+ $this->setPluginWorkspaces($value);
break;
case 11:
- $this->setPluginMenus($value);
+ $this->setPluginVersion($value);
break;
case 12:
- $this->setPluginFolders($value);
+ $this->setPluginEnable($value);
break;
case 13:
- $this->setPluginTriggers($value);
+ $this->setPluginPrivate($value);
break;
case 14:
- $this->setPluginPmFunctions($value);
+ $this->setPluginMenus($value);
break;
case 15:
- $this->setPluginRedirectLogin($value);
+ $this->setPluginFolders($value);
break;
case 16:
- $this->setPluginSteps($value);
+ $this->setPluginTriggers($value);
break;
case 17:
- $this->setPluginCss($value);
+ $this->setPluginPmFunctions($value);
break;
case 18:
- $this->setPluginJs($value);
+ $this->setPluginRedirectLogin($value);
break;
case 19:
- $this->setPluginRestService($value);
+ $this->setPluginSteps($value);
break;
case 20:
+ $this->setPluginCss($value);
+ break;
+ case 21:
+ $this->setPluginJs($value);
+ break;
+ case 22:
+ $this->setPluginRestService($value);
+ break;
+ case 23:
$this->setPluginAttributes($value);
break;
} // switch()
@@ -1354,15 +1498,15 @@ abstract class BasePluginsRegistry extends BaseObject implements Persistent
}
if (array_key_exists($keys[4], $arr)) {
- $this->setClassName($arr[$keys[4]]);
+ $this->setPluginClassName($arr[$keys[4]]);
}
if (array_key_exists($keys[5], $arr)) {
- $this->setFriendlyName($arr[$keys[5]]);
+ $this->setPluginFriendlyName($arr[$keys[5]]);
}
if (array_key_exists($keys[6], $arr)) {
- $this->setFileName($arr[$keys[6]]);
+ $this->setPluginFile($arr[$keys[6]]);
}
if (array_key_exists($keys[7], $arr)) {
@@ -1370,55 +1514,67 @@ abstract class BasePluginsRegistry extends BaseObject implements Persistent
}
if (array_key_exists($keys[8], $arr)) {
- $this->setPluginVersion($arr[$keys[8]]);
+ $this->setPluginSetupPage($arr[$keys[8]]);
}
if (array_key_exists($keys[9], $arr)) {
- $this->setPluginEnable($arr[$keys[9]]);
+ $this->setPluginCompanyLogo($arr[$keys[9]]);
}
if (array_key_exists($keys[10], $arr)) {
- $this->setPluginPrivate($arr[$keys[10]]);
+ $this->setPluginWorkspaces($arr[$keys[10]]);
}
if (array_key_exists($keys[11], $arr)) {
- $this->setPluginMenus($arr[$keys[11]]);
+ $this->setPluginVersion($arr[$keys[11]]);
}
if (array_key_exists($keys[12], $arr)) {
- $this->setPluginFolders($arr[$keys[12]]);
+ $this->setPluginEnable($arr[$keys[12]]);
}
if (array_key_exists($keys[13], $arr)) {
- $this->setPluginTriggers($arr[$keys[13]]);
+ $this->setPluginPrivate($arr[$keys[13]]);
}
if (array_key_exists($keys[14], $arr)) {
- $this->setPluginPmFunctions($arr[$keys[14]]);
+ $this->setPluginMenus($arr[$keys[14]]);
}
if (array_key_exists($keys[15], $arr)) {
- $this->setPluginRedirectLogin($arr[$keys[15]]);
+ $this->setPluginFolders($arr[$keys[15]]);
}
if (array_key_exists($keys[16], $arr)) {
- $this->setPluginSteps($arr[$keys[16]]);
+ $this->setPluginTriggers($arr[$keys[16]]);
}
if (array_key_exists($keys[17], $arr)) {
- $this->setPluginCss($arr[$keys[17]]);
+ $this->setPluginPmFunctions($arr[$keys[17]]);
}
if (array_key_exists($keys[18], $arr)) {
- $this->setPluginJs($arr[$keys[18]]);
+ $this->setPluginRedirectLogin($arr[$keys[18]]);
}
if (array_key_exists($keys[19], $arr)) {
- $this->setPluginRestService($arr[$keys[19]]);
+ $this->setPluginSteps($arr[$keys[19]]);
}
if (array_key_exists($keys[20], $arr)) {
- $this->setPluginAttributes($arr[$keys[20]]);
+ $this->setPluginCss($arr[$keys[20]]);
+ }
+
+ if (array_key_exists($keys[21], $arr)) {
+ $this->setPluginJs($arr[$keys[21]]);
+ }
+
+ if (array_key_exists($keys[22], $arr)) {
+ $this->setPluginRestService($arr[$keys[22]]);
+ }
+
+ if (array_key_exists($keys[23], $arr)) {
+ $this->setPluginAttributes($arr[$keys[23]]);
}
}
@@ -1448,22 +1604,34 @@ abstract class BasePluginsRegistry extends BaseObject implements Persistent
$criteria->add(PluginsRegistryPeer::PLUGIN_DESCRIPTION, $this->plugin_description);
}
- if ($this->isColumnModified(PluginsRegistryPeer::CLASS_NAME)) {
- $criteria->add(PluginsRegistryPeer::CLASS_NAME, $this->class_name);
+ if ($this->isColumnModified(PluginsRegistryPeer::PLUGIN_CLASS_NAME)) {
+ $criteria->add(PluginsRegistryPeer::PLUGIN_CLASS_NAME, $this->plugin_class_name);
}
- if ($this->isColumnModified(PluginsRegistryPeer::FRIENDLY_NAME)) {
- $criteria->add(PluginsRegistryPeer::FRIENDLY_NAME, $this->friendly_name);
+ if ($this->isColumnModified(PluginsRegistryPeer::PLUGIN_FRIENDLY_NAME)) {
+ $criteria->add(PluginsRegistryPeer::PLUGIN_FRIENDLY_NAME, $this->plugin_friendly_name);
}
- if ($this->isColumnModified(PluginsRegistryPeer::FILE_NAME)) {
- $criteria->add(PluginsRegistryPeer::FILE_NAME, $this->file_name);
+ if ($this->isColumnModified(PluginsRegistryPeer::PLUGIN_FILE)) {
+ $criteria->add(PluginsRegistryPeer::PLUGIN_FILE, $this->plugin_file);
}
if ($this->isColumnModified(PluginsRegistryPeer::PLUGIN_FOLDER)) {
$criteria->add(PluginsRegistryPeer::PLUGIN_FOLDER, $this->plugin_folder);
}
+ if ($this->isColumnModified(PluginsRegistryPeer::PLUGIN_SETUP_PAGE)) {
+ $criteria->add(PluginsRegistryPeer::PLUGIN_SETUP_PAGE, $this->plugin_setup_page);
+ }
+
+ if ($this->isColumnModified(PluginsRegistryPeer::PLUGIN_COMPANY_LOGO)) {
+ $criteria->add(PluginsRegistryPeer::PLUGIN_COMPANY_LOGO, $this->plugin_company_logo);
+ }
+
+ if ($this->isColumnModified(PluginsRegistryPeer::PLUGIN_WORKSPACES)) {
+ $criteria->add(PluginsRegistryPeer::PLUGIN_WORKSPACES, $this->plugin_workspaces);
+ }
+
if ($this->isColumnModified(PluginsRegistryPeer::PLUGIN_VERSION)) {
$criteria->add(PluginsRegistryPeer::PLUGIN_VERSION, $this->plugin_version);
}
@@ -1576,14 +1744,20 @@ abstract class BasePluginsRegistry extends BaseObject implements Persistent
$copyObj->setPluginDescription($this->plugin_description);
- $copyObj->setClassName($this->class_name);
+ $copyObj->setPluginClassName($this->plugin_class_name);
- $copyObj->setFriendlyName($this->friendly_name);
+ $copyObj->setPluginFriendlyName($this->plugin_friendly_name);
- $copyObj->setFileName($this->file_name);
+ $copyObj->setPluginFile($this->plugin_file);
$copyObj->setPluginFolder($this->plugin_folder);
+ $copyObj->setPluginSetupPage($this->plugin_setup_page);
+
+ $copyObj->setPluginCompanyLogo($this->plugin_company_logo);
+
+ $copyObj->setPluginWorkspaces($this->plugin_workspaces);
+
$copyObj->setPluginVersion($this->plugin_version);
$copyObj->setPluginEnable($this->plugin_enable);
diff --git a/workflow/engine/classes/model/om/BasePluginsRegistryPeer.php b/workflow/engine/classes/model/om/BasePluginsRegistryPeer.php
index ce93113f0..9623cb3cb 100644
--- a/workflow/engine/classes/model/om/BasePluginsRegistryPeer.php
+++ b/workflow/engine/classes/model/om/BasePluginsRegistryPeer.php
@@ -25,7 +25,7 @@ abstract class BasePluginsRegistryPeer
const CLASS_DEFAULT = 'classes.model.PluginsRegistry';
/** The total number of columns. */
- const NUM_COLUMNS = 21;
+ const NUM_COLUMNS = 24;
/** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0;
@@ -43,18 +43,27 @@ abstract class BasePluginsRegistryPeer
/** the column name for the PLUGIN_DESCRIPTION field */
const PLUGIN_DESCRIPTION = 'PLUGINS_REGISTRY.PLUGIN_DESCRIPTION';
- /** the column name for the CLASS_NAME field */
- const CLASS_NAME = 'PLUGINS_REGISTRY.CLASS_NAME';
+ /** the column name for the PLUGIN_CLASS_NAME field */
+ const PLUGIN_CLASS_NAME = 'PLUGINS_REGISTRY.PLUGIN_CLASS_NAME';
- /** the column name for the FRIENDLY_NAME field */
- const FRIENDLY_NAME = 'PLUGINS_REGISTRY.FRIENDLY_NAME';
+ /** the column name for the PLUGIN_FRIENDLY_NAME field */
+ const PLUGIN_FRIENDLY_NAME = 'PLUGINS_REGISTRY.PLUGIN_FRIENDLY_NAME';
- /** the column name for the FILE_NAME field */
- const FILE_NAME = 'PLUGINS_REGISTRY.FILE_NAME';
+ /** the column name for the PLUGIN_FILE field */
+ const PLUGIN_FILE = 'PLUGINS_REGISTRY.PLUGIN_FILE';
/** the column name for the PLUGIN_FOLDER field */
const PLUGIN_FOLDER = 'PLUGINS_REGISTRY.PLUGIN_FOLDER';
+ /** the column name for the PLUGIN_SETUP_PAGE field */
+ const PLUGIN_SETUP_PAGE = 'PLUGINS_REGISTRY.PLUGIN_SETUP_PAGE';
+
+ /** the column name for the PLUGIN_COMPANY_LOGO field */
+ const PLUGIN_COMPANY_LOGO = 'PLUGINS_REGISTRY.PLUGIN_COMPANY_LOGO';
+
+ /** the column name for the PLUGIN_WORKSPACES field */
+ const PLUGIN_WORKSPACES = 'PLUGINS_REGISTRY.PLUGIN_WORKSPACES';
+
/** the column name for the PLUGIN_VERSION field */
const PLUGIN_VERSION = 'PLUGINS_REGISTRY.PLUGIN_VERSION';
@@ -105,10 +114,10 @@ abstract class BasePluginsRegistryPeer
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
private static $fieldNames = array (
- BasePeer::TYPE_PHPNAME => array ('Id', 'PrUid', 'PluginNamespace', 'PluginDescription', 'ClassName', 'FriendlyName', 'FileName', 'PluginFolder', 'PluginVersion', 'PluginEnable', 'PluginPrivate', 'PluginMenus', 'PluginFolders', 'PluginTriggers', 'PluginPmFunctions', 'PluginRedirectLogin', 'PluginSteps', 'PluginCss', 'PluginJs', 'PluginRestService', 'PluginAttributes', ),
- BasePeer::TYPE_COLNAME => array (PluginsRegistryPeer::ID, PluginsRegistryPeer::PR_UID, PluginsRegistryPeer::PLUGIN_NAMESPACE, PluginsRegistryPeer::PLUGIN_DESCRIPTION, PluginsRegistryPeer::CLASS_NAME, PluginsRegistryPeer::FRIENDLY_NAME, PluginsRegistryPeer::FILE_NAME, PluginsRegistryPeer::PLUGIN_FOLDER, PluginsRegistryPeer::PLUGIN_VERSION, PluginsRegistryPeer::PLUGIN_ENABLE, PluginsRegistryPeer::PLUGIN_PRIVATE, PluginsRegistryPeer::PLUGIN_MENUS, PluginsRegistryPeer::PLUGIN_FOLDERS, PluginsRegistryPeer::PLUGIN_TRIGGERS, PluginsRegistryPeer::PLUGIN_PM_FUNCTIONS, PluginsRegistryPeer::PLUGIN_REDIRECT_LOGIN, PluginsRegistryPeer::PLUGIN_STEPS, PluginsRegistryPeer::PLUGIN_CSS, PluginsRegistryPeer::PLUGIN_JS, PluginsRegistryPeer::PLUGIN_REST_SERVICE, PluginsRegistryPeer::PLUGIN_ATTRIBUTES, ),
- BasePeer::TYPE_FIELDNAME => array ('ID', 'PR_UID', 'PLUGIN_NAMESPACE', 'PLUGIN_DESCRIPTION', 'CLASS_NAME', 'FRIENDLY_NAME', 'FILE_NAME', 'PLUGIN_FOLDER', 'PLUGIN_VERSION', 'PLUGIN_ENABLE', 'PLUGIN_PRIVATE', 'PLUGIN_MENUS', 'PLUGIN_FOLDERS', 'PLUGIN_TRIGGERS', 'PLUGIN_PM_FUNCTIONS', 'PLUGIN_REDIRECT_LOGIN', 'PLUGIN_STEPS', 'PLUGIN_CSS', 'PLUGIN_JS', 'PLUGIN_REST_SERVICE', 'PLUGIN_ATTRIBUTES', ),
- BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, )
+ BasePeer::TYPE_PHPNAME => array ('Id', 'PrUid', 'PluginNamespace', 'PluginDescription', 'PluginClassName', 'PluginFriendlyName', 'PluginFile', 'PluginFolder', 'PluginSetupPage', 'PluginCompanyLogo', 'PluginWorkspaces', 'PluginVersion', 'PluginEnable', 'PluginPrivate', 'PluginMenus', 'PluginFolders', 'PluginTriggers', 'PluginPmFunctions', 'PluginRedirectLogin', 'PluginSteps', 'PluginCss', 'PluginJs', 'PluginRestService', 'PluginAttributes', ),
+ BasePeer::TYPE_COLNAME => array (PluginsRegistryPeer::ID, PluginsRegistryPeer::PR_UID, PluginsRegistryPeer::PLUGIN_NAMESPACE, PluginsRegistryPeer::PLUGIN_DESCRIPTION, PluginsRegistryPeer::PLUGIN_CLASS_NAME, PluginsRegistryPeer::PLUGIN_FRIENDLY_NAME, PluginsRegistryPeer::PLUGIN_FILE, PluginsRegistryPeer::PLUGIN_FOLDER, PluginsRegistryPeer::PLUGIN_SETUP_PAGE, PluginsRegistryPeer::PLUGIN_COMPANY_LOGO, PluginsRegistryPeer::PLUGIN_WORKSPACES, PluginsRegistryPeer::PLUGIN_VERSION, PluginsRegistryPeer::PLUGIN_ENABLE, PluginsRegistryPeer::PLUGIN_PRIVATE, PluginsRegistryPeer::PLUGIN_MENUS, PluginsRegistryPeer::PLUGIN_FOLDERS, PluginsRegistryPeer::PLUGIN_TRIGGERS, PluginsRegistryPeer::PLUGIN_PM_FUNCTIONS, PluginsRegistryPeer::PLUGIN_REDIRECT_LOGIN, PluginsRegistryPeer::PLUGIN_STEPS, PluginsRegistryPeer::PLUGIN_CSS, PluginsRegistryPeer::PLUGIN_JS, PluginsRegistryPeer::PLUGIN_REST_SERVICE, PluginsRegistryPeer::PLUGIN_ATTRIBUTES, ),
+ BasePeer::TYPE_FIELDNAME => array ('ID', 'PR_UID', 'PLUGIN_NAMESPACE', 'PLUGIN_DESCRIPTION', 'PLUGIN_CLASS_NAME', 'PLUGIN_FRIENDLY_NAME', 'PLUGIN_FILE', 'PLUGIN_FOLDER', 'PLUGIN_SETUP_PAGE', 'PLUGIN_COMPANY_LOGO', 'PLUGIN_WORKSPACES', 'PLUGIN_VERSION', 'PLUGIN_ENABLE', 'PLUGIN_PRIVATE', 'PLUGIN_MENUS', 'PLUGIN_FOLDERS', 'PLUGIN_TRIGGERS', 'PLUGIN_PM_FUNCTIONS', 'PLUGIN_REDIRECT_LOGIN', 'PLUGIN_STEPS', 'PLUGIN_CSS', 'PLUGIN_JS', 'PLUGIN_REST_SERVICE', 'PLUGIN_ATTRIBUTES', ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, )
);
/**
@@ -118,10 +127,10 @@ abstract class BasePluginsRegistryPeer
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/
private static $fieldKeys = array (
- BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'PrUid' => 1, 'PluginNamespace' => 2, 'PluginDescription' => 3, 'ClassName' => 4, 'FriendlyName' => 5, 'FileName' => 6, 'PluginFolder' => 7, 'PluginVersion' => 8, 'PluginEnable' => 9, 'PluginPrivate' => 10, 'PluginMenus' => 11, 'PluginFolders' => 12, 'PluginTriggers' => 13, 'PluginPmFunctions' => 14, 'PluginRedirectLogin' => 15, 'PluginSteps' => 16, 'PluginCss' => 17, 'PluginJs' => 18, 'PluginRestService' => 19, 'PluginAttributes' => 20, ),
- BasePeer::TYPE_COLNAME => array (PluginsRegistryPeer::ID => 0, PluginsRegistryPeer::PR_UID => 1, PluginsRegistryPeer::PLUGIN_NAMESPACE => 2, PluginsRegistryPeer::PLUGIN_DESCRIPTION => 3, PluginsRegistryPeer::CLASS_NAME => 4, PluginsRegistryPeer::FRIENDLY_NAME => 5, PluginsRegistryPeer::FILE_NAME => 6, PluginsRegistryPeer::PLUGIN_FOLDER => 7, PluginsRegistryPeer::PLUGIN_VERSION => 8, PluginsRegistryPeer::PLUGIN_ENABLE => 9, PluginsRegistryPeer::PLUGIN_PRIVATE => 10, PluginsRegistryPeer::PLUGIN_MENUS => 11, PluginsRegistryPeer::PLUGIN_FOLDERS => 12, PluginsRegistryPeer::PLUGIN_TRIGGERS => 13, PluginsRegistryPeer::PLUGIN_PM_FUNCTIONS => 14, PluginsRegistryPeer::PLUGIN_REDIRECT_LOGIN => 15, PluginsRegistryPeer::PLUGIN_STEPS => 16, PluginsRegistryPeer::PLUGIN_CSS => 17, PluginsRegistryPeer::PLUGIN_JS => 18, PluginsRegistryPeer::PLUGIN_REST_SERVICE => 19, PluginsRegistryPeer::PLUGIN_ATTRIBUTES => 20, ),
- BasePeer::TYPE_FIELDNAME => array ('ID' => 0, 'PR_UID' => 1, 'PLUGIN_NAMESPACE' => 2, 'PLUGIN_DESCRIPTION' => 3, 'CLASS_NAME' => 4, 'FRIENDLY_NAME' => 5, 'FILE_NAME' => 6, 'PLUGIN_FOLDER' => 7, 'PLUGIN_VERSION' => 8, 'PLUGIN_ENABLE' => 9, 'PLUGIN_PRIVATE' => 10, 'PLUGIN_MENUS' => 11, 'PLUGIN_FOLDERS' => 12, 'PLUGIN_TRIGGERS' => 13, 'PLUGIN_PM_FUNCTIONS' => 14, 'PLUGIN_REDIRECT_LOGIN' => 15, 'PLUGIN_STEPS' => 16, 'PLUGIN_CSS' => 17, 'PLUGIN_JS' => 18, 'PLUGIN_REST_SERVICE' => 19, 'PLUGIN_ATTRIBUTES' => 20, ),
- BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, )
+ BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'PrUid' => 1, 'PluginNamespace' => 2, 'PluginDescription' => 3, 'PluginClassName' => 4, 'PluginFriendlyName' => 5, 'PluginFile' => 6, 'PluginFolder' => 7, 'PluginSetupPage' => 8, 'PluginCompanyLogo' => 9, 'PluginWorkspaces' => 10, 'PluginVersion' => 11, 'PluginEnable' => 12, 'PluginPrivate' => 13, 'PluginMenus' => 14, 'PluginFolders' => 15, 'PluginTriggers' => 16, 'PluginPmFunctions' => 17, 'PluginRedirectLogin' => 18, 'PluginSteps' => 19, 'PluginCss' => 20, 'PluginJs' => 21, 'PluginRestService' => 22, 'PluginAttributes' => 23, ),
+ BasePeer::TYPE_COLNAME => array (PluginsRegistryPeer::ID => 0, PluginsRegistryPeer::PR_UID => 1, PluginsRegistryPeer::PLUGIN_NAMESPACE => 2, PluginsRegistryPeer::PLUGIN_DESCRIPTION => 3, PluginsRegistryPeer::PLUGIN_CLASS_NAME => 4, PluginsRegistryPeer::PLUGIN_FRIENDLY_NAME => 5, PluginsRegistryPeer::PLUGIN_FILE => 6, PluginsRegistryPeer::PLUGIN_FOLDER => 7, PluginsRegistryPeer::PLUGIN_SETUP_PAGE => 8, PluginsRegistryPeer::PLUGIN_COMPANY_LOGO => 9, PluginsRegistryPeer::PLUGIN_WORKSPACES => 10, PluginsRegistryPeer::PLUGIN_VERSION => 11, PluginsRegistryPeer::PLUGIN_ENABLE => 12, PluginsRegistryPeer::PLUGIN_PRIVATE => 13, PluginsRegistryPeer::PLUGIN_MENUS => 14, PluginsRegistryPeer::PLUGIN_FOLDERS => 15, PluginsRegistryPeer::PLUGIN_TRIGGERS => 16, PluginsRegistryPeer::PLUGIN_PM_FUNCTIONS => 17, PluginsRegistryPeer::PLUGIN_REDIRECT_LOGIN => 18, PluginsRegistryPeer::PLUGIN_STEPS => 19, PluginsRegistryPeer::PLUGIN_CSS => 20, PluginsRegistryPeer::PLUGIN_JS => 21, PluginsRegistryPeer::PLUGIN_REST_SERVICE => 22, PluginsRegistryPeer::PLUGIN_ATTRIBUTES => 23, ),
+ BasePeer::TYPE_FIELDNAME => array ('ID' => 0, 'PR_UID' => 1, 'PLUGIN_NAMESPACE' => 2, 'PLUGIN_DESCRIPTION' => 3, 'PLUGIN_CLASS_NAME' => 4, 'PLUGIN_FRIENDLY_NAME' => 5, 'PLUGIN_FILE' => 6, 'PLUGIN_FOLDER' => 7, 'PLUGIN_SETUP_PAGE' => 8, 'PLUGIN_COMPANY_LOGO' => 9, 'PLUGIN_WORKSPACES' => 10, 'PLUGIN_VERSION' => 11, 'PLUGIN_ENABLE' => 12, 'PLUGIN_PRIVATE' => 13, 'PLUGIN_MENUS' => 14, 'PLUGIN_FOLDERS' => 15, 'PLUGIN_TRIGGERS' => 16, 'PLUGIN_PM_FUNCTIONS' => 17, 'PLUGIN_REDIRECT_LOGIN' => 18, 'PLUGIN_STEPS' => 19, 'PLUGIN_CSS' => 20, 'PLUGIN_JS' => 21, 'PLUGIN_REST_SERVICE' => 22, 'PLUGIN_ATTRIBUTES' => 23, ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, )
);
/**
@@ -230,14 +239,20 @@ abstract class BasePluginsRegistryPeer
$criteria->addSelectColumn(PluginsRegistryPeer::PLUGIN_DESCRIPTION);
- $criteria->addSelectColumn(PluginsRegistryPeer::CLASS_NAME);
+ $criteria->addSelectColumn(PluginsRegistryPeer::PLUGIN_CLASS_NAME);
- $criteria->addSelectColumn(PluginsRegistryPeer::FRIENDLY_NAME);
+ $criteria->addSelectColumn(PluginsRegistryPeer::PLUGIN_FRIENDLY_NAME);
- $criteria->addSelectColumn(PluginsRegistryPeer::FILE_NAME);
+ $criteria->addSelectColumn(PluginsRegistryPeer::PLUGIN_FILE);
$criteria->addSelectColumn(PluginsRegistryPeer::PLUGIN_FOLDER);
+ $criteria->addSelectColumn(PluginsRegistryPeer::PLUGIN_SETUP_PAGE);
+
+ $criteria->addSelectColumn(PluginsRegistryPeer::PLUGIN_COMPANY_LOGO);
+
+ $criteria->addSelectColumn(PluginsRegistryPeer::PLUGIN_WORKSPACES);
+
$criteria->addSelectColumn(PluginsRegistryPeer::PLUGIN_VERSION);
$criteria->addSelectColumn(PluginsRegistryPeer::PLUGIN_ENABLE);
diff --git a/workflow/engine/config/schema.xml b/workflow/engine/config/schema.xml
index 758b21bb1..7365e8009 100644
--- a/workflow/engine/config/schema.xml
+++ b/workflow/engine/config/schema.xml
@@ -5621,10 +5621,13 @@
-
-
-
+
+
+
+
+
+
diff --git a/workflow/engine/controllers/adminProxy.php b/workflow/engine/controllers/adminProxy.php
index 80744824e..17591826a 100644
--- a/workflow/engine/controllers/adminProxy.php
+++ b/workflow/engine/controllers/adminProxy.php
@@ -1,4 +1,7 @@
getPluginDetails( $sFileName . ".php" );
- $plugin['name'] = $addonDetails->sNamespace;
- $plugin['description'] = $addonDetails->sDescription;
- $plugin['version'] = $addonDetails->iVersion;
- $plugin['enable'] = $addonDetails->enabled;
+ $plugin['name'] = $addonDetails->getNamespace();
+ $plugin['description'] = $addonDetails->getDescription();
+ $plugin['version'] = $addonDetails->getVersion();
+ $plugin['enable'] = $addonDetails->isEnabled();
$plugins[] = $plugin;
}
}
diff --git a/workflow/engine/controllers/caseSchedulerProxy.php b/workflow/engine/controllers/caseSchedulerProxy.php
index b9593024b..0707cecfe 100644
--- a/workflow/engine/controllers/caseSchedulerProxy.php
+++ b/workflow/engine/controllers/caseSchedulerProxy.php
@@ -1,5 +1,7 @@
getCaseSchedulerPlugins();
-
- foreach ($activePluginsForCaseScheduler as $key => $caseSchedulerPluginDetail) {
- if (($caseSchedulerPluginDetail->sNamespace == $params[0]) && ($caseSchedulerPluginDetail->sActionId == $params[1])) {
+ /** @var \ProcessMaker\Plugins\Interfaces\CaseSchedulerPlugin $caseSchedulerPluginDetail */
+ foreach ($activePluginsForCaseScheduler as $caseSchedulerPluginDetail) {
+ if (($caseSchedulerPluginDetail->equalNamespaceTo($params[0])) && ($caseSchedulerPluginDetail->equalActionIdTo($params[1]))) {
$caseSchedulerSelected = $caseSchedulerPluginDetail;
}
}
@@ -519,7 +521,7 @@ class caseSchedulerProxy extends HttpProxyController
//Save the form
$oData = $_POST['pluginFields'];
$oData['SCH_UID'] = $aData['SCH_UID'];
- $oPluginRegistry->executeMethod( $caseSchedulerPluginDetail->sNamespace, $caseSchedulerPluginDetail->sActionSave, $oData );
+ $oPluginRegistry->executeMethod( $caseSchedulerPluginDetail->getNamespace(), $caseSchedulerPluginDetail->getActionSave(), $oData );
}
}
diff --git a/workflow/engine/controllers/designer.php b/workflow/engine/controllers/designer.php
index d4cfa409b..5b9b241da 100644
--- a/workflow/engine/controllers/designer.php
+++ b/workflow/engine/controllers/designer.php
@@ -1,5 +1,7 @@
getDesignerSourcePath();
- foreach ($srcPath as $key => $value) {
+ foreach ($srcPath as $value) {
$ext = pathinfo($value->pathFile, PATHINFO_EXTENSION);
if ($ext === "css") {
$sourceCss[] = $value->pathFile;
diff --git a/workflow/engine/controllers/main.php b/workflow/engine/controllers/main.php
index 82baf7927..4c5041ffe 100644
--- a/workflow/engine/controllers/main.php
+++ b/workflow/engine/controllers/main.php
@@ -1,5 +1,7 @@
memcache->delete( 'rbacSession' . session_id() );
} else {
// Execute SSO trigger
- $pluginRegistry = & PMPluginRegistry::getSingleton();
+ $pluginRegistry = PluginRegistry::loadSingleton();
if (defined( 'PM_SINGLE_SIGN_ON' )) {
if ($pluginRegistry->existsTrigger( PM_SINGLE_SIGN_ON )) {
if ($pluginRegistry->executeTriggers( PM_SINGLE_SIGN_ON, null )) {
@@ -473,7 +475,7 @@ class Main extends Controller
}
}
if (class_exists( 'PMPluginRegistry' )) {
- $oPluginRegistry = &PMPluginRegistry::getSingleton();
+ $oPluginRegistry = PluginRegistry::loadSingleton();
$logoPlugin = $oPluginRegistry->getCompanyLogo( $sCompanyLogo );
if ($logoPlugin != '/images/processmaker2.logo2.png') {
$sCompanyLogo = $logoPlugin;
diff --git a/workflow/engine/data/mysql/schema.sql b/workflow/engine/data/mysql/schema.sql
index adb0a9d44..2d12af100 100644
--- a/workflow/engine/data/mysql/schema.sql
+++ b/workflow/engine/data/mysql/schema.sql
@@ -3146,10 +3146,13 @@ CREATE TABLE `PLUGINS_REGISTRY`
`PR_UID` VARCHAR(32) default '' NOT NULL,
`PLUGIN_NAMESPACE` VARCHAR(100) NOT NULL,
`PLUGIN_DESCRIPTION` VARCHAR(200) default '',
- `CLASS_NAME` VARCHAR(100) NOT NULL,
- `FRIENDLY_NAME` VARCHAR(150) default '',
- `FILE_NAME` VARCHAR(250) default '' NOT NULL,
+ `PLUGIN_CLASS_NAME` VARCHAR(100) NOT NULL,
+ `PLUGIN_FRIENDLY_NAME` VARCHAR(150) default '',
+ `PLUGIN_FILE` VARCHAR(250) default '' NOT NULL,
`PLUGIN_FOLDER` VARCHAR(100) default '' NOT NULL,
+ `PLUGIN_SETUP_PAGE` VARCHAR(100) default '',
+ `PLUGIN_COMPANY_LOGO` VARCHAR(100) default '',
+ `PLUGIN_WORKSPACES` VARCHAR(100) default '',
`PLUGIN_VERSION` VARCHAR(50) default '',
`PLUGIN_ENABLE` INTEGER default 0,
`PLUGIN_PRIVATE` INTEGER default 0,
diff --git a/workflow/engine/menus/setup.php b/workflow/engine/menus/setup.php
index a9952367e..08da62041 100644
--- a/workflow/engine/menus/setup.php
+++ b/workflow/engine/menus/setup.php
@@ -22,6 +22,9 @@
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
+
+use ProcessMaker\Plugins\PluginRegistry;
+
global $G_TMP_MENU;
global $RBAC;
$partnerFlag = (defined('PARTNER_FLAG')) ? PARTNER_FLAG : false;
@@ -288,7 +291,7 @@ if ($RBAC->userCanAccess('PM_SETUP') == 1) {
}
/*----------------------------------********---------------------------------*/
-$pluginRegistry = &PMPluginRegistry::getSingleton(); //lsl
+$pluginRegistry = PluginRegistry::loadSingleton(); //lsl
$status = $pluginRegistry->getStatusPlugin('actionsByEmail');
if ((string)($status) !== 'enabled' &&
diff --git a/workflow/engine/methods/appFolder/appFolderAjax.php b/workflow/engine/methods/appFolder/appFolderAjax.php
index f95f32645..bdc88174b 100644
--- a/workflow/engine/methods/appFolder/appFolderAjax.php
+++ b/workflow/engine/methods/appFolder/appFolderAjax.php
@@ -1,5 +1,7 @@
xssFilterHard($_POST);
$_GET = $filter->xssFilterHard($_GET);
@@ -1623,7 +1625,7 @@ function uploadExternalDocument()
G::uploadFile($fileObj['tempName'], $sPathName, $sFileName); //upload
//Plugin Hook PM_UPLOAD_DOCUMENT for upload document
- $oPluginRegistry =& PMPluginRegistry::getSingleton();
+ $oPluginRegistry = PluginRegistry::loadSingleton();
if ($oPluginRegistry->existsTrigger (PM_UPLOAD_DOCUMENT) && class_exists ('uploadDocumentData')) {
$oData['APP_UID'] = $appId;
$documentData = new uploadDocumentData (
diff --git a/workflow/engine/methods/appFolder/appFolderSaveDocument.php b/workflow/engine/methods/appFolder/appFolderSaveDocument.php
index bdc73990a..9512932d0 100644
--- a/workflow/engine/methods/appFolder/appFolderSaveDocument.php
+++ b/workflow/engine/methods/appFolder/appFolderSaveDocument.php
@@ -23,6 +23,9 @@
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
+
+use ProcessMaker\Plugins\PluginRegistry;
+
try {
$docUid = $_POST['form']['DOC_UID'];
$appDocUid = $_POST['form']['APP_DOC_UID'];
@@ -124,7 +127,7 @@ try {
G::uploadFile($_FILES['form']['tmp_name']['APP_DOC_FILENAME'], $sPathName, $sFileName);
//Plugin Hook PM_UPLOAD_DOCUMENT for upload document
- $oPluginRegistry = & PMPluginRegistry::getSingleton();
+ $oPluginRegistry = PluginRegistry::loadSingleton();
if ($oPluginRegistry->existsTrigger(PM_UPLOAD_DOCUMENT) && class_exists('uploadDocumentData')) {
$oData['APP_UID'] = $appId;
diff --git a/workflow/engine/methods/authSources/authSources_Ajax.php b/workflow/engine/methods/authSources/authSources_Ajax.php
index 8e066e157..2c44d7fb8 100644
--- a/workflow/engine/methods/authSources/authSources_Ajax.php
+++ b/workflow/engine/methods/authSources/authSources_Ajax.php
@@ -21,6 +21,9 @@
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
+
+use ProcessMaker\Plugins\PluginRegistry;
+
try {
global $RBAC;
if ($RBAC->userCanAccess( 'PM_SETUP_ADVANCE' ) != 1) {
@@ -153,7 +156,7 @@ try {
}
break;
case 'authSourcesNew':
- $pluginRegistry = &PMPluginRegistry::getSingleton();
+ $pluginRegistry = PluginRegistry::loadSingleton();
$arr = Array ();
$oDirectory = dir( PATH_RBAC . 'plugins' . PATH_SEP );
diff --git a/workflow/engine/methods/cases/ajaxListener.php b/workflow/engine/methods/cases/ajaxListener.php
index 45624dc14..e5708129f 100644
--- a/workflow/engine/methods/cases/ajaxListener.php
+++ b/workflow/engine/methods/cases/ajaxListener.php
@@ -22,6 +22,8 @@
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
+use ProcessMaker\Plugins\PluginRegistry;
+
/**
*
* @author Erik Amaru Ortiz
@@ -1022,7 +1024,7 @@ class Ajax
}
}
-$pluginRegistry = & PMPluginRegistry::getSingleton();
+$pluginRegistry = PluginRegistry::loadSingleton();
if ($pluginRegistry->existsTrigger(PM_GET_CASES_AJAX_LISTENER)) {
$ajax = $pluginRegistry->executeTriggers(PM_GET_CASES_AJAX_LISTENER, null);
} else {
diff --git a/workflow/engine/methods/cases/casesListExtJs.php b/workflow/engine/methods/cases/casesListExtJs.php
index ae8cfc4eb..fe0cf9530 100644
--- a/workflow/engine/methods/cases/casesListExtJs.php
+++ b/workflow/engine/methods/cases/casesListExtJs.php
@@ -1,4 +1,7 @@
assign('extJsViewState', $oHeadPublisher->getExtJsViewState());
$oHeadPublisher->assign('isIE', Bootstrap::isIE());
$oHeadPublisher->assign('__OPEN_APPLICATION_UID__', $openApplicationUid);
-$oPluginRegistry =& PMPluginRegistry::getSingleton();
+$oPluginRegistry = PluginRegistry::loadSingleton();
$fromPlugin = $oPluginRegistry->getOpenReassignCallback();
$jsFunction = false;
if(sizeof($fromPlugin)) {
- foreach($fromPlugin as $key => $jsFile) {
- $jsFile = $jsFile->callBackFile;
+ /** @var \ProcessMaker\Plugins\Interfaces\OpenReassignCallback $jsFile */
+ foreach($fromPlugin as $jsFile) {
+ $jsFile = $jsFile->getCallBackFile();
if(is_file($jsFile)) {
$jsFile = file_get_contents($jsFile);
if(!empty($jsFile)) {
diff --git a/workflow/engine/methods/cases/casesStartPage_Ajax.php b/workflow/engine/methods/cases/casesStartPage_Ajax.php
index 81012da6d..acd483507 100644
--- a/workflow/engine/methods/cases/casesStartPage_Ajax.php
+++ b/workflow/engine/methods/cases/casesStartPage_Ajax.php
@@ -1,5 +1,7 @@
xssFilterHard($_POST);
$_REQUEST = $filter->xssFilterHard($_REQUEST);
@@ -306,7 +308,7 @@ function getSimpleDashboardData ()
function getRegisteredDashboards ()
{
- $oPluginRegistry = & PMPluginRegistry::getSingleton();
+ $oPluginRegistry = PluginRegistry::loadSingleton();
$dashBoardPages = $oPluginRegistry->getDashboardPages();
print_r( G::json_encode( $dashBoardPages ) );
}
diff --git a/workflow/engine/methods/cases/cases_SaveDataSupervisor.php b/workflow/engine/methods/cases/cases_SaveDataSupervisor.php
index b456cbafb..b0aac5fe3 100644
--- a/workflow/engine/methods/cases/cases_SaveDataSupervisor.php
+++ b/workflow/engine/methods/cases/cases_SaveDataSupervisor.php
@@ -23,6 +23,8 @@
*/
//validate the data post
+use ProcessMaker\Plugins\PluginRegistry;
+
$dynaForm = DynaformPeer::retrieveByPK($_GET["UID"]);
$flagDynaFormNewVersion = !is_null($dynaForm) && $dynaForm->getDynVersion() == 2;
@@ -180,7 +182,7 @@ if (isset( $_FILES["form"]["name"] ) && count( $_FILES["form"]["name"] ) > 0) {
G::uploadFile( $arrayFileTmpName[$i], $sPathName, $sFileName );
//Plugin Hook PM_UPLOAD_DOCUMENT for upload document
- $oPluginRegistry = &PMPluginRegistry::getSingleton();
+ $oPluginRegistry = PluginRegistry::loadSingleton();
if ($oPluginRegistry->existsTrigger( PM_UPLOAD_DOCUMENT ) && class_exists( "uploadDocumentData" )) {
$triggerDetail = $oPluginRegistry->getTriggerInfo( PM_UPLOAD_DOCUMENT );
@@ -188,7 +190,7 @@ if (isset( $_FILES["form"]["name"] ) && count( $_FILES["form"]["name"] ) > 0) {
$uploadReturn = $oPluginRegistry->executeTriggers( PM_UPLOAD_DOCUMENT, $documentData );
if ($uploadReturn) {
- $aFields["APP_DOC_PLUGIN"] = $triggerDetail->sNamespace;
+ $aFields["APP_DOC_PLUGIN"] = $triggerDetail->getNamespace();
if (! isset( $aFields["APP_DOC_UID"] )) {
$aFields["APP_DOC_UID"] = $sAppDocUid;
diff --git a/workflow/engine/methods/cases/cases_SchedulerGetPlugins.php b/workflow/engine/methods/cases/cases_SchedulerGetPlugins.php
index 32ae2e0eb..657027bc7 100644
--- a/workflow/engine/methods/cases/cases_SchedulerGetPlugins.php
+++ b/workflow/engine/methods/cases/cases_SchedulerGetPlugins.php
@@ -1,5 +1,7 @@
getCaseSchedulerPlugins();
$selectedPlugin = "";
if ((isset( $_REQUEST['plg_uid'] )) && ($_REQUEST['plg_uid'] != "")) {
@@ -56,11 +58,12 @@ function pluginCaseSchedulerForm ()
}
$G_PUBLISH = new Publisher();
$params = explode( "--", $_REQUEST['selectedOption'] );
- $oPluginRegistry = & PMPluginRegistry::getSingleton();
+ $oPluginRegistry = PluginRegistry::loadSingleton();
$activePluginsForCaseScheduler = $oPluginRegistry->getCaseSchedulerPlugins();
-
- foreach ($activePluginsForCaseScheduler as $key => $caseSchedulerPluginDetail) {
- if (($caseSchedulerPluginDetail->sNamespace == $params[0]) && ($caseSchedulerPluginDetail->sActionId == $params[1])) {
+ /** @var \ProcessMaker\Plugins\Interfaces\CaseSchedulerPlugin $caseSchedulerPluginDetail */
+ foreach ($activePluginsForCaseScheduler as $caseSchedulerPluginDetail) {
+ if (($caseSchedulerPluginDetail->equalNamespaceTo($params[0])) &&
+ ($caseSchedulerPluginDetail->equalActionIdTo($params[1]))) {
$caseSchedulerSelected = $caseSchedulerPluginDetail;
}
}
@@ -74,7 +77,7 @@ function pluginCaseSchedulerForm ()
$oData = array ("PRO_UID" => $_REQUEST['pro_uid']
);
}
- $oPluginRegistry->executeMethod( $caseSchedulerPluginDetail->sNamespace, $caseSchedulerPluginDetail->sActionForm, $oData );
+ $oPluginRegistry->executeMethod($caseSchedulerPluginDetail->getNamespace(), $caseSchedulerPluginDetail->getActionForm(), $oData);
}
}
diff --git a/workflow/engine/methods/cases/cases_ShowOutputDocument.php b/workflow/engine/methods/cases/cases_ShowOutputDocument.php
index f788d52f2..27f8d0e2f 100644
--- a/workflow/engine/methods/cases/cases_ShowOutputDocument.php
+++ b/workflow/engine/methods/cases/cases_ShowOutputDocument.php
@@ -27,6 +27,8 @@
* @author David Callizaya
*/
+use ProcessMaker\Plugins\PluginRegistry;
+
if (isset($_REQUEST['actionAjax']) && $_REQUEST['actionAjax'] == "verifySession" ) {
if (!isset($_SESSION['USER_LOGGED'])) {
if ((isset( $_POST['request'] )) && ($_POST['request'] == true)) {
@@ -107,7 +109,7 @@ if (file_exists( $realPath )) {
if (!$sw_file_exists) {
- $oPluginRegistry = & PMPluginRegistry::getSingleton();
+ $oPluginRegistry = PluginRegistry::loadSingleton();
if ($oPluginRegistry->existsTrigger( PM_UPLOAD_DOCUMENT )) {
$error_message = G::LoadTranslation( 'ID_ERROR_FILE_NOT_EXIST', SYS_LANG, array('filename' => $info['basename'] . $ver . '.' . $ext) ) . ' ' . G::LoadTranslation('ID_CONTACT_ADMIN');
} else {
diff --git a/workflow/engine/methods/cases/cases_Step.php b/workflow/engine/methods/cases/cases_Step.php
index 03e9226cb..e2d53b20a 100644
--- a/workflow/engine/methods/cases/cases_Step.php
+++ b/workflow/engine/methods/cases/cases_Step.php
@@ -1,4 +1,7 @@
xssRegexFilter(
@@ -382,7 +385,7 @@ try {
$Fields['MESSAGE1'] = G::LoadTranslation( 'ID_PLEASE_ENTER_COMMENTS' );
$Fields['MESSAGE2'] = G::LoadTranslation( 'ID_PLEASE_SELECT_FILE' );
//START: If there is a Break Step registered from Plugin Similar as a Trigger debug
- $oPluginRegistry = & PMPluginRegistry::getSingleton();
+ $oPluginRegistry = PluginRegistry::loadSingleton();
if ($oPluginRegistry->existsTrigger( PM_UPLOAD_DOCUMENT_BEFORE )) {
//If a Plugin has registered a Break Page Evaluator
$oPluginRegistry->executeTriggers( PM_UPLOAD_DOCUMENT_BEFORE, array ('USR_UID' => $_SESSION['USER_LOGGED']) );
@@ -391,18 +394,6 @@ try {
$G_PUBLISH->AddContent( 'propeltable', 'cases/paged-table-inputDocuments', 'cases/cases_InputdocsList', $oCase->getInputDocumentsCriteria( $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_GET['UID'] ), array_merge( array ('DOC_UID' => $_GET['UID']
), $Fields ) ); //$aFields
-
- //call plugin
- //if ( $oPluginRegistry->existsTrigger ( PM_CASE_DOCUMENT_LIST ) ) {
- // $folderData = new folderData (null, null, $_SESSION['APPLICATION'], null, $_SESSION['USER_LOGGED'] );
- // $oPluginRegistry =& PMPluginRegistry::getSingleton();
- // $oPluginRegistry->executeTriggers ( PM_CASE_DOCUMENT_LIST , $folderData );
- // //end plugin
- //}
- //else
- // $G_PUBLISH->AddContent('propeltable', 'cases/paged-table-inputDocuments', 'cases/cases_InputdocsList', $oCase->getInputDocumentsCriteria($_SESSION['APPLICATION'], $_SESSION['INDEX'], $_GET['UID']), array_merge(array('DOC_UID'=>$_GET['UID']),$Fields));//$aFields
-
-
$oHeadPublisher = & headPublisher::getSingleton();
$titleDocument = "" . htmlspecialchars($Fields['INP_DOC_TITLE'], ENT_QUOTES) . "
" . G::LoadTranslation('ID_INPUT_DOCUMENT') . "
";
if ($Fields['INP_DOC_DESCRIPTION']) {
@@ -454,7 +445,7 @@ try {
switch ($_GET['ACTION']) {
case 'GENERATE':
//START: If there is a Break Step registered from Plugin Similar as a Trigger debug
- $oPluginRegistry = & PMPluginRegistry::getSingleton();
+ $oPluginRegistry = PluginRegistry::loadSingleton();
if ($oPluginRegistry->existsTrigger( PM_UPLOAD_DOCUMENT_BEFORE )) {
//If a Plugin has registered a Break Page Evaluator
$oPluginRegistry->executeTriggers( PM_UPLOAD_DOCUMENT_BEFORE, array ('USR_UID' => $_SESSION['USER_LOGGED']) );
@@ -646,7 +637,7 @@ try {
//Save data - End
//Plugin Hook PM_UPLOAD_DOCUMENT for upload document
- $oPluginRegistry = & PMPluginRegistry::getSingleton();
+ $oPluginRegistry = PluginRegistry::loadSingleton();
if ($oPluginRegistry->existsTrigger( PM_UPLOAD_DOCUMENT ) && class_exists( 'uploadDocumentData' )) {
$triggerDetail = $oPluginRegistry->getTriggerInfo( PM_UPLOAD_DOCUMENT );
@@ -663,7 +654,7 @@ try {
$uploadReturn = $oPluginRegistry->executeTriggers( PM_UPLOAD_DOCUMENT, $documentData );
if ($uploadReturn) {
//Only delete if the file was saved correctly
- $aFields['APP_DOC_PLUGIN'] = $triggerDetail->sNamespace;
+ $aFields['APP_DOC_PLUGIN'] = $triggerDetail->getNamespace();
//$oAppDocument = new AppDocument();
//$oAppDocument->update($aFields);
unlink( $pathOutput . $sFilename . '.pdf' );
@@ -718,7 +709,7 @@ try {
$lastVersion = $oAppDocument->getLastAppDocVersion( $_GET['DOC'], $_SESSION['APPLICATION'] );
$aFields = $oAppDocument->load( $_GET['DOC'], $lastVersion );
$listing = false;
- $oPluginRegistry = & PMPluginRegistry::getSingleton();
+ $oPluginRegistry = PluginRegistry::loadSingleton();
if ($oPluginRegistry->existsTrigger( PM_CASE_DOCUMENT_LIST )) {
$folderData = new folderData( null, null, $_SESSION['APPLICATION'], null, $_SESSION['USER_LOGGED'] );
$folderData->PMType = "OUTPUT";
@@ -1119,7 +1110,7 @@ try {
if ($noShowTitle == 0) {
$G_PUBLISH->AddContent( 'smarty', 'cases/cases_title', '', '', $array );
}
- $oPluginRegistry = &PMPluginRegistry::getSingleton();
+ $oPluginRegistry = PluginRegistry::loadSingleton();
$externalSteps = $oPluginRegistry->getSteps();
$sNamespace = '';
diff --git a/workflow/engine/methods/cases/cases_SupervisorSaveDocument.php b/workflow/engine/methods/cases/cases_SupervisorSaveDocument.php
index 397be35ec..1f2301133 100644
--- a/workflow/engine/methods/cases/cases_SupervisorSaveDocument.php
+++ b/workflow/engine/methods/cases/cases_SupervisorSaveDocument.php
@@ -22,6 +22,8 @@
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
+use ProcessMaker\Plugins\PluginRegistry;
+
try {
$oAppDocument = new AppDocument();
@@ -52,7 +54,7 @@ try {
G::uploadFile( $_FILES['form']['tmp_name']['APP_DOC_FILENAME'], $sPathName, $sFileName );
//Plugin Hook PM_UPLOAD_DOCUMENT for upload document
- $oPluginRegistry = & PMPluginRegistry::getSingleton();
+ $oPluginRegistry = PluginRegistry::loadSingleton();
if ($oPluginRegistry->existsTrigger( PM_UPLOAD_DOCUMENT ) && class_exists( 'uploadDocumentData' )) {
$oData['APP_UID'] = $_GET['APP_UID'];
$documentData = new uploadDocumentData( $_GET['APP_UID'], $_SESSION['USER_LOGGED'], $sPathName . $sFileName, $aFields['APP_DOC_FILENAME'], $sAppDocUid );
diff --git a/workflow/engine/methods/dynaforms/dynaforms_NewPlugin.php b/workflow/engine/methods/dynaforms/dynaforms_NewPlugin.php
index 3cd6d9c3d..27cb9e49b 100644
--- a/workflow/engine/methods/dynaforms/dynaforms_NewPlugin.php
+++ b/workflow/engine/methods/dynaforms/dynaforms_NewPlugin.php
@@ -22,11 +22,6 @@
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
-//call plugin
-// $oPluginRegistry = &PMPluginRegistry::getSingleton();
-// $existsDynaforms = $oPluginRegistry->existsTrigger(PM_NEW_DYNAFORM_LIST );
-
-
//for now, we are going with the default list, because the plugin is not complete
include ('dynaforms_Edit.php');
die();
diff --git a/workflow/engine/methods/enterprise/addonsStoreAction.php b/workflow/engine/methods/enterprise/addonsStoreAction.php
index eeef66eb3..ef60033dc 100644
--- a/workflow/engine/methods/enterprise/addonsStoreAction.php
+++ b/workflow/engine/methods/enterprise/addonsStoreAction.php
@@ -80,11 +80,11 @@ try {
BasePeer::doUpdate($oCriteriaSelect, $oCriteriaUpdate, $cnn);
//are all the plugins that are enabled in the workspace
- $pluginRegistry =& ProcessMaker\Plugins\PluginsRegistry::loadSingleton();
- foreach ($pluginRegistry->_aPluginDetails as $plugin) {
+ $pluginRegistry = ProcessMaker\Plugins\PluginRegistry::loadSingleton();
+ foreach ($pluginRegistry->getPlugins() as $plugin) {
if ($plugin->enabled && !in_array($plugin->sNamespace, $licenseManager->features)) {
$pluginRegistry->disablePlugin($plugin->sNamespace);
- $pluginRegistry->pluginAdapter->savePlugin($plugin->sNamespace, $pluginRegistry);
+ $pluginRegistry->savePlugin($plugin->sNamespace);
}
}
}
diff --git a/workflow/engine/methods/enterprise/enterprise.php b/workflow/engine/methods/enterprise/enterprise.php
index e44441d77..17343b26a 100644
--- a/workflow/engine/methods/enterprise/enterprise.php
+++ b/workflow/engine/methods/enterprise/enterprise.php
@@ -1,5 +1,7 @@
getPluginDetails("enterprise.php");
- $pluginRegistry->enablePlugin($pluginDetail->sNamespace);
+ $pluginRegistry->enablePlugin($pluginDetail->getNamespace());
file_put_contents(PATH_DATA_SITE . "plugin.singleton", $pluginRegistry->serializeInstance());
}
@@ -118,10 +120,10 @@ class enterprisePlugin extends PMPlugin
public function setup()
{
if (!PluginsRegistryPeer::retrieveByPK(md5('enterprise'))) {
- $pluginRegistry = &PMPluginRegistry::getSingleton();
+ $pluginRegistry = PluginRegistry::loadSingleton();
$pluginDetail = $pluginRegistry->getPluginDetails("enterprise.php");
- $pluginRegistry->enablePlugin($pluginDetail->sNamespace);
- $pluginRegistry->pluginAdapter->savePlugin($pluginDetail->sNamespace, $pluginRegistry);
+ $pluginRegistry->enablePlugin($pluginDetail->getNamespace());
+ $pluginRegistry->savePlugin($pluginDetail->getNamespace());
}
}
@@ -176,16 +178,17 @@ class enterprisePlugin extends PMPlugin
if (file_exists(PATH_CORE . "plugins" . PATH_SEP . $pluginName . ".php")) {
require_once (PATH_CORE . "plugins" . PATH_SEP . $pluginName . ".php");
- $pluginRegistry = &PMPluginRegistry::getSingleton();
+ $pluginRegistry = PluginRegistry::loadSingleton();
$pluginDetail = $pluginRegistry->getPluginDetails($pluginName . ".php");
if ($pluginDetail) {
- $pluginRegistry->enablePlugin($pluginDetail->sNamespace);
- $pluginRegistry->disablePlugin($pluginDetail->sNamespace);
+ $pluginRegistry->enablePlugin($pluginDetail->getNamespace());
+ $pluginRegistry->disablePlugin($pluginDetail->getNamespace());
///////
- $plugin = new $pluginDetail->sClassName($pluginDetail->sNamespace, $pluginDetail->sFilename);
+ $className = $pluginDetail->getClassName();
+ $plugin = new $className($pluginDetail->getNamespace(), $pluginDetail->getFile());
//$this->_aPlugins[$pluginDetail->sNamespace] = $plugin;
if (method_exists($plugin, "uninstall")) {
@@ -193,7 +196,7 @@ class enterprisePlugin extends PMPlugin
}
///////
- file_put_contents(PATH_DATA_SITE . "plugin.singleton", $pluginRegistry->serializeInstance());
+ $pluginRegistry->savePlugin($pluginDetail->getNamespace());
}
///////
@@ -323,7 +326,7 @@ class enterprisePlugin extends PMPlugin
}
}
-$oPluginRegistry = &PMPluginRegistry::getSingleton();
+$oPluginRegistry = PluginRegistry::loadSingleton();
$oPluginRegistry->registerPlugin('enterprise', __FILE__); //<- enterprise string must be in single quote, otherwise generate error
//since we are placing pmLicenseManager and EE together.. after register EE, we need to require_once the pmLicenseManager
diff --git a/workflow/engine/methods/enterprise/pluginsImportFile.php b/workflow/engine/methods/enterprise/pluginsImportFile.php
index 1bceef92f..7e2e0afd4 100644
--- a/workflow/engine/methods/enterprise/pluginsImportFile.php
+++ b/workflow/engine/methods/enterprise/pluginsImportFile.php
@@ -26,6 +26,8 @@
global $RBAC;
+use ProcessMaker\Plugins\PluginRegistry;
+
$RBAC->requirePermissions("PM_SETUP_ADVANCE");
require_once PATH_CORE . 'methods' . PATH_SEP . 'enterprise' . PATH_SEP . 'enterprise.php';
@@ -75,7 +77,7 @@ try {
throw (new Exception($str));
}
- $oPluginRegistry = &PMPluginRegistry::getSingleton();
+ $oPluginRegistry = PluginRegistry::loadSingleton();
$pluginFile = $sClassName . '.php';
if ($bMainFile && $bClassFile) {
@@ -136,9 +138,9 @@ try {
$details = $oPluginRegistry->getPluginDetails($pluginFile);
- $oPluginRegistry->installPlugin($details->sNamespace);
+ $oPluginRegistry->installPlugin($details->getNamespace());
$oPluginRegistry->setupPlugins(); //get and setup enabled plugins
- $size = file_put_contents(PATH_DATA_SITE . "plugin.singleton", $oPluginRegistry->serializeInstance());
+ $oPluginRegistry->savePlugin($details->getNamespace());
//G::header("Location: pluginsList");
//die;
diff --git a/workflow/engine/methods/enterprise/pluginsSetup.php b/workflow/engine/methods/enterprise/pluginsSetup.php
index 28d96a707..d4fcad8d8 100644
--- a/workflow/engine/methods/enterprise/pluginsSetup.php
+++ b/workflow/engine/methods/enterprise/pluginsSetup.php
@@ -2,10 +2,11 @@
$pluginFile = $_GET['id'];
-$oPluginRegistry =& PMPluginRegistry::getSingleton();
+$oPluginRegistry = \ProcessMaker\Plugins\PluginRegistry::loadSingleton();
$details = $oPluginRegistry->getPluginDetails( $pluginFile );
-$xmlform = isset($details->sPluginFolder) ? $details->sPluginFolder . '/' . $details->sSetupPage : '';
+$folder = $details->getFolder();
+$xmlform = (isset($folder)) ? $folder . '/' . $details->getSetupPage() : '';
$G_MAIN_MENU = 'processmaker';
$G_ID_MENU_SELECTED = 'SETUP';
@@ -23,7 +24,7 @@ try {
throw ( new Exception ('setup .xml file is not defined for this plugin') );
}
- $Fields = $oPluginRegistry->getFieldsForPageSetup( $details->sNamespace );
+ $Fields = $oPluginRegistry->getFieldsForPageSetup( $details->getNamespace() );
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', $xmlform, '',$Fields ,'pluginsSetupSave?id='.$pluginFile );
} catch (Exception $e) {
$aMessage['MESSAGE'] = $e->getMessage();
diff --git a/workflow/engine/methods/install/autoinstallPlugins.php b/workflow/engine/methods/install/autoinstallPlugins.php
index af45cec4a..02530513b 100644
--- a/workflow/engine/methods/install/autoinstallPlugins.php
+++ b/workflow/engine/methods/install/autoinstallPlugins.php
@@ -57,7 +57,7 @@ foreach ($availablePlugins as $filename) {
}
//print "change to ENABLED";
- $oPluginRegistry = & PMPluginRegistry::getSingleton();
+ $oPluginRegistry = \ProcessMaker\Plugins\PluginRegistry::loadSingleton();
$pluginFile = $sClassName . '.php';
if (! file_exists( PATH_PLUGINS . $sClassName . '.php' )) {
@@ -67,10 +67,10 @@ foreach ($availablePlugins as $filename) {
require_once (PATH_PLUGINS . $pluginFile);
$details = $oPluginRegistry->getPluginDetails( $pluginFile );
- $oPluginRegistry->installPlugin( $details->sNamespace );
- $oPluginRegistry->enablePlugin( $details->sNamespace );
+ $oPluginRegistry->installPlugin($details->getNamespace());
+ $oPluginRegistry->enablePlugin($details->getNamespace());
$oPluginRegistry->setupPlugins(); //get and setup enabled plugins
- $size = file_put_contents( PATH_DATA_SITE . 'plugin.singleton', $oPluginRegistry->serializeInstance() );
+ $oPluginRegistry->savePlugin($details->getNamespace());
$message .= "$filename - OK
";
diff --git a/workflow/engine/methods/login/authentication.php b/workflow/engine/methods/login/authentication.php
index ed7e32196..e445cf4c2 100644
--- a/workflow/engine/methods/login/authentication.php
+++ b/workflow/engine/methods/login/authentication.php
@@ -23,6 +23,8 @@
*
*/
+use ProcessMaker\Plugins\PluginRegistry;
+
try {
$usr = '';
$pwd = '';
@@ -172,7 +174,7 @@ try {
}
//Execute the SSO Script from plugin
- $oPluginRegistry =& PMPluginRegistry::getSingleton();
+ $oPluginRegistry = PluginRegistry::loadSingleton();
$lSession="";
$loginInfo = new loginInfo ($usr, $pwd, $lSession );
if ($oPluginRegistry->existsTrigger ( PM_LOGIN )) {
@@ -425,7 +427,7 @@ try {
setcookie("PM-TabPrimary", 101010010, time() + (24 * 60 * 60), '/');
}
- $oPluginRegistry =& PMPluginRegistry::getSingleton();
+ $oPluginRegistry = PluginRegistry::loadSingleton();
if ($oPluginRegistry->existsTrigger ( PM_AFTER_LOGIN )) {
$oPluginRegistry->executeTriggers ( PM_AFTER_LOGIN , $_SESSION['USER_LOGGED'] );
}
diff --git a/workflow/engine/methods/login/changePassword.php b/workflow/engine/methods/login/changePassword.php
index 8eec6306c..1fd8f1ae7 100644
--- a/workflow/engine/methods/login/changePassword.php
+++ b/workflow/engine/methods/login/changePassword.php
@@ -50,15 +50,19 @@ if (class_exists('redirectDetail')) {
if (isset($RBAC->aUserInfo['PROCESSMAKER']['ROLE']['ROL_CODE'])) {
$userRole = $RBAC->aUserInfo['PROCESSMAKER']['ROLE']['ROL_CODE'];
}
- $oPluginRegistry = &PMPluginRegistry::getSingleton();
+ $oPluginRegistry = \ProcessMaker\Plugins\PluginRegistry::loadSingleton();
//$oPluginRegistry->showArrays();
$aRedirectLogin = $oPluginRegistry->getRedirectLogins();
if (isset($aRedirectLogin)) {
if (is_array($aRedirectLogin)) {
- foreach ($aRedirectLogin as $key => $detail) {
+ /** @var \ProcessMaker\Plugins\Interfaces\RedirectDetail $detail */
+ foreach ($aRedirectLogin as $detail) {
if (isset($detail->sPathMethod)) {
- if ($detail->sRoleCode == $userRole) {
- G::header('location: /sys' . SYS_TEMP . '/' . SYS_LANG . '/' . SYS_SKIN . '/' . $detail->sPathMethod );
+ if ($detail->equalRoleCodeTo($userRole)) {
+ G::header(
+ 'location: /sys' . SYS_TEMP . '/' . SYS_LANG .
+ '/' . SYS_SKIN . '/' . $detail->getPathMethod()
+ );
die;
}
}
diff --git a/workflow/engine/methods/login/licenseUpdate.php b/workflow/engine/methods/login/licenseUpdate.php
index 88417bfd3..4855e792d 100644
--- a/workflow/engine/methods/login/licenseUpdate.php
+++ b/workflow/engine/methods/login/licenseUpdate.php
@@ -37,11 +37,12 @@ if ($aux['extension'] != 'dat') {
BasePeer::doUpdate($oCriteriaSelect, $oCriteriaUpdate, $cnn);
//are all the plugins that are enabled in the workspace
- $pluginRegistry =& ProcessMaker\Plugins\PluginsRegistry::loadSingleton();
- foreach ($pluginRegistry->_aPluginDetails as $plugin) {
- if ($plugin->enabled && !in_array($plugin->sNamespace, $licenseManager->features)) {
- $pluginRegistry->disablePlugin($plugin->sNamespace);
- $pluginRegistry->pluginAdapter->savePlugin($plugin->sNamespace, $pluginRegistry);
+ $pluginRegistry = ProcessMaker\Plugins\PluginRegistry::loadSingleton();
+ /** @var \ProcessMaker\Plugins\Interfaces\PluginDetail $plugin */
+ foreach ($pluginRegistry->getPlugins() as $plugin) {
+ if ($plugin->isEnabled() && !in_array($plugin->getNamespace(), $licenseManager->features)) {
+ $pluginRegistry->disablePlugin($plugin->getNamespace());
+ $pluginRegistry->savePlugin($plugin->getNamespace());
}
}
diff --git a/workflow/engine/methods/login/login.php b/workflow/engine/methods/login/login.php
index d06ec840e..983ea3e85 100644
--- a/workflow/engine/methods/login/login.php
+++ b/workflow/engine/methods/login/login.php
@@ -109,7 +109,7 @@ if (isset ($_SESSION['USER_LOGGED'])) {
}
} else {
// Execute SSO trigger
- $pluginRegistry =& PMPluginRegistry::getSingleton();
+ $pluginRegistry = \ProcessMaker\Plugins\PluginRegistry::loadSingleton();
if (defined('PM_SINGLE_SIGN_ON')) {
/*----------------------------------********---------------------------------*/
$licensedFeatures = & PMLicensedFeatures::getSingleton();
diff --git a/workflow/engine/methods/mails/emailList.php b/workflow/engine/methods/mails/emailList.php
index e2fd93c0c..65e384f4a 100644
--- a/workflow/engine/methods/mails/emailList.php
+++ b/workflow/engine/methods/mails/emailList.php
@@ -47,9 +47,8 @@ $status = array(
array("pending", G::LoadTranslation('ID_PENDING'))
);
-$pluginRegistry = PMPluginRegistry::getSingleton();
-$statusER = $pluginRegistry->getStatusPlugin('externalRegistration');
-$flagER = (preg_match('/^enabled$/', $statusER))? 1 : 0;
+$pluginRegistry = \ProcessMaker\Plugins\PluginRegistry::loadSingleton();
+$flagER = $pluginRegistry->isEnable('externalRegistration') ? 1 : 0;
$processes = getProcessArray($userUid);
diff --git a/workflow/engine/methods/mails/emailsAjax.php b/workflow/engine/methods/mails/emailsAjax.php
index fc8a1fde1..ad1d88388 100644
--- a/workflow/engine/methods/mails/emailsAjax.php
+++ b/workflow/engine/methods/mails/emailsAjax.php
@@ -36,10 +36,8 @@ switch($req){
$arrayType = [];
- $pluginRegistry = PMPluginRegistry::getSingleton();
- $statusEr = $pluginRegistry->getStatusPlugin('externalRegistration');
-
- $flagEr = (preg_match('/^enabled$/', $statusEr))? 1 : 0;
+ $pluginRegistry = \ProcessMaker\Plugins\PluginRegistry::loadSingleton();
+ $flagEr = $pluginRegistry->isEnable('externalRegistration') ? 1 : 0;
if ($flagEr == 0) {
$arrayType[] = 'EXTERNAL_REGISTRATION';
diff --git a/workflow/engine/methods/processes/ajaxListener.php b/workflow/engine/methods/processes/ajaxListener.php
index 1fba57773..4fd2137ab 100644
--- a/workflow/engine/methods/processes/ajaxListener.php
+++ b/workflow/engine/methods/processes/ajaxListener.php
@@ -22,6 +22,9 @@
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
+
+use ProcessMaker\Plugins\PluginRegistry;
+
/**
*
* @author Erik Amaru Ortiz
@@ -112,7 +115,7 @@ class Ajax
$oData['PRO_TEMPLATE'] = (isset($_POST['PRO_TEMPLATE']) && $_POST['PRO_TEMPLATE'] != '') ? $_POST['form']['PRO_TEMPLATE'] : '';
$oData['PROCESSMAP'] = $oProcessMap;
- $oPluginRegistry = & PMPluginRegistry::getSingleton();
+ $oPluginRegistry = PluginRegistry::loadSingleton();
$oPluginRegistry->executeTriggers(PM_NEW_PROCESS_SAVE, $oData);
} else {
//$oProcessMap->updateProcess($_POST['form']);
diff --git a/workflow/engine/methods/processes/mainInit.php b/workflow/engine/methods/processes/mainInit.php
index fc8534961..415f09547 100644
--- a/workflow/engine/methods/processes/mainInit.php
+++ b/workflow/engine/methods/processes/mainInit.php
@@ -21,6 +21,7 @@
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
+use ProcessMaker\Plugins\PluginRegistry;
//$oHeadPublisher = & headPublisher::getSingleton();
global $RBAC;
@@ -47,12 +48,12 @@ if ($pmVersion != "") {
$arrayFlagMenuNewOption = (version_compare($pmVersion . "", "3", ">="))? array("bpmn" => true) : array("pm" => true);
}
-$pluginRegistry = &PMPluginRegistry::getSingleton();
+$oPluginRegistry = PluginRegistry::loadSingleton();
$arrayMenuNewOptionPlugin = array();
$arrayContextMenuOptionPlugin = array();
-foreach ($pluginRegistry->getDesignerMenu() as $value) {
+foreach ($oPluginRegistry->getDesignerMenu() as $value) {
if (file_exists($value->file)) {
require_once($value->file);
@@ -102,11 +103,11 @@ if($RBAC->userCanAccess('PM_DELETE_PROCESS_CASES') === 1) {
}
$oHeadPublisher->assign('deleteCasesFlag', $deleteCasesFlag);
-$oPluginRegistry = & PMPluginRegistry::getSingleton();
+$oPluginRegistry = PluginRegistry::loadSingleton();
$callBackFile = $oPluginRegistry->getImportProcessCallback();
$file = false;
if(sizeof($callBackFile)) {
- $file = $callBackFile[0]->callBackFile != "" ? $callBackFile[0]->callBackFile : false;
+ $file = $callBackFile[0]->getCallBackFile() != "" ? $callBackFile[0]->getCallBackFile() : false;
}
$oHeadPublisher->assign("importProcessCallbackFile", $file);
diff --git a/workflow/engine/methods/processes/processes_New.php b/workflow/engine/methods/processes/processes_New.php
index ad37b27a9..f38680504 100644
--- a/workflow/engine/methods/processes/processes_New.php
+++ b/workflow/engine/methods/processes/processes_New.php
@@ -43,7 +43,7 @@ if ($access != 1) {
}
//call plugins
-$oPluginRegistry = & PMPluginRegistry::getSingleton();
+$oPluginRegistry = \ProcessMaker\Plugins\PluginRegistry::loadSingleton();
$oPluginRegistry->executeTriggers( PM_NEW_PROCESS_LIST, NULL );
$aFields['MESSAGE1'] = G::LoadTranslation( 'ID_MSG_ERROR_PRO_TITLE' );
diff --git a/workflow/engine/methods/processes/processes_Save.php b/workflow/engine/methods/processes/processes_Save.php
index f425fa796..382a1976b 100644
--- a/workflow/engine/methods/processes/processes_Save.php
+++ b/workflow/engine/methods/processes/processes_Save.php
@@ -68,7 +68,7 @@ switch ($function) {
$oData['PRO_TEMPLATE'] = (isset( $_POST['form']['PRO_TEMPLATE'] ) && $_POST['form']['PRO_TEMPLATE'] != '') ? $_POST['form']['PRO_TEMPLATE'] : '';
$oData['PROCESSMAP'] = $oProcessMap;
- $oPluginRegistry = & PMPluginRegistry::getSingleton();
+ $oPluginRegistry = \ProcessMaker\Plugins\PluginRegistry::loadSingleton();
$oPluginRegistry->executeTriggers( PM_NEW_PROCESS_SAVE, $oData );
G::header( 'location: processes_Map?PRO_UID=' . $sProUid );
diff --git a/workflow/engine/methods/reports/reportsList.php b/workflow/engine/methods/reports/reportsList.php
index d87006f7e..d7ba34b97 100644
--- a/workflow/engine/methods/reports/reportsList.php
+++ b/workflow/engine/methods/reports/reportsList.php
@@ -74,7 +74,7 @@ $reports[] = array ('RPT_NUMBER' => count( $reports ),'RPT_UID' => 5,'RPT_TITLE'
'RPT_TITLE' => "Report 9",//G::LoadTranslation('ID_REPORT6'),
'VIEW' => G::LoadTranslation('ID_VIEW'));*/
-$oPluginRegistry = &PMPluginRegistry::getSingleton();
+$oPluginRegistry = \ProcessMaker\Plugins\PluginRegistry::loadSingleton();
$aAvailableReports = $oPluginRegistry->getReports();
//$aReports = array();
diff --git a/workflow/engine/methods/reports/reports_View.php b/workflow/engine/methods/reports/reports_View.php
index 673bd2256..e6eddc7f0 100644
--- a/workflow/engine/methods/reports/reports_View.php
+++ b/workflow/engine/methods/reports/reports_View.php
@@ -210,7 +210,7 @@ try {
break;
default:
$foundReport = false;
- $oPluginRegistry = &PMPluginRegistry::getSingleton();
+ $oPluginRegistry = \ProcessMaker\Plugins\PluginRegistry::loadSingleton();
$aAvailableReports = $oPluginRegistry->getReports();
foreach ($aAvailableReports as $sReportClass) {
diff --git a/workflow/engine/methods/services/upload.php b/workflow/engine/methods/services/upload.php
index 07d1a2dfd..a8a418d32 100644
--- a/workflow/engine/methods/services/upload.php
+++ b/workflow/engine/methods/services/upload.php
@@ -138,7 +138,7 @@ if (isset( $_FILES ) && $_FILES["ATTACH_FILE"]["error"] == 0) {
//Plugin Hook PM_UPLOAD_DOCUMENT for upload document
- $oPluginRegistry = &PMPluginRegistry::getSingleton();
+ $oPluginRegistry = \ProcessMaker\Plugins\PluginRegistry::loadSingleton();
if ($oPluginRegistry->existsTrigger( PM_UPLOAD_DOCUMENT ) && class_exists( "uploadDocumentData" )) {
$triggerDetail = $oPluginRegistry->getTriggerInfo( PM_UPLOAD_DOCUMENT );
@@ -146,7 +146,7 @@ if (isset( $_FILES ) && $_FILES["ATTACH_FILE"]["error"] == 0) {
$uploadReturn = $oPluginRegistry->executeTriggers( PM_UPLOAD_DOCUMENT, $documentData );
if ($uploadReturn) {
- $aFields["APP_DOC_PLUGIN"] = $triggerDetail->sNamespace;
+ $aFields["APP_DOC_PLUGIN"] = $triggerDetail->getNamespace();
if (! isset( $aFields["APP_DOC_UID"] )) {
$aFields["APP_DOC_UID"] = $sAppDocUid;
diff --git a/workflow/engine/methods/setup/pluginsChange.php b/workflow/engine/methods/setup/pluginsChange.php
index b7ab420f6..3e9f10532 100644
--- a/workflow/engine/methods/setup/pluginsChange.php
+++ b/workflow/engine/methods/setup/pluginsChange.php
@@ -32,18 +32,17 @@ $filter = new InputFilter();
$path = PATH_PLUGINS . $pluginFile;
$path = $filter->validateInput($path, 'path');
-$oPluginRegistry =& ProcessMaker\Plugins\PluginsRegistry::loadSingleton();
+$oPluginRegistry =& ProcessMaker\Plugins\PluginRegistry::loadSingleton();
if ($handle = opendir(PATH_PLUGINS)) {
while (false !== ($file = readdir($handle))) {
if (strpos($file, '.php', 1) && $file == $pluginFile) {
if ($pluginStatus == '1') {
- //print "change to disable";
+ // change to disable
$details = $oPluginRegistry->getPluginDetails($pluginFile);
- $oPluginRegistry->disablePlugin($details->sNamespace);
- $oPluginRegistry->pluginAdapter->savePlugin($details->sNamespace, $oPluginRegistry);
- G::auditLog("DisablePlugin", "Plugin Name: " . $details->sNamespace);
- //print "size saved : $size
";
+ $oPluginRegistry->disablePlugin($details->getNamespace());
+ //$oPluginRegistry->adapter->savePlugin($details->sNamespace, $oPluginRegistry);
+ G::auditLog("DisablePlugin", "Plugin Name: " . $details->getNamespace());
} else {
$pluginName = str_replace(".php", "", $pluginFile);
@@ -73,14 +72,13 @@ if ($handle = opendir(PATH_PLUGINS)) {
}
/*----------------------------------********---------------------------------*/
- //print "change to ENABLED";
+ // change to ENABLED
require_once($path);
$details = $oPluginRegistry->getPluginDetails($pluginFile);
- $oPluginRegistry->enablePlugin($details->sNamespace);
+ $oPluginRegistry->enablePlugin($details->getNamespace());
$oPluginRegistry->setupPlugins(); //get and setup enabled plugins
- $oPluginRegistry->pluginAdapter->savePlugin($details->sNamespace, $oPluginRegistry);
- G::auditLog("EnablePlugin", "Plugin Name: " . $details->sNamespace);
- //print "size saved : $size
";
+ $oPluginRegistry->savePlugin($details->getNamespace());
+ G::auditLog("EnablePlugin", "Plugin Name: " . $details->getNamespace());
}
}
}
diff --git a/workflow/engine/methods/setup/pluginsImport.php b/workflow/engine/methods/setup/pluginsImport.php
index fccc47671..ea15dc307 100644
--- a/workflow/engine/methods/setup/pluginsImport.php
+++ b/workflow/engine/methods/setup/pluginsImport.php
@@ -43,7 +43,7 @@ if ($access != 1) {
}
}
-$oPluginRegistry = & PMPluginRegistry::getSingleton();
+$oPluginRegistry = \ProcessMaker\Plugins\PluginRegistry::loadSingleton();
$G_MAIN_MENU = 'processmaker';
$G_ID_MENU_SELECTED = 'SETUP';
$G_SUB_MENU = 'setup';
diff --git a/workflow/engine/methods/setup/pluginsImportFile.php b/workflow/engine/methods/setup/pluginsImportFile.php
index 70ee4ea9a..fcd0ca935 100644
--- a/workflow/engine/methods/setup/pluginsImportFile.php
+++ b/workflow/engine/methods/setup/pluginsImportFile.php
@@ -23,6 +23,7 @@
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
+use ProcessMaker\Plugins\PluginRegistry;
global $RBAC;
$RBAC->requirePermissions( 'PM_SETUP_ADVANCE' );
@@ -67,7 +68,7 @@ try {
$tar->extractList( $listFiles, PATH_PLUGINS . 'data');
$tar->extractList( $licenseName, PATH_PLUGINS);
- $pluginRegistry = &PMPluginRegistry::getSingleton();
+ $pluginRegistry = PluginRegistry::loadSingleton();
$autoPlugins = glob(PATH_PLUGINS . "data/enterprise/data/*.tar");
$autoPluginsA = array();
@@ -91,10 +92,9 @@ try {
}
$pluginDetail = $pluginRegistry->getPluginDetails($sClassName . ".php");
- $pluginRegistry->installPlugin($pluginDetail->sNamespace); //error
+ $pluginRegistry->installPlugin($pluginDetail->getNamespace()); //error
+ $pluginRegistry->savePlugin($pluginDetail->getNamespace());
}
-
- file_put_contents(PATH_DATA_SITE . "plugin.singleton", $pluginRegistry->serializeInstance());
$licfile = glob(PATH_PLUGINS . "*.dat");
if ((isset($licfile[0])) && ( is_file($licfile[0]) )) {
@@ -141,7 +141,7 @@ try {
$tar->extractList( $listFiles, PATH_PLUGINS . 'data');
$tar->extractList( $licenseName, PATH_PLUGINS);
- $pluginRegistry = &PMPluginRegistry::getSingleton();
+ $pluginRegistry = PluginRegistry::loadSingleton();
$autoPlugins = glob(PATH_PLUGINS . "data/plugins/*.tar");
$autoPluginsA = array();
@@ -165,11 +165,10 @@ try {
}
$pluginDetail = $pluginRegistry->getPluginDetails($sClassName . ".php");
- $pluginRegistry->installPlugin($pluginDetail->sNamespace); //error
+ $pluginRegistry->installPlugin($pluginDetail->getNamespace()); //error
+ $pluginRegistry->savePlugin($pluginDetail->getNamespace());
}
- file_put_contents(PATH_DATA_SITE . "plugin.singleton", $pluginRegistry->serializeInstance());
-
$licfile = glob(PATH_PLUGINS . "*.dat");
if ((isset($licfile[0])) && ( is_file($licfile[0]) )) {
@@ -222,7 +221,7 @@ try {
file_put_contents($pathFileFlag, 'New Enterprise');
}
- $oPluginRegistry =& ProcessMaker\Plugins\PluginsRegistry::loadSingleton();
+ $oPluginRegistry = PluginRegistry::loadSingleton();
$pluginFile = $sClassName . '.php';
if ($bMainFile && $bClassFile) {
@@ -326,13 +325,13 @@ try {
$details = $oPluginRegistry->getPluginDetails( $pluginFile );
- $oPluginRegistry->installPlugin( $details->sNamespace );
+ $oPluginRegistry->installPlugin($details->getNamespace());
$oPluginRegistry->setupPlugins(); //get and setup enabled plugins
- $oPluginRegistry->pluginAdapter->savePlugin($details->sNamespace , $oPluginRegistry);
+ $oPluginRegistry->savePlugin($details->getNamespace());
- $response = $oPluginRegistry->verifyTranslation( $details->sNamespace);
- G::auditLog("InstallPlugin", "Plugin Name: ".$details->sNamespace );
+ $response = $oPluginRegistry->verifyTranslation($details->getNamespace());
+ G::auditLog("InstallPlugin", "Plugin Name: " . $details->getNamespace());
//if ($response->recordsCountSuccess <= 0) {
//throw (new Exception( 'The plugin ' . $details->sNamespace . ' couldn\'t verify any translation item. Verified Records:' . $response->recordsCountSuccess));
diff --git a/workflow/engine/methods/setup/pluginsRemove.php b/workflow/engine/methods/setup/pluginsRemove.php
index 7e6722857..8f8d4e348 100644
--- a/workflow/engine/methods/setup/pluginsRemove.php
+++ b/workflow/engine/methods/setup/pluginsRemove.php
@@ -42,7 +42,7 @@ $filter = new InputFilter();
$pluginName = $_REQUEST['pluginUid'];
$pluginName = $filter->xssFilterHard($pluginName);
-$pluginRegistry =& ProcessMaker\Plugins\PluginsRegistry::loadSingleton();
+$pluginRegistry =& ProcessMaker\Plugins\PluginRegistry::loadSingleton();
$pluginRegistry->uninstallPlugin($pluginName);
G::auditLog('RemovePlugin','Plugin Name: '.$pluginName);
diff --git a/workflow/engine/methods/setup/pluginsSetup.php b/workflow/engine/methods/setup/pluginsSetup.php
index cf5bb3210..932a3327a 100644
--- a/workflow/engine/methods/setup/pluginsSetup.php
+++ b/workflow/engine/methods/setup/pluginsSetup.php
@@ -24,10 +24,11 @@
$pluginFile = $_GET['id'];
-$oPluginRegistry = & PMPluginRegistry::getSingleton();
+$oPluginRegistry = \ProcessMaker\Plugins\PluginRegistry::loadSingleton();
$details = $oPluginRegistry->getPluginDetails( $pluginFile );
-$xmlform = isset( $details->sPluginFolder ) ? $details->sPluginFolder . '/' . $details->sSetupPage : '';
+$folder = $details->getFolder();
+$xmlform = isset($folder) ? $folder . '/' . $details->getSetupPage() : '';
$G_MAIN_MENU = 'processmaker';
$G_ID_MENU_SELECTED = 'SETUP';
@@ -45,7 +46,7 @@ try {
if (! file_exists( PATH_PLUGINS . $xmlform . '.xml' ))
throw (new Exception( 'setup .xml file is not defined for this plugin' ));
- $Fields = $oPluginRegistry->getFieldsForPageSetup( $details->sNamespace );
+ $Fields = $oPluginRegistry->getFieldsForPageSetup( $details->getNamespace() );
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', $xmlform, '', $Fields, 'pluginsSetupSave?id=' . $pluginFile );
} catch (Exception $e) {
$aMessage['MESSAGE'] = $e->getMessage();
diff --git a/workflow/engine/methods/setup/pluginsSetupSave.php b/workflow/engine/methods/setup/pluginsSetupSave.php
index 40b0243cb..d245032f5 100644
--- a/workflow/engine/methods/setup/pluginsSetupSave.php
+++ b/workflow/engine/methods/setup/pluginsSetupSave.php
@@ -24,11 +24,11 @@
$pluginFile = $_GET['id'];
-$oPluginRegistry = & PMPluginRegistry::getSingleton();
+$oPluginRegistry = \ProcessMaker\Plugins\PluginRegistry::loadSingleton();
$details = $oPluginRegistry->getPluginDetails( $pluginFile );
try {
- $Fields = $oPluginRegistry->updateFieldsForPageSetup( $details->sNamespace, $_POST );
+ $Fields = $oPluginRegistry->updateFieldsForPageSetup( $details->getNamespace(), $_POST );
$str = "$Fields fields saved successfully!";
G::SendTemporalMessage( $str, 'info', 'string', 3, 100 );
G::Header( "location: pluginsSetup?id=$pluginFile" );
diff --git a/workflow/engine/methods/tracker/tracker_Ajax.php b/workflow/engine/methods/tracker/tracker_Ajax.php
index e9942a14e..bac877785 100644
--- a/workflow/engine/methods/tracker/tracker_Ajax.php
+++ b/workflow/engine/methods/tracker/tracker_Ajax.php
@@ -1,462 +1,461 @@
-.
- *
- * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
- * Coral Gables, FL, 33134, USA, or email info@colosa.com.
- */
-try {
-
- $filter = new InputFilter();
- $_POST = $filter->xssFilterHard($_POST);
-
- if (isset( $_POST['form']['action'] )) {
- $_POST['action'] = $_POST['form']['action'];
- }
-
- switch ($_POST['action']) {
- case 'availableCaseTrackerObjects':
- $oProcessMap = new ProcessMap();
- $oProcessMap->availableCaseTrackerObjects( $_POST['PRO_UID'] );
- break;
- case 'assignCaseTrackerObject':
- $oProcessMap = new ProcessMap();
- $cto_UID = $oProcessMap->assignCaseTrackerObject( $_POST['PRO_UID'], $_POST['OBJECT_TYPE'], $_POST['OBJECT_UID'] );
- $oProcessMap->getCaseTrackerObjectsCriteria( $_POST['PRO_UID'] );
- $infoProcess = new Process();
- $resultProcess = $infoProcess->load($_POST['PRO_UID']);
- G::auditLog('CaseTrackers','Assign Case Tracker Object ('.$cto_UID.' - '.$_POST['OBJECT_TYPE'].') in Process "'.$resultProcess['PRO_TITLE'].'"');
- echo $cto_UID;
- break;
- case 'removeCaseTrackerObject':
- $oProcessMap = new ProcessMap();
- $oProcessMap->removeCaseTrackerObject( $_POST['CTO_UID'], $_POST['PRO_UID'], $_POST['STEP_POSITION'] );
- $oProcessMap->getCaseTrackerObjectsCriteria( $_POST['PRO_UID'] );
- $infoProcess = new Process();
- $resultProcess = $infoProcess->load($_POST['PRO_UID']);
- G::auditLog('CaseTrackers','Remove Case Tracker Object ('.$_POST['CTO_UID'].') in Process "'.$resultProcess['PRO_TITLE'].'"');
- break;
- case 'upCaseTrackerObject':
- $oProcessMap = new ProcessMap();
- $oProcessMap->upCaseTrackerObject( $_POST['CTO_UID'], $_POST['PRO_UID'], $_POST['STEP_POSITION'] );
- $oProcessMap->getCaseTrackerObjectsCriteria( $_POST['PRO_UID'] );
- $infoProcess = new Process();
- $resultProcess = $infoProcess->load($_POST['PRO_UID']);
- G::auditLog('CaseTrackers','Move Up Case Tracker Object ('.$_POST['CTO_UID'].') in Process "'.$resultProcess['PRO_TITLE'].'"');
- break;
- case 'downCaseTrackerObject':
- $oProcessMap = new ProcessMap();
- $oProcessMap->downCaseTrackerObject( $_POST['CTO_UID'], $_POST['PRO_UID'], $_POST['STEP_POSITION'] );
- $oProcessMap->getCaseTrackerObjectsCriteria( $_POST['PRO_UID'] );
- $infoProcess = new Process();
- $resultProcess = $infoProcess->load($_POST['PRO_UID']);
- G::auditLog('CaseTrackers','Move Down Case Tracker Object ('.$_POST['CTO_UID'].') in Process "'.$resultProcess['PRO_TITLE'].'"');
- break;
- case 'editStagesMap':
- $oTemplatePower = new TemplatePower( PATH_TPL . 'tracker/stages_Map.html' );
- $oTemplatePower->prepare();
- $G_PUBLISH = new Publisher();
- $G_PUBLISH->AddContent( 'template', '', '', '', $oTemplatePower );
- $oHeadPublisher = & headPublisher::getSingleton();
- $oHeadPublisher->addScriptCode( '
- var pb=leimnud.dom.capture("tag.body 0");
- Sm=new stagesmap();
- Sm.options = {
- target : "sm_target",
- dataServer: "../tracker/tracker_Ajax",
- uid : "' . $_POST['PRO_UID'] . '",
- lang : "' . SYS_LANG . '",
- theme : "processmaker",
- size : {w:"780",h:"540"},
- images_dir: "/jscore/processmap/core/images/",
- rw : true,
- hideMenu : false
- };
- Sm.make();' );
- G::RenderPage( 'publish', 'raw' );
- break;
- case 'showUploadedDocumentTracker':
- require_once 'classes/model/AppDocument.php';
- require_once 'classes/model/AppDelegation.php';
- require_once 'classes/model/InputDocument.php';
- require_once 'classes/model/Users.php';
- $oAppDocument = new AppDocument();
- $oAppDocument->Fields = $oAppDocument->load( $_POST['APP_DOC_UID'] );
-
- $oInputDocument = new InputDocument();
- if ($oAppDocument->Fields['DOC_UID'] != - 1) {
- $Fields = $oInputDocument->load( $oAppDocument->Fields['DOC_UID'] );
- } else {
- $Fields = array ('INP_DOC_FORM_NEEDED' => '','FILENAME' => $oAppDocument->Fields['APP_DOC_FILENAME']);
- }
- $oCriteria = new Criteria( 'workflow' );
- $oCriteria->add( AppDelegationPeer::DEL_INDEX, $oAppDocument->Fields['DEL_INDEX'] );
- $oDataset = AppDelegationPeer::doSelectRS( $oCriteria );
- $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
- $oDataset->next();
- $aRow = $oDataset->getRow();
- $oTask = new Task();
- $aTask = $oTask->load( $aRow['TAS_UID'] );
- $Fields['ORIGIN'] = $aTask['TAS_TITLE'];
- $oUser = new Users();
- $aUser = $oUser->load( $oAppDocument->Fields['USR_UID'] );
- $Fields['CREATOR'] = $aUser['USR_FIRSTNAME'] . ' ' . $aUser['USR_LASTNAME'];
- switch ($Fields['INP_DOC_FORM_NEEDED']) {
- case 'REAL':
- $sXmlForm = 'tracker/tracker_ViewAnyInputDocument2';
- break;
- case 'VIRTUAL':
- $sXmlForm = 'tracker/tracker_ViewAnyInputDocument1';
- break;
- case 'VREAL':
- $sXmlForm = 'tracker/tracker_ViewAnyInputDocument3';
- break;
- default:
- $sXmlForm = 'tracker/tracker_ViewAnyInputDocument';
- break;
- }
- $oAppDocument->Fields['VIEW'] = G::LoadTranslation( 'ID_OPEN' );
- $oAppDocument->Fields['FILE'] = 'tracker_ShowDocument?a=' . $_POST['APP_DOC_UID'] . '&r=' . rand();
-
- //If plugin and trigger are defined for listing
- if ($oPluginRegistry->existsTrigger( PM_CASE_DOCUMENT_LIST_ARR )) {
- $oPluginRegistry = & PMPluginRegistry::getSingleton();
- $filesPluginArray = $oPluginRegistry->executeTriggers( PM_CASE_DOCUMENT_LIST_ARR, $_SESSION['APPLICATION'] );
- //Now search for the file, if exists the change the download URL
- foreach ($filesPluginArray as $file) {
- if ($file->filename == $_POST['APP_DOC_UID']) {
- $oAppDocument->Fields['FILE'] = $file->downloadScript;
- }
- }
- }
-
- $G_PUBLISH = new Publisher();
- $G_PUBLISH->AddContent( 'xmlform', 'xmlform', $sXmlForm, '', G::array_merges( $Fields, $oAppDocument->Fields ), '' );
- G::RenderPage( 'publish', 'raw' );
- break;
- case 'showGeneratedDocumentTracker':
- require_once 'classes/model/AppDocument.php';
- require_once 'classes/model/AppDelegation.php';
- $oAppDocument = new AppDocument();
- $aFields = $oAppDocument->load( $_POST['APP_DOC_UID'] );
- require_once 'classes/model/OutputDocument.php';
- $oOutputDocument = new OutputDocument();
- $aOD = $oOutputDocument->load( $aFields['DOC_UID'] );
-
- $oCriteria = new Criteria( 'workflow' );
- $oCriteria->add( AppDelegationPeer::APP_UID, $aFields['APP_UID'] );
- $oCriteria->add( AppDelegationPeer::DEL_INDEX, $aFields['DEL_INDEX'] );
- $oDataset = AppDelegationPeer::doSelectRS( $oCriteria );
- $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
- $oDataset->next();
- $aRow = $oDataset->getRow();
- $oTask = new Task();
- $aTask = $oTask->load( $aRow['TAS_UID'] );
- $aFields['ORIGIN'] = $aTask['TAS_TITLE'];
- require_once 'classes/model/Users.php';
- $oUser = new Users();
- $aUser = $oUser->load( $aFields['USR_UID'] );
- $aFields['CREATOR'] = $aUser['USR_FIRSTNAME'] . ' ' . $aUser['USR_LASTNAME'];
- $aFields['VIEW'] = G::LoadTranslation( 'ID_OPEN' );
- $aFields['FILE1'] = 'tracker_ShowOutputDocument?a=' . $aFields['APP_DOC_UID'] . '&ext=doc&random=' . rand();
- $aFields['FILE2'] = 'tracker_ShowOutputDocument?a=' . $aFields['APP_DOC_UID'] . '&ext=pdf&random=' . rand();
-
- //If plugin and trigger are defined for listing
- if ($oPluginRegistry->existsTrigger( PM_CASE_DOCUMENT_LIST_ARR )) {
- $oPluginRegistry = & PMPluginRegistry::getSingleton();
- $filesPluginArray = $oPluginRegistry->executeTriggers( PM_CASE_DOCUMENT_LIST_ARR, $aFields['APP_UID'] );
- //Now search for the file, if exists the change the download URL
- foreach ($filesPluginArray as $file) {
- if ($file->filename == $_POST['APP_DOC_UID']) {
- $aFields['FILE2'] = $file->downloadScript; // The PDF is the only one uploaded to KT
- }
- }
- }
-
- $G_PUBLISH = new Publisher();
- $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'tracker/tracker_ViewAnyOutputDocument', '', G::array_merges( $aOD, $aFields ), '' );
- G::RenderPage( 'publish', 'raw' );
- break;
- case 'load':
- $oConnection = Propel::getConnection( 'workflow' );
- $oStatement = $oConnection->prepareStatement( "CREATE TABLE IF NOT EXISTS `STAGE` (
- `STG_UID` VARCHAR( 32 ) NOT NULL ,
- `PRO_UID` VARCHAR( 32 ) NOT NULL ,
- `STG_POSX` INT( 11 ) NOT NULL DEFAULT '0',
- `STG_POSY` INT( 11 ) NOT NULL DEFAULT '0',
- `STG_INDEX` INT( 11 ) NOT NULL DEFAULT '0',
- PRIMARY KEY ( `STG_UID` )
- );" );
- $oStatement->executeQuery();
- /**
- * ************************************************************************************************************
- */
- require_once 'classes/model/Stage.php';
- require_once 'classes/model/Process.php';
- require_once 'classes/model/Task.php';
- require_once 'classes/model/AppDelegation.php';
- //$oJSON = new Services_JSON();
- $oData = Bootstrap::json_decode( stripslashes( $_POST['data'] ) );
- $oProcess = new Process();
- $aRow = $oProcess->load( $oData->uid );
- $oSM = new stdclass();
- $oSM->title = new stdclass();
- $oSM->title->label = strip_tags( $aRow['PRO_TITLE'] );
- //$oSM->title->position->x = $aRow['PRO_TITLE_X'];
- //$oSM->title->position->y = $aRow['PRO_TITLE_Y'];
- $oSM->title->position = new stdclass();
- $oSM->title->position->x = 10;
- $oSM->title->position->y = 10;
- $oSM->stages = array ();
- $oCriteria = new Criteria( 'workflow' );
- $oCriteria->addSelectColumn( StagePeer::STG_UID );
- $oCriteria->addSelectColumn( ContentPeer::CON_VALUE );
- $oCriteria->addSelectColumn( StagePeer::STG_POSX );
- $oCriteria->addSelectColumn( StagePeer::STG_POSY );
- $aConditions = array ();
- $aConditions[] = array (0 => StagePeer::STG_UID,1 => ContentPeer::CON_ID);
- $aConditions[] = array (0 => ContentPeer::CON_CATEGORY,1 => DBAdapter::getStringDelimiter() . 'STG_TITLE' . DBAdapter::getStringDelimiter());
- $aConditions[] = array (0 => ContentPeer::CON_LANG,1 => DBAdapter::getStringDelimiter() . SYS_LANG . DBAdapter::getStringDelimiter());
- $oCriteria->addJoinMC( $aConditions, Criteria::LEFT_JOIN );
- $oCriteria->add( StagePeer::PRO_UID, $oData->uid );
- $oCriteria->addAscendingOrderByColumn( StagePeer::STG_INDEX );
- $oDataset = StagePeer::doSelectRS( $oCriteria );
- $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
- $oDataset->next();
- while ($aRow1 = $oDataset->getRow()) {
- $oStage = new stdclass();
- $oStage->uid = $aRow1['STG_UID'];
- $oStage->label = strip_tags( $aRow1['CON_VALUE'] );
- $oStage->position = new stdclass();
- $oStage->position->x = (int) $aRow1['STG_POSX'];
- $oStage->position->y = (int) $aRow1['STG_POSY'];
- $oStage->derivation = new stdclass();
- $oStage->derivation->to = array ();
- if (! $oData->mode) {
- $oCriteria = new Criteria( 'workflow' );
- $oCriteria->add( TaskPeer::STG_UID, $aRow1['STG_UID'] );
- $oDataset1 = TaskPeer::doSelectRS( $oCriteria );
- $oDataset1->setFetchmode( ResultSet::FETCHMODE_ASSOC );
- $oDataset1->next();
- $aTasks = array ();
- while ($aRow2 = $oDataset1->getRow()) {
- $aTasks[] = $aRow2['TAS_UID'];
- $oDataset1->next();
- }
- $oCriteria = new Criteria( 'workflow' );
- $oCriteria->add( AppDelegationPeer::APP_UID, $_SESSION['APPLICATION'] );
- $oCriteria->add( AppDelegationPeer::TAS_UID, $aTasks, Criteria::IN );
- $oCriteria->add( $oCriteria->getNewCriterion( AppDelegationPeer::DEL_FINISH_DATE, null, Criteria::ISNULL )->addOr( $oCriteria->getNewCriterion( AppDelegationPeer::DEL_FINISH_DATE, '' ) ) );
- if (AppDelegationPeer::doCount( $oCriteria ) > 0) {
- $oStage->color = '#FF0000';
- } else {
- $oCriteria = new Criteria( 'workflow' );
- $oCriteria->add( AppDelegationPeer::APP_UID, $_SESSION['APPLICATION'] );
- $oCriteria->add( AppDelegationPeer::TAS_UID, $aTasks, Criteria::IN );
- $oCriteria->add( AppDelegationPeer::DEL_THREAD_STATUS, 'CLOSED' );
- if (AppDelegationPeer::doCount( $oCriteria ) > 0) {
- $oStage->color = '#006633';
- } else {
- $oCriteria = new Criteria( 'workflow' );
- $oCriteria->add( AppDelegationPeer::APP_UID, $_SESSION['APPLICATION'] );
- $oCriteria->add( AppDelegationPeer::TAS_UID, $aTasks, Criteria::IN );
- if (AppDelegationPeer::doCount( $oCriteria ) == 0) {
- $oStage->color = '#939598';
- }
- }
-
- }
- }
- $oSM->stages[] = $oStage;
- $oDataset->next();
- }
- foreach ($oSM->stages as $iKey => $oStage) {
- if (isset( $oSM->stages[$iKey + 1] )) {
- $oDerivation = new stdclass();
- $oDerivation->stage = $oSM->stages[$iKey + 1]->uid;
- $oSM->stages[$iKey]->derivation->to = array ($oDerivation);
- $oSM->stages[$iKey]->derivation->type = 0;
- }
- }
- //$oJSON = new Services_JSON();
- echo Bootstrap::json_encode( $oSM );
- break;
- case 'addStage':
- require_once 'classes/model/Stage.php';
- //$oJSON = new Services_JSON();
- $oData = Bootstrap::json_decode( stripslashes( $_POST['data'] ) );
- $oCriteria = new Criteria( 'workflow' );
- $oCriteria->addSelectColumn( 'STG_UID' );
- $oCriteria->add( StagePeer::PRO_UID, $oData->uid );
- $oDataset = StagePeer::doSelectRS( $oCriteria );
- $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
- $oDataset->next();
- $aStages = array ();
- $iStageNumber = 0;
- while ($aRow = $oDataset->getRow()) {
- $aStages[] = $aRow['STG_UID'];
- $iStageNumber ++;
- $oDataset->next();
- }
- if ($iStageNumber == 0) {
- $iStageNumber = 1;
- }
- $iIndex = $iStageNumber + 1;
- $bContinue = false;
- while (! $bContinue) {
- $oCriteria = new Criteria( 'workflow' );
- $oCriteria->addSelectColumn( 'COUNT(*) AS TIMES' );
- $oCriteria->add( ContentPeer::CON_ID, $aStages, Criteria::IN );
- $oCriteria->add( ContentPeer::CON_CATEGORY, 'STG_TITLE' );
- $oCriteria->add( ContentPeer::CON_LANG, SYS_LANG );
- $oCriteria->add( ContentPeer::CON_VALUE, G::LoadTranslation( 'ID_STAGE' ) . ' ' . $iStageNumber );
- $oDataset = ContentPeer::doSelectRS( $oCriteria );
- $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
- $oDataset->next();
- $aRow = $oDataset->getRow();
- if ((int) $aRow['TIMES'] > 0) {
- $iStageNumber += 1;
- } else {
- $bContinue = true;
- }
- }
- $oStage = new Stage();
- $oNewStage = new stdclass();
- $oNewStage->label = G::LoadTranslation( 'ID_STAGE' ) . ' ' . $iStageNumber;
-
- if ($oData->position->x < 0)
- $oData->position->x *= - 1;
- if ($oData->position->y < 0)
- $oData->position->y *= - 1;
-
- $oNewStage->uid = $oStage->create( array ('PRO_UID' => $oData->uid,'STG_TITLE' => $oNewStage->label,'STG_POSX' => $oData->position->x,'STG_POSY' => $oData->position->y,'STG_INDEX' => $iIndex) );
- //$oJSON = new Services_JSON();
- echo Bootstrap::json_encode( $oNewStage );
- break;
- case 'saveStagePosition':
- require_once 'classes/model/Stage.php';
- //$oJSON = new Services_JSON();
- $oData = Bootstrap::json_decode( stripslashes( $_POST['data'] ) );
- $oStage = new Stage();
- $aFields = $oStage->load( $oData->uid );
- $aFields['STG_UID'] = $oData->uid;
- $aFields['STG_POSX'] = $oData->position->x;
- $aFields['STG_POSY'] = $oData->position->y;
- $oStage->update( $aFields );
- break;
- case 'deleteStage':
- require_once 'classes/model/Stage.php';
- //$oJSON = new Services_JSON();
- $oData = Bootstrap::json_decode( stripslashes( $_POST['data'] ) );
- $oStage = new Stage();
- $aFields = $oStage->load( $oData->stg_uid );
- $oStage->remove( $oData->stg_uid );
- $oStage->reorderPositions( $aFields['PRO_UID'], $aFields['STG_INDEX'] );
- require_once 'classes/model/Task.php';
- $oCriteria1 = new Criteria( 'workflow' );
- $oCriteria1->add( TaskPeer::STG_UID, $oData->stg_uid );
- $oCriteria2 = new Criteria( 'workflow' );
- $oCriteria2->add( TaskPeer::STG_UID, '' );
- BasePeer::doUpdate( $oCriteria1, $oCriteria2, Propel::getConnection( 'workflow' ) );
- break;
- case 'editStage':
- require_once 'classes/model/Stage.php';
- //$oJSON = new Services_JSON();
- $oData = Bootstrap::json_decode( stripslashes( $_POST['data'] ) );
- $oStage = new Stage();
- $aFields = $oStage->load( $oData->stg_uid );
- $aFields['THEINDEX'] = $oData->theindex;
- $aFields['action'] = 'updateStage';
- global $G_PUBLISH;
- $G_PUBLISH = new Publisher();
- $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'tracker/tracker_StageEdit', '', $aFields, '../tracker/tracker_Ajax' );
- G::RenderPage( 'publish', 'raw' );
- break;
- case 'updateStage':
- require_once 'classes/model/Stage.php';
- $oStage = new Stage();
- $aFields = $oStage->load( $_POST['form']['STG_UID'] );
- $aFields['STG_TITLE'] = $_POST['form']['STG_TITLE'];
- $oStage->update( $aFields );
- break;
- case 'tasksAssigned':
- require_once 'classes/model/Stage.php';
- require_once 'classes/model/Task.php';
- //$oJSON = new Services_JSON();
- $oData = Bootstrap::json_decode( stripslashes( $_POST['data'] ) );
- $oCriteria = new Criteria( 'workflow' );
- $oCriteria->addSelectColumn( TaskPeer::TAS_UID );
- $oCriteria->addSelectColumn( TaskPeer::TAS_TITLE );
- $oCriteria->add( TaskPeer::STG_UID, $oData->stg_uid );
- $oCriteria->addAscendingOrderByColumn( TaskPeer::TAS_TITLE );
- global $G_PUBLISH;
- $G_PUBLISH = new Publisher();
- $G_PUBLISH->AddContent( 'propeltable', 'paged-table', 'tracker/tracker_StageTasks', $oCriteria, array ('PRO_UID' => $oData->pro_uid,'STG_UID' => $oData->stg_uid) );
- G::RenderPage( 'publish', 'raw' );
- break;
- case 'availableTasksForTheStage':
- require_once 'classes/model/Process.php';
- require_once 'classes/model/Task.php';
- $oCriteria = new Criteria( 'workflow' );
- $oCriteria->addSelectColumn( TaskPeer::TAS_UID );
- $oCriteria->addSelectColumn( TaskPeer::TAS_TITLE );
- $oCriteria->add( TaskPeer::PRO_UID, $_POST['PRO_UID'] );
- $oCriteria->add( TaskPeer::STG_UID, '' );
- $oCriteria->addAscendingOrderByColumn( TaskPeer::TAS_TITLE );
- global $G_PUBLISH;
- $G_PUBLISH = new Publisher();
- $G_PUBLISH->AddContent( 'propeltable', 'paged-table', 'tracker/tracker_AvailableStageTasks', $oCriteria, array ('STG_UID' => $_POST['STG_UID']) );
- G::RenderPage( 'publish', 'raw' );
- break;
- case 'assignTaskToStage':
- require_once 'classes/model/Task.php';
- $oCriteria1 = new Criteria( 'workflow' );
- $oCriteria1->add( TaskPeer::TAS_UID, $_POST['TAS_UID'] );
- $oCriteria2 = new Criteria( 'workflow' );
- $oCriteria2->add( TaskPeer::STG_UID, $_POST['STG_UID'] );
- BasePeer::doUpdate( $oCriteria1, $oCriteria2, Propel::getConnection( 'workflow' ) );
- break;
- case 'removeTaskFromTheStage':
- require_once 'classes/model/Task.php';
- $oCriteria1 = new Criteria( 'workflow' );
- $oCriteria1->add( TaskPeer::TAS_UID, $_POST['TAS_UID'] );
- $oCriteria2 = new Criteria( 'workflow' );
- $oCriteria2->add( TaskPeer::STG_UID, '' );
- BasePeer::doUpdate( $oCriteria1, $oCriteria2, Propel::getConnection( 'workflow' ) );
- break;
-
- case "processMapLegend":
- $arrayField = array ();
- $arrayField["sLabel1"] = G::LoadTranslation( "ID_TASK_IN_PROGRESS" );
- $arrayField["sLabel2"] = G::LoadTranslation( "ID_COMPLETED_TASK" );
- $arrayField["sLabel3"] = G::LoadTranslation( "ID_PENDING_TASK" );
- $arrayField["sLabel4"] = G::LoadTranslation( "ID_PARALLEL_TASK" );
- $arrayField["tracker"] = 1;
- $G_PUBLISH = new Publisher();
- $G_PUBLISH->AddContent( "smarty", "cases/cases_Leyends", "", "", $arrayField );
- G::RenderPage( "publish", "raw" );
- break;
- }
-} catch (Exception $oException) {
- $token = strtotime("now");
- PMException::registerErrorLog($oException, $token);
- G::outRes( G::LoadTranslation("ID_EXCEPTION_LOG_INTERFAZ", array($token)) );
- die;
-}
-
+.
+ *
+ * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
+ * Coral Gables, FL, 33134, USA, or email info@colosa.com.
+ */
+try {
+ $filter = new InputFilter();
+ $_POST = $filter->xssFilterHard($_POST);
+
+ if (isset( $_POST['form']['action'] )) {
+ $_POST['action'] = $_POST['form']['action'];
+ }
+
+ switch ($_POST['action']) {
+ case 'availableCaseTrackerObjects':
+ $oProcessMap = new ProcessMap();
+ $oProcessMap->availableCaseTrackerObjects( $_POST['PRO_UID'] );
+ break;
+ case 'assignCaseTrackerObject':
+ $oProcessMap = new ProcessMap();
+ $cto_UID = $oProcessMap->assignCaseTrackerObject( $_POST['PRO_UID'], $_POST['OBJECT_TYPE'], $_POST['OBJECT_UID'] );
+ $oProcessMap->getCaseTrackerObjectsCriteria( $_POST['PRO_UID'] );
+ $infoProcess = new Process();
+ $resultProcess = $infoProcess->load($_POST['PRO_UID']);
+ G::auditLog('CaseTrackers','Assign Case Tracker Object ('.$cto_UID.' - '.$_POST['OBJECT_TYPE'].') in Process "'.$resultProcess['PRO_TITLE'].'"');
+ echo $cto_UID;
+ break;
+ case 'removeCaseTrackerObject':
+ $oProcessMap = new ProcessMap();
+ $oProcessMap->removeCaseTrackerObject( $_POST['CTO_UID'], $_POST['PRO_UID'], $_POST['STEP_POSITION'] );
+ $oProcessMap->getCaseTrackerObjectsCriteria( $_POST['PRO_UID'] );
+ $infoProcess = new Process();
+ $resultProcess = $infoProcess->load($_POST['PRO_UID']);
+ G::auditLog('CaseTrackers','Remove Case Tracker Object ('.$_POST['CTO_UID'].') in Process "'.$resultProcess['PRO_TITLE'].'"');
+ break;
+ case 'upCaseTrackerObject':
+ $oProcessMap = new ProcessMap();
+ $oProcessMap->upCaseTrackerObject( $_POST['CTO_UID'], $_POST['PRO_UID'], $_POST['STEP_POSITION'] );
+ $oProcessMap->getCaseTrackerObjectsCriteria( $_POST['PRO_UID'] );
+ $infoProcess = new Process();
+ $resultProcess = $infoProcess->load($_POST['PRO_UID']);
+ G::auditLog('CaseTrackers','Move Up Case Tracker Object ('.$_POST['CTO_UID'].') in Process "'.$resultProcess['PRO_TITLE'].'"');
+ break;
+ case 'downCaseTrackerObject':
+ $oProcessMap = new ProcessMap();
+ $oProcessMap->downCaseTrackerObject( $_POST['CTO_UID'], $_POST['PRO_UID'], $_POST['STEP_POSITION'] );
+ $oProcessMap->getCaseTrackerObjectsCriteria( $_POST['PRO_UID'] );
+ $infoProcess = new Process();
+ $resultProcess = $infoProcess->load($_POST['PRO_UID']);
+ G::auditLog('CaseTrackers','Move Down Case Tracker Object ('.$_POST['CTO_UID'].') in Process "'.$resultProcess['PRO_TITLE'].'"');
+ break;
+ case 'editStagesMap':
+ $oTemplatePower = new TemplatePower( PATH_TPL . 'tracker/stages_Map.html' );
+ $oTemplatePower->prepare();
+ $G_PUBLISH = new Publisher();
+ $G_PUBLISH->AddContent( 'template', '', '', '', $oTemplatePower );
+ $oHeadPublisher = & headPublisher::getSingleton();
+ $oHeadPublisher->addScriptCode( '
+ var pb=leimnud.dom.capture("tag.body 0");
+ Sm=new stagesmap();
+ Sm.options = {
+ target : "sm_target",
+ dataServer: "../tracker/tracker_Ajax",
+ uid : "' . $_POST['PRO_UID'] . '",
+ lang : "' . SYS_LANG . '",
+ theme : "processmaker",
+ size : {w:"780",h:"540"},
+ images_dir: "/jscore/processmap/core/images/",
+ rw : true,
+ hideMenu : false
+ };
+ Sm.make();' );
+ G::RenderPage( 'publish', 'raw' );
+ break;
+ case 'showUploadedDocumentTracker':
+ require_once 'classes/model/AppDocument.php';
+ require_once 'classes/model/AppDelegation.php';
+ require_once 'classes/model/InputDocument.php';
+ require_once 'classes/model/Users.php';
+ $oAppDocument = new AppDocument();
+ $oAppDocument->Fields = $oAppDocument->load( $_POST['APP_DOC_UID'] );
+
+ $oInputDocument = new InputDocument();
+ if ($oAppDocument->Fields['DOC_UID'] != - 1) {
+ $Fields = $oInputDocument->load( $oAppDocument->Fields['DOC_UID'] );
+ } else {
+ $Fields = array ('INP_DOC_FORM_NEEDED' => '','FILENAME' => $oAppDocument->Fields['APP_DOC_FILENAME']);
+ }
+ $oCriteria = new Criteria( 'workflow' );
+ $oCriteria->add( AppDelegationPeer::DEL_INDEX, $oAppDocument->Fields['DEL_INDEX'] );
+ $oDataset = AppDelegationPeer::doSelectRS( $oCriteria );
+ $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
+ $oDataset->next();
+ $aRow = $oDataset->getRow();
+ $oTask = new Task();
+ $aTask = $oTask->load( $aRow['TAS_UID'] );
+ $Fields['ORIGIN'] = $aTask['TAS_TITLE'];
+ $oUser = new Users();
+ $aUser = $oUser->load( $oAppDocument->Fields['USR_UID'] );
+ $Fields['CREATOR'] = $aUser['USR_FIRSTNAME'] . ' ' . $aUser['USR_LASTNAME'];
+ switch ($Fields['INP_DOC_FORM_NEEDED']) {
+ case 'REAL':
+ $sXmlForm = 'tracker/tracker_ViewAnyInputDocument2';
+ break;
+ case 'VIRTUAL':
+ $sXmlForm = 'tracker/tracker_ViewAnyInputDocument1';
+ break;
+ case 'VREAL':
+ $sXmlForm = 'tracker/tracker_ViewAnyInputDocument3';
+ break;
+ default:
+ $sXmlForm = 'tracker/tracker_ViewAnyInputDocument';
+ break;
+ }
+ $oAppDocument->Fields['VIEW'] = G::LoadTranslation( 'ID_OPEN' );
+ $oAppDocument->Fields['FILE'] = 'tracker_ShowDocument?a=' . $_POST['APP_DOC_UID'] . '&r=' . rand();
+
+ //If plugin and trigger are defined for listing
+ if ($oPluginRegistry->existsTrigger( PM_CASE_DOCUMENT_LIST_ARR )) {
+ $oPluginRegistry = PluginRegistry::loadSingleton();
+ $filesPluginArray = $oPluginRegistry->executeTriggers( PM_CASE_DOCUMENT_LIST_ARR, $_SESSION['APPLICATION'] );
+ //Now search for the file, if exists the change the download URL
+ foreach ($filesPluginArray as $file) {
+ if ($file->filename == $_POST['APP_DOC_UID']) {
+ $oAppDocument->Fields['FILE'] = $file->downloadScript;
+ }
+ }
+ }
+
+ $G_PUBLISH = new Publisher();
+ $G_PUBLISH->AddContent( 'xmlform', 'xmlform', $sXmlForm, '', G::array_merges( $Fields, $oAppDocument->Fields ), '' );
+ G::RenderPage( 'publish', 'raw' );
+ break;
+ case 'showGeneratedDocumentTracker':
+ require_once 'classes/model/AppDocument.php';
+ require_once 'classes/model/AppDelegation.php';
+ $oAppDocument = new AppDocument();
+ $aFields = $oAppDocument->load( $_POST['APP_DOC_UID'] );
+ require_once 'classes/model/OutputDocument.php';
+ $oOutputDocument = new OutputDocument();
+ $aOD = $oOutputDocument->load( $aFields['DOC_UID'] );
+
+ $oCriteria = new Criteria( 'workflow' );
+ $oCriteria->add( AppDelegationPeer::APP_UID, $aFields['APP_UID'] );
+ $oCriteria->add( AppDelegationPeer::DEL_INDEX, $aFields['DEL_INDEX'] );
+ $oDataset = AppDelegationPeer::doSelectRS( $oCriteria );
+ $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
+ $oDataset->next();
+ $aRow = $oDataset->getRow();
+ $oTask = new Task();
+ $aTask = $oTask->load( $aRow['TAS_UID'] );
+ $aFields['ORIGIN'] = $aTask['TAS_TITLE'];
+ require_once 'classes/model/Users.php';
+ $oUser = new Users();
+ $aUser = $oUser->load( $aFields['USR_UID'] );
+ $aFields['CREATOR'] = $aUser['USR_FIRSTNAME'] . ' ' . $aUser['USR_LASTNAME'];
+ $aFields['VIEW'] = G::LoadTranslation( 'ID_OPEN' );
+ $aFields['FILE1'] = 'tracker_ShowOutputDocument?a=' . $aFields['APP_DOC_UID'] . '&ext=doc&random=' . rand();
+ $aFields['FILE2'] = 'tracker_ShowOutputDocument?a=' . $aFields['APP_DOC_UID'] . '&ext=pdf&random=' . rand();
+
+ //If plugin and trigger are defined for listing
+ if ($oPluginRegistry->existsTrigger( PM_CASE_DOCUMENT_LIST_ARR )) {
+ $oPluginRegistry = \ProcessMaker\Plugins\PluginRegistry::loadSingleton();
+ $filesPluginArray = $oPluginRegistry->executeTriggers( PM_CASE_DOCUMENT_LIST_ARR, $aFields['APP_UID'] );
+ //Now search for the file, if exists the change the download URL
+ foreach ($filesPluginArray as $file) {
+ if ($file->filename == $_POST['APP_DOC_UID']) {
+ $aFields['FILE2'] = $file->downloadScript; // The PDF is the only one uploaded to KT
+ }
+ }
+ }
+
+ $G_PUBLISH = new Publisher();
+ $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'tracker/tracker_ViewAnyOutputDocument', '', G::array_merges( $aOD, $aFields ), '' );
+ G::RenderPage( 'publish', 'raw' );
+ break;
+ case 'load':
+ $oConnection = Propel::getConnection( 'workflow' );
+ $oStatement = $oConnection->prepareStatement( "CREATE TABLE IF NOT EXISTS `STAGE` (
+ `STG_UID` VARCHAR( 32 ) NOT NULL ,
+ `PRO_UID` VARCHAR( 32 ) NOT NULL ,
+ `STG_POSX` INT( 11 ) NOT NULL DEFAULT '0',
+ `STG_POSY` INT( 11 ) NOT NULL DEFAULT '0',
+ `STG_INDEX` INT( 11 ) NOT NULL DEFAULT '0',
+ PRIMARY KEY ( `STG_UID` )
+ );" );
+ $oStatement->executeQuery();
+ /**
+ * ************************************************************************************************************
+ */
+ require_once 'classes/model/Stage.php';
+ require_once 'classes/model/Process.php';
+ require_once 'classes/model/Task.php';
+ require_once 'classes/model/AppDelegation.php';
+ //$oJSON = new Services_JSON();
+ $oData = Bootstrap::json_decode( stripslashes( $_POST['data'] ) );
+ $oProcess = new Process();
+ $aRow = $oProcess->load( $oData->uid );
+ $oSM = new stdclass();
+ $oSM->title = new stdclass();
+ $oSM->title->label = strip_tags( $aRow['PRO_TITLE'] );
+ //$oSM->title->position->x = $aRow['PRO_TITLE_X'];
+ //$oSM->title->position->y = $aRow['PRO_TITLE_Y'];
+ $oSM->title->position = new stdclass();
+ $oSM->title->position->x = 10;
+ $oSM->title->position->y = 10;
+ $oSM->stages = array ();
+ $oCriteria = new Criteria( 'workflow' );
+ $oCriteria->addSelectColumn( StagePeer::STG_UID );
+ $oCriteria->addSelectColumn( ContentPeer::CON_VALUE );
+ $oCriteria->addSelectColumn( StagePeer::STG_POSX );
+ $oCriteria->addSelectColumn( StagePeer::STG_POSY );
+ $aConditions = array ();
+ $aConditions[] = array (0 => StagePeer::STG_UID,1 => ContentPeer::CON_ID);
+ $aConditions[] = array (0 => ContentPeer::CON_CATEGORY,1 => DBAdapter::getStringDelimiter() . 'STG_TITLE' . DBAdapter::getStringDelimiter());
+ $aConditions[] = array (0 => ContentPeer::CON_LANG,1 => DBAdapter::getStringDelimiter() . SYS_LANG . DBAdapter::getStringDelimiter());
+ $oCriteria->addJoinMC( $aConditions, Criteria::LEFT_JOIN );
+ $oCriteria->add( StagePeer::PRO_UID, $oData->uid );
+ $oCriteria->addAscendingOrderByColumn( StagePeer::STG_INDEX );
+ $oDataset = StagePeer::doSelectRS( $oCriteria );
+ $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
+ $oDataset->next();
+ while ($aRow1 = $oDataset->getRow()) {
+ $oStage = new stdclass();
+ $oStage->uid = $aRow1['STG_UID'];
+ $oStage->label = strip_tags( $aRow1['CON_VALUE'] );
+ $oStage->position = new stdclass();
+ $oStage->position->x = (int) $aRow1['STG_POSX'];
+ $oStage->position->y = (int) $aRow1['STG_POSY'];
+ $oStage->derivation = new stdclass();
+ $oStage->derivation->to = array ();
+ if (! $oData->mode) {
+ $oCriteria = new Criteria( 'workflow' );
+ $oCriteria->add( TaskPeer::STG_UID, $aRow1['STG_UID'] );
+ $oDataset1 = TaskPeer::doSelectRS( $oCriteria );
+ $oDataset1->setFetchmode( ResultSet::FETCHMODE_ASSOC );
+ $oDataset1->next();
+ $aTasks = array ();
+ while ($aRow2 = $oDataset1->getRow()) {
+ $aTasks[] = $aRow2['TAS_UID'];
+ $oDataset1->next();
+ }
+ $oCriteria = new Criteria( 'workflow' );
+ $oCriteria->add( AppDelegationPeer::APP_UID, $_SESSION['APPLICATION'] );
+ $oCriteria->add( AppDelegationPeer::TAS_UID, $aTasks, Criteria::IN );
+ $oCriteria->add( $oCriteria->getNewCriterion( AppDelegationPeer::DEL_FINISH_DATE, null, Criteria::ISNULL )->addOr( $oCriteria->getNewCriterion( AppDelegationPeer::DEL_FINISH_DATE, '' ) ) );
+ if (AppDelegationPeer::doCount( $oCriteria ) > 0) {
+ $oStage->color = '#FF0000';
+ } else {
+ $oCriteria = new Criteria( 'workflow' );
+ $oCriteria->add( AppDelegationPeer::APP_UID, $_SESSION['APPLICATION'] );
+ $oCriteria->add( AppDelegationPeer::TAS_UID, $aTasks, Criteria::IN );
+ $oCriteria->add( AppDelegationPeer::DEL_THREAD_STATUS, 'CLOSED' );
+ if (AppDelegationPeer::doCount( $oCriteria ) > 0) {
+ $oStage->color = '#006633';
+ } else {
+ $oCriteria = new Criteria( 'workflow' );
+ $oCriteria->add( AppDelegationPeer::APP_UID, $_SESSION['APPLICATION'] );
+ $oCriteria->add( AppDelegationPeer::TAS_UID, $aTasks, Criteria::IN );
+ if (AppDelegationPeer::doCount( $oCriteria ) == 0) {
+ $oStage->color = '#939598';
+ }
+ }
+
+ }
+ }
+ $oSM->stages[] = $oStage;
+ $oDataset->next();
+ }
+ foreach ($oSM->stages as $iKey => $oStage) {
+ if (isset( $oSM->stages[$iKey + 1] )) {
+ $oDerivation = new stdclass();
+ $oDerivation->stage = $oSM->stages[$iKey + 1]->uid;
+ $oSM->stages[$iKey]->derivation->to = array ($oDerivation);
+ $oSM->stages[$iKey]->derivation->type = 0;
+ }
+ }
+ //$oJSON = new Services_JSON();
+ echo Bootstrap::json_encode( $oSM );
+ break;
+ case 'addStage':
+ require_once 'classes/model/Stage.php';
+ //$oJSON = new Services_JSON();
+ $oData = Bootstrap::json_decode( stripslashes( $_POST['data'] ) );
+ $oCriteria = new Criteria( 'workflow' );
+ $oCriteria->addSelectColumn( 'STG_UID' );
+ $oCriteria->add( StagePeer::PRO_UID, $oData->uid );
+ $oDataset = StagePeer::doSelectRS( $oCriteria );
+ $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
+ $oDataset->next();
+ $aStages = array ();
+ $iStageNumber = 0;
+ while ($aRow = $oDataset->getRow()) {
+ $aStages[] = $aRow['STG_UID'];
+ $iStageNumber ++;
+ $oDataset->next();
+ }
+ if ($iStageNumber == 0) {
+ $iStageNumber = 1;
+ }
+ $iIndex = $iStageNumber + 1;
+ $bContinue = false;
+ while (! $bContinue) {
+ $oCriteria = new Criteria( 'workflow' );
+ $oCriteria->addSelectColumn( 'COUNT(*) AS TIMES' );
+ $oCriteria->add( ContentPeer::CON_ID, $aStages, Criteria::IN );
+ $oCriteria->add( ContentPeer::CON_CATEGORY, 'STG_TITLE' );
+ $oCriteria->add( ContentPeer::CON_LANG, SYS_LANG );
+ $oCriteria->add( ContentPeer::CON_VALUE, G::LoadTranslation( 'ID_STAGE' ) . ' ' . $iStageNumber );
+ $oDataset = ContentPeer::doSelectRS( $oCriteria );
+ $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
+ $oDataset->next();
+ $aRow = $oDataset->getRow();
+ if ((int) $aRow['TIMES'] > 0) {
+ $iStageNumber += 1;
+ } else {
+ $bContinue = true;
+ }
+ }
+ $oStage = new Stage();
+ $oNewStage = new stdclass();
+ $oNewStage->label = G::LoadTranslation( 'ID_STAGE' ) . ' ' . $iStageNumber;
+
+ if ($oData->position->x < 0)
+ $oData->position->x *= - 1;
+ if ($oData->position->y < 0)
+ $oData->position->y *= - 1;
+
+ $oNewStage->uid = $oStage->create( array ('PRO_UID' => $oData->uid,'STG_TITLE' => $oNewStage->label,'STG_POSX' => $oData->position->x,'STG_POSY' => $oData->position->y,'STG_INDEX' => $iIndex) );
+ //$oJSON = new Services_JSON();
+ echo Bootstrap::json_encode( $oNewStage );
+ break;
+ case 'saveStagePosition':
+ require_once 'classes/model/Stage.php';
+ //$oJSON = new Services_JSON();
+ $oData = Bootstrap::json_decode( stripslashes( $_POST['data'] ) );
+ $oStage = new Stage();
+ $aFields = $oStage->load( $oData->uid );
+ $aFields['STG_UID'] = $oData->uid;
+ $aFields['STG_POSX'] = $oData->position->x;
+ $aFields['STG_POSY'] = $oData->position->y;
+ $oStage->update( $aFields );
+ break;
+ case 'deleteStage':
+ require_once 'classes/model/Stage.php';
+ //$oJSON = new Services_JSON();
+ $oData = Bootstrap::json_decode( stripslashes( $_POST['data'] ) );
+ $oStage = new Stage();
+ $aFields = $oStage->load( $oData->stg_uid );
+ $oStage->remove( $oData->stg_uid );
+ $oStage->reorderPositions( $aFields['PRO_UID'], $aFields['STG_INDEX'] );
+ require_once 'classes/model/Task.php';
+ $oCriteria1 = new Criteria( 'workflow' );
+ $oCriteria1->add( TaskPeer::STG_UID, $oData->stg_uid );
+ $oCriteria2 = new Criteria( 'workflow' );
+ $oCriteria2->add( TaskPeer::STG_UID, '' );
+ BasePeer::doUpdate( $oCriteria1, $oCriteria2, Propel::getConnection( 'workflow' ) );
+ break;
+ case 'editStage':
+ require_once 'classes/model/Stage.php';
+ //$oJSON = new Services_JSON();
+ $oData = Bootstrap::json_decode( stripslashes( $_POST['data'] ) );
+ $oStage = new Stage();
+ $aFields = $oStage->load( $oData->stg_uid );
+ $aFields['THEINDEX'] = $oData->theindex;
+ $aFields['action'] = 'updateStage';
+ global $G_PUBLISH;
+ $G_PUBLISH = new Publisher();
+ $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'tracker/tracker_StageEdit', '', $aFields, '../tracker/tracker_Ajax' );
+ G::RenderPage( 'publish', 'raw' );
+ break;
+ case 'updateStage':
+ require_once 'classes/model/Stage.php';
+ $oStage = new Stage();
+ $aFields = $oStage->load( $_POST['form']['STG_UID'] );
+ $aFields['STG_TITLE'] = $_POST['form']['STG_TITLE'];
+ $oStage->update( $aFields );
+ break;
+ case 'tasksAssigned':
+ require_once 'classes/model/Stage.php';
+ require_once 'classes/model/Task.php';
+ //$oJSON = new Services_JSON();
+ $oData = Bootstrap::json_decode( stripslashes( $_POST['data'] ) );
+ $oCriteria = new Criteria( 'workflow' );
+ $oCriteria->addSelectColumn( TaskPeer::TAS_UID );
+ $oCriteria->addSelectColumn( TaskPeer::TAS_TITLE );
+ $oCriteria->add( TaskPeer::STG_UID, $oData->stg_uid );
+ $oCriteria->addAscendingOrderByColumn( TaskPeer::TAS_TITLE );
+ global $G_PUBLISH;
+ $G_PUBLISH = new Publisher();
+ $G_PUBLISH->AddContent( 'propeltable', 'paged-table', 'tracker/tracker_StageTasks', $oCriteria, array ('PRO_UID' => $oData->pro_uid,'STG_UID' => $oData->stg_uid) );
+ G::RenderPage( 'publish', 'raw' );
+ break;
+ case 'availableTasksForTheStage':
+ require_once 'classes/model/Process.php';
+ require_once 'classes/model/Task.php';
+ $oCriteria = new Criteria( 'workflow' );
+ $oCriteria->addSelectColumn( TaskPeer::TAS_UID );
+ $oCriteria->addSelectColumn( TaskPeer::TAS_TITLE );
+ $oCriteria->add( TaskPeer::PRO_UID, $_POST['PRO_UID'] );
+ $oCriteria->add( TaskPeer::STG_UID, '' );
+ $oCriteria->addAscendingOrderByColumn( TaskPeer::TAS_TITLE );
+ global $G_PUBLISH;
+ $G_PUBLISH = new Publisher();
+ $G_PUBLISH->AddContent( 'propeltable', 'paged-table', 'tracker/tracker_AvailableStageTasks', $oCriteria, array ('STG_UID' => $_POST['STG_UID']) );
+ G::RenderPage( 'publish', 'raw' );
+ break;
+ case 'assignTaskToStage':
+ require_once 'classes/model/Task.php';
+ $oCriteria1 = new Criteria( 'workflow' );
+ $oCriteria1->add( TaskPeer::TAS_UID, $_POST['TAS_UID'] );
+ $oCriteria2 = new Criteria( 'workflow' );
+ $oCriteria2->add( TaskPeer::STG_UID, $_POST['STG_UID'] );
+ BasePeer::doUpdate( $oCriteria1, $oCriteria2, Propel::getConnection( 'workflow' ) );
+ break;
+ case 'removeTaskFromTheStage':
+ require_once 'classes/model/Task.php';
+ $oCriteria1 = new Criteria( 'workflow' );
+ $oCriteria1->add( TaskPeer::TAS_UID, $_POST['TAS_UID'] );
+ $oCriteria2 = new Criteria( 'workflow' );
+ $oCriteria2->add( TaskPeer::STG_UID, '' );
+ BasePeer::doUpdate( $oCriteria1, $oCriteria2, Propel::getConnection( 'workflow' ) );
+ break;
+
+ case "processMapLegend":
+ $arrayField = array ();
+ $arrayField["sLabel1"] = G::LoadTranslation( "ID_TASK_IN_PROGRESS" );
+ $arrayField["sLabel2"] = G::LoadTranslation( "ID_COMPLETED_TASK" );
+ $arrayField["sLabel3"] = G::LoadTranslation( "ID_PENDING_TASK" );
+ $arrayField["sLabel4"] = G::LoadTranslation( "ID_PARALLEL_TASK" );
+ $arrayField["tracker"] = 1;
+ $G_PUBLISH = new Publisher();
+ $G_PUBLISH->AddContent( "smarty", "cases/cases_Leyends", "", "", $arrayField );
+ G::RenderPage( "publish", "raw" );
+ break;
+ }
+} catch (Exception $oException) {
+ $token = strtotime("now");
+ PMException::registerErrorLog($oException, $token);
+ G::outRes( G::LoadTranslation("ID_EXCEPTION_LOG_INTERFAZ", array($token)) );
+ die;
+}
+
diff --git a/workflow/engine/skinEngine/skinEngine.php b/workflow/engine/skinEngine/skinEngine.php
index 20fe756f3..076df76ea 100644
--- a/workflow/engine/skinEngine/skinEngine.php
+++ b/workflow/engine/skinEngine/skinEngine.php
@@ -7,6 +7,8 @@
* @author Hugo Loza
*/
+use ProcessMaker\Plugins\PluginRegistry;
+
define('SE_LAYOUT_NOT_FOUND', 6);
class SkinEngine
@@ -450,7 +452,7 @@ class SkinEngine
$smarty->assign('tpl_submenu', PATH_TEMPLATE . 'submenu.html');
if (class_exists('PMPluginRegistry')) {
- $oPluginRegistry = &PMPluginRegistry::getSingleton();
+ $oPluginRegistry = PluginRegistry::loadSingleton();
$sCompanyLogo = $oPluginRegistry->getCompanyLogo('/images/processmaker.logo.jpg');
}
else {
@@ -534,7 +536,7 @@ class SkinEngine
$smarty->assign('tpl_submenu', PATH_TEMPLATE . 'submenu.html' );
if (class_exists('PMPluginRegistry')) {
- $oPluginRegistry = &PMPluginRegistry::getSingleton();
+ $oPluginRegistry = PluginRegistry::loadSingleton();
$sCompanyLogo = $oPluginRegistry->getCompanyLogo ( '/images/processmaker.logo.jpg' );
}
else
@@ -791,7 +793,7 @@ class SkinEngine
}
}
if (class_exists('PMPluginRegistry') && defined("SYS_SYS")) {
- $oPluginRegistry = &PMPluginRegistry::getSingleton();
+ $oPluginRegistry = PluginRegistry::loadSingleton();
if ( isset($sFotoSelect) && $sFotoSelect!='' && !(strcmp($sWspaceSelect, SYS_SYS)) ){
$sCompanyLogo = $oPluginRegistry->getCompanyLogo($sFotoSelect);
$sCompanyLogo = "/sys".SYS_SYS."/".SYS_LANG."/".SYS_SKIN."/setup/showLogoFile.php?id=".base64_encode($sCompanyLogo);
diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/ActionsByEmail.php b/workflow/engine/src/ProcessMaker/BusinessModel/ActionsByEmail.php
index bf8a890fa..4a66a77bd 100644
--- a/workflow/engine/src/ProcessMaker/BusinessModel/ActionsByEmail.php
+++ b/workflow/engine/src/ProcessMaker/BusinessModel/ActionsByEmail.php
@@ -2,6 +2,8 @@
namespace ProcessMaker\BusinessModel;
+use ProcessMaker\Plugins\PluginRegistry;
+
/**
* Description of ActionsByEmailService
*
@@ -688,7 +690,7 @@ class ActionsByEmail
/*----------------------------------********---------------------------------*/
if (defined('PM_SINGLE_SIGN_ON')) {
- $pluginRegistry = &\PMPluginRegistry::getSingleton();
+ $pluginRegistry = PluginRegistry::loadSingleton();
if ($pluginRegistry->existsTrigger(PM_SINGLE_SIGN_ON)) {
if ($pluginRegistry->executeTriggers(PM_SINGLE_SIGN_ON, null)) {
diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/CaseScheduler.php b/workflow/engine/src/ProcessMaker/BusinessModel/CaseScheduler.php
index 88dccc28f..e43a1e6fb 100644
--- a/workflow/engine/src/ProcessMaker/BusinessModel/CaseScheduler.php
+++ b/workflow/engine/src/ProcessMaker/BusinessModel/CaseScheduler.php
@@ -2,6 +2,8 @@
namespace ProcessMaker\BusinessModel;
use \G;
+use ProcessMaker\Plugins\Interfaces\CaseSchedulerPlugin;
+use ProcessMaker\Plugins\PluginRegistry;
class CaseScheduler
{
@@ -1115,13 +1117,13 @@ class CaseScheduler
//Plugin
if (isset($arrayData["CASE_SH_PLUGIN_UID"]) && $arrayData["CASE_SH_PLUGIN_UID"] != "") {
- $oPluginRegistry = &\PMPluginRegistry::getSingleton();
+ $oPluginRegistry = PluginRegistry::loadSingleton();
$activePluginsForCaseScheduler = $oPluginRegistry->getCaseSchedulerPlugins();
$params = explode("--", $arrayData["CASE_SH_PLUGIN_UID"]);
-
- foreach ($activePluginsForCaseScheduler as $key => $caseSchedulerPluginDetail) {
- if ($caseSchedulerPluginDetail->sNamespace == $params[0] && $caseSchedulerPluginDetail->sActionId == $params[1]) {
+ /** @var CaseSchedulerPlugin $caseSchedulerPluginDetail */
+ foreach ($activePluginsForCaseScheduler as $caseSchedulerPluginDetail) {
+ if ($caseSchedulerPluginDetail->equalNamespaceTo($params[0]) && $caseSchedulerPluginDetail->equalActionIdTo($params[1])) {
$caseSchedulerSelected = $caseSchedulerPluginDetail;
}
}
@@ -1129,7 +1131,7 @@ class CaseScheduler
if (isset($caseSchedulerSelected) && is_object($caseSchedulerSelected)) {
//Save the form
$arrayDataPlugin["SCH_UID"] = $arrayCaseSchedulerData["SCH_UID"];
- $oPluginRegistry->executeMethod($caseSchedulerPluginDetail->sNamespace, $caseSchedulerPluginDetail->sActionSave, $arrayDataPlugin);
+ $oPluginRegistry->executeMethod($caseSchedulerPluginDetail->getNamespace(), $caseSchedulerPluginDetail->getActionSave(), $arrayDataPlugin);
}
}
} catch (\Exception $e) {
diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Cases.php b/workflow/engine/src/ProcessMaker/BusinessModel/Cases.php
index e97ab85a0..adaca0c95 100644
--- a/workflow/engine/src/ProcessMaker/BusinessModel/Cases.php
+++ b/workflow/engine/src/ProcessMaker/BusinessModel/Cases.php
@@ -2,6 +2,7 @@
namespace ProcessMaker\BusinessModel;
use \G;
+use ProcessMaker\Plugins\PluginRegistry;
use \UsersPeer;
use \CasesPeer;
@@ -1098,12 +1099,11 @@ class Cases
$cases = new \cases();
$listing = false;
- $oPluginRegistry = & \PMPluginRegistry::getSingleton();
+ $oPluginRegistry = PluginRegistry::loadSingleton();
if ($oPluginRegistry->existsTrigger(PM_CASE_DOCUMENT_LIST)) {
$folderData = new \folderData(null, null, $sApplicationUID, null, $sUserUID);
$folderData->PMType = "INPUT";
$folderData->returnList = true;
- //$oPluginRegistry = & PMPluginRegistry::getSingleton();
$listing = $oPluginRegistry->executeTriggers(PM_CASE_DOCUMENT_LIST, $folderData);
}
$aObjectPermissions = $cases->getAllObjects($sProcessUID, $sApplicationUID, $sTasKUID, $sUserUID);
@@ -1396,12 +1396,11 @@ class Cases
$cases = new \cases();
$listing = false;
- $oPluginRegistry = & \PMPluginRegistry::getSingleton();
+ $oPluginRegistry = PluginRegistry::loadSingleton();
if ($oPluginRegistry->existsTrigger(PM_CASE_DOCUMENT_LIST)) {
$folderData = new \folderData(null, null, $sApplicationUID, null, $sUserUID);
$folderData->PMType = "OUTPUT";
$folderData->returnList = true;
- //$oPluginRegistry = & PMPluginRegistry::getSingleton();
$listing = $oPluginRegistry->executeTriggers(PM_CASE_DOCUMENT_LIST, $folderData);
}
$aObjectPermissions = $cases->getAllObjects($sProcessUID, $sApplicationUID, $sTasKUID, $sUserUID);
diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Cases/InputDocument.php b/workflow/engine/src/ProcessMaker/BusinessModel/Cases/InputDocument.php
index dfceadf74..7f79c3aed 100644
--- a/workflow/engine/src/ProcessMaker/BusinessModel/Cases/InputDocument.php
+++ b/workflow/engine/src/ProcessMaker/BusinessModel/Cases/InputDocument.php
@@ -1,6 +1,8 @@
updateCase($appUid, $aData);
//Plugin Hook PM_UPLOAD_DOCUMENT for upload document
- $oPluginRegistry = &\PMPluginRegistry::getSingleton();
+ $oPluginRegistry = PluginRegistry::loadSingleton();
if ($oPluginRegistry->existsTrigger(PM_UPLOAD_DOCUMENT) && class_exists("uploadDocumentData")) {
$triggerDetail = $oPluginRegistry->getTriggerInfo(PM_UPLOAD_DOCUMENT);
@@ -1014,7 +1016,7 @@ class InputDocument
$uploadReturn = $oPluginRegistry->executeTriggers(PM_UPLOAD_DOCUMENT, $documentData);
if ($uploadReturn) {
- $aFields["APP_DOC_PLUGIN"] = $triggerDetail->sNamespace;
+ $aFields["APP_DOC_PLUGIN"] = $triggerDetail->getNamespace();
if (!isset($aFields["APP_DOC_UID"])) {
$aFields["APP_DOC_UID"] = $sAppDocUid;
}
diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Cases/OutputDocument.php b/workflow/engine/src/ProcessMaker/BusinessModel/Cases/OutputDocument.php
index ae7a6cf85..131de7047 100644
--- a/workflow/engine/src/ProcessMaker/BusinessModel/Cases/OutputDocument.php
+++ b/workflow/engine/src/ProcessMaker/BusinessModel/Cases/OutputDocument.php
@@ -1,6 +1,8 @@
loadCase( $applicationUid );
$sProcessUID = $fields['PRO_UID'];
@@ -244,7 +245,6 @@ class OutputDocument
try {
$sApplicationUID = $applicationUid;
$sUserUID = $userUid;
-
$oCase = new \Cases();
$fields = $oCase->loadCase( $sApplicationUID );
$sProcessUID = $fields['PRO_UID'];
@@ -442,7 +442,6 @@ class OutputDocument
$outputID = $outputDocumentUid;
$g = new \G();
$g->sessionVarSave();
-
$oCase = new \Cases();
$oCase->thisIsTheCurrentUser( $sApplication, $index, $sUserLogged, '', 'casesListExtJs' );
//require_once 'classes/model/OutputDocument.php';
@@ -526,11 +525,10 @@ class OutputDocument
$this->generate( $outputID, $Fields['APP_DATA'], $pathOutput, $sFilename, $aOD['OUT_DOC_TEMPLATE'], (boolean) $aOD['OUT_DOC_LANDSCAPE'], $aOD['OUT_DOC_GENERATE'], $aProperties , $applicationUid);
//Plugin Hook PM_UPLOAD_DOCUMENT for upload document
-
- $oPluginRegistry = & \PMPluginRegistry::getSingleton();
+ $oPluginRegistry = PluginRegistry::loadSingleton();
if ($oPluginRegistry->existsTrigger( PM_UPLOAD_DOCUMENT ) && class_exists( 'uploadDocumentData' )) {
$triggerDetail = $oPluginRegistry->getTriggerInfo( PM_UPLOAD_DOCUMENT );
- $aFields['APP_DOC_PLUGIN'] = $triggerDetail->sNamespace;
+ $aFields['APP_DOC_PLUGIN'] = $triggerDetail->getNamespace();
$oAppDocument1 = new \AppDocument();
$oAppDocument1->update( $aFields );
$sPathName = PATH_DOCUMENT . \G::getPathFromUID($sApplication) . PATH_SEP;
diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Migrator/ExportObjects.php b/workflow/engine/src/ProcessMaker/BusinessModel/Migrator/ExportObjects.php
index 5198533ac..62dd0cb46 100644
--- a/workflow/engine/src/ProcessMaker/BusinessModel/Migrator/ExportObjects.php
+++ b/workflow/engine/src/ProcessMaker/BusinessModel/Migrator/ExportObjects.php
@@ -1,6 +1,8 @@
getPluginsData();
foreach ($data as $detail) {
$detail = (array)$detail;
diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Migrator/PluginMigratorAdapter.php b/workflow/engine/src/ProcessMaker/BusinessModel/Migrator/PluginMigratorAdapter.php
index 5862c147c..e7ca88c67 100644
--- a/workflow/engine/src/ProcessMaker/BusinessModel/Migrator/PluginMigratorAdapter.php
+++ b/workflow/engine/src/ProcessMaker/BusinessModel/Migrator/PluginMigratorAdapter.php
@@ -1,6 +1,8 @@
getPluginByCode($pluginName);
require_once (
PATH_PLUGINS.PATH_SEP.
diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Process.php b/workflow/engine/src/ProcessMaker/BusinessModel/Process.php
index f903725ca..4772d0960 100644
--- a/workflow/engine/src/ProcessMaker/BusinessModel/Process.php
+++ b/workflow/engine/src/ProcessMaker/BusinessModel/Process.php
@@ -794,16 +794,6 @@ class Process
switch ($option) {
case "CREATE":
$processUid = $process->create($arrayProcessData, false);
-
- //Call plugins
- //$arrayData = array(
- // "PRO_UID" => $processUid,
- // "PRO_TEMPLATE" => (isset($arrayProcessData["PRO_TEMPLATE"]) && $arrayProcessData["PRO_TEMPLATE"] != "")? $arrayProcessData["PRO_TEMPLATE"] : "",
- // "PROCESSMAP" => $this //?
- //);
- //
- //$oPluginRegistry = &PMPluginRegistry::getSingleton();
- //$oPluginRegistry->executeTriggers(PM_NEW_PROCESS_SAVE, $arrayData);
break;
case "UPDATE":
$result = $process->update($arrayProcessData);
diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Step.php b/workflow/engine/src/ProcessMaker/BusinessModel/Step.php
index 7e53f4a56..0b2ccf257 100644
--- a/workflow/engine/src/ProcessMaker/BusinessModel/Step.php
+++ b/workflow/engine/src/ProcessMaker/BusinessModel/Step.php
@@ -1,6 +1,9 @@
getSteps();
$criteria = new \Criteria("workflow");
@@ -579,9 +582,10 @@ class Step
$titleObj = "unknown " . $row["STEP_UID"];
if (is_array($externalSteps) && count($externalSteps) > 0) {
- foreach ($externalSteps as $key => $value) {
- if ($value->sStepId == $row["STEP_UID_OBJ"]) {
- $titleObj = $value->sStepTitle;
+ /** @var StepDetail $value */
+ foreach ($externalSteps as $value) {
+ if ($value->equalStepIdTo($row["STEP_UID_OBJ"])) {
+ $titleObj = $value->getStepTitle();
}
}
}
diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Task.php b/workflow/engine/src/ProcessMaker/BusinessModel/Task.php
index 1dd0e9c11..de60593a5 100644
--- a/workflow/engine/src/ProcessMaker/BusinessModel/Task.php
+++ b/workflow/engine/src/ProcessMaker/BusinessModel/Task.php
@@ -2,6 +2,8 @@
namespace ProcessMaker\BusinessModel;
use \G;
+use ProcessMaker\Plugins\Interfaces\StepDetail;
+use ProcessMaker\Plugins\PluginRegistry;
use \ProcessMaker\Util;
class Task
@@ -627,14 +629,15 @@ class Task
}
//Call plugin
- $pluginRegistry = &\PMPluginRegistry::getSingleton();
+ $pluginRegistry = PluginRegistry::loadSingleton();
$externalSteps = $pluginRegistry->getSteps();
if (is_array($externalSteps) && count($externalSteps) > 0) {
- foreach ($externalSteps as $key => $value) {
+ /** @var StepDetail $value */
+ foreach ($externalSteps as $value) {
$arraydbStep[] = array(
- $this->getFieldNameByFormatFieldName("OBJ_UID") => $value->sStepId,
- $this->getFieldNameByFormatFieldName("OBJ_TITLE") => $value->sStepTitle,
+ $this->getFieldNameByFormatFieldName("OBJ_UID") => $value->getStepId(),
+ $this->getFieldNameByFormatFieldName("OBJ_TITLE") => $value->getStepTitle(),
$this->getFieldNameByFormatFieldName("OBJ_DESCRIPTION") => "",
$this->getFieldNameByFormatFieldName("OBJ_TYPE") => "EXTERNAL"
);
diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/User.php b/workflow/engine/src/ProcessMaker/BusinessModel/User.php
index 3a117fbf0..3bf5d1759 100644
--- a/workflow/engine/src/ProcessMaker/BusinessModel/User.php
+++ b/workflow/engine/src/ProcessMaker/BusinessModel/User.php
@@ -1,6 +1,7 @@
userObj = new \RbacUsers();
if (class_exists('PMPluginRegistry')) {
- $pluginRegistry = & \PMPluginRegistry::getSingleton();
+ $pluginRegistry = PluginRegistry::loadSingleton();
if ($pluginRegistry->existsTrigger(PM_BEFORE_CREATE_USER)) {
try {
$pluginRegistry->executeTriggers(PM_BEFORE_CREATE_USER, null);
diff --git a/workflow/engine/src/ProcessMaker/Plugins/Adapters/PluginAdapter.php b/workflow/engine/src/ProcessMaker/Plugins/Adapters/PluginAdapter.php
index 093005c73..1764e7ab2 100644
--- a/workflow/engine/src/ProcessMaker/Plugins/Adapters/PluginAdapter.php
+++ b/workflow/engine/src/ProcessMaker/Plugins/Adapters/PluginAdapter.php
@@ -3,251 +3,236 @@
namespace ProcessMaker\Plugins\Adapters;
use PMPluginRegistry;
-use ProcessMaker\Plugins\Interfaces\Plugins;
-use ProcessMaker\Plugins\PluginsRegistry;
+/**
+ * Adapts the plugin singleton file and converts it to table
+ * Class PluginAdapter
+ * @package ProcessMaker\Plugins\Adapters
+ */
class PluginAdapter
{
- protected $pluginRegistry;
/**
- * @var array $aliasNameAttributes
+ * This array is a map to change the old key to the new, corresponding of each class
+ * @var array
*/
- private $aliasNameAttributes = [
- 'sNamespace' => 'PLUGIN_NAMESPACE',
- 'sDescription' => 'PLUGIN_DESCRIPTION',
- 'sClassName' => 'CLASS_NAME',
- 'sFriendlyName' => 'FRIENDLY_NAME',
- 'sFilename' => 'FILE_NAME',
- 'sPluginFolder' => 'PLUGIN_FOLDER',
- 'iVersion' => 'PLUGIN_VERSION',
- 'enabled' => 'PLUGIN_ENABLE',
- 'bPrivate' => 'PLUGIN_PRIVATE',
- '_aMenus' => 'PLUGIN_MENUS',
- '_aFolders' => 'PLUGIN_FOLDERS',
- '_aTriggers' => 'PLUGIN_TRIGGERS',
- '_aPmFunctions' => 'PLUGIN_PM_FUNCTIONS',
- '_aRedirectLogin' => 'PLUGIN_REDIRECT_LOGIN',
- '_aSteps' => 'PLUGIN_STEPS',
- '_aCSSStyleSheets' => 'PLUGIN_CSS',
- '_aJavascripts' => 'PLUGIN_JS',
- '_restServices' => 'PLUGIN_REST_SERVICE',
+ private $keyNames = [
+ 'sNamespace' => 'Namespace',
+ //MenuDetail
+ 'sMenuId' => 'MenuId',
+ 'sFilename' => 'Filename',
+ //FolderDetail
+ 'sFolderId' => 'FolderId',
+ 'sFolderName' => 'FolderName',
+ //TriggerDetail
+ 'sTriggerId' => 'TriggerId',
+ 'sTriggerName' => 'TriggerName',
+ //RedirectDetail
+ 'sRoleCode' => 'RoleCode',
+ 'sPathMethod' => 'PathMethod',
+ //StepDetail
+ 'sStepId' => 'StepId',
+ 'sStepName' => 'StepName',
+ 'sStepTitle' => 'StepTitle',
+ 'sSetupStepPage' => 'SetupStepPage',
+ //CssFile->_aCSSStyleSheets
+ 'sCssFile' => 'CssFile',
+ //ToolbarDetail->_aToolbarFiles
+ 'sToolbarId' => 'ToolbarId',
+ //CaseSchedulerPlugin->_aCaseSchedulerPlugin
+ 'sActionId' => 'ActionId',
+ 'sActionForm' => 'ActionForm',
+ 'sActionSave' => 'ActionSave',
+ 'sActionExecute' => 'ActionExecute',
+ 'sActionGetFields' => 'ActionGetFields',
+ //TaskExtendedProperty->_aTaskExtendedProperties
+ //DashboardPage->_aDashboardPages
+ 'sPage' => 'Page',
+ 'sName' => 'Name',
+ 'sIcon' => 'Icon',
+ //CronFile->_aCronFiles
+ 'namespace' => 'Namespace',
+ 'cronFile' => 'CronFile',
+ //ImportCallBack->_aImportProcessCallbackFile
+ //OpenReassignCallback->_aOpenReassignCallback
+ 'callBackFile' => 'CallBackFile',
+ //JsFile->_aJavascripts
+ 'sCoreJsFile' => 'CoreJsFile',
+ 'pluginJsFile' => 'PluginJsFile',
];
/**
- * @param PMPluginRegistry|PluginsRegistry $pluginsSingleton
+ * Map the fields of the table with their type
+ * @var array $attributes
*/
- public function save($pluginsSingleton)
- {
- $this->pluginRegistry = \G::json_decode(\G::json_encode($pluginsSingleton->iterateVisible()));
- foreach ($this->pluginRegistry->_aPluginDetails as $nameSpace => $value) {
- $this->savePluginMigrate($nameSpace, $this->pluginRegistry);
- }
- }
-
- public function savePluginMigrate($sNamespace, $pluginRegistry)
- {
- $structurePlugin = $this->getOldPluginStructure($sNamespace, $pluginRegistry);
- $plugin = $this->diffFieldTable($structurePlugin);
- if ($plugin['PLUGIN_NAMESPACE']) {
- $fieldPlugin = \PluginsRegistry::loadOrCreateIfNotExists(md5($plugin['PLUGIN_NAMESPACE']), $plugin);
- \PluginsRegistry::update($fieldPlugin);
- }
- }
-
- public function savePlugin($sNamespace, $pluginRegistry)
- {
- $structurePlugin = $this->getPluginStructure($sNamespace, $pluginRegistry);
- $plugin = $this->diffFieldTable($structurePlugin);
- if ($plugin['PLUGIN_NAMESPACE']) {
- $fieldPlugin = \PluginsRegistry::loadOrCreateIfNotExists(md5($plugin['PLUGIN_NAMESPACE']), $plugin);
- \PluginsRegistry::update($fieldPlugin);
- }
- }
+ private $attributes = [
+ 'sNamespace' => ['name' => 'PLUGIN_NAMESPACE', 'type' => 'string'],
+ 'sDescription' => ['name' => 'PLUGIN_DESCRIPTION', 'type' => 'string'],
+ 'sClassName' => ['name' => 'PLUGIN_CLASS_NAME', 'type' => 'string'],
+ 'sFriendlyName' => ['name' => 'PLUGIN_FRIENDLY_NAME', 'type' => 'string'],
+ 'sFilename' => ['name' => 'PLUGIN_FILE', 'type' => 'string'],
+ 'sPluginFolder' => ['name' => 'PLUGIN_FOLDER', 'type' => 'string'],
+ 'sSetupPage' => ['name' => 'PLUGIN_SETUP_PAGE', 'type' => 'string'],
+ 'aWorkspaces' => ['name' => 'PLUGIN_WORKSPACES', 'type' => 'array'],
+ 'sCompanyLogo' => ['name' => 'PLUGIN_COMPANY_LOGO', 'type' => 'string'],
+ 'iVersion' => ['name' => 'PLUGIN_VERSION', 'type' => 'int'],
+ 'enabled' => ['name' => 'PLUGIN_ENABLE', 'type' => 'bool'],
+ 'bPrivate' => ['name' => 'PLUGIN_PRIVATE', 'type' => 'bool'],
+ '_aMenus' => ['name' => 'PLUGIN_MENUS', 'type' => 'array'],
+ '_aFolders' => ['name' => 'PLUGIN_FOLDERS', 'type' => 'array'],
+ '_aTriggers' => ['name' => 'PLUGIN_TRIGGERS', 'type' => 'array'],
+ '_aPmFunctions' => ['name' => 'PLUGIN_PM_FUNCTIONS', 'type' => 'array'],
+ '_aRedirectLogin' => ['name' => 'PLUGIN_REDIRECT_LOGIN', 'type' => 'array'],
+ '_aSteps' => ['name' => 'PLUGIN_STEPS', 'type' => 'array'],
+ '_aCSSStyleSheets' => ['name' => 'PLUGIN_CSS', 'type' => 'array'],
+ '_aCss' => ['name' => 'PLUGIN_CSS', 'type' => 'array'],
+ '_aJavascripts' => ['name' => 'PLUGIN_JS', 'type' => 'array'],
+ '_aJs' => ['name' => 'PLUGIN_JS', 'type' => 'array'],
+ '_restServices' => ['name' => 'PLUGIN_REST_SERVICE', 'type' => 'array'],
+ ];
/**
- * @param string $nameSpace
- * @param object $pluginsRegistry
+ * Data of the plugin singleton in array structure
+ * @var array $PMPluginRegistry
+ */
+ private $PMPluginRegistry;
+
+ /**
+ * Returns the structure of the table in attributes
* @return array
*/
- public function getOldPluginStructure($nameSpace, $pluginsRegistry)
+ public function getAttributes()
{
- $pluginRegistry = clone $pluginsRegistry;
- $structurePlugins = $pluginRegistry->_aPluginDetails->{$nameSpace};
- unset($pluginRegistry->_aPluginDetails);
- $aPlugins = isset($pluginRegistry->_aPlugins->{$nameSpace}) ? $pluginRegistry->_aPlugins->{$nameSpace} : [];
- $structurePlugins = array_merge((array)$structurePlugins, (array)$aPlugins);
- unset($pluginRegistry->_aPlugins);
- foreach ($pluginRegistry as $propertyName => $propertyValue) {
- foreach ($propertyValue as $key => $plugin) {
- if (is_object($plugin) &&
- (
- (property_exists($plugin, 'sNamespace') && $plugin->sNamespace == $nameSpace) ||
- (!is_int($key) && $key == $nameSpace)
- )
- ) {
- $structurePlugins[$propertyName][] = $plugin;
- } elseif (is_object($plugin) &&
- property_exists($plugin, 'pluginName') &&
- $plugin->pluginName == $nameSpace
- ) {
- $structurePlugins[$propertyName][] = $plugin;
- } elseif (is_string($plugin) && $plugin == $nameSpace) {
- $structurePlugins[$propertyName][] = $plugin;
- }
- }
- }
- return $structurePlugins;
+ return $this->attributes;
}
/**
- * @param string $nameSpace
- * @param object $pluginsRegistry
- * @return array
+ * Migrate the singleton plugin to tables
+ * @param PMPluginRegistry $PMPluginsSingleton
*/
- public function getPluginStructure($nameSpace, $pluginsRegistry)
+ public function migrate($PMPluginsSingleton)
{
- $pluginRegistry = clone $pluginsRegistry;
- $structurePlugins = $pluginRegistry->_aPluginDetails[$nameSpace];
- unset($pluginRegistry->_aPluginDetails);
- $aPlugins = isset($pluginRegistry->_aPlugins[$nameSpace]) ? $pluginRegistry->_aPlugins[$nameSpace] : [];
- $structurePlugins = array_merge((array)$structurePlugins, get_object_vars($aPlugins));
- unset($pluginRegistry->_aPlugins);
- foreach ($pluginRegistry as $propertyName => $propertyValue) {
- foreach ($propertyValue as $key => $plugin) {
- if (is_object($plugin) &&
- (
- (property_exists($plugin, 'sNamespace') && $plugin->sNamespace == $nameSpace) ||
- (!is_int($key) && $key == $nameSpace)
- )
- ) {
- $structurePlugins[$propertyName][] = $plugin;
- } elseif (is_object($plugin) &&
- property_exists($plugin, 'pluginName') &&
- $plugin->pluginName == $nameSpace
- ) {
- $structurePlugins[$propertyName][] = $plugin;
- } elseif (is_array($plugin) && $key == $nameSpace) {
- $structurePlugins[$propertyName][$key] = $plugin;
- } elseif (is_bool($plugin) && $key == $nameSpace) {
- $structurePlugins[$propertyName][$key] = $plugin;
- } elseif (is_string($plugin) && $plugin == $nameSpace) {
- $structurePlugins[$propertyName][] = $plugin;
- }
- }
+ $this->PMPluginRegistry = \G::json_decode(\G::json_encode($PMPluginsSingleton->getAttributes()), true);
+ $this->parserNameKey();
+ foreach ($this->PMPluginRegistry['_aPluginDetails'] as $nameSpace => $value) {
+ $this->saveInTable($nameSpace, $this->PMPluginRegistry);
}
- return $structurePlugins;
}
/**
- * @param $plugin
- * @return array
- */
- public function diffFieldTable($plugin)
- {
- $fields = [];
- $map = \PluginsRegistryPeer::getTableMap();
- $columns = $map->getColumns();
- $attributes = array_diff_key((array)$plugin, $this->aliasNameAttributes);
- $fieldsTMP = array_intersect_key((array)$plugin, $this->aliasNameAttributes);
- foreach ($this->aliasNameAttributes as $name => $nameTable) {
- if (array_key_exists($name, $fieldsTMP)) {
- switch (gettype($fieldsTMP[$name])) {
- case 'string':
- $valueField = array_key_exists($name, $fieldsTMP) ? $fieldsTMP[$name] : '';
- break;
- case 'array':
- $valueField = array_key_exists($name, $fieldsTMP) ? $fieldsTMP[$name] : [];
- $valueField = \G::json_encode($valueField);
- break;
- case 'integer':
- $valueField = array_key_exists($name, $fieldsTMP) ? $fieldsTMP[$name] : 0;
- break;
- case 'boolean':
- $valueField = array_key_exists($name, $fieldsTMP) ? ($fieldsTMP[$name] ? true : false ): false;
- break;
- case 'NULL':
- default:
- $valueField = array_key_exists($name, $fieldsTMP) ?
- $fieldsTMP[$name] :
- $this->getDefaultValueType($columns[$nameTable]->getType());
- break;
- }
- } else {
- $valueField = $this->getDefaultValueType($columns[$nameTable]->getType());
- }
- $fields[$nameTable] = $valueField;
- }
- $fields['PLUGIN_ATTRIBUTES'] = \G::json_encode($attributes);
- return $fields;
- }
-
- public function getDefaultValueType($var)
- {
- switch ($var) {
- case 'string':
- $response = '';
- break;
- case 'int':
- $response = 0;
- break;
- case 'boolean':
- $response = false;
- break;
- default:
- $response = '';
- break;
- }
- return $response;
- }
-
- /**
- * @param PluginsRegistry $oPlugins
+ * Change to new key property $keyNames
* @return mixed
*/
- public function getPluginsDefinition($oPlugins)
+ private function parserNameKey()
{
- $oldStructure = $this->convertArrayStructure();
- $oPlugins->setPlugins($oldStructure);
- $oPlugins = $this->populateAttributes($oPlugins, $oldStructure);
- return $oPlugins;
- }
-
- public function convertArrayStructure()
- {
- $invertAlias = array_flip($this->aliasNameAttributes);
- $plugins = \PluginsRegistry::loadPlugins();
- $pluginsRegistry = [];
- foreach ($plugins as $index => $plugin) {
- $namePlugin = $plugin['PLUGIN_NAMESPACE'];
- $pluginsRegistry[$namePlugin] = new \stdClass();
- array_walk($plugin, function ($value, $key) use ($invertAlias, &$pluginsRegistry, $namePlugin) {
- if (array_key_exists($key, $invertAlias)) {
- $pluginsRegistry[$namePlugin]->{$invertAlias[$key]} = !is_null($data = \G::json_decode($value)) ?
- $data :
- (!empty($value) ? $value : []);
- }
- });
- $moreAttributes = \G::json_decode($plugin['PLUGIN_ATTRIBUTES']);
- $pluginsRegistry[$namePlugin] = Plugins::setter(array_merge(
- (array)$pluginsRegistry[$namePlugin],
- $moreAttributes ? (array)$moreAttributes : []
- ));
- }
- return $pluginsRegistry;
- }
-
- public function populateAttributes($oPlugins, $structures)
- {
- foreach ($structures as $namePlugin => $plugin) {
- foreach ($plugin as $nameAttribute => $detail) {
- if ($detail &&
- property_exists($oPlugins, $nameAttribute) &&
- $plugin->_aPluginDetails[$namePlugin]->enabled
- ) {
- $oPlugins->{$nameAttribute} = array_merge($oPlugins->{$nameAttribute}, (array)$detail);
+ $aPluginDetails = $this->PMPluginRegistry['_aPluginDetails'];
+ unset($this->PMPluginRegistry['_aPluginDetails']);
+ $aPlugins = $this->PMPluginRegistry['_aPlugins'];
+ unset($this->PMPluginRegistry['_aPlugins']);
+ foreach ($this->PMPluginRegistry as $propertyKey => $propertyValue) {
+ foreach ($propertyValue as $attKey => $attributes) {
+ if (is_array($attributes)) {
+ foreach ($attributes as $index => $attribute) {
+ if (array_key_exists($index, $this->keyNames)) {
+ $newKey = $this->keyNames[$index];
+ $value = $this->PMPluginRegistry[$propertyKey][$attKey][$index];
+ $this->PMPluginRegistry[$propertyKey][$attKey][$newKey] = $value;
+ unset($this->PMPluginRegistry[$propertyKey][$attKey][$index]);
+ }
+ }
}
}
}
- return $oPlugins;
+ $this->PMPluginRegistry['_aPluginDetails'] = $aPluginDetails;
+ $this->PMPluginRegistry['_aPlugins'] = $aPlugins;
+ return $this->PMPluginRegistry;
+ }
+
+ /**
+ * Save plugin in table PLUGINS_REGISTRY
+ * @param string $Namespace Name of plugin
+ * @param array $PMPluginRegistry
+ */
+ public function saveInTable($Namespace, $PMPluginRegistry)
+ {
+ $newStructurePlugin = $this->getAllAttributes($Namespace, $PMPluginRegistry);
+ $plugin = $this->convertFieldTable($newStructurePlugin);
+ if ($plugin['PLUGIN_NAMESPACE'] && $plugin['PLUGIN_CLASS_NAME'] && $plugin['PLUGIN_FILE']) {
+ $fieldPlugin = \PluginsRegistry::loadOrCreateIfNotExists(md5($plugin['PLUGIN_NAMESPACE']), $plugin);
+ \PluginsRegistry::update($fieldPlugin);
+ }
+ }
+
+ /**
+ * Extracts all attributes corresponding to a plugin
+ * @param string $Namespace Name Plugin
+ * @param array $PMPluginRegistry
+ * @return array
+ */
+ private function getAllAttributes($Namespace, $PMPluginRegistry)
+ {
+ $PluginDetails = $PMPluginRegistry['_aPluginDetails'][$Namespace];
+ unset($PMPluginRegistry['_aPluginDetails']);
+ $Plugin = isset($PMPluginRegistry['_aPlugins'][$Namespace]) ? $PMPluginRegistry['_aPlugins'][$Namespace] : [];
+ unset($PMPluginRegistry['_aPlugins']);
+ $newStructurePlugin = array_merge($PluginDetails, $Plugin);
+ foreach ($PMPluginRegistry as $propertyName => $propertyValue) {
+ foreach ($propertyValue as $key => $plugin) {
+ if (is_array($plugin) &&
+ ((array_key_exists('Namespace', $plugin) && $plugin['Namespace'] == $Namespace) ||
+ (!is_int($key) && $key == $Namespace))
+ ) {
+ $newStructurePlugin[$propertyName][] = $plugin;
+ } elseif (is_array($plugin) &&
+ array_key_exists('pluginName', $plugin) &&
+ $plugin['pluginName'] == $Namespace
+ ) {
+ $newStructurePlugin[$propertyName][] = $plugin;
+ } elseif (is_string($plugin) && $plugin == $Namespace) {
+ $newStructurePlugin[$propertyName][] = $plugin;
+ }
+ }
+ }
+ return $newStructurePlugin;
+ }
+
+ /**
+ * Convert de attributes to field of table PLUGINS_REGISTRY
+ * @param array $plugin
+ * @return array
+ */
+ private function convertFieldTable($plugin)
+ {
+ $fields = [];
+ $extraAttributes = array_diff_key($plugin, $this->attributes);
+ $fieldsInTable = array_intersect_key($plugin, $this->attributes);
+ foreach ($this->attributes as $name => $property) {
+ switch ($property['type']) {
+ case 'string':
+ $valueField = array_key_exists($name, $fieldsInTable) ? $fieldsInTable[$name] : '';
+ break;
+ case 'array':
+ $valueField = (array_key_exists($name, $fieldsInTable) && $fieldsInTable[$name]) ?
+ $fieldsInTable[$name] :
+ [];
+ $valueField = \G::json_encode($valueField);
+ break;
+ case 'int':
+ $valueField = array_key_exists($name, $fieldsInTable) ? $fieldsInTable[$name] : 0;
+ break;
+ case 'bool':
+ $valueField = array_key_exists($name, $fieldsInTable) ?
+ ($fieldsInTable[$name] ? true : false) :
+ false;
+ break;
+ default:
+ $valueField = array_key_exists($name, $fieldsInTable) ?
+ $fieldsInTable[$name] :
+ [];
+ break;
+ }
+ $fields[$property['name']] = $valueField;
+ }
+ $fields['PLUGIN_ATTRIBUTES'] = \G::json_encode($extraAttributes);
+ return $fields;
}
}
diff --git a/workflow/engine/src/ProcessMaker/Plugins/Interfaces/CaseSchedulerPlugin.php b/workflow/engine/src/ProcessMaker/Plugins/Interfaces/CaseSchedulerPlugin.php
index 3e7538cf4..147b19613 100644
--- a/workflow/engine/src/ProcessMaker/Plugins/Interfaces/CaseSchedulerPlugin.php
+++ b/workflow/engine/src/ProcessMaker/Plugins/Interfaces/CaseSchedulerPlugin.php
@@ -2,31 +2,113 @@
namespace ProcessMaker\Plugins\Interfaces;
+use ProcessMaker\Plugins\Traits\Attributes;
+
+/**
+ * Class CaseSchedulerPlugin
+ * @package ProcessMaker\Plugins\Interfaces
+ */
class CaseSchedulerPlugin
{
- public $sNamespace;
- public $sActionId;
- public $sActionForm;
- public $sActionSave;
- public $sActionExecute;
- public $sActionGetFields;
+ use Attributes;
+
+ private $Namespace;
+ private $ActionId;
+ private $ActionForm;
+ private $ActionSave;
+ private $ActionExecute;
+ private $ActionGetFields;
/**
- * This function is the constructor of the caseSchedulerPlugin class
- * @param string $sNamespace
- * @param string $sActionId
- * @param string $sActionForm
- * @param string $sActionSave
- * @param string $sActionExecute
- * @param string $sActionGetFields
+ * This function is the constructor of the CaseSchedulerPlugin class
+ * @param string $Namespace
+ * @param string $ActionId
+ * @param string $ActionForm
+ * @param string $ActionSave
+ * @param string $ActionExecute
+ * @param string $ActionGetFields
*/
- public function __construct($sNamespace, $sActionId, $sActionForm, $sActionSave, $sActionExecute, $sActionGetFields)
+ public function __construct($Namespace, $ActionId, $ActionForm, $ActionSave, $ActionExecute, $ActionGetFields)
{
- $this->sNamespace = $sNamespace;
- $this->sActionId = $sActionId;
- $this->sActionForm = $sActionForm;
- $this->sActionSave = $sActionSave;
- $this->sActionExecute = $sActionExecute;
- $this->sActionGetFields = $sActionGetFields;
+ $this->Namespace = $Namespace;
+ $this->ActionId = $ActionId;
+ $this->ActionForm = $ActionForm;
+ $this->ActionSave = $ActionSave;
+ $this->ActionExecute = $ActionExecute;
+ $this->ActionGetFields = $ActionGetFields;
+ }
+
+ /**
+ * Get name of plugin
+ * @return string
+ */
+ public function getNamespace()
+ {
+ return $this->Namespace;
+ }
+
+ /**
+ * Get action Id
+ * @return string
+ */
+ public function getActionId()
+ {
+ return $this->ActionId;
+ }
+
+ /**
+ * Get action form
+ * @return string
+ */
+ public function getActionForm()
+ {
+ return $this->ActionForm;
+ }
+
+ /**
+ * Get action Save
+ * @return string
+ */
+ public function getActionSave()
+ {
+ return $this->ActionSave;
+ }
+
+ /**
+ * Get action execute
+ * @return string
+ */
+ public function getActionExecute()
+ {
+ return $this->ActionExecute;
+ }
+
+ /**
+ * Get action fields
+ * @return string
+ */
+ public function getActionGetFields()
+ {
+ return $this->ActionGetFields;
+ }
+
+ /**
+ * Check if CaseSchedulerPlugin name of plugin is equal to params
+ * @param string $Namespace
+ * @return bool
+ */
+ public function equalNamespaceTo($Namespace)
+ {
+ return $Namespace == $this->Namespace;
+ }
+
+ /**
+ * Check if CaseSchedulerPlugin Action Id is equal to params
+ * @param string $ActionId
+ * @return bool
+ */
+ public function equalActionIdTo($ActionId)
+ {
+ return $ActionId == $this->ActionId;
}
}
diff --git a/workflow/engine/src/ProcessMaker/Plugins/Interfaces/CronFile.php b/workflow/engine/src/ProcessMaker/Plugins/Interfaces/CronFile.php
index 24088e963..bce110c6d 100644
--- a/workflow/engine/src/ProcessMaker/Plugins/Interfaces/CronFile.php
+++ b/workflow/engine/src/ProcessMaker/Plugins/Interfaces/CronFile.php
@@ -2,19 +2,55 @@
namespace ProcessMaker\Plugins\Interfaces;
+use ProcessMaker\Plugins\Traits\Attributes;
+
+/**
+ * Class CronFile
+ * @package ProcessMaker\Plugins\Interfaces
+ */
class CronFile
{
- public $namespace;
- public $cronFile;
+ use Attributes;
+ private $Namespace;
+ private $CronFile;
/**
- * This function is the constructor of the cronFile class
- * @param string $namespace
- * @param string $cronFile
+ * This function is the constructor of the CronFile class
+ * @param string $Namespace
+ * @param string $CronFile
*/
- public function __construct($namespace, $cronFile)
+ public function __construct($Namespace, $CronFile)
{
- $this->namespace = $namespace;
- $this->cronFile = $cronFile;
+ $this->Namespace = $Namespace;
+ $this->CronFile = $CronFile;
+ }
+
+ /**
+ * Set value to cron file
+ * @param string $CronFile
+ */
+ public function setCronFile($CronFile)
+ {
+ $this->CronFile = $CronFile;
+ }
+
+ /**
+ * Check if name of plugin is equal to params
+ * @param string $Namespace
+ * @return bool
+ */
+ public function equalNamespaceTo($Namespace)
+ {
+ return $Namespace == $this->Namespace;
+ }
+
+ /**
+ * Check if cron file is equal to params
+ * @param string $CronFile
+ * @return bool
+ */
+ public function equalCronFileTo($CronFile)
+ {
+ return $CronFile == $this->CronFile;
}
}
diff --git a/workflow/engine/src/ProcessMaker/Plugins/Interfaces/CssFile.php b/workflow/engine/src/ProcessMaker/Plugins/Interfaces/CssFile.php
index 5ce4b9414..43af9de4e 100644
--- a/workflow/engine/src/ProcessMaker/Plugins/Interfaces/CssFile.php
+++ b/workflow/engine/src/ProcessMaker/Plugins/Interfaces/CssFile.php
@@ -2,19 +2,65 @@
namespace ProcessMaker\Plugins\Interfaces;
+use ProcessMaker\Plugins\Traits\Attributes;
+
+/**
+ * Class CssFile
+ * @package ProcessMaker\Plugins\Interfaces
+ */
class CssFile
{
- public $sNamespace;
- public $sCssFile;
+ use Attributes;
+
+ private $Namespace;
+ private $CssFile;
/**
- * This function is the constructor of the cssFile class
- * @param string $sNamespace
- * @param string $sCssFile
+ * This function is the constructor of the CssFile class
+ * @param string $Namespace
+ * @param string $CssFile
*/
- public function __construct($sNamespace, $sCssFile)
+ public function __construct($Namespace, $CssFile)
{
- $this->sNamespace = $sNamespace;
- $this->sCssFile = $sCssFile;
+ $this->Namespace = $Namespace;
+ $this->CssFile = $CssFile;
+ }
+
+ /**
+ * Get css file
+ * @return string
+ */
+ public function getCssFile()
+ {
+ return $this->CssFile;
+ }
+
+ /**
+ * Set css file
+ * @param string $CssFile
+ */
+ public function setCssFile($CssFile)
+ {
+ $this->CssFile = $CssFile;
+ }
+
+ /**
+ * Check if css file is equal to params
+ * @param string $CssFile
+ * @return bool
+ */
+ public function equalCssFileTo($CssFile)
+ {
+ return $CssFile == $this->CssFile;
+ }
+
+ /**
+ * Check if name plugin is equal to params
+ * @param string $Namespace
+ * @return bool
+ */
+ public function equalNamespaceTo($Namespace)
+ {
+ return $Namespace == $this->Namespace;
}
}
diff --git a/workflow/engine/src/ProcessMaker/Plugins/Interfaces/DashboardPage.php b/workflow/engine/src/ProcessMaker/Plugins/Interfaces/DashboardPage.php
index 26d771f3b..d4c9d7c0c 100644
--- a/workflow/engine/src/ProcessMaker/Plugins/Interfaces/DashboardPage.php
+++ b/workflow/engine/src/ProcessMaker/Plugins/Interfaces/DashboardPage.php
@@ -2,25 +2,125 @@
namespace ProcessMaker\Plugins\Interfaces;
+use ProcessMaker\Plugins\Traits\Attributes;
+
+/**
+ * Class DashboardPage
+ * @package ProcessMaker\Plugins\Interfaces
+ */
class DashboardPage
{
- public $sNamespace;
- public $sPage;
- public $sName;
- public $sIcon;
+ use Attributes;
+
+ private $Namespace;
+ private $Page;
+ private $Name;
+ private $Icon;
/**
- * This function is the constructor of the dashboardPage class
- * @param string $sNamespace
- * @param string $sPage
- * @param string $sName
- * @param string $sIcon
+ * This function is the constructor of the DashboardPage class
+ * @param string $Namespace
+ * @param string $Page
+ * @param string $Name
+ * @param string $Icon
*/
- public function __construct($sNamespace, $sPage, $sName, $sIcon)
+ public function __construct($Namespace, $Page, $Name, $Icon)
{
- $this->sNamespace = $sNamespace;
- $this->sPage = $sPage;
- $this->sName = $sName;
- $this->sIcon = $sIcon;
+ $this->Namespace = $Namespace;
+ $this->Page = $Page;
+ $this->Name = $Name;
+ $this->Icon = $Icon;
+ }
+
+ /**
+ * Get name of plugin
+ * @return string
+ */
+ public function getNamespace()
+ {
+ return $this->Namespace;
+ }
+
+ /**
+ * Set name of plugin
+ * @param string $Namespace
+ */
+ public function setNamespace($Namespace)
+ {
+ $this->Namespace = $Namespace;
+ }
+
+ /**
+ * Get page of Dashboard
+ * @return string
+ */
+ public function getPage()
+ {
+ return $this->Page;
+ }
+
+ /**
+ * Set page of Dashboard
+ * @param string $Page
+ */
+ public function setPage($Page)
+ {
+ $this->Page = $Page;
+ }
+
+ /**
+ * Get name of Dashboard
+ * @return string
+ */
+ public function getName()
+ {
+ return $this->Name;
+ }
+
+ /**
+ * Set name of Dashboard
+ * @param string $Name
+ */
+ public function setName($Name)
+ {
+ $this->Name = $Name;
+ }
+
+ /**
+ * Get icon of Dashboard
+ * @return string
+ */
+ public function getIcon()
+ {
+ return $this->Icon;
+ }
+
+ /**
+ * Set icon of Dashboard
+ * @param string $Icon
+ */
+ public function setIcon($Icon)
+ {
+ $this->Icon = $Icon;
+ }
+
+ /**
+ * Check if name plugin is equal to params
+ * @param string $Namespace
+ * @return bool
+ */
+ public function equalNamespaceTo($Namespace)
+ {
+ return $Namespace == $this->Namespace;
+ }
+
+ /**
+ * Check if dashboard page is equal to params
+ * @param string $Page
+ * @return bool
+ */
+ public function equalPageTo($Page)
+ {
+ return $Page == $this->Page;
}
}
diff --git a/workflow/engine/src/ProcessMaker/Plugins/Interfaces/FolderDetail.php b/workflow/engine/src/ProcessMaker/Plugins/Interfaces/FolderDetail.php
index bb5777ea0..a3c1c8368 100644
--- a/workflow/engine/src/ProcessMaker/Plugins/Interfaces/FolderDetail.php
+++ b/workflow/engine/src/ProcessMaker/Plugins/Interfaces/FolderDetail.php
@@ -2,22 +2,85 @@
namespace ProcessMaker\Plugins\Interfaces;
+use ProcessMaker\Plugins\Traits\Attributes;
+
+/**
+ * Class FolderDetail
+ * @package ProcessMaker\Plugins\Interfaces
+ */
class FolderDetail
{
- public $sNamespace;
- public $sFolderId;
- public $sFolderName;
+ use Attributes;
+ private $Namespace;
+ private $FolderId;
+ private $FolderName;
/**
- * This function is the constructor of the folderDetail class
- * @param string $sNamespace
- * @param string $sFolderId
- * @param string $sFolderName
+ * This function is the constructor of the FolderDetail class
+ * @param string $Namespace
+ * @param string $FolderId
+ * @param string $FolderName
*/
- public function __construct($sNamespace, $sFolderId, $sFolderName)
+ public function __construct($Namespace, $FolderId, $FolderName)
{
- $this->sNamespace = $sNamespace;
- $this->sFolderId = $sFolderId;
- $this->sFolderName = $sFolderName;
+ $this->Namespace = $Namespace;
+ $this->FolderId = $FolderId;
+ $this->FolderName = $FolderName;
+ }
+
+ /**
+ * Get folder name
+ * @return string
+ */
+ public function getFolderName()
+ {
+ return $this->FolderName;
+ }
+
+ /**
+ * Set folder name
+ * @param string $FolderName
+ */
+ public function setFolderName($FolderName)
+ {
+ $this->FolderName = $FolderName;
+ }
+
+ /**
+ * Get name of plugin
+ * @return string
+ */
+ public function getNamespace()
+ {
+ return $this->Namespace;
+ }
+
+ /**
+ * Set name of plugin
+ * @param string $Namespace
+ */
+ public function setNamespace($Namespace)
+ {
+ $this->Namespace = $Namespace;
+ }
+
+ /**
+ * Check if folder id is equal to params
+ * @param string $folderId
+ * @return bool
+ */
+ public function equalFolderIdTo($folderId)
+ {
+ return $folderId == $this->FolderId;
+ }
+
+ /**
+ * Check if name plugin is equal to params
+ * @param string $Namespace
+ * @return bool
+ */
+ public function equalNamespaceTo($Namespace)
+ {
+ return $Namespace == $this->Namespace;
}
}
diff --git a/workflow/engine/src/ProcessMaker/Plugins/Interfaces/ImportCallBack.php b/workflow/engine/src/ProcessMaker/Plugins/Interfaces/ImportCallBack.php
index 5fd8df939..96091b613 100644
--- a/workflow/engine/src/ProcessMaker/Plugins/Interfaces/ImportCallBack.php
+++ b/workflow/engine/src/ProcessMaker/Plugins/Interfaces/ImportCallBack.php
@@ -2,19 +2,78 @@
namespace ProcessMaker\Plugins\Interfaces;
+use ProcessMaker\Plugins\Traits\Attributes;
+
class ImportCallBack
{
- public $namespace;
- public $callBackFile;
+ use Attributes;
+ private $Namespace;
+ private $CallBackFile;
/**
- * This function is the constructor of the cronFile class
- * @param string $namespace
- * @param string $callBackFile
+ * This function is the constructor of the ImportCallBack class
+ * @param string $Namespace
+ * @param string $CallBackFile
*/
- public function __construct($namespace, $callBackFile)
+ public function __construct($Namespace, $CallBackFile)
{
- $this->namespace = $namespace;
- $this->callBackFile = $callBackFile;
+ $this->Namespace = $Namespace;
+ $this->CallBackFile = $CallBackFile;
+ }
+
+ /**
+ * Get name of plugin
+ * @return string
+ */
+ public function getNamespace()
+ {
+ return $this->Namespace;
+ }
+
+ /**
+ * Set name of plugin
+ * @param string $Namespace
+ */
+ public function setNamespace($Namespace)
+ {
+ $this->Namespace = $Namespace;
+ }
+
+ /**
+ * Get callback file
+ * @return string
+ */
+ public function getCallBackFile()
+ {
+ return $this->CallBackFile;
+ }
+
+ /**
+ * Set callback file
+ * @param string $CallBackFile
+ */
+ public function setCallBackFile($CallBackFile)
+ {
+ $this->CallBackFile = $CallBackFile;
+ }
+
+ /**
+ * Check if name of plugin is equal to params
+ * @param string $Namespace
+ * @return bool
+ */
+ public function equalNamespaceTo($Namespace)
+ {
+ return $Namespace == $this->Namespace;
+ }
+
+ /**
+ * Check if callback file is equal to params
+ * @param string $CallBackFile
+ * @return bool
+ */
+ public function equalCallBackFileTo($CallBackFile)
+ {
+ return $CallBackFile == $this->CallBackFile;
}
}
diff --git a/workflow/engine/src/ProcessMaker/Plugins/Interfaces/JsFile.php b/workflow/engine/src/ProcessMaker/Plugins/Interfaces/JsFile.php
new file mode 100644
index 000000000..7e4c042f7
--- /dev/null
+++ b/workflow/engine/src/ProcessMaker/Plugins/Interfaces/JsFile.php
@@ -0,0 +1,83 @@
+Namespace = $Namespace;
+ $this->CoreJsFile = $CoreJsFile;
+ $this->PluginJsFile = $PluginJsFile;
+ }
+ /**
+ * Get js files
+ * @return array
+ */
+ public function getPluginJsFile()
+ {
+ return $this->PluginJsFile;
+ }
+
+ /**
+ * Check if core js file is equal to params
+ * @param string $CoreJsFile
+ * @return bool
+ */
+ public function equalCoreJsFile($CoreJsFile)
+ {
+ return $CoreJsFile == $this->CoreJsFile;
+ }
+
+ /**
+ * Check if name of plugin is equal to params
+ * @param string $Namespace
+ * @return bool
+ */
+ public function equalNamespaceTo($Namespace)
+ {
+ return $Namespace == $this->Namespace;
+ }
+
+ /**
+ * Push one or more elements onto the PluginJsFile
+ * @param string|array $PluginJsFile
+ * @throws Exception
+ */
+ public function pushPluginJsFile($PluginJsFile)
+ {
+ if (is_string($PluginJsFile)) {
+ if (!in_array($PluginJsFile, $this->PluginJsFile)) {
+ $this->PluginJsFile[] = $PluginJsFile;
+ }
+ } elseif (is_array($PluginJsFile)) {
+ $this->PluginJsFile = array_unique(
+ array_merge($PluginJsFile, $this->PluginJsFile)
+ );
+ } else {
+ throw new Exception(
+ 'Invalid third param, $pluginJsFile should be a string or array - ' .
+ gettype($PluginJsFile) .
+ ' given.'
+ );
+ }
+ }
+}
diff --git a/workflow/engine/src/ProcessMaker/Plugins/Interfaces/MenuDetail.php b/workflow/engine/src/ProcessMaker/Plugins/Interfaces/MenuDetail.php
index 44408807f..1e8fff7bd 100644
--- a/workflow/engine/src/ProcessMaker/Plugins/Interfaces/MenuDetail.php
+++ b/workflow/engine/src/ProcessMaker/Plugins/Interfaces/MenuDetail.php
@@ -2,22 +2,67 @@
namespace ProcessMaker\Plugins\Interfaces;
+use ProcessMaker\Plugins\Traits\Attributes;
+
+/**
+ * Class MenuDetail
+ * @package ProcessMaker\Plugins\Interfaces
+ */
class MenuDetail
{
- public $sNamespace;
- public $sMenuId;
- public $sFilename;
+ use Attributes;
+ private $Namespace;
+ private $MenuId;
+ private $Filename;
/**
- * This function is the constructor of the menuDetail class
- * @param string $sNamespace
- * @param string $sMenuId
- * @param string $sFilename
+ * This function is the constructor of the MenuDetail class
+ * @param string $Namespace
+ * @param string $MenuId
+ * @param string $Filename
*/
- public function __construct($sNamespace, $sMenuId, $sFilename)
+ public function __construct($Namespace, $MenuId, $Filename)
{
- $this->sNamespace = $sNamespace;
- $this->sMenuId = $sMenuId;
- $this->sFilename = $sFilename;
+ $this->Namespace = $Namespace;
+ $this->MenuId = $MenuId;
+ $this->Filename = $Filename;
+ }
+
+ /**
+ * Check if menu id is equal to params
+ * @param string $menuId
+ * @return bool
+ */
+ public function equalMenuIdTo($menuId)
+ {
+ return $menuId == $this->MenuId;
+ }
+
+ /**
+ * Check if nmae of plugin is equal to params
+ * @param string $Namespace
+ * @return bool
+ */
+ public function equalNamespaceTo($Namespace)
+ {
+ return $Namespace == $this->Namespace;
+ }
+
+ /**
+ * Check if file exists
+ * @return bool
+ */
+ public function exitsFile()
+ {
+ return file_exists($this->Filename);
+ }
+
+ /**
+ * Include file
+ * @return bool
+ */
+ public function includeFileMenu()
+ {
+ include($this->Filename);
}
}
diff --git a/workflow/engine/src/ProcessMaker/Plugins/Interfaces/OpenReassignCallback.php b/workflow/engine/src/ProcessMaker/Plugins/Interfaces/OpenReassignCallback.php
index 4cd69af67..4936efd8d 100644
--- a/workflow/engine/src/ProcessMaker/Plugins/Interfaces/OpenReassignCallback.php
+++ b/workflow/engine/src/ProcessMaker/Plugins/Interfaces/OpenReassignCallback.php
@@ -2,16 +2,51 @@
namespace ProcessMaker\Plugins\Interfaces;
+use ProcessMaker\Plugins\Traits\Attributes;
+
+/**
+ * Class OpenReassignCallback
+ * @package ProcessMaker\Plugins\Interfaces
+ */
class OpenReassignCallback
{
- public $callBackFile;
+ use Attributes;
+ private $CallBackFile;
/**
- * This function is the constructor of the cronFile class
- * @param string $callBackFile
+ * This function is the constructor of the OpenReassignCallback class
+ * @param string $CallBackFile
*/
- public function __construct($callBackFile)
+ public function __construct($CallBackFile)
{
- $this->callBackFile = $callBackFile;
+ $this->CallBackFile = $CallBackFile;
+ }
+
+ /**
+ * Get callback file
+ * @return string
+ */
+ public function getCallBackFile()
+ {
+ return $this->CallBackFile;
+ }
+
+ /**
+ * Set callback file
+ * @param string $CallBackFile
+ */
+ public function setCallBackFile($CallBackFile)
+ {
+ $this->CallBackFile = $CallBackFile;
+ }
+
+ /**
+ * Check if callback file is equal to params
+ * @param string $CallBackFile
+ * @return bool
+ */
+ public function equalCallBackFileTo($CallBackFile)
+ {
+ return $CallBackFile == $this->CallBackFile;
}
}
diff --git a/workflow/engine/src/ProcessMaker/Plugins/Interfaces/PluginDetail.php b/workflow/engine/src/ProcessMaker/Plugins/Interfaces/PluginDetail.php
index 5e6b59fc6..f65f8fcbf 100644
--- a/workflow/engine/src/ProcessMaker/Plugins/Interfaces/PluginDetail.php
+++ b/workflow/engine/src/ProcessMaker/Plugins/Interfaces/PluginDetail.php
@@ -2,24 +2,43 @@
namespace ProcessMaker\Plugins\Interfaces;
+use ProcessMaker\Plugins\Traits\Attributes;
+
+/**
+ * Class PluginDetail
+ * @package ProcessMaker\Plugins\Interfaces
+ */
class PluginDetail
{
- public $sNamespace;
- public $sClassName;
- public $sFriendlyName = null;
- public $sDescription = null;
- public $sSetupPage = null;
- public $sFilename;
- public $sPluginFolder = '';
- public $sCompanyLogo = '';
- public $iVersion = 0;
- public $enabled = false;
- public $aWorkspaces = null;
- public $bPrivate = false;
+ use Attributes;
+
+ /** @var string */
+ private $sNamespace;
+ /** @var string */
+ private $sDescription = '';
+ /** @var string */
+ private $sClassName;
+ /** @var string */
+ private $sFriendlyName = '';
+ /** @var string */
+ private $sFilename;
+ /** @var string */
+ private $sPluginFolder = '';
+ /** @var string */
+ private $sSetupPage = '';
+ /** @var string */
+ private $sCompanyLogo = '';
+ /** @var array */
+ private $aWorkspaces = [];
+ /** @var bool */
+ private $enabled = false;
+ /** @var bool */
+ private $bPrivate = false;
+ /** @var int */
+ private $iVersion = 0;
/**
* This function is the constructor of the pluginDetail class
- *
* @param string $sNamespace
* @param string $sClassName
* @param string $sFilename
@@ -27,6 +46,10 @@ class PluginDetail
* @param string $sPluginFolder
* @param string $sDescription
* @param string $sSetupPage
+ * @param string $sCompanyLogo
+ * @param array $aWorkspaces
+ * @param bool $enable
+ * @param bool $bPrivate
* @param integer $iVersion
*/
public function __construct(
@@ -37,19 +60,242 @@ class PluginDetail
$sPluginFolder = '',
$sDescription = '',
$sSetupPage = '',
- $iVersion = 0
+ $iVersion = 0,
+ $sCompanyLogo = '',
+ $aWorkspaces = [],
+ $enable = false,
+ $bPrivate = false
) {
$this->sNamespace = $sNamespace;
+ $this->sDescription = $sDescription;
$this->sClassName = $sClassName;
$this->sFriendlyName = $sFriendlyName;
- $this->sDescription = $sDescription;
- $this->sSetupPage = $sSetupPage;
- $this->iVersion = $iVersion;
$this->sFilename = $sFilename;
- if ($sPluginFolder == '') {
- $this->sPluginFolder = $sNamespace;
- } else {
+ $this->sPluginFolder = $sNamespace;
+ if ($sPluginFolder) {
$this->sPluginFolder = $sPluginFolder;
}
+ $this->sSetupPage = $sSetupPage;
+ $this->sCompanyLogo = $sCompanyLogo;
+ $this->aWorkspaces = $aWorkspaces;
+ $this->enabled = $enable;
+ $this->bPrivate = $bPrivate;
+ $this->iVersion = $iVersion;
+ }
+
+ /**
+ * Get name of plugin
+ * @return string
+ */
+ public function getNamespace()
+ {
+ return $this->sNamespace;
+ }
+
+ /**
+ * Set name of plugin
+ * @param string $PluginNamespace
+ */
+ public function setNamespace($PluginNamespace)
+ {
+ $this->sNamespace = $PluginNamespace;
+ }
+
+ /**
+ * Get description
+ * @return string
+ */
+ public function getDescription()
+ {
+ return $this->sDescription;
+ }
+
+ /**
+ * Set description
+ * @param string $PluginDescription
+ */
+ public function setDescription($PluginDescription)
+ {
+ $this->sDescription = $PluginDescription;
+ }
+
+ /**
+ * Get class name
+ * @return string
+ */
+ public function getClassName()
+ {
+ return $this->sClassName;
+ }
+
+ /**
+ * Set class name
+ * @param string $PluginClassName
+ */
+ public function setClassName($PluginClassName)
+ {
+ $this->sClassName = $PluginClassName;
+ }
+
+ /**
+ * Get friendly name
+ * @return string
+ */
+ public function getFriendlyName()
+ {
+ return $this->sFriendlyName;
+ }
+
+ /**
+ * Set friendly name
+ * @param string $PluginFriendlyName
+ */
+ public function setFriendlyName($PluginFriendlyName)
+ {
+ $this->sFriendlyName = $PluginFriendlyName;
+ }
+
+ /**
+ * Get path file
+ * @return string
+ */
+ public function getFile()
+ {
+ return $this->sFilename;
+ }
+
+ /**
+ * Set path file
+ * @param string $PluginFile
+ */
+ public function setFile($PluginFile)
+ {
+ $this->sFilename = $PluginFile;
+ }
+
+ /**
+ * Get name folder
+ * @return string
+ */
+ public function getFolder()
+ {
+ return $this->sPluginFolder;
+ }
+
+ /**
+ * Set name folder
+ * @param string $PluginFolder
+ */
+ public function setFolder($PluginFolder)
+ {
+ $this->sPluginFolder = $PluginFolder;
+ }
+
+ /**
+ * Get setup page
+ * @return string
+ */
+ public function getSetupPage()
+ {
+ return $this->sSetupPage;
+ }
+
+ /**
+ * Set setup page
+ * @param string $PluginSetupPage
+ */
+ public function setSetupPage($PluginSetupPage)
+ {
+ $this->sSetupPage = $PluginSetupPage;
+ }
+
+ /**
+ * Get company logo
+ * @return string
+ */
+ public function getCompanyLogo()
+ {
+ return $this->sCompanyLogo;
+ }
+
+ /**
+ * Set company logo
+ * @param string $PluginCompanyLogo
+ */
+ public function setCompanyLogo($PluginCompanyLogo)
+ {
+ $this->sCompanyLogo = $PluginCompanyLogo;
+ }
+
+ /**
+ * Get workspace allowed
+ * @return array
+ */
+ public function getWorkspaces()
+ {
+ return $this->aWorkspaces;
+ }
+
+ /**
+ * Set workspace allowed
+ * @param array $PluginWorkspaces
+ */
+ public function setWorkspaces($PluginWorkspaces)
+ {
+ $this->aWorkspaces = $PluginWorkspaces;
+ }
+
+ /**
+ * Get plugin is enable
+ * @return bool
+ */
+ public function isEnabled()
+ {
+ return $this->enabled;
+ }
+
+ /**
+ * Set status plugin
+ * @param bool $PluginEnable
+ */
+ public function setEnabled($PluginEnable)
+ {
+ $this->enabled = $PluginEnable;
+ }
+
+ /**
+ * Get if plugin is private
+ * @return bool
+ */
+ public function isPrivate()
+ {
+ return $this->bPrivate;
+ }
+
+ /**
+ * Set status private
+ * @param bool $PluginPrivate
+ */
+ public function setPrivate($PluginPrivate)
+ {
+ $this->bPrivate = $PluginPrivate;
+ }
+
+ /**
+ * Get version of plugin
+ * @return int
+ */
+ public function getVersion()
+ {
+ return $this->iVersion;
+ }
+
+ /**
+ * Set version of plugin
+ * @param int $PluginVersion
+ */
+ public function setVersion($PluginVersion)
+ {
+ $this->iVersion = $PluginVersion;
}
}
diff --git a/workflow/engine/src/ProcessMaker/Plugins/Interfaces/Plugins.php b/workflow/engine/src/ProcessMaker/Plugins/Interfaces/Plugins.php
deleted file mode 100644
index 5b80f56c2..000000000
--- a/workflow/engine/src/ProcessMaker/Plugins/Interfaces/Plugins.php
+++ /dev/null
@@ -1,83 +0,0 @@
- $oldValue) {
- if (isset($vars[$name])) {
- $newObject->{$name} = $vars[$name];
- unset($vars[$name]);
- } else {
- $newObject->{$name} = $oldValue;
- }
- }
- if ($vars) {
- $sClassName = $vars['sClassName'];
- $sNamespace = $vars['sNamespace'];
- $sFilename = $vars['sFilename'];
- $newObjectDetails = new PluginDetail(
- $sNamespace,
- $sClassName,
- $sFilename
- );
- if (class_exists($sClassName)) {
- $oPlugin = new $sClassName($sNamespace, $sFilename);
- } else {
- $oPlugin = $newObjectDetails;
- }
- $newObject->_aPlugins[$sNamespace] = $oPlugin;
- $hasDetails = get_object_vars($newObjectDetails);
- foreach ($hasDetails as $name => $oldValue) {
- if (isset($vars[$name])) {
- $newObjectDetails->{$name} = $vars[$name];
- unset($vars[$name]);
- } else {
- $newObjectDetails->{$name} = $oldValue;
- }
- }
- $newObject->_aPluginDetails[$sNamespace] = $newObjectDetails;
- }
- return $newObject;
- }
-}
diff --git a/workflow/engine/src/ProcessMaker/Plugins/Interfaces/RedirectDetail.php b/workflow/engine/src/ProcessMaker/Plugins/Interfaces/RedirectDetail.php
index 6f802c67d..b16ae01d3 100644
--- a/workflow/engine/src/ProcessMaker/Plugins/Interfaces/RedirectDetail.php
+++ b/workflow/engine/src/ProcessMaker/Plugins/Interfaces/RedirectDetail.php
@@ -2,22 +2,77 @@
namespace ProcessMaker\Plugins\Interfaces;
+use ProcessMaker\Plugins\Traits\Attributes;
+
+/**
+ * Class RedirectDetail
+ * @package ProcessMaker\Plugins\Interfaces
+ */
class RedirectDetail
{
- public $sNamespace;
- public $sRoleCode;
- public $sPathMethod;
+ use Attributes;
+
+ private $Namespace;
+ private $RoleCode;
+ private $PathMethod;
/**
- * This function is the constructor of the redirectDetail class
- * @param string $sNamespace
- * @param string $sRoleCode
- * @param string $sPathMethod
+ * This function is the constructor of the RedirectDetail class
+ * @param string $Namespace
+ * @param string $RoleCode
+ * @param string $PathMethod
*/
- public function __construct($sNamespace, $sRoleCode, $sPathMethod)
+ public function __construct($Namespace, $RoleCode, $PathMethod)
{
- $this->sNamespace = $sNamespace;
- $this->sRoleCode = $sRoleCode;
- $this->sPathMethod = $sPathMethod;
+ $this->Namespace = $Namespace;
+ $this->RoleCode = $RoleCode;
+ $this->PathMethod = $PathMethod;
+ }
+
+ /**
+ * Get name of plugin
+ * @return string
+ */
+ public function getNamespace()
+ {
+ return $this->Namespace;
+ }
+
+ /**
+ * Get role code
+ * @return string
+ */
+ public function getRoleCode()
+ {
+ return $this->RoleCode;
+ }
+
+ /**
+ * Get path method
+ * @return string
+ */
+ public function getPathMethod()
+ {
+ return $this->PathMethod;
+ }
+
+ /**
+ * Check if name of plugin is equal to params
+ * @param string $Namespace
+ * @return bool
+ */
+ public function equalNamespaceTo($Namespace)
+ {
+ return $Namespace == $this->Namespace;
+ }
+
+ /**
+ * Check if role code is equal to params
+ * @param string $RoleCode
+ * @return bool
+ */
+ public function equalRoleCodeTo($RoleCode)
+ {
+ return $RoleCode == $this->RoleCode;
}
}
diff --git a/workflow/engine/src/ProcessMaker/Plugins/Interfaces/StepDetail.php b/workflow/engine/src/ProcessMaker/Plugins/Interfaces/StepDetail.php
index d27950977..c87b0a095 100644
--- a/workflow/engine/src/ProcessMaker/Plugins/Interfaces/StepDetail.php
+++ b/workflow/engine/src/ProcessMaker/Plugins/Interfaces/StepDetail.php
@@ -2,28 +2,101 @@
namespace ProcessMaker\Plugins\Interfaces;
+use ProcessMaker\Plugins\Traits\Attributes;
+
+/**
+ * Class StepDetail
+ * @package ProcessMaker\Plugins\Interfaces
+ */
class StepDetail
{
- public $sNamespace;
- public $sStepId;
- public $sStepName;
- public $sStepTitle;
- public $sSetupStepPage;
+ use Attributes;
+
+ private $Namespace;
+ private $StepId;
+ private $StepName;
+ private $StepTitle;
+ private $SetupStepPage;
/**
- * This function is the constructor of the stepDetail class
- * @param string $sNamespace
- * @param string $sStepId
- * @param string $sStepName
- * @param string $sStepTitle
- * @param string $sSetupStepPage
+ * This function is the constructor of the StepDetail class
+ * @param string $Namespace
+ * @param string $StepId
+ * @param string $StepName
+ * @param string $StepTitle
+ * @param string $SetupStepPage
*/
- public function __construct($sNamespace, $sStepId, $sStepName, $sStepTitle, $sSetupStepPage)
+ public function __construct($Namespace, $StepId, $StepName, $StepTitle, $SetupStepPage)
{
- $this->sNamespace = $sNamespace;
- $this->sStepId = $sStepId;
- $this->sStepName = $sStepName;
- $this->sStepTitle = $sStepTitle;
- $this->sSetupStepPage = $sSetupStepPage;
+ $this->Namespace = $Namespace;
+ $this->StepId = $StepId;
+ $this->StepName = $StepName;
+ $this->StepTitle = $StepTitle;
+ $this->SetupStepPage = $SetupStepPage;
+ }
+
+ /**
+ * Get name of plugin
+ * @return string
+ */
+ public function getNamespace()
+ {
+ return $this->Namespace;
+ }
+
+ /**
+ * Get step id
+ * @return string
+ */
+ public function getStepId()
+ {
+ return $this->StepId;
+ }
+
+ /**
+ * Get step Title
+ * @return string
+ */
+ public function getStepTitle()
+ {
+ return $this->StepTitle;
+ }
+
+ /**
+ * Get step name
+ * @return string
+ */
+ public function getStepName()
+ {
+ return $this->StepName;
+ }
+
+ /**
+ * Get setup step page
+ * @return string
+ */
+ public function getSetupStepPage()
+ {
+ return $this->SetupStepPage;
+ }
+
+ /**
+ * Check if step id is equal to params
+ * @param string $StepId
+ * @return bool
+ */
+ public function equalStepIdTo($StepId)
+ {
+ return $StepId == $this->StepId;
+ }
+
+ /**
+ * Check if name of plugin is equal to params
+ * @param string $Namespace
+ * @return bool
+ */
+ public function equalNamespaceTo($Namespace)
+ {
+ return $Namespace == $this->Namespace;
}
}
diff --git a/workflow/engine/src/ProcessMaker/Plugins/Interfaces/TaskExtendedProperty.php b/workflow/engine/src/ProcessMaker/Plugins/Interfaces/TaskExtendedProperty.php
index b4b86e124..e1289079c 100644
--- a/workflow/engine/src/ProcessMaker/Plugins/Interfaces/TaskExtendedProperty.php
+++ b/workflow/engine/src/ProcessMaker/Plugins/Interfaces/TaskExtendedProperty.php
@@ -2,25 +2,107 @@
namespace ProcessMaker\Plugins\Interfaces;
+use ProcessMaker\Plugins\Traits\Attributes;
+
+/**
+ * Class TaskExtendedProperty
+ * @package ProcessMaker\Plugins\Interfaces
+ */
class TaskExtendedProperty
{
- public $sNamespace;
- public $sPage;
- public $sName;
- public $sIcon;
+ use Attributes;
+
+ private $Namespace;
+ private $Page;
+ private $Name;
+ private $Icon;
/**
- * This function is the constructor of the taskExtendedProperty class
- * @param string $sNamespace
- * @param string $sPage
- * @param string $sName
- * @param string $sIcon
+ * This function is the constructor of the TaskExtendedProperty class
+ * @param string $Namespace
+ * @param string $Page
+ * @param string $Name
+ * @param string $Icon
*/
- public function __construct($sNamespace, $sPage, $sName, $sIcon)
+ public function __construct($Namespace, $Page, $Name, $Icon)
{
- $this->sNamespace = $sNamespace;
- $this->sPage = $sPage;
- $this->sName = $sName;
- $this->sIcon = $sIcon;
+ $this->Namespace = $Namespace;
+ $this->Page = $Page;
+ $this->Name = $Name;
+ $this->Icon = $Icon;
+ }
+
+ /**
+ * Set name
+ * @param string $Name
+ */
+ public function setName($Name)
+ {
+ $this->Name = $Name;
+ }
+
+ /**
+ * Set icon
+ * @param string $Icon
+ */
+ public function setIcon($Icon)
+ {
+ $this->Icon = $Icon;
+ }
+
+ /**
+ * Get name of plugin
+ * @return string
+ */
+ public function getNamespace()
+ {
+ return $this->Namespace;
+ }
+
+ /**
+ * Get page
+ * @return string
+ */
+ public function getPage()
+ {
+ return $this->Page;
+ }
+
+ /**
+ * Get name
+ * @return string
+ */
+ public function getName()
+ {
+ return $this->Name;
+ }
+
+ /**
+ * Get icon
+ * @return string
+ */
+ public function getIcon()
+ {
+ return $this->Icon;
+ }
+
+ /**
+ * Check if nmae of plugin is equal to params
+ * @param string $Namespace
+ * @return bool
+ */
+ public function equalNamespaceTo($Namespace)
+ {
+ return $Namespace == $this->Namespace;
+ }
+
+ /**
+ * Check if page is equal to params
+ * @param string $Page
+ * @return bool
+ */
+ public function equalPageTo($Page)
+ {
+ return $Page == $this->Page;
}
}
diff --git a/workflow/engine/src/ProcessMaker/Plugins/Interfaces/ToolbarDetail.php b/workflow/engine/src/ProcessMaker/Plugins/Interfaces/ToolbarDetail.php
index e2a267e7d..d270cfd5f 100644
--- a/workflow/engine/src/ProcessMaker/Plugins/Interfaces/ToolbarDetail.php
+++ b/workflow/engine/src/ProcessMaker/Plugins/Interfaces/ToolbarDetail.php
@@ -2,22 +2,67 @@
namespace ProcessMaker\Plugins\Interfaces;
+use ProcessMaker\Plugins\Traits\Attributes;
+
+/**
+ * Class ToolbarDetail
+ * @package ProcessMaker\Plugins\Interfaces
+ */
class ToolbarDetail
{
- public $sNamespace;
- public $sToolbarId;
- public $sFilename;
+ use Attributes;
+ private $Namespace;
+ private $ToolbarId;
+ private $Filename;
/**
- * This function is the constructor of the menuDetail class
- * @param string $sNamespace
- * @param string $sToolbarId
- * @param string $sFilename
+ * This function is the constructor of the ToolbarDetail class
+ * @param string $Namespace Name of Plugin
+ * @param string $ToolbarId (NORMAL, GRID)
+ * @param string $Filename
*/
- public function __construct($sNamespace, $sToolbarId, $sFilename)
+ public function __construct($Namespace, $ToolbarId, $Filename)
{
- $this->sNamespace = $sNamespace;
- $this->sToolbarId = $sToolbarId;
- $this->sFilename = $sFilename;
+ $this->Namespace = $Namespace;
+ $this->ToolbarId = $ToolbarId;
+ $this->Filename = $Filename;
+ }
+
+ /**
+ * Check if name of plugin is equal to params
+ * @param string $Namespace
+ * @return bool
+ */
+ public function equalNamespaceTo($Namespace)
+ {
+ return $Namespace == $this->Namespace;
+ }
+
+ /**
+ * Check if toolbar id is equal to params
+ * @param string $ToolbarId
+ * @return bool
+ */
+ public function equalToolbarIdTo($ToolbarId)
+ {
+ return $ToolbarId == $this->ToolbarId;
+ }
+
+ /**
+ * Check if file exists to params
+ * @return bool
+ */
+ public function exitsFile()
+ {
+ return file_exists($this->Filename);
+ }
+
+ /**
+ * Include file
+ * @return bool
+ */
+ public function includeFile()
+ {
+ include($this->Filename);
}
}
diff --git a/workflow/engine/src/ProcessMaker/Plugins/Interfaces/TriggerDetail.php b/workflow/engine/src/ProcessMaker/Plugins/Interfaces/TriggerDetail.php
index 7b06bafda..30c4bb4c5 100644
--- a/workflow/engine/src/ProcessMaker/Plugins/Interfaces/TriggerDetail.php
+++ b/workflow/engine/src/ProcessMaker/Plugins/Interfaces/TriggerDetail.php
@@ -2,22 +2,67 @@
namespace ProcessMaker\Plugins\Interfaces;
+use ProcessMaker\Plugins\Traits\Attributes;
+
+/**
+ * Class TriggerDetail
+ * @package ProcessMaker\Plugins\Interfaces
+ */
class TriggerDetail
{
- public $sNamespace;
- public $sTriggerId;
- public $sTriggerName;
+ use Attributes;
+ private $Namespace;
+ private $TriggerId;
+ private $TriggerName;
/**
- * This function is the constructor of the triggerDetail class
- * @param string $sNamespace
- * @param string $sTriggerId
- * @param string $sTriggerName
+ * This function is the constructor of the TriggerDetail class
+ * @param string $Namespace
+ * @param string $TriggerId
+ * @param string $TriggerName
*/
- public function __construct($sNamespace, $sTriggerId, $sTriggerName)
+ public function __construct($Namespace, $TriggerId, $TriggerName)
{
- $this->sNamespace = $sNamespace;
- $this->sTriggerId = $sTriggerId;
- $this->sTriggerName = $sTriggerName;
+ $this->Namespace = $Namespace;
+ $this->TriggerId = $TriggerId;
+ $this->TriggerName = $TriggerName;
+ }
+
+ /**
+ * Get name of plugin
+ * @return string
+ */
+ public function getNamespace()
+ {
+ return $this->Namespace;
+ }
+
+ /**
+ * Get trigger name
+ * @return string
+ */
+ public function getTriggerName()
+ {
+ return $this->TriggerName;
+ }
+
+ /**
+ * Check if trigger id is equal to params
+ * @param string $triggerId
+ * @return bool
+ */
+ public function equalTriggerId($triggerId)
+ {
+ return $triggerId == $this->TriggerId;
+ }
+
+ /**
+ * Check if nmae of plugin is equal to params
+ * @param string $Namespace
+ * @return bool
+ */
+ public function equalNamespaceTo($Namespace)
+ {
+ return $Namespace == $this->Namespace;
}
}
diff --git a/workflow/engine/src/ProcessMaker/Plugins/PluginRegistry.php b/workflow/engine/src/ProcessMaker/Plugins/PluginRegistry.php
new file mode 100644
index 000000000..7ef8ea58e
--- /dev/null
+++ b/workflow/engine/src/ProcessMaker/Plugins/PluginRegistry.php
@@ -0,0 +1,1650 @@
+adapter = new PluginAdapter();
+ $this->constructStructure();
+ }
+
+ /**
+ * Load the singleton instance from stored
+ * @return PluginRegistry
+ */
+ public static function loadSingleton()
+ {
+ if (self::$instance == null) {
+ self::$instance = new PluginRegistry();
+ }
+ return self::$instance;
+ }
+
+ /**
+ * Register the plugin in the singleton
+ * @param string $Namespace Name Plugin
+ * @param string $Filename Path of the main plugin file
+ */
+ public function registerPlugin($Namespace, $Filename = null)
+ {
+ $ClassName = $Namespace . "plugin";
+ $plugin = new $ClassName($Namespace, $Filename);
+
+ if (isset($this->_aPluginDetails[$Namespace])) {
+ $this->_aPluginDetails[$Namespace]->setVersion($plugin->iVersion);
+ return;
+ }
+
+ $detail = new PluginDetail(
+ $Namespace,
+ $ClassName,
+ $Filename,
+ $plugin->sFriendlyName,
+ $plugin->sPluginFolder,
+ $plugin->sDescription,
+ $plugin->sSetupPage,
+ $plugin->iVersion,
+ isset($plugin->sCompanyLogo) ? $plugin->sCompanyLogo: '',
+ isset($plugin->aWorkspaces) ? $plugin->aWorkspaces: [],
+ isset($plugin->enable) ? $plugin->enable: false,
+ isset($plugin->bPrivate) ? $plugin->bPrivate: false
+ );
+ $this->_aPluginDetails[$Namespace] = $detail;
+ }
+
+ /**
+ * Get setup Plugins
+ * @return int
+ */
+ public function setupPlugins()
+ {
+ try {
+ require_once(PATH_CORE . "methods" . PATH_SEP . "enterprise" . PATH_SEP . "enterprise.php");
+ $iPlugins = 0;
+ /** @var PluginDetail $pluginDetail */
+ foreach ($this->_aPluginDetails as $pluginDetail) {
+ if ($pluginDetail->isEnabled()) {
+ if (!empty($pluginDetail->getFile()) && file_exists($pluginDetail->getFile())) {
+ $arrayFileInfo = pathinfo($pluginDetail->getFile());
+ $Filename = (($pluginDetail->getNamespace() == "enterprise") ?
+ PATH_CORE . "methods" . PATH_SEP . "enterprise" . PATH_SEP :
+ PATH_PLUGINS
+ ) . $arrayFileInfo["basename"];
+ if (!file_exists($Filename)) {
+ continue;
+ }
+ require_once $Filename;
+ $className = $pluginDetail->getClassName();
+ if (class_exists($className)) {
+ /** @var enterprisePlugin|\PMPlugin $Plugin */
+ $Plugin = new $className($pluginDetail->getNamespace(), $pluginDetail->getFile());
+ $this->_aPlugins[$pluginDetail->getNamespace()] = $Plugin;
+ $iPlugins++;
+ $Plugin->setup();
+ }
+ }
+ }
+ }
+ return $iPlugins;
+ } catch (Exception $e) {
+ global $G_PUBLISH;
+ $Message['MESSAGE'] = $e->getMessage();
+ $G_PUBLISH = new \Publisher();
+ $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $Message);
+ \G::RenderPage('publish');
+ die();
+ }
+ }
+
+ /**
+ * Save the current configuration of a plugin
+ * @param string $Namespace Name Plugin
+ */
+ public function savePlugin($Namespace)
+ {
+ $newStructurePlugin = $this->getAllAttributes($Namespace);
+ $plugin = $this->convertFieldTable($newStructurePlugin);
+ if ($plugin['PLUGIN_NAMESPACE'] && $plugin['PLUGIN_CLASS_NAME'] && $plugin['PLUGIN_FILE']) {
+ $fieldPlugin = \PluginsRegistry::loadOrCreateIfNotExists(md5($plugin['PLUGIN_NAMESPACE']), $plugin);
+ \PluginsRegistry::update($fieldPlugin);
+ }
+ }
+ /**
+ * Get the plugin details, by filename
+ * @param string $Filename
+ * @return null|PluginDetail
+ */
+ public function getPluginDetails($Filename)
+ {
+ /** @var PluginDetail $detail */
+ foreach ($this->_aPluginDetails as $detail) {
+ if ($Filename == baseName($detail->getFile())) {
+ return $detail;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Enable the plugin
+ * @param string $Namespace Name of plugin
+ * @return bool
+ * @throws Exception
+ */
+ public function enablePlugin($Namespace)
+ {
+ /** @var PluginDetail $currentPlugin */
+ if ($currentPlugin = $this->_aPluginDetails[$Namespace]) {
+ $this->registerFolder($Namespace, $Namespace, $currentPlugin->getFolder());
+ //register the default directory, later we can have more
+ $currentPlugin->setEnabled(true);
+ //PluginsRegistry::enable($Namespace);
+ $className = $currentPlugin->getClassName();
+ /** @var enterprisePlugin $Plugin */
+ if (class_exists($className)) {
+ $Plugin = new $className(
+ $currentPlugin->getNamespace(),
+ $currentPlugin->getFile()
+ );
+ } else {
+ $Plugin = $currentPlugin;
+ }
+ $this->_aPlugins[$Namespace] = $Plugin;
+ if (method_exists($Plugin, 'enable')) {
+ $Plugin->enable();
+ }
+ /*
+ * 1. register /src directory for autoloading
+ * 2. verify if rest service is enabled
+ * 3. register rest service directory
+ */
+ $pluginSrcDir = PATH_PLUGINS . $currentPlugin->getNamespace() . PATH_SEP . 'src';
+
+ if (is_dir($pluginSrcDir)) {
+ $loader = ClassLoader::getInstance();
+ $loader->add($pluginSrcDir);
+ }
+
+ if (array_key_exists($currentPlugin->getNamespace(), $this->_restServiceEnabled)
+ && $this->_restServiceEnabled[$currentPlugin->getNamespace()] == true
+ ) {
+ $Plugin->registerRestService();
+ }
+ return true;
+ } else {
+ throw new Exception("Unable to enable plugin '$Namespace' (plugin not found)");
+ }
+ }
+
+ /**
+ * Disable the plugin
+ * @param string $Namespace Name of plugin
+ * @param bool $eventPlugin Propagate disable event of plugin
+ * @throws Exception
+ */
+ public function disablePlugin($Namespace, $eventPlugin = true)
+ {
+ /** @var PluginDetail $currentPlugin */
+ $currentPlugin = $this->_aPluginDetails[$Namespace];
+ // If plugin class exists check if disable method exist,
+ // otherwise use default plugin details
+ $className = $currentPlugin->getClassName();
+ if ($currentPlugin && class_exists($className)) {
+ $currentPlugin->setEnabled(false);
+ //PluginsRegistry::disable($Namespace);
+ if ($eventPlugin) {
+ $plugin = new $className(
+ $currentPlugin->getNamespace(),
+ $currentPlugin->getFile()
+ );
+ if (method_exists($plugin, "disable")) {
+ $plugin->disable();
+ }
+ }
+ } else {
+ throw new Exception("Unable to disable plugin '$Namespace' (plugin not found)");
+ }
+ }
+
+ /**
+ * Get status plugin
+ * @param string $name Name of Plugin
+ * @return string Return a string with status plugin
+ * @throws Exception
+ */
+ public function getStatusPlugin($name)
+ {
+ /** @var PluginDetail $currentPlugin */
+ if (!empty($this->_aPluginDetails[$name]) && $currentPlugin = $this->_aPluginDetails[$name]) {
+ return $currentPlugin->isEnabled() ? "enabled" : "disabled";
+ }
+ return false;
+ }
+
+ /**
+ * Get status plugin
+ * @param string $Namespace Name of Plugin
+ * @return bool Return a boolean It's true if the plugin is active
+ * It is true if the plugin is active and false if it is disabled
+ * @throws Exception
+ */
+ public function isEnable($Namespace)
+ {
+ /** @var PluginDetail $currentPlugin */
+ if (!empty($this->_aPluginDetails[$Namespace]) && $currentPlugin = $this->_aPluginDetails[$Namespace]) {
+ return $currentPlugin->isEnabled();
+ }
+ return false;
+ }
+
+ /**
+ * Install a plugin archive.
+ * If pluginName is specified, the archive will
+ * only be installed if it contains this plugin.
+ * @param string $Filename
+ * @param string $Namespace Name of plugin
+ * @return bool true if enabled, false otherwise
+ * @throws Exception
+ */
+ public function installPluginArchive($Filename, $Namespace)
+ {
+ \G::LoadThirdParty("pear/Archive", "Tar");
+ $tar = new \Archive_Tar($Filename);
+ $files = $tar->listContent();
+ $plugins = array();
+ $namePlugin = array();
+ foreach ($files as $f) {
+ if (preg_match("/^([\w\.]*).ini$/", $f["filename"], $matches)) {
+ $plugins[] = $matches[1];
+ }
+ if (preg_match("/^.*($Namespace)\.php$/", $f["filename"], $matches)) {
+ $namePlugin[] = $matches[1];
+ }
+ }
+
+ if (count($plugins) > 1) {
+ throw new Exception("Multiple plugins in one archive are not supported currently");
+ }
+
+ if (isset($Namespace) && !in_array($Namespace, $namePlugin)) {
+ throw new Exception("Plugin '$Namespace' not found in archive");
+ }
+
+ $pluginFile = "$Namespace.php";
+
+ $res = $tar->extract(PATH_PLUGINS);
+ if (!file_exists(PATH_PLUGINS . $pluginFile)) {
+ throw (new Exception("File \"$pluginFile\" doesn't exist"));
+ }
+ $path = PATH_PLUGINS . $pluginFile;
+ require_once($path);
+ /** @var PluginDetail $details */
+ $details = $this->getPluginDetails($pluginFile);
+
+ $this->installPlugin($details->getNamespace());
+ $this->enablePlugin($details->getNamespace());
+ $this->savePlugin($details->getNamespace());
+ }
+
+ /**
+ * Uninstall plugin
+ * @param string $Namespace Name of plugin
+ * @throws Exception
+ */
+ public function uninstallPlugin($Namespace)
+ {
+ $pluginFile = $Namespace . ".php";
+
+ if (!file_exists(PATH_PLUGINS . $pluginFile)) {
+ throw (new Exception("File \"$pluginFile\" doesn't exist"));
+ }
+
+ $path = PATH_PLUGINS . $pluginFile;
+ $filter = new \InputFilter();
+ $path = $filter->validateInput($path, 'path');
+ require_once($path);
+
+ foreach ($this->_aPluginDetails as $namespace => $detail) {
+ if ($namespace == $Namespace) {
+ $this->enablePlugin($detail->sNamespace);
+ $this->disablePlugin($detail->sNamespace);
+
+ ///////
+ $plugin = new $detail->sClassName($detail->sNamespace, $detail->sFilename);
+ $this->_aPlugins[$detail->sNamespace] = $plugin;
+
+ if (method_exists($plugin, "uninstall")) {
+ $plugin->uninstall();
+ }
+
+ ///////
+ $this->savePlugin($detail->sNamespace);
+ ///////
+ $pluginDir = PATH_PLUGINS . $detail->sPluginFolder;
+
+ if (isset($detail->sFilename) && !empty($detail->sFilename) && file_exists($detail->sFilename)) {
+ unlink($detail->sFilename);
+ }
+
+ if (isset($detail->sPluginFolder) && !empty($detail->sPluginFolder) && file_exists($pluginDir)) {
+ \G::rm_dir($pluginDir);
+ }
+
+ ///////
+ $this->uninstallPluginWorkspaces(array($Namespace));
+ ///////
+ break;
+ }
+ }
+ }
+
+ /**
+ * Uninstall Plugin of Workspaces
+ * @param array $arrayPlugin
+ */
+ public function uninstallPluginWorkspaces($arrayPlugin)
+ {
+ $workspace = \System::listWorkspaces();
+
+ foreach ($workspace as $indexWS => $ws) {
+ $pluginRegistry = PluginRegistry::loadSingleton();
+ $attributes = $pluginRegistry->getAttributes();
+
+ foreach ($arrayPlugin as $index => $value) {
+ if (isset($attributes["_aPluginDetails"][$value])) {
+ $pluginRegistry->disablePlugin($value, 0);
+ $pluginRegistry->savePlugin($value);
+ }
+ }
+
+ }
+ }
+
+ /**
+ * Install and setup the plugin
+ * @param string $Namespace Name of plugin
+ */
+ public function installPlugin($Namespace)
+ {
+ try {
+ if (isset($this->_aPluginDetails[$Namespace])) {
+ /** @var PluginDetail $detail */
+ $detail = $this->_aPluginDetails[$Namespace];
+ $className= $detail->getClassName();
+ /** @var enterprisePlugin $oPlugin */
+ $oPlugin = new $className($detail->getNamespace(), $detail->getFile());
+ $oPlugin->setup();
+ $this->_aPlugins[$detail->getNamespace()] = $oPlugin;
+ $oPlugin->install();
+ //save in Table
+ $this->savePlugin($detail->getNamespace());
+ }
+ } catch (Exception $e) {
+ global $G_PUBLISH;
+ $Message['MESSAGE'] = $e->getMessage();
+ $G_PUBLISH = new \Publisher();
+ $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $Message);
+ \G::RenderPage('publish');
+ die();
+ }
+ }
+
+ /**
+ * Register a menu
+ * @param string $Namespace Name of plugin
+ * @param string $MenuId Id of menu
+ * @param string $Filename File of menu
+ */
+ public function registerMenu($Namespace, $MenuId, $Filename)
+ {
+ $found = false;
+ /** @var MenuDetail $menu */
+ foreach ($this->_aMenus as $menu) {
+ if ($menu->equalMenuIdTo($MenuId) && $menu->equalNamespaceTo($Namespace)) {
+ $found = true;
+ }
+ }
+ if (!$found) {
+ $menuDetail = new MenuDetail($Namespace, $MenuId, $Filename);
+ $this->_aMenus[] = $menuDetail;
+ }
+ }
+
+ /**
+ * Register a dashlet class
+ * @param string $Namespace
+ */
+ public function registerDashlets($Namespace)
+ {
+ $found = false;
+ foreach ($this->_aDashlets as $row => $detail) {
+ if ($Namespace == $detail) {
+ $found = true;
+ }
+ }
+ if (!$found) {
+ $this->_aDashlets[] = $Namespace;
+ }
+ }
+
+ /**
+ * Register a stylesheet
+ * @param string $Namespace Name of plugin
+ * @param string $CssFile File css
+ */
+ public function registerCss($Namespace, $CssFile)
+ {
+ $found = false;
+ /** @var CssFile $css */
+ foreach ($this->_aCss as $css) {
+ if ($css->equalCssFileTo($CssFile) && $css->equalNamespaceTo($Namespace)) {
+ $css->setCssFile($CssFile);
+ $found = true;
+ }
+ }
+ if (!$found) {
+ $cssFile = new CssFile($Namespace, $CssFile);
+ $this->_aCss[] = $cssFile;
+ }
+ }
+
+ /**
+ * Return all css
+ * @return array
+ */
+ public function getRegisteredCss()
+ {
+ return $this->_aCss;
+ }
+
+ /**
+ * Register a plugin javascript to run with core js script at same runtime
+ * @param string $Namespace Name of plugin
+ * @param string $CoreJsFile Core js file
+ * @param array|string $PluginJsFile File js of plugin
+ * @throws Exception
+ */
+ public function registerJavascript($Namespace, $CoreJsFile, $PluginJsFile)
+ {
+ /** @var JsFile $js */
+ foreach ($this->_aJs as $js) {
+ if ($js->equalCoreJsFile($CoreJsFile) && $js->equalNamespaceTo($Namespace)) {
+ $js->pushPluginJsFile($PluginJsFile);
+ return;
+ }
+ }
+ $js = new JsFile($Namespace, $CoreJsFile, []);
+ $js->pushPluginJsFile($PluginJsFile);
+ $this->_aJs[] = $js;
+ }
+
+ /**
+ * Return all plugin javascripts
+ * @return array
+ */
+ public function getRegisteredJavascript()
+ {
+ return $this->_aJs;
+ }
+
+ /**
+ * Return all plugin javascripts given a core js file, from all namespaces or a single namespace
+ * @param string $CoreJsFile Core js file
+ * @param string $Namespace Name of plugin
+ * @return array
+ */
+ public function getRegisteredJavascriptBy($CoreJsFile, $Namespace = '')
+ {
+ $scripts = array();
+ if ($Namespace == '') {
+ /** @var JsFile $js */
+ foreach ($this->_aJs as $i => $js) {
+ if ($js->equalCoreJsFile($CoreJsFile)) {
+ $scripts = array_merge($scripts, $js->getPluginJsFile());
+ }
+ }
+ } else {
+ /** @var JsFile $js */
+ foreach ($this->_aJs as $i => $js) {
+ if ($js->equalCoreJsFile($CoreJsFile) && $js->equalNamespaceTo($Namespace)) {
+ $scripts = array_merge($scripts, $js->getPluginJsFile());
+ }
+ }
+ }
+ return $scripts;
+ }
+
+ /**
+ * Unregister all javascripts from a namespace or a js core file given
+ * @param string $Namespace Name of plugin
+ * @param string $CoreJsFile Core js file
+ * @return array
+ */
+ public function unregisterJavascripts($Namespace, $CoreJsFile = '')
+ {
+ if ($CoreJsFile == '') {
+ /** @var JsFile $js */
+ foreach ($this->_aJs as $i => $js) {
+ if ($js->equalNamespaceTo($Namespace)) {
+ unset($this->_aJs[$i]);
+ }
+ }
+ // Re-index when all js were unregistered
+ $this->_aJs = array_values($this->_aJs);
+ } else {
+ /** @var JsFile $js */
+ foreach ($this->_aJs as $i => $js) {
+ if ($js->equalCoreJsFile($CoreJsFile) && $js->equalNamespaceTo($Namespace)) {
+ unset($this->_aJs[$i]);
+ // Re-index for each js that was unregistered
+ $this->_aJs = array_values($this->_aJs);
+ }
+ }
+ }
+ }
+
+ /**
+ * Register a reports class
+ * @param string $Namespace Name of plugin
+ */
+ public function registerReport($Namespace)
+ {
+ $found = false;
+ foreach ($this->_aReports as $detail) {
+ if ($Namespace == $detail) {
+ $found = true;
+ }
+ }
+ if (!$found) {
+ $this->_aReports[] = $Namespace;
+ }
+ }
+
+ /**
+ * Register a PmFunction class in the singleton
+ * @param string $Namespace Name of plugin
+ */
+ public function registerPmFunction($Namespace)
+ {
+ $found = false;
+ foreach ($this->_aPmFunctions as $row => $detail) {
+ if ($Namespace == $detail) {
+ $found = true;
+ }
+ }
+ if (!$found) {
+ $this->_aPmFunctions[] = $Namespace;
+ }
+ }
+
+ /**
+ * Register a redirectLogin class in the singleton
+ * @param string $Namespace Name of plugin
+ * @param string $Role
+ * @param string $PathMethod
+ */
+ public function registerRedirectLogin($Namespace, $Role, $PathMethod)
+ {
+ $found = false;
+ /** @var RedirectDetail $redirectDetail */
+ foreach ($this->_aRedirectLogin as $redirectDetail) {
+ if (($redirectDetail->equalNamespaceTo($Namespace)) && ($redirectDetail->equalRoleCodeTo($Role))) {
+ //Filters based on Workspace and Role Code
+ $found = true;
+ }
+ }
+ if (!$found) {
+ $this->_aRedirectLogin[] = new RedirectDetail($Namespace, $Role, $PathMethod);
+ }
+ }
+
+ /**
+ * Register a folder for methods
+ * @param string $Namespace Name of plugin
+ * @param string $FolderId Id of folder
+ * @param string $FolderName Name of folder
+ */
+ public function registerFolder($Namespace, $FolderId, $FolderName)
+ {
+ $found = false;
+ /** @var FolderDetail $folder */
+ foreach ($this->_aFolders as $folder) {
+ if ($folder->equalFolderIdTo($FolderId) && $folder->equalNamespaceTo($Namespace)) {
+ $found = true;
+ }
+ }
+
+ if (!$found) {
+ $this->_aFolders[] = new FolderDetail($Namespace, $FolderId, $FolderName);
+ }
+ }
+
+ /**
+ * Register a step for process
+ * @param string $Namespace Name of plugin
+ * @param string $StepId Id of step
+ * @param string $StepName Name of step
+ * @param string $StepTitle Title of step
+ * @param string $SetupStepPage
+ */
+ public function registerStep($Namespace, $StepId, $StepName, $StepTitle, $SetupStepPage = '')
+ {
+ $found = false;
+ /** @var StepDetail $detail */
+ foreach ($this->_aSteps as $detail) {
+ if ($detail->equalStepIdTo($StepId) && $detail->equalNamespaceTo($Namespace)) {
+ $found = true;
+ }
+ }
+
+ if (!$found) {
+ $this->_aSteps[] = new StepDetail($Namespace, $StepId, $StepName, $StepTitle, $SetupStepPage);
+ }
+ }
+
+ /**
+ * Return true if the FolderName is registered
+ * @param string $FolderName
+ * @return bool
+ */
+ public function isRegisteredFolder($FolderName)
+ {
+ /** @var FolderDetail $folder */
+ foreach ($this->_aFolders as $folder) {
+ $folderName = $folder->getFolderName();
+ if ($FolderName == $folderName && is_dir(PATH_PLUGINS . $folderName)) {
+ return true;
+ } elseif ($FolderName == $folderName &&
+ is_dir(PATH_PLUGINS . $folder->getNamespace() . PATH_SEP . $folderName)) {
+ return $folder->getNamespace();
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Return all menus related to a menuId
+ * @param string $MenuId
+ */
+ public function getMenus($MenuId)
+ {
+ /** @var MenuDetail $menu */
+ foreach ($this->_aMenus as $menu) {
+ if ($menu->equalMenuIdTo($MenuId) && $menu->exitsFile()) {
+ $menu->includeFileMenu();
+ }
+ }
+ }
+
+ /**
+ * Return all dashlets classes registered
+ * @return array
+ */
+ public function getDashlets()
+ {
+ return $this->_aDashlets;
+ }
+
+ /**
+ * This function returns all reports registered
+ * @return array
+ */
+ public function getReports()
+ {
+ return $this->_aReports;
+ }
+
+ /**
+ * This function returns all pmFunctions registered
+ * @return array
+ */
+ public function getPmFunctions()
+ {
+ return $this->_aPmFunctions;
+ }
+
+ /**
+ * This function returns all steps registered
+ * @return array
+ */
+ public function getSteps()
+ {
+ return $this->_aSteps;
+ }
+
+ /**
+ * This function returns all redirect registered
+ * @return array
+ */
+ public function getRedirectLogins()
+ {
+ return $this->_aRedirectLogin;
+ }
+
+ /**
+ * execute all triggers related to a triggerId
+ * TODO
+ *
+ * @param string $TriggerId
+ * @param $oData
+ * @return mixed
+ */
+ public function executeTriggers($TriggerId, $oData)
+ {
+ \G::LoadThirdParty("pear", "PEAR");
+ /** @var TriggerDetail $trigger */
+ foreach ($this->_aTriggers as $trigger) {
+ if ($trigger->equalTriggerId($TriggerId)) {
+ //review all folders registered for this namespace
+ $found = false;
+ $classFile = '';
+ /** @var FolderDetail $folder */
+ foreach ($this->_aFolders as $folder) {
+ $fname = $folder->equalNamespaceTo('enterprise') ?
+ PATH_CORE . 'classes' . PATH_SEP . 'class.' . $folder->getFolderName() . '.php' :
+ PATH_PLUGINS . $folder->getFolderName() . PATH_SEP . 'class.' . $folder->getFolderName() . '.php';
+ if ($trigger->equalNamespaceTo($folder->getNamespace()) && file_exists($fname)) {
+ $found = true;
+ $classFile = $fname;
+ }
+ }
+ if ($found) {
+ require_once($classFile);
+ $sClassName = substr($this->_aPluginDetails[$trigger->getNamespace()]->sClassName, 0, 1) .
+ str_replace(
+ 'plugin',
+ 'class',
+ substr($this->_aPluginDetails[$trigger->getNamespace()]->sClassName, 1)
+ );
+ $obj = new $sClassName();
+ $methodName = $trigger->getTriggerName();
+ $response = $obj->{$methodName}($oData);
+ if (\PEAR::isError($response)) {
+ print $response->getMessage();
+ return;
+ }
+ return $response;
+ } else {
+ print "error in call method " . $trigger->getTriggerName();
+ }
+ }
+ }
+ }
+
+ /**
+ * verify if exists triggers related to a triggerId
+ * @param string $TriggerId
+ * @return bool
+ */
+ public function existsTrigger($TriggerId)
+ {
+ $found = false;
+ /** @var TriggerDetail $trigger */
+ foreach ($this->_aTriggers as $trigger) {
+ if ($trigger->equalTriggerId($TriggerId)) {
+ //review all folders registered for this namespace
+ /** @var FolderDetail $folder */
+ foreach ($this->_aFolders as $folder) {
+ $folderName = $folder->getFolderName();
+ $fileName = $folder->getNamespace() == 'enterprise' ?
+ PATH_CORE . 'classes' . PATH_SEP . 'class.' . $folderName . '.php' :
+ PATH_PLUGINS . $folderName . PATH_SEP . 'class.' . $folderName . '.php';
+ if ($trigger->getNamespace() == $folder->getNamespace() && file_exists($fileName)) {
+ $found = true;
+ }
+ }
+
+ }
+ }
+ return $found;
+ }
+
+ /**
+ * Return info related to a triggerId
+ * @param int $triggerId
+ * @return TriggerDetail
+ */
+ public function getTriggerInfo($triggerId)
+ {
+ $found = null;
+ /** @var TriggerDetail $trigger */
+ foreach ($this->_aTriggers as $trigger) {
+ if ($trigger->equalTriggerId($triggerId)) {
+ //review all folders registered for this namespace
+ /** @var FolderDetail $folder */
+ foreach ($this->_aFolders as $folder) {
+ $filename = PATH_PLUGINS . $folder->getFolderName() . PATH_SEP .
+ 'class.' . $folder->getFolderName() . '.php';
+ if ($trigger->equalNamespaceTo($folder->getNamespace()) && file_exists($filename)) {
+ $found = $trigger;
+ }
+ }
+ }
+ }
+ return $found;
+ }
+
+ /**
+ * Register a trigger
+ * @param string $Namespace
+ * @param string $TriggerId
+ * @param string $TriggerName
+ */
+ public function registerTrigger($Namespace, $TriggerId, $TriggerName)
+ {
+ $found = false;
+ /** @var TriggerDetail $trigger */
+ foreach ($this->_aTriggers as $trigger) {
+ if ($trigger->equalTriggerId($TriggerId) && $trigger->equalNamespaceTo($Namespace)) {
+ $found = true;
+ }
+ }
+ if (!$found) {
+ $triggerDetail = new TriggerDetail($Namespace, $TriggerId, $TriggerName);
+ $this->_aTriggers[] = $triggerDetail;
+ }
+ }
+
+ /**
+ * Get plugin
+ * @param string $Namespace Name of plugin
+ * @return mixed
+ */
+ public function &getPlugin($Namespace)
+ {
+ $oPlugin = null;
+ if (array_key_exists($Namespace, $this->_aPlugins)) {
+ $oPlugin = $this->_aPlugins[$Namespace];
+ }
+ return $oPlugin;
+ }
+
+ /**
+ * Set company logo
+ * @param string $Namespace Name of plugin
+ * @param string $Filename File name logo
+ * @return void
+ */
+ public function setCompanyLogo($Namespace, $Filename)
+ {
+ foreach ($this->_aPluginDetails as $detail) {
+ if ($Namespace == $detail->sNamespace) {
+ $this->_aPluginDetails[$Namespace]->sCompanyLogo = $Filename;
+ }
+ }
+ }
+
+ /**
+ * Get company logo
+ * @param string $default
+ * @return mixed
+ */
+ public function getCompanyLogo($default)
+ {
+ $CompanyLogo = $default;
+ /** @var PluginDetail $detail */
+ foreach ($this->_aPluginDetails as $detail) {
+ if (trim($detail->getCompanyLogo()) != '') {
+ $CompanyLogo = $detail->getCompanyLogo();
+ }
+ }
+ return $CompanyLogo;
+ }
+
+ /**
+ * This function execute a Method
+ * @param string $Namespace Name of plugin
+ * @param string $MethodName
+ * @param object $oData
+ * @return mixed
+ * @throws Exception
+ */
+ public function executeMethod($Namespace, $MethodName, $oData)
+ {
+ $response = null;
+ try {
+ $details = $this->_aPluginDetails[$Namespace];
+ $pluginFolder = $details->sPluginFolder;
+ $className = $details->sClassName;
+ $classFile = PATH_PLUGINS . $pluginFolder . PATH_SEP . 'class.' . $pluginFolder . '.php';
+ if (file_exists($classFile)) {
+ $sClassName = substr_replace($className, "class", -6, 6);
+ if (!class_exists($sClassName)) {
+ require_once $classFile;
+ }
+ $obj = new $sClassName();
+ if (!in_array($MethodName, get_class_methods($obj))) {
+ throw (new Exception("The method '$MethodName' doesn't exist in class '$sClassName' "));
+ }
+ $obj->sNamespace = $details->sNamespace;
+ $obj->sClassName = $details->sClassName;
+ $obj->sFilename = $details->sFilename;
+ $obj->iVersion = $details->iVersion;
+ $obj->sFriendlyName = $details->sFriendlyName;
+ $obj->sPluginFolder = $details->sPluginFolder;
+ $response = $obj->{$MethodName}($oData);
+ }
+ return $response;
+ } catch (Exception $e) {
+ throw ($e);
+ }
+ }
+
+ /**
+ * this function gets Fields For Page on Setup
+ * @param string $Namespace Name of plugin
+ * @return object
+ */
+ public function getFieldsForPageSetup($Namespace)
+ {
+ $oData = null;
+ return $this->executeMethod($Namespace, 'getFieldsForPageSetup', $oData);
+ }
+
+ /**
+ * This function updates Fields For Page on Setup
+ * @param string $Namespace
+ * @param object $oData
+ * @return mixed
+ * @throws Exception
+ */
+ public function updateFieldsForPageSetup($Namespace, $oData)
+ {
+ if (!isset($this->_aPluginDetails[$Namespace])) {
+ throw (new Exception("The namespace '$Namespace' doesn't exist in plugins folder."));
+ }
+ return $this->executeMethod($Namespace, 'updateFieldsForPageSetup', $oData);
+ }
+
+ /**
+ * @deprecated
+ */
+ public function eevalidate()
+ {
+ }
+
+ /**
+ * Register a toolbar for dynaform editor
+ * @param string $Namespace Name of plugin
+ * @param string $ToolbarId (NORMAL, GRID)
+ * @param string $Filename
+ */
+ public function registerToolbarFile($Namespace, $ToolbarId, $Filename)
+ {
+ $found = false;
+ /** @var ToolbarDetail $toolbarFile */
+ foreach ($this->_aToolbarFiles as $toolbarFile) {
+ if ($toolbarFile->equalToolbarIdTo($ToolbarId) && $toolbarFile->equalNamespaceTo($Namespace)) {
+ $found = true;
+ }
+ }
+ if (!$found) {
+ $toolbarDetail = new ToolbarDetail($Namespace, $ToolbarId, $Filename);
+ $this->_aToolbarFiles[] = $toolbarDetail;
+ }
+ }
+
+ /**
+ * Return all toolbar files related to a ToolbarId
+ * @param string $ToolbarId (NORMAL, GRID)
+ */
+ public function getToolbarOptions($ToolbarId)
+ {
+ /** @var ToolbarDetail $toolbarFile */
+ foreach ($this->_aToolbarFiles as $toolbarFile) {
+ if ($toolbarFile->equalToolbarIdTo($ToolbarId) && $toolbarFile->exitsFile()) {
+ $toolbarFile->includeFile();
+ }
+ }
+ }
+
+ /**
+ * Register a Case Scheduler Plugin
+ * @param string $Namespace Name of plugin
+ * @param string $ActionId
+ * @param string $ActionForm
+ * @param string $ActionSave
+ * @param string $ActionExecute
+ * @param string $ActionGetFields
+ */
+ public function registerCaseSchedulerPlugin(
+ $Namespace,
+ $ActionId,
+ $ActionForm,
+ $ActionSave,
+ $ActionExecute,
+ $ActionGetFields
+ ) {
+ $found = false;
+ /** @var CaseSchedulerPlugin $caseScheduler */
+ foreach ($this->_aCaseSchedulerPlugin as $caseScheduler) {
+ if ($caseScheduler->equalActionIdTo($ActionId) && $caseScheduler->equalNamespaceTo($Namespace)) {
+ $found = true;
+ }
+ }
+
+ if (!$found) {
+ $this->_aCaseSchedulerPlugin[] = new CaseSchedulerPlugin(
+ $Namespace,
+ $ActionId,
+ $ActionForm,
+ $ActionSave,
+ $ActionExecute,
+ $ActionGetFields
+ );
+ }
+ }
+
+ /**
+ * This function returns all Case Scheduler Plugins registered
+ * @return array
+ */
+ public function getCaseSchedulerPlugins()
+ {
+ return $this->_aCaseSchedulerPlugin;
+ }
+
+ /**
+ * Register a Task Extended property page
+ * @param string $Namespace Name of plugin
+ * @param string $Page
+ * @param string $Name
+ * @param string $Icon
+ */
+ public function registerTaskExtendedProperty($Namespace, $Page, $Name, $Icon)
+ {
+ $found = false;
+ /** @var TaskExtendedProperty $task */
+ foreach ($this->_aTaskExtendedProperties as $task) {
+ if ($task && $task->equalPageTo($Page) && $task->equalNamespaceTo($Namespace)) {
+ $task->setName($Name);
+ $task->setIcon($Icon);
+ $found = true;
+ }
+ }
+ if (!$found) {
+ $taskExtendedProperty = new TaskExtendedProperty($Namespace, $Page, $Name, $Icon);
+ $this->_aTaskExtendedProperties[] = $taskExtendedProperty;
+ }
+ }
+
+ /**
+ * Register a dashboard page for cases
+ * @param string $Namespace
+ * @param string $Page
+ * @param string $Name
+ * @param string $Icon
+ */
+ public function registerDashboardPage($Namespace, $Page, $Name, $Icon)
+ {
+ $found = false;
+ /** @var DashboardPage $dashboardPage */
+ foreach ($this->_aDashboardPages as $dashboardPage) {
+ if ($dashboardPage->equalPageTo($Page) && $dashboardPage->equalNamespaceTo($Namespace)) {
+ $dashboardPage->setName($Name);
+ $dashboardPage->setIcon($Icon);
+ $found = true;
+ }
+ }
+ if (!$found) {
+ $dashboardPage = new DashboardPage($Namespace, $Page, $Name, $Icon);
+ $this->_aDashboardPages[] = $dashboardPage;
+ }
+ }
+
+ /**
+ * Register a rest service class from a plugin to be served by processmaker
+ * @param string $Namespace The namespace for the plugin
+ * @return bool
+ */
+ public function registerRestService($Namespace)
+ {
+ $baseSrcPluginPath = PATH_PLUGINS . $Namespace . PATH_SEP . "src";
+ $apiPath = PATH_SEP . "Services" . PATH_SEP . "Api" . PATH_SEP . ucfirst($Namespace);
+ $classesList = (new \Bootstrap())->rglob('*', 0, $baseSrcPluginPath . $apiPath);
+
+ foreach ($classesList as $classFile) {
+ if (pathinfo($classFile, PATHINFO_EXTENSION) === 'php') {
+ $ns = str_replace(
+ '/',
+ '\\',
+ str_replace('.php', '', str_replace($baseSrcPluginPath, '', $classFile))
+ );
+
+ // Ensure that is registering only existent classes.
+ if (class_exists($ns)) {
+ $this->_restServices[$Namespace][] = array(
+ "filepath" => $classFile,
+ "namespace" => $ns
+ );
+ }
+ }
+ }
+
+ WebApplication::purgeRestApiCache(basename(PATH_DATA_SITE));
+
+ return true;
+ }
+
+ /**
+ * Register a extend rest service class from a plugin to be served by processmaker
+ *
+ * @param string $Namespace The namespace for the plugin
+ * @param string $ClassName The service (api) class name
+ */
+ public function registerExtendsRestService($Namespace, $ClassName)
+ {
+ $baseSrcPluginPath = PATH_PLUGINS . $Namespace . PATH_SEP . "src";
+ $apiPath = PATH_SEP . "Services" . PATH_SEP . "Ext" . PATH_SEP;
+ $classFile = $baseSrcPluginPath . $apiPath . 'Ext' . $ClassName . '.php';
+ if (file_exists($classFile)) {
+ $this->_restExtendServices[$Namespace][$ClassName] = array(
+ "filePath" => $classFile,
+ "classParent" => $ClassName,
+ "classExtend" => 'Ext' . $ClassName
+ );
+ }
+ }
+
+ /**
+ * Get a extend rest service class from a plugin to be served by processmaker
+ * @param string $ClassName The service (api) class name
+ * @return array
+ */
+ public function getExtendsRestService($ClassName)
+ {
+ $responseRestExtendService = array();
+ foreach ($this->_restExtendServices as $Namespace => $restExtendService) {
+ if (isset($restExtendService[$ClassName])) {
+ $responseRestExtendService = $restExtendService[$ClassName];
+ break;
+ }
+ }
+ return $responseRestExtendService;
+ }
+
+ /**
+ * Remove a extend rest service class from a plugin to be served by processmaker
+ * @param string $Namespace
+ * @param string $ClassName The service (api) class name
+ * @return bool
+ */
+ public function disableExtendsRestService($Namespace, $ClassName = '')
+ {
+ if (isset($this->_restExtendServices[$Namespace][$ClassName]) && !empty($ClassName)) {
+ unset($this->_restExtendServices[$Namespace][$ClassName]);
+ } elseif (empty($ClassName)) {
+ unset($this->_restExtendServices[$Namespace]);
+ }
+ }
+
+ /**
+ * Unregister a rest service class of a plugin
+ * @param string $Namespace The namespace for the plugin
+ */
+ public function unregisterRestService($Namespace)
+ {
+ if ($this->_restServices) {
+ unset($this->_restServices[$Namespace]);
+ WebApplication::purgeRestApiCache(basename(PATH_DATA_SITE));
+ }
+ }
+
+ /**
+ * Return all rest services registered
+ * @return array
+ */
+ public function getRegisteredRestServices()
+ {
+ return $this->_restServices;
+ }
+
+ /**
+ * Return all dashboard pages
+ * @return array
+ */
+ public function getDashboardPages()
+ {
+ return $this->_aDashboardPages;
+ }
+
+ /**
+ * Return all task extended properties
+ * @return array
+ */
+ public function getTaskExtendedProperties()
+ {
+ return $this->_aTaskExtendedProperties;
+ }
+
+ public function registerDashboard()
+ {
+ // Dummy function for backwards compatibility
+ }
+
+ /**
+ * Verify Translation of plugin
+ * @param string $Namespace Name of plugin
+ */
+ public function verifyTranslation($Namespace)
+ {
+ $language = new \Language();
+ $pathPluginTranslations = PATH_PLUGINS . $Namespace . PATH_SEP . 'translations' . PATH_SEP;
+ if (file_exists($pathPluginTranslations . 'translations.php')) {
+ if (!file_exists($pathPluginTranslations . $Namespace . '.' . SYS_LANG . '.po')) {
+ $language->createLanguagePlugin($Namespace, SYS_LANG);
+ }
+ $language->updateLanguagePlugin($Namespace, SYS_LANG);
+ }
+ }
+
+ /**
+ * Register a cron file
+ * @param string $Namespace Name of Plugin
+ * @param string $CronFile
+ */
+ public function registerCronFile($Namespace, $CronFile)
+ {
+ $found = false;
+ /** @var CronFile $cronFile */
+ foreach ($this->_aCronFiles as $cronFile) {
+ if ($cronFile->equalCronFileTo($CronFile) && $cronFile->equalNamespaceTo($Namespace)) {
+ $cronFile->setCronFile($CronFile);
+ $found = true;
+ }
+ }
+ if (!$found) {
+ $CronFile = new CronFile($Namespace, $CronFile);
+ $this->_aCronFiles[] = $CronFile;
+ }
+ }
+
+ /**
+ * Function to enable rest service for plugins
+ * @param string $Namespace Name of plugin
+ * @param bool $enable
+ */
+ public function enableRestService($Namespace, $enable)
+ {
+ $this->_restServiceEnabled[$Namespace] = $enable;
+ }
+
+ /**
+ * Return all cron files registered
+ * @return array
+ */
+ public function getCronFiles()
+ {
+ return $this->_aCronFiles;
+ }
+
+ /**
+ * Update the plugin attributes in all workspaces
+ * @param string $Namespace Name of Plugin
+ * @throws Exception
+ */
+ public function updatePluginAttributesInAllWorkspaces($Namespace)
+ {
+ try {
+ \G::LoadClass("wsTools");
+
+ //Set variables
+ $pluginFileName = $Namespace . ".php";
+
+ //Verify data
+ if (!file_exists(PATH_PLUGINS . $pluginFileName)) {
+ throw new Exception("Error: The plugin not exists");
+ }
+
+ //Update plugin attributes
+ require_once(PATH_PLUGINS . $pluginFileName);
+
+ $pmPluginRegistry = PluginRegistry::loadSingleton();
+
+ $pluginDetails = $pmPluginRegistry->getPluginDetails($pluginFileName);
+
+ if (is_array($pluginDetails->getWorkspaces()) &&
+ count($pluginDetails->getWorkspaces()) > 0
+ ) {
+ $arrayWorkspace = array();
+
+ foreach (\System::listWorkspaces() as $value) {
+ $workspaceTools = $value;
+
+ $arrayWorkspace[] = $workspaceTools->name;
+ }
+ //Workspaces to update
+ $arrayWorkspaceAux = array_diff($arrayWorkspace, $pluginDetails->getWorkspaces());
+ $strWorkspaceNoWritable = "";
+
+ $arrayWorkspace = array();
+
+ foreach ($arrayWorkspaceAux as $value) {
+ $workspace = $value;
+
+ $workspacePathDataSite = PATH_DATA . "sites" . PATH_SEP . $workspace . PATH_SEP;
+
+ if (file_exists($workspacePathDataSite . "plugin.singleton")) {
+ $pmPluginRegistry = PluginRegistry::loadSingleton();
+
+ if (isset($pmPluginRegistry->_aPluginDetails[$Namespace])) {
+ if (!is_writable($workspacePathDataSite . "plugin.singleton")) {
+ $strWorkspaceNoWritable .= (($strWorkspaceNoWritable != "") ? ", " : "") . $workspace;
+ }
+
+ $arrayWorkspace[] = $workspace;
+ }
+ }
+ }
+
+ //Verify data
+ if ($strWorkspaceNoWritable != "") {
+ throw new Exception(
+ 'Error: The workspaces ' .
+ $strWorkspaceNoWritable .
+ ' has problems of permissions of write in file "plugin.singleton", solve this problem'
+ );
+ }
+
+ //Update plugin attributes
+ foreach ($arrayWorkspace as $value) {
+ $workspace = $value;
+
+ $workspacePathDataSite = PATH_DATA . "sites" . PATH_SEP . $workspace . PATH_SEP;
+
+ $pmPluginRegistry = PluginRegistry::loadSingleton();
+
+ $pmPluginRegistry->disablePlugin($Namespace);
+
+ $pmPluginRegistry->savePlugin($Namespace);
+ }
+ }
+ } catch (Exception $e) {
+ throw $e;
+ }
+ }
+
+ /**
+ * Register designer menu file
+ * @param string $pluginName Plugin name
+ * @param string $file Designer menu file
+ * @throws Exception
+ */
+ public function registerDesignerMenu($pluginName, $file)
+ {
+ try {
+ $flagFound = false;
+
+ foreach ($this->_arrayDesignerMenu as $value) {
+ if ($value->pluginName == $pluginName && $value->file == $file) {
+ $flagFound = true;
+ break;
+ }
+ }
+
+ if (!$flagFound) {
+ $obj = new \stdClass();
+ $obj->pluginName = $pluginName;
+ $obj->file = $file;
+
+ $this->_arrayDesignerMenu[] = $obj;
+ }
+ } catch (Exception $e) {
+ throw $e;
+ }
+ }
+
+ /**
+ * Return all designer menu files registered
+ * @return array
+ * @throws Exception
+ */
+ public function getDesignerMenu()
+ {
+ try {
+ return $this->_arrayDesignerMenu;
+ } catch (Exception $e) {
+ throw $e;
+ }
+ }
+
+ /**
+ * Replace new options to menu
+ * @param string $namespace
+ * @param array $from
+ * @param array $options
+ * @return void
+ */
+ public function registerMenuOptionsToReplace($namespace, $from, $options)
+ {
+ if (isset($from["section"]) && isset($from["menuId"])) {
+ $section = $from["section"];
+ $oMenuFromPlugin = $this->_aMenuOptionsToReplace;
+ if (array_key_exists($section, $oMenuFromPlugin)) {
+ unset($this->_aMenuOptionsToReplace[$from["section"]]);
+ }
+ $this->_aMenuOptionsToReplace[$from["section"]][$from["menuId"]][] = $options;
+ }
+ }
+
+ /**
+ * Return all menu Options from a specific section
+ * @param string $strMenuName
+ * @return array
+ */
+ public function getMenuOptionsToReplace($strMenuName)
+ {
+ $oMenuFromPlugin = $this->_aMenuOptionsToReplace;
+ if (sizeof($oMenuFromPlugin)) {
+ if (array_key_exists($strMenuName, $oMenuFromPlugin)) {
+ return $oMenuFromPlugin[$strMenuName];
+ }
+ }
+ }
+
+ /**
+ * Register a callBackFile in the singleton
+ * @param string $Namespace
+ * @param string $CallBackFile
+ * @throws Exception
+ */
+ public function registerImportProcessCallback($Namespace, $CallBackFile)
+ {
+ try {
+ $found = false;
+ /** @var ImportCallBack $import */
+ foreach ($this->_aImportProcessCallbackFile as $import) {
+ if ($import->equalCallBackFileTo($CallBackFile) && $import->equalNamespaceTo($Namespace)) {
+ $import->setCallBackFile($CallBackFile);
+ $found = true;
+ }
+ }
+ if (!$found) {
+ $CallBackFile = new ImportCallBack($Namespace, $CallBackFile);
+ $this->_aImportProcessCallbackFile[] = $CallBackFile;
+ }
+ } catch (Exception $e) {
+ throw $e;
+ }
+ }
+
+ /**
+ * Return all callBackFiles registered
+ * @return array
+ */
+ public function getImportProcessCallback()
+ {
+ return $this->_aImportProcessCallbackFile;
+ }
+
+ /**
+ * Register a callBackFile
+ * @param string $callBackFile
+ * @throws Exception
+ */
+ public function registerOpenReassignCallback($callBackFile)
+ {
+ try {
+ $found = false;
+ /** @var OpenReassignCallback $open */
+ foreach ($this->_aOpenReassignCallback as $open) {
+ if ($open->equalCallBackFileTo($callBackFile)) {
+ $open->setCallBackFile($callBackFile);
+ $found = true;
+ }
+ }
+ if (!$found) {
+ $callBackFile = new OpenReassignCallback($callBackFile);
+ $this->_aOpenReassignCallback[] = $callBackFile;
+ }
+ } catch (Exception $e) {
+ throw $e;
+ }
+ }
+
+ /**
+ * Return all callBackFiles registered
+ *
+ * @return array
+ */
+ public function getOpenReassignCallback()
+ {
+ return $this->_aOpenReassignCallback;
+ }
+
+ public function getPluginsData()
+ {
+ return $this->_aPlugins;
+ }
+
+ /**
+ * The following function method extracts the plugin if exists one
+ * with the same uppercase characters, this is required for the
+ *
+ * @param string $code
+ * @return array|object
+ */
+ public function getPluginByCode($code)
+ {
+ $plugin = new \stdClass();
+ foreach ($this->_aPlugins as $plugin) {
+ $plugin = (array)$plugin;
+ if (strtoupper($plugin['sNamespace']) == $code) {
+ return (object)$plugin;
+ }
+ }
+ return $plugin;
+ }
+
+ /**
+ * Checks if the plugin name is Enterprise Plugin
+ *
+ * @param string $pluginName Plugin name
+ * @param string $path Path to plugin
+ *
+ * @return bool Returns TRUE when plugin name is Enterprise Plugin, FALSE otherwise
+ */
+ public function isEnterprisePlugin($pluginName, $path = null)
+ {
+ $path = (!is_null($path) && $path != '') ? rtrim($path, '/\\') . PATH_SEP : PATH_PLUGINS;
+ $pluginFile = $pluginName . '.php';
+
+ //Return
+ return preg_match(
+ '/^.*class\s+' . $pluginName . 'Plugin\s+extends\s+(?:enterprisePlugin)\s*\{.*$/i',
+ str_replace(["\n", "\r", "\t"], ' ', file_get_contents($path . $pluginFile))
+ );
+ }
+
+ /**
+ * Registry in an array routes for js or css files.
+ * @param string $pluginName
+ * @param string $pathFile
+ * @throws Exception
+ */
+ public function registerDesignerSourcePath($pluginName, $pathFile)
+ {
+ try {
+ $flagFound = false;
+
+ foreach ($this->_arrayDesignerSourcePath as $designer) {
+ if ($designer->pluginName == $pluginName && $designer->pathFile == $pathFile) {
+ $flagFound = true;
+ break;
+ }
+ }
+
+ if (!$flagFound) {
+ $obj = new \stdClass();
+ $obj->pluginName = $pluginName;
+ $obj->pathFile = $pathFile;
+
+ $this->_arrayDesignerSourcePath[] = $obj;
+ }
+ } catch (Exception $e) {
+ throw $e;
+ }
+ }
+
+ /**
+ * You obtain an array containing the routes recorded by the
+ * function registerDesignerSourcePath.
+ * @return array
+ * @throws Exception
+ */
+ public function getDesignerSourcePath()
+ {
+ try {
+ return $this->_arrayDesignerSourcePath;
+ } catch (Exception $e) {
+ throw $e;
+ }
+ }
+}
diff --git a/workflow/engine/src/ProcessMaker/Plugins/PluginsRegistry.php b/workflow/engine/src/ProcessMaker/Plugins/PluginsRegistry.php
deleted file mode 100644
index 99f5c4d9d..000000000
--- a/workflow/engine/src/ProcessMaker/Plugins/PluginsRegistry.php
+++ /dev/null
@@ -1,1726 +0,0 @@
-Plugins;
- }
-
- /**
- * @param array $Plugins
- */
- public function setPlugins($Plugins)
- {
- $this->Plugins = $Plugins;
- }
-
- /**
- * PluginRegistry constructor.
- */
- public function __construct()
- {
- $this->pluginAdapter = new PluginAdapter();
- $oPlugins = $this->pluginAdapter->getPluginsDefinition($this);
- }
-
- /**
- * Load the singleton instance from a serialized stored file
- *
- * @return PluginsRegistry|static
- * @throws \Exception
- */
- public static function loadSingleton()
- {
- if (self::$instance == null) {
- self::$instance = new PluginsRegistry();
- }
- return self::$instance;
- }
-
- /**
- * This function is instancing to this class
- * param
- *
- * @return object
- * @deprecated
- */
- public static function getSingleton()
- {
- if (self::$instance == null) {
- self::$instance = new PluginsRegistry();
- }
- return self::$instance;
- }
-
- /**
- * Register the plugin in the singleton
- *
- * @param string $sNamespace
- * @param string $sFilename
- */
- public function registerPlugin($sNamespace, $sFilename = null)
- {
- //require_once ($sFilename);
- $sClassName = $sNamespace . "plugin";
- $plugin = new $sClassName($sNamespace, $sFilename);
-
- if (isset($this->_aPluginDetails[$sNamespace])) {
- $this->_aPluginDetails[$sNamespace]->iVersion = $plugin->iVersion;
- return;
- }
-
- $detail = new PluginDetail(
- $sNamespace,
- $sClassName,
- $sFilename,
- $plugin->sFriendlyName,
- $plugin->sPluginFolder,
- $plugin->sDescription,
- $plugin->sSetupPage,
- $plugin->iVersion
- );
-
- if (isset($plugin->aWorkspaces)) {
- $detail->aWorkspaces = $plugin->aWorkspaces;
- }
-
- if (isset($plugin->bPrivate)) {
- $detail->bPrivate = $plugin->bPrivate;
- }
-
- $this->_aPluginDetails[$sNamespace] = $detail;
- }
-
- /**
- * get the plugin details, by filename
- *
- * @param string $sFilename
- * @return null|PluginDetail
- */
- public function getPluginDetails($sFilename)
- {
- foreach ($this->_aPluginDetails as $key => $row) {
- if ($sFilename == baseName($row->sFilename)) {
- return $row;
- }
- }
- return null;
- }
-
- /**
- * Enable the plugin in the singleton
- *
- * @param string $sNamespace
- * @return bool
- * @throws \Exception
- */
- public function enablePlugin($sNamespace)
- {
- if ($currentPlugin = $this->_aPluginDetails[$sNamespace]) {
- $this->registerFolder($sNamespace, $sNamespace, $currentPlugin->sPluginFolder);
- //register the default directory, later we can have more
- $currentPlugin->enabled = true;
- /** @var enterprisePlugin $oPlugin */
- if (class_exists($currentPlugin->sClassName)) {
- $oPlugin = new $currentPlugin->sClassName(
- $currentPlugin->sNamespace,
- $currentPlugin->sFilename
- );
- } else {
- $oPlugin = $currentPlugin;
- }
- $this->_aPlugins[$currentPlugin->sNamespace] = $oPlugin;
- if (method_exists($oPlugin, 'enable')) {
- $oPlugin->enable();
- }
-
- /*
- * 1. register /src directory for autoloading
- * 2. verify if rest service is enabled
- * 3. register rest service directory
- */
- $pluginSrcDir = PATH_PLUGINS . $currentPlugin->sNamespace . PATH_SEP . 'src';
-
- if (is_dir($pluginSrcDir)) {
- $loader = ClassLoader::getInstance();
- $loader->add($pluginSrcDir);
- }
-
- if (array_key_exists($currentPlugin->sNamespace, $this->_restServiceEnabled)
- && $this->_restServiceEnabled[$currentPlugin->sNamespace] == true
- ) {
- $oPlugin->registerRestService();
- }
- return true;
- } else {
- throw new \Exception("Unable to enable plugin '$sNamespace' (plugin not found)");
- }
- }
-
- /**
- * disable the plugin in the singleton
- *
- * @param string $sNamespace
- * @param int $eventPlugin
- * @throws \Exception
- */
- public function disablePlugin($sNamespace, $eventPlugin = 1)
- {
- if ($currentPlugin = $this->_aPluginDetails[$sNamespace]) {
- $currentPlugin->enabled = false;
- if ($eventPlugin == 1) {
- // If plugin class exists check if disable method exist,
- // otherwise use default plugin details
- if (class_exists($currentPlugin->sClassName)) {
- $plugin = new $currentPlugin->sClassName(
- $currentPlugin->sNamespace,
- $currentPlugin->sFilename
- );
- } else {
- throw new \Exception("Unable to disable plugin '$sNamespace' (plugin not found)");
- }
- if (method_exists($plugin, "disable")) {
- $plugin->disable();
- }
- }
- } else {
- throw new \Exception("Unable to disable plugin '$sNamespace' (plugin not found)");
- }
- }
-
- /**
- * Get status plugin in the singleton
- * @param string $name Plugin name
- * @return int|string Return a string with status plugin, 0 otherwise
- * @throws \Exception
- */
- public function getStatusPlugin($name)
- {
- try {
- return (isset($this->_aPluginDetails[$name])) ?
- (($this->_aPluginDetails[$name]->enabled) ? "enabled" : "disabled") :
- 0;
- } catch (\Exception $e) {
- throw $e;
- }
- }
-
- /**
- * Install a plugin archive.
- * If pluginName is specified, the archive will
- * only be installed if it contains this plugin.
- *
- * @param $filename
- * @param $pluginName
- * return bool true if enabled, false otherwise
- * @throws \Exception
- */
- public function installPluginArchive($filename, $pluginName)
- {
- \G::LoadThirdParty("pear/Archive", "Tar");
- $tar = new \Archive_Tar($filename);
- $files = $tar->listContent();
- $plugins = array();
- $namePlugin = array();
- foreach ($files as $f) {
- if (preg_match("/^([\w\.]*).ini$/", $f["filename"], $matches)) {
- $plugins[] = $matches[1];
- }
- if (preg_match("/^.*($pluginName)\.php$/", $f["filename"], $matches)) {
- $namePlugin[] = $matches[1];
- }
- }
-
- if (count($plugins) > 1) {
- throw new \Exception("Multiple plugins in one archive are not supported currently");
- }
-
- if (isset($pluginName) && !in_array($pluginName, $namePlugin)) {
- throw new \Exception("Plugin '$pluginName' not found in archive");
- }
-
- $pluginFile = "$pluginName.php";
-
- $res = $tar->extract(PATH_PLUGINS);
- if (!file_exists(PATH_PLUGINS . $pluginFile)) {
- throw (new \Exception("File \"$pluginFile\" doesn't exist"));
- }
- $path = PATH_PLUGINS . $pluginFile;
- require_once($path);
- /** @var PluginDetail $details */
- $details = $this->getPluginDetails($pluginFile);
-
- $this->installPlugin($details->sNamespace);
-
- $this->enablePlugin($details->sNamespace);
- $this->pluginAdapter->savePlugin($details->sNamespace, $this);
- }
-
- public function uninstallPlugin($sNamespace)
- {
- $pluginFile = $sNamespace . ".php";
-
- if (!file_exists(PATH_PLUGINS . $pluginFile)) {
- throw (new \Exception("File \"$pluginFile\" doesn't exist"));
- }
-
- ///////
- $path = PATH_PLUGINS . $pluginFile;
- $filter = new \InputFilter();
- $path = $filter->validateInput($path, 'path');
- require_once($path);
-
- foreach ($this->_aPluginDetails as $namespace => $detail) {
- if ($namespace == $sNamespace) {
- $this->enablePlugin($detail->sNamespace);
- $this->disablePlugin($detail->sNamespace);
-
- ///////
- $plugin = new $detail->sClassName($detail->sNamespace, $detail->sFilename);
- $this->_aPlugins[$detail->sNamespace] = $plugin;
-
- if (method_exists($plugin, "uninstall")) {
- $plugin->uninstall();
- }
-
- ///////
- $this->pluginAdapter->savePlugin($detail->sNamespace, $this);
- ///////
- $pluginDir = PATH_PLUGINS . $detail->sPluginFolder;
-
- if (isset($detail->sFilename) && !empty($detail->sFilename) && file_exists($detail->sFilename)) {
- unlink($detail->sFilename);
- }
-
- if (isset($detail->sPluginFolder) && !empty($detail->sPluginFolder) && file_exists($pluginDir)) {
- \G::rm_dir($pluginDir);
- }
-
- ///////
- $this->uninstallPluginWorkspaces(array($sNamespace));
- ///////
- break;
- }
- }
- }
-
- /**
- * @param $arrayPlugin
- */
- public function uninstallPluginWorkspaces($arrayPlugin)
- {
- $workspace = \System::listWorkspaces();
-
- foreach ($workspace as $indexWS => $ws) {
- $pluginRegistry =& PluginsRegistry::loadSingleton();
- $attributes = $pluginRegistry->getAttributes();
-
- foreach ($arrayPlugin as $index => $value) {
- if (isset($attributes["_aPluginDetails"][$value])) {
- $pluginRegistry->disablePlugin($value, 0);
- $pluginRegistry->pluginAdapter->savePlugin($value, $pluginRegistry);
- }
- }
-
- }
- }
-
- /**
- * install the plugin
- *
- * @param string $sNamespace
- */
- public function installPlugin($sNamespace)
- {
- try {
- foreach ($this->_aPluginDetails as $namespace => $detail) {
- if ($sNamespace == $namespace) {
- $oPlugin = new $detail->sClassName($detail->sNamespace, $detail->sFilename);
- $this->_aPlugins[$detail->sNamespace] = $oPlugin;
-
- $this->pluginAdapter->savePlugin($detail->sNamespace, $this);
-
- $oPlugin->install();
- }
- }
- } catch (\Exception $e) {
- global $G_PUBLISH;
- $aMessage['MESSAGE'] = $e->getMessage();
- $G_PUBLISH = new \Publisher();
- $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage);
- \G::RenderPage('publish');
- die();
- }
- }
-
- /**
- * Register a menu in the singleton
- *
- * @param string $sNamespace
- * @param string $sMenuId
- * @param string $sFilename
- */
- public function registerMenu($sNamespace, $sMenuId, $sFilename)
- {
- $found = false;
- foreach ($this->_aMenus as $row => $detail) {
- if ($sMenuId == $detail->sMenuId && $sNamespace == $detail->sNamespace) {
- $found = true;
- }
- }
- if (!$found) {
- $menuDetail = new MenuDetail($sNamespace, $sMenuId, $sFilename);
- $this->_aMenus[] = $menuDetail;
- }
- }
-
- /**
- * Register a dashlet class in the singleton
- *
- * @param string $namespace
- */
- public function registerDashlets($namespace)
- {
- $found = false;
- foreach ($this->_aDashlets as $row => $detail) {
- if ($namespace == $detail) {
- $found = true;
- }
- }
- if (!$found) {
- $this->_aDashlets[] = $namespace;
- }
- }
-
- /**
- * Register a stylesheet in the singleton
- *
- * @param string $sNamespace
- * @param string $sCssFile
- */
- public function registerCss($sNamespace, $sCssFile)
- {
- $found = false;
- foreach ($this->_aCSSStyleSheets as $row => $detail) {
- if ($sCssFile == $detail->sCssFile && $sNamespace == $detail->sNamespace) {
- $detail->sCssFile = $sCssFile;
- $found = true;
- }
- }
- if (!$found) {
- $cssFile = new CssFile($sNamespace, $sCssFile);
- $this->_aCSSStyleSheets[] = $cssFile;
- }
- }
-
- /**
- * return all css
- *
- * @return array
- */
- public function getRegisteredCss()
- {
- return $this->_aCSSStyleSheets;
- }
-
- /**
- * Register a plugin javascript to run with core js script at same runtime
- *
- * @param string $sNamespace
- * @param string $sCoreJsFile
- * @param array /string $pluginJsFile
- * @return mixed
- * @throws \Exception
- */
- public function registerJavascript($sNamespace, $sCoreJsFile, $pluginJsFile)
- {
- foreach ($this->_aJavascripts as $i => $js) {
- if ($sCoreJsFile == $js->sCoreJsFile && $sNamespace == $js->sNamespace) {
- if (is_string($pluginJsFile)) {
- if (!in_array($pluginJsFile, $this->_aJavascripts[$i]->pluginJsFile)) {
- $this->_aJavascripts[$i]->pluginJsFile[] = $pluginJsFile;
- }
- } elseif (is_array($pluginJsFile)) {
- $this->_aJavascripts[$i]->pluginJsFile = array_unique(
- array_merge($pluginJsFile, $this->_aJavascripts[$i]->pluginJsFile)
- );
- } else {
- throw new \Exception(
- 'Invalid third param, $pluginJsFile should be a string or array - ' .
- gettype($pluginJsFile) .
- ' given.'
- );
- }
- return $this->_aJavascripts[$i];
- }
- }
-
- $js = new \stdClass();
- $js->sNamespace = $sNamespace;
- $js->sCoreJsFile = $sCoreJsFile;
- $js->pluginJsFile = array();
-
- if (is_string($pluginJsFile)) {
- $js->pluginJsFile[] = $pluginJsFile;
- } elseif (is_array($pluginJsFile)) {
- $js->pluginJsFile = array_merge($js->pluginJsFile, $pluginJsFile);
- } else {
- throw new \Exception(
- 'Invalid third param, $pluginJsFile should be a string or array - ' .
- gettype($pluginJsFile) .
- ' given.'
- );
- }
-
- $this->_aJavascripts[] = $js;
- }
-
- /**
- * return all plugin javascripts
- *
- * @return array
- */
- public function getRegisteredJavascript()
- {
- return $this->_aJavascripts;
- }
-
- /**
- * return all plugin javascripts given a core js file, from all namespaces or a single namespace
- *
- * @param string $sCoreJsFile
- * @param string $sNamespace
- * @return array
- */
- public function getRegisteredJavascriptBy($sCoreJsFile, $sNamespace = '')
- {
- $scripts = array();
-
- if ($sNamespace == '') {
- foreach ($this->_aJavascripts as $i => $js) {
- if ($sCoreJsFile == $js->sCoreJsFile) {
- $scripts = array_merge($scripts, $this->_aJavascripts[$i]->pluginJsFile);
- }
- }
- } else {
- foreach ($this->_aJavascripts as $i => $js) {
- if ($sCoreJsFile == $js->sCoreJsFile && $sNamespace == $js->sNamespace) {
- $scripts = array_merge($scripts, $this->_aJavascripts[$i]->pluginJsFile);
- }
- }
- }
- return $scripts;
- }
-
- /**
- * unregister all javascripts from a namespace or a js core file given
- *
- * @param string $sNamespace
- * @param string $sCoreJsFile
- * @return array
- */
- public function unregisterJavascripts($sNamespace, $sCoreJsFile = '')
- {
- if ($sCoreJsFile == '') {
- foreach ($this->_aJavascripts as $i => $js) {
- if ($sNamespace == $js->sNamespace) {
- unset($this->_aJavascripts[$i]);
- }
- }
- // Re-index when all js were unregistered
- $this->_aJavascripts = array_values($this->_aJavascripts);
- } else {
- foreach ($this->_aJavascripts as $i => $js) {
- if ($sCoreJsFile == $js->sCoreJsFile && $sNamespace == $js->sNamespace) {
- unset($this->_aJavascripts[$i]);
- // Re-index for each js that was unregistered
- $this->_aJavascripts = array_values($this->_aJavascripts);
- }
- }
- }
- }
-
- /**
- * Register a reports class in the singleton
- *
- * @param string $sNamespace
- */
- public function registerReport($sNamespace)
- {
- $found = false;
- foreach ($this->_aReports as $row => $detail) {
- if ($sNamespace == $detail) {
- $found = true;
- }
- }
- if (!$found) {
- $this->_aReports[] = $sNamespace;
- }
- }
-
- /**
- * Register a PmFunction class in the singleton
- *
- * @param string $sNamespace
- */
- public function registerPmFunction($sNamespace)
- {
- $found = false;
- foreach ($this->_aPmFunctions as $row => $detail) {
- if ($sNamespace == $detail) {
- $found = true;
- }
- }
- if (!$found) {
- $this->_aPmFunctions[] = $sNamespace;
- }
- }
-
- /**
- * Register a redirectLogin class in the singleton
- *
- * @param string $sNamespace
- * @param string $sRole
- * @param string $sPathMethod
- */
- public function registerRedirectLogin($sNamespace, $sRole, $sPathMethod)
- {
- $found = false;
- foreach ($this->_aRedirectLogin as $row => $detail) {
- if (($sNamespace == $detail->sNamespace) && ($sRole == $detail->sRoleCode)) {
- //Filters based on Workspace and Role Code
- $found = true;
- }
- }
- if (!$found) {
- $this->_aRedirectLogin[] = new RedirectDetail($sNamespace, $sRole, $sPathMethod);
- }
- }
-
- /**
- * Register a folder for methods
- *
- * @param string $sNamespace
- * @param string $sFolderId
- * @param string $sFolderName
- */
- public function registerFolder($sNamespace, $sFolderId, $sFolderName)
- {
- $found = false;
- foreach ($this->_aFolders as $row => $detail) {
- if ($sFolderId == $detail->sFolderId && $sNamespace == $detail->sNamespace) {
- $found = true;
- }
- }
-
- if (!$found) {
- $this->_aFolders[] = new FolderDetail($sNamespace, $sFolderId, $sFolderName);
- }
- }
-
- /**
- * Register a step for process
- *
- * @param $sNamespace
- * @param $sStepId
- * @param $sStepName
- * @param $sStepTitle
- * @param string $setupStepPage
- */
- public function registerStep($sNamespace, $sStepId, $sStepName, $sStepTitle, $setupStepPage = '')
- {
- $found = false;
- foreach ($this->_aSteps as $row => $detail) {
- if ($sStepId == $detail->sStepId && $sNamespace == $detail->sNamespace) {
- $found = true;
- }
- }
-
- if (!$found) {
- $this->_aSteps[] = new StepDetail($sNamespace, $sStepId, $sStepName, $sStepTitle, $setupStepPage);
- }
- }
-
- /**
- * Return true if the $sFolderName is registered in the singleton
- *
- * @param string $sFolderName
- * @return bool
- */
- public function isRegisteredFolder($sFolderName)
- {
- foreach ($this->_aFolders as $row => $folder) {
- if ($sFolderName == $folder->sFolderName && is_dir(PATH_PLUGINS . $folder->sFolderName)) {
- return true;
- } elseif ($sFolderName == $folder->sFolderName &&
- is_dir(PATH_PLUGINS . $folder->sNamespace . PATH_SEP . $folder->sFolderName)) {
- return $folder->sNamespace;
- }
- }
- return false;
- }
-
- /**
- * Return all menus related to a menuId
- *
- * @param string $menuId
- */
- public function getMenus($menuId)
- {
- foreach ($this->_aMenus as $row => $detail) {
- if ($menuId == $detail->sMenuId && file_exists($detail->sFilename)) {
- include($detail->sFilename);
- }
- }
- }
-
- /**
- * return all dashlets classes registered
- *
- * @return array
- */
- public function getDashlets()
- {
- return $this->_aDashlets;
- }
-
- /**
- * This function returns all reports registered
- *
- * @return array
- */
- public function getReports()
- {
- return $this->_aReports;
- }
-
- /**
- * This function returns all pmFunctions registered
- *
- * @return array
- */
- public function getPmFunctions()
- {
- return $this->_aPmFunctions;
- }
-
- /**
- * This function returns all steps registered
- *
- * @return array
- */
- public function getSteps()
- {
- return $this->_aSteps;
- }
-
- /**
- * This function returns all redirect registered
- *
- * @return array
- */
- public function getRedirectLogins()
- {
- return $this->_aRedirectLogin;
- }
-
- /**
- * execute all triggers related to a triggerId
- *
- * TODO
- *
- * @param string $triggerId
- * @param $oData
- * @return mixed
- */
- public function executeTriggers($triggerId, $oData)
- {
- \G::LoadThirdParty("pear", "PEAR");
- foreach ($this->_aTriggers as $row => $detail) {
- if ($triggerId == $detail->sTriggerId) {
- //review all folders registered for this namespace
- $found = false;
- $classFile = '';
-
- foreach ($this->_aFolders as $row => $folder) {
- $fname = $folder->sNamespace == 'enterprise' ?
- PATH_CORE . 'classes' . PATH_SEP . 'class.' . $folder->sFolderName . '.php' :
- PATH_PLUGINS . $folder->sFolderName . PATH_SEP . 'class.' . $folder->sFolderName . '.php';
- if ($detail->sNamespace == $folder->sNamespace && file_exists($fname)) {
- $found = true;
- $classFile = $fname;
- }
- }
- if ($found) {
- require_once($classFile);
- $sClassName = substr($this->_aPluginDetails[$detail->sNamespace]->sClassName, 0, 1) .
- str_replace(
- 'plugin',
- 'class',
- substr($this->_aPluginDetails[$detail->sNamespace]->sClassName, 1)
- );
- $obj = new $sClassName();
- $methodName = $detail->sTriggerName;
- $response = $obj->{$methodName}($oData);
- if (\PEAR::isError($response)) {
- print $response->getMessage();
- return;
- }
- return $response;
- } else {
- print "error in call method " . $detail->sTriggerName;
- }
- }
- }
- }
-
- /**
- * verify if exists triggers related to a triggerId
- *
- * @param string $triggerId
- * @return bool
- */
- public function existsTrigger($triggerId)
- {
- $found = false;
- foreach ($this->_aTriggers as $row => $detail) {
- if ($triggerId == $detail->sTriggerId) {
- //review all folders registered for this namespace
- foreach ($this->_aFolders as $row => $folder) {
- $fname = $folder->sNamespace == 'enterprise' ?
- PATH_CORE . 'classes' . PATH_SEP . 'class.' . $folder->sFolderName . '.php' :
- PATH_PLUGINS . $folder->sFolderName . PATH_SEP . 'class.' . $folder->sFolderName . '.php';
- if ($detail->sNamespace == $folder->sNamespace && file_exists($fname)) {
- $found = true;
- }
- }
-
- }
- }
- return $found;
- }
-
- /**
- * Return info related to a triggerId
- *
- * @param int $triggerId
- * @return object
- */
- public function getTriggerInfo($triggerId)
- {
- $found = null;
- foreach ($this->_aTriggers as $row => $detail) {
- if ($triggerId == $detail->sTriggerId) {
- //review all folders registered for this namespace
- foreach ($this->_aFolders as $row => $folder) {
- $fname = PATH_PLUGINS . $folder->sFolderName . PATH_SEP . 'class.' . $folder->sFolderName . '.php';
- if ($detail->sNamespace == $folder->sNamespace && file_exists($fname)) {
- $found = $detail;
- }
- }
- }
- }
- return $found;
- }
-
- /**
- * Register a trigger in the Singleton
- *
- * @param string $sNamespace
- * @param string $sTriggerId
- * @param string $sTriggerName
- */
- public function registerTrigger($sNamespace, $sTriggerId, $sTriggerName)
- {
- $found = false;
- foreach ($this->_aTriggers as $row => $detail) {
- if ($sTriggerId == $detail->sTriggerId && $sNamespace == $detail->sNamespace) {
- $found = true;
- }
- }
- if (!$found) {
- $triggerDetail = new TriggerDetail($sNamespace, $sTriggerId, $sTriggerName);
- $this->_aTriggers[] = $triggerDetail;
- }
- }
-
- /**
- * Get plugin
- *
- * @param string $sNamespace
- * @return mixed
- */
- public function &getPlugin($sNamespace)
- {
- $oPlugin = null;
- if (array_key_exists($sNamespace, $this->_aPlugins)) {
- $oPlugin = $this->_aPlugins[$sNamespace];
- }
- return $oPlugin;
- }
-
- /**
- * Set company logo
- *
- * @param string $sNamespace
- * @param string $filename
- * @return void
- */
- public function setCompanyLogo($sNamespace, $filename)
- {
- foreach ($this->_aPluginDetails as $row => $detail) {
- if ($sNamespace == $detail->sNamespace) {
- $this->_aPluginDetails[$sNamespace]->sCompanyLogo = $filename;
- }
- }
- }
-
- /**
- * Get company logo
- *
- * @param $default
- * @return mixed
- */
- public function getCompanyLogo($default)
- {
- $sCompanyLogo = $default;
- foreach ($this->_aPluginDetails as $row => $detail) {
- if (trim($detail->sCompanyLogo) != '') {
- $sCompanyLogo = $detail->sCompanyLogo;
- }
- }
- return $sCompanyLogo;
- }
-
- /**
- * get setup Plugins
- *
- * @param unknown_type $default
- * @return void
- */
- /**
- * @return int
- */
- public function setupPlugins()
- {
- try {
- require_once(PATH_CORE . "methods" . PATH_SEP . "enterprise" . PATH_SEP . "enterprise.php");
- $iPlugins = 0;
- foreach ($this->_aPluginDetails as $namespace => $detail) {
- if (isset($detail->enabled) && $detail->enabled) {
- if (!empty($detail->sFilename) && file_exists($detail->sFilename)) {
- $arrayFileInfo = pathinfo($detail->sFilename);
- $sFilename = (($detail->sNamespace == "enterprise") ?
- PATH_CORE . "methods" . PATH_SEP . "enterprise" . PATH_SEP :
- PATH_PLUGINS
- ) . $arrayFileInfo["basename"];
- if (!file_exists($sFilename)) {
- continue;
- }
- require_once $sFilename;
- if (class_exists($detail->sClassName)) {
- /** @var \enterprisePlugin|\PMPlugin $oPlugin */
- $oPlugin = new $detail->sClassName($detail->sNamespace, $detail->sFilename);
- $this->_aPlugins[$detail->sNamespace] = $oPlugin;
- $iPlugins++;
- $oPlugin->setup();
- }
- }
- }
- }
- return $iPlugins;
- } catch (\Exception $e) {
- global $G_PUBLISH;
- $aMessage['MESSAGE'] = $e->getMessage();
- $G_PUBLISH = new \Publisher();
- $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage);
- \G::RenderPage('publish');
- die();
- }
- }
-
- /**
- * this function execute a Method
- *
- * @param string $sNamespace
- * @param string $methodName
- * @param object $oData
- * @return mixed
- * @throws \Exception
- */
- public function executeMethod($sNamespace, $methodName, $oData)
- {
- $response = null;
- try {
- $details = $this->_aPluginDetails[$sNamespace];
- $pluginFolder = $details->sPluginFolder;
- $className = $details->sClassName;
- $classFile = PATH_PLUGINS . $pluginFolder . PATH_SEP . 'class.' . $pluginFolder . '.php';
- if (file_exists($classFile)) {
- $sClassName = substr_replace($className, "class", -6, 6);
- if (!class_exists($sClassName)) {
- require_once $classFile;
- }
- $obj = new $sClassName();
- if (!in_array($methodName, get_class_methods($obj))) {
- throw (new \Exception("The method '$methodName' doesn't exist in class '$sClassName' "));
- }
- $obj->sNamespace = $details->sNamespace;
- $obj->sClassName = $details->sClassName;
- $obj->sFilename = $details->sFilename;
- $obj->iVersion = $details->iVersion;
- $obj->sFriendlyName = $details->sFriendlyName;
- $obj->sPluginFolder = $details->sPluginFolder;
- $response = $obj->{$methodName}($oData);
- }
- return $response;
- } catch (\Exception $e) {
- throw ($e);
- }
- }
-
- /**
- * this function gets Fields For Page on Setup
- *
- * @param string $sNamespace
- * @return object
- */
- public function getFieldsForPageSetup($sNamespace)
- {
- $oData = null;
- return $this->executeMethod($sNamespace, 'getFieldsForPageSetup', $oData);
- }
-
- /**
- * this function updates Fields For Page on Setup
- *
- * @param string $sNamespace
- * @return mixed
- * @throws \Exception
- */
- public function updateFieldsForPageSetup($sNamespace, $oData)
- {
- if (!isset($this->_aPluginDetails[$sNamespace])) {
- throw (new \Exception("The namespace '$sNamespace' doesn't exist in plugins folder."));
- }
- return $this->executeMethod($sNamespace, 'updateFieldsForPageSetup', $oData);
- }
-
- /**
- * @deprecated
- */
- public function eevalidate()
- {
- }
-
- /**
- * Register a toolbar for dynaform editor in the singleton
- *
- * @param string $sNamespace
- * @param string $sToolbarId
- * @param string $sFilename
- */
- public function registerToolbarFile($sNamespace, $sToolbarId, $sFilename)
- {
- $found = false;
- foreach ($this->_aToolbarFiles as $row => $detail) {
- if ($sToolbarId == $detail->sToolbarId && $sNamespace == $detail->sNamespace) {
- $found = true;
- }
- }
- if (!$found) {
- $toolbarDetail = new ToolbarDetail($sNamespace, $sToolbarId, $sFilename);
- $this->_aToolbarFiles[] = $toolbarDetail;
- }
- }
-
- /**
- * return all toolbar files related to a sToolbarId
- *
- * @param string $sToolbarId (NORMAL, GRID)
- */
- public function getToolbarOptions($sToolbarId)
- {
- foreach ($this->_aToolbarFiles as $row => $detail) {
- if ($sToolbarId == $detail->sToolbarId && file_exists($detail->sFilename)) {
- include($detail->sFilename);
- }
- }
- }
-
- /**
- * Register a Case Scheduler Plugin
- *
- * @param $sNamespace
- * @param $sActionId
- * @param $sActionForm
- * @param $sActionSave
- * @param $sActionExecute
- * @param $sActionGetFields
- */
- public function registerCaseSchedulerPlugin(
- $sNamespace,
- $sActionId,
- $sActionForm,
- $sActionSave,
- $sActionExecute,
- $sActionGetFields
- )
- {
- $found = false;
- foreach ($this->_aCaseSchedulerPlugin as $row => $detail) {
- if ($sActionId == $detail->sActionId && $sNamespace == $detail->sNamespace) {
- $found = true;
- }
- }
-
- if (!$found) {
- $this->_aCaseSchedulerPlugin[] = new CaseSchedulerPlugin(
- $sNamespace,
- $sActionId,
- $sActionForm,
- $sActionSave,
- $sActionExecute,
- $sActionGetFields
- );
- }
- }
-
- /**
- * This function returns all Case Scheduler Plugins registered
- *
- * @return array
- */
- public function getCaseSchedulerPlugins()
- {
- return $this->_aCaseSchedulerPlugin;
- }
-
- /**
- * Register a Task Extended property page in the singleton
- *
- * @param string $sNamespace
- * @param $sPage
- * @param $sName
- * @param $sIcon
- */
- public function registerTaskExtendedProperty($sNamespace, $sPage, $sName, $sIcon)
- {
- $found = false;
- foreach ($this->_aTaskExtendedProperties as $row => $detail) {
- if ($sPage == $detail->sPage && $sNamespace == $detail->sNamespace) {
- $detail->sName = $sName;
- $detail->sIcon = $sIcon;
- $found = true;
- }
- }
- if (!$found) {
- $taskExtendedProperty = new TaskExtendedProperty($sNamespace, $sPage, $sName, $sIcon);
- $this->_aTaskExtendedProperties[] = $taskExtendedProperty;
- }
- }
-
- /**
- * Register a dashboard page for cases in the singleton
- *
- * @param string $sNamespace
- * @param string $sPage
- * @param string $sName
- * @param string $sIcon
- */
- public function registerDashboardPage($sNamespace, $sPage, $sName, $sIcon)
- {
- $found = false;
- foreach ($this->_aDashboardPages as $row => $detail) {
- if ($sPage == $detail->sPage && $sNamespace == $detail->sNamespace) {
- $detail->sName = $sName;
- $detail->sIcon = $sIcon;
- $found = true;
- }
- }
- if (!$found) {
- $dashboardPage = new DashboardPage($sNamespace, $sPage, $sName, $sIcon);
- $this->_aDashboardPages[] = $dashboardPage;
- }
- }
-
- /**
- * Register a rest service class from a plugin to be served by processmaker
- *
- * @param string $sNamespace The namespace for the plugin
- * @return bool
- */
- public function registerRestService($sNamespace)
- {
- $baseSrcPluginPath = PATH_PLUGINS . $sNamespace . PATH_SEP . "src";
- $apiPath = PATH_SEP . "Services" . PATH_SEP . "Api" . PATH_SEP . ucfirst($sNamespace);
- $classesList = (new \Bootstrap())->rglob('*', 0, $baseSrcPluginPath . $apiPath);
-
- foreach ($classesList as $classFile) {
- if (pathinfo($classFile, PATHINFO_EXTENSION) === 'php') {
- $ns = str_replace(
- '/',
- '\\',
- str_replace('.php', '', str_replace($baseSrcPluginPath, '', $classFile))
- );
-
- // Ensure that is registering only existent classes.
- if (class_exists($ns)) {
- $this->_restServices[$sNamespace][] = array(
- "filepath" => $classFile,
- "namespace" => $ns
- );
- }
- }
- }
-
- WebApplication::purgeRestApiCache(basename(PATH_DATA_SITE));
-
- return true;
- }
-
- /**
- * Register a extend rest service class from a plugin to be served by processmaker
- *
- * @param string $sNamespace The namespace for the plugin
- * @param string $className The service (api) class name
- */
- public function registerExtendsRestService($sNamespace, $className)
- {
- $baseSrcPluginPath = PATH_PLUGINS . $sNamespace . PATH_SEP . "src";
- $apiPath = PATH_SEP . "Services" . PATH_SEP . "Ext" . PATH_SEP;
- $classFile = $baseSrcPluginPath . $apiPath . 'Ext' . $className . '.php';
- if (file_exists($classFile)) {
- $this->_restExtendServices[$sNamespace][$className] = array(
- "filePath" => $classFile,
- "classParent" => $className,
- "classExtend" => 'Ext' . $className
- );
- }
- }
-
- /**
- * Get a extend rest service class from a plugin to be served by processmaker
- *
- * @param string $className The service (api) class name
- * @return array
- */
- public function getExtendsRestService($className)
- {
- $responseRestExtendService = array();
- foreach ($this->_restExtendServices as $sNamespace => $restExtendService) {
- if (isset($restExtendService[$className])) {
- $responseRestExtendService = $restExtendService[$className];
- break;
- }
- }
- return $responseRestExtendService;
- }
-
- /**
- * Remove a extend rest service class from a plugin to be served by processmaker
- *
- * @param string $sNamespace
- * @param string $className The service (api) class name
- * @return bool
- */
- public function disableExtendsRestService($sNamespace, $className = '')
- {
- if (isset($this->_restExtendServices[$sNamespace][$className]) && !empty($className)) {
- unset($this->_restExtendServices[$sNamespace][$className]);
- } elseif (empty($className)) {
- unset($this->_restExtendServices[$sNamespace]);
- }
- }
-
- /**
- * Unregister a rest service class of a plugin
- *
- * @param string $sNamespace The namespace for the plugin
- */
- public function unregisterRestService($sNamespace)
- {
- if ($this->_restServices) {
- unset($this->_restServices[$sNamespace]);
- WebApplication::purgeRestApiCache(basename(PATH_DATA_SITE));
- }
- }
-
- public function getRegisteredRestServices()
- {
- return $this->_restServices;
- }
-
- /**
- * return all dashboard pages
- *
- * @return array
- */
- public function getDashboardPages()
- {
- return $this->_aDashboardPages;
- }
-
- /**
- * return all tasl extended properties
- *
- * @return array
- */
- public function getTaskExtendedProperties()
- {
- return $this->_aTaskExtendedProperties;
- }
-
- public function registerDashboard()
- {
- // Dummy function for backwards compatibility
- }
-
- public function getAttributes()
- {
- return get_object_vars($this);
- }
-
- public function verifyTranslation($namePlugin)
- {
- $language = new \Language();
- $pathPluginTranslations = PATH_PLUGINS . $namePlugin . PATH_SEP . 'translations' . PATH_SEP;
- if (file_exists($pathPluginTranslations . 'translations.php')) {
- if (!file_exists($pathPluginTranslations . $namePlugin . '.' . SYS_LANG . '.po')) {
- $language->createLanguagePlugin($namePlugin, SYS_LANG);
- }
- $language->updateLanguagePlugin($namePlugin, SYS_LANG);
- }
- }
-
- /**
- * Register a cron file in the singleton
- *
- * @param string $namespace
- * @param string $cronFile
- */
- public function registerCronFile($namespace, $cronFile)
- {
- $found = false;
- foreach ($this->_aCronFiles as $row => $detail) {
- if ($cronFile == $detail->cronFile && $namespace == $detail->namespace) {
- $detail->cronFile = $cronFile;
- $found = true;
- }
- }
- if (!$found) {
- $cronFile = new CronFile($namespace, $cronFile);
- $this->_aCronFiles[] = $cronFile;
- }
- }
-
- /**
- * Function to enable rest service for plugins
- * @param string $sNamespace
- * @param bool $enable
- */
- public function enableRestService($sNamespace, $enable)
- {
- $this->_restServiceEnabled[$sNamespace] = $enable;
- }
-
- /**
- * Return all cron files registered
- *
- * @return array
- */
- public function getCronFiles()
- {
- return $this->_aCronFiles;
- }
-
- /**
- * Update the plugin attributes in all workspaces
- *
- * @param string $pluginName Plugin name
- * @throws \Exception
- */
- public function updatePluginAttributesInAllWorkspaces($pluginName)
- {
- try {
- \G::LoadClass("wsTools");
-
- //Set variables
- $pluginFileName = $pluginName . ".php";
-
- //Verify data
- if (!file_exists(PATH_PLUGINS . $pluginFileName)) {
- throw new \Exception("Error: The plugin not exists");
- }
-
- //Update plugin attributes
- require_once(PATH_PLUGINS . $pluginFileName);
-
- $pmPluginRegistry =& \PMPluginRegistry::getSingleton();
-
- $pluginDetails = $pmPluginRegistry->getPluginDetails($pluginFileName);
-
- if (isset($pluginDetails->aWorkspaces) &&
- is_array($pluginDetails->aWorkspaces) &&
- count($pluginDetails->aWorkspaces) > 0
- ) {
- $arrayWorkspace = array();
-
- foreach (\System::listWorkspaces() as $value) {
- $workspaceTools = $value;
-
- $arrayWorkspace[] = $workspaceTools->name;
- }
-
- $arrayWorkspaceAux = array_diff($arrayWorkspace, $pluginDetails->aWorkspaces); //Workspaces to update
- $strWorkspaceNoWritable = "";
-
- $arrayWorkspace = array();
-
- foreach ($arrayWorkspaceAux as $value) {
- $workspace = $value;
-
- $workspacePathDataSite = PATH_DATA . "sites" . PATH_SEP . $workspace . PATH_SEP;
-
- if (file_exists($workspacePathDataSite . "plugin.singleton")) {
- $pmPluginRegistry = PMPluginRegistry::loadSingleton(
- $workspacePathDataSite . "plugin.singleton"
- );
-
- if (isset($pmPluginRegistry->_aPluginDetails[$pluginName])) {
- if (!is_writable($workspacePathDataSite . "plugin.singleton")) {
- $strWorkspaceNoWritable .= (($strWorkspaceNoWritable != "") ? ", " : "") . $workspace;
- }
-
- $arrayWorkspace[] = $workspace;
- }
- }
- }
-
- //Verify data
- if ($strWorkspaceNoWritable != "") {
- throw new \Exception(
- 'Error: The workspaces ' .
- $strWorkspaceNoWritable .
- ' has problems of permissions of write in file "plugin.singleton", solve this problem'
- );
- }
-
- //Update plugin attributes
- foreach ($arrayWorkspace as $value) {
- $workspace = $value;
-
- $workspacePathDataSite = PATH_DATA . "sites" . PATH_SEP . $workspace . PATH_SEP;
-
- $pmPluginRegistry = \PMPluginRegistry::loadSingleton($workspacePathDataSite . "plugin.singleton");
-
- $pmPluginRegistry->disablePlugin($pluginName);
-
- file_put_contents(
- $workspacePathDataSite . "plugin.singleton",
- $pmPluginRegistry->serializeInstance()
- );
- }
- }
- } catch (\Exception $e) {
- throw $e;
- }
- }
-
- /**
- * Register designer menu file
- *
- * @param string $pluginName Plugin name
- * @param string $file Designer menu file
- * @throws \Exception
- */
- public function registerDesignerMenu($pluginName, $file)
- {
- try {
- $flagFound = false;
-
- foreach ($this->_arrayDesignerMenu as $value) {
- if ($value->pluginName == $pluginName && $value->file == $file) {
- $flagFound = true;
- break;
- }
- }
-
- if (!$flagFound) {
- $obj = new \stdClass();
- $obj->pluginName = $pluginName;
- $obj->file = $file;
-
- $this->_arrayDesignerMenu[] = $obj;
- }
- } catch (\Exception $e) {
- throw $e;
- }
- }
-
- /**
- * Return all designer menu files registered
- *
- * @return array
- * @throws \Exception
- */
- public function getDesignerMenu()
- {
- try {
- return $this->_arrayDesignerMenu;
- } catch (\Exception $e) {
- throw $e;
- }
- }
-
- /**
- * Replace new options to menu
- *
- * @param string $namespace
- * @param array $from
- * @param array $options
- * @return void
- */
- public function registerMenuOptionsToReplace($namespace, $from, $options)
- {
- if (isset($from["section"]) && isset($from["menuId"])) {
- $section = $from["section"];
- $oMenuFromPlugin = $this->_aMenuOptionsToReplace;
- if (array_key_exists($section, $oMenuFromPlugin)) {
- unset($this->_aMenuOptionsToReplace[$from["section"]]);
- }
- $this->_aMenuOptionsToReplace[$from["section"]][$from["menuId"]][] = $options;
- }
- }
-
- /**
- * Return all menu Options from a specific section
- *
- * @param string $strMenuName
- * @return array
- */
- public function getMenuOptionsToReplace($strMenuName)
- {
- $oMenuFromPlugin = $this->_aMenuOptionsToReplace;
- if (sizeof($oMenuFromPlugin)) {
- if (array_key_exists($strMenuName, $oMenuFromPlugin)) {
- return $oMenuFromPlugin[$strMenuName];
- }
- }
- }
-
- /**
- * Register a callBackFile in the singleton
- *
- * @param string $namespace
- * @param string $callBackFile
- * @throws \Exception
- */
- public function registerImportProcessCallback($namespace, $callBackFile)
- {
- try {
- $found = false;
- foreach ($this->_aImportProcessCallbackFile as $row => $detail) {
- if ($callBackFile == $detail->callBackFile && $namespace == $detail->namespace) {
- $detail->callBackFile = $callBackFile;
- $found = true;
- }
- }
- if (!$found) {
- $callBackFile = new ImportCallBack($namespace, $callBackFile);
- $this->_aImportProcessCallbackFile[] = $callBackFile;
- }
- } catch (\Exception $e) {
- throw $e;
- }
- }
-
- /**
- * Return all callBackFiles registered
- *
- * @return array
- */
- public function getImportProcessCallback()
- {
- return $this->_aImportProcessCallbackFile;
- }
-
- /**
- * Register a callBackFile in the singleton
- *
- * @param string $callBackFile
- * @throws \Exception
- */
- public function registerOpenReassignCallback($callBackFile)
- {
- try {
- $found = false;
- foreach ($this->_aOpenReassignCallback as $row => $detail) {
- if ($callBackFile == $detail->callBackFile) {
- $detail->callBackFile = $callBackFile;
- $found = true;
- }
- }
- if (!$found) {
- $callBackFile = new OpenReassignCallback($callBackFile);
- $this->_aOpenReassignCallback[] = $callBackFile;
- }
- } catch (\Exception $e) {
- throw $e;
- }
- }
-
- /**
- * Return all callBackFiles registered
- *
- * @return array
- */
- public function getOpenReassignCallback()
- {
- return $this->_aOpenReassignCallback;
- }
-
- public function getPluginsData()
- {
- return $this->_aPlugins;
- }
-
- /**
- * The following function method extracts the plugin if exists one
- * with the same uppercase characters, this is required for the
- *
- * @param $code
- * @return array|object
- */
- public function getPluginByCode($code)
- {
- $plugin = new \stdClass();
- foreach ($this->_aPlugins as $plugin) {
- $plugin = (array)$plugin;
- if (strtoupper($plugin['sNamespace']) == $code) {
- return (object)$plugin;
- }
- }
- return $plugin;
- }
-
- /**
- * Checks if the plugin name is Enterprise Plugin
- *
- * @param string $pluginName Plugin name
- * @param string $path Path to plugin
- *
- * @return bool Returns TRUE when plugin name is Enterprise Plugin, FALSE otherwise
- */
- public function isEnterprisePlugin($pluginName, $path = null)
- {
- $path = (!is_null($path) && $path != '') ? rtrim($path, '/\\') . PATH_SEP : PATH_PLUGINS;
- $pluginFile = $pluginName . '.php';
-
- //Return
- return preg_match(
- '/^.*class\s+' . $pluginName . 'Plugin\s+extends\s+(?:enterprisePlugin)\s*\{.*$/i',
- str_replace(["\n", "\r", "\t"], ' ', file_get_contents($path . $pluginFile))
- );
- }
-
- /**
- * Registry in an array routes for js or css files.
- * @param string $pluginName
- * @param string $pathFile
- * @throws \Exception
- */
- public function registerDesignerSourcePath($pluginName, $pathFile)
- {
- try {
- $flagFound = false;
-
- foreach ($this->_arrayDesignerSourcePath as $value) {
- if ($value->pluginName == $pluginName && $value->pathFile == $pathFile) {
- $flagFound = true;
- break;
- }
- }
-
- if (!$flagFound) {
- $obj = new \stdClass();
- $obj->pluginName = $pluginName;
- $obj->pathFile = $pathFile;
-
- $this->_arrayDesignerSourcePath[] = $obj;
- }
- } catch (\Exception $e) {
- throw $e;
- }
- }
-
- /**
- * You obtain an array containing the routes recorded by the
- * function registerDesignerSourcePath.
- * @return array
- * @throws \Exception
- */
- public function getDesignerSourcePath()
- {
- try {
- return $this->_arrayDesignerSourcePath;
- } catch (\Exception $e) {
- throw $e;
- }
- }
-
- /**
- * Get all variables of object
- * @return array
- */
- public function iterateVisible()
- {
- $response = array();
- foreach ($this as $key => $value) {
- $response[$key] = $value;
- }
- return $response;
- }
-}
diff --git a/workflow/engine/src/ProcessMaker/Plugins/Traits/Attributes.php b/workflow/engine/src/ProcessMaker/Plugins/Traits/Attributes.php
new file mode 100644
index 000000000..a5fa06ca1
--- /dev/null
+++ b/workflow/engine/src/ProcessMaker/Plugins/Traits/Attributes.php
@@ -0,0 +1,19 @@
+_aPlugins;
+ }
+
+ /**
+ * Ser information of all Plugins
+ * @param array $_aPlugins
+ */
+ public function setPlugins($_aPlugins)
+ {
+ $this->_aPlugins = $_aPlugins;
+ }
+
+ /**
+ * Builds the Plugin structure based on its classes
+ */
+ private function constructStructure()
+ {
+ $Plugins = PluginsRegistry::getPluginsEnabled(BasePeer::TYPE_PHPNAME);
+ foreach ($Plugins as $plugin) {
+ $this->_aPluginDetails[$plugin['PluginNamespace']] = $this->buildPluginDetails($plugin);
+ $this->buildMenus(\G::json_decode($plugin['PluginMenus'], true));
+ $this->buildFolders(\G::json_decode($plugin['PluginFolders'], true));
+ $this->buildTriggers(\G::json_decode($plugin['PluginTriggers'], true));
+ $this->buildPmFunctions(\G::json_decode($plugin['PluginPmFunctions'], true));
+ $this->buildRedirectLogin(\G::json_decode($plugin['PluginRedirectLogin'], true));
+ $this->buildSteps(\G::json_decode($plugin['PluginSteps'], true));
+ $this->buildCss(\G::json_decode($plugin['PluginCss'], true));
+ $this->buildJs(\G::json_decode($plugin['PluginJs'], true));
+ $this->buildRestService(\G::json_decode($plugin['PluginRestService'], true));
+ $this->buildAttributes($plugin['PluginNamespace'], \G::json_decode($plugin['PluginAttributes'], true));
+ }
+ }
+
+ /**
+ * Build the class PluginDetail
+ * @param array $plugin Information of plugin
+ * @return PluginDetail
+ */
+ private function buildPluginDetails($plugin)
+ {
+ return new PluginDetail(
+ $plugin['PluginNamespace'],
+ $plugin['PluginClassName'],
+ $plugin['PluginFile'],
+ $plugin['PluginFriendlyName'],
+ $plugin['PluginFolder'],
+ $plugin['PluginDescription'],
+ $plugin['PluginSetupPage'],
+ $plugin['PluginVersion'],
+ $plugin['PluginCompanyLogo'],
+ \G::json_decode($plugin['PluginWorkspaces']),
+ $plugin['PluginEnable'],
+ $plugin['PluginPrivate']
+ );
+ }
+
+ /**
+ * Build the class MenuDetail
+ * @param array $menus
+ */
+ private function buildMenus($menus)
+ {
+ $response = [];
+ foreach ($menus as $index => $menu) {
+ $response[] = new MenuDetail($menu['Namespace'], $menu['MenuId'], $menu['Filename']);
+ }
+ $this->_aMenus = array_merge($this->_aMenus, $response);
+ }
+
+ /**
+ * Build the class FolderDetail
+ * @param array $folders
+ */
+ private function buildFolders($folders)
+ {
+ $response = [];
+ foreach ($folders as $index => $folder) {
+ $response[] = new FolderDetail($folder['Namespace'], $folder['FolderId'], $folder['FolderName']);
+ }
+ $this->_aFolders = array_merge($this->_aFolders, $response);
+ }
+
+ /**
+ * Build the class TriggerDetail
+ * @param array $triggers
+ */
+ private function buildTriggers($triggers)
+ {
+ $response = [];
+ foreach ($triggers as $index => $trigger) {
+ $response[] = new TriggerDetail($trigger['Namespace'], $trigger['TriggerId'], $trigger['TriggerName']);
+ }
+ $this->_aTriggers = array_merge($this->_aTriggers, $response);
+ }
+
+ /**
+ * Build the array
+ * @param array $pmFunctions
+ */
+ private function buildPmFunctions($pmFunctions)
+ {
+ foreach ($pmFunctions as $index => $pmFunction) {
+ $this->_aPmFunctions = array_merge($this->_aPmFunctions, [$pmFunction]);
+ }
+ }
+
+ /**
+ * Build the class RedirectDetail
+ * @param array $redirectLogin
+ */
+ private function buildRedirectLogin($redirectLogin)
+ {
+ $response = [];
+ foreach ($redirectLogin as $index => $trigger) {
+ $response[] = new RedirectDetail($trigger['Namespace'], $trigger['RoleCode'], $trigger['PathMethod']);
+ }
+ $this->_aRedirectLogin = array_merge($this->_aRedirectLogin, $response);
+ }
+
+ /**
+ * Build the class StepDetail
+ * @param array $steps
+ */
+ private function buildSteps($steps)
+ {
+ $response = [];
+ foreach ($steps as $index => $step) {
+ $response[] = new StepDetail(
+ $step['Namespace'],
+ $step['StepId'],
+ $step['StepName'],
+ $step['StepTitle'],
+ $step['SetupStepPage']
+ );
+ }
+ $this->_aSteps = array_merge($this->_aSteps, $response);
+ }
+
+ /**
+ * Build the class CssFile
+ * @param array $css
+ */
+ private function buildCss($css)
+ {
+ $response = [];
+ foreach ($css as $index => $c) {
+ $response[] = new CssFile($c['Namespace'], $c['CssFile']);
+ }
+ $this->_aCss = array_merge($this->_aCss, $response);
+ }
+
+ /**
+ * Build the class JsFile
+ * @param array $js
+ */
+ private function buildJs($js)
+ {
+ $response = [];
+ foreach ($js as $index => $j) {
+ $response[] = new JsFile($j['Namespace'], $j['CoreJsFile'], $j['PluginJsFile']);
+ }
+ $this->_aJs = array_merge($this->_aJs, $response);
+ }
+
+ /**
+ * Build the array
+ * @param array $restServices
+ */
+ private function buildRestService($restServices)
+ {
+ foreach ($restServices as $index => $restService) {
+ $this->_restServices = array_merge($this->_restServices, $restService);
+ }
+ }
+
+ /**
+ * Build other properties that are not considered in the schema of the table
+ * @param string $namespace
+ * @param array $attributes
+ */
+ private function buildAttributes($namespace, $attributes)
+ {
+ $this->_aPlugins[$namespace] = (object)$this->_aPluginDetails[$namespace]->getAttributes();
+ foreach ($attributes as $key => $value) {
+ $this->_aPlugins[$namespace]->{$key} = $value;
+ if (property_exists($this, $key)) {
+ $this->{$key} = array_merge($this->{$key}, $value);
+ }
+ }
+ }
+
+ /**
+ * Get all attributes of a plugin
+ * @param string $Namespace
+ * @return array
+ */
+ private function getAllAttributes($Namespace)
+ {
+ $PluginRegistry = clone $this;
+ /** @var PluginDetail $PluginDetails */
+ $PluginDetails = $PluginRegistry->_aPluginDetails[$Namespace];
+ unset($PluginRegistry->_aPluginDetails);
+ $Plugin = isset($PluginRegistry->_aPlugins[$Namespace]) ?
+ \G::json_decode(\G::json_encode($PluginRegistry->_aPlugins[$Namespace]), true) :
+ [];
+ unset($PluginRegistry->_aPlugins);
+ $newStructurePlugin = array_merge($PluginDetails->getAttributes(), $Plugin);
+ foreach ($PluginRegistry as $propertyName => $propertyValue) {
+ foreach ($propertyValue as $key => $plugin) {
+ if (is_object($plugin) &&
+ ((property_exists($plugin, 'Namespace') && $plugin->equalNamespaceTo($Namespace)) ||
+ (!is_int($key) && $key == $Namespace))
+ ) {
+ $newStructurePlugin[$propertyName][] = $plugin;
+ } elseif (is_object($plugin) &&
+ property_exists($plugin, 'pluginName') &&
+ $plugin->pluginName == $Namespace
+ ) {
+ $newStructurePlugin[$propertyName][] = $plugin;
+ } elseif (is_string($plugin) && $plugin == $Namespace) {
+ $newStructurePlugin[$propertyName][] = $plugin;
+ }
+ }
+ }
+ return $newStructurePlugin;
+ }
+
+ /**
+ * Convert de attributes to field of table PLUGINS_REGISTRY
+ * @param array $plugin
+ * @return array
+ */
+ private function convertFieldTable($plugin)
+ {
+ $fields = [];
+ $extraAttributes = array_diff_key($plugin, $this->adapter->getAttributes());
+ $fieldsInTable = array_intersect_key($plugin, $this->adapter->getAttributes());
+ foreach ($this->adapter->getAttributes() as $name => $property) {
+ switch ($property['type']) {
+ case 'string':
+ $valueField = array_key_exists($name, $fieldsInTable) ? $fieldsInTable[$name] : '';
+ break;
+ case 'array':
+ $valueField = [];
+ if ((array_key_exists($name, $fieldsInTable) && $fieldsInTable[$name])) {
+ foreach ($fieldsInTable[$name] as $index => $item) {
+ if (method_exists($item, 'getAttributes')) {
+ $valueField[$index] = $item->getAttributes();
+ } else {
+ $valueField[$index] = $item;
+ }
+ }
+ }
+ $valueField = \G::json_encode($valueField);
+ break;
+ case 'int':
+ $valueField = array_key_exists($name, $fieldsInTable) ? $fieldsInTable[$name] : 0;
+ break;
+ case 'bool':
+ $valueField = array_key_exists($name, $fieldsInTable) ?
+ ($fieldsInTable[$name] ? true : false) :
+ false;
+ break;
+ default:
+ $valueField = array_key_exists($name, $fieldsInTable) ?
+ $fieldsInTable[$name] :
+ [];
+ break;
+ }
+ $fields[$property['name']] = $valueField;
+ }
+ $fields['PLUGIN_ATTRIBUTES'] = \G::json_encode($extraAttributes);
+ return $fields;
+ }
+}
diff --git a/workflow/engine/src/ProcessMaker/Project/Adapter/BpmnWorkflow.php b/workflow/engine/src/ProcessMaker/Project/Adapter/BpmnWorkflow.php
index 8106dfd35..fb79e87eb 100644
--- a/workflow/engine/src/ProcessMaker/Project/Adapter/BpmnWorkflow.php
+++ b/workflow/engine/src/ProcessMaker/Project/Adapter/BpmnWorkflow.php
@@ -1,6 +1,7 @@
getStatusPlugin('pmConnectors') === 'enabled') {
@@ -306,7 +307,7 @@ class BpmnWorkflow extends Project\Bpmn
*/
public function sincronizeActivityData($actUid, $data)
{
- $registry = \PMPluginRegistry::getSingleton();
+ $registry = PluginRegistry::loadSingleton();
$taskData = \TaskPeer::retrieveByPK($actUid);
//The plugin pmConnectors will be moved to the core in pm.3.3
if ($taskData->getTasType() == 'SERVICE-TASK' && $registry->getStatusPlugin('pmConnectors') !== 'enabled') {
@@ -325,7 +326,7 @@ class BpmnWorkflow extends Project\Bpmn
*/
static function __updateServiceTask($activityBefore, $activityCurrent, $taskData)
{
- $registry = \PMPluginRegistry::getSingleton();
+ $registry = PluginRegistry::loadSingleton();
if ($activityBefore->getActTaskType() != "SERVICETASK" && $activityCurrent->getActTaskType() == "SERVICETASK") {
//The plugin pmConnectors will be moved to the core in pm.3.3
if ($registry->getStatusPlugin('pmConnectors') === 'enabled') {
diff --git a/workflow/engine/src/ProcessMaker/Project/Workflow.php b/workflow/engine/src/ProcessMaker/Project/Workflow.php
index 69ee4b0c7..2012b7226 100644
--- a/workflow/engine/src/ProcessMaker/Project/Workflow.php
+++ b/workflow/engine/src/ProcessMaker/Project/Workflow.php
@@ -2,6 +2,7 @@
namespace ProcessMaker\Project;
use \Criteria;
+use ProcessMaker\Plugins\PluginRegistry;
use \ResultSet;
use \Process;
@@ -87,7 +88,7 @@ class Workflow extends Handler
$pluginData['PRO_TEMPLATE'] = empty($data["PRO_TEMPLATE"]) ? "" : $data["PRO_TEMPLATE"];
$pluginData['PROCESSMAP'] = null;
- $pluginRegistry = \PMPluginRegistry::getSingleton();
+ $pluginRegistry = PluginRegistry::loadSingleton();
$pluginRegistry->executeTriggers(PM_NEW_PROCESS_SAVE, $pluginData);
// Save Calendar ID for this process
@@ -230,7 +231,7 @@ class Workflow extends Handler
}
if ($tasType == "SERVICE-TASK") {
- $registry = \PMPluginRegistry::getSingleton();
+ $registry = PluginRegistry::loadSingleton();
//The plugin pmConnectors will be moved to the core in pm.3.3
if ($registry->getStatusPlugin('pmConnectors') === 'enabled') {
$pathFile = PATH_PLUGINS . 'pmConnectors' . PATH_SEP . 'src' . PATH_SEP . 'Services' . PATH_SEP . 'BusinessModel' . PATH_SEP . 'PmConnectors' . PATH_SEP . 'ServiceTaskBM.php';
diff --git a/workflow/engine/templates/cases/cases_StepsTree.php b/workflow/engine/templates/cases/cases_StepsTree.php
index a99489c96..e8c2489d7 100644
--- a/workflow/engine/templates/cases/cases_StepsTree.php
+++ b/workflow/engine/templates/cases/cases_StepsTree.php
@@ -28,7 +28,7 @@
$c->add ( StepPeer::TAS_UID, $_SESSION['TASK'] );
$c->addAscendingOrderByColumn ( StepPeer::STEP_POSITION );
- $oPluginRegistry = &PMPluginRegistry::getSingleton();
+ $oPluginRegistry = \ProcessMaker\Plugins\PluginRegistry::loadSingleton();
$externalSteps = $oPluginRegistry->getSteps();
$oTree = new Tree();
@@ -71,10 +71,11 @@
case 'EXTERNAL':
$stepTitle = 'unknown ' . $aRow->getStepUidObj();
$oPluginRegistry = &PMPluginRegistry::getSingleton ();
- foreach ( $externalSteps as $key=>$val ) {
- if ( $val->sStepId == $aRow->getStepUidObj() ) {
- $stepTitle = $val->sStepTitle; //default title
- $sNamespace = $val->sNamespace;
+ /** @var \ProcessMaker\Plugins\Interfaces\StepDetail $val */
+ foreach ( $externalSteps as $val ) {
+ if ($val->equalStepIdTo($aRow->getStepUidObj())) {
+ $stepTitle = $val->getStepTitle(); //default title
+ $sNamespace = $val->getNamespace();
$oPlugin =& $oPluginRegistry->getPlugin($sNamespace);
$classFile = PATH_PLUGINS . $oPlugin->sNamespace . PATH_SEP . 'class.' . $oPlugin->sNamespace .'.php';
if ( file_exists ( $classFile ) ) {
diff --git a/workflow/engine/templates/steps/triggers_Tree.php b/workflow/engine/templates/steps/triggers_Tree.php
index 992f11820..0a24686ec 100644
--- a/workflow/engine/templates/steps/triggers_Tree.php
+++ b/workflow/engine/templates/steps/triggers_Tree.php
@@ -26,7 +26,7 @@
try {
//call plugin
- $oPluginRegistry = &PMPluginRegistry::getSingleton();
+ $oPluginRegistry = \ProcessMaker\Plugins\PluginRegistry::loadSingleton();
$externalSteps = $oPluginRegistry->getSteps();
$oProcessMap = new ProcessMap();
@@ -64,9 +64,10 @@ try {
break;
case 'EXTERNAL':
$aRow['STEP_NAME'] = 'unknown ' . $aRow['STEP_UID'];
- foreach ( $externalSteps as $key=>$val ) {
- if ( $val->sStepId == $aRow['STEP_UID_OBJ'] )
- $aRow['STEP_NAME'] = $val->sStepTitle;
+ /** @var \ProcessMaker\Plugins\Interfaces\StepDetail $val */
+ foreach ( $externalSteps as $val ) {
+ if ( $val->equalStepIdTo($aRow['STEP_UID_OBJ']))
+ $aRow['STEP_NAME'] = $val->getStepTitle();
}
break;
}
diff --git a/workflow/public_html/bootstrap.php b/workflow/public_html/bootstrap.php
index eb2d3b727..0b41e9256 100644
--- a/workflow/public_html/bootstrap.php
+++ b/workflow/public_html/bootstrap.php
@@ -419,12 +419,7 @@
//here we are loading all plugins registered
//the singleton has a list of enabled plugins
- $sSerializedFile = PATH_DATA_SITE . 'plugin.singleton';
- $oPluginRegistry =& PMPluginRegistry::getSingleton();
-
- if (file_exists ($sSerializedFile)) {
- $oPluginRegistry->unSerializeInstance(file_get_contents($sSerializedFile));
- }
+ $oPluginRegistry = \ProcessMaker\Plugins\PluginRegistry::loadSingleton();
// setup propel definitions and logging
require_once ( "propel/Propel.php" );
diff --git a/workflow/public_html/sysGeneric.php b/workflow/public_html/sysGeneric.php
index f2ee126b9..a121ee9ab 100644
--- a/workflow/public_html/sysGeneric.php
+++ b/workflow/public_html/sysGeneric.php
@@ -680,7 +680,7 @@ if (defined( 'DEBUG_SQL_LOG' ) && DEBUG_SQL_LOG) {
//here we are loading all plugins registered
//the singleton has a list of enabled plugins
-$oPluginRegistry = &ProcessMaker\Plugins\PluginsRegistry::loadSingleton();
+$oPluginRegistry = ProcessMaker\Plugins\PluginRegistry::loadSingleton();
$attributes = $oPluginRegistry->getAttributes();
Bootstrap::LoadTranslationPlugins( defined( 'SYS_LANG' ) ? SYS_LANG : "en" , $attributes);