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 template configuration collection and item class.
  4:  *
  5:  * @package Core
  6:  * @subpackage GenericDB_Model
  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:  * Template configuration collection
 20:  *
 21:  * @package Core
 22:  * @subpackage GenericDB_Model
 23:  */
 24: class cApiTemplateConfigurationCollection extends ItemCollection {
 25: 
 26:     /**
 27:      * Create a new collection of items.
 28:      *
 29:      * @param string $select where clause to use for selection (see
 30:      *            ItemCollection::select())
 31:      */
 32:     public function __construct($select = false) {
 33:         global $cfg;
 34:         parent::__construct($cfg['tab']['tpl_conf'], 'idtplcfg');
 35:         $this->_setItemClass('cApiTemplateConfiguration');
 36: 
 37:         // set the join partners so that joins can be used via link() method
 38:         $this->_setJoinPartner('cApiTemplateCollection');
 39: 
 40:         if ($select !== false) {
 41:             $this->select($select);
 42:         }
 43:     }
 44: 
 45:     /**
 46:      * Deletes template configuration entry, removes also all related container
 47:      * configurations.
 48:      *
 49:      * @param int $idtplcfg
 50:      * @return bool
 51:      */
 52:     public function delete($idtplcfg) {
 53:         $result = parent::delete($idtplcfg);
 54: 
 55:         // Delete also all container configurations
 56:         $oContainerConfColl = new cApiContainerConfigurationCollection('idtplcfg = ' . (int) $idtplcfg);
 57:         $oContainerConfColl->deleteByWhereClause('idtplcfg = ' . (int) $idtplcfg);
 58: 
 59:         return $result;
 60:     }
 61: 
 62:     /**
 63:      * Creates a template config item entry
 64:      *
 65:      * @param int $idtpl
 66:      * @param int $status
 67:      * @param string $author
 68:      * @param string $created
 69:      * @param string $lastmodified
 70:      * @return cApiTemplateConfiguration
 71:      */
 72:     public function create($idtpl, $status = 0, $author = '', $created = '', $lastmodified = '') {
 73:         global $auth;
 74: 
 75:         if (empty($author)) {
 76:             $author = $auth->auth['uname'];
 77:         }
 78:         if (empty($created)) {
 79:             $created = date('Y-m-d H:i:s');
 80:         }
 81:         if (empty($lastmodified)) {
 82:             $lastmodified = '0000-00-00 00:00:00';
 83:         }
 84: 
 85:         $item = $this->createNewItem();
 86:         $item->set('idtpl', $idtpl);
 87:         $item->set('author', $author);
 88:         $item->set('status', $status);
 89:         $item->set('created', $created);
 90:         $item->set('lastmodified', $lastmodified);
 91:         $item->store();
 92: 
 93:         return $item;
 94:     }
 95: 
 96:     /**
 97:      * If there is a preconfiguration of template, copy its settings into
 98:      * templateconfiguration
 99:      *
100:      * @param int $idtpl
101:      * @param int $idtplcfg
102:      */
103:     public function copyTemplatePreconfiguration($idtpl, $idtplcfg) {
104:         $oTemplateColl = new cApiTemplateCollection('idtpl = ' . (int) $idtpl);
105: 
106:         if (($oTemplate = $oTemplateColl->next()) !== false) {
107:             if ($oTemplate->get('idtplcfg') > 0) {
108:                 $oContainerConfColl = new cApiContainerConfigurationCollection('idtplcfg = ' . $oTemplate->get('idtplcfg'));
109:                 $aStandardconfig = array();
110:                 while (($oContainerConf = $oContainerConfColl->next()) !== false) {
111:                     $aStandardconfig[$oContainerConf->get('number')] = $oContainerConf->get('container');
112:                 }
113: 
114:                 foreach ($aStandardconfig as $number => $container) {
115:                     $oContainerConfColl->create($idtplcfg, $number, $container);
116:                 }
117:             }
118:         }
119:     }
120: }
121: 
122: /**
123:  * Template configuration item
124:  *
125:  * @package Core
126:  * @subpackage GenericDB_Model
127:  */
128: class cApiTemplateConfiguration extends Item {
129: 
130:     /**
131:      * Constructor Function
132:      *
133:      * @param mixed $mId Specifies the ID of item to load
134:      */
135:     public function __construct($mId = false) {
136:         global $cfg;
137:         parent::__construct($cfg['tab']['tpl_conf'], 'idtplcfg');
138:         $this->setFilters(array(), array());
139:         if ($mId !== false) {
140:             $this->loadByPrimaryKey($mId);
141:         }
142:     }
143: 
144:     /**
145:      * Userdefined setter for template configuration fields.
146:      *
147:      * @param string $name
148:      * @param mixed $value
149:      * @param bool $bSafe Flag to run defined inFilter on passed value
150:      * @todo should return return value of overloaded method
151:      */
152:     public function setField($name, $value, $bSafe = true) {
153:         switch ($name) {
154:             case 'idtpl':
155:             case 'status':
156:                 $value = (int) $value;
157:                 break;
158:         }
159: 
160:         parent::setField($name, $value, $bSafe);
161:     }
162: }
163: 
CMS CONTENIDO 4.9.7 API documentation generated by ApiGen