CODE STYLE Format
Change format
This commit is contained in:
@@ -1,28 +1,29 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|
||||||
G::LoadSystem( 'dbMaintenance' );
|
G::LoadSystem( 'dbMaintenance' );
|
||||||
G::LoadClass( "cli" );
|
G::LoadClass( "cli" );
|
||||||
|
|
||||||
/** Class MultipleFilesBackup
|
/**
|
||||||
|
* Class MultipleFilesBackup
|
||||||
* create a backup of this workspace
|
* create a backup of this workspace
|
||||||
*
|
*
|
||||||
* Exports the database and copies the files to an tar archive o several if the max filesize is reached.
|
* Exports the database and copies the files to an tar archive o several if the max filesize is reached.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
class multipleFilesBackup{
|
class multipleFilesBackup
|
||||||
|
{
|
||||||
private $dir_to_compress = "";
|
private $dir_to_compress = "";
|
||||||
private $filename = "backUpProcessMaker.tar";
|
private $filename = "backUpProcessMaker.tar";
|
||||||
private $fileSize = "1000"; // 1 GB by default.
|
private $fileSize = "1000";
|
||||||
private $sizeDescriptor = "m"; //megabytes
|
// 1 GB by default.
|
||||||
|
private $sizeDescriptor = "m";
|
||||||
|
//megabytes
|
||||||
private $tempDirectories = array ();
|
private $tempDirectories = array ();
|
||||||
|
|
||||||
/* Constructor
|
/* Constructor
|
||||||
* @filename contains the path and filename of the comppress file(s).
|
* @filename contains the path and filename of the comppress file(s).
|
||||||
* @size got the Max size of the compressed files, by default if the $size less to zero will mantains 1000 Mb as Max size.
|
* @size got the Max size of the compressed files, by default if the $size less to zero will mantains 1000 Mb as Max size.
|
||||||
*/
|
*/
|
||||||
function multipleFilesBackup($filename,$size)
|
public function multipleFilesBackup ($filename, $size)
|
||||||
{
|
{
|
||||||
if (! empty( $filename )) {
|
if (! empty( $filename )) {
|
||||||
$this->filename = $filename;
|
$this->filename = $filename;
|
||||||
@@ -31,6 +32,7 @@ class multipleFilesBackup{
|
|||||||
$this->fileSize = $size;
|
$this->fileSize = $size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Gets workspace information enough to make its backup.
|
/* Gets workspace information enough to make its backup.
|
||||||
* @workspace contains the workspace to be add to the commpression process.
|
* @workspace contains the workspace to be add to the commpression process.
|
||||||
*/
|
*/
|
||||||
@@ -53,9 +55,7 @@ class multipleFilesBackup{
|
|||||||
$metadata["directories"] = array ("{$workspace->name}.files");
|
$metadata["directories"] = array ("{$workspace->name}.files");
|
||||||
$metadata["version"] = 1;
|
$metadata["version"] = 1;
|
||||||
$metaFilename = "$tempDirectory/{$workspace->name}.meta";
|
$metaFilename = "$tempDirectory/{$workspace->name}.meta";
|
||||||
if (!file_put_contents($metaFilename,
|
if (! file_put_contents( $metaFilename, str_replace( array (",","{","}"), array (",\n ","{\n ","\n}\n"), G::json_encode( $metadata ) ) )) {
|
||||||
str_replace(array(",", "{", "}"), array(",\n ", "{\n ", "\n}\n"),
|
|
||||||
G::json_encode($metadata)))) {
|
|
||||||
CLI::logging( "Could not create backup metadata" );
|
CLI::logging( "Could not create backup metadata" );
|
||||||
}
|
}
|
||||||
CLI::logging( "Adding database to backup...\n" );
|
CLI::logging( "Adding database to backup...\n" );
|
||||||
@@ -75,8 +75,8 @@ class multipleFilesBackup{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Commpress the DB and files into a single or several files with numerical series extentions
|
// Commpress the DB and files into a single or several files with numerical series extentions
|
||||||
*/
|
|
||||||
public function letsBackup ()
|
public function letsBackup ()
|
||||||
{
|
{
|
||||||
// creating command
|
// creating command
|
||||||
@@ -89,8 +89,7 @@ class multipleFilesBackup{
|
|||||||
//executing command to create the files
|
//executing command to create the files
|
||||||
echo exec( $CommpressCommand );
|
echo exec( $CommpressCommand );
|
||||||
//Remove leftovers dirs.
|
//Remove leftovers dirs.
|
||||||
foreach($this->tempDirectories as $tempDirectory)
|
foreach ($this->tempDirectories as $tempDirectory) {
|
||||||
{
|
|
||||||
CLI::logging( "Deleting: " . $tempDirectory . "\n" );
|
CLI::logging( "Deleting: " . $tempDirectory . "\n" );
|
||||||
G::rm_dir( $tempDirectory );
|
G::rm_dir( $tempDirectory );
|
||||||
}
|
}
|
||||||
@@ -101,12 +100,11 @@ class multipleFilesBackup{
|
|||||||
* @ dstWorkspace contains the workspace to be overwriting.
|
* @ dstWorkspace contains the workspace to be overwriting.
|
||||||
* @ overwrite got the option true if the workspace will be overwrite.
|
* @ overwrite got the option true if the workspace will be overwrite.
|
||||||
*/
|
*/
|
||||||
static public function letsRestore($filename, $srcWorkspace, $dstWorkspace = NULL, $overwrite = true)
|
static public function letsRestore ($filename, $srcWorkspace, $dstWorkspace = null, $overwrite = true)
|
||||||
{
|
{
|
||||||
// Needed info:
|
// Needed info:
|
||||||
// TEMPDIR /shared/workflow_data/upgrade/
|
// TEMPDIR /shared/workflow_data/upgrade/
|
||||||
// BACKUPS /shared/workflow_data/backups/
|
// BACKUPS /shared/workflow_data/backups/
|
||||||
|
|
||||||
// Creating command cat myfiles_split.tgz_* | tar xz
|
// Creating command cat myfiles_split.tgz_* | tar xz
|
||||||
$DecommpressCommand = "cat " . $filename . ".* ";
|
$DecommpressCommand = "cat " . $filename . ".* ";
|
||||||
$DecommpressCommand .= " | tar xzv";
|
$DecommpressCommand .= " | tar xzv";
|
||||||
@@ -130,12 +128,10 @@ class multipleFilesBackup{
|
|||||||
$metaFiles = glob( $tempDirectory . "/*.txt" );
|
$metaFiles = glob( $tempDirectory . "/*.txt" );
|
||||||
if (! empty( $metaFiles )) {
|
if (! empty( $metaFiles )) {
|
||||||
return workspaceTools::restoreLegacy( $tempDirectory );
|
return workspaceTools::restoreLegacy( $tempDirectory );
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
throw new Exception( "No metadata found in backup" );
|
throw new Exception( "No metadata found in backup" );
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
CLI::logging( "Found " . count( $metaFiles ) . " workspaces in backup:\n" );
|
CLI::logging( "Found " . count( $metaFiles ) . " workspaces in backup:\n" );
|
||||||
foreach ($metaFiles as $metafile) {
|
foreach ($metaFiles as $metafile) {
|
||||||
CLI::logging( "-> " . basename( $metafile ) . "\n" );
|
CLI::logging( "-> " . basename( $metafile ) . "\n" );
|
||||||
@@ -156,24 +152,21 @@ class multipleFilesBackup{
|
|||||||
if (isset( $dstWorkspace )) {
|
if (isset( $dstWorkspace )) {
|
||||||
$workspaceName = $dstWorkspace;
|
$workspaceName = $dstWorkspace;
|
||||||
$createWorkspace = true;
|
$createWorkspace = true;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$workspaceName = $metadata->WORKSPACE_NAME;
|
$workspaceName = $metadata->WORKSPACE_NAME;
|
||||||
$createWorkspace = false;
|
$createWorkspace = false;
|
||||||
}
|
}
|
||||||
if (isset( $srcWorkspace ) && strcmp( $metadata->WORKSPACE_NAME, $srcWorkspace ) != 0) {
|
if (isset( $srcWorkspace ) && strcmp( $metadata->WORKSPACE_NAME, $srcWorkspace ) != 0) {
|
||||||
CLI::logging( CLI::warning( "> Workspace $backupWorkspace found, but not restoring." ) . "\n" );
|
CLI::logging( CLI::warning( "> Workspace $backupWorkspace found, but not restoring." ) . "\n" );
|
||||||
continue;
|
continue;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
CLI::logging( "> Restoring " . CLI::info( $backupWorkspace ) . " to " . CLI::info( $workspaceName ) . "\n" );
|
CLI::logging( "> Restoring " . CLI::info( $backupWorkspace ) . " to " . CLI::info( $workspaceName ) . "\n" );
|
||||||
}
|
}
|
||||||
$workspace = new workspaceTools( $workspaceName );
|
$workspace = new workspaceTools( $workspaceName );
|
||||||
if ($workspace->workspaceExists()) {
|
if ($workspace->workspaceExists()) {
|
||||||
if ($overwrite) {
|
if ($overwrite) {
|
||||||
CLI::logging( CLI::warning( "> Workspace $workspaceName already exist, overwriting!" ) . "\n" );
|
CLI::logging( CLI::warning( "> Workspace $workspaceName already exist, overwriting!" ) . "\n" );
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
throw new Exception( "Destination workspace already exist (use -o to overwrite)" );
|
throw new Exception( "Destination workspace already exist (use -o to overwrite)" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -191,8 +184,7 @@ class multipleFilesBackup{
|
|||||||
$shared_stat = stat( PATH_DATA );
|
$shared_stat = stat( PATH_DATA );
|
||||||
if ($shared_stat !== false) {
|
if ($shared_stat !== false) {
|
||||||
workspaceTools::dirPerms( $workspace->path, $shared_stat['uid'], $shared_stat['gid'], $shared_stat['mode'] );
|
workspaceTools::dirPerms( $workspace->path, $shared_stat['uid'], $shared_stat['gid'], $shared_stat['mode'] );
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
CLI::logging( CLI::error( "Could not get the shared folder permissions, not changing workspace permissions" ) . "\n" );
|
CLI::logging( CLI::error( "Could not get the shared folder permissions, not changing workspace permissions" ) . "\n" );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -224,4 +216,3 @@ class multipleFilesBackup{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
|
||||||
|
|||||||
@@ -32,18 +32,18 @@
|
|||||||
|
|
||||||
class pluginDetail
|
class pluginDetail
|
||||||
{
|
{
|
||||||
var $sNamespace;
|
public $sNamespace;
|
||||||
var $sClassName;
|
public $sClassName;
|
||||||
var $sFriendlyName = null;
|
public $sFriendlyName = null;
|
||||||
var $sDescription = null;
|
public $sDescription = null;
|
||||||
var $sSetupPage = null;
|
public $sSetupPage = null;
|
||||||
var $sFilename;
|
public $sFilename;
|
||||||
var $sPluginFolder = '';
|
public $sPluginFolder = '';
|
||||||
var $sCompanyLogo = '';
|
public $sCompanyLogo = '';
|
||||||
var $iVersion = 0;
|
public $iVersion = 0;
|
||||||
var $enabled = false;
|
public $enabled = false;
|
||||||
var $aWorkspaces = null;
|
public $aWorkspaces = null;
|
||||||
var $bPrivate = false;
|
public $bPrivate = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function is the constructor of the pluginDetail class
|
* This function is the constructor of the pluginDetail class
|
||||||
@@ -58,7 +58,7 @@ class pluginDetail
|
|||||||
* @param integer $iVersion
|
* @param integer $iVersion
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function __construct ($sNamespace, $sClassName, $sFilename, $sFriendlyName = '', $sPluginFolder = '', $sDescription = '', $sSetupPage = '', $iVersion = 0)
|
public function __construct ($sNamespace, $sClassName, $sFilename, $sFriendlyName = '', $sPluginFolder = '', $sDescription = '', $sSetupPage = '', $iVersion = 0)
|
||||||
{
|
{
|
||||||
$this->sNamespace = $sNamespace;
|
$this->sNamespace = $sNamespace;
|
||||||
$this->sClassName = $sClassName;
|
$this->sClassName = $sClassName;
|
||||||
@@ -67,12 +67,13 @@ class pluginDetail
|
|||||||
$this->sSetupPage = $sSetupPage;
|
$this->sSetupPage = $sSetupPage;
|
||||||
$this->iVersion = $iVersion;
|
$this->iVersion = $iVersion;
|
||||||
$this->sFilename = $sFilename;
|
$this->sFilename = $sFilename;
|
||||||
if ($sPluginFolder == '')
|
if ($sPluginFolder == '') {
|
||||||
$this->sPluginFolder = $sNamespace;
|
$this->sPluginFolder = $sNamespace;
|
||||||
else
|
} else {
|
||||||
$this->sPluginFolder = $sPluginFolder;
|
$this->sPluginFolder = $sPluginFolder;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -107,7 +108,7 @@ class PMPluginRegistry
|
|||||||
*/
|
*/
|
||||||
private $_restServices = array ();
|
private $_restServices = array ();
|
||||||
|
|
||||||
private static $instance = NULL;
|
private static $instance = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function is the constructor of the PMPluginRegistry class
|
* This function is the constructor of the PMPluginRegistry class
|
||||||
@@ -127,7 +128,7 @@ class PMPluginRegistry
|
|||||||
*/
|
*/
|
||||||
function &getSingleton ()
|
function &getSingleton ()
|
||||||
{
|
{
|
||||||
if (self::$instance == NULL) {
|
if (self::$instance == null) {
|
||||||
self::$instance = new PMPluginRegistry();
|
self::$instance = new PMPluginRegistry();
|
||||||
}
|
}
|
||||||
return self::$instance;
|
return self::$instance;
|
||||||
@@ -139,7 +140,7 @@ class PMPluginRegistry
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function serializeInstance ()
|
public function serializeInstance ()
|
||||||
{
|
{
|
||||||
return serialize( self::$instance );
|
return serialize( self::$instance );
|
||||||
}
|
}
|
||||||
@@ -150,9 +151,9 @@ class PMPluginRegistry
|
|||||||
* @param string $serialized
|
* @param string $serialized
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function unSerializeInstance ($serialized)
|
public function unSerializeInstance ($serialized)
|
||||||
{
|
{
|
||||||
if (self::$instance == NULL) {
|
if (self::$instance == null) {
|
||||||
self::$instance = new PMPluginRegistry();
|
self::$instance = new PMPluginRegistry();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -163,7 +164,7 @@ class PMPluginRegistry
|
|||||||
/**
|
/**
|
||||||
* Save the current instance to the plugin singleton
|
* Save the current instance to the plugin singleton
|
||||||
*/
|
*/
|
||||||
function save ()
|
public function save ()
|
||||||
{
|
{
|
||||||
file_put_contents( PATH_DATA_SITE . 'plugin.singleton', $this->serializeInstance() );
|
file_put_contents( PATH_DATA_SITE . 'plugin.singleton', $this->serializeInstance() );
|
||||||
}
|
}
|
||||||
@@ -179,6 +180,7 @@ class PMPluginRegistry
|
|||||||
{
|
{
|
||||||
//require_once ($sFilename);
|
//require_once ($sFilename);
|
||||||
|
|
||||||
|
|
||||||
$sClassName = $sNamespace . "plugin";
|
$sClassName = $sNamespace . "plugin";
|
||||||
$plugin = new $sClassName( $sNamespace, $sFilename );
|
$plugin = new $sClassName( $sNamespace, $sFilename );
|
||||||
|
|
||||||
@@ -188,16 +190,7 @@ class PMPluginRegistry
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$detail = new pluginDetail(
|
$detail = new pluginDetail( $sNamespace, $sClassName, $sFilename, $plugin->sFriendlyName, $plugin->sPluginFolder, $plugin->sDescription, $plugin->sSetupPage, $plugin->iVersion );
|
||||||
$sNamespace,
|
|
||||||
$sClassName,
|
|
||||||
$sFilename,
|
|
||||||
$plugin->sFriendlyName,
|
|
||||||
$plugin->sPluginFolder,
|
|
||||||
$plugin->sDescription,
|
|
||||||
$plugin->sSetupPage,
|
|
||||||
$plugin->iVersion
|
|
||||||
);
|
|
||||||
|
|
||||||
if (isset( $plugin->aWorkspaces )) {
|
if (isset( $plugin->aWorkspaces )) {
|
||||||
$detail->aWorkspaces = $plugin->aWorkspaces;
|
$detail->aWorkspaces = $plugin->aWorkspaces;
|
||||||
@@ -211,6 +204,7 @@ class PMPluginRegistry
|
|||||||
// $detail->enabled = $this->_aPluginDetails[$sNamespace]->enabled;
|
// $detail->enabled = $this->_aPluginDetails[$sNamespace]->enabled;
|
||||||
//}
|
//}
|
||||||
|
|
||||||
|
|
||||||
$this->_aPluginDetails[$sNamespace] = $detail;
|
$this->_aPluginDetails[$sNamespace] = $detail;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -219,13 +213,14 @@ class PMPluginRegistry
|
|||||||
*
|
*
|
||||||
* @param unknown_type $sFilename
|
* @param unknown_type $sFilename
|
||||||
*/
|
*/
|
||||||
function getPluginDetails ($sFilename)
|
public function getPluginDetails ($sFilename)
|
||||||
{
|
{
|
||||||
foreach ($this->_aPluginDetails as $key => $row) {
|
foreach ($this->_aPluginDetails as $key => $row) {
|
||||||
if ($sFilename == baseName( $row->sFilename ))
|
if ($sFilename == baseName( $row->sFilename )) {
|
||||||
return $row;
|
return $row;
|
||||||
}
|
}
|
||||||
return NULL;
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -233,11 +228,12 @@ class PMPluginRegistry
|
|||||||
*
|
*
|
||||||
* @param unknown_type $sNamespace
|
* @param unknown_type $sNamespace
|
||||||
*/
|
*/
|
||||||
function enablePlugin ($sNamespace)
|
public function enablePlugin ($sNamespace)
|
||||||
{
|
{
|
||||||
foreach ($this->_aPluginDetails as $namespace => $detail) {
|
foreach ($this->_aPluginDetails as $namespace => $detail) {
|
||||||
if ($sNamespace == $namespace) {
|
if ($sNamespace == $namespace) {
|
||||||
$this->registerFolder( $sNamespace, $sNamespace, $detail->sPluginFolder ); //register the default directory, later we can have more
|
$this->registerFolder( $sNamespace, $sNamespace, $detail->sPluginFolder );
|
||||||
|
//register the default directory, later we can have more
|
||||||
$this->_aPluginDetails[$sNamespace]->enabled = true;
|
$this->_aPluginDetails[$sNamespace]->enabled = true;
|
||||||
$oPlugin = new $detail->sClassName( $detail->sNamespace, $detail->sFilename );
|
$oPlugin = new $detail->sClassName( $detail->sNamespace, $detail->sFilename );
|
||||||
$this->_aPlugins[$detail->sNamespace] = $oPlugin;
|
$this->_aPlugins[$detail->sNamespace] = $oPlugin;
|
||||||
@@ -255,7 +251,7 @@ class PMPluginRegistry
|
|||||||
*
|
*
|
||||||
* @param unknown_type $sNamespace
|
* @param unknown_type $sNamespace
|
||||||
*/
|
*/
|
||||||
function disablePlugin ($sNamespace, $eventPlugin = 1)
|
public function disablePlugin ($sNamespace, $eventPlugin = 1)
|
||||||
{
|
{
|
||||||
$sw = false;
|
$sw = false;
|
||||||
|
|
||||||
@@ -280,58 +276,70 @@ class PMPluginRegistry
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach ($this->_aMenus as $key => $detail) {
|
foreach ($this->_aMenus as $key => $detail) {
|
||||||
if ($detail->sNamespace == $sNamespace)
|
if ($detail->sNamespace == $sNamespace) {
|
||||||
unset( $this->_aMenus[$key] );
|
unset( $this->_aMenus[$key] );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
foreach ($this->_aFolders as $key => $detail) {
|
foreach ($this->_aFolders as $key => $detail) {
|
||||||
if ($detail->sNamespace == $sNamespace)
|
if ($detail->sNamespace == $sNamespace) {
|
||||||
unset( $this->_aFolders[$key] );
|
unset( $this->_aFolders[$key] );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
foreach ($this->_aTriggers as $key => $detail) {
|
foreach ($this->_aTriggers as $key => $detail) {
|
||||||
if ($detail->sNamespace == $sNamespace)
|
if ($detail->sNamespace == $sNamespace) {
|
||||||
unset( $this->_aTriggers[$key] );
|
unset( $this->_aTriggers[$key] );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
foreach ($this->_aDashlets as $key => $detail) {
|
foreach ($this->_aDashlets as $key => $detail) {
|
||||||
if ($detail == $sNamespace) {
|
if ($detail == $sNamespace) {
|
||||||
unset( $this->_aDashlets[$key] );
|
unset( $this->_aDashlets[$key] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreach ($this->_aReports as $key => $detail) {
|
foreach ($this->_aReports as $key => $detail) {
|
||||||
if ($detail == $sNamespace)
|
if ($detail == $sNamespace) {
|
||||||
unset( $this->_aReports[$key] );
|
unset( $this->_aReports[$key] );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
foreach ($this->_aPmFunctions as $key => $detail) {
|
foreach ($this->_aPmFunctions as $key => $detail) {
|
||||||
if ($detail == $sNamespace)
|
if ($detail == $sNamespace) {
|
||||||
unset( $this->_aPmFunctions[$key] );
|
unset( $this->_aPmFunctions[$key] );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
foreach ($this->_aRedirectLogin as $key => $detail) {
|
foreach ($this->_aRedirectLogin as $key => $detail) {
|
||||||
if ($detail->sNamespace == $sNamespace)
|
if ($detail->sNamespace == $sNamespace) {
|
||||||
unset( $this->_aRedirectLogin[$key] );
|
unset( $this->_aRedirectLogin[$key] );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
foreach ($this->_aSteps as $key => $detail) {
|
foreach ($this->_aSteps as $key => $detail) {
|
||||||
if ($detail->sNamespace == $sNamespace)
|
if ($detail->sNamespace == $sNamespace) {
|
||||||
unset( $this->_aSteps[$key] );
|
unset( $this->_aSteps[$key] );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
foreach ($this->_aToolbarFiles as $key => $detail) {
|
foreach ($this->_aToolbarFiles as $key => $detail) {
|
||||||
if ($detail->sNamespace == $sNamespace)
|
if ($detail->sNamespace == $sNamespace) {
|
||||||
unset( $this->_aToolbarFiles[$key] );
|
unset( $this->_aToolbarFiles[$key] );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
foreach ($this->_aCSSStyleSheets as $key => $detail) {
|
foreach ($this->_aCSSStyleSheets as $key => $detail) {
|
||||||
if ($detail->sNamespace == $sNamespace)
|
if ($detail->sNamespace == $sNamespace) {
|
||||||
unset( $this->_aCSSStyleSheets[$key] );
|
unset( $this->_aCSSStyleSheets[$key] );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
foreach ($this->_aCaseSchedulerPlugin as $key => $detail) {
|
foreach ($this->_aCaseSchedulerPlugin as $key => $detail) {
|
||||||
if ($detail->sNamespace == $sNamespace)
|
if ($detail->sNamespace == $sNamespace) {
|
||||||
unset( $this->_aCaseSchedulerPlugin[$key] );
|
unset( $this->_aCaseSchedulerPlugin[$key] );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
foreach ($this->_aTaskExtendedProperties as $key => $detail) {
|
foreach ($this->_aTaskExtendedProperties as $key => $detail) {
|
||||||
if ($detail->sNamespace == $sNamespace)
|
if ($detail->sNamespace == $sNamespace) {
|
||||||
unset( $this->_aTaskExtendedProperties[$key] );
|
unset( $this->_aTaskExtendedProperties[$key] );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
foreach ($this->_aDashboardPages as $key => $detail) {
|
foreach ($this->_aDashboardPages as $key => $detail) {
|
||||||
if ($detail->sNamespace == $sNamespace)
|
if ($detail->sNamespace == $sNamespace) {
|
||||||
unset( $this->_aDashboardPages[$key] );
|
unset( $this->_aDashboardPages[$key] );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//unregistering javascripts from this plugin
|
//unregistering javascripts from this plugin
|
||||||
$this->unregisterJavascripts( $sNamespace );
|
$this->unregisterJavascripts( $sNamespace );
|
||||||
@@ -344,15 +352,17 @@ class PMPluginRegistry
|
|||||||
*
|
*
|
||||||
* @param unknown_type $sNamespace
|
* @param unknown_type $sNamespace
|
||||||
*/
|
*/
|
||||||
function getStatusPlugin ($sNamespace)
|
public function getStatusPlugin ($sNamespace)
|
||||||
{
|
{
|
||||||
foreach ($this->_aPluginDetails as $namespace => $detail) {
|
foreach ($this->_aPluginDetails as $namespace => $detail) {
|
||||||
if ($sNamespace == $namespace)
|
if ($sNamespace == $namespace) {
|
||||||
if ($this->_aPluginDetails[$sNamespace]->enabled)
|
if ($this->_aPluginDetails[$sNamespace]->enabled) {
|
||||||
return 'enabled';
|
return 'enabled';
|
||||||
else
|
} else {
|
||||||
return 'disabled';
|
return 'disabled';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -363,13 +373,11 @@ class PMPluginRegistry
|
|||||||
*
|
*
|
||||||
* @return bool true if enabled, false otherwise
|
* @return bool true if enabled, false otherwise
|
||||||
*/
|
*/
|
||||||
function installPluginArchive ($filename, $pluginName)
|
public function installPluginArchive ($filename, $pluginName)
|
||||||
{
|
{
|
||||||
G::LoadThirdParty( "pear/Archive", "Tar" );
|
G::LoadThirdParty( "pear/Archive", "Tar" );
|
||||||
$tar = new Archive_Tar( $filename );
|
$tar = new Archive_Tar( $filename );
|
||||||
|
|
||||||
$files = $tar->listContent();
|
$files = $tar->listContent();
|
||||||
|
|
||||||
$plugins = array ();
|
$plugins = array ();
|
||||||
$namePlugin = array ();
|
$namePlugin = array ();
|
||||||
foreach ($files as $f) {
|
foreach ($files as $f) {
|
||||||
@@ -408,8 +416,6 @@ class PMPluginRegistry
|
|||||||
|
|
||||||
//$pluginIni = $tar->extractInString("$pluginName.ini");
|
//$pluginIni = $tar->extractInString("$pluginName.ini");
|
||||||
//$pluginConfig = parse_ini_string($pluginIni);
|
//$pluginConfig = parse_ini_string($pluginIni);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
if (!empty($oClass->aDependences)) {
|
if (!empty($oClass->aDependences)) {
|
||||||
foreach ($oClass->aDependences as $aDependence) {
|
foreach ($oClass->aDependences as $aDependence) {
|
||||||
@@ -446,7 +452,7 @@ class PMPluginRegistry
|
|||||||
$this->save();
|
$this->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
function uninstallPlugin ($sNamespace)
|
public function uninstallPlugin ($sNamespace)
|
||||||
{
|
{
|
||||||
$pluginFile = $sNamespace . ".php";
|
$pluginFile = $sNamespace . ".php";
|
||||||
|
|
||||||
@@ -472,7 +478,6 @@ class PMPluginRegistry
|
|||||||
|
|
||||||
///////
|
///////
|
||||||
$this->save();
|
$this->save();
|
||||||
|
|
||||||
///////
|
///////
|
||||||
$pluginDir = PATH_PLUGINS . $detail->sPluginFolder;
|
$pluginDir = PATH_PLUGINS . $detail->sPluginFolder;
|
||||||
|
|
||||||
@@ -485,16 +490,14 @@ class PMPluginRegistry
|
|||||||
}
|
}
|
||||||
|
|
||||||
///////
|
///////
|
||||||
$this->uninstallPluginWorkspaces( array ($sNamespace
|
$this->uninstallPluginWorkspaces( array ($sNamespace) );
|
||||||
) );
|
|
||||||
|
|
||||||
///////
|
///////
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function uninstallPluginWorkspaces ($arrayPlugin)
|
public function uninstallPluginWorkspaces ($arrayPlugin)
|
||||||
{
|
{
|
||||||
G::LoadClass( "system" );
|
G::LoadClass( "system" );
|
||||||
G::LoadClass( "wsTools" );
|
G::LoadClass( "wsTools" );
|
||||||
@@ -509,7 +512,6 @@ class PMPluginRegistry
|
|||||||
//Here we are loading all plug-ins registered
|
//Here we are loading all plug-ins registered
|
||||||
//The singleton has a list of enabled plug-ins
|
//The singleton has a list of enabled plug-ins
|
||||||
|
|
||||||
|
|
||||||
$pluginRegistry = &PMPluginRegistry::getSingleton();
|
$pluginRegistry = &PMPluginRegistry::getSingleton();
|
||||||
$pluginRegistry->unSerializeInstance( file_get_contents( $wsPathDataSite . "plugin.singleton" ) );
|
$pluginRegistry->unSerializeInstance( file_get_contents( $wsPathDataSite . "plugin.singleton" ) );
|
||||||
|
|
||||||
@@ -533,7 +535,7 @@ class PMPluginRegistry
|
|||||||
*
|
*
|
||||||
* @param unknown_type $sNamespace
|
* @param unknown_type $sNamespace
|
||||||
*/
|
*/
|
||||||
function installPlugin ($sNamespace)
|
public function installPlugin ($sNamespace)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
foreach ($this->_aPluginDetails as $namespace => $detail) {
|
foreach ($this->_aPluginDetails as $namespace => $detail) {
|
||||||
@@ -561,13 +563,14 @@ class PMPluginRegistry
|
|||||||
* @param unknown_type $sMenuId
|
* @param unknown_type $sMenuId
|
||||||
* @param unknown_type $sFilename
|
* @param unknown_type $sFilename
|
||||||
*/
|
*/
|
||||||
function registerMenu ($sNamespace, $sMenuId, $sFilename)
|
public function registerMenu ($sNamespace, $sMenuId, $sFilename)
|
||||||
{
|
{
|
||||||
$found = false;
|
$found = false;
|
||||||
foreach ($this->_aMenus as $row => $detail) {
|
foreach ($this->_aMenus as $row => $detail) {
|
||||||
if ($sMenuId == $detail->sMenuId && $sNamespace == $detail->sNamespace)
|
if ($sMenuId == $detail->sMenuId && $sNamespace == $detail->sNamespace) {
|
||||||
$found = true;
|
$found = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (! $found) {
|
if (! $found) {
|
||||||
$menuDetail = new menuDetail( $sNamespace, $sMenuId, $sFilename );
|
$menuDetail = new menuDetail( $sNamespace, $sMenuId, $sFilename );
|
||||||
$this->_aMenus[] = $menuDetail;
|
$this->_aMenus[] = $menuDetail;
|
||||||
@@ -579,7 +582,7 @@ class PMPluginRegistry
|
|||||||
*
|
*
|
||||||
* @param unknown_type $className
|
* @param unknown_type $className
|
||||||
*/
|
*/
|
||||||
function registerDashlets ($namespace)
|
public function registerDashlets ($namespace)
|
||||||
{
|
{
|
||||||
$found = false;
|
$found = false;
|
||||||
foreach ($this->_aDashlets as $row => $detail) {
|
foreach ($this->_aDashlets as $row => $detail) {
|
||||||
@@ -598,7 +601,7 @@ class PMPluginRegistry
|
|||||||
* @param unknown_type $sNamespace
|
* @param unknown_type $sNamespace
|
||||||
* @param unknown_type $sPage
|
* @param unknown_type $sPage
|
||||||
*/
|
*/
|
||||||
function registerCss ($sNamespace, $sCssFile)
|
public function registerCss ($sNamespace, $sCssFile)
|
||||||
{
|
{
|
||||||
$found = false;
|
$found = false;
|
||||||
foreach ($this->_aCSSStyleSheets as $row => $detail) {
|
foreach ($this->_aCSSStyleSheets as $row => $detail) {
|
||||||
@@ -618,7 +621,7 @@ class PMPluginRegistry
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function getRegisteredCss ()
|
public function getRegisteredCss ()
|
||||||
{
|
{
|
||||||
return $this->_aCSSStyleSheets;
|
return $this->_aCSSStyleSheets;
|
||||||
}
|
}
|
||||||
@@ -630,7 +633,7 @@ class PMPluginRegistry
|
|||||||
* @param string $coreJsFile
|
* @param string $coreJsFile
|
||||||
* @param array/string $pluginJsFile
|
* @param array/string $pluginJsFile
|
||||||
*/
|
*/
|
||||||
function registerJavascript ($sNamespace, $sCoreJsFile, $pluginJsFile)
|
public function registerJavascript ($sNamespace, $sCoreJsFile, $pluginJsFile)
|
||||||
{
|
{
|
||||||
|
|
||||||
foreach ($this->_aJavascripts as $i => $js) {
|
foreach ($this->_aJavascripts as $i => $js) {
|
||||||
@@ -669,7 +672,7 @@ class PMPluginRegistry
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function getRegisteredJavascript ()
|
public function getRegisteredJavascript ()
|
||||||
{
|
{
|
||||||
return $this->_aJavascripts;
|
return $this->_aJavascripts;
|
||||||
}
|
}
|
||||||
@@ -681,7 +684,7 @@ class PMPluginRegistry
|
|||||||
* @param string $sNamespace
|
* @param string $sNamespace
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function getRegisteredJavascriptBy ($sCoreJsFile, $sNamespace = '')
|
public function getRegisteredJavascriptBy ($sCoreJsFile, $sNamespace = '')
|
||||||
{
|
{
|
||||||
$scripts = array ();
|
$scripts = array ();
|
||||||
|
|
||||||
@@ -708,9 +711,10 @@ class PMPluginRegistry
|
|||||||
* @param string $sCoreJsFile
|
* @param string $sCoreJsFile
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function unregisterJavascripts ($sNamespace, $sCoreJsFile = '')
|
public function unregisterJavascripts ($sNamespace, $sCoreJsFile = '')
|
||||||
{
|
{
|
||||||
if ($sCoreJsFile == '') { // if $sCoreJsFile=='' unregister all js from this namespace
|
if ($sCoreJsFile == '') {
|
||||||
|
// if $sCoreJsFile=='' unregister all js from this namespace
|
||||||
foreach ($this->_aJavascripts as $i => $js) {
|
foreach ($this->_aJavascripts as $i => $js) {
|
||||||
if ($sNamespace == $js->sNamespace) {
|
if ($sNamespace == $js->sNamespace) {
|
||||||
unset( $this->_aJavascripts[$i] );
|
unset( $this->_aJavascripts[$i] );
|
||||||
@@ -736,13 +740,14 @@ class PMPluginRegistry
|
|||||||
* @param unknown_type $sMenuId
|
* @param unknown_type $sMenuId
|
||||||
* @param unknown_type $sFilename
|
* @param unknown_type $sFilename
|
||||||
*/
|
*/
|
||||||
function registerReport ($sNamespace)
|
public function registerReport ($sNamespace)
|
||||||
{
|
{
|
||||||
$found = false;
|
$found = false;
|
||||||
foreach ($this->_aReports as $row => $detail) {
|
foreach ($this->_aReports as $row => $detail) {
|
||||||
if ($sNamespace == $detail)
|
if ($sNamespace == $detail) {
|
||||||
$found = true;
|
$found = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (! $found) {
|
if (! $found) {
|
||||||
$this->_aReports[] = $sNamespace;
|
$this->_aReports[] = $sNamespace;
|
||||||
}
|
}
|
||||||
@@ -755,13 +760,14 @@ class PMPluginRegistry
|
|||||||
* @param unknown_type $sMenuId
|
* @param unknown_type $sMenuId
|
||||||
* @param unknown_type $sFilename
|
* @param unknown_type $sFilename
|
||||||
*/
|
*/
|
||||||
function registerPmFunction ($sNamespace)
|
public function registerPmFunction ($sNamespace)
|
||||||
{
|
{
|
||||||
$found = false;
|
$found = false;
|
||||||
foreach ($this->_aPmFunctions as $row => $detail) {
|
foreach ($this->_aPmFunctions as $row => $detail) {
|
||||||
if ($sNamespace == $detail)
|
if ($sNamespace == $detail) {
|
||||||
$found = true;
|
$found = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (! $found) {
|
if (! $found) {
|
||||||
$this->_aPmFunctions[] = $sNamespace;
|
$this->_aPmFunctions[] = $sNamespace;
|
||||||
}
|
}
|
||||||
@@ -774,13 +780,15 @@ class PMPluginRegistry
|
|||||||
* @param unknown_type $sRole
|
* @param unknown_type $sRole
|
||||||
* @param unknown_type $sPath
|
* @param unknown_type $sPath
|
||||||
*/
|
*/
|
||||||
function registerRedirectLogin ($sNamespace, $sRole, $sPathMethod)
|
public function registerRedirectLogin ($sNamespace, $sRole, $sPathMethod)
|
||||||
{
|
{
|
||||||
$found = false;
|
$found = false;
|
||||||
foreach ($this->_aRedirectLogin as $row => $detail) {
|
foreach ($this->_aRedirectLogin as $row => $detail) {
|
||||||
if (($sNamespace == $detail->sNamespace) && ($sRole == $detail->sRoleCode)) //Filters based on Workspace and Role Code
|
if (($sNamespace == $detail->sNamespace) && ($sRole == $detail->sRoleCode)) {
|
||||||
|
//Filters based on Workspace and Role Code
|
||||||
$found = true;
|
$found = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (! $found) {
|
if (! $found) {
|
||||||
$this->_aRedirectLogin[] = new redirectDetail( $sNamespace, $sRole, $sPathMethod );
|
$this->_aRedirectLogin[] = new redirectDetail( $sNamespace, $sRole, $sPathMethod );
|
||||||
}
|
}
|
||||||
@@ -791,12 +799,14 @@ class PMPluginRegistry
|
|||||||
*
|
*
|
||||||
* @param unknown_type $sFolderName
|
* @param unknown_type $sFolderName
|
||||||
*/
|
*/
|
||||||
function registerFolder ($sNamespace, $sFolderId, $sFolderName)
|
public function registerFolder ($sNamespace, $sFolderId, $sFolderName)
|
||||||
{
|
{
|
||||||
$found = false;
|
$found = false;
|
||||||
foreach ($this->_aFolders as $row => $detail)
|
foreach ($this->_aFolders as $row => $detail) {
|
||||||
if ($sFolderId == $detail->sFolderId && $sNamespace == $detail->sNamespace)
|
if ($sFolderId == $detail->sFolderId && $sNamespace == $detail->sNamespace) {
|
||||||
$found = true;
|
$found = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (! $found) {
|
if (! $found) {
|
||||||
$this->_aFolders[] = new folderDetail( $sNamespace, $sFolderId, $sFolderName );
|
$this->_aFolders[] = new folderDetail( $sNamespace, $sFolderId, $sFolderName );
|
||||||
@@ -808,12 +818,14 @@ class PMPluginRegistry
|
|||||||
*
|
*
|
||||||
* @param unknown_type $sFolderName
|
* @param unknown_type $sFolderName
|
||||||
*/
|
*/
|
||||||
function registerStep ($sNamespace, $sStepId, $sStepName, $sStepTitle, $setupStepPage = '')
|
public function registerStep ($sNamespace, $sStepId, $sStepName, $sStepTitle, $setupStepPage = '')
|
||||||
{
|
{
|
||||||
$found = false;
|
$found = false;
|
||||||
foreach ($this->_aSteps as $row => $detail)
|
foreach ($this->_aSteps as $row => $detail) {
|
||||||
if ($sStepId == $detail->sStepId && $sNamespace == $detail->sNamespace)
|
if ($sStepId == $detail->sStepId && $sNamespace == $detail->sNamespace) {
|
||||||
$found = true;
|
$found = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (! $found) {
|
if (! $found) {
|
||||||
$this->_aSteps[] = new stepDetail( $sNamespace, $sStepId, $sStepName, $sStepTitle, $setupStepPage );
|
$this->_aSteps[] = new stepDetail( $sNamespace, $sStepId, $sStepName, $sStepTitle, $setupStepPage );
|
||||||
@@ -825,7 +837,7 @@ class PMPluginRegistry
|
|||||||
*
|
*
|
||||||
* @param unknown_type $sFolderName
|
* @param unknown_type $sFolderName
|
||||||
*/
|
*/
|
||||||
function isRegisteredFolder ($sFolderName)
|
public function isRegisteredFolder ($sFolderName)
|
||||||
{
|
{
|
||||||
foreach ($this->_aFolders as $row => $folder) {
|
foreach ($this->_aFolders as $row => $folder) {
|
||||||
if ($sFolderName == $folder->sFolderName && is_dir( PATH_PLUGINS . $folder->sFolderName )) {
|
if ($sFolderName == $folder->sFolderName && is_dir( PATH_PLUGINS . $folder->sFolderName )) {
|
||||||
@@ -842,7 +854,7 @@ class PMPluginRegistry
|
|||||||
*
|
*
|
||||||
* @param unknown_type $menuId
|
* @param unknown_type $menuId
|
||||||
*/
|
*/
|
||||||
function getMenus ($menuId)
|
public function getMenus ($menuId)
|
||||||
{
|
{
|
||||||
foreach ($this->_aMenus as $row => $detail) {
|
foreach ($this->_aMenus as $row => $detail) {
|
||||||
if ($menuId == $detail->sMenuId && file_exists( $detail->sFilename )) {
|
if ($menuId == $detail->sMenuId && file_exists( $detail->sFilename )) {
|
||||||
@@ -856,7 +868,7 @@ class PMPluginRegistry
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function getDashlets ()
|
public function getDashlets ()
|
||||||
{
|
{
|
||||||
return $this->_aDashlets;
|
return $this->_aDashlets;
|
||||||
}
|
}
|
||||||
@@ -866,7 +878,7 @@ class PMPluginRegistry
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function getReports ()
|
public function getReports ()
|
||||||
{
|
{
|
||||||
return $this->_aReports;
|
return $this->_aReports;
|
||||||
$report = array ();
|
$report = array ();
|
||||||
@@ -881,7 +893,7 @@ class PMPluginRegistry
|
|||||||
* This function returns all pmFunctions registered
|
* This function returns all pmFunctions registered
|
||||||
* @ array
|
* @ array
|
||||||
*/
|
*/
|
||||||
function getPmFunctions ()
|
public function getPmFunctions ()
|
||||||
{
|
{
|
||||||
return $this->_aPmFunctions;
|
return $this->_aPmFunctions;
|
||||||
$pmf = array ();
|
$pmf = array ();
|
||||||
@@ -897,7 +909,7 @@ class PMPluginRegistry
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function getSteps ()
|
public function getSteps ()
|
||||||
{
|
{
|
||||||
return $this->_aSteps;
|
return $this->_aSteps;
|
||||||
}
|
}
|
||||||
@@ -907,7 +919,7 @@ class PMPluginRegistry
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function getRedirectLogins ()
|
public function getRedirectLogins ()
|
||||||
{
|
{
|
||||||
return $this->_aRedirectLogin;
|
return $this->_aRedirectLogin;
|
||||||
}
|
}
|
||||||
@@ -918,11 +930,10 @@ class PMPluginRegistry
|
|||||||
* @param unknown_type $menuId
|
* @param unknown_type $menuId
|
||||||
* @return object
|
* @return object
|
||||||
*/
|
*/
|
||||||
function executeTriggers ($triggerId, $oData)
|
public function executeTriggers ($triggerId, $oData)
|
||||||
{
|
{
|
||||||
foreach ($this->_aTriggers as $row => $detail) {
|
foreach ($this->_aTriggers as $row => $detail) {
|
||||||
if ($triggerId == $detail->sTriggerId) {
|
if ($triggerId == $detail->sTriggerId) {
|
||||||
|
|
||||||
//review all folders registered for this namespace
|
//review all folders registered for this namespace
|
||||||
$found = false;
|
$found = false;
|
||||||
$classFile = '';
|
$classFile = '';
|
||||||
@@ -945,23 +956,23 @@ class PMPluginRegistry
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
return $response;
|
return $response;
|
||||||
} else
|
} else {
|
||||||
print "error in call method " . $detail->sTriggerName;
|
print "error in call method " . $detail->sTriggerName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* verify if exists triggers related to a triggerId
|
* verify if exists triggers related to a triggerId
|
||||||
*
|
*
|
||||||
* @param unknown_type $triggerId
|
* @param unknown_type $triggerId
|
||||||
*/
|
*/
|
||||||
function existsTrigger ($triggerId)
|
public function existsTrigger ($triggerId)
|
||||||
{
|
{
|
||||||
$found = false;
|
$found = false;
|
||||||
foreach ($this->_aTriggers as $row => $detail) {
|
foreach ($this->_aTriggers as $row => $detail) {
|
||||||
if ($triggerId == $detail->sTriggerId) {
|
if ($triggerId == $detail->sTriggerId) {
|
||||||
|
|
||||||
//review all folders registered for this namespace
|
//review all folders registered for this namespace
|
||||||
foreach ($this->_aFolders as $row => $folder) {
|
foreach ($this->_aFolders as $row => $folder) {
|
||||||
$fname = PATH_PLUGINS . $folder->sFolderName . PATH_SEP . 'class.' . $folder->sFolderName . '.php';
|
$fname = PATH_PLUGINS . $folder->sFolderName . PATH_SEP . 'class.' . $folder->sFolderName . '.php';
|
||||||
@@ -980,12 +991,11 @@ class PMPluginRegistry
|
|||||||
* @param unknown_type $triggerId
|
* @param unknown_type $triggerId
|
||||||
* @return object
|
* @return object
|
||||||
*/
|
*/
|
||||||
function getTriggerInfo ($triggerId)
|
public function getTriggerInfo ($triggerId)
|
||||||
{
|
{
|
||||||
$found = null;
|
$found = null;
|
||||||
foreach ($this->_aTriggers as $row => $detail) {
|
foreach ($this->_aTriggers as $row => $detail) {
|
||||||
if ($triggerId == $detail->sTriggerId) {
|
if ($triggerId == $detail->sTriggerId) {
|
||||||
|
|
||||||
//review all folders registered for this namespace
|
//review all folders registered for this namespace
|
||||||
foreach ($this->_aFolders as $row => $folder) {
|
foreach ($this->_aFolders as $row => $folder) {
|
||||||
$fname = PATH_PLUGINS . $folder->sFolderName . PATH_SEP . 'class.' . $folder->sFolderName . '.php';
|
$fname = PATH_PLUGINS . $folder->sFolderName . PATH_SEP . 'class.' . $folder->sFolderName . '.php';
|
||||||
@@ -1005,13 +1015,14 @@ class PMPluginRegistry
|
|||||||
* @param unknown_type $sMethodFunction
|
* @param unknown_type $sMethodFunction
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function registerTrigger ($sNamespace, $sTriggerId, $sTriggerName)
|
public function registerTrigger ($sNamespace, $sTriggerId, $sTriggerName)
|
||||||
{
|
{
|
||||||
$found = false;
|
$found = false;
|
||||||
foreach ($this->_aTriggers as $row => $detail) {
|
foreach ($this->_aTriggers as $row => $detail) {
|
||||||
if ($sTriggerId == $detail->sTriggerId && $sNamespace == $detail->sNamespace)
|
if ($sTriggerId == $detail->sTriggerId && $sNamespace == $detail->sNamespace) {
|
||||||
$found = true;
|
$found = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (! $found) {
|
if (! $found) {
|
||||||
$triggerDetail = new triggerDetail( $sNamespace, $sTriggerId, $sTriggerName );
|
$triggerDetail = new triggerDetail( $sNamespace, $sTriggerId, $sTriggerName );
|
||||||
$this->_aTriggers[] = $triggerDetail;
|
$this->_aTriggers[] = $triggerDetail;
|
||||||
@@ -1024,7 +1035,7 @@ class PMPluginRegistry
|
|||||||
* @param unknown_type $sNamespace
|
* @param unknown_type $sNamespace
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function &getPlugin ($sNamespace)
|
public function &getPlugin ($sNamespace)
|
||||||
{
|
{
|
||||||
if (array_key_exists( $sNamespace, $this->_aPlugins )) {
|
if (array_key_exists( $sNamespace, $this->_aPlugins )) {
|
||||||
return $this->_aPlugins[$sNamespace];
|
return $this->_aPlugins[$sNamespace];
|
||||||
@@ -1052,14 +1063,15 @@ class PMPluginRegistry
|
|||||||
* @param unknown_type $filename
|
* @param unknown_type $filename
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function setCompanyLogo ($sNamespace, $filename)
|
public function setCompanyLogo ($sNamespace, $filename)
|
||||||
{
|
{
|
||||||
$found = false;
|
$found = false;
|
||||||
foreach ($this->_aPluginDetails as $row => $detail) {
|
foreach ($this->_aPluginDetails as $row => $detail) {
|
||||||
if ($sNamespace == $detail->sNamespace)
|
if ($sNamespace == $detail->sNamespace) {
|
||||||
$this->_aPluginDetails[$sNamespace]->sCompanyLogo = $filename;
|
$this->_aPluginDetails[$sNamespace]->sCompanyLogo = $filename;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get company logo
|
* get company logo
|
||||||
@@ -1067,13 +1079,14 @@ class PMPluginRegistry
|
|||||||
* @param unknown_type $default
|
* @param unknown_type $default
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function getCompanyLogo ($default)
|
public function getCompanyLogo ($default)
|
||||||
{
|
{
|
||||||
$sCompanyLogo = $default;
|
$sCompanyLogo = $default;
|
||||||
foreach ($this->_aPluginDetails as $row => $detail) {
|
foreach ($this->_aPluginDetails as $row => $detail) {
|
||||||
if (trim( $detail->sCompanyLogo ) != '')
|
if (trim( $detail->sCompanyLogo ) != '') {
|
||||||
$sCompanyLogo = $detail->sCompanyLogo;
|
$sCompanyLogo = $detail->sCompanyLogo;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return $sCompanyLogo;
|
return $sCompanyLogo;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1083,7 +1096,7 @@ class PMPluginRegistry
|
|||||||
* @param unknown_type $default
|
* @param unknown_type $default
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function setupPlugins ()
|
public function setupPlugins ()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$iPlugins = 0;
|
$iPlugins = 0;
|
||||||
@@ -1099,8 +1112,9 @@ class PMPluginRegistry
|
|||||||
$aux = explode( chr( 92 ), $detail->sFilename );
|
$aux = explode( chr( 92 ), $detail->sFilename );
|
||||||
}
|
}
|
||||||
$sFilename = PATH_PLUGINS . $aux[count( $aux ) - 1];
|
$sFilename = PATH_PLUGINS . $aux[count( $aux ) - 1];
|
||||||
if (! file_exists( $sFilename ))
|
if (! file_exists( $sFilename )) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
require_once $sFilename;
|
require_once $sFilename;
|
||||||
if (class_exists( $detail->sClassName )) {
|
if (class_exists( $detail->sClassName )) {
|
||||||
$oPlugin = new $detail->sClassName( $detail->sNamespace, $detail->sFilename );
|
$oPlugin = new $detail->sClassName( $detail->sNamespace, $detail->sFilename );
|
||||||
@@ -1132,7 +1146,7 @@ class PMPluginRegistry
|
|||||||
* @param object $oData
|
* @param object $oData
|
||||||
* @return object
|
* @return object
|
||||||
*/
|
*/
|
||||||
function executeMethod ($sNamespace, $methodName, $oData)
|
public function executeMethod ($sNamespace, $methodName, $oData)
|
||||||
{
|
{
|
||||||
$response = null;
|
$response = null;
|
||||||
try {
|
try {
|
||||||
@@ -1170,32 +1184,32 @@ class PMPluginRegistry
|
|||||||
* @param string $sNamespace
|
* @param string $sNamespace
|
||||||
* @return object
|
* @return object
|
||||||
*/
|
*/
|
||||||
function getFieldsForPageSetup ($sNamespace)
|
public function getFieldsForPageSetup ($sNamespace)
|
||||||
{
|
{
|
||||||
$oData = NULL;
|
$oData = null;
|
||||||
return $this->executeMethod( $sNamespace, 'getFieldsForPageSetup', $oData );
|
return $this->executeMethod( $sNamespace, 'getFieldsForPageSetup', $oData );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* this function updates Fields For Page on Setup
|
* this function updates Fields For Page on Setup
|
||||||
*
|
*
|
||||||
* @param string $sNamespace
|
* @param string $sNamespace
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function updateFieldsForPageSetup ($sNamespace, $oData)
|
public function updateFieldsForPageSetup ($sNamespace, $oData)
|
||||||
{
|
{
|
||||||
if (! isset( $this->_aPluginDetails[$sNamespace] )) {
|
if (! isset( $this->_aPluginDetails[$sNamespace] )) {
|
||||||
throw (new Exception( "The namespace '$sNamespace' doesn't exist in plugins folder." ));
|
throw (new Exception( "The namespace '$sNamespace' doesn't exist in plugins folder." ));
|
||||||
}
|
}
|
||||||
;
|
|
||||||
return $this->executeMethod( $sNamespace, 'updateFieldsForPageSetup', $oData );
|
return $this->executeMethod( $sNamespace, 'updateFieldsForPageSetup', $oData );
|
||||||
}
|
}
|
||||||
|
|
||||||
function eevalidate ()
|
public function eevalidate ()
|
||||||
{
|
{
|
||||||
$fileL = PATH_DATA_SITE . 'license.dat';
|
$fileL = PATH_DATA_SITE . 'license.dat';
|
||||||
$fileS = PATH_DATA . 'license.dat';
|
$fileS = PATH_DATA . 'license.dat';
|
||||||
if ((file_exists( $fileL )) || (file_exists( $fileS ))) { //Found a License
|
if ((file_exists( $fileL )) || (file_exists( $fileS ))) {
|
||||||
|
//Found a License
|
||||||
if (class_exists( 'pmLicenseManager' )) {
|
if (class_exists( 'pmLicenseManager' )) {
|
||||||
$sSerializedFile = PATH_DATA_SITE . 'lmn.singleton';
|
$sSerializedFile = PATH_DATA_SITE . 'lmn.singleton';
|
||||||
$pmLicenseManagerO = & pmLicenseManager::getSingleton();
|
$pmLicenseManagerO = & pmLicenseManager::getSingleton();
|
||||||
@@ -1213,13 +1227,14 @@ class PMPluginRegistry
|
|||||||
* @param unknown_type $sToolbarId
|
* @param unknown_type $sToolbarId
|
||||||
* @param unknown_type $sFilename
|
* @param unknown_type $sFilename
|
||||||
*/
|
*/
|
||||||
function registerToolbarFile ($sNamespace, $sToolbarId, $sFilename)
|
public function registerToolbarFile ($sNamespace, $sToolbarId, $sFilename)
|
||||||
{
|
{
|
||||||
$found = false;
|
$found = false;
|
||||||
foreach ($this->_aToolbarFiles as $row => $detail) {
|
foreach ($this->_aToolbarFiles as $row => $detail) {
|
||||||
if ($sToolbarId == $detail->sToolbarId && $sNamespace == $detail->sNamespace)
|
if ($sToolbarId == $detail->sToolbarId && $sNamespace == $detail->sNamespace) {
|
||||||
$found = true;
|
$found = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (! $found) {
|
if (! $found) {
|
||||||
$toolbarDetail = new toolbarDetail( $sNamespace, $sToolbarId, $sFilename );
|
$toolbarDetail = new toolbarDetail( $sNamespace, $sToolbarId, $sFilename );
|
||||||
$this->_aToolbarFiles[] = $toolbarDetail;
|
$this->_aToolbarFiles[] = $toolbarDetail;
|
||||||
@@ -1231,7 +1246,7 @@ class PMPluginRegistry
|
|||||||
*
|
*
|
||||||
* @param unknown_type $sToolbarId (NORMAL, GRID)
|
* @param unknown_type $sToolbarId (NORMAL, GRID)
|
||||||
*/
|
*/
|
||||||
function getToolbarOptions ($sToolbarId)
|
public function getToolbarOptions ($sToolbarId)
|
||||||
{
|
{
|
||||||
foreach ($this->_aToolbarFiles as $row => $detail) {
|
foreach ($this->_aToolbarFiles as $row => $detail) {
|
||||||
if ($sToolbarId == $detail->sToolbarId && file_exists( $detail->sFilename )) {
|
if ($sToolbarId == $detail->sToolbarId && file_exists( $detail->sFilename )) {
|
||||||
@@ -1243,12 +1258,13 @@ class PMPluginRegistry
|
|||||||
/**
|
/**
|
||||||
* Register a Case Scheduler Plugin
|
* Register a Case Scheduler Plugin
|
||||||
*/
|
*/
|
||||||
function registerCaseSchedulerPlugin ($sNamespace, $sActionId, $sActionForm, $sActionSave, $sActionExecute, $sActionGetFields)
|
public function registerCaseSchedulerPlugin ($sNamespace, $sActionId, $sActionForm, $sActionSave, $sActionExecute, $sActionGetFields)
|
||||||
{
|
{
|
||||||
$found = false;
|
$found = false;
|
||||||
foreach ($this->_aCaseSchedulerPlugin as $row => $detail)
|
foreach ($this->_aCaseSchedulerPlugin as $row => $detail)
|
||||||
if ($sActionId == $detail->sActionId && $sNamespace == $detail->sNamespace)
|
if ($sActionId == $detail->sActionId && $sNamespace == $detail->sNamespace) {
|
||||||
$found = true;
|
$found = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (! $found) {
|
if (! $found) {
|
||||||
$this->_aCaseSchedulerPlugin[] = new caseSchedulerPlugin( $sNamespace, $sActionId, $sActionForm, $sActionSave, $sActionExecute, $sActionGetFields );
|
$this->_aCaseSchedulerPlugin[] = new caseSchedulerPlugin( $sNamespace, $sActionId, $sActionForm, $sActionSave, $sActionExecute, $sActionGetFields );
|
||||||
@@ -1260,7 +1276,7 @@ class PMPluginRegistry
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function getCaseSchedulerPlugins ()
|
public function getCaseSchedulerPlugins ()
|
||||||
{
|
{
|
||||||
return $this->_aCaseSchedulerPlugin;
|
return $this->_aCaseSchedulerPlugin;
|
||||||
}
|
}
|
||||||
@@ -1272,7 +1288,7 @@ class PMPluginRegistry
|
|||||||
* @param unknown_type $sPage
|
* @param unknown_type $sPage
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function registerTaskExtendedProperty ($sNamespace, $sPage, $sName, $sIcon)
|
public function registerTaskExtendedProperty ($sNamespace, $sPage, $sName, $sIcon)
|
||||||
{
|
{
|
||||||
$found = false;
|
$found = false;
|
||||||
foreach ($this->_aTaskExtendedProperties as $row => $detail) {
|
foreach ($this->_aTaskExtendedProperties as $row => $detail) {
|
||||||
@@ -1296,7 +1312,7 @@ class PMPluginRegistry
|
|||||||
* @param unknown_type $sName
|
* @param unknown_type $sName
|
||||||
* @param unknown_type $sIcon
|
* @param unknown_type $sIcon
|
||||||
*/
|
*/
|
||||||
function registerDashboardPage ($sNamespace, $sPage, $sName, $sIcon)
|
public function registerDashboardPage ($sNamespace, $sPage, $sName, $sIcon)
|
||||||
{
|
{
|
||||||
foreach ($this->_aDashboardPages as $row => $detail) {
|
foreach ($this->_aDashboardPages as $row => $detail) {
|
||||||
if ($sPage == $detail->sPage && $sNamespace == $detail->sNamespace) {
|
if ($sPage == $detail->sPage && $sNamespace == $detail->sNamespace) {
|
||||||
@@ -1355,7 +1371,6 @@ class PMPluginRegistry
|
|||||||
unset( $this->_restServices[$i] );
|
unset( $this->_restServices[$i] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Re-index when all js were unregistered
|
// Re-index when all js were unregistered
|
||||||
$this->_restServices = array_values( $this->_restServices );
|
$this->_restServices = array_values( $this->_restServices );
|
||||||
}
|
}
|
||||||
@@ -1381,7 +1396,7 @@ class PMPluginRegistry
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function getDashboardPages ()
|
public function getDashboardPages ()
|
||||||
{
|
{
|
||||||
return $this->_aDashboardPages;
|
return $this->_aDashboardPages;
|
||||||
}
|
}
|
||||||
@@ -1391,18 +1406,19 @@ class PMPluginRegistry
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function getTaskExtendedProperties ()
|
public function getTaskExtendedProperties ()
|
||||||
{
|
{
|
||||||
return $this->_aTaskExtendedProperties;
|
return $this->_aTaskExtendedProperties;
|
||||||
}
|
}
|
||||||
|
|
||||||
function registerDashboard ()
|
public function registerDashboard ()
|
||||||
{
|
{
|
||||||
// Dummy function for backwards compatibility
|
// Dummy function for backwards compatibility
|
||||||
}
|
}
|
||||||
|
|
||||||
function getAttributes ()
|
public function getAttributes ()
|
||||||
{
|
{
|
||||||
return get_object_vars( $this );
|
return get_object_vars( $this );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,9 +13,10 @@ require_once 'classes/model/om/BaseAppNotes.php';
|
|||||||
*
|
*
|
||||||
* @package classes.model
|
* @package classes.model
|
||||||
*/
|
*/
|
||||||
class AppNotes extends BaseAppNotes {
|
class AppNotes extends BaseAppNotes
|
||||||
|
{
|
||||||
|
|
||||||
function getNotesList($appUid, $usrUid='', $start='', $limit='')
|
public function getNotesList ($appUid, $usrUid = '', $start = '', $limit = '')
|
||||||
{
|
{
|
||||||
require_once ("classes/model/Users.php");
|
require_once ("classes/model/Users.php");
|
||||||
|
|
||||||
@@ -75,9 +76,8 @@ class AppNotes extends BaseAppNotes {
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function postNewNote ($appUid, $usrUid, $noteContent, $notify = true, $noteAvalibility = "PUBLIC", $noteRecipients = "", $noteType = "USER", $noteDate = "now")
|
||||||
function postNewNote($appUid, $usrUid, $noteContent, $notify=true, $noteAvalibility="PUBLIC", $noteRecipients="", $noteType="USER", $noteDate="now") {
|
{
|
||||||
|
|
||||||
$this->setAppUid( $appUid );
|
$this->setAppUid( $appUid );
|
||||||
$this->setUsrUid( $usrUid );
|
$this->setUsrUid( $usrUid );
|
||||||
$this->setNoteDate( $noteDate );
|
$this->setNoteDate( $noteDate );
|
||||||
@@ -115,7 +115,6 @@ class AppNotes extends BaseAppNotes {
|
|||||||
$noteRecipientsA = array ();
|
$noteRecipientsA = array ();
|
||||||
G::LoadClass( 'case' );
|
G::LoadClass( 'case' );
|
||||||
$oCase = new Cases();
|
$oCase = new Cases();
|
||||||
|
|
||||||
$p = $oCase->getUsersParticipatedInCase( $appUid );
|
$p = $oCase->getUsersParticipatedInCase( $appUid );
|
||||||
foreach ($p['array'] as $key => $userParticipated) {
|
foreach ($p['array'] as $key => $userParticipated) {
|
||||||
$noteRecipientsA[] = $key;
|
$noteRecipientsA[] = $key;
|
||||||
@@ -129,7 +128,8 @@ class AppNotes extends BaseAppNotes {
|
|||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function sendNoteNotification($appUid, $usrUid, $noteContent, $noteRecipients, $sFrom="") {
|
public function sendNoteNotification ($appUid, $usrUid, $noteContent, $noteRecipients, $sFrom = "")
|
||||||
|
{
|
||||||
try {
|
try {
|
||||||
require_once ('classes/model/Configuration.php');
|
require_once ('classes/model/Configuration.php');
|
||||||
$oConfiguration = new Configuration();
|
$oConfiguration = new Configuration();
|
||||||
@@ -206,7 +206,6 @@ class AppNotes extends BaseAppNotes {
|
|||||||
|
|
||||||
$sSubject = G::replaceDataField( $configNoteNotification['subject'], $aFields );
|
$sSubject = G::replaceDataField( $configNoteNotification['subject'], $aFields );
|
||||||
|
|
||||||
|
|
||||||
//erik: new behaviour for messages
|
//erik: new behaviour for messages
|
||||||
//G::loadClass('configuration');
|
//G::loadClass('configuration');
|
||||||
//$oConf = new Configurations;
|
//$oConf = new Configurations;
|
||||||
@@ -222,15 +221,12 @@ class AppNotes extends BaseAppNotes {
|
|||||||
if ( ! file_exists ( $fileTemplate ) ) {
|
if ( ! file_exists ( $fileTemplate ) ) {
|
||||||
throw new Exception("Template file '$fileTemplate' does not exist.");
|
throw new Exception("Template file '$fileTemplate' does not exist.");
|
||||||
}
|
}
|
||||||
|
|
||||||
$sBody = G::replaceDataField(file_get_contents($fileTemplate), $aFields);
|
$sBody = G::replaceDataField(file_get_contents($fileTemplate), $aFields);
|
||||||
} else {*/
|
} else {*/
|
||||||
$sBody = nl2br( G::replaceDataField( $configNoteNotification['body'], $aFields ) );
|
$sBody = nl2br( G::replaceDataField( $configNoteNotification['body'], $aFields ) );
|
||||||
/*}*/
|
/*}*/
|
||||||
|
|
||||||
G::LoadClass( 'spool' );
|
G::LoadClass( 'spool' );
|
||||||
$oUser = new Users();
|
$oUser = new Users();
|
||||||
|
|
||||||
$recipientsArray = explode( ",", $noteRecipients );
|
$recipientsArray = explode( ",", $noteRecipients );
|
||||||
|
|
||||||
foreach ($recipientsArray as $recipientUid) {
|
foreach ($recipientsArray as $recipientUid) {
|
||||||
@@ -238,40 +234,18 @@ class AppNotes extends BaseAppNotes {
|
|||||||
$aUser = $oUser->load( $recipientUid );
|
$aUser = $oUser->load( $recipientUid );
|
||||||
|
|
||||||
$sTo = ((($aUser['USR_FIRSTNAME'] != '') || ($aUser['USR_LASTNAME'] != '')) ? $aUser['USR_FIRSTNAME'] . ' ' . $aUser['USR_LASTNAME'] . ' ' : '') . '<' . $aUser['USR_EMAIL'] . '>';
|
$sTo = ((($aUser['USR_FIRSTNAME'] != '') || ($aUser['USR_LASTNAME'] != '')) ? $aUser['USR_FIRSTNAME'] . ' ' . $aUser['USR_LASTNAME'] . ' ' : '') . '<' . $aUser['USR_EMAIL'] . '>';
|
||||||
|
|
||||||
$oSpool = new spoolRun();
|
$oSpool = new spoolRun();
|
||||||
$oSpool->setConfig(array('MESS_ENGINE' => $aConfiguration['MESS_ENGINE'],
|
$oSpool->setConfig( array ('MESS_ENGINE' => $aConfiguration['MESS_ENGINE'],'MESS_SERVER' => $aConfiguration['MESS_SERVER'],'MESS_PORT' => $aConfiguration['MESS_PORT'],'MESS_ACCOUNT' => $aConfiguration['MESS_ACCOUNT'],'MESS_PASSWORD' => $aConfiguration['MESS_PASSWORD'],'SMTPAuth' => $aConfiguration['MESS_RAUTH'] == '1' ? true : false,'SMTPSecure' => isset( $aConfiguration['SMTPSecure'] ) ? $aConfiguration['SMTPSecure'] : '') );
|
||||||
'MESS_SERVER' => $aConfiguration['MESS_SERVER'],
|
$oSpool->create( array ('msg_uid' => '','app_uid' => $appUid,'del_index' => 1,'app_msg_type' => 'DERIVATION','app_msg_subject' => $sSubject,'app_msg_from' => $sFrom,'app_msg_to' => $sTo,'app_msg_body' => $sBody,'app_msg_cc' => '','app_msg_bcc' => '','app_msg_attach' => '','app_msg_template' => '','app_msg_status' => 'pending') );
|
||||||
'MESS_PORT' => $aConfiguration['MESS_PORT'],
|
|
||||||
'MESS_ACCOUNT' => $aConfiguration['MESS_ACCOUNT'],
|
|
||||||
'MESS_PASSWORD' => $aConfiguration['MESS_PASSWORD'],
|
|
||||||
'SMTPAuth' => $aConfiguration['MESS_RAUTH'] == '1' ? true : false,
|
|
||||||
'SMTPSecure' => isset($aConfiguration['SMTPSecure']) ? $aConfiguration['SMTPSecure'] : ''
|
|
||||||
));
|
|
||||||
$oSpool->create(array('msg_uid' => '',
|
|
||||||
'app_uid' => $appUid,
|
|
||||||
'del_index' => 1,
|
|
||||||
'app_msg_type' => 'DERIVATION',
|
|
||||||
'app_msg_subject' => $sSubject,
|
|
||||||
'app_msg_from' => $sFrom,
|
|
||||||
'app_msg_to' => $sTo,
|
|
||||||
'app_msg_body' => $sBody,
|
|
||||||
'app_msg_cc' => '',
|
|
||||||
'app_msg_bcc' => '',
|
|
||||||
'app_msg_attach' => '',
|
|
||||||
'app_msg_template' => '',
|
|
||||||
'app_msg_status' => 'pending'
|
|
||||||
));
|
|
||||||
if (($aConfiguration['MESS_BACKGROUND'] == '') || ($aConfiguration['MESS_TRY_SEND_INMEDIATLY'] == '1')) {
|
if (($aConfiguration['MESS_BACKGROUND'] == '') || ($aConfiguration['MESS_TRY_SEND_INMEDIATLY'] == '1')) {
|
||||||
$oSpool->sendMail();
|
$oSpool->sendMail();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Send derivation notification - End
|
//Send derivation notification - End
|
||||||
|
|
||||||
} catch (Exception $oException) {
|
} catch (Exception $oException) {
|
||||||
throw $oException;
|
throw $oException;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* FieldCondition.php
|
* FieldCondition.php
|
||||||
|
*
|
||||||
* @package workflow.engine.classes.model
|
* @package workflow.engine.classes.model
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require_once 'classes/model/om/BaseFieldCondition.php';
|
require_once 'classes/model/om/BaseFieldCondition.php';
|
||||||
require_once 'classes/model/Dynaform.php';
|
require_once 'classes/model/Dynaform.php';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Skeleton subclass for representing a row from the 'FIELD_CONDITION' table.
|
* Skeleton subclass for representing a row from the 'FIELD_CONDITION' table.
|
||||||
*
|
*
|
||||||
@@ -19,15 +19,18 @@ require_once 'classes/model/Dynaform.php';
|
|||||||
*
|
*
|
||||||
* @package workflow.engine.classes.model
|
* @package workflow.engine.classes.model
|
||||||
*/
|
*/
|
||||||
class FieldCondition extends BaseFieldCondition {
|
class FieldCondition extends BaseFieldCondition
|
||||||
|
{
|
||||||
|
|
||||||
|
public $oDynaformHandler;
|
||||||
|
|
||||||
var $oDynaformHandler;
|
|
||||||
/**
|
/**
|
||||||
* Quick get all records into a criteria object
|
* Quick get all records into a criteria object
|
||||||
*
|
*
|
||||||
* @author Erik A. Ortiz <erik@colosa.com, aortiz.erik@gmail.com>
|
* @author Erik A. Ortiz <erik@colosa.com, aortiz.erik@gmail.com>
|
||||||
*/
|
*/
|
||||||
public function get( $UID ) {
|
public function get ($UID)
|
||||||
|
{
|
||||||
|
|
||||||
$obj = FieldConditionPeer::retrieveByPk( $UID );
|
$obj = FieldConditionPeer::retrieveByPk( $UID );
|
||||||
if (! isset( $obj )) {
|
if (! isset( $obj )) {
|
||||||
@@ -42,7 +45,8 @@ class FieldCondition extends BaseFieldCondition {
|
|||||||
*
|
*
|
||||||
* @author Erik A. Ortiz <erik@colosa.com, aortiz.erik@gmail.com>
|
* @author Erik A. Ortiz <erik@colosa.com, aortiz.erik@gmail.com>
|
||||||
*/
|
*/
|
||||||
public function getAllCriteriaByDynUid( $DYN_UID, $filter='all' ) {
|
public function getAllCriteriaByDynUid ($DYN_UID, $filter = 'all')
|
||||||
|
{
|
||||||
$oCriteria = new Criteria( 'workflow' );
|
$oCriteria = new Criteria( 'workflow' );
|
||||||
$oCriteria->addSelectColumn( FieldConditionPeer::FCD_UID );
|
$oCriteria->addSelectColumn( FieldConditionPeer::FCD_UID );
|
||||||
$oCriteria->addSelectColumn( FieldConditionPeer::FCD_FUNCTION );
|
$oCriteria->addSelectColumn( FieldConditionPeer::FCD_FUNCTION );
|
||||||
@@ -68,7 +72,8 @@ class FieldCondition extends BaseFieldCondition {
|
|||||||
*
|
*
|
||||||
* @author Erik A. Ortiz <erik@colosa.com, aortiz.erik@gmail.com>
|
* @author Erik A. Ortiz <erik@colosa.com, aortiz.erik@gmail.com>
|
||||||
*/
|
*/
|
||||||
public function getAllByDynUid( $DYN_UID, $filter='all' ) {
|
public function getAllByDynUid ($DYN_UID, $filter = 'all')
|
||||||
|
{
|
||||||
$aRows = Array ();
|
$aRows = Array ();
|
||||||
|
|
||||||
$oCriteria = $this->getAllCriteriaByDynUid( $DYN_UID, $filter );
|
$oCriteria = $this->getAllCriteriaByDynUid( $DYN_UID, $filter );
|
||||||
@@ -90,7 +95,8 @@ class FieldCondition extends BaseFieldCondition {
|
|||||||
*
|
*
|
||||||
* @author Erik A. Ortiz <erik@colosa.com, aortiz.erik@gmail.com>
|
* @author Erik A. Ortiz <erik@colosa.com, aortiz.erik@gmail.com>
|
||||||
*/
|
*/
|
||||||
public function quickSave($aData) {
|
public function quickSave ($aData)
|
||||||
|
{
|
||||||
$con = Propel::getConnection( FieldConditionPeer::DATABASE_NAME );
|
$con = Propel::getConnection( FieldConditionPeer::DATABASE_NAME );
|
||||||
try {
|
try {
|
||||||
$obj = null;
|
$obj = null;
|
||||||
@@ -123,7 +129,8 @@ class FieldCondition extends BaseFieldCondition {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getConditionScript($DYN_UID) {
|
public function getConditionScript ($DYN_UID)
|
||||||
|
{
|
||||||
require_once 'classes/model/Dynaform.php';
|
require_once 'classes/model/Dynaform.php';
|
||||||
G::LoadSystem( 'dynaformhandler' );
|
G::LoadSystem( 'dynaformhandler' );
|
||||||
|
|
||||||
@@ -142,7 +149,6 @@ class FieldCondition extends BaseFieldCondition {
|
|||||||
$sCode = '';
|
$sCode = '';
|
||||||
|
|
||||||
if (sizeof( $aRows ) != 0) {
|
if (sizeof( $aRows ) != 0) {
|
||||||
|
|
||||||
foreach ($aRows as $aRow) {
|
foreach ($aRows as $aRow) {
|
||||||
$hashCond = md5( $aRow['FCD_UID'] );
|
$hashCond = md5( $aRow['FCD_UID'] );
|
||||||
$sCondition = $this->parseCondition( $aRow['FCD_CONDITION'] );
|
$sCondition = $this->parseCondition( $aRow['FCD_CONDITION'] );
|
||||||
@@ -159,31 +165,26 @@ class FieldCondition extends BaseFieldCondition {
|
|||||||
$sCode .= "showRowById('$aField');";
|
$sCode .= "showRowById('$aField');";
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'showOnly':
|
case 'showOnly':
|
||||||
$sCode .= "hideRowsById(Array($sDynaformFieldsAsStrings));";
|
$sCode .= "hideRowsById(Array($sDynaformFieldsAsStrings));";
|
||||||
foreach ($aFields as $aField) {
|
foreach ($aFields as $aField) {
|
||||||
$sCode .= "showRowById('$aField');";
|
$sCode .= "showRowById('$aField');";
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'showAll':
|
case 'showAll':
|
||||||
$sCode .= "showRowsById(Array($sDynaformFieldsAsStrings));";
|
$sCode .= "showRowsById(Array($sDynaformFieldsAsStrings));";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'hide':
|
case 'hide':
|
||||||
foreach ($aFields as $aField) {
|
foreach ($aFields as $aField) {
|
||||||
$sCode .= "hideRowById('$aField');";
|
$sCode .= "hideRowById('$aField');";
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'hideOnly':
|
case 'hideOnly':
|
||||||
$sCode .= "showRowsById(Array($sDynaformFieldsAsStrings));";
|
$sCode .= "showRowsById(Array($sDynaformFieldsAsStrings));";
|
||||||
foreach ($aFields as $aField) {
|
foreach ($aFields as $aField) {
|
||||||
$sCode .= "hideRowById('$aField');";
|
$sCode .= "hideRowById('$aField');";
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'hideAll':
|
case 'hideAll':
|
||||||
$aDynaFields = array ();
|
$aDynaFields = array ();
|
||||||
$aEventOwner = explode( ',', $aRow['FCD_EVENT_OWNERS'] );
|
$aEventOwner = explode( ',', $aRow['FCD_EVENT_OWNERS'] );
|
||||||
@@ -194,7 +195,6 @@ class FieldCondition extends BaseFieldCondition {
|
|||||||
}
|
}
|
||||||
$sDynaformFieldsAsStrings = implode( ',', $aDynaFields );
|
$sDynaformFieldsAsStrings = implode( ',', $aDynaFields );
|
||||||
$sCode .= "hideRowsById(Array($sDynaformFieldsAsStrings));";
|
$sCode .= "hideRowsById(Array($sDynaformFieldsAsStrings));";
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$sCode .= " } ";
|
$sCode .= " } ";
|
||||||
@@ -218,7 +218,6 @@ class FieldCondition extends BaseFieldCondition {
|
|||||||
case 'percentage':
|
case 'percentage':
|
||||||
$sJSEvent = 'blur';
|
$sJSEvent = 'blur';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
$sJSEvent = 'change';
|
$sJSEvent = 'change';
|
||||||
break;
|
break;
|
||||||
@@ -236,14 +235,14 @@ class FieldCondition extends BaseFieldCondition {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return $sCode;
|
return $sCode;
|
||||||
} else {
|
} else {
|
||||||
return NULL;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseCondition($sCondition) {
|
public function parseCondition ($sCondition)
|
||||||
|
{
|
||||||
preg_match_all( '/@#[a-zA-Z0-9_.]+/', $sCondition, $result );
|
preg_match_all( '/@#[a-zA-Z0-9_.]+/', $sCondition, $result );
|
||||||
if (sizeof( $result[0] ) > 0) {
|
if (sizeof( $result[0] ) > 0) {
|
||||||
foreach ($result[0] as $fname) {
|
foreach ($result[0] as $fname) {
|
||||||
@@ -271,16 +270,17 @@ class FieldCondition extends BaseFieldCondition {
|
|||||||
}
|
}
|
||||||
return $sCondition;
|
return $sCondition;
|
||||||
}
|
}
|
||||||
|
public function create ($aData)
|
||||||
public function create($aData) {
|
{
|
||||||
$oConnection = Propel::getConnection( FieldConditionPeer::DATABASE_NAME );
|
$oConnection = Propel::getConnection( FieldConditionPeer::DATABASE_NAME );
|
||||||
try {
|
try {
|
||||||
// $aData['FCD_UID'] = '';
|
// $aData['FCD_UID'] = '';
|
||||||
if ( isset ( $aData['FCD_UID'] ) && $aData['FCD_UID']== '' )
|
if (isset( $aData['FCD_UID'] ) && $aData['FCD_UID'] == '') {
|
||||||
unset( $aData['FCD_UID'] );
|
unset( $aData['FCD_UID'] );
|
||||||
if ( !isset ( $aData['FCD_UID'] ) )
|
}
|
||||||
|
if (! isset( $aData['FCD_UID'] )) {
|
||||||
$aData['FCD_UID'] = G::generateUniqueID();
|
$aData['FCD_UID'] = G::generateUniqueID();
|
||||||
|
}
|
||||||
$oFieldCondition = new FieldCondition();
|
$oFieldCondition = new FieldCondition();
|
||||||
$oFieldCondition->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
|
$oFieldCondition->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
|
||||||
if ($oFieldCondition->validate()) {
|
if ($oFieldCondition->validate()) {
|
||||||
@@ -302,8 +302,8 @@ class FieldCondition extends BaseFieldCondition {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function remove ($sUID)
|
||||||
public function remove($sUID) {
|
{
|
||||||
$oConnection = Propel::getConnection( FieldConditionPeer::DATABASE_NAME );
|
$oConnection = Propel::getConnection( FieldConditionPeer::DATABASE_NAME );
|
||||||
try {
|
try {
|
||||||
$oConnection->begin();
|
$oConnection->begin();
|
||||||
@@ -317,33 +317,35 @@ class FieldCondition extends BaseFieldCondition {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function fieldConditionExists ( $sUid, $aDynaform ) {
|
public function fieldConditionExists ($sUid, $aDynaform)
|
||||||
|
{
|
||||||
try {
|
try {
|
||||||
$found = false;
|
$found = false;
|
||||||
$obj = FieldConditionPeer::retrieveByPk( $sUid );
|
$obj = FieldConditionPeer::retrieveByPk( $sUid );
|
||||||
if (isset( $obj )) {
|
if (isset( $obj )) {
|
||||||
$aFields = $obj->toArray( BasePeer::TYPE_FIELDNAME );
|
$aFields = $obj->toArray( BasePeer::TYPE_FIELDNAME );
|
||||||
foreach ($aDynaform as $key => $row) {
|
foreach ($aDynaform as $key => $row) {
|
||||||
if($row['DYN_UID'] == $aFields['FCD_DYN_UID'])
|
if ($row['DYN_UID'] == $aFields['FCD_DYN_UID']) {
|
||||||
$found = true;
|
$found = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// return( get_class($obj) == 'FieldCondition') ;
|
// return( get_class($obj) == 'FieldCondition') ;
|
||||||
return ($found);
|
return ($found);
|
||||||
}
|
} catch (Exception $oError) {
|
||||||
catch (Exception $oError) {
|
|
||||||
throw ($oError);
|
throw ($oError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function Exists ( $sUid ) {
|
public function Exists ($sUid)
|
||||||
|
{
|
||||||
try {
|
try {
|
||||||
$obj = FieldConditionPeer::retrieveByPk( $sUid );
|
$obj = FieldConditionPeer::retrieveByPk( $sUid );
|
||||||
return (is_object( $obj ) && get_class( $obj ) == 'FieldCondition');
|
return (is_object( $obj ) && get_class( $obj ) == 'FieldCondition');
|
||||||
}
|
} catch (Exception $oError) {
|
||||||
catch (Exception $oError) {
|
|
||||||
throw ($oError);
|
throw ($oError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
// FieldCondition
|
||||||
|
|
||||||
} // FieldCondition
|
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Gateway.php
|
* Gateway.php
|
||||||
|
*
|
||||||
* @package workflow.engine.classes.model
|
* @package workflow.engine.classes.model
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require_once 'classes/model/om/BaseGateway.php';
|
require_once 'classes/model/om/BaseGateway.php';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Skeleton subclass for representing a row from the 'GATEWAY' table.
|
* Skeleton subclass for representing a row from the 'GATEWAY' table.
|
||||||
*
|
*
|
||||||
@@ -18,7 +18,8 @@ require_once 'classes/model/om/BaseGateway.php';
|
|||||||
*
|
*
|
||||||
* @package workflow.engine.classes.model
|
* @package workflow.engine.classes.model
|
||||||
*/
|
*/
|
||||||
class Gateway extends BaseGateway {
|
class Gateway extends BaseGateway
|
||||||
|
{
|
||||||
|
|
||||||
public function create ($aData)
|
public function create ($aData)
|
||||||
{
|
{
|
||||||
@@ -33,8 +34,7 @@ class Gateway extends BaseGateway {
|
|||||||
$iResult = $oGateway->save();
|
$iResult = $oGateway->save();
|
||||||
$oConnection->commit();
|
$oConnection->commit();
|
||||||
return $sGatewayUID;
|
return $sGatewayUID;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$sMessage = '';
|
$sMessage = '';
|
||||||
$aValidationFailures = $oGateway->getValidationFailures();
|
$aValidationFailures = $oGateway->getValidationFailures();
|
||||||
foreach ($aValidationFailures as $oValidationFailure) {
|
foreach ($aValidationFailures as $oValidationFailure) {
|
||||||
@@ -42,8 +42,7 @@ class Gateway extends BaseGateway {
|
|||||||
}
|
}
|
||||||
throw (new Exception( 'The registry cannot be created!<br />' . $sMessage ));
|
throw (new Exception( 'The registry cannot be created!<br />' . $sMessage ));
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception $oError) {
|
||||||
catch (Exception $oError) {
|
|
||||||
$oConnection->rollback();
|
$oConnection->rollback();
|
||||||
throw ($oError);
|
throw ($oError);
|
||||||
}
|
}
|
||||||
@@ -53,18 +52,15 @@ class Gateway extends BaseGateway {
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$oRow = GatewayPeer::retrieveByPK( $GatewayUid );
|
$oRow = GatewayPeer::retrieveByPK( $GatewayUid );
|
||||||
if (!is_null($oRow))
|
if (! is_null( $oRow )) {
|
||||||
{
|
|
||||||
$aFields = $oRow->toArray( BasePeer::TYPE_FIELDNAME );
|
$aFields = $oRow->toArray( BasePeer::TYPE_FIELDNAME );
|
||||||
$this->fromArray( $aFields, BasePeer::TYPE_FIELDNAME );
|
$this->fromArray( $aFields, BasePeer::TYPE_FIELDNAME );
|
||||||
$this->setNew( false );
|
$this->setNew( false );
|
||||||
return $aFields;
|
return $aFields;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
throw (new Exception( "The row '" . $GatewayUid . "' in table Gateway doesn't exist!" ));
|
throw (new Exception( "The row '" . $GatewayUid . "' in table Gateway doesn't exist!" ));
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception $oError) {
|
||||||
catch (Exception $oError) {
|
|
||||||
throw ($oError);
|
throw ($oError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -72,25 +68,19 @@ class Gateway extends BaseGateway {
|
|||||||
public function update ($fields)
|
public function update ($fields)
|
||||||
{
|
{
|
||||||
$con = Propel::getConnection( GatewayPeer::DATABASE_NAME );
|
$con = Propel::getConnection( GatewayPeer::DATABASE_NAME );
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
$con->begin();
|
$con->begin();
|
||||||
$this->load( $fields['GAT_UID'] );
|
$this->load( $fields['GAT_UID'] );
|
||||||
$this->fromArray( $fields, BasePeer::TYPE_FIELDNAME );
|
$this->fromArray( $fields, BasePeer::TYPE_FIELDNAME );
|
||||||
if($this->validate())
|
if ($this->validate()) {
|
||||||
{
|
|
||||||
$result = $this->save();
|
$result = $this->save();
|
||||||
$con->commit();
|
$con->commit();
|
||||||
return $result;
|
return $result;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$con->rollback();
|
$con->rollback();
|
||||||
throw (new Exception( "Failed Validation in class " . get_class( $this ) . "." ));
|
throw (new Exception( "Failed Validation in class " . get_class( $this ) . "." ));
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception $e) {
|
||||||
catch(Exception $e)
|
|
||||||
{
|
|
||||||
$con->rollback();
|
$con->rollback();
|
||||||
throw ($e);
|
throw ($e);
|
||||||
}
|
}
|
||||||
@@ -101,19 +91,16 @@ class Gateway extends BaseGateway {
|
|||||||
$oConnection = Propel::getConnection( GatewayPeer::DATABASE_NAME );
|
$oConnection = Propel::getConnection( GatewayPeer::DATABASE_NAME );
|
||||||
try {
|
try {
|
||||||
$oGateWay = GatewayPeer::retrieveByPK( $GatewayUid );
|
$oGateWay = GatewayPeer::retrieveByPK( $GatewayUid );
|
||||||
if (!is_null($oGateWay))
|
if (! is_null( $oGateWay )) {
|
||||||
{
|
|
||||||
$oConnection->begin();
|
$oConnection->begin();
|
||||||
$iResult = $oGateWay->delete();
|
$iResult = $oGateWay->delete();
|
||||||
$oConnection->commit();
|
$oConnection->commit();
|
||||||
//return $iResult;
|
//return $iResult;
|
||||||
return true;
|
return true;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
throw (new Exception( 'This row does not exist!' ));
|
throw (new Exception( 'This row does not exist!' ));
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception $oError) {
|
||||||
catch (Exception $oError) {
|
|
||||||
$oConnection->rollback();
|
$oConnection->rollback();
|
||||||
throw ($oError);
|
throw ($oError);
|
||||||
}
|
}
|
||||||
@@ -125,18 +112,17 @@ class Gateway extends BaseGateway {
|
|||||||
* @param string $sProUid the uid of the Prolication
|
* @param string $sProUid the uid of the Prolication
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function gatewayExists ( $GatUid ) {
|
public function gatewayExists ($GatUid)
|
||||||
|
{
|
||||||
$con = Propel::getConnection( GatewayPeer::DATABASE_NAME );
|
$con = Propel::getConnection( GatewayPeer::DATABASE_NAME );
|
||||||
try {
|
try {
|
||||||
$oPro = GatewayPeer::retrieveByPk( $GatUid );
|
$oPro = GatewayPeer::retrieveByPk( $GatUid );
|
||||||
if (is_object( $oPro ) && get_class( $oPro ) == 'Gateway') {
|
if (is_object( $oPro ) && get_class( $oPro ) == 'Gateway') {
|
||||||
return true;
|
return true;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception $oError) {
|
||||||
catch (Exception $oError) {
|
|
||||||
throw ($oError);
|
throw ($oError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -147,16 +133,14 @@ class Gateway extends BaseGateway {
|
|||||||
* @param array $aData with new values
|
* @param array $aData with new values
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function createRow($aData)
|
public function createRow ($aData)
|
||||||
{
|
{
|
||||||
$con = Propel::getConnection( GatewayPeer::DATABASE_NAME );
|
$con = Propel::getConnection( GatewayPeer::DATABASE_NAME );
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
$con->begin();
|
$con->begin();
|
||||||
|
|
||||||
$this->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
|
$this->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
|
||||||
if($this->validate())
|
if ($this->validate()) {
|
||||||
{
|
|
||||||
$this->setGatUid( (isset( $aData['GAT_UID'] ) ? $aData['GAT_UID'] : '') );
|
$this->setGatUid( (isset( $aData['GAT_UID'] ) ? $aData['GAT_UID'] : '') );
|
||||||
$this->setProUid( (isset( $aData['PRO_UID'] ) ? $aData['PRO_UID'] : '') );
|
$this->setProUid( (isset( $aData['PRO_UID'] ) ? $aData['PRO_UID'] : '') );
|
||||||
$this->setTasUid( (isset( $aData['TAS_UID'] ) ? $aData['TAS_UID'] : '') );
|
$this->setTasUid( (isset( $aData['TAS_UID'] ) ? $aData['TAS_UID'] : '') );
|
||||||
@@ -166,20 +150,17 @@ class Gateway extends BaseGateway {
|
|||||||
$this->save();
|
$this->save();
|
||||||
$con->commit();
|
$con->commit();
|
||||||
return;
|
return;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$con->rollback();
|
$con->rollback();
|
||||||
$e = new Exception( "Failed Validation in class " . get_class( $this ) . "." );
|
$e = new Exception( "Failed Validation in class " . get_class( $this ) . "." );
|
||||||
$e->aValidationFailures = $this->getValidationFailures();
|
$e->aValidationFailures = $this->getValidationFailures();
|
||||||
throw ($e);
|
throw ($e);
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception $e) {
|
||||||
catch(Exception $e)
|
|
||||||
{
|
|
||||||
$con->rollback();
|
$con->rollback();
|
||||||
throw ($e);
|
throw ($e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
// Gateway
|
||||||
|
|
||||||
} // Gateway
|
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* ReportVar.php
|
* ReportVar.php
|
||||||
|
*
|
||||||
* @package workflow.engine.classes.model
|
* @package workflow.engine.classes.model
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require_once 'classes/model/om/BaseReportVar.php';
|
require_once 'classes/model/om/BaseReportVar.php';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Skeleton subclass for representing a row from the 'REPORT_VAR' table.
|
* Skeleton subclass for representing a row from the 'REPORT_VAR' table.
|
||||||
*
|
*
|
||||||
@@ -18,7 +18,8 @@ require_once 'classes/model/om/BaseReportVar.php';
|
|||||||
*
|
*
|
||||||
* @package workflow.engine.classes.model
|
* @package workflow.engine.classes.model
|
||||||
*/
|
*/
|
||||||
class ReportVar extends BaseReportVar {
|
class ReportVar extends BaseReportVar
|
||||||
|
{
|
||||||
/*
|
/*
|
||||||
* Load the report var registry
|
* Load the report var registry
|
||||||
* @param string $sRepVarUid
|
* @param string $sRepVarUid
|
||||||
@@ -28,34 +29,35 @@ class ReportVar extends BaseReportVar {
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$oReportVar = ReportVarPeer::retrieveByPK( $sRepVarUid );
|
$oReportVar = ReportVarPeer::retrieveByPK( $sRepVarUid );
|
||||||
if (!is_null($oReportVar))
|
if (! is_null( $oReportVar )) {
|
||||||
{
|
|
||||||
$aFields = $oReportVar->toArray( BasePeer::TYPE_FIELDNAME );
|
$aFields = $oReportVar->toArray( BasePeer::TYPE_FIELDNAME );
|
||||||
$this->fromArray( $aFields, BasePeer::TYPE_FIELDNAME );
|
$this->fromArray( $aFields, BasePeer::TYPE_FIELDNAME );
|
||||||
return $aFields;
|
return $aFields;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
throw (new Exception( 'This row doesn\'t exist!' ));
|
throw (new Exception( 'This row doesn\'t exist!' ));
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception $oError) {
|
||||||
catch (Exception $oError) {
|
|
||||||
throw ($oError);
|
throw ($oError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create the report var registry
|
* Create the report var registry
|
||||||
|
*
|
||||||
* @param array $aData
|
* @param array $aData
|
||||||
* @return string
|
* @return string
|
||||||
**/
|
*
|
||||||
|
*/
|
||||||
public function create ($aData)
|
public function create ($aData)
|
||||||
{
|
{
|
||||||
$oConnection = Propel::getConnection( ReportVarPeer::DATABASE_NAME );
|
$oConnection = Propel::getConnection( ReportVarPeer::DATABASE_NAME );
|
||||||
try {
|
try {
|
||||||
if ( isset ( $aData['REP_VAR_UID'] ) && $aData['REP_VAR_UID']== '' )
|
if (isset( $aData['REP_VAR_UID'] ) && $aData['REP_VAR_UID'] == '') {
|
||||||
unset( $aData['REP_VAR_UID'] );
|
unset( $aData['REP_VAR_UID'] );
|
||||||
if ( !isset ( $aData['REP_VAR_UID'] ) )
|
}
|
||||||
|
if (! isset( $aData['REP_VAR_UID'] )) {
|
||||||
$aData['REP_VAR_UID'] = G::generateUniqueID();
|
$aData['REP_VAR_UID'] = G::generateUniqueID();
|
||||||
|
}
|
||||||
$oReportVar = new ReportVar();
|
$oReportVar = new ReportVar();
|
||||||
$oReportVar->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
|
$oReportVar->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
|
||||||
if ($oReportVar->validate()) {
|
if ($oReportVar->validate()) {
|
||||||
@@ -63,8 +65,7 @@ class ReportVar extends BaseReportVar {
|
|||||||
$iResult = $oReportVar->save();
|
$iResult = $oReportVar->save();
|
||||||
$oConnection->commit();
|
$oConnection->commit();
|
||||||
return $aData['REP_VAR_UID'];
|
return $aData['REP_VAR_UID'];
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$sMessage = '';
|
$sMessage = '';
|
||||||
$aValidationFailures = $oReportVar->getValidationFailures();
|
$aValidationFailures = $oReportVar->getValidationFailures();
|
||||||
foreach ($aValidationFailures as $oValidationFailure) {
|
foreach ($aValidationFailures as $oValidationFailure) {
|
||||||
@@ -72,8 +73,7 @@ class ReportVar extends BaseReportVar {
|
|||||||
}
|
}
|
||||||
throw (new Exception( 'The registry cannot be created!<br />' . $sMessage ));
|
throw (new Exception( 'The registry cannot be created!<br />' . $sMessage ));
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception $oError) {
|
||||||
catch (Exception $oError) {
|
|
||||||
$oConnection->rollback();
|
$oConnection->rollback();
|
||||||
throw ($oError);
|
throw ($oError);
|
||||||
}
|
}
|
||||||
@@ -81,24 +81,24 @@ class ReportVar extends BaseReportVar {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the report var registry
|
* Update the report var registry
|
||||||
|
*
|
||||||
* @param array $aData
|
* @param array $aData
|
||||||
* @return string
|
* @return string
|
||||||
**/
|
*
|
||||||
|
*/
|
||||||
public function update ($aData)
|
public function update ($aData)
|
||||||
{
|
{
|
||||||
$oConnection = Propel::getConnection( ReportVarPeer::DATABASE_NAME );
|
$oConnection = Propel::getConnection( ReportVarPeer::DATABASE_NAME );
|
||||||
try {
|
try {
|
||||||
$oReportVar = ReportVarPeer::retrieveByPK( $aData['REP_VAR_UID'] );
|
$oReportVar = ReportVarPeer::retrieveByPK( $aData['REP_VAR_UID'] );
|
||||||
if (!is_null($oReportVar))
|
if (! is_null( $oReportVar )) {
|
||||||
{
|
|
||||||
$oReportVar->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
|
$oReportVar->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
|
||||||
if ($oReportVar->validate()) {
|
if ($oReportVar->validate()) {
|
||||||
$oConnection->begin();
|
$oConnection->begin();
|
||||||
$iResult = $oReportVar->save();
|
$iResult = $oReportVar->save();
|
||||||
$oConnection->commit();
|
$oConnection->commit();
|
||||||
return $iResult;
|
return $iResult;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$sMessage = '';
|
$sMessage = '';
|
||||||
$aValidationFailures = $oReportVar->getValidationFailures();
|
$aValidationFailures = $oReportVar->getValidationFailures();
|
||||||
foreach ($aValidationFailures as $oValidationFailure) {
|
foreach ($aValidationFailures as $oValidationFailure) {
|
||||||
@@ -106,12 +106,10 @@ class ReportVar extends BaseReportVar {
|
|||||||
}
|
}
|
||||||
throw (new Exception( 'The registry cannot be updated!<br />' . $sMessage ));
|
throw (new Exception( 'The registry cannot be updated!<br />' . $sMessage ));
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
throw (new Exception( 'This row doesn\'t exist!' ));
|
throw (new Exception( 'This row doesn\'t exist!' ));
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception $oError) {
|
||||||
catch (Exception $oError) {
|
|
||||||
$oConnection->rollback();
|
$oConnection->rollback();
|
||||||
throw ($oError);
|
throw ($oError);
|
||||||
}
|
}
|
||||||
@@ -119,44 +117,44 @@ class ReportVar extends BaseReportVar {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove the report var registry
|
* Remove the report var registry
|
||||||
|
*
|
||||||
* @param array $aData
|
* @param array $aData
|
||||||
* @return string
|
* @return string
|
||||||
**/
|
*
|
||||||
|
*/
|
||||||
public function remove ($sRepVarUid)
|
public function remove ($sRepVarUid)
|
||||||
{
|
{
|
||||||
$oConnection = Propel::getConnection( ReportVarPeer::DATABASE_NAME );
|
$oConnection = Propel::getConnection( ReportVarPeer::DATABASE_NAME );
|
||||||
try {
|
try {
|
||||||
$oReportVar = ReportVarPeer::retrieveByPK( $sRepVarUid );
|
$oReportVar = ReportVarPeer::retrieveByPK( $sRepVarUid );
|
||||||
if (!is_null($oReportVar))
|
if (! is_null( $oReportVar )) {
|
||||||
{
|
|
||||||
$oConnection->begin();
|
$oConnection->begin();
|
||||||
$iResult = $oReportVar->delete();
|
$iResult = $oReportVar->delete();
|
||||||
$oConnection->commit();
|
$oConnection->commit();
|
||||||
return $iResult;
|
return $iResult;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
throw (new Exception( 'This row doesn\'t exist!' ));
|
throw (new Exception( 'This row doesn\'t exist!' ));
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception $oError) {
|
||||||
catch (Exception $oError) {
|
|
||||||
$oConnection->rollback();
|
$oConnection->rollback();
|
||||||
throw ($oError);
|
throw ($oError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function reportVarExists ( $sRepVarUid ) {
|
public function reportVarExists ($sRepVarUid)
|
||||||
|
{
|
||||||
$con = Propel::getConnection( ReportVarPeer::DATABASE_NAME );
|
$con = Propel::getConnection( ReportVarPeer::DATABASE_NAME );
|
||||||
try {
|
try {
|
||||||
$oRepVarUid = ReportVarPeer::retrieveByPk( $sRepVarUid );
|
$oRepVarUid = ReportVarPeer::retrieveByPk( $sRepVarUid );
|
||||||
if (is_object( $oRepVarUid ) && get_class( $oRepVarUid ) == 'ReportVar') {
|
if (is_object( $oRepVarUid ) && get_class( $oRepVarUid ) == 'ReportVar') {
|
||||||
return true;
|
return true;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception $oError) {
|
||||||
catch (Exception $oError) {
|
|
||||||
throw ($oError);
|
throw ($oError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // ReportVar
|
}
|
||||||
|
// ReportVar
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* SubProcess.php
|
* SubProcess.php
|
||||||
|
*
|
||||||
* @package workflow.engine.classes.model
|
* @package workflow.engine.classes.model
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require_once 'classes/model/om/BaseSubProcess.php';
|
require_once 'classes/model/om/BaseSubProcess.php';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Skeleton subclass for representing a row from the 'SUB_PROCESS' table.
|
* Skeleton subclass for representing a row from the 'SUB_PROCESS' table.
|
||||||
*
|
*
|
||||||
@@ -18,24 +18,22 @@ require_once 'classes/model/om/BaseSubProcess.php';
|
|||||||
*
|
*
|
||||||
* @package workflow.engine.classes.model
|
* @package workflow.engine.classes.model
|
||||||
*/
|
*/
|
||||||
class SubProcess extends BaseSubProcess {
|
class SubProcess extends BaseSubProcess
|
||||||
|
{
|
||||||
|
|
||||||
public function load ($SP_UID)
|
public function load ($SP_UID)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$oRow = SubProcessPeer::retrieveByPK( $SP_UID );
|
$oRow = SubProcessPeer::retrieveByPK( $SP_UID );
|
||||||
if (!is_null($oRow))
|
if (! is_null( $oRow )) {
|
||||||
{
|
|
||||||
$aFields = $oRow->toArray( BasePeer::TYPE_FIELDNAME );
|
$aFields = $oRow->toArray( BasePeer::TYPE_FIELDNAME );
|
||||||
$this->fromArray( $aFields, BasePeer::TYPE_FIELDNAME );
|
$this->fromArray( $aFields, BasePeer::TYPE_FIELDNAME );
|
||||||
$this->setNew( false );
|
$this->setNew( false );
|
||||||
return $aFields;
|
return $aFields;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
throw (new Exception( "The row '$SP_UID' in table SubProcess doesn't exist!" ));
|
throw (new Exception( "The row '$SP_UID' in table SubProcess doesn't exist!" ));
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception $oError) {
|
||||||
catch (Exception $oError) {
|
|
||||||
throw ($oError);
|
throw ($oError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -43,15 +41,16 @@ class SubProcess extends BaseSubProcess {
|
|||||||
public function create ($aData)
|
public function create ($aData)
|
||||||
{
|
{
|
||||||
$con = Propel::getConnection( SubProcessPeer::DATABASE_NAME );
|
$con = Propel::getConnection( SubProcessPeer::DATABASE_NAME );
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
$con->begin();
|
$con->begin();
|
||||||
if ( isset ( $aData['SP_UID'] ) && $aData['SP_UID']== '' )
|
if (isset( $aData['SP_UID'] ) && $aData['SP_UID'] == '') {
|
||||||
unset( $aData['SP_UID'] );
|
unset( $aData['SP_UID'] );
|
||||||
if ( !isset ( $aData['SP_UID'] ) )
|
}
|
||||||
|
if (! isset( $aData['SP_UID'] )) {
|
||||||
$this->setSpUid( G::generateUniqueID() );
|
$this->setSpUid( G::generateUniqueID() );
|
||||||
else
|
} else {
|
||||||
$this->setSpUid( $aData['SP_UID'] );
|
$this->setSpUid( $aData['SP_UID'] );
|
||||||
|
}
|
||||||
|
|
||||||
$this->setProUid( $aData['PRO_UID'] );
|
$this->setProUid( $aData['PRO_UID'] );
|
||||||
|
|
||||||
@@ -75,57 +74,47 @@ class SubProcess extends BaseSubProcess {
|
|||||||
|
|
||||||
$this->setSpGridIn( $aData['SP_GRID_IN'] );
|
$this->setSpGridIn( $aData['SP_GRID_IN'] );
|
||||||
|
|
||||||
if($this->validate())
|
if ($this->validate()) {
|
||||||
{
|
|
||||||
$result = $this->save();
|
$result = $this->save();
|
||||||
$con->commit();
|
$con->commit();
|
||||||
return $result;
|
return $result;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$con->rollback();
|
$con->rollback();
|
||||||
throw (new Exception( "Failed Validation in class " . get_class( $this ) . "." ));
|
throw (new Exception( "Failed Validation in class " . get_class( $this ) . "." ));
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception $e) {
|
||||||
catch(Exception $e)
|
|
||||||
{
|
|
||||||
$con->rollback();
|
$con->rollback();
|
||||||
throw ($e);
|
throw ($e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function update ($fields)
|
public function update ($fields)
|
||||||
{
|
{
|
||||||
$con = Propel::getConnection( SubProcessPeer::DATABASE_NAME );
|
$con = Propel::getConnection( SubProcessPeer::DATABASE_NAME );
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
$con->begin();
|
$con->begin();
|
||||||
$this->load( $fields['SP_UID'] );
|
$this->load( $fields['SP_UID'] );
|
||||||
$this->fromArray( $fields, BasePeer::TYPE_FIELDNAME );
|
$this->fromArray( $fields, BasePeer::TYPE_FIELDNAME );
|
||||||
if($this->validate())
|
if ($this->validate()) {
|
||||||
{
|
|
||||||
$result = $this->save();
|
$result = $this->save();
|
||||||
$con->commit();
|
$con->commit();
|
||||||
return $result;
|
return $result;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$con->rollback();
|
$con->rollback();
|
||||||
$validationE = new Exception( "Failed Validation in class " . get_class( $this ) . "." );
|
$validationE = new Exception( "Failed Validation in class " . get_class( $this ) . "." );
|
||||||
$validationE->aValidationFailures = $this->getValidationFailures();
|
$validationE->aValidationFailures = $this->getValidationFailures();
|
||||||
throw ($validationE);
|
throw ($validationE);
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception $e) {
|
||||||
catch(Exception $e)
|
|
||||||
{
|
|
||||||
$con->rollback();
|
$con->rollback();
|
||||||
throw ($e);
|
throw ($e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function remove ($SP_UID)
|
public function remove ($SP_UID)
|
||||||
{
|
{
|
||||||
$con = Propel::getConnection( SubProcessPeer::DATABASE_NAME );
|
$con = Propel::getConnection( SubProcessPeer::DATABASE_NAME );
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
$con->begin();
|
$con->begin();
|
||||||
$oRepTab = SubProcessPeer::retrieveByPK( $SP_UID );
|
$oRepTab = SubProcessPeer::retrieveByPK( $SP_UID );
|
||||||
if (! is_null( $oRepTab )) {
|
if (! is_null( $oRepTab )) {
|
||||||
@@ -133,9 +122,7 @@ class SubProcess extends BaseSubProcess {
|
|||||||
$con->commit();
|
$con->commit();
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
} catch (Exception $e) {
|
||||||
catch(Exception $e)
|
|
||||||
{
|
|
||||||
$con->rollback();
|
$con->rollback();
|
||||||
throw ($e);
|
throw ($e);
|
||||||
}
|
}
|
||||||
@@ -147,20 +134,20 @@ class SubProcess extends BaseSubProcess {
|
|||||||
* @param string $sUid the uid of the Prolication
|
* @param string $sUid the uid of the Prolication
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function subProcessExists ( $sUid ) {
|
public function subProcessExists ($sUid)
|
||||||
|
{
|
||||||
$con = Propel::getConnection( SubProcessPeer::DATABASE_NAME );
|
$con = Propel::getConnection( SubProcessPeer::DATABASE_NAME );
|
||||||
try {
|
try {
|
||||||
$oObj = SubProcessPeer::retrieveByPk( $sUid );
|
$oObj = SubProcessPeer::retrieveByPk( $sUid );
|
||||||
if (is_object( $oObj ) && get_class( $oObj ) == 'SubProcess') {
|
if (is_object( $oObj ) && get_class( $oObj ) == 'SubProcess') {
|
||||||
return true;
|
return true;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception $oError) {
|
||||||
catch (Exception $oError) {
|
|
||||||
throw ($oError);
|
throw ($oError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
// SubProcess
|
||||||
|
|
||||||
} // SubProcess
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* SwimlanesElements.php
|
* SwimlanesElements.php
|
||||||
|
*
|
||||||
* @package workflow.engine.classes.model
|
* @package workflow.engine.classes.model
|
||||||
*
|
*
|
||||||
* ProcessMaker Open Source Edition
|
* ProcessMaker Open Source Edition
|
||||||
@@ -38,10 +39,12 @@ require_once 'classes/model/Content.php';
|
|||||||
*
|
*
|
||||||
* @package workflow.engine.classes.model
|
* @package workflow.engine.classes.model
|
||||||
*/
|
*/
|
||||||
class SwimlanesElements extends BaseSwimlanesElements {
|
class SwimlanesElements extends BaseSwimlanesElements
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This value goes in the content table
|
* This value goes in the content table
|
||||||
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $swi_text = '';
|
protected $swi_text = '';
|
||||||
@@ -55,27 +58,26 @@ class SwimlanesElements extends BaseSwimlanesElements {
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$oSwimlanesElements = SwimlanesElementsPeer::retrieveByPK( $sSwiEleUid );
|
$oSwimlanesElements = SwimlanesElementsPeer::retrieveByPK( $sSwiEleUid );
|
||||||
if (!is_null($oSwimlanesElements))
|
if (! is_null( $oSwimlanesElements )) {
|
||||||
{
|
|
||||||
$aFields = $oSwimlanesElements->toArray( BasePeer::TYPE_FIELDNAME );
|
$aFields = $oSwimlanesElements->toArray( BasePeer::TYPE_FIELDNAME );
|
||||||
$aFields['SWI_TEXT'] = $oSwimlanesElements->getSwiEleText();
|
$aFields['SWI_TEXT'] = $oSwimlanesElements->getSwiEleText();
|
||||||
$this->fromArray( $aFields, BasePeer::TYPE_FIELDNAME );
|
$this->fromArray( $aFields, BasePeer::TYPE_FIELDNAME );
|
||||||
return $aFields;
|
return $aFields;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
throw (new Exception( 'This row doesn\'t exist!' ));
|
throw (new Exception( 'This row doesn\'t exist!' ));
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception $oError) {
|
||||||
catch (Exception $oError) {
|
|
||||||
throw ($oError);
|
throw ($oError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create the application document registry
|
* Create the application document registry
|
||||||
|
*
|
||||||
* @param array $aData
|
* @param array $aData
|
||||||
* @return string
|
* @return string
|
||||||
**/
|
*
|
||||||
|
*/
|
||||||
public function create ($aData)
|
public function create ($aData)
|
||||||
{
|
{
|
||||||
$oConnection = Propel::getConnection( SwimlanesElementsPeer::DATABASE_NAME );
|
$oConnection = Propel::getConnection( SwimlanesElementsPeer::DATABASE_NAME );
|
||||||
@@ -91,8 +93,7 @@ class SwimlanesElements extends BaseSwimlanesElements {
|
|||||||
$iResult = $oSwimlanesElements->save();
|
$iResult = $oSwimlanesElements->save();
|
||||||
$oConnection->commit();
|
$oConnection->commit();
|
||||||
return $aData['SWI_UID'];
|
return $aData['SWI_UID'];
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$sMessage = '';
|
$sMessage = '';
|
||||||
$aValidationFailures = $oSwimlanesElements->getValidationFailures();
|
$aValidationFailures = $oSwimlanesElements->getValidationFailures();
|
||||||
foreach ($aValidationFailures as $oValidationFailure) {
|
foreach ($aValidationFailures as $oValidationFailure) {
|
||||||
@@ -100,8 +101,7 @@ class SwimlanesElements extends BaseSwimlanesElements {
|
|||||||
}
|
}
|
||||||
throw (new Exception( 'The registry cannot be created!<br />' . $sMessage ));
|
throw (new Exception( 'The registry cannot be created!<br />' . $sMessage ));
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception $oError) {
|
||||||
catch (Exception $oError) {
|
|
||||||
$oConnection->rollback();
|
$oConnection->rollback();
|
||||||
throw ($oError);
|
throw ($oError);
|
||||||
}
|
}
|
||||||
@@ -109,28 +109,27 @@ class SwimlanesElements extends BaseSwimlanesElements {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the application document registry
|
* Update the application document registry
|
||||||
|
*
|
||||||
* @param array $aData
|
* @param array $aData
|
||||||
* @return string
|
* @return string
|
||||||
**/
|
*
|
||||||
|
*/
|
||||||
public function update ($aData)
|
public function update ($aData)
|
||||||
{
|
{
|
||||||
$oConnection = Propel::getConnection( SwimlanesElementsPeer::DATABASE_NAME );
|
$oConnection = Propel::getConnection( SwimlanesElementsPeer::DATABASE_NAME );
|
||||||
try {
|
try {
|
||||||
$oSwimlanesElements = SwimlanesElementsPeer::retrieveByPK( $aData['SWI_UID'] );
|
$oSwimlanesElements = SwimlanesElementsPeer::retrieveByPK( $aData['SWI_UID'] );
|
||||||
if (!is_null($oSwimlanesElements))
|
if (! is_null( $oSwimlanesElements )) {
|
||||||
{
|
|
||||||
$oSwimlanesElements->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
|
$oSwimlanesElements->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
|
||||||
if ($oSwimlanesElements->validate()) {
|
if ($oSwimlanesElements->validate()) {
|
||||||
$oConnection->begin();
|
$oConnection->begin();
|
||||||
if (isset($aData['SWI_TEXT']))
|
if (isset( $aData['SWI_TEXT'] )) {
|
||||||
{
|
|
||||||
$oSwimlanesElements->setSwiEleText( $aData['SWI_TEXT'] );
|
$oSwimlanesElements->setSwiEleText( $aData['SWI_TEXT'] );
|
||||||
}
|
}
|
||||||
$iResult = $oSwimlanesElements->save();
|
$iResult = $oSwimlanesElements->save();
|
||||||
$oConnection->commit();
|
$oConnection->commit();
|
||||||
return $iResult;
|
return $iResult;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$sMessage = '';
|
$sMessage = '';
|
||||||
$aValidationFailures = $oSwimlanesElements->getValidationFailures();
|
$aValidationFailures = $oSwimlanesElements->getValidationFailures();
|
||||||
foreach ($aValidationFailures as $oValidationFailure) {
|
foreach ($aValidationFailures as $oValidationFailure) {
|
||||||
@@ -138,12 +137,10 @@ class SwimlanesElements extends BaseSwimlanesElements {
|
|||||||
}
|
}
|
||||||
throw (new Exception( 'The registry cannot be updated!<br />' . $sMessage ));
|
throw (new Exception( 'The registry cannot be updated!<br />' . $sMessage ));
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
throw (new Exception( 'This row doesn\'t exist!' ));
|
throw (new Exception( 'This row doesn\'t exist!' ));
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception $oError) {
|
||||||
catch (Exception $oError) {
|
|
||||||
$oConnection->rollback();
|
$oConnection->rollback();
|
||||||
throw ($oError);
|
throw ($oError);
|
||||||
}
|
}
|
||||||
@@ -151,50 +148,49 @@ class SwimlanesElements extends BaseSwimlanesElements {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove the application document registry
|
* Remove the application document registry
|
||||||
|
*
|
||||||
* @param array $aData
|
* @param array $aData
|
||||||
* @return string
|
* @return string
|
||||||
**/
|
*
|
||||||
|
*/
|
||||||
public function remove ($sSwiEleUid)
|
public function remove ($sSwiEleUid)
|
||||||
{
|
{
|
||||||
$oConnection = Propel::getConnection( SwimlanesElementsPeer::DATABASE_NAME );
|
$oConnection = Propel::getConnection( SwimlanesElementsPeer::DATABASE_NAME );
|
||||||
try {
|
try {
|
||||||
$oSwimlanesElements = SwimlanesElementsPeer::retrieveByPK( $sSwiEleUid );
|
$oSwimlanesElements = SwimlanesElementsPeer::retrieveByPK( $sSwiEleUid );
|
||||||
if (!is_null($oSwimlanesElements))
|
if (! is_null( $oSwimlanesElements )) {
|
||||||
{
|
|
||||||
$oConnection->begin();
|
$oConnection->begin();
|
||||||
Content::removeContent( 'SWI_TEXT', '', $oSwimlanesElements->getSwiUid() );
|
Content::removeContent( 'SWI_TEXT', '', $oSwimlanesElements->getSwiUid() );
|
||||||
$iResult = $oSwimlanesElements->delete();
|
$iResult = $oSwimlanesElements->delete();
|
||||||
$oConnection->commit();
|
$oConnection->commit();
|
||||||
return $iResult;
|
return $iResult;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
throw (new Exception( 'This row doesn\'t exist!' ));
|
throw (new Exception( 'This row doesn\'t exist!' ));
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception $oError) {
|
||||||
catch (Exception $oError) {
|
|
||||||
$oConnection->rollback();
|
$oConnection->rollback();
|
||||||
throw ($oError);
|
throw ($oError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function swimlanesElementsExists ( $sSwiEleUid ) {
|
public function swimlanesElementsExists ($sSwiEleUid)
|
||||||
|
{
|
||||||
$con = Propel::getConnection( SwimlanesElementsPeer::DATABASE_NAME );
|
$con = Propel::getConnection( SwimlanesElementsPeer::DATABASE_NAME );
|
||||||
try {
|
try {
|
||||||
$oSwiEleUid = SwimlanesElementsPeer::retrieveByPk( $sSwiEleUid );
|
$oSwiEleUid = SwimlanesElementsPeer::retrieveByPk( $sSwiEleUid );
|
||||||
if (is_object( $oSwiEleUid ) && get_class( $oSwiEleUid ) == 'SwimlanesElements') {
|
if (is_object( $oSwiEleUid ) && get_class( $oSwiEleUid ) == 'SwimlanesElements') {
|
||||||
return true;
|
return true;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception $oError) {
|
||||||
catch (Exception $oError) {
|
|
||||||
throw ($oError);
|
throw ($oError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the [swi_text] column value.
|
* Get the [swi_text] column value.
|
||||||
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getSwiEleText ()
|
public function getSwiEleText ()
|
||||||
@@ -202,8 +198,7 @@ function swimlanesElementsExists ( $sSwiEleUid ) {
|
|||||||
if ($this->swi_text == '') {
|
if ($this->swi_text == '') {
|
||||||
try {
|
try {
|
||||||
$this->swi_text = Content::load( 'SWI_TEXT', '', $this->getSwiUid(), (defined( 'SYS_LANG' ) ? SYS_LANG : 'en') );
|
$this->swi_text = Content::load( 'SWI_TEXT', '', $this->getSwiUid(), (defined( 'SYS_LANG' ) ? SYS_LANG : 'en') );
|
||||||
}
|
} catch (Exception $oError) {
|
||||||
catch (Exception $oError) {
|
|
||||||
throw ($oError);
|
throw ($oError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -226,12 +221,12 @@ function swimlanesElementsExists ( $sSwiEleUid ) {
|
|||||||
$this->swi_text = $sValue;
|
$this->swi_text = $sValue;
|
||||||
|
|
||||||
$iResult = Content::addContent( 'SWI_TEXT', '', $this->getSwiUid(), (defined( 'SYS_LANG' ) ? SYS_LANG : 'en'), $this->swi_text );
|
$iResult = Content::addContent( 'SWI_TEXT', '', $this->getSwiUid(), (defined( 'SYS_LANG' ) ? SYS_LANG : 'en'), $this->swi_text );
|
||||||
}
|
} catch (Exception $oError) {
|
||||||
catch (Exception $oError) {
|
|
||||||
$this->swi_text = '';
|
$this->swi_text = '';
|
||||||
throw ($oError);
|
throw ($oError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
// SwimlanesElements
|
||||||
|
|
||||||
} // SwimlanesElements
|
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* TaskUser.php
|
* TaskUser.php
|
||||||
|
*
|
||||||
* @package workflow.engine.classes.model
|
* @package workflow.engine.classes.model
|
||||||
*
|
*
|
||||||
* ProcessMaker Open Source Edition
|
* ProcessMaker Open Source Edition
|
||||||
@@ -38,22 +39,25 @@ require_once 'classes/model/Content.php';
|
|||||||
*
|
*
|
||||||
* @package workflow.engine.classes.model
|
* @package workflow.engine.classes.model
|
||||||
*/
|
*/
|
||||||
class TaskUser extends BaseTaskUser {
|
class TaskUser extends BaseTaskUser
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create the application document registry
|
* Create the application document registry
|
||||||
|
*
|
||||||
* @param array $aData
|
* @param array $aData
|
||||||
* @return string
|
* @return string
|
||||||
**/
|
*
|
||||||
|
*/
|
||||||
public function create ($aData)
|
public function create ($aData)
|
||||||
{
|
{
|
||||||
$oConnection = Propel::getConnection( TaskUserPeer::DATABASE_NAME );
|
$oConnection = Propel::getConnection( TaskUserPeer::DATABASE_NAME );
|
||||||
try {
|
try {
|
||||||
$taskUser = TaskUserPeer::retrieveByPK( $aData['TAS_UID'], $aData['USR_UID'], $aData['TU_TYPE'], $aData['TU_RELATION'] );
|
$taskUser = TaskUserPeer::retrieveByPK( $aData['TAS_UID'], $aData['USR_UID'], $aData['TU_TYPE'], $aData['TU_RELATION'] );
|
||||||
|
|
||||||
if( is_object($taskUser) )
|
if (is_object( $taskUser )) {
|
||||||
return - 1;
|
return - 1;
|
||||||
|
}
|
||||||
$oTaskUser = new TaskUser();
|
$oTaskUser = new TaskUser();
|
||||||
$oTaskUser->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
|
$oTaskUser->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
|
||||||
if ($oTaskUser->validate()) {
|
if ($oTaskUser->validate()) {
|
||||||
@@ -61,8 +65,7 @@ class TaskUser extends BaseTaskUser {
|
|||||||
$iResult = $oTaskUser->save();
|
$iResult = $oTaskUser->save();
|
||||||
$oConnection->commit();
|
$oConnection->commit();
|
||||||
return $iResult;
|
return $iResult;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$sMessage = '';
|
$sMessage = '';
|
||||||
$aValidationFailures = $oTaskUser->getValidationFailures();
|
$aValidationFailures = $oTaskUser->getValidationFailures();
|
||||||
foreach ($aValidationFailures as $oValidationFailure) {
|
foreach ($aValidationFailures as $oValidationFailure) {
|
||||||
@@ -70,8 +73,7 @@ class TaskUser extends BaseTaskUser {
|
|||||||
}
|
}
|
||||||
throw (new Exception( 'The registry cannot be created!<br />' . $sMessage ));
|
throw (new Exception( 'The registry cannot be created!<br />' . $sMessage ));
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception $oError) {
|
||||||
catch (Exception $oError) {
|
|
||||||
$oConnection->rollback();
|
$oConnection->rollback();
|
||||||
throw ($oError);
|
throw ($oError);
|
||||||
}
|
}
|
||||||
@@ -79,49 +81,48 @@ class TaskUser extends BaseTaskUser {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove the application document registry
|
* Remove the application document registry
|
||||||
|
*
|
||||||
* @param string $sTasUid
|
* @param string $sTasUid
|
||||||
* @param string $sUserUid
|
* @param string $sUserUid
|
||||||
* @return string
|
* @return string
|
||||||
**/
|
*
|
||||||
|
*/
|
||||||
public function remove ($sTasUid, $sUserUid, $iType, $iRelation)
|
public function remove ($sTasUid, $sUserUid, $iType, $iRelation)
|
||||||
{
|
{
|
||||||
$oConnection = Propel::getConnection( TaskUserPeer::DATABASE_NAME );
|
$oConnection = Propel::getConnection( TaskUserPeer::DATABASE_NAME );
|
||||||
try {
|
try {
|
||||||
$oTaskUser = TaskUserPeer::retrieveByPK( $sTasUid, $sUserUid, $iType, $iRelation );
|
$oTaskUser = TaskUserPeer::retrieveByPK( $sTasUid, $sUserUid, $iType, $iRelation );
|
||||||
if (!is_null($oTaskUser))
|
if (! is_null( $oTaskUser )) {
|
||||||
{
|
|
||||||
$oConnection->begin();
|
$oConnection->begin();
|
||||||
$iResult = $oTaskUser->delete();
|
$iResult = $oTaskUser->delete();
|
||||||
$oConnection->commit();
|
$oConnection->commit();
|
||||||
return $iResult;
|
return $iResult;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
throw (new Exception( 'This row does not exist!' ));
|
throw (new Exception( 'This row does not exist!' ));
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception $oError) {
|
||||||
catch (Exception $oError) {
|
|
||||||
$oConnection->rollback();
|
$oConnection->rollback();
|
||||||
throw ($oError);
|
throw ($oError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function TaskUserExists ($sTasUid, $sUserUid, $iType, $iRelation) {
|
public function TaskUserExists ($sTasUid, $sUserUid, $iType, $iRelation)
|
||||||
|
{
|
||||||
$con = Propel::getConnection( TaskUserPeer::DATABASE_NAME );
|
$con = Propel::getConnection( TaskUserPeer::DATABASE_NAME );
|
||||||
try {
|
try {
|
||||||
$oTaskUser = TaskUserPeer::retrieveByPk( $sTasUid, $sUserUid, $iType, $iRelation );
|
$oTaskUser = TaskUserPeer::retrieveByPk( $sTasUid, $sUserUid, $iType, $iRelation );
|
||||||
if (is_object( $oTaskUser ) && get_class( $oTaskUser ) == 'TaskUser') {
|
if (is_object( $oTaskUser ) && get_class( $oTaskUser ) == 'TaskUser') {
|
||||||
return true;
|
return true;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception $oError) {
|
||||||
catch (Exception $oError) {
|
|
||||||
throw ($oError);
|
throw ($oError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getCountAllTaksByGroups(){
|
public function getCountAllTaksByGroups ()
|
||||||
|
{
|
||||||
$oCriteria = new Criteria( 'workflow' );
|
$oCriteria = new Criteria( 'workflow' );
|
||||||
$oCriteria->addAsColumn( 'GRP_UID', TaskUserPeer::USR_UID );
|
$oCriteria->addAsColumn( 'GRP_UID', TaskUserPeer::USR_UID );
|
||||||
$oCriteria->addSelectColumn( 'COUNT(*) AS CNT' );
|
$oCriteria->addSelectColumn( 'COUNT(*) AS CNT' );
|
||||||
@@ -137,10 +138,9 @@ class TaskUser extends BaseTaskUser {
|
|||||||
}
|
}
|
||||||
return $aRows;
|
return $aRows;
|
||||||
}
|
}
|
||||||
|
|
||||||
//erik: new functions
|
//erik: new functions
|
||||||
function getUsersTask($TAS_UID, $TU_TYPE=1){
|
public function getUsersTask ($TAS_UID, $TU_TYPE = 1)
|
||||||
|
{
|
||||||
require_once 'classes/model/Users.php';
|
require_once 'classes/model/Users.php';
|
||||||
|
|
||||||
$groupsTask = array ();
|
$groupsTask = array ();
|
||||||
@@ -163,9 +163,9 @@ class TaskUser extends BaseTaskUser {
|
|||||||
$dataset = TaskUserPeer::doSelectRS( $criteria );
|
$dataset = TaskUserPeer::doSelectRS( $criteria );
|
||||||
$dataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
$dataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||||
|
|
||||||
while ($dataset->next())
|
while ($dataset->next()) {
|
||||||
$usersTask[] = $dataset->getRow();
|
$usersTask[] = $dataset->getRow();
|
||||||
|
}
|
||||||
//getting task's groups
|
//getting task's groups
|
||||||
$delimiter = DBAdapter::getStringDelimiter();
|
$delimiter = DBAdapter::getStringDelimiter();
|
||||||
$criteria = new Criteria( 'workflow' );
|
$criteria = new Criteria( 'workflow' );
|
||||||
@@ -182,17 +182,17 @@ class TaskUser extends BaseTaskUser {
|
|||||||
$criteria->add( TaskUserPeer::TU_TYPE, $TU_TYPE );
|
$criteria->add( TaskUserPeer::TU_TYPE, $TU_TYPE );
|
||||||
$criteria->add( TaskUserPeer::TU_RELATION, 2 );
|
$criteria->add( TaskUserPeer::TU_RELATION, 2 );
|
||||||
$dataset = TaskUserPeer::doSelectRS( $criteria );
|
$dataset = TaskUserPeer::doSelectRS( $criteria );
|
||||||
|
|
||||||
$dataset = TaskUserPeer::doSelectRS( $criteria );
|
$dataset = TaskUserPeer::doSelectRS( $criteria );
|
||||||
$dataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
$dataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||||
|
|
||||||
while( $dataset->next() )
|
while ($dataset->next()) {
|
||||||
$usersTask[] = $dataset->getRow();
|
$usersTask[] = $dataset->getRow();
|
||||||
|
}
|
||||||
$result->data = $usersTask;
|
$result->data = $usersTask;
|
||||||
$result->totalCount = sizeof( $usersTask );
|
$result->totalCount = sizeof( $usersTask );
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
// TaskUser
|
||||||
|
|
||||||
} // TaskUser
|
|
||||||
@@ -10,7 +10,8 @@
|
|||||||
* @author Zachary Tirrell <zbtirrell@plymouth.edu>
|
* @author Zachary Tirrell <zbtirrell@plymouth.edu>
|
||||||
* @GPL 2007, Plymouth State University, ITS
|
* @GPL 2007, Plymouth State University, ITS
|
||||||
*/
|
*/
|
||||||
class Zimbra {
|
class Zimbra
|
||||||
|
{
|
||||||
|
|
||||||
public $debug = false;
|
public $debug = false;
|
||||||
public $error;
|
public $error;
|
||||||
@@ -33,6 +34,7 @@ class Zimbra {
|
|||||||
protected $_idm; // IDMObject
|
protected $_idm; // IDMObject
|
||||||
protected $_username; // the user we are operating as
|
protected $_username; // the user we are operating as
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* __construct
|
* __construct
|
||||||
*
|
*
|
||||||
@@ -44,7 +46,8 @@ class Zimbra {
|
|||||||
* @param string $which defaults to prod
|
* @param string $which defaults to prod
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public function __construct($username, $serverUrl, $preAuthKey, $which = 'prod') {
|
public function __construct ($username, $serverUrl, $preAuthKey, $which = 'prod')
|
||||||
|
{
|
||||||
if ($which == 'dev') {
|
if ($which == 'dev') {
|
||||||
$which = 'zimbra_dev';
|
$which = 'zimbra_dev';
|
||||||
$this->_dev = true;
|
$this->_dev = true;
|
||||||
@@ -62,6 +65,7 @@ class Zimbra {
|
|||||||
|
|
||||||
// end __construct
|
// end __construct
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* sso
|
* sso
|
||||||
*
|
*
|
||||||
@@ -72,14 +76,15 @@ class Zimbra {
|
|||||||
* @param string $options options for sso
|
* @param string $options options for sso
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function sso($options='') {
|
public function sso ($options = '')
|
||||||
|
{
|
||||||
if ($this->_username) {
|
if ($this->_username) {
|
||||||
setcookie( 'ZM_SKIN', 'plymouth', time() + 60 * 60 * 24 * 30, '/', '.plymouth.edu' );
|
setcookie( 'ZM_SKIN', 'plymouth', time() + 60 * 60 * 24 * 30, '/', '.plymouth.edu' );
|
||||||
|
|
||||||
$pre_auth = $this->getPreAuth( $this->_username );
|
$pre_auth = $this->getPreAuth( $this->_username );
|
||||||
$url = $this->_protocol . '/service/preauth?account=' . $this->_username . '@' . $this->_server . '&expires=' . $this->_preauth_expiration . '×tamp=' . $this->_timestamp . '&preauth=' . $pre_auth; //.'&'.$options;
|
$url = $this->_protocol . '/service/preauth?account=' . $this->_username . '@' . $this->_server . '&expires=' . $this->_preauth_expiration . '×tamp=' . $this->_timestamp . '&preauth=' . $pre_auth; //.'&'.$options;
|
||||||
header( "Location: $url" );
|
header( "Location: $url" );
|
||||||
exit;
|
exit();
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -87,25 +92,26 @@ class Zimbra {
|
|||||||
|
|
||||||
// end sso
|
// end sso
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* createAccount
|
* createAccount
|
||||||
|
*
|
||||||
* @param string $name account name
|
* @param string $name account name
|
||||||
* @param string $password password
|
* @param string $password password
|
||||||
* @return string account id
|
* @return string account id
|
||||||
*/
|
*/
|
||||||
function createAccount($name, $password) {
|
function createAccount ($name, $password)
|
||||||
|
{
|
||||||
$option_string = '';
|
$option_string = '';
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
|
||||||
$soap = '<CreateAccountRequest xmlns="urn:zimbraAccount">
|
$soap = '<CreateAccountRequest xmlns="urn:zimbraAccount">
|
||||||
<name>' . $name . '@' . $this->_server1 . '</name>
|
<name>' . $name . '@' . $this->_server1 . '</name>
|
||||||
<password>' . $password . '</password>' . $option_string . '
|
<password>' . $password . '</password>' . $option_string . '
|
||||||
<session/>
|
<session/>
|
||||||
</CreateAccountRequest>';
|
</CreateAccountRequest>';
|
||||||
|
|
||||||
|
|
||||||
$response = $this->soapRequest( $soap );
|
$response = $this->soapRequest( $soap );
|
||||||
} catch (SoapFault $exception) {
|
} catch (SoapFault $exception) {
|
||||||
print_exception( $exception );
|
print_exception( $exception );
|
||||||
@@ -124,7 +130,8 @@ class Zimbra {
|
|||||||
* @param string $username username
|
* @param string $username username
|
||||||
* @return string preauthentication key in hmacsha1 format
|
* @return string preauthentication key in hmacsha1 format
|
||||||
*/
|
*/
|
||||||
private function getPreAuth($username) {
|
private function getPreAuth ($username)
|
||||||
|
{
|
||||||
$account_identifier = $username . '@' . $this->_server1;
|
$account_identifier = $username . '@' . $this->_server1;
|
||||||
$by_value = 'name';
|
$by_value = 'name';
|
||||||
$expires = $this->_preauth_expiration;
|
$expires = $this->_preauth_expiration;
|
||||||
@@ -137,6 +144,7 @@ class Zimbra {
|
|||||||
|
|
||||||
// end getPreAuth
|
// end getPreAuth
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* hmacsha1
|
* hmacsha1
|
||||||
*
|
*
|
||||||
@@ -148,28 +156,23 @@ class Zimbra {
|
|||||||
* @param string $data data to encrypt
|
* @param string $data data to encrypt
|
||||||
* @return string converted to hmac sha1 format
|
* @return string converted to hmac sha1 format
|
||||||
*/
|
*/
|
||||||
private function hmacsha1($key, $data) {
|
private function hmacsha1 ($key, $data)
|
||||||
|
{
|
||||||
$blocksize = 64;
|
$blocksize = 64;
|
||||||
$hashfunc = 'sha1';
|
$hashfunc = 'sha1';
|
||||||
if (strlen($key) > $blocksize)
|
if (strlen( $key ) > $blocksize) {
|
||||||
$key = pack( 'H*', $hashfunc( $key ) );
|
$key = pack( 'H*', $hashfunc( $key ) );
|
||||||
|
}
|
||||||
$key = str_pad( $key, $blocksize, chr( 0x00 ) );
|
$key = str_pad( $key, $blocksize, chr( 0x00 ) );
|
||||||
$ipad = str_repeat( chr( 0x36 ), $blocksize );
|
$ipad = str_repeat( chr( 0x36 ), $blocksize );
|
||||||
$opad = str_repeat( chr( 0x5c ), $blocksize );
|
$opad = str_repeat( chr( 0x5c ), $blocksize );
|
||||||
$hmac = pack(
|
$hmac = pack( 'H*', $hashfunc( ($key ^ $opad) . pack( 'H*', $hashfunc( ($key ^ $ipad) . $data ) ) ) );
|
||||||
'H*', $hashfunc(
|
|
||||||
($key ^ $opad) . pack(
|
|
||||||
'H*', $hashfunc(
|
|
||||||
($key ^ $ipad) . $data
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
return bin2hex( $hmac );
|
return bin2hex( $hmac );
|
||||||
}
|
}
|
||||||
|
|
||||||
// end hmacsha1
|
// end hmacsha1
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* connect
|
* connect
|
||||||
*
|
*
|
||||||
@@ -179,7 +182,8 @@ class Zimbra {
|
|||||||
* @access public
|
* @access public
|
||||||
* @return array associative array of account information
|
* @return array associative array of account information
|
||||||
*/
|
*/
|
||||||
public function connect() {
|
public function connect ()
|
||||||
|
{
|
||||||
if ($this->_connected) {
|
if ($this->_connected) {
|
||||||
return $this->_account_info;
|
return $this->_account_info;
|
||||||
}
|
}
|
||||||
@@ -239,6 +243,7 @@ class Zimbra {
|
|||||||
|
|
||||||
// end connect
|
// end connect
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* administerUser
|
* administerUser
|
||||||
*
|
*
|
||||||
@@ -249,7 +254,8 @@ class Zimbra {
|
|||||||
* @param string $username username to administer
|
* @param string $username username to administer
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function administerUser($username) {
|
public function administerUser ($username)
|
||||||
|
{
|
||||||
if (! $this->_admin) {
|
if (! $this->_admin) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -275,6 +281,7 @@ class Zimbra {
|
|||||||
|
|
||||||
// end administerUser
|
// end administerUser
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* getInfo
|
* getInfo
|
||||||
*
|
*
|
||||||
@@ -285,7 +292,8 @@ class Zimbra {
|
|||||||
* @param string $options options for info retrieval, defaults to null
|
* @param string $options options for info retrieval, defaults to null
|
||||||
* @return array information
|
* @return array information
|
||||||
*/
|
*/
|
||||||
public function getInfo($options='') {
|
public function getInfo ($options = '')
|
||||||
|
{
|
||||||
// valid sections: mbox,prefs,attrs,zimlets,props,idents,sigs,dsrcs,children
|
// valid sections: mbox,prefs,attrs,zimlets,props,idents,sigs,dsrcs,children
|
||||||
$option_string = $this->buildOptionString( $options );
|
$option_string = $this->buildOptionString( $options );
|
||||||
|
|
||||||
@@ -301,6 +309,7 @@ class Zimbra {
|
|||||||
|
|
||||||
// end getInfo
|
// end getInfo
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* getMessages
|
* getMessages
|
||||||
*
|
*
|
||||||
@@ -312,7 +321,8 @@ class Zimbra {
|
|||||||
* @param array $options options to apply to retrieval
|
* @param array $options options to apply to retrieval
|
||||||
* @return array array of messages
|
* @return array array of messages
|
||||||
*/
|
*/
|
||||||
public function getMessages($search='in:inbox', $options=array('limit' => 5, 'fetch' => 'none')) {
|
public function getMessages ($search = 'in:inbox', $options = array('limit' => 5, 'fetch' => 'none'))
|
||||||
|
{
|
||||||
$option_string = $this->buildOptionString( $options );
|
$option_string = $this->buildOptionString( $options );
|
||||||
|
|
||||||
$soap = '<SearchRequest xmlns="urn:zimbraMail" types="message"' . $option_string . '>
|
$soap = '<SearchRequest xmlns="urn:zimbraMail" types="message"' . $option_string . '>
|
||||||
@@ -329,6 +339,7 @@ class Zimbra {
|
|||||||
|
|
||||||
// end getMessages
|
// end getMessages
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* getContacts
|
* getContacts
|
||||||
*
|
*
|
||||||
@@ -340,7 +351,8 @@ class Zimbra {
|
|||||||
* @param array $options options to apply to retrieval
|
* @param array $options options to apply to retrieval
|
||||||
* @return array array of messages
|
* @return array array of messages
|
||||||
*/
|
*/
|
||||||
public function getContacts($search='in:contacts', $options=array('limit' => 5, 'fetch' => 'none')) {
|
public function getContacts ($search = 'in:contacts', $options = array('limit' => 5, 'fetch' => 'none'))
|
||||||
|
{
|
||||||
$option_string = $this->buildOptionString( $options );
|
$option_string = $this->buildOptionString( $options );
|
||||||
|
|
||||||
$soap = '<SearchRequest xmlns="urn:zimbraMail" types="contact"' . $option_string . '>
|
$soap = '<SearchRequest xmlns="urn:zimbraMail" types="contact"' . $option_string . '>
|
||||||
@@ -369,7 +381,8 @@ class Zimbra {
|
|||||||
* @return array array of messages
|
* @return array array of messages
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public function getAppointments($search='in:calendar', $options=array('limit' => 50, 'fetch' => 'none')) {
|
public function getAppointments ($search = 'in:calendar', $options = array('limit' => 50, 'fetch' => 'none'))
|
||||||
|
{
|
||||||
$option_string = $this->buildOptionString( $options );
|
$option_string = $this->buildOptionString( $options );
|
||||||
|
|
||||||
$soap = '<SearchRequest xmlns="urn:zimbraMail" types="appointment"' . $option_string . '>
|
$soap = '<SearchRequest xmlns="urn:zimbraMail" types="appointment"' . $option_string . '>
|
||||||
@@ -386,6 +399,7 @@ class Zimbra {
|
|||||||
|
|
||||||
// end getAppointments
|
// end getAppointments
|
||||||
|
|
||||||
|
|
||||||
/* getTasks
|
/* getTasks
|
||||||
*
|
*
|
||||||
* get the Tasks in folder
|
* get the Tasks in folder
|
||||||
@@ -397,7 +411,8 @@ class Zimbra {
|
|||||||
* @return array array of messages
|
* @return array array of messages
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public function getTasks($search='in:tasks', $options=array('limit' => 50, 'fetch' => 'none')) {
|
public function getTasks ($search = 'in:tasks', $options = array('limit' => 50, 'fetch' => 'none'))
|
||||||
|
{
|
||||||
$option_string = $this->buildOptionString( $options );
|
$option_string = $this->buildOptionString( $options );
|
||||||
|
|
||||||
$soap = '<SearchRequest xmlns="urn:zimbraMail" types="task"' . $option_string . '>
|
$soap = '<SearchRequest xmlns="urn:zimbraMail" types="task"' . $option_string . '>
|
||||||
@@ -414,6 +429,7 @@ class Zimbra {
|
|||||||
|
|
||||||
// end getTasks
|
// end getTasks
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* getMessageContent
|
* getMessageContent
|
||||||
*
|
*
|
||||||
@@ -424,7 +440,8 @@ class Zimbra {
|
|||||||
* @param int $id id number of message to retrieve content of
|
* @param int $id id number of message to retrieve content of
|
||||||
* @return array associative array with message content, valid for tasks, calendar entries, and email messages.
|
* @return array associative array with message content, valid for tasks, calendar entries, and email messages.
|
||||||
*/
|
*/
|
||||||
public function getMessageContent($id) {
|
public function getMessageContent ($id)
|
||||||
|
{
|
||||||
$soap = '<GetMsgRequest xmlns="urn:zimbraMail">
|
$soap = '<GetMsgRequest xmlns="urn:zimbraMail">
|
||||||
<m id="' . $id . '" html="1">*</m>
|
<m id="' . $id . '" html="1">*</m>
|
||||||
</GetMsgRequest>';
|
</GetMsgRequest>';
|
||||||
@@ -457,19 +474,22 @@ class Zimbra {
|
|||||||
* @access public
|
* @access public
|
||||||
* @return array $subscribed
|
* @return array $subscribed
|
||||||
*/
|
*/
|
||||||
public function getSubscribedCalendars() {
|
public function getSubscribedCalendars ()
|
||||||
|
{
|
||||||
$subscribed = array ();
|
$subscribed = array ();
|
||||||
if (is_array( $this->_account_info['link_attribute_name'] )) {
|
if (is_array( $this->_account_info['link_attribute_name'] )) {
|
||||||
foreach ($this->_account_info['link_attribute_name'] as $i => $name) {
|
foreach ($this->_account_info['link_attribute_name'] as $i => $name) {
|
||||||
if ($this->_account_info['link_attribute_view'][$i] == 'appointment')
|
if ($this->_account_info['link_attribute_view'][$i] == 'appointment') {
|
||||||
$subscribed[$this->_account_info['link_attribute_id'][$i]] = $name;
|
$subscribed[$this->_account_info['link_attribute_id'][$i]] = $name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return $subscribed;
|
return $subscribed;
|
||||||
}
|
}
|
||||||
|
|
||||||
// end getSubscribedCalendars
|
// end getSubscribedCalendars
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* getSubscribedTaskLists
|
* getSubscribedTaskLists
|
||||||
*
|
*
|
||||||
@@ -479,19 +499,22 @@ class Zimbra {
|
|||||||
* @access public
|
* @access public
|
||||||
* @return array $subscribed or false
|
* @return array $subscribed or false
|
||||||
*/
|
*/
|
||||||
public function getSubscribedTaskLists() {
|
public function getSubscribedTaskLists ()
|
||||||
|
{
|
||||||
$subscribed = array ();
|
$subscribed = array ();
|
||||||
if (is_array( $this->_account_info['link_attribute_name'] )) {
|
if (is_array( $this->_account_info['link_attribute_name'] )) {
|
||||||
foreach ($this->_account_info['link_attribute_name'] as $i => $name) {
|
foreach ($this->_account_info['link_attribute_name'] as $i => $name) {
|
||||||
if ($this->_account_info['link_attribute_view'][$i] == 'task')
|
if ($this->_account_info['link_attribute_view'][$i] == 'task') {
|
||||||
$subscribed[$this->_account_info['link_attribute_id'][$i]] = $name;
|
$subscribed[$this->_account_info['link_attribute_id'][$i]] = $name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return $subscribed;
|
return $subscribed;
|
||||||
}
|
}
|
||||||
|
|
||||||
// end getSubscribedCalendars
|
// end getSubscribedCalendars
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* getFolder
|
* getFolder
|
||||||
*
|
*
|
||||||
@@ -502,10 +525,12 @@ class Zimbra {
|
|||||||
* @param string $folder_options options for folder retrieval
|
* @param string $folder_options options for folder retrieval
|
||||||
* @return array $folder or false
|
* @return array $folder or false
|
||||||
*/
|
*/
|
||||||
public function getFolder($folderName, $folder_options='') {
|
public function getFolder ($folderName, $folder_options = '')
|
||||||
|
{
|
||||||
|
|
||||||
//$folder_option_string = $this->buildOptionString($folder_options);
|
//$folder_option_string = $this->buildOptionString($folder_options);
|
||||||
|
|
||||||
|
|
||||||
$soap = '<GetFolderRequest xmlns="urn:zimbraMail" visible="1">
|
$soap = '<GetFolderRequest xmlns="urn:zimbraMail" visible="1">
|
||||||
<folder path="' . $folderName . '"/>
|
<folder path="' . $folderName . '"/>
|
||||||
</GetFolderRequest>';
|
</GetFolderRequest>';
|
||||||
@@ -526,6 +551,7 @@ class Zimbra {
|
|||||||
|
|
||||||
// end getFolder
|
// end getFolder
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* getPrefrences
|
* getPrefrences
|
||||||
*
|
*
|
||||||
@@ -536,7 +562,8 @@ class Zimbra {
|
|||||||
* @example example XML: <GetPrefsRequest> <!-- get only the specified prefs --> [<pref name="{name1}"/> <pref name="{name2}"/>] </GetPrefsRequest>
|
* @example example XML: <GetPrefsRequest> <!-- get only the specified prefs --> [<pref name="{name1}"/> <pref name="{name2}"/>] </GetPrefsRequest>
|
||||||
* @return array $prefs or false
|
* @return array $prefs or false
|
||||||
*/
|
*/
|
||||||
public function getPreferences() {
|
public function getPreferences ()
|
||||||
|
{
|
||||||
$soap = '<GetPrefsRequest xmlns="urn:zimbraAccount" />';
|
$soap = '<GetPrefsRequest xmlns="urn:zimbraAccount" />';
|
||||||
$response = $this->soapRequest( $soap );
|
$response = $this->soapRequest( $soap );
|
||||||
if ($response) {
|
if ($response) {
|
||||||
@@ -553,6 +580,7 @@ class Zimbra {
|
|||||||
|
|
||||||
// end getPreferences
|
// end getPreferences
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* setPrefrences
|
* setPrefrences
|
||||||
*
|
*
|
||||||
@@ -564,7 +592,8 @@ class Zimbra {
|
|||||||
* @example example XML: <ModifyPrefsRequest> [<pref name="{name}">{value}</pref>...]+ </ModifyPrefsRequest>
|
* @example example XML: <ModifyPrefsRequest> [<pref name="{name}">{value}</pref>...]+ </ModifyPrefsRequest>
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function setPreferences($options='') {
|
public function setPreferences ($options = '')
|
||||||
|
{
|
||||||
$option_string = '';
|
$option_string = '';
|
||||||
foreach ($options as $name => $value) {
|
foreach ($options as $name => $value) {
|
||||||
$option_string .= '<pref name="' . $name . '">' . $value . '</pref>';
|
$option_string .= '<pref name="' . $name . '">' . $value . '</pref>';
|
||||||
@@ -583,6 +612,7 @@ class Zimbra {
|
|||||||
|
|
||||||
// end setPreferences
|
// end setPreferences
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* emailChannel
|
* emailChannel
|
||||||
*
|
*
|
||||||
@@ -591,7 +621,8 @@ class Zimbra {
|
|||||||
* @since version 1.0
|
* @since version 1.0
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
public function emailChannel() {
|
public function emailChannel ()
|
||||||
|
{
|
||||||
require_once 'xtemplate.php';
|
require_once 'xtemplate.php';
|
||||||
$tpl = new XTemplate( '/web/pscpages/webapp/portal/channel/email/templates/index.tpl' );
|
$tpl = new XTemplate( '/web/pscpages/webapp/portal/channel/email/templates/index.tpl' );
|
||||||
|
|
||||||
@@ -632,7 +663,8 @@ class Zimbra {
|
|||||||
$tpl->assign( 'message', $clean_message );
|
$tpl->assign( 'message', $clean_message );
|
||||||
$tpl->parse( 'main.message' );
|
$tpl->parse( 'main.message' );
|
||||||
}
|
}
|
||||||
$inbox = $this->getFolder(array('l' => 2));
|
$inbox = $this->getFolder( array ('l' => 2
|
||||||
|
) );
|
||||||
|
|
||||||
$total_messages = (int) $inbox['n'];
|
$total_messages = (int) $inbox['n'];
|
||||||
$unread_messages = (int) $inbox['u'];
|
$unread_messages = (int) $inbox['u'];
|
||||||
@@ -662,6 +694,7 @@ class Zimbra {
|
|||||||
|
|
||||||
// end emailChannel
|
// end emailChannel
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* builOptionString
|
* builOptionString
|
||||||
*
|
*
|
||||||
@@ -672,7 +705,8 @@ class Zimbra {
|
|||||||
* @param array $options array of options to be parsed into a string
|
* @param array $options array of options to be parsed into a string
|
||||||
* @return string $options_string
|
* @return string $options_string
|
||||||
*/
|
*/
|
||||||
protected function buildOptionString($options) {
|
protected function buildOptionString ($options)
|
||||||
|
{
|
||||||
$options_string = '';
|
$options_string = '';
|
||||||
foreach ($options as $k => $v) {
|
foreach ($options as $k => $v) {
|
||||||
$options_string .= ' ' . $k . '="' . $v . '"';
|
$options_string .= ' ' . $k . '="' . $v . '"';
|
||||||
@@ -682,6 +716,7 @@ class Zimbra {
|
|||||||
|
|
||||||
// end buildOptionString
|
// end buildOptionString
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* extractAuthToken
|
* extractAuthToken
|
||||||
*
|
*
|
||||||
@@ -692,7 +727,8 @@ class Zimbra {
|
|||||||
* @param string $xml xml to have the auth token pulled from
|
* @param string $xml xml to have the auth token pulled from
|
||||||
* @return string $auth_token
|
* @return string $auth_token
|
||||||
*/
|
*/
|
||||||
private function extractAuthToken($xml) {
|
private function extractAuthToken ($xml)
|
||||||
|
{
|
||||||
$auth_token = strstr( $xml, "<authToken" );
|
$auth_token = strstr( $xml, "<authToken" );
|
||||||
$auth_token = strstr( $auth_token, ">" );
|
$auth_token = strstr( $auth_token, ">" );
|
||||||
$auth_token = substr( $auth_token, 1, strpos( $auth_token, "<" ) - 1 );
|
$auth_token = substr( $auth_token, 1, strpos( $auth_token, "<" ) - 1 );
|
||||||
@@ -709,7 +745,8 @@ class Zimbra {
|
|||||||
* @param string $xml xml to have the session id pulled from
|
* @param string $xml xml to have the session id pulled from
|
||||||
* @return int $session_id
|
* @return int $session_id
|
||||||
*/
|
*/
|
||||||
private function extractSessionID($xml) {
|
private function extractSessionID ($xml)
|
||||||
|
{
|
||||||
|
|
||||||
//for testing purpose we are extracting lifetime instead of sessionid
|
//for testing purpose we are extracting lifetime instead of sessionid
|
||||||
//$session_id = strstr($xml, "<lifetime");
|
//$session_id = strstr($xml, "<lifetime");
|
||||||
@@ -721,6 +758,7 @@ class Zimbra {
|
|||||||
|
|
||||||
// end extractSessionID
|
// end extractSessionID
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* extractErrorCode
|
* extractErrorCode
|
||||||
*
|
*
|
||||||
@@ -731,7 +769,8 @@ class Zimbra {
|
|||||||
* @param string $xml xml to have the error code pulled from
|
* @param string $xml xml to have the error code pulled from
|
||||||
* @return int $session_id
|
* @return int $session_id
|
||||||
*/
|
*/
|
||||||
private function extractErrorCode($xml) {
|
private function extractErrorCode ($xml)
|
||||||
|
{
|
||||||
$session_id = strstr( $xml, "<Code" );
|
$session_id = strstr( $xml, "<Code" );
|
||||||
$session_id = strstr( $session_id, ">" );
|
$session_id = strstr( $session_id, ">" );
|
||||||
$session_id = substr( $session_id, 1, strpos( $session_id, "<" ) - 1 );
|
$session_id = substr( $session_id, 1, strpos( $session_id, "<" ) - 1 );
|
||||||
@@ -740,6 +779,7 @@ class Zimbra {
|
|||||||
|
|
||||||
// end extractErrorCode
|
// end extractErrorCode
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* makeBytesPretty
|
* makeBytesPretty
|
||||||
*
|
*
|
||||||
@@ -751,14 +791,15 @@ class Zimbra {
|
|||||||
* @param boolean $redlevel
|
* @param boolean $redlevel
|
||||||
* @return int $size
|
* @return int $size
|
||||||
*/
|
*/
|
||||||
private function makeBytesPretty($bytes, $redlevel=false) {
|
private function makeBytesPretty ($bytes, $redlevel = false)
|
||||||
if ($bytes < 1024)
|
{
|
||||||
|
if ($bytes < 1024) {
|
||||||
$size = $bytes . ' B';
|
$size = $bytes . ' B';
|
||||||
elseif ($bytes < 1024 * 1024)
|
} elseif ($bytes < 1024 * 1024) {
|
||||||
$size = round( $bytes / 1024, 1 ) . ' KB';
|
$size = round( $bytes / 1024, 1 ) . ' KB';
|
||||||
else
|
} else {
|
||||||
$size = round( ($bytes / 1024) / 1024, 1 ) . ' MB';
|
$size = round( ($bytes / 1024) / 1024, 1 ) . ' MB';
|
||||||
|
}
|
||||||
if ($redlevel && $bytes > $redlevel) {
|
if ($redlevel && $bytes > $redlevel) {
|
||||||
$size = '<span style="color:red">' . $size . '</span>';
|
$size = '<span style="color:red">' . $size . '</span>';
|
||||||
}
|
}
|
||||||
@@ -768,6 +809,7 @@ class Zimbra {
|
|||||||
|
|
||||||
// end makeBytesPretty
|
// end makeBytesPretty
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* message
|
* message
|
||||||
*
|
*
|
||||||
@@ -777,7 +819,8 @@ class Zimbra {
|
|||||||
* @access public
|
* @access public
|
||||||
* @param string $message message for debug
|
* @param string $message message for debug
|
||||||
*/
|
*/
|
||||||
protected function message($message) {
|
protected function message ($message)
|
||||||
|
{
|
||||||
if ($this->debug) {
|
if ($this->debug) {
|
||||||
echo $message;
|
echo $message;
|
||||||
}
|
}
|
||||||
@@ -785,6 +828,7 @@ class Zimbra {
|
|||||||
|
|
||||||
// end message
|
// end message
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* soapRequest
|
* soapRequest
|
||||||
*
|
*
|
||||||
@@ -797,7 +841,8 @@ class Zimbra {
|
|||||||
* @param boolean $footer
|
* @param boolean $footer
|
||||||
* @return string $response
|
* @return string $response
|
||||||
*/
|
*/
|
||||||
protected function soapRequest($body, $header=false, $connecting=false) {
|
protected function soapRequest ($body, $header = false, $connecting = false)
|
||||||
|
{
|
||||||
if (! $connecting && ! $this->_connected) {
|
if (! $connecting && ! $this->_connected) {
|
||||||
throw new Exception( 'zimbra.class: soapRequest called without a connection to Zimbra server' );
|
throw new Exception( 'zimbra.class: soapRequest called without a connection to Zimbra server' );
|
||||||
}
|
}
|
||||||
@@ -824,7 +869,8 @@ class Zimbra {
|
|||||||
$error_code = $this->extractErrorCode( $response );
|
$error_code = $this->extractErrorCode( $response );
|
||||||
$this->error = 'ERROR: ' . $error_code . ':<textarea>' . $response . '</textarea>';
|
$this->error = 'ERROR: ' . $error_code . ':<textarea>' . $response . '</textarea>';
|
||||||
$this->message( $this->error );
|
$this->message( $this->error );
|
||||||
$aError = array('error' => $error_code);
|
$aError = array ('error' => $error_code
|
||||||
|
);
|
||||||
return $aError;
|
return $aError;
|
||||||
//return false;
|
//return false;
|
||||||
}
|
}
|
||||||
@@ -836,6 +882,7 @@ class Zimbra {
|
|||||||
|
|
||||||
// end soapRequest
|
// end soapRequest
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* getNumSOAPCalls
|
* getNumSOAPCalls
|
||||||
*
|
*
|
||||||
@@ -845,12 +892,14 @@ class Zimbra {
|
|||||||
* @access public
|
* @access public
|
||||||
* @return int $this->_num_soap_calls
|
* @return int $this->_num_soap_calls
|
||||||
*/
|
*/
|
||||||
public function getNumSOAPCalls() {
|
public function getNumSOAPCalls ()
|
||||||
|
{
|
||||||
return $this->_num_soap_calls;
|
return $this->_num_soap_calls;
|
||||||
}
|
}
|
||||||
|
|
||||||
// end getNumSOAPCalls
|
// end getNumSOAPCalls
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* makeXMLTree
|
* makeXMLTree
|
||||||
*
|
*
|
||||||
@@ -861,7 +910,8 @@ class Zimbra {
|
|||||||
* @param string $data data to be built into an array
|
* @param string $data data to be built into an array
|
||||||
* @return array $ret
|
* @return array $ret
|
||||||
*/
|
*/
|
||||||
protected function makeXMLTree($data) {
|
protected function makeXMLTree ($data)
|
||||||
|
{
|
||||||
// create parser
|
// create parser
|
||||||
$parser = xml_parser_create();
|
$parser = xml_parser_create();
|
||||||
xml_parser_set_option( $parser, XML_OPTION_CASE_FOLDING, 0 );
|
xml_parser_set_option( $parser, XML_OPTION_CASE_FOLDING, 0 );
|
||||||
@@ -912,6 +962,7 @@ class Zimbra {
|
|||||||
|
|
||||||
// end makeXMLTree
|
// end makeXMLTree
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* &composeArray
|
* &composeArray
|
||||||
*
|
*
|
||||||
@@ -924,7 +975,8 @@ class Zimbra {
|
|||||||
* @param array $value
|
* @param array $value
|
||||||
* @return array $array
|
* @return array $array
|
||||||
*/
|
*/
|
||||||
private function &composeArray($array, $elements, $value=array()) {
|
private function &composeArray ($array, $elements, $value = array())
|
||||||
|
{
|
||||||
global $XML_LIST_ELEMENTS;
|
global $XML_LIST_ELEMENTS;
|
||||||
|
|
||||||
// get current element
|
// get current element
|
||||||
@@ -942,6 +994,7 @@ class Zimbra {
|
|||||||
|
|
||||||
// end composeArray
|
// end composeArray
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* noop
|
* noop
|
||||||
*
|
*
|
||||||
@@ -951,7 +1004,8 @@ class Zimbra {
|
|||||||
* @access public
|
* @access public
|
||||||
* @return string xml response from the noop
|
* @return string xml response from the noop
|
||||||
*/
|
*/
|
||||||
public function noop() {
|
public function noop ()
|
||||||
|
{
|
||||||
return $this->soapRequest( '<NoOpRequest xmlns="urn:zimbraMail"/>' );
|
return $this->soapRequest( '<NoOpRequest xmlns="urn:zimbraMail"/>' );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -963,9 +1017,12 @@ class Zimbra {
|
|||||||
* @since version 1.0
|
* @since version 1.0
|
||||||
* @access public
|
* @access public
|
||||||
* @param
|
* @param
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
public function addAppointment($serializeOp1) {
|
public function addAppointment ($serializeOp1)
|
||||||
|
{
|
||||||
$unserializeOp1 = unserialize( $serializeOp1 );
|
$unserializeOp1 = unserialize( $serializeOp1 );
|
||||||
|
|
||||||
$username = $unserializeOp1['username'];
|
$username = $unserializeOp1['username'];
|
||||||
@@ -1030,6 +1087,7 @@ class Zimbra {
|
|||||||
|
|
||||||
// end addAppointments
|
// end addAppointments
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* addTask
|
* addTask
|
||||||
*
|
*
|
||||||
@@ -1040,7 +1098,8 @@ class Zimbra {
|
|||||||
* @param array $options array of options to apply to retrieval from calendar
|
* @param array $options array of options to apply to retrieval from calendar
|
||||||
* @return array associative array of appointments
|
* @return array associative array of appointments
|
||||||
*/
|
*/
|
||||||
public function addTask($serializeOp1) {
|
public function addTask ($serializeOp1)
|
||||||
|
{
|
||||||
$unserializeOp1 = unserialize( $serializeOp1 );
|
$unserializeOp1 = unserialize( $serializeOp1 );
|
||||||
|
|
||||||
$subject = $unserializeOp1['subject'];
|
$subject = $unserializeOp1['subject'];
|
||||||
@@ -1055,7 +1114,6 @@ class Zimbra {
|
|||||||
$status = $unserializeOp1['status'];
|
$status = $unserializeOp1['status'];
|
||||||
$percent = $unserializeOp1['percent'];
|
$percent = $unserializeOp1['percent'];
|
||||||
|
|
||||||
|
|
||||||
$soap = '<CreateTaskRequest xmlns="urn:zimbraMail">
|
$soap = '<CreateTaskRequest xmlns="urn:zimbraMail">
|
||||||
<m l="15">
|
<m l="15">
|
||||||
<su>' . $subject . '</su>
|
<su>' . $subject . '</su>
|
||||||
@@ -1092,6 +1150,7 @@ class Zimbra {
|
|||||||
|
|
||||||
// end addTask
|
// end addTask
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* addContacts
|
* addContacts
|
||||||
*
|
*
|
||||||
@@ -1100,9 +1159,12 @@ class Zimbra {
|
|||||||
* @since version 1.0
|
* @since version 1.0
|
||||||
* @access public
|
* @access public
|
||||||
* @param
|
* @param
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
public function addContacts($serializeOp1) {
|
public function addContacts ($serializeOp1)
|
||||||
|
{
|
||||||
$unserializeOp1 = unserialize( $serializeOp1 );
|
$unserializeOp1 = unserialize( $serializeOp1 );
|
||||||
|
|
||||||
$firstName = $unserializeOp1['firstName'];
|
$firstName = $unserializeOp1['firstName'];
|
||||||
@@ -1139,10 +1201,13 @@ class Zimbra {
|
|||||||
* @since version 1.0
|
* @since version 1.0
|
||||||
* @access public
|
* @access public
|
||||||
* @param
|
* @param
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public function addFolder($serializeOp1) {
|
public function addFolder ($serializeOp1)
|
||||||
|
{
|
||||||
$unserializeOp1 = unserialize( $serializeOp1 );
|
$unserializeOp1 = unserialize( $serializeOp1 );
|
||||||
|
|
||||||
$folderName = $unserializeOp1['folderName'];
|
$folderName = $unserializeOp1['folderName'];
|
||||||
@@ -1172,10 +1237,13 @@ class Zimbra {
|
|||||||
* @since version 1.0
|
* @since version 1.0
|
||||||
* @access public
|
* @access public
|
||||||
* @param
|
* @param
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public function upload($folderId, $UploadId, $fileVersion='', $docId='') {
|
public function upload ($folderId, $UploadId, $fileVersion = '', $docId = '')
|
||||||
|
{
|
||||||
if ($fileVersion == '' && $docId == '') {
|
if ($fileVersion == '' && $docId == '') {
|
||||||
$soap = '<SaveDocumentRequest xmlns="urn:zimbraMail">
|
$soap = '<SaveDocumentRequest xmlns="urn:zimbraMail">
|
||||||
<doc l="' . $folderId . '">
|
<doc l="' . $folderId . '">
|
||||||
@@ -1204,6 +1272,7 @@ class Zimbra {
|
|||||||
|
|
||||||
// end uploadDocument
|
// end uploadDocument
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* getDocId
|
* getDocId
|
||||||
*
|
*
|
||||||
@@ -1212,9 +1281,12 @@ class Zimbra {
|
|||||||
* @since version 1.0
|
* @since version 1.0
|
||||||
* @access public
|
* @access public
|
||||||
* @param
|
* @param
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
public function getDocId($folderId, $fileName) {
|
public function getDocId ($folderId, $fileName)
|
||||||
|
{
|
||||||
$soap = '<GetItemRequest xmlns="urn:zimbraMail">
|
$soap = '<GetItemRequest xmlns="urn:zimbraMail">
|
||||||
<item l="' . $folderId . '" name="' . $fileName . '" />
|
<item l="' . $folderId . '" name="' . $fileName . '" />
|
||||||
</GetItemRequest>';
|
</GetItemRequest>';
|
||||||
@@ -1239,6 +1311,7 @@ class Zimbra {
|
|||||||
// I don't know how to make usort calls to internal OO functions
|
// I don't know how to make usort calls to internal OO functions
|
||||||
// if someone knows how, please fix this :)
|
// if someone knows how, please fix this :)
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* zimbra_startSort
|
* zimbra_startSort
|
||||||
*
|
*
|
||||||
@@ -1250,7 +1323,8 @@ class Zimbra {
|
|||||||
* @param array $task_b
|
* @param array $task_b
|
||||||
* @return int (($task_a['dueDate']-$task_a['dur']) < ($task_b['dueDate']-$task_b['dur'])) ? -1 : 1
|
* @return int (($task_a['dueDate']-$task_a['dur']) < ($task_b['dueDate']-$task_b['dur'])) ? -1 : 1
|
||||||
*/
|
*/
|
||||||
function zimbra_startSort($task_a, $task_b) {
|
function zimbra_startSort ($task_a, $task_b)
|
||||||
|
{
|
||||||
if (($task_a['dueDate'] - $task_a['dur']) == ($task_b['dueDate'] - $task_b['dur'])) {
|
if (($task_a['dueDate'] - $task_a['dur']) == ($task_b['dueDate'] - $task_b['dur'])) {
|
||||||
return ($task_a['name'] < $task_b['name']) ? - 1 : 1;
|
return ($task_a['name'] < $task_b['name']) ? - 1 : 1;
|
||||||
}
|
}
|
||||||
@@ -1268,7 +1342,8 @@ function zimbra_startSort($task_a, $task_b) {
|
|||||||
* @param array $task_b
|
* @param array $task_b
|
||||||
* @return int ($task_a['dueDate'] < $task_b['dueDate']) ? -1 : 1
|
* @return int ($task_a['dueDate'] < $task_b['dueDate']) ? -1 : 1
|
||||||
*/
|
*/
|
||||||
function zimbra_dueSort($task_a, $task_b) {
|
function zimbra_dueSort ($task_a, $task_b)
|
||||||
|
{
|
||||||
if ($task_a['dueDate'] == $task_b['dueDate']) {
|
if ($task_a['dueDate'] == $task_b['dueDate']) {
|
||||||
return ($task_a['name'] < $task_b['name']) ? - 1 : 1;
|
return ($task_a['name'] < $task_b['name']) ? - 1 : 1;
|
||||||
}
|
}
|
||||||
@@ -1286,11 +1361,11 @@ function zimbra_dueSort($task_a, $task_b) {
|
|||||||
* @param array $task_b
|
* @param array $task_b
|
||||||
* @return int ($task_a['name'] < $task_b['name']) ? -1 : 1
|
* @return int ($task_a['name'] < $task_b['name']) ? -1 : 1
|
||||||
*/
|
*/
|
||||||
function zimbra_nameSort($task_a, $task_b) {
|
function zimbra_nameSort ($task_a, $task_b)
|
||||||
|
{
|
||||||
if ($task_a['name'] == $task_b['name']) {
|
if ($task_a['name'] == $task_b['name']) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return ($task_a['name'] < $task_b['name']) ? - 1 : 1;
|
return ($task_a['name'] < $task_b['name']) ? - 1 : 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
|
||||||
Reference in New Issue
Block a user