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
    • NavigationMain
    • 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

  • cApiAction
  • cApiActionCollection
  • cApiActionlog
  • cApiActionlogCollection
  • cApiArea
  • cApiAreaCollection
  • cApiArticle
  • cApiArticleCollection
  • cApiArticleLanguage
  • cApiArticleLanguageCollection
  • cApiArticleSpecification
  • cApiArticleSpecificationCollection
  • cApiCategory
  • cApiCategoryArticle
  • cApiCategoryArticleCollection
  • cApiCategoryCollection
  • cApiCategoryLanguage
  • cApiCategoryLanguageCollection
  • cApiCategoryTree
  • cApiCategoryTreeCollection
  • cApiClient
  • cApiClientCollection
  • cApiClientLanguage
  • cApiClientLanguageCollection
  • cApiCommunication
  • cApiCommunicationCollection
  • cApiContainer
  • cApiContainerCollection
  • cApiContainerConfiguration
  • cApiContainerConfigurationCollection
  • cApiContent
  • cApiContentCollection
  • 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
  • cApiMetaType
  • cApiMetaTypeCollection
  • cApiModule
  • cApiModuleCollection
  • cApiNavMain
  • cApiNavMainCollection
  • cApiNavSub
  • cApiNavSubCollection
  • cApiOnlineUser
  • cApiOnlineUserCollection
  • cApiPathresolveCache
  • cApiPathresolveCacheCollection
  • cApiProperty
  • cApiPropertyCollection
  • cApiRight
  • cApiRightCollection
  • cApiStat
  • cApiStatCollection
  • cApiSystemProperty
  • cApiSystemPropertyCollection
  • cApiTemplate
  • cApiTemplateCollection
  • cApiTemplateConfiguration
  • cApiTemplateConfigurationCollection
  • cApiType
  • cApiTypeCollection
  • cApiUpload
  • cApiUploadCollection
  • cApiUploadMeta
  • cApiUploadMetaCollection
  • cApiUser
  • cApiUserCollection
  • cApiUserProperty
  • cApiUserPropertyCollection
  • NoteCollection
  • NoteItem
  • TODOCollection
  • TODOItem
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo
  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:     public function __construct($select = false) {
 27:         global $cfg;
 28:         parent::__construct($cfg['tab']['tpl_conf'], 'idtplcfg');
 29:         $this->_setItemClass('cApiTemplateConfiguration');
 30: 
 31:         // set the join partners so that joins can be used via link() method
 32:         $this->_setJoinPartner('cApiTemplateCollection');
 33: 
 34:         if ($select !== false) {
 35:             $this->select($select);
 36:         }
 37:     }
 38: 
 39:     /**
 40:      * Deletes template configuration entry, removes also all related container
 41:      * configurations.
 42:      *
 43:      * @param int $idtplcfg
 44:      * @return bool
 45:      */
 46:     public function delete($idtplcfg) {
 47:         $result = parent::delete($idtplcfg);
 48: 
 49:         // Delete also all container configurations
 50:         $oContainerConfColl = new cApiContainerConfigurationCollection('idtplcfg = ' . (int) $idtplcfg);
 51:         $oContainerConfColl->deleteByWhereClause('idtplcfg = ' . (int) $idtplcfg);
 52: 
 53:         return $result;
 54:     }
 55: 
 56:     /**
 57:      * Creates an template config item entry
 58:      *
 59:      * @param int $idtpl
 60:      * @param int $status
 61:      * @param string $author
 62:      * @param string $created
 63:      * @param string $lastmodified
 64:      * @return cApiTemplateConfiguration
 65:      */
 66:     public function create($idtpl, $status = 0, $author = '', $created = '', $lastmodified = '') {
 67:         global $auth;
 68: 
 69:         if (empty($author)) {
 70:             $author = $auth->auth['uname'];
 71:         }
 72:         if (empty($created)) {
 73:             $created = date('Y-m-d H:i:s');
 74:         }
 75:         if (empty($lastmodified)) {
 76:             $lastmodified = '0000-00-00 00:00:00';
 77:         }
 78: 
 79:         $item = parent::createNewItem();
 80:         $item->set('idtpl', $idtpl);
 81:         $item->set('author', $author);
 82:         $item->set('status', $status);
 83:         $item->set('created', $created);
 84:         $item->set('lastmodified', $lastmodified);
 85:         $item->store();
 86: 
 87:         return $item;
 88:     }
 89: 
 90:     /**
 91:      * If there is a preconfiguration of template, copy its settings into
 92:      * templateconfiguration
 93:      *
 94:      * @param int $idtpl
 95:      * @param int $idtplcfg
 96:      */
 97:     public function copyTemplatePreconfiguration($idtpl, $idtplcfg) {
 98:         $oTemplateColl = new cApiTemplateCollection('idtpl = ' . (int) $idtpl);
 99: 
100:         if (($oTemplate = $oTemplateColl->next()) !== false) {
101:             if ($oTemplate->get('idtplcfg') > 0) {
102:                 $oContainerConfColl = new cApiContainerConfigurationCollection('idtplcfg = ' . $oTemplate->get('idtplcfg'));
103:                 $aStandardconfig = array();
104:                 while (($oContainerConf = $oContainerConfColl->next()) !== false) {
105:                     $aStandardconfig[$oContainerConf->get('number')] = $oContainerConf->get('container');
106:                 }
107: 
108:                 foreach ($aStandardconfig as $number => $container) {
109:                     $oContainerConfColl->create($idtplcfg, $number, $container);
110:                 }
111:             }
112:         }
113:     }
114: 
115: }
116: 
117: /**
118:  * Template configuration item
119:  *
120:  * @package Core
121:  * @subpackage GenericDB_Model
122:  */
123: class cApiTemplateConfiguration extends Item {
124: 
125:     /**
126:      * Constructor Function
127:      *
128:      * @param mixed $mId Specifies the ID of item to load
129:      */
130:     public function __construct($mId = false) {
131:         global $cfg;
132:         parent::__construct($cfg['tab']['tpl_conf'], 'idtplcfg');
133:         $this->setFilters(array(), array());
134:         if ($mId !== false) {
135:             $this->loadByPrimaryKey($mId);
136:         }
137:     }
138: 
139:     /**
140:      * Userdefined setter for template configuration fields.
141:      *
142:      * @param string $name
143:      * @param mixed $value
144:      * @param bool $bSafe Flag to run defined inFilter on passed value
145:      */
146:     public function setField($name, $value, $bSafe = true) {
147:         switch ($name) {
148:             case 'idtpl':
149:             case 'status':
150:                 $value = (int) $value;
151:                 break;
152:         }
153: 
154:         parent::setField($name, $value, $bSafe);
155:     }
156: 
157: }
158: 
CMS CONTENIDO 4.9.0 API documentation generated by ApiGen 2.8.0