Overview

Packages

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