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
    • 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:     /**
 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 = parent::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.2 API documentation generated by ApiGen 2.8.0