Overview

Packages

  • CONTENIDO
  • Core
    • Authentication
    • Backend
    • Cache
    • CEC
    • Chain
    • ContentType
    • Database
    • Debug
    • Exception
    • Frontend
      • Search
      • URI
      • Util
    • GenericDB
      • Model
    • GUI
      • HTML
    • I18N
    • LayoutHandler
    • Log
    • Security
    • Session
    • Util
    • Validation
    • Versioning
    • XML
  • Module
    • ContentRssCreator
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationTop
    • ScriptCookieDirective
  • mpAutoloaderClassMap
  • None
  • Plugin
    • ContentAllocation
    • CronjobOverview
    • FormAssistant
    • FrontendLogic
    • FrontendUsers
    • Linkchecker
    • ModRewrite
    • Newsletter
    • Repository
      • FrontendNavigation
      • KeywordDensity
    • SearchSolr
    • SmartyWrapper
    • UrlShortener
    • UserForum
    • Workflow
  • PluginManager
  • Setup
    • Form
    • GUI
    • Helper
      • Environment
      • Filesystem
      • MySQL
      • PHP
    • UpgradeJob

Classes

  • Workflow
  • WorkflowAction
  • WorkflowActions
  • WorkflowAllocation
  • WorkflowAllocations
  • WorkflowArtAllocation
  • WorkflowArtAllocations
  • WorkflowItem
  • WorkflowItems
  • Workflows
  • WorkflowTask
  • WorkflowTasks
  • WorkflowUserSequence
  • WorkflowUserSequences

Functions

  • createNewWorkflow
  • doWorkflowAction
  • editWorkflowStep
  • getActionSelect
  • getCatLang
  • getCurrentUserSequence
  • getLastWorkflowStatus
  • getTimeUnitSelector
  • getUsers
  • getWorkflowForCat
  • getWorkflowForUserSequence
  • getWorkflowList
  • getWorkflowUsers
  • isCurrentEditor
  • piworkflowAllowArticleEdit
  • piworkflowCategoryColumns
  • piworkflowCategoryRenderColumn
  • piworkflowCreateTasksFolder
  • piworkflowProcessActions
  • piworkflowProcessArticleColumns
  • piworkflowRenderAction
  • piworkflowRenderColumn
  • prepareWorkflowItems
  • setUserSequence
  • workflowInherit
  • workflowSelect
  • Overview
  • Package
  • Function
  • Tree
  • Deprecated
  • Todo
  1: <?php
  2: /**
  3:  * This file contains the Workflow management class.
  4:  *
  5:  * @package Plugin
  6:  * @subpackage Workflow
  7:  * @author Timo Hummel
  8:  * @copyright four for business AG <www.4fb.de>
  9:  * @license http://www.contenido.org/license/LIZENZ.txt
 10:  * @link http://www.4fb.de
 11:  * @link http://www.contenido.org
 12:  */
 13: 
 14: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
 15: 
 16: $cfg["tab"]["workflow"] = $cfg['sql']['sqlprefix'] . "_piwf_workflow";
 17: $cfg["tab"]["workflow_allocation"] = $cfg['sql']['sqlprefix'] . "_piwf_allocation";
 18: $cfg["tab"]["workflow_art_allocation"] = $cfg['sql']['sqlprefix'] . "_piwf_art_allocation";
 19: $cfg["tab"]["workflow_items"] = $cfg['sql']['sqlprefix'] . "_piwf_items";
 20: $cfg["tab"]["workflow_tasks"] = $cfg['sql']['sqlprefix'] . "_piwf_tasks";
 21: $cfg["tab"]["workflow_user_sequences"] = $cfg['sql']['sqlprefix'] . "_piwf_user_sequences";
 22: $cfg["tab"]["workflow_actions"] = $cfg['sql']['sqlprefix'] . "_piwf_actions";
 23: 
 24: plugin_include('workflow', 'classes/class.workflowactions.php');
 25: plugin_include('workflow', 'classes/class.workflowallocation.php');
 26: plugin_include('workflow', 'classes/class.workflowartallocation.php');
 27: plugin_include('workflow', 'classes/class.workflowitems.php');
 28: plugin_include('workflow', 'classes/class.workflowusersequence.php');
 29: 
 30: /**
 31:  * Workflow management class.
 32:  *
 33:  * @package Plugin
 34:  * @subpackage Workflow
 35:  */
 36: class Workflows extends ItemCollection {
 37: 
 38:     /**
 39:      * Constructor Function
 40:      *
 41:      * @param none
 42:      */
 43:     public function __construct() {
 44:         global $cfg;
 45:         parent::__construct($cfg["tab"]["workflow"], "idworkflow");
 46:         $this->_setItemClass("Workflow");
 47:     }
 48: 
 49:     public function create() {
 50:         global $auth, $client, $lang;
 51:         $newitem = $this->createNewItem();
 52:         $newitem->setField("created", date('Y-m-d H:i:s'));
 53:         $newitem->setField("idauthor", $auth->auth["uid"]);
 54:         $newitem->setField("idclient", $client);
 55:         $newitem->setField("idlang", $lang);
 56:         $newitem->store();
 57: 
 58:         return $newitem;
 59:     }
 60: 
 61:     /**
 62:      * Deletes all corresponding informations to this workflow and delegate call
 63:      * to parent
 64:      *
 65:      * @param int $idWorkflow - id of workflow to delete
 66:      */
 67:     public function delete($idWorkflow) {
 68:         global $cfg;
 69:         $oDb = cRegistry::getDb();
 70: 
 71:         $aItemIdsDelete = array();
 72:         $sSql = 'SELECT idworkflowitem FROM ' . $cfg["tab"]["workflow_items"] . ' WHERE idworkflow = ' . cSecurity::toInteger($idWorkflow) . ';';
 73:         $oDb->query($sSql);
 74:         while ($oDb->nextRecord()) {
 75:             $aItemIdsDelete[] = (int) $oDb->f('idworkflowitem');
 76:         }
 77: 
 78:         if (!empty($aItemIdsDelete)) {
 79:             $aUserSequencesDelete = array();
 80:             $sSql = 'SELECT idusersequence FROM ' . $cfg["tab"]["workflow_user_sequences"] . ' WHERE idworkflowitem in (' . implode(',', $aItemIdsDelete) . ');';
 81:             $oDb->query($sSql);
 82:             while ($oDb->nextRecord()) {
 83:                 $aUserSequencesDelete[] = (int) $oDb->f('idusersequence');
 84:             }
 85: 
 86:             $sSql = 'DELETE FROM ' . $cfg["tab"]["workflow_user_sequences"] . ' WHERE idworkflowitem in (' . implode(',', $aItemIdsDelete) . ');';
 87:             $oDb->query($sSql);
 88: 
 89:             $sSql = 'DELETE FROM ' . $cfg["tab"]["workflow_actions"] . ' WHERE idworkflowitem in (' . implode(',', $aItemIdsDelete) . ');';
 90:             $oDb->query($sSql);
 91:         }
 92: 
 93:         if (!empty($aUserSequencesDelete)) {
 94:             $sSql = 'DELETE FROM ' . $cfg["tab"]["workflow_art_allocation"] . ' WHERE idusersequence in (' . implode(',', $aUserSequencesDelete) . ');';
 95:             $oDb->query($sSql);
 96:         }
 97: 
 98:         $sSql = 'DELETE FROM ' . $cfg["tab"]["workflow_items"] . ' WHERE idworkflow = ' . cSecurity::toInteger($idWorkflow) . ';';
 99:         $oDb->query($sSql);
100: 
101:         $sSql = 'DELETE FROM ' . $cfg["tab"]["workflow_allocation"] . ' WHERE idworkflow = ' . cSecurity::toInteger($idWorkflow) . ';';
102:         $oDb->query($sSql);
103: 
104:         parent::delete($idWorkflow);
105:     }
106: 
107: }
108: 
109: /**
110:  * Class Workflow
111:  * Class for a single workflow item
112:  *
113:  * @package Plugin
114:  * @subpackage Workflow
115:  * @author Timo A. Hummel <Timo.Hummel@4fb.de>
116:  * @version 0.1
117:  * @copyright four for business 2003
118:  */
119: class Workflow extends Item {
120: 
121:     /**
122:      * Constructor Function
123:      */
124:     public function __construct() {
125:         global $cfg;
126: 
127:         parent::__construct($cfg["tab"]["workflow"], "idworkflow");
128:     }
129: 
130: }
131: 
132: /* Helper functions */
133: function getWorkflowForCat($idcat) {
134:     global $lang;
135: 
136:     $idcatlang = getCatLang($idcat, $lang);
137:     if (!$idcatlang) {
138:         return 0;
139:     }
140:     $workflows = new WorkflowAllocations();
141:     $workflows->select('idcatlang = ' . (int) $idcatlang);
142:     if (($obj = $workflows->next()) !== false) {
143:         // Sanity: Check if the workflow still exists
144:         $workflow = new Workflow();
145:         $res = $workflow->loadByPrimaryKey($obj->get('idworkflow'));
146:         return ($res == true) ? $obj->get('idworkflow') : 0;
147:     }
148: }
149: 
150: function getCatLang($idcat, $idlang) {
151:     // Get the idcatlang
152:     $oCatLangColl = new cApiCategoryLanguageCollection();
153:     $aIds = $oCatLangColl->getIdsByWhereClause('idlang = ' . (int) $idlang . ' AND idcat = ' . (int) $idcat);
154:     return (count($aIds) > 0) ? $aIds[0] : 0;
155: }
156: 
157: ?>
CMS CONTENIDO 4.9.11 API documentation generated by ApiGen 2.8.0