recoding to use as plugin with CL
This commit is contained in:
parent
244621b05f
commit
e8b0c80921
22 changed files with 2187 additions and 2341 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
/.project
|
61
cl_plugin.xml
Normal file
61
cl_plugin.xml
Normal file
|
@ -0,0 +1,61 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<plugin>
|
||||
<general active="1">
|
||||
<plugin_name>ConLite Workflow</plugin_name>
|
||||
<plugin_foldername>cl-workflow</plugin_foldername>
|
||||
<uuid>6BAFECC4-AF63-51CE-839D-A4E5FBBEB4A9</uuid>
|
||||
<description>ConLite Workflow adds a simple worflow management to your ConLite CMS</description>
|
||||
<author>ConLite Team</author>
|
||||
<copyright>ConLite Team</copyright>
|
||||
<mail>cl-workflow@conlite.org</mail>
|
||||
<website>https://conlite.org</website>
|
||||
<version>0.1.0</version>
|
||||
<license>GNU Lesser General Public License</license>
|
||||
</general>
|
||||
<requirements php="5.6">
|
||||
<conlite minversion="2.1.0" />
|
||||
</requirements>
|
||||
<conlite>
|
||||
<areas>
|
||||
<area menuless="0">workflow</area>
|
||||
<area parent="workflow" menuless="0">workflow_common</area>
|
||||
<area parent="workflow" menuless="0">workflow_steps</area>
|
||||
<area parent="workflow" menuless="0">workflow_step_edit</area>
|
||||
<area parent="con" menuless="0">con_workflow</area>
|
||||
</areas>
|
||||
<actions>
|
||||
<action area="workflow_common">workflow_show</action>
|
||||
<action area="workflow_common">workflow_create</action>
|
||||
<action area="workflow_common">workflow_save</action>
|
||||
<action area="workflow">workflow_delete</action>
|
||||
<action area="workflow_steps">workflow_step_edit</action>
|
||||
<action area="workflow_steps">workflow_step_up</action>
|
||||
<action area="workflow_steps">workflow_step_down</action>
|
||||
<action area="workflow_steps">workflow_save_step</action>
|
||||
<action area="workflow_steps">workflow_create_step</action>
|
||||
<action area="workflow_steps">workflow_step_delete</action>
|
||||
<action area="workflow_steps">workflow_user_up</action>
|
||||
<action area="workflow_steps">workflow_user_down</action>
|
||||
<action area="workflow_steps">workflow_create_user</action>
|
||||
<action area="workflow_steps">workflow_user_delete</action>
|
||||
<action area="str">workflow_cat_assign</action>
|
||||
<action area="con">workflow_do_action</action>
|
||||
<action area="str">workflow_inherit_down</action>
|
||||
<action area="con_workflow">workflow_task_user_select</action>
|
||||
<action area="con_workflow">workflow_do_action</action>
|
||||
</actions>
|
||||
<frames>
|
||||
<frame area="workflow" filetype="main" name="cl-workflow/includes/include.workflow_left_top.php" frameId="1" />
|
||||
<frame area="workflow" filetype="main" name="cl-workflow/includes/include.workflow_list.php" frameId="2" />
|
||||
<frame area="workflow_common" filetype="main" name="cl-workflow/includes/include.workflow_edit.php" frameId="4" />
|
||||
<frame area="workflow" filetype="main" name="cl-workflow/includes/include.workflow_subnav.php" frameId="3" />
|
||||
<frame area="workflow_steps" filetype="main" name="cl-workflow/includes/include.workflow_steps.php" frameId="4" />
|
||||
<frame area="con_workflow" filetype="main" name="cl-workflow/includes/include.workflow_tasks.php" frameId="4" />
|
||||
</frames>
|
||||
<nav_sub>
|
||||
<nav area="workflow" level="0" navm="extra">cl-workflow/xml/lang_de_DE.xml;navigation/extra/workflow/main</nav>
|
||||
<nav area="workflow_common" level="1" navm="0">cl-workflow/xml/lang_de_DE.xml;navigation/extra/workflow/settings</nav>
|
||||
<nav area="workflow_steps" level="1" navm="0">cl-workflow/xml/lang_de_DE.xml;navigation/extra/workflow/steps</nav>
|
||||
</nav_sub>
|
||||
</conlite>
|
||||
</plugin>
|
|
@ -30,20 +30,6 @@ if (!defined('CON_FRAMEWORK')) {
|
|||
die('Illegal call');
|
||||
}
|
||||
|
||||
|
||||
$cfg["tab"]["workflow"] = $cfg['sql']['sqlprefix'] . "_piwf_workflow";
|
||||
$cfg["tab"]["workflow_allocation"] = $cfg['sql']['sqlprefix'] . "_piwf_allocation";
|
||||
$cfg["tab"]["workflow_art_allocation"] = $cfg['sql']['sqlprefix'] . "_piwf_art_allocation";
|
||||
$cfg["tab"]["workflow_items"] = $cfg['sql']['sqlprefix'] . "_piwf_items";
|
||||
$cfg["tab"]["workflow_user_sequences"] = $cfg['sql']['sqlprefix'] . "_piwf_user_sequences";
|
||||
$cfg["tab"]["workflow_actions"] = $cfg['sql']['sqlprefix'] . "_piwf_actions";
|
||||
|
||||
plugin_include('workflow', 'classes/class.workflowactions.php');
|
||||
plugin_include('workflow', 'classes/class.workflowallocation.php');
|
||||
plugin_include('workflow', 'classes/class.workflowartallocation.php');
|
||||
plugin_include('workflow', 'classes/class.workflowitems.php');
|
||||
plugin_include('workflow', 'classes/class.workflowusersequence.php');
|
||||
|
||||
/**
|
||||
* Class Workflows
|
||||
* Class for workflow management
|
||||
|
@ -136,45 +122,4 @@ class Workflow extends Item {
|
|||
parent::__construct($cfg["tab"]["workflow"], "idworkflow");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* Helper functions */
|
||||
|
||||
function getWorkflowForCat($idcat) {
|
||||
global $lang, $cfg;
|
||||
|
||||
$idcatlang = getCatLang($idcat, $lang);
|
||||
$workflows = new WorkflowAllocations;
|
||||
$workflows->select("idcatlang = '$idcatlang'");
|
||||
if ($obj = $workflows->next()) {
|
||||
/* Sanity: Check if the workflow still exists */
|
||||
$workflow = new Workflow;
|
||||
|
||||
$res = $workflow->loadByPrimaryKey($obj->get("idworkflow"));
|
||||
|
||||
if ($res == false) {
|
||||
return 0;
|
||||
} else {
|
||||
return $obj->get("idworkflow");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getCatLang($idcat, $idlang) {
|
||||
global $lang, $cfg;
|
||||
$db = new DB_ConLite;
|
||||
|
||||
/* Get the idcatlang */
|
||||
$sql = "SELECT idcatlang FROM "
|
||||
. $cfg["tab"]["cat_lang"] .
|
||||
" WHERE idlang = '" . Contenido_Security::escapeDB($idlang, $db) . "' AND
|
||||
idcat = '" . Contenido_Security::escapeDB($idcat, $db) . "'";
|
||||
|
||||
$db->query($sql);
|
||||
|
||||
if ($db->next_record()) {
|
||||
return ($db->f("idcatlang"));
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
}
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Project:
|
||||
* Contenido Content Management System
|
||||
|
@ -25,8 +26,7 @@
|
|||
* }}
|
||||
*
|
||||
*/
|
||||
|
||||
if(!defined('CON_FRAMEWORK')) {
|
||||
if (!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
}
|
||||
|
||||
|
@ -38,77 +38,69 @@ if(!defined('CON_FRAMEWORK')) {
|
|||
* @copyright four for business 2003
|
||||
*/
|
||||
class WorkflowActions extends ItemCollection {
|
||||
|
||||
/**
|
||||
|
||||
/**
|
||||
* Constructor Function
|
||||
* @param string $table The table to use as information source
|
||||
*/
|
||||
function __construct()
|
||||
{
|
||||
global $cfg;
|
||||
parent::__construct($cfg["tab"]["workflow_actions"], "idworkflowaction");
|
||||
function __construct() {
|
||||
global $cfg;
|
||||
parent::__construct($cfg["tab"]["workflow_actions"], "idworkflowaction");
|
||||
$this->_setItemClass("WorkflowAction");
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param type $idworkflowitem
|
||||
* @param type $action
|
||||
* @return boolean
|
||||
*/
|
||||
function get($idworkflowitem, $action)
|
||||
{
|
||||
$this->select("idworkflowitem = '".Contenido_Security::escapeDB($idworkflowitem, NULL)."' AND action = '".Contenido_Security::escapeDB($action, NULL)."'");
|
||||
if ($this->next())
|
||||
{
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function getAvailableWorkflowActions ()
|
||||
{
|
||||
$availableWorkflowActions = array (
|
||||
"publish" => i18n("Publish article", "workflow"),
|
||||
"lock" => i18n("Lock article", "workflow"),
|
||||
"last" => i18n("Move back to last editor", "workflow"),
|
||||
"reject" => i18n("Reject article", "workflow"),
|
||||
"articleedit" => i18n("Edit article content", "workflow"),
|
||||
"propertyedit" => i18n("Edit article properties", "workflow"),
|
||||
"templateedit" => i18n("Edit template", "workflow"),
|
||||
"revise" => i18n("Revise article", "workflow"));
|
||||
|
||||
return($availableWorkflowActions);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param type $idworkflowitem
|
||||
* @param type $action
|
||||
* @return boolean
|
||||
*/
|
||||
function get($idworkflowitem, $action) {
|
||||
$this->select("idworkflowitem = '" . Contenido_Security::escapeDB($idworkflowitem, NULL) . "' AND action = '" . Contenido_Security::escapeDB($action, NULL) . "'");
|
||||
if ($this->next()) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function getAvailableWorkflowActions() {
|
||||
$availableWorkflowActions = array(
|
||||
"publish" => i18n("Publish article", "workflow"),
|
||||
"lock" => i18n("Lock article", "workflow"),
|
||||
"last" => i18n("Move back to last editor", "workflow"),
|
||||
"reject" => i18n("Reject article", "workflow"),
|
||||
"articleedit" => i18n("Edit article content", "workflow"),
|
||||
"propertyedit" => i18n("Edit article properties", "workflow"),
|
||||
"templateedit" => i18n("Edit template", "workflow"),
|
||||
"revise" => i18n("Revise article", "workflow"));
|
||||
|
||||
return($availableWorkflowActions);
|
||||
}
|
||||
|
||||
function set($idworkflowitem, $action) {
|
||||
$this->select("idworkflowitem = '" . Contenido_Security::escapeDB($idworkflowitem, NULL) . "' AND action = '" . Contenido_Security::escapeDB($action, NULL) . "'");
|
||||
if (!$this->next()) {
|
||||
$newitem = parent::createNewItem();
|
||||
$newitem->setField("idworkflowitem", $idworkflowitem);
|
||||
$newitem->setField("action", $action);
|
||||
$newitem->store();
|
||||
}
|
||||
}
|
||||
|
||||
function remove($idworkflowitem, $action) {
|
||||
$this->select("idworkflowitem = '$idworkflowitem' AND action = '$action'");
|
||||
if ($item = $this->next()) {
|
||||
$this->delete($item->getField("idworkflowaction"));
|
||||
}
|
||||
}
|
||||
|
||||
function select($where = "", $group_by = "", $order_by = "", $limit = "") {
|
||||
global $client;
|
||||
|
||||
return parent::select($where, $group_by, $order_by, $limit);
|
||||
}
|
||||
|
||||
function set ($idworkflowitem, $action)
|
||||
{
|
||||
$this->select("idworkflowitem = '".Contenido_Security::escapeDB($idworkflowitem, NULL)."' AND action = '".Contenido_Security::escapeDB($action, NULL)."'");
|
||||
if (!$this->next())
|
||||
{
|
||||
$newitem = parent::createNewItem();
|
||||
$newitem->setField("idworkflowitem",$idworkflowitem);
|
||||
$newitem->setField("action",$action);
|
||||
$newitem->store();
|
||||
}
|
||||
}
|
||||
|
||||
function remove ($idworkflowitem, $action)
|
||||
{
|
||||
$this->select("idworkflowitem = '$idworkflowitem' AND action = '$action'");
|
||||
if ($item = $this->next())
|
||||
{
|
||||
$this->delete($item->getField("idworkflowaction"));
|
||||
}
|
||||
}
|
||||
|
||||
function select ($where = "", $group_by = "", $order_by = "", $limit = "")
|
||||
{
|
||||
global $client;
|
||||
|
||||
return parent::select($where, $group_by, $order_by, $limit);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -119,14 +111,16 @@ class WorkflowActions extends ItemCollection {
|
|||
* @copyright four for business 2003
|
||||
*/
|
||||
class WorkflowAction extends Item {
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @global type $cfg
|
||||
*/
|
||||
function __construct() {
|
||||
function __construct() {
|
||||
global $cfg;
|
||||
parent::__construct($cfg["tab"]["workflow_actions"], "idworkflowaction");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Project:
|
||||
* Contenido Content Management System
|
||||
|
@ -25,12 +26,10 @@
|
|||
* }}
|
||||
*
|
||||
*/
|
||||
|
||||
if(!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
if (!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Class WorkflowAllocations
|
||||
* Class for workflow allocation management
|
||||
|
@ -39,112 +38,100 @@ if(!defined('CON_FRAMEWORK')) {
|
|||
* @copyright four for business 2003
|
||||
*/
|
||||
class WorkflowAllocations extends ItemCollection {
|
||||
|
||||
/**
|
||||
|
||||
/**
|
||||
* Constructor Function
|
||||
* @param string $table The table to use as information source
|
||||
*/
|
||||
function __construct()
|
||||
{
|
||||
global $cfg;
|
||||
parent::__construct($cfg["tab"]["workflow_allocation"], "idallocation");
|
||||
function __construct() {
|
||||
global $cfg;
|
||||
parent::__construct($cfg["tab"]["workflow_allocation"], "idallocation");
|
||||
$this->_setItemClass("WorkflowAllocation");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/** @deprecated [2011-03-15] Old constructor function for downwards compatibility */
|
||||
function WorkflowAllocations()
|
||||
{
|
||||
function WorkflowAllocations() {
|
||||
cWarning(__FILE__, __LINE__, "Deprecated method call, use __construct()");
|
||||
$this->__construct();
|
||||
}
|
||||
|
||||
function delete ($idallocation)
|
||||
{
|
||||
global $cfg, $lang;
|
||||
function delete($idallocation) {
|
||||
global $cfg, $lang;
|
||||
|
||||
$obj = new WorkflowAllocation;
|
||||
$obj->loadByPrimaryKey($idallocation);
|
||||
|
||||
$idcatlang = $obj->get("idcatlang");
|
||||
$obj = new WorkflowAllocation;
|
||||
$obj->loadByPrimaryKey($idallocation);
|
||||
|
||||
$db = new DB_ConLite;
|
||||
$sql = "SELECT idcat FROM ".$cfg["tab"]["cat_lang"]." WHERE idcatlang = '".Contenido_Security::toInteger($idcatlang)."'";
|
||||
$db->query($sql);
|
||||
$db->next_record();
|
||||
$idcat = $db->f("idcat");
|
||||
|
||||
$sql = "SELECT idart FROM ".$cfg["tab"]["cat_art"]." WHERE idcat = '".Contenido_Security::toInteger($idcat)."'";
|
||||
$db->query($sql);
|
||||
|
||||
while ($db->next_record())
|
||||
{
|
||||
$idarts[] = $db->f("idart");
|
||||
}
|
||||
|
||||
$idartlangs = array();
|
||||
|
||||
if (is_array($idarts))
|
||||
{
|
||||
foreach ($idarts as $idart)
|
||||
{
|
||||
$sql = "SELECT idartlang FROM ".$cfg["tab"]["art_lang"]." WHERE idart = '".Contenido_Security::toInteger($idart)."' and idlang = '".Contenido_Security::toInteger($lang)."'";
|
||||
$db->query($sql);
|
||||
if ($db->next_record())
|
||||
{
|
||||
$idartlangs[] = $db->f("idartlang");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$workflowArtAllocation = new WorkflowArtAllocation;
|
||||
$workflowArtAllocations = new WorkflowArtAllocations;
|
||||
|
||||
foreach ($idartlangs as $idartlang)
|
||||
{
|
||||
$workflowArtAllocation->loadBy("idartlang", $idartlang);
|
||||
$workflowArtAllocations->delete($workflowArtAllocation->get("idartallocation"));
|
||||
}
|
||||
$idcatlang = $obj->get("idcatlang");
|
||||
|
||||
$db = new DB_ConLite;
|
||||
$sql = "SELECT idcat FROM " . $cfg["tab"]["cat_lang"] . " WHERE idcatlang = '" . Contenido_Security::toInteger($idcatlang) . "'";
|
||||
$db->query($sql);
|
||||
$db->next_record();
|
||||
$idcat = $db->f("idcat");
|
||||
|
||||
$sql = "SELECT idart FROM " . $cfg["tab"]["cat_art"] . " WHERE idcat = '" . Contenido_Security::toInteger($idcat) . "'";
|
||||
$db->query($sql);
|
||||
|
||||
while ($db->next_record()) {
|
||||
$idarts[] = $db->f("idart");
|
||||
}
|
||||
|
||||
$idartlangs = array();
|
||||
|
||||
if (is_array($idarts)) {
|
||||
foreach ($idarts as $idart) {
|
||||
$sql = "SELECT idartlang FROM " . $cfg["tab"]["art_lang"] . " WHERE idart = '" . Contenido_Security::toInteger($idart) . "' and idlang = '" . Contenido_Security::toInteger($lang) . "'";
|
||||
$db->query($sql);
|
||||
if ($db->next_record()) {
|
||||
$idartlangs[] = $db->f("idartlang");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$workflowArtAllocation = new WorkflowArtAllocation;
|
||||
$workflowArtAllocations = new WorkflowArtAllocations;
|
||||
|
||||
foreach ($idartlangs as $idartlang) {
|
||||
$workflowArtAllocation->loadBy("idartlang", $idartlang);
|
||||
$workflowArtAllocations->delete($workflowArtAllocation->get("idartallocation"));
|
||||
}
|
||||
|
||||
parent::delete($idallocation);
|
||||
}
|
||||
|
||||
function create($idworkflow, $idcatlang) {
|
||||
$this->select("idcatlang = '$idcatlang'");
|
||||
|
||||
if ($this->next() !== false) {
|
||||
$this->lasterror = i18n("Category already has a workflow assigned", "workflow");
|
||||
return false;
|
||||
}
|
||||
|
||||
$workflows = new Workflows;
|
||||
$workflows->select("idworkflow = '$idworkflow'");
|
||||
|
||||
if ($workflows->next() === false) {
|
||||
$this->lasterror = i18n("Workflow doesn't exist", "workflow");
|
||||
return false;
|
||||
}
|
||||
$newitem = parent::createNewItem();
|
||||
if (!$newitem->setWorkflow($idworkflow)) {
|
||||
$this->lasterror = $newitem->lasterror;
|
||||
$workflows->delete($newitem->getField("idallocation"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!$newitem->setCatLang($idcatlang)) {
|
||||
$this->lasterror = $newitem->lasterror;
|
||||
$workflows->delete($newitem->getField("idallocation"));
|
||||
return false;
|
||||
}
|
||||
|
||||
$newitem->store();
|
||||
|
||||
return ($newitem);
|
||||
}
|
||||
|
||||
parent::delete($idallocation);
|
||||
}
|
||||
|
||||
function create ($idworkflow, $idcatlang)
|
||||
{
|
||||
$this->select("idcatlang = '$idcatlang'");
|
||||
|
||||
if ($this->next() !== false)
|
||||
{
|
||||
$this->lasterror = i18n("Category already has a workflow assigned", "workflow");
|
||||
return false;
|
||||
}
|
||||
|
||||
$workflows = new Workflows;
|
||||
$workflows->select("idworkflow = '$idworkflow'");
|
||||
|
||||
if ($workflows->next() === false)
|
||||
{
|
||||
$this->lasterror = i18n("Workflow doesn't exist", "workflow");
|
||||
return false;
|
||||
}
|
||||
$newitem = parent::createNewItem();
|
||||
if (!$newitem->setWorkflow($idworkflow))
|
||||
{
|
||||
$this->lasterror = $newitem->lasterror;
|
||||
$workflows->delete($newitem->getField("idallocation"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!$newitem->setCatLang($idcatlang))
|
||||
{
|
||||
$this->lasterror = $newitem->lasterror;
|
||||
$workflows->delete($newitem->getField("idallocation"));
|
||||
return false;
|
||||
}
|
||||
|
||||
$newitem->store();
|
||||
|
||||
return ($newitem);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -155,88 +142,82 @@ class WorkflowAllocations extends ItemCollection {
|
|||
* @copyright four for business 2003
|
||||
*/
|
||||
class WorkflowAllocation extends Item {
|
||||
|
||||
/**
|
||||
|
||||
/**
|
||||
* Constructor Function
|
||||
* @param string $table The table to use as information source
|
||||
*/
|
||||
function __construct()
|
||||
{
|
||||
global $cfg;
|
||||
|
||||
parent::__construct($cfg["tab"]["workflow_allocation"], "idallocation");
|
||||
}
|
||||
function __construct() {
|
||||
global $cfg;
|
||||
|
||||
parent::__construct($cfg["tab"]["workflow_allocation"], "idallocation");
|
||||
}
|
||||
|
||||
/** @deprecated [2011-03-15] Old constructor function for downwards compatibility */
|
||||
function WorkflowAllocation()
|
||||
{
|
||||
function WorkflowAllocation() {
|
||||
cWarning(__FILE__, __LINE__, "Deprecated method call, use __construct()");
|
||||
$this->__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Overridden setField function. Users should only use setWorkflow.
|
||||
* @param string $field Void field since we override the usual setField function
|
||||
* @param string $value Void field since we override the usual setField function
|
||||
*/
|
||||
function setField($field, $value, $bSafe = true)
|
||||
{
|
||||
die("Don't use setField for WorkflowAllocation items! Use setWorkflow instead!");
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
function setField($field, $value, $bSafe = true) {
|
||||
die("Don't use setField for WorkflowAllocation items! Use setWorkflow instead!");
|
||||
}
|
||||
|
||||
/**
|
||||
* setWorkflow sets the workflow for the current item.
|
||||
* @param int $idworkflow Workflow-ID to set the item to
|
||||
*/
|
||||
function setWorkflow ($idworkflow)
|
||||
{
|
||||
$workflows = new Workflows;
|
||||
*/
|
||||
function setWorkflow($idworkflow) {
|
||||
$workflows = new Workflows;
|
||||
|
||||
$workflows->select("idworkflow = '$idworkflow'");
|
||||
|
||||
if ($workflows->next() === false)
|
||||
{
|
||||
$this->lasterror = i18n("Workflow doesn't exist", "workflow");
|
||||
return false;
|
||||
}
|
||||
|
||||
parent::setField("idworkflow", $idworkflow);
|
||||
parent::store();
|
||||
return true;
|
||||
}
|
||||
$workflows->select("idworkflow = '$idworkflow'");
|
||||
|
||||
/**
|
||||
if ($workflows->next() === false) {
|
||||
$this->lasterror = i18n("Workflow doesn't exist", "workflow");
|
||||
return false;
|
||||
}
|
||||
|
||||
parent::setField("idworkflow", $idworkflow);
|
||||
parent::store();
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* setCatLang sets the idcatlang for the current item. Should
|
||||
* only be called by the create function.
|
||||
* only be called by the create function.
|
||||
* @param int $idcatlang idcatlang to set.
|
||||
*/
|
||||
function setCatLang ($idcatlang)
|
||||
{
|
||||
global $cfg;
|
||||
|
||||
$allocations = new WorkflowAllocations;
|
||||
|
||||
$allocations->select("idcatlang = '$idcatlang'");
|
||||
|
||||
if ($allocations->next() !== false)
|
||||
{
|
||||
$this->lasterror = i18n("Category already has a workflow assigned", "workflow");
|
||||
return false;
|
||||
}
|
||||
|
||||
$db = new DB_ConLite;
|
||||
$sql = "SELECT idcatlang FROM ".$cfg["tab"]["cat_lang"]." WHERE idcatlang = '".Contenido_Security::toInteger($idcatlang)."'";
|
||||
$db->query($sql);
|
||||
|
||||
if (!$db->next_record())
|
||||
{
|
||||
$this->lasterror = i18n("Category doesn't exist, assignment failed", "workflow");
|
||||
return false;
|
||||
}
|
||||
*/
|
||||
function setCatLang($idcatlang) {
|
||||
global $cfg;
|
||||
|
||||
$allocations = new WorkflowAllocations;
|
||||
|
||||
$allocations->select("idcatlang = '$idcatlang'");
|
||||
|
||||
if ($allocations->next() !== false) {
|
||||
$this->lasterror = i18n("Category already has a workflow assigned", "workflow");
|
||||
return false;
|
||||
}
|
||||
|
||||
$db = new DB_ConLite;
|
||||
$sql = "SELECT idcatlang FROM " . $cfg["tab"]["cat_lang"] . " WHERE idcatlang = '" . Contenido_Security::toInteger($idcatlang) . "'";
|
||||
$db->query($sql);
|
||||
|
||||
if (!$db->next_record()) {
|
||||
$this->lasterror = i18n("Category doesn't exist, assignment failed", "workflow");
|
||||
return false;
|
||||
}
|
||||
|
||||
parent::setField("idcatlang", $idcatlang);
|
||||
parent::store();
|
||||
return true;
|
||||
}
|
||||
|
||||
parent::setField("idcatlang", $idcatlang);
|
||||
parent::store();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Project:
|
||||
* Contenido Content Management System
|
||||
|
@ -26,12 +27,10 @@
|
|||
* }}
|
||||
*
|
||||
*/
|
||||
|
||||
if(!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
if (!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Class WorkflowArtAllocations
|
||||
* Class for workflow art allocation management
|
||||
|
@ -40,53 +39,49 @@ if(!defined('CON_FRAMEWORK')) {
|
|||
* @copyright four for business 2003
|
||||
*/
|
||||
class WorkflowArtAllocations extends ItemCollection {
|
||||
|
||||
/**
|
||||
|
||||
/**
|
||||
* Constructor Function
|
||||
* @param string $table The table to use as information source
|
||||
*/
|
||||
function __construct()
|
||||
{
|
||||
global $cfg;
|
||||
parent::__construct($cfg["tab"]["workflow_art_allocation"], "idartallocation");
|
||||
function __construct() {
|
||||
global $cfg;
|
||||
parent::__construct($cfg["tab"]["workflow_art_allocation"], "idartallocation");
|
||||
$this->_setItemClass("WorkflowArtAllocation");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/** @deprecated [2011-03-15] Old constructor function for downwards compatibility */
|
||||
function WorkflowArtAllocations()
|
||||
{
|
||||
function WorkflowArtAllocations() {
|
||||
cWarning(__FILE__, __LINE__, "Deprecated method call, use __construct()");
|
||||
$this->__construct();
|
||||
}
|
||||
|
||||
function create ($idartlang)
|
||||
{
|
||||
global $cfg;
|
||||
|
||||
$sql = "SELECT idartlang FROM " .$cfg["tab"]["art_lang"].
|
||||
" WHERE idartlang = '".Contenido_Security::escapeDB($idartlang, $this->db)."'";
|
||||
function create($idartlang) {
|
||||
global $cfg;
|
||||
|
||||
$sql = "SELECT idartlang FROM " . $cfg["tab"]["art_lang"] .
|
||||
" WHERE idartlang = '" . Contenido_Security::escapeDB($idartlang, $this->db) . "'";
|
||||
|
||||
$this->db->query($sql);
|
||||
if (!$this->db->next_record()) {
|
||||
$this->lasterror = i18n("Article doesn't exist", "workflow");
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->select("idartlang = '$idartlang'");
|
||||
|
||||
if ($this->next() !== false) {
|
||||
$this->lasterror = i18n("Article is already assigned to a usersequence step.", "workflow");
|
||||
return false;
|
||||
}
|
||||
|
||||
$newitem = parent::createNewItem();
|
||||
$newitem->setField("idartlang", $idartlang);
|
||||
$newitem->store();
|
||||
|
||||
return ($newitem);
|
||||
}
|
||||
|
||||
$this->db->query($sql);
|
||||
if (!$this->db->next_record())
|
||||
{
|
||||
$this->lasterror = i18n("Article doesn't exist", "workflow");
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->select("idartlang = '$idartlang'");
|
||||
|
||||
if ($this->next() !== false)
|
||||
{
|
||||
$this->lasterror = i18n("Article is already assigned to a usersequence step.", "workflow");
|
||||
return false;
|
||||
}
|
||||
|
||||
$newitem = parent::createNewItem();
|
||||
$newitem->setField("idartlang",$idartlang);
|
||||
$newitem->store();
|
||||
|
||||
return ($newitem);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -97,265 +92,241 @@ class WorkflowArtAllocations extends ItemCollection {
|
|||
* @copyright four for business 2003
|
||||
*/
|
||||
class WorkflowArtAllocation extends Item {
|
||||
|
||||
/**
|
||||
|
||||
/**
|
||||
* Constructor Function
|
||||
* @param string $table The table to use as information source
|
||||
*/
|
||||
function __construct()
|
||||
{
|
||||
global $cfg;
|
||||
|
||||
parent::__construct($cfg["tab"]["workflow_art_allocation"], "idartallocation");
|
||||
}
|
||||
function __construct() {
|
||||
global $cfg;
|
||||
|
||||
parent::__construct($cfg["tab"]["workflow_art_allocation"], "idartallocation");
|
||||
}
|
||||
|
||||
/** @deprecated [2011-03-15] Old constructor function for downwards compatibility */
|
||||
function WorkflowArtAllocation()
|
||||
{
|
||||
function WorkflowArtAllocation() {
|
||||
cWarning(__FILE__, __LINE__, "Deprecated method call, use __construct()");
|
||||
$this->__construct();
|
||||
}
|
||||
|
||||
function getWorkflowItem ()
|
||||
{
|
||||
$userSequence = new WorkflowUserSequence;
|
||||
$userSequence->loadByPrimaryKey($this->values["idusersequence"]);
|
||||
|
||||
return ($userSequence->getWorkflowItem());
|
||||
}
|
||||
|
||||
/**
|
||||
function getWorkflowItem() {
|
||||
$userSequence = new WorkflowUserSequence;
|
||||
$userSequence->loadByPrimaryKey($this->values["idusersequence"]);
|
||||
|
||||
return ($userSequence->getWorkflowItem());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current item position
|
||||
* @param string $field Void field since we override the usual setField function
|
||||
* @param string $value Void field since we override the usual setField function
|
||||
*/
|
||||
function currentItemPosition()
|
||||
{
|
||||
$idworkflowitem = $this->get("idworkflowitem");
|
||||
|
||||
$workflowItems = new WorkflowItems;
|
||||
$workflowItems->select("idworkflowitem = '$idworkflowitem'");
|
||||
|
||||
if ($item = $workflowItems->next())
|
||||
{
|
||||
return ($item->get("position"));
|
||||
}
|
||||
}
|
||||
*/
|
||||
function currentItemPosition() {
|
||||
$idworkflowitem = $this->get("idworkflowitem");
|
||||
|
||||
/**
|
||||
$workflowItems = new WorkflowItems;
|
||||
$workflowItems->select("idworkflowitem = '$idworkflowitem'");
|
||||
|
||||
if ($item = $workflowItems->next()) {
|
||||
return ($item->get("position"));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current user position
|
||||
* @param string $field Void field since we override the usual setField function
|
||||
* @param string $value Void field since we override the usual setField function
|
||||
*/
|
||||
function currentUserPosition()
|
||||
{
|
||||
return ($this->get("position"));
|
||||
}
|
||||
*/
|
||||
function currentUserPosition() {
|
||||
return ($this->get("position"));
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Overriden store function to send mails
|
||||
* @param none
|
||||
*/
|
||||
function store()
|
||||
{
|
||||
global $cfg;
|
||||
|
||||
$sMailhost = getSystemProperty('system', 'mail_host');
|
||||
*/
|
||||
function store() {
|
||||
global $cfg;
|
||||
|
||||
$sMailhost = getSystemProperty('system', 'mail_host');
|
||||
if ($sMailhost == '') {
|
||||
$sMailhost = 'localhost';
|
||||
}
|
||||
|
||||
//modified : 2008-06-25 - use php mailer class instead of mail()
|
||||
$oMail = new PHPMailer();
|
||||
}
|
||||
|
||||
//modified : 2008-06-25 - use php mailer class instead of mail()
|
||||
$oMail = new PHPMailer();
|
||||
$oMail->Host = $sMailhost;
|
||||
$oMail->IsHTML(0);
|
||||
$oMail->WordWrap = 1000;
|
||||
$oMail->IsMail();
|
||||
|
||||
if (array_key_exists("idusersequence",$this->modifiedValues))
|
||||
{
|
||||
$usersequence = new WorkflowUserSequence;
|
||||
$usersequence->loadByPrimaryKey($this->values["idusersequence"]);
|
||||
|
||||
$email = $usersequence->get("emailnoti");
|
||||
$escal = $usersequence->get("escalationnoti");
|
||||
|
||||
if ($email == 1 || $escal == 1)
|
||||
{
|
||||
/* Grab the required informations */
|
||||
$curEditor = getGroupOrUserName($usersequence->get("iduser"));
|
||||
$idartlang = $this->get("idartlang");
|
||||
$timeunit = $usersequence->get("timeunit");
|
||||
$timelimit = $usersequence->get("timelimit");
|
||||
|
||||
$db = new DB_ConLite;
|
||||
$sql = "SELECT author, title, idart FROM ".$cfg["tab"]["art_lang"]." WHERE idartlang = '".Contenido_Security::escapeDB($idartlang, $db)."'";
|
||||
|
||||
$db->query($sql);
|
||||
|
||||
if ($db->next_record())
|
||||
{
|
||||
$idart = $db->f("idart");
|
||||
$title = $db->f("title");
|
||||
$author = $db->f("author");
|
||||
}
|
||||
|
||||
/* Extract category */
|
||||
$sql = "SELECT idcat FROM ".$cfg["tab"]["cat_art"]." WHERE idart = '".Contenido_Security::escapeDB($idart, $db)."'";
|
||||
$db->query($sql);
|
||||
|
||||
if ($db->next_record())
|
||||
{
|
||||
$idcat = $db->f("idcat");
|
||||
}
|
||||
|
||||
$sql = "SELECT name FROM ".$cfg["tab"]["cat_lang"]." WHERE idcat = '".Contenido_Security::escapeDB($idcat, $db)."'";
|
||||
$db->query($sql);
|
||||
|
||||
if ($db->next_record())
|
||||
{
|
||||
$catname = $db->f("name");
|
||||
}
|
||||
|
||||
$starttime = $this->get("starttime");
|
||||
|
||||
|
||||
$starttime = strtotime (substr_replace (substr (substr ($starttime,0,2).chunk_split (substr ($starttime,2,6),2,"-").chunk_split (substr ($starttime,8),2,":"),0,19)," ",10,1));
|
||||
|
||||
switch ($timeunit)
|
||||
{
|
||||
case "Seconds":
|
||||
$maxtime = $starttime + $timelimit;
|
||||
break;
|
||||
case "Minutes":
|
||||
$maxtime = $starttime + ($timelimit * 60);
|
||||
break;
|
||||
case "Hours":
|
||||
$maxtime = $starttime + ($timelimit * 3600);
|
||||
break;
|
||||
case "Days":
|
||||
$maxtime = $starttime + ($timelimit * 86400);
|
||||
break;
|
||||
case "Weeks":
|
||||
$maxtime = $starttime + ($timelimit * 604800);
|
||||
break;
|
||||
case "Months":
|
||||
$maxtime = $starttime + ($timelimit * 2678400);
|
||||
break;
|
||||
case "Years":
|
||||
$maxtime = $starttime + ($timelimit * 31536000);
|
||||
break;
|
||||
default:
|
||||
$maxtime = $starttime + $timelimit;
|
||||
}
|
||||
|
||||
if ($email == 1)
|
||||
{
|
||||
$email = "Hello %s,\n\n".
|
||||
"you are assigned as the next editor for the Article %s.\n\n".
|
||||
"More informations:\n".
|
||||
"Article: %s\n".
|
||||
"Category: %s\n".
|
||||
"Editor: %s\n".
|
||||
"Author: %s\n".
|
||||
"Editable from: %s\n".
|
||||
"Editable to: %s\n";
|
||||
|
||||
$filledMail = sprintf( $email,
|
||||
$curEditor,
|
||||
$title,
|
||||
$title,
|
||||
$catname,
|
||||
$curEditor,
|
||||
$author,
|
||||
date("Y-m-d H:i:s", $starttime),
|
||||
date("Y-m-d H:i:s", $maxtime));
|
||||
$user = new User;
|
||||
$oMail->WordWrap = 1000;
|
||||
$oMail->IsMail();
|
||||
|
||||
if (isGroup($usersequence->get("iduser")))
|
||||
{
|
||||
$sql = "select idgroupuser, user_id FROM ". $cfg["tab"]["groupmembers"] ." WHERE
|
||||
group_id = '".Contenido_Security::escapeDB($usersequence->get("iduser"), $db)."'";
|
||||
$db->query($sql);
|
||||
|
||||
while ($db->next_record())
|
||||
{
|
||||
$user->loadUserByUserID($db->f("user_id"));
|
||||
//modified : 2008-06-25 - use php mailer class instead of mail()
|
||||
$oMail->AddAddress($user->getField("email"), "");
|
||||
$oMail->Subject = stripslashes (i18n('Workflow notification'));
|
||||
$oMail->Body = $filledMail;
|
||||
$oMail->Send();
|
||||
}
|
||||
|
||||
} else {
|
||||
$user->loadUserByUserID($usersequence->get("iduser"));
|
||||
//modified : 2008-06-25 - use php mailer class instead of mail()
|
||||
$oMail->AddAddress($user->getField("email"), "");
|
||||
$oMail->Subject = stripslashes (i18n('Workflow notification'));
|
||||
$oMail->Body = $filledMail;
|
||||
$oMail->Send();
|
||||
}
|
||||
|
||||
} else {
|
||||
$email = "Hello %s,\n\n".
|
||||
"you are assigned as the escalator for the Article %s.\n\n".
|
||||
"More informations:\n".
|
||||
"Article: %s\n".
|
||||
"Category: %s\n".
|
||||
"Editor: %s\n".
|
||||
"Author: %s\n".
|
||||
"Editable from: %s\n".
|
||||
"Editable to: %s\n";
|
||||
|
||||
$filledMail = sprintf( $email,
|
||||
$curEditor,
|
||||
$title,
|
||||
$title,
|
||||
$catname,
|
||||
$curEditor,
|
||||
$author,
|
||||
date("Y-m-d H:i:s", $starttime),
|
||||
date("Y-m-d H:i:s", $maxtime));
|
||||
|
||||
$user = new User;
|
||||
|
||||
if (isGroup($usersequence->get("iduser")))
|
||||
{
|
||||
|
||||
$sql = "select idgroupuser, user_id FROM ". $cfg["tab"]["groupmembers"] ." WHERE
|
||||
group_id = '".Contenido_Security::escapeDB($usersequence->get("iduser"), $db)."'";
|
||||
$db->query($sql);
|
||||
|
||||
while ($db->next_record())
|
||||
{
|
||||
$user->loadUserByUserID($db->f("user_id"));
|
||||
echo "mail to ".$user->getField("email")."<br>";
|
||||
//modified : 2008-06-25 - use php mailer class instead of mail()
|
||||
$oMail->AddAddress($user->getField("email"), "");
|
||||
$oMail->Subject = stripslashes (i18n('Workflow escalation'));
|
||||
$oMail->Body = $filledMail;
|
||||
$oMail->Send();
|
||||
}
|
||||
|
||||
} else {
|
||||
$user->loadUserByUserID($usersequence->get("iduser"));
|
||||
echo "mail to ".$user->getField("email")."<br>";
|
||||
//modified : 2008-06-25 - use php mailer class instead of mail()
|
||||
$oMail->AddAddress($user->getField("email"), "");
|
||||
$oMail->Subject = stripslashes (i18n('Workflow escalation'));
|
||||
$oMail->Body = $filledMail;
|
||||
$oMail->Send();
|
||||
}
|
||||
}
|
||||
|
||||
if (array_key_exists("idusersequence", $this->modifiedValues)) {
|
||||
$usersequence = new WorkflowUserSequence;
|
||||
$usersequence->loadByPrimaryKey($this->values["idusersequence"]);
|
||||
|
||||
$email = $usersequence->get("emailnoti");
|
||||
$escal = $usersequence->get("escalationnoti");
|
||||
|
||||
if ($email == 1 || $escal == 1) {
|
||||
/* Grab the required informations */
|
||||
$curEditor = getGroupOrUserName($usersequence->get("iduser"));
|
||||
$idartlang = $this->get("idartlang");
|
||||
$timeunit = $usersequence->get("timeunit");
|
||||
$timelimit = $usersequence->get("timelimit");
|
||||
|
||||
$db = new DB_ConLite;
|
||||
$sql = "SELECT author, title, idart FROM " . $cfg["tab"]["art_lang"] . " WHERE idartlang = '" . Contenido_Security::escapeDB($idartlang, $db) . "'";
|
||||
|
||||
$db->query($sql);
|
||||
|
||||
if ($db->next_record()) {
|
||||
$idart = $db->f("idart");
|
||||
$title = $db->f("title");
|
||||
$author = $db->f("author");
|
||||
}
|
||||
|
||||
/* Extract category */
|
||||
$sql = "SELECT idcat FROM " . $cfg["tab"]["cat_art"] . " WHERE idart = '" . Contenido_Security::escapeDB($idart, $db) . "'";
|
||||
$db->query($sql);
|
||||
|
||||
if ($db->next_record()) {
|
||||
$idcat = $db->f("idcat");
|
||||
}
|
||||
|
||||
$sql = "SELECT name FROM " . $cfg["tab"]["cat_lang"] . " WHERE idcat = '" . Contenido_Security::escapeDB($idcat, $db) . "'";
|
||||
$db->query($sql);
|
||||
|
||||
if ($db->next_record()) {
|
||||
$catname = $db->f("name");
|
||||
}
|
||||
|
||||
$starttime = $this->get("starttime");
|
||||
|
||||
|
||||
$starttime = strtotime(substr_replace(substr(substr($starttime, 0, 2) . chunk_split(substr($starttime, 2, 6), 2, "-") . chunk_split(substr($starttime, 8), 2, ":"), 0, 19), " ", 10, 1));
|
||||
|
||||
switch ($timeunit) {
|
||||
case "Seconds":
|
||||
$maxtime = $starttime + $timelimit;
|
||||
break;
|
||||
case "Minutes":
|
||||
$maxtime = $starttime + ($timelimit * 60);
|
||||
break;
|
||||
case "Hours":
|
||||
$maxtime = $starttime + ($timelimit * 3600);
|
||||
break;
|
||||
case "Days":
|
||||
$maxtime = $starttime + ($timelimit * 86400);
|
||||
break;
|
||||
case "Weeks":
|
||||
$maxtime = $starttime + ($timelimit * 604800);
|
||||
break;
|
||||
case "Months":
|
||||
$maxtime = $starttime + ($timelimit * 2678400);
|
||||
break;
|
||||
case "Years":
|
||||
$maxtime = $starttime + ($timelimit * 31536000);
|
||||
break;
|
||||
default:
|
||||
$maxtime = $starttime + $timelimit;
|
||||
}
|
||||
|
||||
if ($email == 1) {
|
||||
$email = "Hello %s,\n\n" .
|
||||
"you are assigned as the next editor for the Article %s.\n\n" .
|
||||
"More informations:\n" .
|
||||
"Article: %s\n" .
|
||||
"Category: %s\n" .
|
||||
"Editor: %s\n" .
|
||||
"Author: %s\n" .
|
||||
"Editable from: %s\n" .
|
||||
"Editable to: %s\n";
|
||||
|
||||
$filledMail = sprintf($email,
|
||||
$curEditor,
|
||||
$title,
|
||||
$title,
|
||||
$catname,
|
||||
$curEditor,
|
||||
$author,
|
||||
date("Y-m-d H:i:s", $starttime),
|
||||
date("Y-m-d H:i:s", $maxtime));
|
||||
$user = new User;
|
||||
|
||||
if (isGroup($usersequence->get("iduser"))) {
|
||||
$sql = "select idgroupuser, user_id FROM " . $cfg["tab"]["groupmembers"] . " WHERE
|
||||
group_id = '" . Contenido_Security::escapeDB($usersequence->get("iduser"), $db) . "'";
|
||||
$db->query($sql);
|
||||
|
||||
while ($db->next_record()) {
|
||||
$user->loadUserByUserID($db->f("user_id"));
|
||||
//modified : 2008-06-25 - use php mailer class instead of mail()
|
||||
$oMail->AddAddress($user->getField("email"), "");
|
||||
$oMail->Subject = stripslashes(i18n('Workflow notification'));
|
||||
$oMail->Body = $filledMail;
|
||||
$oMail->Send();
|
||||
}
|
||||
} else {
|
||||
$user->loadUserByUserID($usersequence->get("iduser"));
|
||||
//modified : 2008-06-25 - use php mailer class instead of mail()
|
||||
$oMail->AddAddress($user->getField("email"), "");
|
||||
$oMail->Subject = stripslashes(i18n('Workflow notification'));
|
||||
$oMail->Body = $filledMail;
|
||||
$oMail->Send();
|
||||
}
|
||||
} else {
|
||||
$email = "Hello %s,\n\n" .
|
||||
"you are assigned as the escalator for the Article %s.\n\n" .
|
||||
"More informations:\n" .
|
||||
"Article: %s\n" .
|
||||
"Category: %s\n" .
|
||||
"Editor: %s\n" .
|
||||
"Author: %s\n" .
|
||||
"Editable from: %s\n" .
|
||||
"Editable to: %s\n";
|
||||
|
||||
$filledMail = sprintf($email,
|
||||
$curEditor,
|
||||
$title,
|
||||
$title,
|
||||
$catname,
|
||||
$curEditor,
|
||||
$author,
|
||||
date("Y-m-d H:i:s", $starttime),
|
||||
date("Y-m-d H:i:s", $maxtime));
|
||||
|
||||
$user = new User;
|
||||
|
||||
if (isGroup($usersequence->get("iduser"))) {
|
||||
|
||||
$sql = "select idgroupuser, user_id FROM " . $cfg["tab"]["groupmembers"] . " WHERE
|
||||
group_id = '" . Contenido_Security::escapeDB($usersequence->get("iduser"), $db) . "'";
|
||||
$db->query($sql);
|
||||
|
||||
while ($db->next_record()) {
|
||||
$user->loadUserByUserID($db->f("user_id"));
|
||||
echo "mail to " . $user->getField("email") . "<br>";
|
||||
//modified : 2008-06-25 - use php mailer class instead of mail()
|
||||
$oMail->AddAddress($user->getField("email"), "");
|
||||
$oMail->Subject = stripslashes(i18n('Workflow escalation'));
|
||||
$oMail->Body = $filledMail;
|
||||
$oMail->Send();
|
||||
}
|
||||
} else {
|
||||
$user->loadUserByUserID($usersequence->get("iduser"));
|
||||
echo "mail to " . $user->getField("email") . "<br>";
|
||||
//modified : 2008-06-25 - use php mailer class instead of mail()
|
||||
$oMail->AddAddress($user->getField("email"), "");
|
||||
$oMail->Subject = stripslashes(i18n('Workflow escalation'));
|
||||
$oMail->Body = $filledMail;
|
||||
$oMail->Send();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return parent::store();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
return parent::store();
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Project:
|
||||
* Contenido Content Management System
|
||||
|
@ -25,12 +26,10 @@
|
|||
* }}
|
||||
*
|
||||
*/
|
||||
|
||||
if(!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
if (!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Class WorkflowTasks
|
||||
* Class for workflow task collections
|
||||
|
@ -39,41 +38,37 @@ if(!defined('CON_FRAMEWORK')) {
|
|||
* @copyright four for business 2003
|
||||
*/
|
||||
class WorkflowTasks extends ItemCollection {
|
||||
|
||||
/**
|
||||
|
||||
/**
|
||||
* Constructor Function
|
||||
* @param string $table The table to use as information source
|
||||
*/
|
||||
function __construct()
|
||||
{
|
||||
global $cfg;
|
||||
parent::__construct($cfg["tab"]["tasks"], "idtask");
|
||||
function __construct() {
|
||||
global $cfg;
|
||||
parent::__construct($cfg["tab"]["tasks"], "idtask");
|
||||
$this->_setItemClass("WorkflowTask");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/** @deprecated [2011-03-15] Old constructor function for downwards compatibility */
|
||||
function WorkflowTasks()
|
||||
{
|
||||
function WorkflowTasks() {
|
||||
cWarning(__FILE__, __LINE__, "Deprecated method call, use __construct()");
|
||||
$this->__construct();
|
||||
}
|
||||
|
||||
function create ()
|
||||
{
|
||||
$newitem = parent::createNewItem();
|
||||
return ($newitem);
|
||||
}
|
||||
|
||||
function select ($where = "", $group_by = "", $order_by = "", $limit = "")
|
||||
{
|
||||
global $client;
|
||||
|
||||
if ($where != "")
|
||||
{
|
||||
$where = $where . " AND idclient = '".Contenido_Security::escapeDB($client, NULL)."'";
|
||||
}
|
||||
return parent::select($where, $group_by, $order_by, $limit);
|
||||
}
|
||||
function create() {
|
||||
$newitem = parent::createNewItem();
|
||||
return ($newitem);
|
||||
}
|
||||
|
||||
function select($where = "", $group_by = "", $order_by = "", $limit = "") {
|
||||
global $client;
|
||||
|
||||
if ($where != "") {
|
||||
$where = $where . " AND idclient = '" . Contenido_Security::escapeDB($client, NULL) . "'";
|
||||
}
|
||||
return parent::select($where, $group_by, $order_by, $limit);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -84,23 +79,22 @@ class WorkflowTasks extends ItemCollection {
|
|||
* @copyright four for business 2003
|
||||
*/
|
||||
class WorkflowTask extends Item {
|
||||
|
||||
/**
|
||||
|
||||
/**
|
||||
* Constructor Function
|
||||
* @param string $table The table to use as information source
|
||||
*/
|
||||
function __construct()
|
||||
{
|
||||
global $cfg;
|
||||
parent::__construct($cfg["tab"]["tasks"], "idtask");
|
||||
}
|
||||
function __construct() {
|
||||
global $cfg;
|
||||
parent::__construct($cfg["tab"]["tasks"], "idtask");
|
||||
}
|
||||
|
||||
/** @deprecated [2011-03-15] Old constructor function for downwards compatibility */
|
||||
function WorkflowTask()
|
||||
{
|
||||
function WorkflowTask() {
|
||||
cWarning(__FILE__, __LINE__, "Deprecated method call, use __construct()");
|
||||
$this->__construct();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Project:
|
||||
* Contenido Content Management System
|
||||
|
@ -25,12 +26,10 @@
|
|||
* }}
|
||||
*
|
||||
*/
|
||||
|
||||
if(!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
if (!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Class WorkflowUserSequences
|
||||
* Class for workflow user sequence management
|
||||
|
@ -39,131 +38,122 @@ if(!defined('CON_FRAMEWORK')) {
|
|||
* @copyright four for business 2003
|
||||
*/
|
||||
class WorkflowUserSequences extends ItemCollection {
|
||||
|
||||
/**
|
||||
|
||||
/**
|
||||
* Constructor Function
|
||||
* @param string $table The table to use as information source
|
||||
*/
|
||||
function __construct()
|
||||
{
|
||||
global $cfg;
|
||||
parent::__construct($cfg["tab"]["workflow_user_sequences"], "idusersequence");
|
||||
function __construct() {
|
||||
global $cfg;
|
||||
parent::__construct($cfg["tab"]["workflow_user_sequences"], "idusersequence");
|
||||
$this->_setItemClass("WorkflowUserSequence");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/** @deprecated [2011-03-15] Old constructor function for downwards compatibility */
|
||||
function WorkflowUserSequences()
|
||||
{
|
||||
function WorkflowUserSequences() {
|
||||
cWarning(__FILE__, __LINE__, "Deprecated method call, use __construct()");
|
||||
$this->__construct();
|
||||
}
|
||||
|
||||
function delete ($id)
|
||||
{
|
||||
function delete($id) {
|
||||
global $cfg, $idworkflow;
|
||||
|
||||
$item = new WorkflowUserSequence;
|
||||
$item->loadByPrimaryKey($id);
|
||||
|
||||
$pos = $item->get("position");
|
||||
$idworkflowitem = $item->get("idworkflowitem");
|
||||
$this->select("position > $pos AND idworkflowitem = '".Contenido_Security::escapeDB($idworkflowitem, NULL)."'");
|
||||
while ($obj = $this->next())
|
||||
{
|
||||
$pos = $obj->get("position") -1;
|
||||
$obj->setPosition($pos);
|
||||
$obj->store();
|
||||
}
|
||||
|
||||
$item = new WorkflowUserSequence;
|
||||
$item->loadByPrimaryKey($id);
|
||||
|
||||
$pos = $item->get("position");
|
||||
$idworkflowitem = $item-> |