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