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
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationTop
    • ScriptCookieDirective
  • mpAutoloaderClassMap
  • None
  • PHP
  • Plugin
    • ContentAllocation
    • CronjobOverview
    • FormAssistant
    • FrontendLogic
    • FrontendUsers
    • Linkchecker
    • ModRewrite
    • Newsletter
    • Repository
      • FrontendNavigation
      • KeywordDensity
    • SmartyWrapper
    • UrlShortener
    • UserForum
    • Workflow
  • PluginManager
  • Setup
    • Form
    • GUI
    • Helper
      • Environment
      • Filesystem
      • MySQL
      • PHP
    • UpgradeJob

Classes

  • cApiAction
  • cApiActionCollection
  • cApiActionlog
  • cApiActionlogCollection
  • cApiArea
  • cApiAreaCollection
  • cApiArticle
  • cApiArticleCollection
  • cApiArticleLanguage
  • cApiArticleLanguageCollection
  • cApiArticleLanguageVersion
  • cApiArticleLanguageVersionCollection
  • cApiArticleSpecification
  • cApiArticleSpecificationCollection
  • cApiCategory
  • cApiCategoryArticle
  • cApiCategoryArticleCollection
  • cApiCategoryCollection
  • cApiCategoryLanguage
  • cApiCategoryLanguageCollection
  • cApiCategoryTree
  • cApiCategoryTreeCollection
  • cApiClient
  • cApiClientCollection
  • cApiClientLanguage
  • cApiClientLanguageCollection
  • cApiCommunication
  • cApiCommunicationCollection
  • cApiContainer
  • cApiContainerCollection
  • cApiContainerConfiguration
  • cApiContainerConfigurationCollection
  • cApiContent
  • cApiContentCollection
  • cApiContentVersion
  • cApiContentVersionCollection
  • cApiDbfs
  • cApiDbfsCollection
  • cApiFile
  • cApiFileCollection
  • cApiFileInformation
  • cApiFileInformationCollection
  • cApiFrameFile
  • cApiFrameFileCollection
  • cApiFrontendGroup
  • cApiFrontendGroupCollection
  • cApiFrontendGroupMember
  • cApiFrontendGroupMemberCollection
  • cApiFrontendPermission
  • cApiFrontendPermissionCollection
  • cApiFrontendUser
  • cApiFrontendUserCollection
  • cApiGroup
  • cApiGroupCollection
  • cApiGroupMember
  • cApiGroupMemberCollection
  • cApiGroupProperty
  • cApiGroupPropertyCollection
  • cApiInUse
  • cApiInUseCollection
  • cApiIso3166
  • cApiIso3166Collection
  • cApiIso6392
  • cApiIso6392Collection
  • cApiKeyword
  • cApiKeywordCollection
  • cApiLanguage
  • cApiLanguageCollection
  • cApiLayout
  • cApiLayoutCollection
  • cApiMailLog
  • cApiMailLogCollection
  • cApiMailLogSuccess
  • cApiMailLogSuccessCollection
  • cApiMetaTag
  • cApiMetaTagCollection
  • cApiMetaTagVersion
  • cApiMetaTagVersionCollection
  • cApiMetaType
  • cApiMetaTypeCollection
  • cApiModule
  • cApiModuleCollection
  • cApiNavMain
  • cApiNavMainCollection
  • cApiNavSub
  • cApiNavSubCollection
  • cApiOnlineUser
  • cApiOnlineUserCollection
  • cApiPathresolveCache
  • cApiPathresolveCacheCollection
  • cApiProperty
  • cApiPropertyCollection
  • cApiRight
  • cApiRightCollection
  • cApiSearchTracking
  • cApiSearchTrackingCollection
  • cApiStat
  • cApiStatCollection
  • cApiSystemProperty
  • cApiSystemPropertyCollection
  • cApiTemplate
  • cApiTemplateCollection
  • cApiTemplateConfiguration
  • cApiTemplateConfigurationCollection
  • cApiType
  • cApiTypeCollection
  • cApiUpload
  • cApiUploadCollection
  • cApiUploadMeta
  • cApiUploadMetaCollection
  • cApiUser
  • cApiUserCollection
  • cApiUserPasswordRequest
  • cApiUserPasswordRequestCollection
  • cApiUserProperty
  • cApiUserPropertyCollection
  • NoteCollection
  • NoteItem
  • TODOCollection
  • TODOItem
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo
  1: <?php
  2: 
  3: /**
  4:  * This file contains the template configuration collection and item class.
  5:  *
  6:  * @package Core
  7:  * @subpackage GenericDB_Model
  8:  * @author Timo Hummel
  9:  * @copyright four for business AG <www.4fb.de>
 10:  * @license http://www.contenido.org/license/LIZENZ.txt
 11:  * @link http://www.4fb.de
 12:  * @link http://www.contenido.org
 13:  */
 14: 
 15: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
 16: 
 17: /**
 18:  * Template configuration collection
 19:  *
 20:  * @package Core
 21:  * @subpackage GenericDB_Model
 22:  */
 23: class cApiTemplateConfigurationCollection extends ItemCollection {
 24:     /**
 25:      * Constructor to create an instance of this class.
 26:      *
 27:      * @param bool $select [optional]
 28:      *                     where clause to use for selection (see ItemCollection::select())
 29:      *
 30:      * @throws cDbException
 31:      * @throws cInvalidArgumentException
 32:      */
 33:     public function __construct($select = false) {
 34:         global $cfg;
 35:         parent::__construct($cfg['tab']['tpl_conf'], 'idtplcfg');
 36:         $this->_setItemClass('cApiTemplateConfiguration');
 37: 
 38:         // set the join partners so that joins can be used via link() method
 39:         $this->_setJoinPartner('cApiTemplateCollection');
 40: 
 41:         if ($select !== false) {
 42:             $this->select($select);
 43:         }
 44:     }
 45: 
 46:     /**
 47:      * Deletes template configuration entry, removes also all related container
 48:      * configurations.
 49:      *
 50:      * @param int $idtplcfg
 51:      *
 52:      * @return bool
 53:      * 
 54:      * @throws cDbException
 55:      * @throws cInvalidArgumentException
 56:      */
 57:     public function delete($idtplcfg) {
 58:         $result = parent::delete($idtplcfg);
 59: 
 60:         // Delete also all container configurations
 61:         $oContainerConfColl = new cApiContainerConfigurationCollection('idtplcfg = ' . (int) $idtplcfg);
 62:         $oContainerConfColl->deleteByWhereClause('idtplcfg = ' . (int) $idtplcfg);
 63: 
 64:         return $result;
 65:     }
 66: 
 67:     /**
 68:      * Creates a template config item entry
 69:      *
 70:      * @param int    $idtpl
 71:      * @param int    $status       [optional]
 72:      * @param string $author       [optional]
 73:      * @param string $created      [optional]
 74:      * @param string $lastmodified [optional]
 75:      *
 76:      * @return cApiTemplateConfiguration
 77:      * @throws cDbException
 78:      * @throws cException
 79:      * @throws cInvalidArgumentException
 80:      */
 81:     public function create($idtpl, $status = 0, $author = '', $created = '', $lastmodified = '') {
 82:         global $auth;
 83: 
 84:         if (empty($author)) {
 85:             $author = $auth->auth['uname'];
 86:         }
 87:         if (empty($created)) {
 88:             $created = date('Y-m-d H:i:s');
 89:         }
 90:         if (empty($lastmodified)) {
 91:             $lastmodified = '0000-00-00 00:00:00';
 92:         }
 93: 
 94:         $item = $this->createNewItem();
 95:         $item->set('idtpl', $idtpl);
 96:         $item->set('author', $author);
 97:         $item->set('status', $status);
 98:         $item->set('created', $created);
 99:         $item->set('lastmodified', $lastmodified);
100:         $item->store();
101: 
102:         return $item;
103:     }
104: 
105:     /**
106:      * If there is a preconfiguration of template, copy its settings into
107:      * templateconfiguration
108:      *
109:      * @param int $idtpl
110:      * @param int $idtplcfg
111:      * @throws cDbException
112:      * @throws cException
113:      * @throws cInvalidArgumentException
114:      */
115:     public function copyTemplatePreconfiguration($idtpl, $idtplcfg) {
116:         $oTemplateColl = new cApiTemplateCollection('idtpl = ' . (int) $idtpl);
117: 
118:         if (($oTemplate = $oTemplateColl->next()) !== false) {
119:             if ($oTemplate->get('idtplcfg') > 0) {
120:                 $oContainerConfColl = new cApiContainerConfigurationCollection('idtplcfg = ' . $oTemplate->get('idtplcfg'));
121:                 $aStandardconfig = array();
122:                 while (($oContainerConf = $oContainerConfColl->next()) !== false) {
123:                     $aStandardconfig[$oContainerConf->get('number')] = $oContainerConf->get('container');
124:                 }
125: 
126:                 foreach ($aStandardconfig as $number => $container) {
127:                     $oContainerConfColl->create($idtplcfg, $number, $container);
128:                 }
129:             }
130:         }
131:     }
132: }
133: 
134: /**
135:  * Template configuration item
136:  *
137:  * @package Core
138:  * @subpackage GenericDB_Model
139:  */
140: class cApiTemplateConfiguration extends Item
141: {
142:     /**
143:      * Constructor to create an instance of this class.
144:      *
145:      * @param mixed $mId [optional]
146:      *                   Specifies the ID of item to load
147:      *                   
148:      * @throws cDbException
149:      * @throws cException
150:      */
151:     public function __construct($mId = false) {
152:         global $cfg;
153:         parent::__construct($cfg['tab']['tpl_conf'], 'idtplcfg');
154:         $this->setFilters(array(), array());
155:         if ($mId !== false) {
156:             $this->loadByPrimaryKey($mId);
157:         }
158:     }
159: 
160:     /**
161:      * Userdefined setter for template configuration fields.
162:      *
163:      * @param string $name
164:      * @param mixed $value
165:      * @param bool $bSafe [optional]
166:      *         Flag to run defined inFilter on passed value
167:      *
168:      * @return bool
169:      */
170:     public function setField($name, $value, $bSafe = true) {
171:         switch ($name) {
172:             case 'idtpl':
173:             case 'status':
174:                 $value = (int) $value;
175:                 break;
176:         }
177: 
178:         return parent::setField($name, $value, $bSafe);
179:     }
180: }
181: 
CMS CONTENIDO 4.10.0 API documentation generated by ApiGen 2.8.0