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