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

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