diff --git a/composer.lock b/composer.lock
index 895e8be4a..a2c604353 100644
--- a/composer.lock
+++ b/composer.lock
@@ -644,7 +644,7 @@
],
"authors": [
{
- "name": "Jean-Marc Trémeaux",
+ "name": "Jean-Marc Tr??meaux",
"homepage": "http://naku.dohcrew.com/",
"role": "Developer"
},
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/framework/src/Maveriks/WebApplication.php b/framework/src/Maveriks/WebApplication.php
index 6af32cd75..2c85b2d08 100644
--- a/framework/src/Maveriks/WebApplication.php
+++ b/framework/src/Maveriks/WebApplication.php
@@ -2,6 +2,7 @@
namespace Maveriks;
use Maveriks\Util;
+use ProcessMaker\Plugins\PluginRegistry;
use ProcessMaker\Services;
use ProcessMaker\Services\Api;
use Luracast\Restler\RestException;
@@ -359,8 +360,8 @@ class WebApplication
}
// hook to get rest api classes from plugins
- if (class_exists('PMPluginRegistry') && file_exists(PATH_DATA_SITE . 'plugin.singleton')) {
- $pluginRegistry = \PMPluginRegistry::loadSingleton(PATH_DATA_SITE . 'plugin.singleton');
+ if (class_exists('ProcessMaker\Plugins\PluginRegistry')) {
+ $pluginRegistry = PluginRegistry::loadSingleton();
$plugins = $pluginRegistry->getRegisteredRestServices();
if (! empty($plugins)) {
@@ -371,8 +372,9 @@ class WebApplication
$loader->add($pluginSourceDir);
foreach ($plugin as $class) {
- if (class_exists($class['namespace'])) {
- $this->rest->addAPIClass($class['namespace'], strtolower($pluginName));
+ $className = is_object($class) ? $class->namespace: $class['namespace'];
+ if (class_exists($className)) {
+ $this->rest->addAPIClass($className, strtolower($pluginName));
}
}
}
diff --git a/gulliver/bin/tasks/pakeGulliver.php b/gulliver/bin/tasks/pakeGulliver.php
index 2e8d88562..9c885069c 100644
--- a/gulliver/bin/tasks/pakeGulliver.php
+++ b/gulliver/bin/tasks/pakeGulliver.php
@@ -27,7 +27,7 @@
*/
//dont work mb_internal_encoding('UTF-8');
-
+use ProcessMaker\Plugins\PluginRegistry;
pake_desc('gulliver version');
@@ -519,7 +519,7 @@ function run_pack_plugin($task, $args) {
require_once ($pluginFilename);
- $oPluginRegistry = & PMPluginRegistry::getSingleton();
+ $oPluginRegistry = PluginRegistry::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 = PluginRegistry::loadSingleton();
$pmPluginRegistry->updatePluginAttributesInAllWorkspaces($pluginName);
diff --git a/gulliver/methods/defaultAjax.php b/gulliver/methods/defaultAjax.php
index c0ad336a0..1daa72eea 100644
--- a/gulliver/methods/defaultAjax.php
+++ b/gulliver/methods/defaultAjax.php
@@ -23,6 +23,9 @@
*/
/*NEXT LINE: Runs any configuration defined to be executed before dependent fields recalc*/
+
+use ProcessMaker\Plugins\PluginRegistry;
+
if (isset( $_SESSION['CURRENT_PAGE_INITILIZATION'] ))
eval( $_SESSION['CURRENT_PAGE_INITILIZATION'] );
@@ -44,7 +47,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 = PluginRegistry::loadSingleton();
if ($oPluginRegistry->isRegisteredFolder( $aux[0] )) {
$sPath = PATH_PLUGINS;
}
diff --git a/gulliver/methods/propelTableAjax.php b/gulliver/methods/propelTableAjax.php
index 6ca4aaaa9..93205fe77 100644
--- a/gulliver/methods/propelTableAjax.php
+++ b/gulliver/methods/propelTableAjax.php
@@ -24,6 +24,8 @@
*/
/* Includes */
+use ProcessMaker\Plugins\PluginRegistry;
+
G::LoadAllPluginModelClasses();
$id = get_ajax_value('ptID');
$ntable = unserialize(base64_decode($_SESSION['pagedTable[' . $id . ']']));
@@ -39,7 +41,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 = PluginRegistry::loadSingleton();
if ( $oPluginRegistry->isRegisteredFolder($aux[0]) ) {
$sPath = PATH_PLUGINS;
}
diff --git a/gulliver/system/class.g.php b/gulliver/system/class.g.php
index 692d2274e..174749f9f 100644
--- a/gulliver/system/class.g.php
+++ b/gulliver/system/class.g.php
@@ -24,6 +24,8 @@
*
*/
+use ProcessMaker\Plugins\PluginRegistry;
+
/**
* @package gulliver.system
*/
@@ -476,7 +478,7 @@ class G
*
* @return void
*/
- public function rm_dir ($dirName)
+ public static function rm_dir ($dirName)
{
if (! is_writable( $dirName )) {
return false;
@@ -5016,9 +5018,9 @@ class G
$restClasses = array_merge( $restClasses, $pluginRestClasses );
}
// hook to get rest api classes from plugins
- if (class_exists( 'PMPluginRegistry' )) {
- $pluginRegistry = & PMPluginRegistry::getSingleton();
- $pluginClasses = $pluginRegistry->getRegisteredRestClassFiles();
+ if (class_exists( 'ProcessMaker\Plugins\PluginRegistry' )) {
+ $pluginRegistry = PluginRegistry::loadSingleton();
+ $pluginClasses = $pluginRegistry->getRegisteredRestServices();
$restClasses = array_merge( $restClasses, $pluginClasses );
}
foreach ($restClasses as $key => $classFile) {
diff --git a/gulliver/system/class.headPublisher.php b/gulliver/system/class.headPublisher.php
index 84f2be7fb..5cc0e0861 100644
--- a/gulliver/system/class.headPublisher.php
+++ b/gulliver/system/class.headPublisher.php
@@ -25,6 +25,8 @@
*
*/
+use ProcessMaker\Plugins\PluginRegistry;
+
/**
* Class headPublisher
*
@@ -386,11 +388,12 @@ class headPublisher
*/
// Load external/plugin css
// NOTE is necesary to move this to decorator server
- if (class_exists('PMPluginRegistry')) {
- $oPluginRegistry = & PMPluginRegistry::getSingleton();
+ if (class_exists('ProcessMaker\Plugins\PluginRegistry') && defined('SYS_SYS')) {
+ $oPluginRegistry = PluginRegistry::loadSingleton();
$registeredCss = $oPluginRegistry->getRegisteredCss();
+ /** @var \ProcessMaker\Plugins\Interfaces\CssFile $cssFile */
foreach ($registeredCss as $cssFile) {
- $script .= " \n";
+ $script .= " \n";
}
}
return $script;
@@ -504,7 +507,7 @@ class headPublisher
$flagPlugin = false;
$keyPlugin = count($aux)-2;
- $oPluginRegistry = & PMPluginRegistry::getSingleton();
+ $oPluginRegistry = PluginRegistry::loadSingleton();
if ($oPluginRegistry->isRegisteredFolder($aux[$keyPlugin])) {
$flagPlugin = true;
} else {
@@ -550,8 +553,8 @@ class headPublisher
$this->extJsScript[] = '/extjs/' . $cacheName;
//hook for registered javascripts from plugins
- if (class_exists('PMPluginRegistry')) {
- $oPluginRegistry = & PMPluginRegistry::getSingleton();
+ if (class_exists('ProcessMaker\Plugins\PluginRegistry') && defined('SYS_SYS')) {
+ $oPluginRegistry = PluginRegistry::loadSingleton();
$pluginJavascripts = $oPluginRegistry->getRegisteredJavascriptBy($filename);
} else {
$pluginJavascripts = array();
@@ -681,7 +684,7 @@ class headPublisher
$aux = explode(PATH_SEP, $file);
//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 = PluginRegistry::loadSingleton();
if ($oPluginRegistry->isRegisteredFolder($aux[0])) {
$sPath = PATH_PLUGINS;
}
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 f3d0c13fe..2f2d547b7 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,12 +198,12 @@ class RbacUsers extends BaseRbacUsers
public function create($aData)
{
- if (class_exists('PMPluginRegistry')) {
- $pluginRegistry = & PMPluginRegistry::getSingleton();
+ if (class_exists('ProcessMaker\Plugins\PluginRegistry')) {
+ $pluginRegistry = PluginRegistry::loadSingleton();
if ($pluginRegistry->existsTrigger(PM_BEFORE_CREATE_USER)) {
try {
$pluginRegistry->executeTriggers(PM_BEFORE_CREATE_USER, null);
- } catch(Exception $error) {
+ } catch (Exception $error) {
throw new Exception($error->getMessage());
}
}
diff --git a/thirdparty/creole/drivers/mysql/MySQLConnection.php b/thirdparty/creole/drivers/mysql/MySQLConnection.php
index d3c8a05ee..b41c69faa 100644
--- a/thirdparty/creole/drivers/mysql/MySQLConnection.php
+++ b/thirdparty/creole/drivers/mysql/MySQLConnection.php
@@ -126,7 +126,6 @@ class MySQLConnection extends ConnectionCommon implements Connection {
*/
public function getDatabaseInfo()
{
- require_once 'creole/drivers/mysql/metadata/MySQLDatabaseInfo.php';
return new MySQLDatabaseInfo($this);
}
@@ -135,7 +134,6 @@ class MySQLConnection extends ConnectionCommon implements Connection {
*/
public function getIdGenerator()
{
- require_once 'creole/drivers/mysql/MySQLIdGenerator.php';
return new MySQLIdGenerator($this);
}
@@ -144,7 +142,6 @@ class MySQLConnection extends ConnectionCommon implements Connection {
*/
public function prepareStatement($sql)
{
- require_once 'creole/drivers/mysql/MySQLPreparedStatement.php';
return new MySQLPreparedStatement($this, $sql);
}
@@ -160,7 +157,6 @@ class MySQLConnection extends ConnectionCommon implements Connection {
*/
public function createStatement()
{
- require_once 'creole/drivers/mysql/MySQLStatement.php';
return new MySQLStatement($this);
}
diff --git a/thirdparty/propel/Propel.php b/thirdparty/propel/Propel.php
index f8400cdb9..3ebef7a3e 100644
--- a/thirdparty/propel/Propel.php
+++ b/thirdparty/propel/Propel.php
@@ -495,8 +495,6 @@ class Propel {
throw new PropelException("No connection params set for " . $name);
}
}
-
- include_once 'creole/Creole.php';
// if specified, use custom driver
if (isset(self::$configuration['datasources'][$name]['driver'])) {
Creole::registerDriver($dsn['phptype'], self::$configuration['datasources'][$name]['driver']);
diff --git a/workflow/engine/bin/cron_single.php b/workflow/engine/bin/cron_single.php
index 5ece0cd9a..fac05dc1a 100644
--- a/workflow/engine/bin/cron_single.php
+++ b/workflow/engine/bin/cron_single.php
@@ -1,5 +1,8 @@
unSerializeInstance(file_get_contents(PATH_DATA_SITE . 'plugin.singleton'));
- }
+ $oPluginRegistry = PluginRegistry::loadSingleton();
global $sObject;
global $sLastExecution;
@@ -326,7 +316,6 @@ function resendEmails()
setExecutionMessage("Resending emails");
try {
-
$dateResend = $sNow;
if ($sNow == $dateSystem) {
@@ -391,8 +380,6 @@ function unpauseApplications()
setExecutionMessage("Unpausing applications");
try {
-
-
$oCases = new Cases();
$oCases->ThrowUnpauseDaemon($sNow, 1);
@@ -436,7 +423,7 @@ function executePlugins()
// Executing registered cron files
// -> Get registered cron files
- $oPluginRegistry =& PMPluginRegistry::getSingleton();
+ $oPluginRegistry = PluginRegistry::loadSingleton();
$cronFiles = $oPluginRegistry->getCronFiles();
// -> Execute functions
diff --git a/workflow/engine/bin/tasks/cliAddons.php b/workflow/engine/bin/tasks/cliAddons.php
index 332a4deb8..3929af511 100644
--- a/workflow/engine/bin/tasks/cliAddons.php
+++ b/workflow/engine/bin/tasks/cliAddons.php
@@ -56,13 +56,7 @@ function run_addon_core_install($args)
define("DB_ADAPTER", $args[3]);
}
- $sSerializedFile = PATH_DATA_SITE . "plugin.singleton";
- $oPluginRegistry = &PMPluginRegistry::getSingleton();
- if (file_exists($sSerializedFile)) {
- $oPluginRegistry->unSerializeInstance(file_get_contents($sSerializedFile));
- }
///////
- //echo "** Installation starting... (workspace: $workspace, store: $storeId, id: $addonName)\n";
$ws = new workspaceTools($workspace);
$ws->initPropel(false);
diff --git a/workflow/engine/bin/tasks/cliFlushCache.php b/workflow/engine/bin/tasks/cliFlushCache.php
index 3934d096a..2be46226e 100644
--- a/workflow/engine/bin/tasks/cliFlushCache.php
+++ b/workflow/engine/bin/tasks/cliFlushCache.php
@@ -25,6 +25,8 @@
*/
+use ProcessMaker\Util\System;
+
CLI::taskName('flush-cache');
CLI::taskDescription(<<name . " ... ";
echo PHP_EOL;
echo " Flush workspace " . pakeColor::colorize($workspace->name, "INFO") . " cache ... " . PHP_EOL;
- $status = \ProcessMaker\Util\System::flushCache($workspace);
+ System::flushCache($workspace);
echo "DONE" . PHP_EOL;
} catch (Exception $e) {
echo $e->getMessage() . PHP_EOL;
diff --git a/workflow/engine/bin/tasks/cliWorkspaces.php b/workflow/engine/bin/tasks/cliWorkspaces.php
index 05b4ec6e6..9f6725af0 100644
--- a/workflow/engine/bin/tasks/cliWorkspaces.php
+++ b/workflow/engine/bin/tasks/cliWorkspaces.php
@@ -303,6 +303,19 @@ CLI::taskArg('workspace', true, true);
CLI::taskOpt("lang", "Specify the language to migrate the content data. If not specified, then 'en' (English) will be used by default.\n Ex: -lfr (French) Ex: --lang=zh-CN (Mainland Chinese)", "l:","lang=");
CLI::taskRun("run_migrate_content");
+CLI::taskName('migrate-plugins-singleton-information');
+CLI::taskDescription(<< Migrating and populating indexing for avoiding the use of table APP_CACHE_VIEW process took " . ($stop - $start) . " seconds.\n");
}
+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);
+ CLI::logging('Regenerating Singleton in: ' . pakeColor::colorize($workspace->name, 'INFO') . "\n");
+ $workspace->migrateSingleton($workspace->name);
+ CLI::logging("-> Regenerating Singleton \n");
+ } else {
+ CLI::logging("> Migrating and populating data...\n");
+ $start = microtime(true);
+ foreach ($workspaces as $workspace) {
+ passthru('./processmaker migrate-plugins-singleton-information '.$workspace->name);
+ }
+ $stop = microtime(true);
+ CLI::logging("<*> Migrating and populating data Singleton took " . ($stop - $start) . " seconds.\n");
+ }
+}
/**
- * This method recursively finds all PHP files that reference the path PATH_DATA
- * incorrectly, which is caused by importing processes where the data directory
- * of ProcessMaker has different routes. Modified files are backed up with the
+ * This method recursively finds all PHP files that reference the path PATH_DATA
+ * incorrectly, which is caused by importing processes where the data directory
+ * of ProcessMaker has different routes. Modified files are backed up with the
* extension '.backup' in the same directory.
- *
+ *
* @param array $args
* @param array $opts
* @throws Exception
diff --git a/workflow/engine/classes/PmInstaller.php b/workflow/engine/classes/PmInstaller.php
index c7bc743d6..23b9b082c 100644
--- a/workflow/engine/classes/PmInstaller.php
+++ b/workflow/engine/classes/PmInstaller.php
@@ -84,7 +84,7 @@ class PmInstaller
* @param string $name Default value "workflow"
* @return string file_exists(PATH_DATA."sites/".$name);
*/
- public function isset_site($name = "workflow")
+ public static function isset_site($name = "workflow")
{
$pathSites = PATH_DATA . 'sites/'. '*';
$directories = glob($pathSites, GLOB_ONLYDIR);
diff --git a/workflow/engine/classes/ProcessMap.php b/workflow/engine/classes/ProcessMap.php
index d93ae3d10..798e7e893 100644
--- a/workflow/engine/classes/ProcessMap.php
+++ b/workflow/engine/classes/ProcessMap.php
@@ -24,6 +24,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;
+
/**
*
* @package workflow.engine.ProcessMaker
@@ -368,12 +371,13 @@ class ProcessMap
$oPM->derivation = array('Sequential', 'Evaluate (manual)', 'Evaluate (auto)', 'Parallel (fork)', 'Parallel by evaluation (fork)', 'Parallel (sequential join)', 'Parallel (sequential main join)' );
//Load extended task properties from plugin. By JHL Jan 18, 2011
- $oPluginRegistry = & PMPluginRegistry::getSingleton();
+ $oPluginRegistry = PluginRegistry::loadSingleton();
+ /** @var \ProcessMaker\Plugins\Interfaces\TaskExtendedProperty[] $activePluginsForTaskProperties */
$activePluginsForTaskProperties = $oPluginRegistry->getTaskExtendedProperties();
$oPM->taskOptions = array();
- foreach ($activePluginsForTaskProperties as $key => $taskPropertiesInfo) {
- $taskOption['title'] = $taskPropertiesInfo->sName;
- $taskOption['id'] = $taskPropertiesInfo->sNamespace . "--" . $taskPropertiesInfo->sName;
+ foreach ($activePluginsForTaskProperties as $taskPropertiesInfo) {
+ $taskOption['title'] = $taskPropertiesInfo->getName();
+ $taskOption['id'] = $taskPropertiesInfo->getNamespace() . "--" . $taskPropertiesInfo->getName();
$oPM->taskOptions[] = $taskOption;
}
@@ -745,7 +749,8 @@ class ProcessMap
{
try {
//call plugin
- $oPluginRegistry = &PMPluginRegistry::getSingleton();
+ $oPluginRegistry = PluginRegistry::loadSingleton();
+ /** @var \ProcessMaker\Plugins\Interfaces\StepDetail[] $externalSteps */
$externalSteps = $oPluginRegistry->getSteps();
$aSteps = array();
@@ -795,9 +800,9 @@ class ProcessMap
case 'EXTERNAL':
$sTitle = 'unknown ' . $aRow['STEP_UID'];
foreach ($externalSteps as $key => $val) {
- if ($val->sStepId == $aRow['STEP_UID_OBJ']) {
- $sTitle = $val->sStepTitle;
- if (trim($val->sSetupStepPage) != '') {
+ if ($val->equalStepIdTo($aRow['STEP_UID_OBJ'])) {
+ $sTitle = $val->getStepTitle();
+ if (trim($val->getSetupStepPage()) != '') {
$urlEdit = "externalStepEdit('" . $aRow['STEP_UID'] . "', '" . $val->sSetupStepPage . "');";
$linkEditValue = 'Edit';
} else {
@@ -929,11 +934,17 @@ class ProcessMap
}
//call plugin
- $oPluginRegistry = &PMPluginRegistry::getSingleton();
+ $oPluginRegistry = PluginRegistry::loadSingleton();
+ /** @var \ProcessMaker\Plugins\Interfaces\StepDetail[] $externalSteps */
$externalSteps = $oPluginRegistry->getSteps();
if (is_array($externalSteps) && count($externalSteps) > 0) {
foreach ($externalSteps as $key => $stepVar) {
- $aBB[] = array('STEP_UID' => $stepVar->sStepId, 'STEP_TITLE' => $stepVar->sStepTitle, 'STEP_TYPE_OBJ' => 'EXTERNAL', 'STEP_MODE' => '' );
+ $aBB[] = array(
+ 'STEP_UID' => $stepVar->getStepId(),
+ 'STEP_TITLE' => $stepVar->getStepTitle(),
+ 'STEP_TYPE_OBJ' => 'EXTERNAL',
+ 'STEP_MODE' => ''
+ );
}
}
global $_DBArray;
@@ -1363,12 +1374,13 @@ class ProcessMap
break;
default:
//if the $iForm is not one of the defaults then search under Plugins for an extended property. By JHL Jan 18, 2011
- $oPluginRegistry = & PMPluginRegistry::getSingleton();
+ $oPluginRegistry = PluginRegistry::loadSingleton();
+ /** @var \ProcessMaker\Plugins\Interfaces\TaskExtendedProperty[] $activePluginsForTaskProperties */
$activePluginsForTaskProperties = $oPluginRegistry->getTaskExtendedProperties();
foreach ($activePluginsForTaskProperties as $key => $taskPropertiesInfo) {
- $id = $taskPropertiesInfo->sNamespace . "--" . $taskPropertiesInfo->sName;
+ $id = $taskPropertiesInfo->getNamespace() . "--" . $taskPropertiesInfo->getName();
if ($id == $iForm) {
- $sFilename = $taskPropertiesInfo->sPage;
+ $sFilename = $taskPropertiesInfo->getPage();
$sw_template = true;
}
}
@@ -4697,10 +4709,6 @@ class ProcessMap
public function getDynaformList($sTaskUID = '')
{
try {
- //call plugin
- $oPluginRegistry = &PMPluginRegistry::getSingleton();
- $externalSteps = $oPluginRegistry->getSteps();
-
$aSteps = array();
//$aSteps [] = array ('STEP_TITLE' => 'char', 'STEP_UID' => 'char', 'STEP_TYPE_OBJ' => 'char', 'STEP_CONDITION' => 'char', 'STEP_POSITION' => 'integer' );
$oCriteria = new Criteria('workflow');
@@ -5131,11 +5139,17 @@ class ProcessMap
}
//call plugin
- $oPluginRegistry = &PMPluginRegistry::getSingleton();
+ $oPluginRegistry = PluginRegistry::loadSingleton();
+ /** @var \ProcessMaker\Plugins\Interfaces\StepDetail[] $externalSteps */
$externalSteps = $oPluginRegistry->getSteps();
if (is_array($externalSteps) && count($externalSteps) > 0) {
foreach ($externalSteps as $key => $stepVar) {
- $aBB[] = array('STEP_UID' => $stepVar->sStepId, 'STEP_TITLE' => $stepVar->sStepTitle, 'STEP_TYPE_OBJ' => 'EXTERNAL', 'STEP_MODE' => '' );
+ $aBB[] = array(
+ 'STEP_UID' => $stepVar->getStepId(),
+ 'STEP_TITLE' => $stepVar->getStepTitle(),
+ 'STEP_TYPE_OBJ' => 'EXTERNAL',
+ 'STEP_MODE' => ''
+ );
}
}
@@ -5180,7 +5194,8 @@ class ProcessMap
{
try {
//call plugin
- $oPluginRegistry = &PMPluginRegistry::getSingleton();
+ $oPluginRegistry = PluginRegistry::loadSingleton();
+ /** @var \ProcessMaker\Plugins\Interfaces\StepDetail[] $externalSteps */
$externalSteps = $oPluginRegistry->getSteps();
$aSteps = array();
@@ -5239,10 +5254,10 @@ class ProcessMap
case 'EXTERNAL':
$sTitle = 'unknown ' . $aRow['STEP_UID'];
foreach ($externalSteps as $key => $val) {
- if ($val->sStepId == $aRow['STEP_UID_OBJ']) {
- $sTitle = $val->sStepTitle;
- if (trim($val->sSetupStepPage) != '') {
- $urlEdit = "externalStepEdit('" . $aRow['STEP_UID'] . "', '" . $val->sSetupStepPage . "');";
+ if ($val->equalStepIdTo($aRow['STEP_UID_OBJ'])) {
+ $sTitle = $val->getStepTitle();
+ if (trim($val->getSetupStepPage()) != '') {
+ $urlEdit = "externalStepEdit('" . $aRow['STEP_UID'] . "', '" . $val->getSetupStepPage() . "');";
$linkEditValue = 'Edit';
} else {
$urlEdit = "";
diff --git a/workflow/engine/classes/class.applications.php b/workflow/engine/classes/class.applications.php
index 88256fd91..39b1e1fb5 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
@@ -1187,11 +1190,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 747e60319..2a37048bb 100644
--- a/workflow/engine/classes/class.case.php
+++ b/workflow/engine/classes/class.case.php
@@ -27,6 +27,7 @@ use \ProcessMaker\BusinessModel\WebEntryEvent;
*
*/
+use ProcessMaker\Plugins\PluginRegistry;
/**
* A Cases object where you can do start, load, update, refresh about cases
@@ -2278,7 +2279,7 @@ class Cases
$newValues['APP_TITLE'],
$sUsrUid
);
- $oPluginRegistry = &PMPluginRegistry::getSingleton();
+ $oPluginRegistry = PluginRegistry::loadSingleton();
$oPluginRegistry->executeTriggers(PM_CREATE_CASE, $folderData);
}
$this->getExecuteTriggerProcess($sAppUid, 'CREATE');
@@ -3550,7 +3551,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";
@@ -3891,7 +3892,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);
@@ -4648,12 +4649,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);
}
@@ -4955,12 +4955,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..3b70a555f 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;
}
@@ -530,7 +504,7 @@ class PMPlugin
$aPluginsPP[] = substr($aPlugin['sFilename'], 0, strpos($aPlugin['sFilename'], '-')) . '.php';
}
}
- $oPluginRegistry = PMPluginRegistry::getSingleton();
+ $oPluginRegistry = PluginRegistry::loadSingleton();
if ($handle = opendir(PATH_PLUGINS)) {
while (false !== ($file = readdir($handle))) {
if (in_array($file, $aPluginsPP)) {
@@ -538,23 +512,24 @@ class PMPlugin
}
if (strpos($file, '.php', 1) && is_file(PATH_PLUGINS . $file)) {
include_once (PATH_PLUGINS . $file);
+ /** @var \ProcessMaker\Plugins\Interfaces\PluginDetail $pluginDetail */
$pluginDetail = $oPluginRegistry->getPluginDetails($file);
if ($pluginDetail === null) {
continue;
}
- $status_label = $pluginDetail->enabled ? G::LoadTranslation('ID_ENABLED') : G::LoadTranslation('ID_DISABLED');
- $status = $pluginDetail->enabled ? 1 : 0;
- if (isset($pluginDetail->aWorkspaces)) {
- if (!is_array($pluginDetail->aWorkspaces)) {
- $pluginDetail->aWorkspaces = array();
+ $status_label = $pluginDetail->isEnabled() ? G::LoadTranslation('ID_ENABLED') : G::LoadTranslation('ID_DISABLED');
+ $status = $pluginDetail->isEnabled() ? 1 : 0;
+ if ($pluginDetail->getWorkspaces()) {
+ if (!is_array($pluginDetail->getWorkspaces())) {
+ $pluginDetail->setWorkspaces(array());
}
- if (!in_array($workspace, $pluginDetail->aWorkspaces)) {
+ if (!in_array($workspace, $pluginDetail->getWorkspaces())) {
continue;
}
}
- $setup = $pluginDetail->sSetupPage != '' && $pluginDetail->enabled ? '1' : '0';
+ $setup = $pluginDetail->getSetupPage() != '' && $pluginDetail->isEnabled() ? '1' : '0';
- if (isset($pluginDetail) && !$pluginDetail->bPrivate) {
+ if (isset($pluginDetail) && !$pluginDetail->isPrivate()) {
$items[] = [
'id' => (count($items) + 1),
'namespace' => $pluginDetail->sNamespace,
@@ -585,14 +560,13 @@ class PMPlugin
*/
public static function getListAllPlugins($workspace)
{
- PMPluginRegistry::saveState();
- $pathSingleton = PATH_DATA . "sites" . PATH_SEP . $workspace . PATH_SEP . "plugin.singleton";
- $oPluginRegistry = PMPluginRegistry::loadSingleton($pathSingleton);
+ $oPluginRegistry = PluginRegistry::loadSingleton();
$items = [];
if ($handle = opendir(PATH_PLUGINS)) {
while (false !== ($file = readdir($handle))) {
if (strpos($file, '.php', 1) && is_file(PATH_PLUGINS . $file)) {
include_once (PATH_PLUGINS . $file);
+ /** @var \ProcessMaker\Plugins\Interfaces\PluginDetail $detail */
$detail = $oPluginRegistry->getPluginDetails($file);
if ($detail !== null) {
$items[] = $detail;
@@ -601,7 +575,6 @@ class PMPlugin
}
closedir($handle);
}
- PMPluginRegistry::restoreState();
return $items;
}
diff --git a/workflow/engine/classes/class.pluginRegistry.php b/workflow/engine/classes/class.pluginRegistry.php
index 1ff5b81e3..675f4f535 100644
--- a/workflow/engine/classes/class.pluginRegistry.php
+++ b/workflow/engine/classes/class.pluginRegistry.php
@@ -25,6 +25,8 @@
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
+use ProcessMaker\Plugins\PluginRegistry;
+
/**
*
* @package workflow.engine.classes
@@ -140,30 +142,21 @@ class PMPluginRegistry
*
* @return object
*/
- public static function getSingleton ()
+ public static function getSingleton()
{
- if (self::$instance == null) {
- self::$instance = new PMPluginRegistry();
- }
- return self::$instance;
+ return PluginRegistry::loadSingleton();
}
/**
* Load the singleton instance from a serialized stored file
*
* @param $file
- * @return PMPluginRegistry
+ * @return object
* @throws Exception
*/
public static function loadSingleton($file)
{
- self::$instance = unserialize(file_get_contents($file));
-
- if (! is_object(self::$instance) || get_class(self::$instance) != "PMPluginRegistry") {
- throw new Exception("Can't load main PMPluginRegistry object.");
- }
-
- return self::$instance;
+ return PluginRegistry::loadSingleton();
}
/**
@@ -1935,7 +1928,7 @@ class PMPluginRegistry
}
/**
- * Saves the state of instance, in the private property 'stateSaved'.
+ * Saves the state of instance, in the private property 'stateSaved'.
* Use the 'restoreState()' method to put the instance in the saved state.
*/
public static function saveState()
@@ -1945,8 +1938,8 @@ class PMPluginRegistry
}
/**
- * Restores the state of the instance that is in the private variable 'stateSaved'.
- * You must save the state of the instacia with the method 'saveState()'
+ * Restores the state of the instance that is in the private variable 'stateSaved'.
+ * You must save the state of the instacia with the method 'saveState()'
* before being called.
*/
public static function restoreState()
@@ -1958,4 +1951,16 @@ class PMPluginRegistry
}
}
+ /**
+ * 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/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 7fbdbb69f..84ddbd6b0 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..63c40ee8d 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 () );
}
}
}
@@ -265,7 +269,7 @@ class pmLicenseManager
public function unSerializeInstance($serialized)
{
if (self::$instance == null) {
- self::$instance = new PMPluginRegistry ();
+ self::$instance = new PluginRegistry();
}
$instance = unserialize ( $serialized );
self::$instance = $instance;
diff --git a/workflow/engine/classes/class.pmScript.php b/workflow/engine/classes/class.pmScript.php
index 742a84d31..df0ab928b 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.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..b054b6ee4 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) {
@@ -93,7 +93,7 @@ class triggerLibrary
function unSerializeInstance ($serialized)
{
if (self::$instance == NULL) {
- self::$instance = new PMPluginRegistry();
+ self::$instance = new PluginRegistry();
}
$instance = unserialize( $serialized );
diff --git a/workflow/engine/classes/class.wsTools.php b/workflow/engine/classes/class.wsTools.php
index 1eb56dd35..336610fa8 100644
--- a/workflow/engine/classes/class.wsTools.php
+++ b/workflow/engine/classes/class.wsTools.php
@@ -1,6 +1,7 @@
updateFrameworkPaths($workSpace);
$stop = microtime(true);
CLI::logging("<*> Update framework paths took " . ($stop - $start) . " seconds.\n");
+
+ $start = microtime(true);
+ CLI::logging("> Migrating and populating plugin singleton data...\n");
+ $this->migrateSingleton($workSpace);
+ $stop = microtime(true);
+ CLI::logging("<*> Migrating and populating plugin singleton data took " . ($stop - $start) . " seconds.\n");
}
/**
@@ -1644,7 +1651,7 @@ class workspaceTools
if (count($metaFiles) > 1 && (!isset($srcWorkspace))) {
throw new Exception("Multiple workspaces in backup but no workspace specified to restore");
}
- if (isset($srcWorkspace) && !in_array("$srcWorkspace.meta", array_map(BASENAME, $metaFiles))) {
+ if (isset($srcWorkspace) && !in_array("$srcWorkspace.meta", array_map('basename', $metaFiles))) {
throw new Exception("Workspace $srcWorkspace not found in backup");
}
@@ -1890,8 +1897,6 @@ class workspaceTools
}
if ($swv == 1) {
-
-
//Extract
$tar = new Archive_Tar($f);
@@ -2870,7 +2875,6 @@ class workspaceTools
{
CLI::logging("-> Verifying roles permissions in RBAC \n");
//Update table RBAC permissions
-
$RBAC = &RBAC::getSingleton();
$RBAC->initRBAC();
$result = $RBAC->verifyPermissions();
@@ -3884,7 +3888,32 @@ class workspaceTools
$this->initPropel(true);
$this->upgradeTriggersOfTables($flagRecreate, $lang);
}
-
+
+ /**
+ * @param $workspace
+ */
+ public function migrateSingleton($workspace)
+ {
+ if ((!class_exists('Memcache') || !class_exists('Memcached')) && !defined('MEMCACHED_ENABLED')) {
+ define('MEMCACHED_ENABLED', false);
+ }
+ $this->initPropel(true);
+ $conf = new Configuration();
+ 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 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);
+ }
+ }
+
/**
* This method finds all recursively PHP files that have the path PATH_DATA,
* poorly referenced, this is caused by the import of processes where the data
diff --git a/workflow/engine/classes/model/AddonsManager.php b/workflow/engine/classes/model/AddonsManager.php
index 4762cda5e..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,19 +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->setupPlugins();
- file_put_contents(PATH_DATA_SITE . "plugin.singleton", $oPluginRegistry->serializeInstance());
+ $oPluginRegistry->savePlugin($this->getAddonName());
return true;
}
@@ -170,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);
@@ -387,7 +382,7 @@ class AddonsManager extends BaseAddonsManager
$_SESSION["__ENTERPRISE_INSTALL__"] = 1;
}
- $oPluginRegistry = &PMPluginRegistry::getSingleton();
+ $oPluginRegistry = PluginRegistry::loadSingleton();
$oPluginRegistry->installPluginArchive($filename, $this->getAddonName());
$this->setState();
@@ -410,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..46229d861 100644
--- a/workflow/engine/classes/model/AppDelegation.php
+++ b/workflow/engine/classes/model/AppDelegation.php
@@ -25,6 +25,8 @@
*
*/
+use ProcessMaker\Plugins\PluginRegistry;
+
/**
* Skeleton subclass for representing a row from the 'APP_DELEGATION' table.
*
@@ -292,7 +294,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..48df924ec 100644
--- a/workflow/engine/classes/model/AppFolder.php
+++ b/workflow/engine/classes/model/AppFolder.php
@@ -5,8 +5,7 @@
* @package workflow.engine.classes.model
*/
-//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 +723,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 +731,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..a5577b78d 100644
--- a/workflow/engine/classes/model/CaseScheduler.php
+++ b/workflow/engine/classes/model/CaseScheduler.php
@@ -5,10 +5,7 @@
* @package workflow.engine.classes.model
*/
-//require_once 'classes/model/om/BaseCaseScheduler.php';
-
-//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 +445,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 +454,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 +486,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
new file mode 100644
index 000000000..d13b3ebc9
--- /dev/null
+++ b/workflow/engine/classes/model/PluginsRegistry.php
@@ -0,0 +1,247 @@
+toArray($keyType);
+ }
+ return $plugins;
+ }
+
+ /**
+ * 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
+ */
+ public static function load($prUid)
+ {
+ $oPluginsRegistry = PluginsRegistryPeer::retrieveByPK($prUid);
+ if ($oPluginsRegistry) {
+ /** @var array $aFields */
+ $aFields = $oPluginsRegistry->toArray(BasePeer::TYPE_FIELDNAME);
+ return $aFields;
+ } else {
+ throw new Exception("Plugin does not exist!");
+ }
+ }
+
+ /**
+ * Check if there is a plugin uid
+ * @param $prUid
+ * @return mixed|bool
+ */
+ public static function exists($prUid)
+ {
+ $oPluginsRegistry = PluginsRegistryPeer::retrieveByPk($prUid);
+ if ($oPluginsRegistry) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * 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 array
+ */
+ public static function loadOrCreateIfNotExists($prUid, $pluginData = [])
+ {
+ if (!self::exists($prUid)) {
+ $pluginData['PR_UID'] = $prUid;
+ self::create($pluginData);
+ } else {
+ $fields = self::load($prUid);
+ $pluginData = array_merge($fields, $pluginData);
+ }
+ return $pluginData;
+ }
+
+ /**
+ * Creates a record in the PLUGINS_REGISTRY table
+ * @param array $aData
+ * @return bool
+ * @throws Exception
+ */
+ public static function create($aData)
+ {
+ $oConnection = Propel::getConnection(PluginsRegistryPeer::DATABASE_NAME);
+ try {
+ $oPluginsRegistry = new PluginsRegistry();
+ $oPluginsRegistry->fromArray($aData, BasePeer::TYPE_FIELDNAME);
+ if ($oPluginsRegistry->validate()) {
+ $oConnection->begin();
+ $oPluginsRegistry->save();
+ $oConnection->commit();
+ return true;
+ } else {
+ $sMessage = '';
+ $aValidationFailures = $oPluginsRegistry->getValidationFailures();
+ /** @var ValidationFailed $oValidationFailure */
+ foreach ($aValidationFailures as $oValidationFailure) {
+ $sMessage .= $oValidationFailure->getMessage() . '
';
+ }
+ throw (new Exception('The registry cannot be created!
' . $sMessage));
+ }
+ } catch (Exception $oError) {
+ $oConnection->rollback();
+ throw ($oError);
+ }
+ }
+
+ /**
+ * Modifies a record in the PLUGINS_REGISTRY table
+ * @param array $aData
+ * @return int
+ * @throws Exception
+ */
+ public static function update($aData)
+ {
+ $oConnection = Propel::getConnection(PluginsRegistryPeer::DATABASE_NAME);
+ try {
+ $oPluginsRegistry = PluginsRegistryPeer::retrieveByPK($aData['PR_UID']);
+ if ($oPluginsRegistry) {
+ $oPluginsRegistry->fromArray($aData, 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 row doesn\'t exist!'));
+ }
+ } catch (Exception $oError) {
+ $oConnection->rollback();
+ throw ($oError);
+ }
+ }
+
+ /**
+ * Activate a plugin with your name
+ * @param string $Namespace
+ * @return int
+ * @throws Exception
+ */
+ 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);
+ }
+ }
+
+ /**
+ * Disable a plugin with your name
+ * @param string $Namespace
+ * @return int
+ * @throws Exception
+ */
+ 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/PluginsRegistryPeer.php b/workflow/engine/classes/model/PluginsRegistryPeer.php
new file mode 100644
index 000000000..e3e8cb762
--- /dev/null
+++ b/workflow/engine/classes/model/PluginsRegistryPeer.php
@@ -0,0 +1,23 @@
+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) {
- if (isset( $detail->sPathMethod ) && $detail->sRoleCode == $userRole) {
+ if (isset($aRedirectLogin) && is_array($aRedirectLogin)) {
+ /** @var \ProcessMaker\Plugins\Interfaces\RedirectDetail $detail */
+ foreach ($aRedirectLogin as $detail) {
+ $pathMethod = $detail->getPathMethod();
+ if (isset($pathMethod) && $detail->equalRoleCodeTo($userRole)) {
if (isset($_COOKIE['workspaceSkin'])) {
- $url = '/sys' . SYS_SYS . '/' . $this->lang . '/' . $_COOKIE['workspaceSkin'] . '/' . $detail->sPathMethod;
+ $url = '/sys' . SYS_SYS . '/' . $this->lang . '/' . $_COOKIE['workspaceSkin'] . '/' . $pathMethod;
} else {
- $url = '/sys' . SYS_SYS . '/' . $this->lang . '/' . SYS_SKIN . '/' . $detail->sPathMethod;
+ $url = '/sys' . SYS_SYS . '/' . $this->lang . '/' . SYS_SKIN . '/' . $pathMethod;
}
}
}
diff --git a/workflow/engine/classes/model/map/PluginsRegistryMapBuilder.php b/workflow/engine/classes/model/map/PluginsRegistryMapBuilder.php
new file mode 100644
index 000000000..69733f7a6
--- /dev/null
+++ b/workflow/engine/classes/model/map/PluginsRegistryMapBuilder.php
@@ -0,0 +1,118 @@
+dbMap !== null);
+ }
+
+ /**
+ * Gets the databasemap this map builder built.
+ *
+ * @return the databasemap
+ */
+ public function getDatabaseMap()
+ {
+ return $this->dbMap;
+ }
+
+ /**
+ * The doBuild() method builds the DatabaseMap
+ *
+ * @return void
+ * @throws PropelException
+ */
+ public function doBuild()
+ {
+ $this->dbMap = Propel::getDatabaseMap('workflow');
+
+ $tMap = $this->dbMap->addTable('PLUGINS_REGISTRY');
+ $tMap->setPhpName('PluginsRegistry');
+
+ $tMap->setUseIdGenerator(true);
+
+ $tMap->addColumn('ID', 'Id', 'int', CreoleTypes::INTEGER, true, null);
+
+ $tMap->addPrimaryKey('PR_UID', 'PrUid', 'string', CreoleTypes::VARCHAR, true, 32);
+
+ $tMap->addColumn('PLUGIN_NAMESPACE', 'PluginNamespace', 'string', CreoleTypes::VARCHAR, true, 100);
+
+ $tMap->addColumn('PLUGIN_DESCRIPTION', 'PluginDescription', 'string', CreoleTypes::VARCHAR, false, 200);
+
+ $tMap->addColumn('PLUGIN_CLASS_NAME', 'PluginClassName', 'string', CreoleTypes::VARCHAR, true, 100);
+
+ $tMap->addColumn('PLUGIN_FRIENDLY_NAME', 'PluginFriendlyName', 'string', CreoleTypes::VARCHAR, false, 150);
+
+ $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);
+
+ $tMap->addColumn('PLUGIN_PRIVATE', 'PluginPrivate', 'boolean', CreoleTypes::BOOLEAN, false, null);
+
+ $tMap->addColumn('PLUGIN_MENUS', 'PluginMenus', 'string', CreoleTypes::LONGVARCHAR, false, null);
+
+ $tMap->addColumn('PLUGIN_FOLDERS', 'PluginFolders', 'string', CreoleTypes::LONGVARCHAR, false, null);
+
+ $tMap->addColumn('PLUGIN_TRIGGERS', 'PluginTriggers', 'string', CreoleTypes::LONGVARCHAR, false, null);
+
+ $tMap->addColumn('PLUGIN_PM_FUNCTIONS', 'PluginPmFunctions', 'string', CreoleTypes::LONGVARCHAR, false, null);
+
+ $tMap->addColumn('PLUGIN_REDIRECT_LOGIN', 'PluginRedirectLogin', 'string', CreoleTypes::LONGVARCHAR, false, null);
+
+ $tMap->addColumn('PLUGIN_STEPS', 'PluginSteps', 'string', CreoleTypes::LONGVARCHAR, false, null);
+
+ $tMap->addColumn('PLUGIN_CSS', 'PluginCss', 'string', CreoleTypes::LONGVARCHAR, false, null);
+
+ $tMap->addColumn('PLUGIN_JS', 'PluginJs', 'string', CreoleTypes::LONGVARCHAR, false, null);
+
+ $tMap->addColumn('PLUGIN_REST_SERVICE', 'PluginRestService', 'string', CreoleTypes::LONGVARCHAR, false, null);
+
+ $tMap->addColumn('PLUGIN_ATTRIBUTES', 'PluginAttributes', 'string', CreoleTypes::LONGVARCHAR, false, null);
+
+ } // doBuild()
+
+} // PluginsRegistryMapBuilder
diff --git a/workflow/engine/classes/model/om/BasePluginsRegistry.php b/workflow/engine/classes/model/om/BasePluginsRegistry.php
new file mode 100644
index 000000000..29d3abdd4
--- /dev/null
+++ b/workflow/engine/classes/model/om/BasePluginsRegistry.php
@@ -0,0 +1,1832 @@
+id;
+ }
+
+ /**
+ * Get the [pr_uid] column value.
+ *
+ * @return string
+ */
+ public function getPrUid()
+ {
+
+ return $this->pr_uid;
+ }
+
+ /**
+ * Get the [plugin_namespace] column value.
+ *
+ * @return string
+ */
+ public function getPluginNamespace()
+ {
+
+ return $this->plugin_namespace;
+ }
+
+ /**
+ * Get the [plugin_description] column value.
+ *
+ * @return string
+ */
+ public function getPluginDescription()
+ {
+
+ return $this->plugin_description;
+ }
+
+ /**
+ * Get the [plugin_class_name] column value.
+ *
+ * @return string
+ */
+ public function getPluginClassName()
+ {
+
+ return $this->plugin_class_name;
+ }
+
+ /**
+ * Get the [plugin_friendly_name] column value.
+ *
+ * @return string
+ */
+ public function getPluginFriendlyName()
+ {
+
+ return $this->plugin_friendly_name;
+ }
+
+ /**
+ * Get the [plugin_file] column value.
+ *
+ * @return string
+ */
+ public function getPluginFile()
+ {
+
+ return $this->plugin_file;
+ }
+
+ /**
+ * Get the [plugin_folder] column value.
+ *
+ * @return string
+ */
+ public function getPluginFolder()
+ {
+
+ 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.
+ *
+ * @return string
+ */
+ public function getPluginVersion()
+ {
+
+ return $this->plugin_version;
+ }
+
+ /**
+ * Get the [plugin_enable] column value.
+ *
+ * @return boolean
+ */
+ public function getPluginEnable()
+ {
+
+ return $this->plugin_enable;
+ }
+
+ /**
+ * Get the [plugin_private] column value.
+ *
+ * @return boolean
+ */
+ public function getPluginPrivate()
+ {
+
+ return $this->plugin_private;
+ }
+
+ /**
+ * Get the [plugin_menus] column value.
+ *
+ * @return string
+ */
+ public function getPluginMenus()
+ {
+
+ return $this->plugin_menus;
+ }
+
+ /**
+ * Get the [plugin_folders] column value.
+ *
+ * @return string
+ */
+ public function getPluginFolders()
+ {
+
+ return $this->plugin_folders;
+ }
+
+ /**
+ * Get the [plugin_triggers] column value.
+ *
+ * @return string
+ */
+ public function getPluginTriggers()
+ {
+
+ return $this->plugin_triggers;
+ }
+
+ /**
+ * Get the [plugin_pm_functions] column value.
+ *
+ * @return string
+ */
+ public function getPluginPmFunctions()
+ {
+
+ return $this->plugin_pm_functions;
+ }
+
+ /**
+ * Get the [plugin_redirect_login] column value.
+ *
+ * @return string
+ */
+ public function getPluginRedirectLogin()
+ {
+
+ return $this->plugin_redirect_login;
+ }
+
+ /**
+ * Get the [plugin_steps] column value.
+ *
+ * @return string
+ */
+ public function getPluginSteps()
+ {
+
+ return $this->plugin_steps;
+ }
+
+ /**
+ * Get the [plugin_css] column value.
+ *
+ * @return string
+ */
+ public function getPluginCss()
+ {
+
+ return $this->plugin_css;
+ }
+
+ /**
+ * Get the [plugin_js] column value.
+ *
+ * @return string
+ */
+ public function getPluginJs()
+ {
+
+ return $this->plugin_js;
+ }
+
+ /**
+ * Get the [plugin_rest_service] column value.
+ *
+ * @return string
+ */
+ public function getPluginRestService()
+ {
+
+ return $this->plugin_rest_service;
+ }
+
+ /**
+ * Get the [plugin_attributes] column value.
+ *
+ * @return string
+ */
+ public function getPluginAttributes()
+ {
+
+ return $this->plugin_attributes;
+ }
+
+ /**
+ * Set the value of [id] column.
+ *
+ * @param int $v new value
+ * @return void
+ */
+ public function setId($v)
+ {
+
+ // Since the native PHP type for this column is integer,
+ // we will cast the input value to an int (if it is not).
+ if ($v !== null && !is_int($v) && is_numeric($v)) {
+ $v = (int) $v;
+ }
+
+ if ($this->id !== $v) {
+ $this->id = $v;
+ $this->modifiedColumns[] = PluginsRegistryPeer::ID;
+ }
+
+ } // setId()
+
+ /**
+ * Set the value of [pr_uid] column.
+ *
+ * @param string $v new value
+ * @return void
+ */
+ public function setPrUid($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->pr_uid !== $v || $v === '') {
+ $this->pr_uid = $v;
+ $this->modifiedColumns[] = PluginsRegistryPeer::PR_UID;
+ }
+
+ } // setPrUid()
+
+ /**
+ * Set the value of [plugin_namespace] column.
+ *
+ * @param string $v new value
+ * @return void
+ */
+ public function setPluginNamespace($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_namespace !== $v) {
+ $this->plugin_namespace = $v;
+ $this->modifiedColumns[] = PluginsRegistryPeer::PLUGIN_NAMESPACE;
+ }
+
+ } // setPluginNamespace()
+
+ /**
+ * Set the value of [plugin_description] column.
+ *
+ * @param string $v new value
+ * @return void
+ */
+ public function setPluginDescription($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_description !== $v || $v === '') {
+ $this->plugin_description = $v;
+ $this->modifiedColumns[] = PluginsRegistryPeer::PLUGIN_DESCRIPTION;
+ }
+
+ } // setPluginDescription()
+
+ /**
+ * Set the value of [plugin_class_name] column.
+ *
+ * @param string $v new value
+ * @return void
+ */
+ public function setPluginClassName($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_class_name !== $v) {
+ $this->plugin_class_name = $v;
+ $this->modifiedColumns[] = PluginsRegistryPeer::PLUGIN_CLASS_NAME;
+ }
+
+ } // setPluginClassName()
+
+ /**
+ * Set the value of [plugin_friendly_name] column.
+ *
+ * @param string $v new value
+ * @return void
+ */
+ public function setPluginFriendlyName($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_friendly_name !== $v || $v === '') {
+ $this->plugin_friendly_name = $v;
+ $this->modifiedColumns[] = PluginsRegistryPeer::PLUGIN_FRIENDLY_NAME;
+ }
+
+ } // setPluginFriendlyName()
+
+ /**
+ * Set the value of [plugin_file] column.
+ *
+ * @param string $v new value
+ * @return void
+ */
+ public function setPluginFile($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_file !== $v) {
+ $this->plugin_file = $v;
+ $this->modifiedColumns[] = PluginsRegistryPeer::PLUGIN_FILE;
+ }
+
+ } // setPluginFile()
+
+ /**
+ * Set the value of [plugin_folder] column.
+ *
+ * @param string $v new value
+ * @return void
+ */
+ public function setPluginFolder($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_folder !== $v) {
+ $this->plugin_folder = $v;
+ $this->modifiedColumns[] = PluginsRegistryPeer::PLUGIN_FOLDER;
+ }
+
+ } // 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.
+ *
+ * @param string $v new value
+ * @return void
+ */
+ public function setPluginVersion($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_version !== $v || $v === '') {
+ $this->plugin_version = $v;
+ $this->modifiedColumns[] = PluginsRegistryPeer::PLUGIN_VERSION;
+ }
+
+ } // setPluginVersion()
+
+ /**
+ * Set the value of [plugin_enable] column.
+ *
+ * @param boolean $v new value
+ * @return void
+ */
+ public function setPluginEnable($v)
+ {
+
+ if ($this->plugin_enable !== $v || $v === false) {
+ $this->plugin_enable = $v;
+ $this->modifiedColumns[] = PluginsRegistryPeer::PLUGIN_ENABLE;
+ }
+
+ } // setPluginEnable()
+
+ /**
+ * Set the value of [plugin_private] column.
+ *
+ * @param boolean $v new value
+ * @return void
+ */
+ public function setPluginPrivate($v)
+ {
+
+ if ($this->plugin_private !== $v || $v === false) {
+ $this->plugin_private = $v;
+ $this->modifiedColumns[] = PluginsRegistryPeer::PLUGIN_PRIVATE;
+ }
+
+ } // setPluginPrivate()
+
+ /**
+ * Set the value of [plugin_menus] column.
+ *
+ * @param string $v new value
+ * @return void
+ */
+ public function setPluginMenus($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_menus !== $v) {
+ $this->plugin_menus = $v;
+ $this->modifiedColumns[] = PluginsRegistryPeer::PLUGIN_MENUS;
+ }
+
+ } // setPluginMenus()
+
+ /**
+ * Set the value of [plugin_folders] column.
+ *
+ * @param string $v new value
+ * @return void
+ */
+ public function setPluginFolders($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_folders !== $v) {
+ $this->plugin_folders = $v;
+ $this->modifiedColumns[] = PluginsRegistryPeer::PLUGIN_FOLDERS;
+ }
+
+ } // setPluginFolders()
+
+ /**
+ * Set the value of [plugin_triggers] column.
+ *
+ * @param string $v new value
+ * @return void
+ */
+ public function setPluginTriggers($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_triggers !== $v) {
+ $this->plugin_triggers = $v;
+ $this->modifiedColumns[] = PluginsRegistryPeer::PLUGIN_TRIGGERS;
+ }
+
+ } // setPluginTriggers()
+
+ /**
+ * Set the value of [plugin_pm_functions] column.
+ *
+ * @param string $v new value
+ * @return void
+ */
+ public function setPluginPmFunctions($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_pm_functions !== $v) {
+ $this->plugin_pm_functions = $v;
+ $this->modifiedColumns[] = PluginsRegistryPeer::PLUGIN_PM_FUNCTIONS;
+ }
+
+ } // setPluginPmFunctions()
+
+ /**
+ * Set the value of [plugin_redirect_login] column.
+ *
+ * @param string $v new value
+ * @return void
+ */
+ public function setPluginRedirectLogin($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_redirect_login !== $v) {
+ $this->plugin_redirect_login = $v;
+ $this->modifiedColumns[] = PluginsRegistryPeer::PLUGIN_REDIRECT_LOGIN;
+ }
+
+ } // setPluginRedirectLogin()
+
+ /**
+ * Set the value of [plugin_steps] column.
+ *
+ * @param string $v new value
+ * @return void
+ */
+ public function setPluginSteps($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_steps !== $v) {
+ $this->plugin_steps = $v;
+ $this->modifiedColumns[] = PluginsRegistryPeer::PLUGIN_STEPS;
+ }
+
+ } // setPluginSteps()
+
+ /**
+ * Set the value of [plugin_css] column.
+ *
+ * @param string $v new value
+ * @return void
+ */
+ public function setPluginCss($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_css !== $v) {
+ $this->plugin_css = $v;
+ $this->modifiedColumns[] = PluginsRegistryPeer::PLUGIN_CSS;
+ }
+
+ } // setPluginCss()
+
+ /**
+ * Set the value of [plugin_js] column.
+ *
+ * @param string $v new value
+ * @return void
+ */
+ public function setPluginJs($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_js !== $v) {
+ $this->plugin_js = $v;
+ $this->modifiedColumns[] = PluginsRegistryPeer::PLUGIN_JS;
+ }
+
+ } // setPluginJs()
+
+ /**
+ * Set the value of [plugin_rest_service] column.
+ *
+ * @param string $v new value
+ * @return void
+ */
+ public function setPluginRestService($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_rest_service !== $v) {
+ $this->plugin_rest_service = $v;
+ $this->modifiedColumns[] = PluginsRegistryPeer::PLUGIN_REST_SERVICE;
+ }
+
+ } // setPluginRestService()
+
+ /**
+ * Set the value of [plugin_attributes] column.
+ *
+ * @param string $v new value
+ * @return void
+ */
+ public function setPluginAttributes($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_attributes !== $v) {
+ $this->plugin_attributes = $v;
+ $this->modifiedColumns[] = PluginsRegistryPeer::PLUGIN_ATTRIBUTES;
+ }
+
+ } // setPluginAttributes()
+
+ /**
+ * Hydrates (populates) the object variables with values from the database resultset.
+ *
+ * An offset (1-based "start column") is specified so that objects can be hydrated
+ * with a subset of the columns in the resultset rows. This is needed, for example,
+ * for results of JOIN queries where the resultset row includes columns from two or
+ * more tables.
+ *
+ * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos.
+ * @param int $startcol 1-based offset column which indicates which restultset column to start with.
+ * @return int next starting column
+ * @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
+ */
+ public function hydrate(ResultSet $rs, $startcol = 1)
+ {
+ try {
+
+ $this->id = $rs->getInt($startcol + 0);
+
+ $this->pr_uid = $rs->getString($startcol + 1);
+
+ $this->plugin_namespace = $rs->getString($startcol + 2);
+
+ $this->plugin_description = $rs->getString($startcol + 3);
+
+ $this->plugin_class_name = $rs->getString($startcol + 4);
+
+ $this->plugin_friendly_name = $rs->getString($startcol + 5);
+
+ $this->plugin_file = $rs->getString($startcol + 6);
+
+ $this->plugin_folder = $rs->getString($startcol + 7);
+
+ $this->plugin_setup_page = $rs->getString($startcol + 8);
+
+ $this->plugin_company_logo = $rs->getString($startcol + 9);
+
+ $this->plugin_workspaces = $rs->getString($startcol + 10);
+
+ $this->plugin_version = $rs->getString($startcol + 11);
+
+ $this->plugin_enable = $rs->getBoolean($startcol + 12);
+
+ $this->plugin_private = $rs->getBoolean($startcol + 13);
+
+ $this->plugin_menus = $rs->getString($startcol + 14);
+
+ $this->plugin_folders = $rs->getString($startcol + 15);
+
+ $this->plugin_triggers = $rs->getString($startcol + 16);
+
+ $this->plugin_pm_functions = $rs->getString($startcol + 17);
+
+ $this->plugin_redirect_login = $rs->getString($startcol + 18);
+
+ $this->plugin_steps = $rs->getString($startcol + 19);
+
+ $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 + 24; // 24 = PluginsRegistryPeer::NUM_COLUMNS - PluginsRegistryPeer::NUM_LAZY_LOAD_COLUMNS).
+
+ } catch (Exception $e) {
+ throw new PropelException("Error populating PluginsRegistry object", $e);
+ }
+ }
+
+ /**
+ * Removes this object from datastore and sets delete attribute.
+ *
+ * @param Connection $con
+ * @return void
+ * @throws PropelException
+ * @see BaseObject::setDeleted()
+ * @see BaseObject::isDeleted()
+ */
+ public function delete($con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("This object has already been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(PluginsRegistryPeer::DATABASE_NAME);
+ }
+
+ try {
+ $con->begin();
+ PluginsRegistryPeer::doDelete($this, $con);
+ $this->setDeleted(true);
+ $con->commit();
+ } catch (PropelException $e) {
+ $con->rollback();
+ throw $e;
+ }
+ }
+
+ /**
+ * Stores the object in the database. If the object is new,
+ * it inserts it; otherwise an update is performed. This method
+ * wraps the doSave() worker method in a transaction.
+ *
+ * @param Connection $con
+ * @return int The number of rows affected by this insert/update
+ * @throws PropelException
+ * @see doSave()
+ */
+ public function save($con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("You cannot save an object that has been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(PluginsRegistryPeer::DATABASE_NAME);
+ }
+
+ try {
+ $con->begin();
+ $affectedRows = $this->doSave($con);
+ $con->commit();
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollback();
+ throw $e;
+ }
+ }
+
+ /**
+ * Stores the object in the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All related objects are also updated in this method.
+ *
+ * @param Connection $con
+ * @return int The number of rows affected by this insert/update and any referring
+ * @throws PropelException
+ * @see save()
+ */
+ protected function doSave($con)
+ {
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ if (!$this->alreadyInSave) {
+ $this->alreadyInSave = true;
+
+
+ // If this object has been modified, then save it to the database.
+ if ($this->isModified()) {
+ if ($this->isNew()) {
+ $pk = PluginsRegistryPeer::doInsert($this, $con);
+ $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which
+ // should always be true here (even though technically
+ // BasePeer::doInsert() can insert multiple rows).
+
+ $this->setNew(false);
+ } else {
+ $affectedRows += PluginsRegistryPeer::doUpdate($this, $con);
+ }
+ $this->resetModified(); // [HL] After being saved an object is no longer 'modified'
+ }
+
+ $this->alreadyInSave = false;
+ }
+ return $affectedRows;
+ } // doSave()
+
+ /**
+ * Array of ValidationFailed objects.
+ * @var array ValidationFailed[]
+ */
+ protected $validationFailures = array();
+
+ /**
+ * Gets any ValidationFailed objects that resulted from last call to validate().
+ *
+ *
+ * @return array ValidationFailed[]
+ * @see validate()
+ */
+ public function getValidationFailures()
+ {
+ return $this->validationFailures;
+ }
+
+ /**
+ * Validates the objects modified field values and all objects related to this table.
+ *
+ * If $columns is either a column name or an array of column names
+ * only those columns are validated.
+ *
+ * @param mixed $columns Column name or an array of column names.
+ * @return boolean Whether all columns pass validation.
+ * @see doValidate()
+ * @see getValidationFailures()
+ */
+ public function validate($columns = null)
+ {
+ $res = $this->doValidate($columns);
+ if ($res === true) {
+ $this->validationFailures = array();
+ return true;
+ } else {
+ $this->validationFailures = $res;
+ return false;
+ }
+ }
+
+ /**
+ * This function performs the validation work for complex object models.
+ *
+ * In addition to checking the current object, all related objects will
+ * also be validated. If all pass then true is returned; otherwise
+ * an aggreagated array of ValidationFailed objects will be returned.
+ *
+ * @param array $columns Array of column names to validate.
+ * @return mixed true if all validations pass;
+ array of ValidationFailed objects otherwise.
+ */
+ protected function doValidate($columns = null)
+ {
+ if (!$this->alreadyInValidation) {
+ $this->alreadyInValidation = true;
+ $retval = null;
+
+ $failureMap = array();
+
+
+ if (($retval = PluginsRegistryPeer::doValidate($this, $columns)) !== true) {
+ $failureMap = array_merge($failureMap, $retval);
+ }
+
+
+
+ $this->alreadyInValidation = false;
+ }
+
+ return (!empty($failureMap) ? $failureMap : true);
+ }
+
+ /**
+ * Retrieves a field from the object by name passed in as a string.
+ *
+ * @param string $name name
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants TYPE_PHPNAME,
+ * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
+ * @return mixed Value of field.
+ */
+ public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = PluginsRegistryPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+ return $this->getByPosition($pos);
+ }
+
+ /**
+ * Retrieves a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @return mixed Value of field at $pos
+ */
+ public function getByPosition($pos)
+ {
+ switch($pos) {
+ case 0:
+ return $this->getId();
+ break;
+ case 1:
+ return $this->getPrUid();
+ break;
+ case 2:
+ return $this->getPluginNamespace();
+ break;
+ case 3:
+ return $this->getPluginDescription();
+ break;
+ case 4:
+ return $this->getPluginClassName();
+ break;
+ case 5:
+ return $this->getPluginFriendlyName();
+ break;
+ case 6:
+ return $this->getPluginFile();
+ break;
+ case 7:
+ return $this->getPluginFolder();
+ break;
+ case 8:
+ return $this->getPluginSetupPage();
+ break;
+ case 9:
+ return $this->getPluginCompanyLogo();
+ break;
+ case 10:
+ return $this->getPluginWorkspaces();
+ break;
+ case 11:
+ return $this->getPluginVersion();
+ break;
+ case 12:
+ return $this->getPluginEnable();
+ break;
+ case 13:
+ return $this->getPluginPrivate();
+ break;
+ case 14:
+ return $this->getPluginMenus();
+ break;
+ case 15:
+ return $this->getPluginFolders();
+ break;
+ case 16:
+ return $this->getPluginTriggers();
+ break;
+ case 17:
+ return $this->getPluginPmFunctions();
+ break;
+ case 18:
+ return $this->getPluginRedirectLogin();
+ break;
+ case 19:
+ 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:
+ return null;
+ break;
+ } // switch()
+ }
+
+ /**
+ * Exports the object as an array.
+ *
+ * You can specify the key type of the array by passing one of the class
+ * type constants.
+ *
+ * @param string $keyType One of the class type constants TYPE_PHPNAME,
+ * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
+ * @return an associative array containing the field names (as keys) and field values
+ */
+ public function toArray($keyType = BasePeer::TYPE_PHPNAME)
+ {
+ $keys = PluginsRegistryPeer::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getId(),
+ $keys[1] => $this->getPrUid(),
+ $keys[2] => $this->getPluginNamespace(),
+ $keys[3] => $this->getPluginDescription(),
+ $keys[4] => $this->getPluginClassName(),
+ $keys[5] => $this->getPluginFriendlyName(),
+ $keys[6] => $this->getPluginFile(),
+ $keys[7] => $this->getPluginFolder(),
+ $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;
+ }
+
+ /**
+ * Sets a field from the object by name passed in as a string.
+ *
+ * @param string $name peer name
+ * @param mixed $value field value
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants TYPE_PHPNAME,
+ * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
+ * @return void
+ */
+ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = PluginsRegistryPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+ return $this->setByPosition($pos, $value);
+ }
+
+ /**
+ * Sets a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @param mixed $value field value
+ * @return void
+ */
+ public function setByPosition($pos, $value)
+ {
+ switch($pos) {
+ case 0:
+ $this->setId($value);
+ break;
+ case 1:
+ $this->setPrUid($value);
+ break;
+ case 2:
+ $this->setPluginNamespace($value);
+ break;
+ case 3:
+ $this->setPluginDescription($value);
+ break;
+ case 4:
+ $this->setPluginClassName($value);
+ break;
+ case 5:
+ $this->setPluginFriendlyName($value);
+ break;
+ case 6:
+ $this->setPluginFile($value);
+ break;
+ case 7:
+ $this->setPluginFolder($value);
+ break;
+ case 8:
+ $this->setPluginSetupPage($value);
+ break;
+ case 9:
+ $this->setPluginCompanyLogo($value);
+ break;
+ case 10:
+ $this->setPluginWorkspaces($value);
+ break;
+ case 11:
+ $this->setPluginVersion($value);
+ break;
+ case 12:
+ $this->setPluginEnable($value);
+ break;
+ case 13:
+ $this->setPluginPrivate($value);
+ break;
+ case 14:
+ $this->setPluginMenus($value);
+ break;
+ case 15:
+ $this->setPluginFolders($value);
+ break;
+ case 16:
+ $this->setPluginTriggers($value);
+ break;
+ case 17:
+ $this->setPluginPmFunctions($value);
+ break;
+ case 18:
+ $this->setPluginRedirectLogin($value);
+ break;
+ case 19:
+ $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()
+ }
+
+ /**
+ * Populates the object using an array.
+ *
+ * This is particularly useful when populating an object from one of the
+ * request arrays (e.g. $_POST). This method goes through the column
+ * names, checking to see whether a matching key exists in populated
+ * array. If so the setByName() method is called for that column.
+ *
+ * You can specify the key type of the array by additionally passing one
+ * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME,
+ * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId')
+ *
+ * @param array $arr An array to populate the object from.
+ * @param string $keyType The type of keys the array uses.
+ * @return void
+ */
+ public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
+ {
+ $keys = PluginsRegistryPeer::getFieldNames($keyType);
+
+ if (array_key_exists($keys[0], $arr)) {
+ $this->setId($arr[$keys[0]]);
+ }
+
+ if (array_key_exists($keys[1], $arr)) {
+ $this->setPrUid($arr[$keys[1]]);
+ }
+
+ if (array_key_exists($keys[2], $arr)) {
+ $this->setPluginNamespace($arr[$keys[2]]);
+ }
+
+ if (array_key_exists($keys[3], $arr)) {
+ $this->setPluginDescription($arr[$keys[3]]);
+ }
+
+ if (array_key_exists($keys[4], $arr)) {
+ $this->setPluginClassName($arr[$keys[4]]);
+ }
+
+ if (array_key_exists($keys[5], $arr)) {
+ $this->setPluginFriendlyName($arr[$keys[5]]);
+ }
+
+ if (array_key_exists($keys[6], $arr)) {
+ $this->setPluginFile($arr[$keys[6]]);
+ }
+
+ if (array_key_exists($keys[7], $arr)) {
+ $this->setPluginFolder($arr[$keys[7]]);
+ }
+
+ if (array_key_exists($keys[8], $arr)) {
+ $this->setPluginSetupPage($arr[$keys[8]]);
+ }
+
+ if (array_key_exists($keys[9], $arr)) {
+ $this->setPluginCompanyLogo($arr[$keys[9]]);
+ }
+
+ if (array_key_exists($keys[10], $arr)) {
+ $this->setPluginWorkspaces($arr[$keys[10]]);
+ }
+
+ if (array_key_exists($keys[11], $arr)) {
+ $this->setPluginVersion($arr[$keys[11]]);
+ }
+
+ if (array_key_exists($keys[12], $arr)) {
+ $this->setPluginEnable($arr[$keys[12]]);
+ }
+
+ if (array_key_exists($keys[13], $arr)) {
+ $this->setPluginPrivate($arr[$keys[13]]);
+ }
+
+ if (array_key_exists($keys[14], $arr)) {
+ $this->setPluginMenus($arr[$keys[14]]);
+ }
+
+ if (array_key_exists($keys[15], $arr)) {
+ $this->setPluginFolders($arr[$keys[15]]);
+ }
+
+ if (array_key_exists($keys[16], $arr)) {
+ $this->setPluginTriggers($arr[$keys[16]]);
+ }
+
+ if (array_key_exists($keys[17], $arr)) {
+ $this->setPluginPmFunctions($arr[$keys[17]]);
+ }
+
+ if (array_key_exists($keys[18], $arr)) {
+ $this->setPluginRedirectLogin($arr[$keys[18]]);
+ }
+
+ if (array_key_exists($keys[19], $arr)) {
+ $this->setPluginSteps($arr[$keys[19]]);
+ }
+
+ if (array_key_exists($keys[20], $arr)) {
+ $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]]);
+ }
+
+ }
+
+ /**
+ * Build a Criteria object containing the values of all modified columns in this object.
+ *
+ * @return Criteria The Criteria object containing all modified values.
+ */
+ public function buildCriteria()
+ {
+ $criteria = new Criteria(PluginsRegistryPeer::DATABASE_NAME);
+
+ if ($this->isColumnModified(PluginsRegistryPeer::ID)) {
+ $criteria->add(PluginsRegistryPeer::ID, $this->id);
+ }
+
+ if ($this->isColumnModified(PluginsRegistryPeer::PR_UID)) {
+ $criteria->add(PluginsRegistryPeer::PR_UID, $this->pr_uid);
+ }
+
+ if ($this->isColumnModified(PluginsRegistryPeer::PLUGIN_NAMESPACE)) {
+ $criteria->add(PluginsRegistryPeer::PLUGIN_NAMESPACE, $this->plugin_namespace);
+ }
+
+ if ($this->isColumnModified(PluginsRegistryPeer::PLUGIN_DESCRIPTION)) {
+ $criteria->add(PluginsRegistryPeer::PLUGIN_DESCRIPTION, $this->plugin_description);
+ }
+
+ if ($this->isColumnModified(PluginsRegistryPeer::PLUGIN_CLASS_NAME)) {
+ $criteria->add(PluginsRegistryPeer::PLUGIN_CLASS_NAME, $this->plugin_class_name);
+ }
+
+ if ($this->isColumnModified(PluginsRegistryPeer::PLUGIN_FRIENDLY_NAME)) {
+ $criteria->add(PluginsRegistryPeer::PLUGIN_FRIENDLY_NAME, $this->plugin_friendly_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);
+ }
+
+ if ($this->isColumnModified(PluginsRegistryPeer::PLUGIN_ENABLE)) {
+ $criteria->add(PluginsRegistryPeer::PLUGIN_ENABLE, $this->plugin_enable);
+ }
+
+ if ($this->isColumnModified(PluginsRegistryPeer::PLUGIN_PRIVATE)) {
+ $criteria->add(PluginsRegistryPeer::PLUGIN_PRIVATE, $this->plugin_private);
+ }
+
+ if ($this->isColumnModified(PluginsRegistryPeer::PLUGIN_MENUS)) {
+ $criteria->add(PluginsRegistryPeer::PLUGIN_MENUS, $this->plugin_menus);
+ }
+
+ if ($this->isColumnModified(PluginsRegistryPeer::PLUGIN_FOLDERS)) {
+ $criteria->add(PluginsRegistryPeer::PLUGIN_FOLDERS, $this->plugin_folders);
+ }
+
+ if ($this->isColumnModified(PluginsRegistryPeer::PLUGIN_TRIGGERS)) {
+ $criteria->add(PluginsRegistryPeer::PLUGIN_TRIGGERS, $this->plugin_triggers);
+ }
+
+ if ($this->isColumnModified(PluginsRegistryPeer::PLUGIN_PM_FUNCTIONS)) {
+ $criteria->add(PluginsRegistryPeer::PLUGIN_PM_FUNCTIONS, $this->plugin_pm_functions);
+ }
+
+ if ($this->isColumnModified(PluginsRegistryPeer::PLUGIN_REDIRECT_LOGIN)) {
+ $criteria->add(PluginsRegistryPeer::PLUGIN_REDIRECT_LOGIN, $this->plugin_redirect_login);
+ }
+
+ if ($this->isColumnModified(PluginsRegistryPeer::PLUGIN_STEPS)) {
+ $criteria->add(PluginsRegistryPeer::PLUGIN_STEPS, $this->plugin_steps);
+ }
+
+ if ($this->isColumnModified(PluginsRegistryPeer::PLUGIN_CSS)) {
+ $criteria->add(PluginsRegistryPeer::PLUGIN_CSS, $this->plugin_css);
+ }
+
+ if ($this->isColumnModified(PluginsRegistryPeer::PLUGIN_JS)) {
+ $criteria->add(PluginsRegistryPeer::PLUGIN_JS, $this->plugin_js);
+ }
+
+ if ($this->isColumnModified(PluginsRegistryPeer::PLUGIN_REST_SERVICE)) {
+ $criteria->add(PluginsRegistryPeer::PLUGIN_REST_SERVICE, $this->plugin_rest_service);
+ }
+
+ if ($this->isColumnModified(PluginsRegistryPeer::PLUGIN_ATTRIBUTES)) {
+ $criteria->add(PluginsRegistryPeer::PLUGIN_ATTRIBUTES, $this->plugin_attributes);
+ }
+
+
+ return $criteria;
+ }
+
+ /**
+ * Builds a Criteria object containing the primary key for this object.
+ *
+ * Unlike buildCriteria() this method includes the primary key values regardless
+ * of whether or not they have been modified.
+ *
+ * @return Criteria The Criteria object containing value(s) for primary key(s).
+ */
+ public function buildPkeyCriteria()
+ {
+ $criteria = new Criteria(PluginsRegistryPeer::DATABASE_NAME);
+
+ $criteria->add(PluginsRegistryPeer::PR_UID, $this->pr_uid);
+
+ return $criteria;
+ }
+
+ /**
+ * Returns the primary key for this object (row).
+ * @return string
+ */
+ public function getPrimaryKey()
+ {
+ return $this->getPrUid();
+ }
+
+ /**
+ * Generic method to set the primary key (pr_uid column).
+ *
+ * @param string $key Primary key.
+ * @return void
+ */
+ public function setPrimaryKey($key)
+ {
+ $this->setPrUid($key);
+ }
+
+ /**
+ * Sets contents of passed object to values from current object.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param object $copyObj An object of PluginsRegistry (or compatible) type.
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @throws PropelException
+ */
+ public function copyInto($copyObj, $deepCopy = false)
+ {
+
+ $copyObj->setId($this->id);
+
+ $copyObj->setPluginNamespace($this->plugin_namespace);
+
+ $copyObj->setPluginDescription($this->plugin_description);
+
+ $copyObj->setPluginClassName($this->plugin_class_name);
+
+ $copyObj->setPluginFriendlyName($this->plugin_friendly_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);
+
+ $copyObj->setPluginPrivate($this->plugin_private);
+
+ $copyObj->setPluginMenus($this->plugin_menus);
+
+ $copyObj->setPluginFolders($this->plugin_folders);
+
+ $copyObj->setPluginTriggers($this->plugin_triggers);
+
+ $copyObj->setPluginPmFunctions($this->plugin_pm_functions);
+
+ $copyObj->setPluginRedirectLogin($this->plugin_redirect_login);
+
+ $copyObj->setPluginSteps($this->plugin_steps);
+
+ $copyObj->setPluginCss($this->plugin_css);
+
+ $copyObj->setPluginJs($this->plugin_js);
+
+ $copyObj->setPluginRestService($this->plugin_rest_service);
+
+ $copyObj->setPluginAttributes($this->plugin_attributes);
+
+
+ $copyObj->setNew(true);
+
+ $copyObj->setPrUid(''); // this is a pkey column, so set to default value
+
+ }
+
+ /**
+ * Makes a copy of this object that will be inserted as a new row in table when saved.
+ * It creates a new object filling in the simple attributes, but skipping any primary
+ * keys that are defined for the table.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @return PluginsRegistry Clone of current object.
+ * @throws PropelException
+ */
+ public function copy($deepCopy = false)
+ {
+ // we use get_class(), because this might be a subclass
+ $clazz = get_class($this);
+ $copyObj = new $clazz();
+ $this->copyInto($copyObj, $deepCopy);
+ return $copyObj;
+ }
+
+ /**
+ * Returns a peer instance associated with this om.
+ *
+ * Since Peer classes are not to have any instance attributes, this method returns the
+ * same instance for all member of this class. The method could therefore
+ * be static, but this would prevent one from overriding the behavior.
+ *
+ * @return PluginsRegistryPeer
+ */
+ public function getPeer()
+ {
+ if (self::$peer === null) {
+ self::$peer = new PluginsRegistryPeer();
+ }
+ return self::$peer;
+ }
+}
+
diff --git a/workflow/engine/classes/model/om/BasePluginsRegistryPeer.php b/workflow/engine/classes/model/om/BasePluginsRegistryPeer.php
new file mode 100644
index 000000000..9623cb3cb
--- /dev/null
+++ b/workflow/engine/classes/model/om/BasePluginsRegistryPeer.php
@@ -0,0 +1,682 @@
+ 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, )
+ );
+
+ /**
+ * holds an array of keys for quick access to the fieldnames array
+ *
+ * first dimension keys are the type constants
+ * 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, '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, )
+ );
+
+ /**
+ * @return MapBuilder the map builder for this peer
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function getMapBuilder()
+ {
+ include_once 'classes/model/map/PluginsRegistryMapBuilder.php';
+ return BasePeer::getMapBuilder('classes.model.map.PluginsRegistryMapBuilder');
+ }
+ /**
+ * Gets a map (hash) of PHP names to DB column names.
+ *
+ * @return array The PHP to DB name map for this peer
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ * @deprecated Use the getFieldNames() and translateFieldName() methods instead of this.
+ */
+ public static function getPhpNameMap()
+ {
+ if (self::$phpNameMap === null) {
+ $map = PluginsRegistryPeer::getTableMap();
+ $columns = $map->getColumns();
+ $nameMap = array();
+ foreach ($columns as $column) {
+ $nameMap[$column->getPhpName()] = $column->getColumnName();
+ }
+ self::$phpNameMap = $nameMap;
+ }
+ return self::$phpNameMap;
+ }
+ /**
+ * Translates a fieldname to another type
+ *
+ * @param string $name field name
+ * @param string $fromType One of the class type constants TYPE_PHPNAME,
+ * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
+ * @param string $toType One of the class type constants
+ * @return string translated name of the field.
+ */
+ static public function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = self::getFieldNames($toType);
+ $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null;
+ if ($key === null) {
+ throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true));
+ }
+ return $toNames[$key];
+ }
+
+ /**
+ * Returns an array of of field names.
+ *
+ * @param string $type The type of fieldnames to return:
+ * One of the class type constants TYPE_PHPNAME,
+ * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
+ * @return array A list of field names
+ */
+
+ static public function getFieldNames($type = BasePeer::TYPE_PHPNAME)
+ {
+ if (!array_key_exists($type, self::$fieldNames)) {
+ throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM. ' . $type . ' was given.');
+ }
+ return self::$fieldNames[$type];
+ }
+
+ /**
+ * Convenience method which changes table.column to alias.column.
+ *
+ * Using this method you can maintain SQL abstraction while using column aliases.
+ *
+ * $c->addAlias("alias1", TablePeer::TABLE_NAME);
+ * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
+ *
+ * @param string $alias The alias for the current table.
+ * @param string $column The column name for current table. (i.e. PluginsRegistryPeer::COLUMN_NAME).
+ * @return string
+ */
+ public static function alias($alias, $column)
+ {
+ return str_replace(PluginsRegistryPeer::TABLE_NAME.'.', $alias.'.', $column);
+ }
+
+ /**
+ * Add all the columns needed to create a new object.
+ *
+ * Note: any columns that were marked with lazyLoad="true" in the
+ * XML schema will not be added to the select list and only loaded
+ * on demand.
+ *
+ * @param criteria object containing the columns to add.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function addSelectColumns(Criteria $criteria)
+ {
+
+ $criteria->addSelectColumn(PluginsRegistryPeer::ID);
+
+ $criteria->addSelectColumn(PluginsRegistryPeer::PR_UID);
+
+ $criteria->addSelectColumn(PluginsRegistryPeer::PLUGIN_NAMESPACE);
+
+ $criteria->addSelectColumn(PluginsRegistryPeer::PLUGIN_DESCRIPTION);
+
+ $criteria->addSelectColumn(PluginsRegistryPeer::PLUGIN_CLASS_NAME);
+
+ $criteria->addSelectColumn(PluginsRegistryPeer::PLUGIN_FRIENDLY_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);
+
+ $criteria->addSelectColumn(PluginsRegistryPeer::PLUGIN_PRIVATE);
+
+ $criteria->addSelectColumn(PluginsRegistryPeer::PLUGIN_MENUS);
+
+ $criteria->addSelectColumn(PluginsRegistryPeer::PLUGIN_FOLDERS);
+
+ $criteria->addSelectColumn(PluginsRegistryPeer::PLUGIN_TRIGGERS);
+
+ $criteria->addSelectColumn(PluginsRegistryPeer::PLUGIN_PM_FUNCTIONS);
+
+ $criteria->addSelectColumn(PluginsRegistryPeer::PLUGIN_REDIRECT_LOGIN);
+
+ $criteria->addSelectColumn(PluginsRegistryPeer::PLUGIN_STEPS);
+
+ $criteria->addSelectColumn(PluginsRegistryPeer::PLUGIN_CSS);
+
+ $criteria->addSelectColumn(PluginsRegistryPeer::PLUGIN_JS);
+
+ $criteria->addSelectColumn(PluginsRegistryPeer::PLUGIN_REST_SERVICE);
+
+ $criteria->addSelectColumn(PluginsRegistryPeer::PLUGIN_ATTRIBUTES);
+
+ }
+
+ const COUNT = 'COUNT(PLUGINS_REGISTRY.PR_UID)';
+ const COUNT_DISTINCT = 'COUNT(DISTINCT PLUGINS_REGISTRY.PR_UID)';
+
+ /**
+ * Returns the number of rows matching criteria.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria).
+ * @param Connection $con
+ * @return int Number of matching rows.
+ */
+ public static function doCount(Criteria $criteria, $distinct = false, $con = null)
+ {
+ // we're going to modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // clear out anything that might confuse the ORDER BY clause
+ $criteria->clearSelectColumns()->clearOrderByColumns();
+ if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->addSelectColumn(PluginsRegistryPeer::COUNT_DISTINCT);
+ } else {
+ $criteria->addSelectColumn(PluginsRegistryPeer::COUNT);
+ }
+
+ // just in case we're grouping: add those columns to the select statement
+ foreach ($criteria->getGroupByColumns() as $column) {
+ $criteria->addSelectColumn($column);
+ }
+
+ $rs = PluginsRegistryPeer::doSelectRS($criteria, $con);
+ if ($rs->next()) {
+ return $rs->getInt(1);
+ } else {
+ // no rows returned; we infer that means 0 matches.
+ return 0;
+ }
+ }
+ /**
+ * Method to select one object from the DB.
+ *
+ * @param Criteria $criteria object used to create the SELECT statement.
+ * @param Connection $con
+ * @return PluginsRegistry
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectOne(Criteria $criteria, $con = null)
+ {
+ $critcopy = clone $criteria;
+ $critcopy->setLimit(1);
+ $objects = PluginsRegistryPeer::doSelect($critcopy, $con);
+ if ($objects) {
+ return $objects[0];
+ }
+ return null;
+ }
+ /**
+ * Method to do selects.
+ *
+ * @param Criteria $criteria The Criteria object used to build the SELECT statement.
+ * @param Connection $con
+ * @return array Array of selected Objects
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelect(Criteria $criteria, $con = null)
+ {
+ return PluginsRegistryPeer::populateObjects(PluginsRegistryPeer::doSelectRS($criteria, $con));
+ }
+ /**
+ * Prepares the Criteria object and uses the parent doSelect()
+ * method to get a ResultSet.
+ *
+ * Use this method directly if you want to just get the resultset
+ * (instead of an array of objects).
+ *
+ * @param Criteria $criteria The Criteria object used to build the SELECT statement.
+ * @param Connection $con the connection to use
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ * @return ResultSet The resultset object with numerically-indexed fields.
+ * @see BasePeer::doSelect()
+ */
+ public static function doSelectRS(Criteria $criteria, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+
+ if (!$criteria->getSelectColumns()) {
+ $criteria = clone $criteria;
+ PluginsRegistryPeer::addSelectColumns($criteria);
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ // BasePeer returns a Creole ResultSet, set to return
+ // rows indexed numerically.
+ return BasePeer::doSelect($criteria, $con);
+ }
+ /**
+ * The returned array will contain objects of the default type or
+ * objects that inherit from the default.
+ *
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function populateObjects(ResultSet $rs)
+ {
+ $results = array();
+
+ // set the class once to avoid overhead in the loop
+ $cls = PluginsRegistryPeer::getOMClass();
+ $cls = Propel::import($cls);
+ // populate the object(s)
+ while ($rs->next()) {
+
+ $obj = new $cls();
+ $obj->hydrate($rs);
+ $results[] = $obj;
+
+ }
+ return $results;
+ }
+ /**
+ * Returns the TableMap related to this peer.
+ * This method is not needed for general use but a specific application could have a need.
+ * @return TableMap
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function getTableMap()
+ {
+ return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME);
+ }
+
+ /**
+ * The class that the Peer will make instances of.
+ *
+ * This uses a dot-path notation which is tranalted into a path
+ * relative to a location on the PHP include_path.
+ * (e.g. path.to.MyClass -> 'path/to/MyClass.php')
+ *
+ * @return string path.to.ClassName
+ */
+ public static function getOMClass()
+ {
+ return PluginsRegistryPeer::CLASS_DEFAULT;
+ }
+
+ /**
+ * Method perform an INSERT on the database, given a PluginsRegistry or Criteria object.
+ *
+ * @param mixed $values Criteria or PluginsRegistry object containing data that is used to create the INSERT statement.
+ * @param Connection $con the connection to use
+ * @return mixed The new primary key.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doInsert($values, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+ } else {
+ $criteria = $values->buildCriteria(); // build Criteria from PluginsRegistry object
+ }
+
+
+ // Set the correct dbName
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table (I guess, conceivably)
+ $con->begin();
+ $pk = BasePeer::doInsert($criteria, $con);
+ $con->commit();
+ } catch (PropelException $e) {
+ $con->rollback();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+ /**
+ * Method perform an UPDATE on the database, given a PluginsRegistry or Criteria object.
+ *
+ * @param mixed $values Criteria or PluginsRegistry object containing data create the UPDATE statement.
+ * @param Connection $con The connection to use (specify Connection exert more control over transactions).
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doUpdate($values, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+
+ $selectCriteria = new Criteria(self::DATABASE_NAME);
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+
+ $comparison = $criteria->getComparison(PluginsRegistryPeer::PR_UID);
+ $selectCriteria->add(PluginsRegistryPeer::PR_UID, $criteria->remove(PluginsRegistryPeer::PR_UID), $comparison);
+
+ } else {
+ $criteria = $values->buildCriteria(); // gets full criteria
+ $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
+ }
+
+ // set the correct dbName
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+ /**
+ * Method to DELETE all rows from the PLUGINS_REGISTRY table.
+ *
+ * @return int The number of affected rows (if supported by underlying database driver).
+ */
+ public static function doDeleteAll($con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table or we could emulating ON DELETE CASCADE, etc.
+ $con->begin();
+ $affectedRows += BasePeer::doDeleteAll(PluginsRegistryPeer::TABLE_NAME, $con);
+ $con->commit();
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollback();
+ throw $e;
+ }
+ }
+
+ /**
+ * Method perform a DELETE on the database, given a PluginsRegistry or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or PluginsRegistry object or primary key or array of primary keys
+ * which is used to create the DELETE statement
+ * @param Connection $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * This includes CASCADE-related rows
+ * if supported by native driver or if emulated using Propel.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doDelete($values, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(PluginsRegistryPeer::DATABASE_NAME);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+ } elseif ($values instanceof PluginsRegistry) {
+
+ $criteria = $values->buildPkeyCriteria();
+ } else {
+ // it must be the primary key
+ $criteria = new Criteria(self::DATABASE_NAME);
+ $criteria->add(PluginsRegistryPeer::PR_UID, (array) $values, Criteria::IN);
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ $affectedRows = 0; // initialize var to track total num of affected rows
+
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table or we could emulating ON DELETE CASCADE, etc.
+ $con->begin();
+
+ $affectedRows += BasePeer::doDelete($criteria, $con);
+ $con->commit();
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollback();
+ throw $e;
+ }
+ }
+
+ /**
+ * Validates all modified columns of given PluginsRegistry object.
+ * If parameter $columns is either a single column name or an array of column names
+ * than only those columns are validated.
+ *
+ * NOTICE: This does not apply to primary or foreign keys for now.
+ *
+ * @param PluginsRegistry $obj The object to validate.
+ * @param mixed $cols Column name or array of column names.
+ *
+ * @return mixed TRUE if all columns are valid or the error message of the first invalid column.
+ */
+ public static function doValidate(PluginsRegistry $obj, $cols = null)
+ {
+ $columns = array();
+
+ if ($cols) {
+ $dbMap = Propel::getDatabaseMap(PluginsRegistryPeer::DATABASE_NAME);
+ $tableMap = $dbMap->getTable(PluginsRegistryPeer::TABLE_NAME);
+
+ if (! is_array($cols)) {
+ $cols = array($cols);
+ }
+
+ foreach ($cols as $colName) {
+ if ($tableMap->containsColumn($colName)) {
+ $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
+ $columns[$colName] = $obj->$get();
+ }
+ }
+ } else {
+
+ }
+
+ return BasePeer::doValidate(PluginsRegistryPeer::DATABASE_NAME, PluginsRegistryPeer::TABLE_NAME, $columns);
+ }
+
+ /**
+ * Retrieve a single object by pkey.
+ *
+ * @param mixed $pk the primary key.
+ * @param Connection $con the connection to use
+ * @return PluginsRegistry
+ */
+ public static function retrieveByPK($pk, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+
+ $criteria = new Criteria(PluginsRegistryPeer::DATABASE_NAME);
+
+ $criteria->add(PluginsRegistryPeer::PR_UID, $pk);
+
+
+ $v = PluginsRegistryPeer::doSelect($criteria, $con);
+
+ return !empty($v) > 0 ? $v[0] : null;
+ }
+
+ /**
+ * Retrieve multiple objects by pkey.
+ *
+ * @param array $pks List of primary keys
+ * @param Connection $con the connection to use
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function retrieveByPKs($pks, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+
+ $objs = null;
+ if (empty($pks)) {
+ $objs = array();
+ } else {
+ $criteria = new Criteria();
+ $criteria->add(PluginsRegistryPeer::PR_UID, $pks, Criteria::IN);
+ $objs = PluginsRegistryPeer::doSelect($criteria, $con);
+ }
+ return $objs;
+ }
+}
+
+
+// static code to register the map builder for this Peer with the main Propel class
+if (Propel::isInit()) {
+ // the MapBuilder classes register themselves with Propel during initialization
+ // so we need to load them here.
+ try {
+ BasePluginsRegistryPeer::getMapBuilder();
+ } catch (Exception $e) {
+ Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR);
+ }
+} else {
+ // even if Propel is not yet initialized, the map builder class can be registered
+ // now and then it will be loaded when Propel initializes.
+ require_once 'classes/model/map/PluginsRegistryMapBuilder.php';
+ Propel::registerMapBuilder('classes.model.map.PluginsRegistryMapBuilder');
+}
+
diff --git a/workflow/engine/config/schema.xml b/workflow/engine/config/schema.xml
index b43bbc225..19cd4e063 100644
--- a/workflow/engine/config/schema.xml
+++ b/workflow/engine/config/schema.xml
@@ -5639,4 +5639,35 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
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 2aa238393..4255bd3df 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 )) {
@@ -472,8 +474,8 @@ class Main extends Controller
$sWspaceSelect = trim( $aFotoSelect['WORKSPACE_LOGO_NAME'] );
}
}
- if (class_exists( 'PMPluginRegistry' )) {
- $oPluginRegistry = &PMPluginRegistry::getSingleton();
+ if (class_exists( 'ProcessMaker\Plugins\PluginRegistry' )) {
+ $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 16ee7a532..ec7cbdb2b 100644
--- a/workflow/engine/data/mysql/schema.sql
+++ b/workflow/engine/data/mysql/schema.sql
@@ -3144,5 +3144,41 @@ CREATE TABLE `NOTIFICATION_QUEUE`
PRIMARY KEY (`NOT_UID`),
KEY `indexNotStatus`(`NOT_STATUS`)
)ENGINE=InnoDB ;
+#-----------------------------------------------------------------------------
+#-- PLUGINS_REGISTRY
+#-----------------------------------------------------------------------------
+
+DROP TABLE IF EXISTS `PLUGINS_REGISTRY`;
+
+
+CREATE TABLE `PLUGINS_REGISTRY`
+(
+ `ID` INTEGER NOT NULL AUTO_INCREMENT,
+ `PR_UID` VARCHAR(32) default '' NOT NULL,
+ `PLUGIN_NAMESPACE` VARCHAR(100) NOT NULL,
+ `PLUGIN_DESCRIPTION` VARCHAR(200) default '',
+ `PLUGIN_CLASS_NAME` VARCHAR(100) NOT NULL,
+ `PLUGIN_FRIENDLY_NAME` VARCHAR(150) default '',
+ `PLUGIN_FILE` VARCHAR(250) NOT NULL,
+ `PLUGIN_FOLDER` VARCHAR(100) 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,
+ `PLUGIN_MENUS` MEDIUMTEXT,
+ `PLUGIN_FOLDERS` MEDIUMTEXT,
+ `PLUGIN_TRIGGERS` MEDIUMTEXT,
+ `PLUGIN_PM_FUNCTIONS` MEDIUMTEXT,
+ `PLUGIN_REDIRECT_LOGIN` MEDIUMTEXT,
+ `PLUGIN_STEPS` MEDIUMTEXT,
+ `PLUGIN_CSS` MEDIUMTEXT,
+ `PLUGIN_JS` MEDIUMTEXT,
+ `PLUGIN_REST_SERVICE` MEDIUMTEXT,
+ `PLUGIN_ATTRIBUTES` MEDIUMTEXT,
+ PRIMARY KEY (`PR_UID`),
+ UNIQUE KEY `INDEX_PLUGINS_REGISTRY_ID` (`ID`)
+)ENGINE=InnoDB ;
# This restores the fkey checks, after having unset them earlier
SET FOREIGN_KEY_CHECKS = 1;
diff --git a/workflow/engine/menus/cases.php b/workflow/engine/menus/cases.php
index 098b1619b..a5d7d8eff 100644
--- a/workflow/engine/menus/cases.php
+++ b/workflow/engine/menus/cases.php
@@ -22,7 +22,12 @@
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
+
+use ProcessMaker\Plugins\PluginRegistry;
+
+/** @var RBAC $RBAC */
global $RBAC;
+/** @var Menu $G_TMP_MENU */
global $G_TMP_MENU;
$G_TMP_MENU->AddIdRawOption('FOLDERS', '', G::LoadTranslation('ID_CASES_MENU_FOLDERS'), '', '', 'blockHeader');
@@ -48,10 +53,6 @@ $G_TMP_MENU->AddIdRawOption('CASES_SELFSERVICE', 'casesListExtJs?action=selfserv
$G_TMP_MENU->AddIdRawOption('CASES_PAUSED', 'casesListExtJs?action=paused', G::LoadTranslation('ID_PAUSED'),
'mail-queue.png');
-if ($RBAC->userCanAccess('PM_ALLCASES') == 1) {
- //$G_TMP_MENU->AddIdRawOption('CASES_GRAL', 'casesListExtJs?action=gral', G::LoadTranslation('ID_GENERAL'));
-}
-
$G_TMP_MENU->AddIdRawOption('SEARCHS', '', G::LoadTranslation('ID_CASES_MENU_SEARCH'), '', '', 'blockHeader');
if ($RBAC->userCanAccess('PM_ALLCASES') == 1) {
@@ -77,14 +78,15 @@ if ($RBAC->userCanAccess('PM_FOLDERS_VIEW') == 1) {
//Load Other registered Dashboards (From plugins)
-$oPluginRegistry = & PMPluginRegistry::getSingleton ();
+$oPluginRegistry = PluginRegistry::loadSingleton();
+/** @var \ProcessMaker\Plugins\Interfaces\DashboardPage[] $dashBoardPages */
$dashBoardPages = $oPluginRegistry->getDashboardPages ();
if (count($dashBoardPages)>0) {
$G_TMP_MENU->AddIdRawOption('PLUGINS', '', G::LoadTranslation('ID_PLUGINS'), '', '', 'blockHeader');
foreach ($dashBoardPages as $key => $tabInfo) {
- $tabNameSpace=$tabInfo->sNamespace;
- $tabName=$tabInfo->sName;
- $tabIcon=str_replace("ICON_","",$tabInfo->sIcon);
+ $tabNameSpace=$tabInfo->getNamespace();
+ $tabName=$tabInfo->getName();
+ $tabIcon=str_replace("ICON_","",$tabInfo->getIcon());
if ($tabName!= "") {
$G_TMP_MENU->AddIdRawOption($tabIcon, 'casesStartPage?action='.$tabNameSpace.'-'.$tabName,
ucwords(strtolower($tabName)), '');
diff --git a/workflow/engine/menus/setup.php b/workflow/engine/menus/setup.php
index a9952367e..989248d22 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();
$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 23b8ffeeb..6c7d1a1e7 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);
@@ -1621,7 +1623,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 cff4b68e5..70a6487df 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;
@@ -178,7 +180,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 );
@@ -186,7 +188,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 c910a8e0e..7b296b7e5 100644
--- a/workflow/engine/methods/cases/cases_Step.php
+++ b/workflow/engine/methods/cases/cases_Step.php
@@ -1,4 +1,7 @@
xssRegexFilter(
@@ -386,7 +389,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']) );
@@ -395,18 +398,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']) {
@@ -458,7 +449,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']) );
@@ -650,7 +641,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 );
@@ -667,7 +658,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' );
@@ -722,7 +713,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";
@@ -1144,7 +1135,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 11697c771..a42344f79 100644
--- a/workflow/engine/methods/enterprise/addonsStoreAction.php
+++ b/workflow/engine/methods/enterprise/addonsStoreAction.php
@@ -4,6 +4,8 @@ require_once PATH_CORE . 'classes' . PATH_SEP . 'class.pmLicenseManager.php';
require_once PATH_CORE . 'methods' . PATH_SEP . 'enterprise' . PATH_SEP . 'enterprise.php';
require_once PATH_CORE . 'classes' . PATH_SEP . 'model' . PATH_SEP . 'AddonsManagerPeer.php';
+use ProcessMaker\Plugins\PluginRegistry;
+
function runBgProcessmaker($task, $log)
{
require_once (PATH_CORE . "bin/tasks/cliAddons.php");
@@ -79,39 +81,15 @@ try {
BasePeer::doUpdate($oCriteriaSelect, $oCriteriaUpdate, $cnn);
- ///////
- //$licenseManager = &pmLicenseManager::getSingleton();
-
- //plugin.singleton //are all the plugins that are enabled in the SYS_SYS
- $pluginRegistry = &PMPluginRegistry::getSingleton();
-
- $arrayAddon = array();
-
- //ee //all plugins enterprise installed in /processmaker/workflow/engine/plugins (no matter if they are enabled/disabled)
- if (file_exists(PATH_DATA_SITE . "ee")) {
- $arrayAddon = unserialize(trim(file_get_contents(PATH_DATA_SITE . "ee")));
- }
-
- foreach ($arrayAddon as $addon) {
- $sFileName = substr($addon["sFilename"], 0, strpos($addon["sFilename"], "-"));
-
- if (file_exists(PATH_PLUGINS . $sFileName . ".php")) {
- $addonDetails = $pluginRegistry->getPluginDetails($sFileName . ".php");
- $enabled = 0;
-
- if ($addonDetails) {
- $enabled = ($addonDetails->enabled)? 1 : 0;
- }
-
- if ($enabled == 1 && !in_array($sFileName, $licenseManager->features)) {
- require_once (PATH_PLUGINS . $sFileName . ".php");
-
- $pluginRegistry->disablePlugin($sFileName);
- }
+ //are all the plugins that are enabled in the workspace
+ $pluginRegistry = PluginRegistry::loadSingleton();
+ /** @var \ProcessMaker\Plugins\Interfaces\PluginDetail $plugin */
+ foreach ($pluginRegistry->getAllPluginsDetails() as $plugin) {
+ if ($plugin->isEnabled() && !in_array($plugin->getNamespace(), $licenseManager->features)) {
+ $pluginRegistry->disablePlugin($plugin->getNamespace());
+ $pluginRegistry->savePlugin($plugin->getNamespace());
}
}
-
- file_put_contents(PATH_DATA_SITE . "plugin.singleton", $pluginRegistry->serializeInstance());
}
}
break;
@@ -207,10 +185,6 @@ try {
break;
}
- //$logContents = file_get_contents("$log.log", false, NULL, 0, 10);
- //if (!empty($logContents))
- // break;
-
$retries += 1;
if ($retries > $max_retries) {
@@ -219,11 +193,6 @@ try {
}
}
- //if ($failed) {
- // //$addon->clearState(); //clearState no found
- // $result["success"] = false;
- //}
-
$result["status"] = "OK";
} catch (Exception $e) {
$result["message"] = $e->getMessage();
@@ -355,4 +324,3 @@ try {
))
);
}
-
diff --git a/workflow/engine/methods/enterprise/enterprise.php b/workflow/engine/methods/enterprise/enterprise.php
index e859b3a9f..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());
}
@@ -117,11 +119,11 @@ class enterprisePlugin extends PMPlugin
public function setup()
{
- if (!file_exists(PATH_DATA_SITE . "plugin.singleton")) {
- $pluginRegistry = &PMPluginRegistry::getSingleton();
+ if (!PluginsRegistryPeer::retrieveByPK(md5('enterprise'))) {
+ $pluginRegistry = PluginRegistry::loadSingleton();
$pluginDetail = $pluginRegistry->getPluginDetails("enterprise.php");
- $pluginRegistry->enablePlugin($pluginDetail->sNamespace);
- file_put_contents(PATH_DATA_SITE . "plugin.singleton", $pluginRegistry->serializeInstance());
+ $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..59e700ac1 100644
--- a/workflow/engine/methods/enterprise/pluginsSetup.php
+++ b/workflow/engine/methods/enterprise/pluginsSetup.php
@@ -1,11 +1,14 @@
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 +26,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..02df8f7a8 100644
--- a/workflow/engine/methods/install/autoinstallPlugins.php
+++ b/workflow/engine/methods/install/autoinstallPlugins.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;
+
$inst = new PmInstaller();
$oProcess = new Processes();
@@ -57,7 +60,7 @@ foreach ($availablePlugins as $filename) {
}
//print "change to ENABLED";
- $oPluginRegistry = & PMPluginRegistry::getSingleton();
+ $oPluginRegistry = PluginRegistry::loadSingleton();
$pluginFile = $sClassName . '.php';
if (! file_exists( PATH_PLUGINS . $sClassName . '.php' )) {
@@ -67,10 +70,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..a17e2739d 100644
--- a/workflow/engine/methods/login/changePassword.php
+++ b/workflow/engine/methods/login/changePassword.php
@@ -1,4 +1,7 @@
load($_SESSION['USER_LOGGED']);
@@ -50,15 +53,19 @@ if (class_exists('redirectDetail')) {
if (isset($RBAC->aUserInfo['PROCESSMAKER']['ROLE']['ROL_CODE'])) {
$userRole = $RBAC->aUserInfo['PROCESSMAKER']['ROLE']['ROL_CODE'];
}
- $oPluginRegistry = &PMPluginRegistry::getSingleton();
+ $oPluginRegistry = 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 68007ef7e..26e4dcdab 100644
--- a/workflow/engine/methods/login/licenseUpdate.php
+++ b/workflow/engine/methods/login/licenseUpdate.php
@@ -1,5 +1,7 @@
getPluginDetails($sFileName . ".php");
- $enabled = 0;
-
- if ($addonDetails) {
- $enabled = ($addonDetails->enabled)? 1 : 0;
- }
-
- if ($enabled == 1 && !in_array($sFileName, $licenseManager->features)) {
- require_once (PATH_PLUGINS . $sFileName . ".php");
-
- $pluginRegistry->disablePlugin($sFileName);
- }
+ //are all the plugins that are enabled in the workspace
+ $pluginRegistry = PluginRegistry::loadSingleton();
+ /** @var \ProcessMaker\Plugins\Interfaces\PluginDetail $plugin */
+ foreach ($pluginRegistry->getAllPluginsDetails() as $plugin) {
+ if ($plugin->isEnabled() && !in_array($plugin->getNamespace(), $licenseManager->features)) {
+ $pluginRegistry->disablePlugin($plugin->getNamespace());
+ $pluginRegistry->savePlugin($plugin->getNamespace());
}
}
- file_put_contents(PATH_DATA_SITE . "plugin.singleton", $pluginRegistry->serializeInstance());
G::SendTemporalMessage('ID_NLIC', 'info');
} else {
G::SendTemporalMessage('ID_WARNING_ENTERPRISE_LICENSE_MSG', 'warning');
diff --git a/workflow/engine/methods/login/login.php b/workflow/engine/methods/login/login.php
index 80e7e6efb..ab16993d0 100644
--- a/workflow/engine/methods/login/login.php
+++ b/workflow/engine/methods/login/login.php
@@ -22,6 +22,9 @@
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
+
+use ProcessMaker\Plugins\PluginRegistry;
+
/*----------------------------------********---------------------------------*/
//Browser Compatibility
$browserSupported = G::checkBrowserCompatibility();
@@ -122,7 +125,7 @@ if (isset ($_SESSION['USER_LOGGED'])) {
}
} else {
// Execute SSO trigger
- $pluginRegistry =& PMPluginRegistry::getSingleton();
+ $pluginRegistry = 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..a7957d8a8 100644
--- a/workflow/engine/methods/mails/emailList.php
+++ b/workflow/engine/methods/mails/emailList.php
@@ -23,6 +23,9 @@
*/
global $RBAC;
+
+use ProcessMaker\Plugins\PluginRegistry;
+
$resultRbac = $RBAC->requirePermissions('PM_SETUP_ADVANCE', 'PM_SETUP_LOGS');
if (!$resultRbac) {
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
@@ -47,9 +50,8 @@ $status = array(
array("pending", G::LoadTranslation('ID_PENDING'))
);
-$pluginRegistry = PMPluginRegistry::getSingleton();
-$statusER = $pluginRegistry->getStatusPlugin('externalRegistration');
-$flagER = (preg_match('/^enabled$/', $statusER))? 1 : 0;
+$pluginRegistry = 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 5b88d963b..62bdcd467 100644
--- a/workflow/engine/methods/mails/emailsAjax.php
+++ b/workflow/engine/methods/mails/emailsAjax.php
@@ -1,5 +1,6 @@
getStatusPlugin('externalRegistration');
-
- $flagEr = (preg_match('/^enabled$/', $statusEr)) ? 1 : 0;
+ $pluginRegistry = 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..33dc497b0 100644
--- a/workflow/engine/methods/processes/processes_New.php
+++ b/workflow/engine/methods/processes/processes_New.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;
+
$access = $RBAC->userCanAccess( 'PM_FACTORY' );
if ($access != 1) {
switch ($access) {
@@ -43,7 +46,7 @@ if ($access != 1) {
}
//call plugins
-$oPluginRegistry = & PMPluginRegistry::getSingleton();
+$oPluginRegistry = 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..c6f8d58a3 100644
--- a/workflow/engine/methods/processes/processes_Save.php
+++ b/workflow/engine/methods/processes/processes_Save.php
@@ -29,6 +29,8 @@
+use ProcessMaker\Plugins\PluginRegistry;
+
$function = isset( $_POST['function'] ) ? $_POST['function'] : '';
$infoProcess = new Process();
$resultProcessOld = $infoProcess->load($_POST['form']['PRO_UID']);
@@ -68,7 +70,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 = 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..ae304517a 100644
--- a/workflow/engine/methods/reports/reportsList.php
+++ b/workflow/engine/methods/reports/reportsList.php
@@ -22,6 +22,9 @@
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
global $RBAC;
+
+use ProcessMaker\Plugins\PluginRegistry;
+
switch ($RBAC->userCanAccess( 'PM_REPORTS' )) {
case - 2:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
@@ -74,7 +77,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 = 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..470ce0724 100644
--- a/workflow/engine/methods/reports/reports_View.php
+++ b/workflow/engine/methods/reports/reports_View.php
@@ -22,6 +22,8 @@
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
+use ProcessMaker\Plugins\PluginRegistry;
+
/**
* Report - Report view
*
@@ -210,7 +212,7 @@ try {
break;
default:
$foundReport = false;
- $oPluginRegistry = &PMPluginRegistry::getSingleton();
+ $oPluginRegistry = 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..63c85e798 100644
--- a/workflow/engine/methods/services/upload.php
+++ b/workflow/engine/methods/services/upload.php
@@ -22,6 +22,8 @@
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
+use ProcessMaker\Plugins\PluginRegistry;
+
/**
* @Updated Dec 14, 2009 by Erik
*
@@ -138,7 +140,7 @@ if (isset( $_FILES ) && $_FILES["ATTACH_FILE"]["error"] == 0) {
//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 );
@@ -146,7 +148,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 281a3b13c..df188b24f 100644
--- a/workflow/engine/methods/setup/pluginsChange.php
+++ b/workflow/engine/methods/setup/pluginsChange.php
@@ -23,6 +23,8 @@
*/
// lets display the items
+use ProcessMaker\Plugins\PluginRegistry;
+
$pluginFile = $_GET['id'];
$pluginStatus = $_GET['status'];
@@ -32,36 +34,38 @@ $filter = new InputFilter();
$path = PATH_PLUGINS . $pluginFile;
$path = $filter->validateInput($path, 'path');
-$oPluginRegistry = & PMPluginRegistry::getSingleton();
-
-if ($handle = opendir( PATH_PLUGINS )) {
- while (false !== ($file = readdir( $handle ))) {
- if (strpos( $file, '.php', 1 ) && $file == $pluginFile) {
+$oPluginRegistry = 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";
- $details = $oPluginRegistry->getPluginDetails( $pluginFile );
- $oPluginRegistry->disablePlugin( $details->sNamespace );
- $size = file_put_contents( PATH_DATA_SITE . 'plugin.singleton', $oPluginRegistry->serializeInstance() );
- G::auditLog("DisablePlugin", "Plugin Name: ".$details->sNamespace);
- //print "size saved : $size
";
+ // change to disable
+ $details = $oPluginRegistry->getPluginDetails($pluginFile);
+ $oPluginRegistry->disablePlugin($details->getNamespace());
+ $oPluginRegistry->savePlugin($details->getNamespace());
+ G::auditLog("DisablePlugin", "Plugin Name: " . $details->getNamespace());
} else {
$pluginName = str_replace(".php", "", $pluginFile);
if (is_file(PATH_PLUGINS . $pluginName . ".php") && is_dir(PATH_PLUGINS . $pluginName)) {
/*----------------------------------********---------------------------------*/
if (!$oPluginRegistry->isEnterprisePlugin($pluginName) &&
- PMLicensedFeatures::getSingleton()->verifyfeature('B0oWlBLY3hHdWY0YUNpZEtFQm5CeTJhQlIwN3IxMEkwaG4=')
+ PMLicensedFeatures::getSingleton()
+ ->verifyfeature('B0oWlBLY3hHdWY0YUNpZEtFQm5CeTJhQlIwN3IxMEkwaG4=')
) {
//Check disabled code
$cs = new CodeScanner(SYS_SYS);
- $arrayFoundDisabledCode = array_merge($cs->checkDisabledCode("FILE", PATH_PLUGINS . $pluginName . ".php"), $cs->checkDisabledCode("PATH", PATH_PLUGINS . $pluginName));
+ $arrayFoundDisabledCode = array_merge(
+ $cs->checkDisabledCode("FILE", PATH_PLUGINS . $pluginName . ".php"),
+ $cs->checkDisabledCode("PATH", PATH_PLUGINS . $pluginName)
+ );
if (!empty($arrayFoundDisabledCode)) {
$response = array();
- $response["status"] = "DISABLED-CODE";
+ $response["status"] = "DISABLED-CODE";
$response["message"] = G::LoadTranslation("ID_DISABLED_CODE_PLUGIN");
echo G::json_encode($response);
@@ -70,21 +74,16 @@ 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
- $size = file_put_contents(PATH_DATA_SITE . "plugin.singleton", $oPluginRegistry->serializeInstance());
- G::auditLog("EnablePlugin", "Plugin Name: " . $details->sNamespace);
- //print "size saved : $size
";
+ $oPluginRegistry->savePlugin($details->getNamespace());
+ G::auditLog("EnablePlugin", "Plugin Name: " . $details->getNamespace());
}
}
}
}
- closedir( $handle );
+ closedir($handle);
}
-
- //$oPluginRegistry->showArrays();
- //G::Header('location: pluginsList');
-
diff --git a/workflow/engine/methods/setup/pluginsImport.php b/workflow/engine/methods/setup/pluginsImport.php
index fccc47671..df2d3798e 100644
--- a/workflow/engine/methods/setup/pluginsImport.php
+++ b/workflow/engine/methods/setup/pluginsImport.php
@@ -22,6 +22,9 @@
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
global $RBAC;
+
+use ProcessMaker\Plugins\PluginRegistry;
+
$access = $RBAC->userCanAccess( 'PM_SETUP_ADVANCE' );
if ($access != 1) {
switch ($access) {
@@ -43,7 +46,7 @@ if ($access != 1) {
}
}
-$oPluginRegistry = & PMPluginRegistry::getSingleton();
+$oPluginRegistry = 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 9822338dc..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 = & PMPluginRegistry::getSingleton();
+ $oPluginRegistry = PluginRegistry::loadSingleton();
$pluginFile = $sClassName . '.php';
if ($bMainFile && $bClassFile) {
@@ -323,17 +322,16 @@ try {
require_once (PATH_PLUGINS . $pluginFile);
$oPluginRegistry->registerPlugin( $sClassName, PATH_PLUGINS . $sClassName . ".php" );
- $size = file_put_contents( PATH_DATA_SITE . "plugin.singleton", $oPluginRegistry->serializeInstance() );
$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());
- $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/pluginsMain.php b/workflow/engine/methods/setup/pluginsMain.php
index 666b68c85..8848fb917 100644
--- a/workflow/engine/methods/setup/pluginsMain.php
+++ b/workflow/engine/methods/setup/pluginsMain.php
@@ -21,6 +21,10 @@
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
+
+use ProcessMaker\Plugins\PluginRegistry;
+
+/** @var RBAC $RBAC */
global $RBAC;
$RBAC->requirePermissions( 'PM_SETUP' );
@@ -29,7 +33,7 @@ $headPublisher->addExtJsScript( 'setup/pluginsMain', false );
$headPublisher->assign( "PROCESSMAKER_URL", "/sys" . SYS_SYS . "/" . SYS_LANG . "/" . SYS_SKIN );
$headPublisher->assign( "SYS_SKIN", SYS_SKIN );
-$oPluginRegistry = &PMPluginRegistry::getSingleton();
+$oPluginRegistry = PluginRegistry::loadSingleton();
if ($oPluginRegistry->getStatusPlugin('pmWorkspaceManagement') && $oPluginRegistry->getStatusPlugin('pmWorkspaceManagement') == "enabled") {
$headPublisher = $oPluginRegistry->executeMethod('pmWorkspaceManagement', 'disableButtonsPluginMain', $headPublisher);
}
diff --git a/workflow/engine/methods/setup/pluginsRemove.php b/workflow/engine/methods/setup/pluginsRemove.php
index 3f049586a..d70841448 100644
--- a/workflow/engine/methods/setup/pluginsRemove.php
+++ b/workflow/engine/methods/setup/pluginsRemove.php
@@ -22,33 +22,15 @@
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
-/*
-global $RBAC;
-switch ($RBAC->userCanAccess('PM_SETUP_ADVANCE'))
-{
- case -2:
- G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels');
- G::header('location: ../login/login');
- die;
- break;
- case -1:
- G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
- G::header('location: ../login/login');
- die;
- break;
-}*/
+use ProcessMaker\Plugins\PluginRegistry;
$filter = new InputFilter();
$pluginName = $_REQUEST['pluginUid'];
$pluginName = $filter->xssFilterHard($pluginName);
-if (file_exists( PATH_PLUGINS . $pluginName . '.php' )) {
- $pluginRegistry = &PMPluginRegistry::getSingleton();
+$pluginRegistry = PluginRegistry::loadSingleton();
+$pluginRegistry->uninstallPlugin($pluginName);
- $pluginRegistry->uninstallPlugin( $pluginName );
- $path = $filter->validateInput(PATH_DATA_SITE . 'plugin.singleton', 'path');
- $pluginRegistry->unSerializeInstance( file_get_contents( $path ) );
-}
-G::auditLog('RemovePlugin','Plugin Name: '.$pluginName);
-echo $pluginName . ' ' . nl2br( $filter->xssFilterHard(G::LoadTranslation( 'ID_MSG_REMOVE_PLUGIN_SUCCESS' )) );
+G::auditLog('RemovePlugin', 'Plugin Name: ' . $pluginName);
+echo $pluginName . ' ' . nl2br($filter->xssFilterHard(G::LoadTranslation('ID_MSG_REMOVE_PLUGIN_SUCCESS')));
diff --git a/workflow/engine/methods/setup/pluginsSetup.php b/workflow/engine/methods/setup/pluginsSetup.php
index cf5bb3210..5de8150ed 100644
--- a/workflow/engine/methods/setup/pluginsSetup.php
+++ b/workflow/engine/methods/setup/pluginsSetup.php
@@ -22,12 +22,15 @@
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
+use ProcessMaker\Plugins\PluginRegistry;
+
$pluginFile = $_GET['id'];
-$oPluginRegistry = & PMPluginRegistry::getSingleton();
+$oPluginRegistry = 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 +48,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..783a6c562 100644
--- a/workflow/engine/methods/setup/pluginsSetupSave.php
+++ b/workflow/engine/methods/setup/pluginsSetupSave.php
@@ -22,13 +22,15 @@
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
+use ProcessMaker\Plugins\PluginRegistry;
+
$pluginFile = $_GET['id'];
-$oPluginRegistry = & PMPluginRegistry::getSingleton();
+$oPluginRegistry = 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..e4c4fd89f 100644
--- a/workflow/engine/methods/tracker/tracker_Ajax.php
+++ b/workflow/engine/methods/tracker/tracker_Ajax.php
@@ -1,462 +1,464 @@
-.
- *
- * 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.
+ */
+
+use ProcessMaker\Plugins\PluginRegistry;
+
+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 = 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/plugins/charts.php b/workflow/engine/plugins/charts.php
index 383abd1ac..cd6002cad 100644
--- a/workflow/engine/plugins/charts.php
+++ b/workflow/engine/plugins/charts.php
@@ -11,6 +11,7 @@
$this->sSetupPage = 'setupPage';
$this->aWorkspaces = array ( );
$this->iVersion = 0.45;
+ $this->bPrivate = true;
return $res;
}
diff --git a/workflow/engine/skinEngine/skinEngine.php b/workflow/engine/skinEngine/skinEngine.php
index 99de33590..a6f40fc90 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
@@ -449,8 +451,8 @@ class SkinEngine
$smarty->assign('tpl_menu', PATH_TEMPLATE . 'menu.html');
$smarty->assign('tpl_submenu', PATH_TEMPLATE . 'submenu.html');
- if (class_exists('PMPluginRegistry')) {
- $oPluginRegistry = &PMPluginRegistry::getSingleton();
+ if (class_exists('ProcessMaker\Plugins\PluginRegistry')) {
+ $oPluginRegistry = PluginRegistry::loadSingleton();
$sCompanyLogo = $oPluginRegistry->getCompanyLogo('/images/processmaker.logo.jpg');
}
else {
@@ -533,8 +535,8 @@ class SkinEngine
$smarty->assign('tpl_menu', PATH_TEMPLATE . 'menu.html' );
$smarty->assign('tpl_submenu', PATH_TEMPLATE . 'submenu.html' );
- if (class_exists('PMPluginRegistry')) {
- $oPluginRegistry = &PMPluginRegistry::getSingleton();
+ if (class_exists('ProcessMaker\Plugins\PluginRegistry')) {
+ $oPluginRegistry = PluginRegistry::loadSingleton();
$sCompanyLogo = $oPluginRegistry->getCompanyLogo ( '/images/processmaker.logo.jpg' );
}
else
@@ -790,8 +792,8 @@ class SkinEngine
$sWspaceSelect = trim($aFotoSelect['WORKSPACE_LOGO_NAME']);
}
}
- if (class_exists('PMPluginRegistry')) {
- $oPluginRegistry = &PMPluginRegistry::getSingleton();
+ if (class_exists('ProcessMaker\Plugins\PluginRegistry') && defined("SYS_SYS")) {
+ $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 92e2f312a..9b1bd7efc 100644
--- a/workflow/engine/src/ProcessMaker/BusinessModel/Cases.php
+++ b/workflow/engine/src/ProcessMaker/BusinessModel/Cases.php
@@ -5,6 +5,7 @@ use G;
use UsersPeer;
use CasesPeer;
use AppDelegation;
+use ProcessMaker\Plugins\PluginRegistry;
use Exception;
use wsBase;
use RBAC;
@@ -1108,12 +1109,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);
@@ -1406,12 +1406,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 f8cb963e6..d378b0765 100644
--- a/workflow/engine/src/ProcessMaker/BusinessModel/Process.php
+++ b/workflow/engine/src/ProcessMaker/BusinessModel/Process.php
@@ -795,16 +795,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 10bb88b1b..f9dbd8328 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 fc321d74b..764165637 100644
--- a/workflow/engine/src/ProcessMaker/BusinessModel/User.php
+++ b/workflow/engine/src/ProcessMaker/BusinessModel/User.php
@@ -22,7 +22,7 @@ use IsoLocationPeer;
use IsoSubdivisionPeer;
use ListParticipatedLast;
use PMmemcached;
-use PMPluginRegistry;
+use ProcessMaker\Plugins\PluginRegistry;
use ProcessMaker\Util\DateTime;
use ProcessMaker\Util\System;
use Propel;
@@ -869,8 +869,8 @@ class User
public function createUser($userData)
{
$this->userObj = new RbacUsers();
- if (class_exists('PMPluginRegistry')) {
- $pluginRegistry = &PMPluginRegistry::getSingleton();
+ if (class_exists('ProcessMaker\Plugins\PluginRegistry')) {
+ $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
new file mode 100644
index 000000000..97118e7c0
--- /dev/null
+++ b/workflow/engine/src/ProcessMaker/Plugins/Adapters/PluginAdapter.php
@@ -0,0 +1,241 @@
+ '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',
+ ];
+
+ /**
+ * Map the fields of the table with their type
+ * @var array $attributes
+ */
+ 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'],
+ ];
+
+ /**
+ * 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 getAttributes()
+ {
+ return $this->attributes;
+ }
+
+ /**
+ * Migrate the singleton plugin to tables
+ * @param PMPluginRegistry $PMPluginsSingleton
+ */
+ public function migrate($PMPluginsSingleton)
+ {
+ $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);
+ }
+ }
+
+ /**
+ * Change to new key property $keyNames
+ * @return mixed
+ */
+ private function parserNameKey()
+ {
+ $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]);
+ }
+ }
+ }
+ }
+ }
+ $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)
+ ) {
+ $newStructurePlugin[$propertyName][] = $plugin;
+ } elseif (is_array($plugin) &&
+ array_key_exists('pluginName', $plugin) &&
+ $plugin['pluginName'] == $Namespace
+ ) {
+ $newStructurePlugin[$propertyName][] = $plugin;
+ } elseif (!is_int($key) && $key == $Namespace) {
+ $newStructurePlugin[$propertyName][$key] = $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
new file mode 100644
index 000000000..147b19613
--- /dev/null
+++ b/workflow/engine/src/ProcessMaker/Plugins/Interfaces/CaseSchedulerPlugin.php
@@ -0,0 +1,114 @@
+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
new file mode 100644
index 000000000..bce110c6d
--- /dev/null
+++ b/workflow/engine/src/ProcessMaker/Plugins/Interfaces/CronFile.php
@@ -0,0 +1,56 @@
+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
new file mode 100644
index 000000000..43af9de4e
--- /dev/null
+++ b/workflow/engine/src/ProcessMaker/Plugins/Interfaces/CssFile.php
@@ -0,0 +1,66 @@
+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
new file mode 100644
index 000000000..d4c9d7c0c
--- /dev/null
+++ b/workflow/engine/src/ProcessMaker/Plugins/Interfaces/DashboardPage.php
@@ -0,0 +1,126 @@
+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
new file mode 100644
index 000000000..a3c1c8368
--- /dev/null
+++ b/workflow/engine/src/ProcessMaker/Plugins/Interfaces/FolderDetail.php
@@ -0,0 +1,86 @@
+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
new file mode 100644
index 000000000..96091b613
--- /dev/null
+++ b/workflow/engine/src/ProcessMaker/Plugins/Interfaces/ImportCallBack.php
@@ -0,0 +1,79 @@
+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
new file mode 100644
index 000000000..1e8fff7bd
--- /dev/null
+++ b/workflow/engine/src/ProcessMaker/Plugins/Interfaces/MenuDetail.php
@@ -0,0 +1,68 @@
+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
new file mode 100644
index 000000000..4936efd8d
--- /dev/null
+++ b/workflow/engine/src/ProcessMaker/Plugins/Interfaces/OpenReassignCallback.php
@@ -0,0 +1,52 @@
+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
new file mode 100644
index 000000000..0c1b893d8
--- /dev/null
+++ b/workflow/engine/src/ProcessMaker/Plugins/Interfaces/PluginDetail.php
@@ -0,0 +1,301 @@
+sNamespace = $sNamespace;
+ $this->sDescription = $sDescription;
+ $this->sClassName = $sClassName;
+ $this->sFriendlyName = $sFriendlyName;
+ $this->sFilename = $sFilename;
+ $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/RedirectDetail.php b/workflow/engine/src/ProcessMaker/Plugins/Interfaces/RedirectDetail.php
new file mode 100644
index 000000000..b16ae01d3
--- /dev/null
+++ b/workflow/engine/src/ProcessMaker/Plugins/Interfaces/RedirectDetail.php
@@ -0,0 +1,78 @@
+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
new file mode 100644
index 000000000..c87b0a095
--- /dev/null
+++ b/workflow/engine/src/ProcessMaker/Plugins/Interfaces/StepDetail.php
@@ -0,0 +1,102 @@
+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
new file mode 100644
index 000000000..e1289079c
--- /dev/null
+++ b/workflow/engine/src/ProcessMaker/Plugins/Interfaces/TaskExtendedProperty.php
@@ -0,0 +1,108 @@
+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
new file mode 100644
index 000000000..d270cfd5f
--- /dev/null
+++ b/workflow/engine/src/ProcessMaker/Plugins/Interfaces/ToolbarDetail.php
@@ -0,0 +1,68 @@
+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
new file mode 100644
index 000000000..30c4bb4c5
--- /dev/null
+++ b/workflow/engine/src/ProcessMaker/Plugins/Interfaces/TriggerDetail.php
@@ -0,0 +1,68 @@
+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..10604028a
--- /dev/null
+++ b/workflow/engine/src/ProcessMaker/Plugins/PluginRegistry.php
@@ -0,0 +1,1691 @@
+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;
+ }
+
+ /**
+ * Load the singleton instance from a serialized stored file
+ * @return PluginRegistry
+ * @throws Exception
+ */
+ public static function newInstance()
+ {
+ self::$instance = new PluginRegistry();
+ if (! is_object(self::$instance) || get_class(self::$instance) != "ProcessMaker\Plugins\PluginRegistry") {
+ throw new Exception("Can't load main PluginRegistry object.");
+ }
+ 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)");
+ }
+ }
+
+ /**
+ * @param $Namespace
+ * @return bool
+ */
+ public function checkFilePlugin($Namespace)
+ {
+ if (is_file(PATH_PLUGINS . $Namespace . ".php") && is_dir(PATH_PLUGINS . $Namespace)) {
+ require_once(PATH_PLUGINS . $Namespace . ".php");
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * 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)
+ {
+ $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 = PmSystem::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)
+ {
+ /** @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()]->getClassName(), 0, 1) .
+ str_replace(
+ 'plugin',
+ 'class',
+ substr($this->_aPluginDetails[$trigger->getNamespace()]->getClassName(), 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()) != '' && $detail->isEnabled()) {
+ $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;
+ }
+
+ /**
+ * Register a dashboard plugin to be served by processmaker
+ */
+ 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 (PmSystem::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;
+ }
+
+ /**
+ * Return all plugins
+ * @return array
+ */
+ 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/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 @@
+_aPluginDetails;
+ }
+
+ /**
+ * Get information of all Plugins
+ * @return array
+ */
+ public function getPlugins()
+ {
+ return $this->_aPlugins;
+ }
+
+ /**
+ * Ser information of all Plugins
+ * @param array $plugins
+ */
+ public function setPlugins($plugins)
+ {
+ $this->_aPlugins = $plugins;
+ }
+
+ /**
+ * Builds the Plugin structure based on its classes
+ */
+ private function constructStructure()
+ {
+ $Plugins = PluginsRegistry::loadPlugins(BasePeer::TYPE_PHPNAME);
+ foreach ($Plugins as $plugin) {
+ $this->_aPluginDetails[$plugin['PluginNamespace']] = $this->buildPluginDetails($plugin);
+ if ($plugin['PluginEnable']) {
+ $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']));
+ }
+ }
+ }
+
+ /**
+ * 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 $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 $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 $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 $pmFunction) {
+ $this->_aPmFunctions = array_merge($this->_aPmFunctions, [$pmFunction]);
+ }
+ }
+
+ /**
+ * Build the class RedirectDetail
+ * @param array $redirectLogin
+ */
+ private function buildRedirectLogin($redirectLogin)
+ {
+ $response = [];
+ foreach ($redirectLogin as $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 $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 $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 $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)
+ {
+ $this->_restServices = array_merge($this->_restServices, $restServices);
+ }
+
+ /**
+ * 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}, (array)$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($Plugin, $PluginDetails->getAttributes());
+ foreach ($PluginRegistry as $propertyName => $propertyValue) {
+ foreach ($propertyValue as $key => $plugin) {
+ if (is_object($plugin) &&
+ property_exists($plugin, 'Namespace') && $plugin->equalNamespaceTo($Namespace)
+ ) {
+ $newStructurePlugin[$propertyName][] = $plugin;
+ } elseif (is_object($plugin) &&
+ property_exists($plugin, 'pluginName') &&
+ $plugin->pluginName == $Namespace
+ ) {
+ $newStructurePlugin[$propertyName][] = $plugin;
+ } elseif (is_string($key) && $key == $Namespace) {
+ $newStructurePlugin[$propertyName][$key] = $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/src/ProcessMaker/Util/System.php b/workflow/engine/src/ProcessMaker/Util/System.php
index c01a86b89..f9863f741 100644
--- a/workflow/engine/src/ProcessMaker/Util/System.php
+++ b/workflow/engine/src/ProcessMaker/Util/System.php
@@ -2,9 +2,16 @@
namespace ProcessMaker\Util;
-use \ProcessMaker\Services\OAuth2\PmPdo;
-use \ProcessMaker\Services\OAuth2\Server;
-use \OAuth2\Request;
+use Bootstrap;
+use Exception;
+use Maveriks\Util\ClassLoader;
+use PMPlugin;
+use ProcessMaker\Plugins\Interfaces\PluginDetail;
+use ProcessMaker\Plugins\PluginRegistry;
+use ProcessMaker\Services\OAuth2\PmPdo;
+use ProcessMaker\Services\OAuth2\Server;
+use OAuth2\Request;
+use Propel;
class System
{
@@ -14,7 +21,7 @@ class System
* Get Time Zone
*
* @return string Return Time Zone
- * @throws \Exception
+ * @throws Exception
*/
public static function getTimeZone()
{
@@ -23,7 +30,7 @@ class System
//Return
return $arraySystemConfiguration['time_zone'];
- } catch (\Exception $e) {
+ } catch (Exception $e) {
throw $e;
}
}
@@ -37,26 +44,28 @@ class System
{
try {
//Update singleton file by workspace
- \Bootstrap::setConstantsRelatedWs($workspace->name);
- $pathSingleton = PATH_DATA . "sites" . PATH_SEP . $workspace->name . PATH_SEP . "plugin.singleton";
- $oPluginRegistry = \PMPluginRegistry::loadSingleton($pathSingleton);
- $items = \PMPlugin::getListAllPlugins($workspace->name);
+ Bootstrap::setConstantsRelatedWs($workspace->name);
+ Propel::init(PATH_CORE . "config/databases.php");
+ $oPluginRegistry = PluginRegistry::loadSingleton();
+ $items = PMPlugin::getListAllPlugins($workspace->name);
+ /** @var PluginDetail $item */
foreach ($items as $item) {
- if ($item->enabled === true) {
- require_once($item->sFilename);
- $details = $oPluginRegistry->getPluginDetails(basename($item->sFilename));
+ if ($item->isEnabled()) {
+ require_once($item->getFile());
+ /** @var PluginDetail $details */
+ $details = $oPluginRegistry->getPluginDetails(basename($item->getFile()));
//Only if the API directory structure is defined
- $pathApiDirectory = PATH_PLUGINS . $details->sPluginFolder . PATH_SEP . "src" . PATH_SEP . "Services" . PATH_SEP . "Api";
+ $pathApiDirectory = PATH_PLUGINS . $details->getFolder() . PATH_SEP . "src" . PATH_SEP . "Services" . PATH_SEP . "Api";
if (is_dir($pathApiDirectory)) {
- $pluginSrcDir = PATH_PLUGINS . $details->sNamespace . PATH_SEP . 'src';
- $loader = \Maveriks\Util\ClassLoader::getInstance();
+ $pluginSrcDir = PATH_PLUGINS . $details->getNamespace() . PATH_SEP . 'src';
+ $loader = ClassLoader::getInstance();
$loader->add($pluginSrcDir);
- $oPluginRegistry->registerRestService($details->sNamespace);
- if (class_exists($details->sClassName)) {
- $oPlugin = new $details->sClassName($details->sNamespace, $details->sFilename);
+ $oPluginRegistry->registerRestService($details->getNamespace());
+ $className = $details->getClassName();
+ if (class_exists($className)) {
+ $oPlugin = new $className($details->getNamespace(), $details->getFile());
$oPlugin->setup();
}
- file_put_contents($pathSingleton, $oPluginRegistry->serializeInstance());
}
}
}
@@ -71,8 +80,8 @@ class System
if (file_exists($workspace->path . '/routes.php')) {
unlink($workspace->path . '/routes.php');
}
- } catch (\Exception $e) {
- throw new \Exception("Error: cannot perform this task. " . $e->getMessage());
+ } catch (Exception $e) {
+ throw new Exception("Error: cannot perform this task. " . $e->getMessage());
}
}
@@ -87,7 +96,7 @@ class System
$authCode = self::getAuthorizationCodeUserLogged($client);
- $loader = \Maveriks\Util\ClassLoader::getInstance();
+ $loader = ClassLoader::getInstance();
$loader->add(PATH_TRUNK . 'vendor/bshaffer/oauth2-server-php/src/', "OAuth2");
$request = array(
@@ -117,7 +126,7 @@ class System
* Get client credentials
* @return array
*/
- protected function getClientCredentials()
+ protected static function getClientCredentials()
{
$oauthQuery = new PmPdo(self::getDsn());
return $oauthQuery->getClientDetails(self::CLIENT_ID);
@@ -127,7 +136,7 @@ class System
* Get DNS of workspace
* @return array
*/
- protected function getDsn()
+ protected static function getDsn()
{
list($host, $port) = strpos(DB_HOST, ':') !== false ? explode(':', DB_HOST) : array(DB_HOST, '');
$port = empty($port) ? '' : ";port=$port";
@@ -141,7 +150,7 @@ class System
* @param $client
* @return bool|string
*/
- protected function getAuthorizationCodeUserLogged($client)
+ protected static function getAuthorizationCodeUserLogged($client)
{
Server::setDatabaseSource(self::getDsn());
Server::setPmClientId($client['CLIENT_ID']);
diff --git a/workflow/engine/templates/cases/cases_StepsTree.php b/workflow/engine/templates/cases/cases_StepsTree.php
index a99489c96..c64aa0f7b 100644
--- a/workflow/engine/templates/cases/cases_StepsTree.php
+++ b/workflow/engine/templates/cases/cases_StepsTree.php
@@ -23,12 +23,14 @@
*
*/
+use ProcessMaker\Plugins\PluginRegistry;
+
$c = new Criteria();
$c->add ( StepPeer::PRO_UID, $_SESSION['PROCESS'] );
$c->add ( StepPeer::TAS_UID, $_SESSION['TASK'] );
$c->addAscendingOrderByColumn ( StepPeer::STEP_POSITION );
- $oPluginRegistry = &PMPluginRegistry::getSingleton();
+ $oPluginRegistry = PluginRegistry::loadSingleton();
$externalSteps = $oPluginRegistry->getSteps();
$oTree = new Tree();
@@ -70,11 +72,12 @@
$sType = $oDocument->getInpDocFormNeeded(); break;
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;
+ $oPluginRegistry = PluginRegistry::loadSingleton();
+ /** @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 ) ) {
@@ -184,11 +187,12 @@
break;
case 'EXTERNAL':
$aActions = array ('action' => 'label' );
- $oPluginRegistry = &PMPluginRegistry::getSingleton ();
+ $oPluginRegistry = PluginRegistry::loadSingleton();
+ /** @var \ProcessMaker\Plugins\Interfaces\StepDetail $val */
foreach ( $externalSteps as $key=>$val ) {
- if ( $val->sStepId == $aRow->getStepUidObj() ) {
- $stepTitle = $val->sStepTitle; //default title
- $sNamespace = $val->sNamespace;
+ 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..1fe564249 100644
--- a/workflow/engine/templates/steps/triggers_Tree.php
+++ b/workflow/engine/templates/steps/triggers_Tree.php
@@ -23,10 +23,12 @@
*
*/
+use ProcessMaker\Plugins\PluginRegistry;
+
try {
//call plugin
- $oPluginRegistry = &PMPluginRegistry::getSingleton();
+ $oPluginRegistry = PluginRegistry::loadSingleton();
$externalSteps = $oPluginRegistry->getSteps();
$oProcessMap = new ProcessMap();
@@ -64,9 +66,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..ac472e9e5 100644
--- a/workflow/public_html/bootstrap.php
+++ b/workflow/public_html/bootstrap.php
@@ -23,6 +23,8 @@
*
*/
+use ProcessMaker\Plugins\PluginRegistry;
+
/**
* sysGeneric - ProcessMaker Bootstrap
* this file is used initialize main variables, redirect and dispatch all requests
@@ -419,12 +421,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 = 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 0b07f9f67..37608bb78 100644
--- a/workflow/public_html/sysGeneric.php
+++ b/workflow/public_html/sysGeneric.php
@@ -23,6 +23,7 @@
*/
use Illuminate\Foundation\Http\Kernel;
+use ProcessMaker\Plugins\PluginRegistry;
/**
* bootstrap - ProcessMaker Bootstrap
@@ -651,17 +652,6 @@ $memcache = & PMmemcached::getSingleton( SYS_SYS );
// load Plugins base class
-//here we are loading all plugins registered
-//the singleton has a list of enabled plugins
-$sSerializedFile = PATH_DATA_SITE . 'plugin.singleton';
-
-if (file_exists( $sSerializedFile )) {
- $oPluginRegistry = PMPluginRegistry::loadSingleton($sSerializedFile);
- $attributes = $oPluginRegistry->getAttributes();
- Bootstrap::LoadTranslationPlugins( defined( 'SYS_LANG' ) ? SYS_LANG : "en" , $attributes);
-} else{
- $oPluginRegistry = PMPluginRegistry::getSingleton();
-}
// setup propel definitions and logging
//changed to autoloader
@@ -700,6 +690,12 @@ if (defined( 'DEBUG_SQL_LOG' ) && DEBUG_SQL_LOG) {
Propel::init( PATH_CORE . "config/databases.php" );
}
+//here we are loading all plugins registered
+//the singleton has a list of enabled plugins
+$oPluginRegistry = PluginRegistry::loadSingleton();
+$attributes = $oPluginRegistry->getAttributes();
+Bootstrap::LoadTranslationPlugins( defined( 'SYS_LANG' ) ? SYS_LANG : "en" , $attributes);
+
//Set Time Zone
/*----------------------------------********---------------------------------*/
$_SESSION['__SYSTEM_UTC_TIME_ZONE__'] = (int)($config['system_utc_time_zone']) == 1;