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 layout 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:  * Layout collection
 19:  *
 20:  * @package Core
 21:  * @subpackage GenericDB_Model
 22:  */
 23: class cApiLayoutCollection extends ItemCollection {
 24:     /**
 25:      * Constructor to create an instance of this class.
 26:      *
 27:      * @throws cInvalidArgumentException
 28:      */
 29:     public function __construct() {
 30:         global $cfg;
 31:         parent::__construct($cfg['tab']['lay'], 'idlay');
 32:         $this->_setItemClass('cApiLayout');
 33: 
 34:         // set the join partners so that joins can be used via link() method
 35:         $this->_setJoinPartner('cApiClientCollection');
 36:     }
 37: 
 38:     /**
 39:      * Creates a layout entry.
 40:      *
 41:      * @param string $name
 42:      * @param int    $idclient     [optional]
 43:      * @param string $alias        [optional]
 44:      * @param string $description  [optional]
 45:      * @param int    $deletable    [optional]
 46:      *                             Either 1 or 0
 47:      * @param string $author       [optional]
 48:      * @param string $created      [optional]
 49:      * @param string $lastmodified [optional]
 50:      *
 51:      * @return cApiLayout
 52:      * @throws cDbException
 53:      * @throws cException
 54:      * @throws cInvalidArgumentException
 55:      */
 56:     public function create($name, $idclient = NULL, $alias = '', $description = '', $deletable = 1, $author = '', $created = '', $lastmodified = '') {
 57:         global $client, $auth;
 58: 
 59:         if (NULL === $idclient) {
 60:             $idclient = $client;
 61:         }
 62: 
 63:         if (empty($alias)) {
 64:             $alias = cString::toLowerCase(cString::cleanURLCharacters(i18n("-- New layout --")));
 65:         }
 66: 
 67:         if (empty($author)) {
 68:             $author = $auth->auth['uname'];
 69:         }
 70:         if (empty($created)) {
 71:             $created = date('Y-m-d H:i:s');
 72:         }
 73:         if (empty($lastmodified)) {
 74:             $lastmodified = date('Y-m-d H:i:s');
 75:         }
 76: 
 77:         $item = $this->createNewItem();
 78:         $item->set('idclient', $idclient);
 79:         $item->set('name', $name);
 80:         $item->set('alias', $alias);
 81:         $item->set('description', $description);
 82:         $item->set('deletable', $deletable);
 83:         $item->set('author', $author);
 84:         $item->set('created', $created);
 85:         $item->set('lastmodified', $lastmodified);
 86:         $item->store();
 87: 
 88:         return $item;
 89:     }
 90: 
 91: }
 92: 
 93: /**
 94:  * Layout item
 95:  *
 96:  * @package Core
 97:  * @subpackage GenericDB_Model
 98:  */
 99: class cApiLayout extends Item {
100: 
101:     /**
102:      * List of templates being used by current layout
103:      *
104:      * @var array
105:      */
106:     protected $_aUsedTemplates = array();
107: 
108:     /**
109:      * Constructor to create an instance of this class.
110:      *
111:      * @param mixed $mId [optional]
112:      *                   Specifies the ID of item to load
113:      *
114:      * @throws cDbException
115:      * @throws cException
116:      */
117:     public function __construct($mId = false) {
118:         global $cfg;
119:         parent::__construct($cfg['tab']['lay'], 'idlay');
120:         $this->setFilters(array(), array());
121:         if ($mId !== false) {
122:             $this->loadByPrimaryKey($mId);
123:         }
124:     }
125: 
126:     /**
127:      * Checks if the layout is in use in any templates.
128:      *
129:      * @throws cException
130:      *         If layout item has not been loaded before
131:      * @param bool $setData [optional]
132:      *         Flag to set used templates data structure
133:      * @return bool
134:      */
135:     public function isInUse($setData = false) {
136:         if (!$this->isLoaded()) {
137:             throw new cException('Layout item not loaded!');
138:         }
139: 
140:         $oTplColl = new cApiTemplateCollection();
141:         $templates = $oTplColl->fetchByIdLay($this->get('idlay'));
142:         if (0 === count($templates)) {
143:             return false;
144:         }
145: 
146:         if ($setData === true) {
147:             $this->_aUsedTemplates = array();
148:             foreach ($templates as $i => $template) {
149:                 $this->_aUsedTemplates[$i] = array(
150:                     'tpl_id' => $template->get('idtpl'),
151:                     'tpl_name' => $template->get('name')
152:                 );
153:             }
154:         }
155: 
156:         return true;
157:     }
158: 
159:     /**
160:      * Get the informations of used templates
161:      *
162:      * @return array
163:      *         template data
164:      */
165:     public function getUsedTemplates() {
166:         return $this->_aUsedTemplates;
167:     }
168: 
169:     /**
170:      * Userdefined setter for layout fields.
171:      *
172:      * @param string $name
173:      * @param mixed $value
174:      * @param bool $bSafe [optional]
175:      *         Flag to run defined inFilter on passed value
176:      * @return bool
177:      */
178:     public function setField($name, $value, $bSafe = true) {
179:         switch ($name) {
180:             case 'deletable':
181:                 $value = ($value == 1) ? 1 : 0;
182:                 break;
183:             case 'idclient':
184:                 $value = (int) $value;
185:                 break;
186:         }
187: 
188:         return parent::setField($name, $value, $bSafe);
189:     }
190: 
191: }
192: 
CMS CONTENIDO 4.10.0 API documentation generated by ApiGen 2.8.0