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 class for workflow allocation management.
  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: /**
 19:  * Class for workflow allocation management.
 20:  *
 21:  * @package Plugin
 22:  * @subpackage Workflow
 23:  */
 24: class WorkflowAllocations extends ItemCollection {
 25: 
 26:     /**
 27:      * Constructor Function
 28:      *
 29:      * @param string $table The table to use as information source
 30:      */
 31:     public function __construct() {
 32:         global $cfg;
 33:         parent::__construct($cfg["tab"]["workflow_allocation"], "idallocation");
 34:         $this->_setItemClass("WorkflowAllocation");
 35:     }
 36: 
 37:     public function delete($idallocation) {
 38:         global $cfg, $lang;
 39: 
 40:         $obj = new WorkflowAllocation();
 41:         $obj->loadByPrimaryKey($idallocation);
 42: 
 43:         $idcatlang = $obj->get("idcatlang");
 44: 
 45:         $db = cRegistry::getDb();
 46:         $sql = "SELECT idcat FROM " . $cfg["tab"]["cat_lang"] . " WHERE idcatlang = '" . cSecurity::toInteger($idcatlang) . "'";
 47:         $db->query($sql);
 48:         $db->nextRecord();
 49:         $idcat = $db->f("idcat");
 50: 
 51:         $sql = "SELECT idart FROM " . $cfg["tab"]["cat_art"] . " WHERE idcat = '" . cSecurity::toInteger($idcat) . "'";
 52:         $db->query($sql);
 53: 
 54:         while ($db->nextRecord()) {
 55:             $idarts[] = $db->f("idart");
 56:         }
 57: 
 58:         $idartlangs = array();
 59: 
 60:         if (is_array($idarts)) {
 61:             foreach ($idarts as $idart) {
 62:                 $sql = "SELECT idartlang FROM " . $cfg["tab"]["art_lang"] . " WHERE idart = '" . cSecurity::toInteger($idart) . "' and idlang = '" . cSecurity::toInteger($lang) . "'";
 63:                 $db->query($sql);
 64:                 if ($db->nextRecord()) {
 65:                     $idartlangs[] = $db->f("idartlang");
 66:                 }
 67:             }
 68:         }
 69: 
 70:         $workflowArtAllocation = new WorkflowArtAllocation();
 71:         $workflowArtAllocations = new WorkflowArtAllocations();
 72: 
 73:         foreach ($idartlangs as $idartlang) {
 74:             $workflowArtAllocation->loadBy("idartlang", $idartlang);
 75:             $workflowArtAllocations->delete($workflowArtAllocation->get("idartallocation"));
 76:         }
 77: 
 78:         parent::delete($idallocation);
 79:     }
 80: 
 81:     public function create($idworkflow, $idcatlang) {
 82:         $this->select("idcatlang = '$idcatlang'");
 83: 
 84:         if ($this->next() !== false) {
 85:             $this->lasterror = i18n("Category already has a workflow assigned", "workflow");
 86:             return false;
 87:         }
 88: 
 89:         $workflows = new Workflows();
 90:         $workflows->select("idworkflow = '$idworkflow'");
 91: 
 92:         if ($workflows->next() === false) {
 93:             $this->lasterror = i18n("Workflow doesn't exist", "workflow");
 94:             return false;
 95:         }
 96:         $newitem = parent::createNewItem();
 97:         if (!$newitem->setWorkflow($idworkflow)) {
 98:             $this->lasterror = $newitem->lasterror;
 99:             $workflows->delete($newitem->getField("idallocation"));
100:             return false;
101:         }
102: 
103:         if (!$newitem->setCatLang($idcatlang)) {
104:             $this->lasterror = $newitem->lasterror;
105:             $workflows->delete($newitem->getField("idallocation"));
106:             return false;
107:         }
108: 
109:         $newitem->store();
110: 
111:         return ($newitem);
112:     }
113: 
114: }
115: 
116: /**
117:  * Class WorkflowAllocation
118:  * Class for a single workflow allocation item
119:  *
120:  * @package Plugin
121:  * @subpackage Workflow
122:  * @author Timo A. Hummel <Timo.Hummel@4fb.de>
123:  * @version 0.1
124:  * @copyright four for business 2003
125:  */
126: class WorkflowAllocation extends Item {
127: 
128:     /**
129:      * Constructor Function
130:      *
131:      * @param string $table The table to use as information source
132:      */
133:     public function __construct() {
134:         global $cfg;
135: 
136:         parent::__construct($cfg["tab"]["workflow_allocation"], "idallocation");
137:     }
138: 
139:     /**
140:      * Overridden setField function.
141:      * Users should only use setWorkflow.
142:      *
143:      * @param string $field Void field since we override the usual setField
144:      *            function
145:      * @param string $value Void field since we override the usual setField
146:      *            function
147:      * @throws cBadMethodCallException if this function is called
148:      * @return void
149:      */
150:     public function setField($field, $value, $safe = true) {
151:         throw new cBadMethodCallException("Don't use setField for WorkflowAllocation items! Use setWorkflow instead!");
152:     }
153: 
154:     /**
155:      * setWorkflow sets the workflow for the current item.
156:      *
157:      * @param int $idworkflow Workflow-ID to set the item to
158:      */
159:     public function setWorkflow($idworkflow) {
160:         $workflows = new Workflows();
161: 
162:         $workflows->select("idworkflow = '$idworkflow'");
163: 
164:         if ($workflows->next() === false) {
165:             $this->lasterror = i18n("Workflow doesn't exist", "workflow");
166:             return false;
167:         }
168: 
169:         parent::setField("idworkflow", $idworkflow);
170:         parent::store();
171:         return true;
172:     }
173: 
174:     /**
175:      * setCatLang sets the idcatlang for the current item.
176:      * Should
177:      * only be called by the create function.
178:      *
179:      * @param int $idcatlang idcatlang to set.
180:      */
181:     public function setCatLang($idcatlang) {
182:         global $cfg;
183: 
184:         $allocations = new WorkflowAllocations();
185: 
186:         $allocations->select("idcatlang = '$idcatlang'");
187: 
188:         if ($allocations->next() !== false) {
189:             $this->lasterror = i18n("Category already has a workflow assigned", "workflow");
190:             return false;
191:         }
192: 
193:         $db = cRegistry::getDb();
194:         $sql = "SELECT idcatlang FROM " . $cfg["tab"]["cat_lang"] . " WHERE idcatlang = '" . cSecurity::toInteger($idcatlang) . "'";
195:         $db->query($sql);
196: 
197:         if (!$db->nextRecord()) {
198:             $this->lasterror = i18n("Category doesn't exist, assignment failed", "workflow");
199:             return false;
200:         }
201: 
202:         parent::setField("idcatlang", $idcatlang);
203:         parent::store();
204:         return true;
205:     }
206: 
207: }
208: 
209: ?>
CMS CONTENIDO 4.9.1 API documentation generated by ApiGen 2.8.0