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
    • ContentRssCreator
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationTop
    • ScriptCookieDirective
  • 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
  • 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 container 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:  * Container collection
 19:  *
 20:  * @package Core
 21:  * @subpackage GenericDB_Model
 22:  */
 23: class cApiContainerCollection extends ItemCollection {
 24: 
 25:     /**
 26:      * Constructor to create an instance of this class.
 27:      *
 28:      * @param string $select [optional]
 29:      *         where clause to use for selection (see ItemCollection::select())
 30:      */
 31:     public function __construct($select = false) {
 32:         global $cfg;
 33:         parent::__construct($cfg['tab']['container'], 'idcontainer');
 34:         $this->_setItemClass('cApiContainer');
 35: 
 36:         // set the join partners so that joins can be used via link() method
 37:         $this->_setJoinPartner('cApiTemplateCollection');
 38: 
 39:         if ($select !== false) {
 40:             $this->select($select);
 41:         }
 42:     }
 43: 
 44:     /**
 45:      * Creates a container item entry
 46:      *
 47:      * @param int $idtpl
 48:      * @param int $number
 49:      * @param int $idmod
 50:      * @return cApiContainer
 51:      */
 52:     public function create($idtpl, $number, $idmod) {
 53:         $item = $this->createNewItem();
 54: 
 55:         $item->set('idtpl', $idtpl);
 56:         $item->set('number', $number);
 57:         $item->set('idmod', $idmod);
 58:         $item->store();
 59: 
 60:         return $item;
 61:     }
 62: 
 63:     /**
 64:      * Returns list of container numbers by passed template id.
 65:      *
 66:      * @param int $idtpl
 67:      * @return array
 68:      */
 69:     public function getNumbersByTemplate($idtpl) {
 70:         $list = array();
 71:         $sql = "SELECT number FROM `%s` WHERE idtpl = %d";
 72:         $this->db->query($sql, $this->table, $idtpl);
 73:         while ($this->db->nextRecord()) {
 74:             $list[] = $this->db->f('number');
 75:         }
 76:         return $list;
 77:     }
 78: 
 79:     /**
 80:      * Deletes all configurations by given template id
 81:      * @param int $idtpl
 82:      */
 83:     public function clearAssignments($idtpl) {
 84:         $this->deleteBy('idtpl', (int) $idtpl);
 85:     }
 86: 
 87:     /**
 88:      *
 89:      * @param int $idtpl
 90:      * @param int $number
 91:      * @param int $idmod
 92:      */
 93:     public function assignModule($idtpl, $number, $idmod) {
 94:         $this->select('idtpl = ' . (int) $idtpl . ' AND number = ' . (int) $number);
 95:         if (($item = $this->next()) !== false) {
 96:             $item->set('idmod', $idmod);
 97:             $item->store();
 98:         } else {
 99:             $this->create($idtpl, $number, $idmod);
100:         }
101:     }
102: }
103: 
104: /**
105:  * Container item
106:  *
107:  * @package Core
108:  * @subpackage GenericDB_Model
109:  */
110: class cApiContainer extends Item {
111: 
112:     /**
113:      * Constructor to create an instance of this class.
114:      *
115:      * @param mixed $mId [optional]
116:      *         Specifies the ID of item to load
117:      */
118:     public function __construct($mId = false) {
119:         global $cfg;
120:         parent::__construct($cfg['tab']['container'], 'idcontainer');
121:         $this->setFilters(array(), array());
122:         if ($mId !== false) {
123:             $this->loadByPrimaryKey($mId);
124:         }
125:     }
126: 
127:     /**
128:      * Userdefined setter for container fields.
129:      *
130:      * @param string $name
131:      * @param mixed $value
132:      * @param bool $bSafe [optional]
133:      *         Flag to run defined inFilter on passed value
134:      *
135:      * @eturn bool
136:      */
137:     public function setField($name, $value, $bSafe = true) {
138:         switch ($name) {
139:             case 'idtpl':
140:             case 'number':
141:             case 'idmod':
142:                 $value = (int) $value;
143:                 break;
144:         }
145: 
146:         return parent::setField($name, $value, $bSafe);
147:     }
148: 
149: }
150: 
CMS CONTENIDO 4.9.11 API documentation generated by ApiGen 2.8.0