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
  • Smarty
    • Cacher
    • Compiler
    • Config
    • Debug
    • PluginsBlock
    • PluginsFilter
    • PluginsFunction
    • PluginsInternal
    • PluginsModifier
    • PluginsModifierCompiler
    • PluginsShared
    • Security
    • Template
    • TemplateResources
  • Swift
    • ByteStream
    • CharacterStream
    • Encoder
    • Events
    • KeyCache
    • Mailer
    • Mime
    • Plugins
    • Transport

Classes

  • Swift_FailoverTransport
  • Swift_LoadBalancedTransport
  • Swift_MailTransport
  • Swift_Plugins_Loggers_ArrayLogger
  • Swift_Plugins_Loggers_EchoLogger
  • Swift_SendmailTransport
  • Swift_SmtpTransport
  • Swift_Transport_AbstractSmtpTransport
  • Swift_Transport_Esmtp_Auth_CramMd5Authenticator
  • Swift_Transport_Esmtp_Auth_LoginAuthenticator
  • Swift_Transport_Esmtp_Auth_PlainAuthenticator
  • Swift_Transport_Esmtp_AuthHandler
  • Swift_Transport_EsmtpTransport
  • Swift_Transport_FailoverTransport
  • Swift_Transport_LoadBalancedTransport
  • Swift_Transport_MailTransport
  • Swift_Transport_SendmailTransport
  • Swift_Transport_SimpleMailInvoker
  • Swift_Transport_StreamBuffer

Interfaces

  • Swift_Plugins_Logger
  • Swift_Plugins_Pop_Pop3Exception
  • Swift_Transport
  • Swift_Transport_Esmtp_Authenticator
  • Swift_Transport_EsmtpHandler
  • Swift_Transport_IoBuffer
  • Swift_Transport_MailInvoker
  • Swift_Transport_SmtpAgent
  • Swift_TransportException
  • Overview
  • Package
  • Function
  • Todo
  • Download
  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 = $this->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:      */
149:     public function setField($field, $value, $safe = true) {
150:         throw new cBadMethodCallException("Don't use setField for WorkflowAllocation items! Use setWorkflow instead!");
151:     }
152: 
153:     /**
154:      * setWorkflow sets the workflow for the current item.
155:      *
156:      * @param int $idworkflow Workflow-ID to set the item to
157:      */
158:     public function setWorkflow($idworkflow) {
159:         $workflows = new Workflows();
160: 
161:         $workflows->select("idworkflow = '$idworkflow'");
162: 
163:         if ($workflows->next() === false) {
164:             $this->lasterror = i18n("Workflow doesn't exist", "workflow");
165:             return false;
166:         }
167: 
168:         parent::setField("idworkflow", $idworkflow);
169:         $this->store();
170:         return true;
171:     }
172: 
173:     /**
174:      * setCatLang sets the idcatlang for the current item.
175:      * Should
176:      * only be called by the create function.
177:      *
178:      * @param int $idcatlang idcatlang to set.
179:      */
180:     public function setCatLang($idcatlang) {
181:         global $cfg;
182: 
183:         $allocations = new WorkflowAllocations();
184: 
185:         $allocations->select("idcatlang = '$idcatlang'");
186: 
187:         if ($allocations->next() !== false) {
188:             $this->lasterror = i18n("Category already has a workflow assigned", "workflow");
189:             return false;
190:         }
191: 
192:         $db = cRegistry::getDb();
193:         $sql = "SELECT idcatlang FROM " . $cfg["tab"]["cat_lang"] . " WHERE idcatlang = '" . cSecurity::toInteger($idcatlang) . "'";
194:         $db->query($sql);
195: 
196:         if (!$db->nextRecord()) {
197:             $this->lasterror = i18n("Category doesn't exist, assignment failed", "workflow");
198:             return false;
199:         }
200: 
201:         parent::setField("idcatlang", $idcatlang);
202:         $this->store();
203:         return true;
204:     }
205: 
206: }
207: 
208: ?>
CMS CONTENIDO 4.9.7 API documentation generated by ApiGen