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