2019-11-04 15:22:11 +00:00
|
|
|
<?php
|
2020-08-20 16:30:16 +00:00
|
|
|
|
2019-11-04 15:22:11 +00:00
|
|
|
/**
|
|
|
|
* Project:
|
|
|
|
* Contenido Content Management System
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Management of per-workflowitem actions
|
|
|
|
*
|
|
|
|
* Requirements:
|
|
|
|
* @con_php_req 5.0
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @package Contenido Backend classes
|
|
|
|
* @version 1.3
|
|
|
|
* @author Timo Hummel
|
|
|
|
* @copyright four for business AG <www.4fb.de>
|
|
|
|
* @license http://www.contenido.org/license/LIZENZ.txt
|
|
|
|
* @link http://www.4fb.de
|
|
|
|
* @link http://www.contenido.org
|
|
|
|
*
|
|
|
|
* {@internal
|
|
|
|
* created 2003-07-18
|
|
|
|
*
|
|
|
|
* $Id: class.workflowactions.php 128 2019-07-03 11:58:28Z oldperl $
|
|
|
|
* }}
|
|
|
|
*
|
|
|
|
*/
|
2020-08-20 16:30:16 +00:00
|
|
|
if (!defined('CON_FRAMEWORK')) {
|
2019-11-04 15:22:11 +00:00
|
|
|
die('Illegal call');
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Class WorkflowActions
|
|
|
|
* Class for workflow action collections
|
|
|
|
* @author Timo A. Hummel <Timo.Hummel@4fb.de>
|
|
|
|
* @version 0.2
|
|
|
|
* @copyright four for business 2003
|
|
|
|
*/
|
|
|
|
class WorkflowActions extends ItemCollection {
|
2020-08-20 16:30:16 +00:00
|
|
|
|
|
|
|
/**
|
2019-11-04 15:22:11 +00:00
|
|
|
* Constructor Function
|
|
|
|
* @param string $table The table to use as information source
|
|
|
|
*/
|
2020-08-20 16:30:16 +00:00
|
|
|
function __construct() {
|
|
|
|
global $cfg;
|
|
|
|
parent::__construct($cfg["tab"]["workflow_actions"], "idworkflowaction");
|
2019-11-04 15:22:11 +00:00
|
|
|
$this->_setItemClass("WorkflowAction");
|
2020-08-20 16:30:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @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);
|
|
|
|
}
|
2019-11-04 15:22:11 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Class WorkflowAction
|
|
|
|
* Class for a single workflow action
|
|
|
|
* @author Timo A. Hummel <Timo.Hummel@4fb.de>
|
|
|
|
* @version 0.1
|
|
|
|
* @copyright four for business 2003
|
|
|
|
*/
|
|
|
|
class WorkflowAction extends Item {
|
2020-08-20 16:30:16 +00:00
|
|
|
|
2019-11-04 15:22:11 +00:00
|
|
|
/**
|
|
|
|
* Constructor
|
|
|
|
* @global type $cfg
|
|
|
|
*/
|
2020-08-20 16:30:16 +00:00
|
|
|
function __construct() {
|
2019-11-04 15:22:11 +00:00
|
|
|
global $cfg;
|
|
|
|
parent::__construct($cfg["tab"]["workflow_actions"], "idworkflowaction");
|
|
|
|
}
|
2020-08-20 16:30:16 +00:00
|
|
|
|
2019-11-04 15:22:11 +00:00
|
|
|
}
|
2020-08-20 16:30:16 +00:00
|
|
|
|
2019-11-04 15:22:11 +00:00
|
|
|
?>
|