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 content collection and item class.
  5:  *
  6:  * @package          Core
  7:  * @subpackage       GenericDB_Model
  8:  * @author           Dominik Ziegler
  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:  * Content collection
 19:  *
 20:  * @package Core
 21:  * @subpackage GenericDB_Model
 22:  */
 23: class cApiContentCollection 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']['content'], 'idcontent');
 32:         $this->_setItemClass('cApiContent');
 33: 
 34:         // set the join partners so that joins can be used via link() method
 35:         $this->_setJoinPartner('cApiArticleLanguageCollection');
 36:         $this->_setJoinPartner('cApiTypeCollection');
 37:     }
 38: 
 39:     /**
 40:      * Creates a content entry.
 41:      *
 42:      * @param int    $idArtLang
 43:      * @param int    $idType
 44:      * @param int    $typeId
 45:      * @param string $value
 46:      * @param int    $version
 47:      * @param string $author       [optional]
 48:      * @param string $created      [optional]
 49:      * @param string $lastmodified [optional]
 50:      *
 51:      * @return cApiContent
 52:      * @throws cDbException
 53:      * @throws cException
 54:      * @throws cInvalidArgumentException
 55:      */
 56:     public function create($idArtLang, $idType, $typeId, $value, $version, $author = '', $created = '', $lastmodified = '') {
 57:         global $auth;
 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:         $oItem = $this->createNewItem();
 70: 
 71:         $oItem->set('idartlang', $idArtLang);
 72:         $oItem->set('idtype', $idType);
 73:         $oItem->set('typeid', $typeId);
 74:         $oItem->set('value', $value);
 75:         $oItem->set('version', $version);
 76:         $oItem->set('author', $author);
 77:         $oItem->set('created', $created);
 78:         $oItem->set('lastmodified', $lastmodified);
 79: 
 80:         $oItem->store();
 81: 
 82:         return $oItem;
 83:     }
 84: 
 85: }
 86: 
 87: /**
 88:  * Content item
 89:  *
 90:  * @package Core
 91:  * @subpackage GenericDB_Model
 92:  */
 93: class cApiContent extends Item
 94: {
 95:     /**
 96:      * Constructor to create an instance of this class.
 97:      *
 98:      * @param mixed $mId [optional]
 99:      *                   Specifies the ID of item to load
100:      *
101:      * @throws cDbException
102:      * @throws cException
103:      */
104:     public function __construct($mId = false) {
105:         global $cfg;
106:         parent::__construct($cfg['tab']['content'], 'idcontent');
107:         $this->setFilters(array(), array());
108:         if ($mId !== false) {
109:             $this->loadByPrimaryKey($mId);
110:         }
111:     }
112: 
113:     /**
114:      * Userdefined setter for item fields.
115:      *
116:      * @param string $name
117:      * @param mixed $value
118:      * @param bool $bSafe [optional]
119:      *         Flag to run defined inFilter on passed value
120:      *
121:      * @return bool
122:      */
123:     public function setField($name, $value, $bSafe = true) {
124:         switch ($name) {
125:             case 'idartlang':
126:             case 'idtype':
127:             case 'typeid':
128:             case 'version':
129:                 $value = (int) $value;
130:                 break;
131:         }
132: 
133:         return parent::setField($name, $value, $bSafe);
134:     }
135: 
136:     /**
137:      * Creates a new, editable Version with same properties as this Content
138:      *
139:      * @param string $version
140:      * @param mixed  $deleted
141:      * @throws cDbException
142:      * @throws cException
143:      * @throws cInvalidArgumentException
144:      */
145:     public function markAsEditable($version, $deleted) {
146:             $parameters = $this->values;
147:             $parameters['version'] = $version;
148:             $contentVersionColl = new cApiContentVersionCollection();
149:             $contentVersion = $contentVersionColl->create($parameters);
150:             if ($deleted == 1) {
151:                     $contentVersion->set('deleted', $deleted);
152:             }
153:             $contentVersion->store();
154:     }
155: 
156:     /**
157:      * Loads an content entry by its article language id, idtype and type id.
158:      *
159:      * @param int $idartlang
160:      * @param int $idtype
161:      * @param int $typeid
162:      *
163:      * @return bool
164:      *
165:      * @throws cException
166:      */
167:     public function loadByArticleLanguageIdTypeAndTypeId($idartlang, $idtype, $typeid) {
168:         $aProps = array(
169:             'idartlang' => $idartlang,
170:             'idtype' => $idtype,
171:             'typeid' => $typeid
172:         );
173:         $aRecordSet = $this->_oCache->getItemByProperties($aProps);
174:         if ($aRecordSet) {
175:             // entry in cache found, load entry from cache
176:             $this->loadByRecordSet($aRecordSet);
177:             return true;
178:         } else {
179:             $where = $this->db->prepare("idartlang = %d AND idtype = %d AND typeid = %d", $idartlang, $idtype, $typeid);
180:             return $this->_loadByWhereClause($where);
181:         }
182:     }
183: 
184: }
185: 
CMS CONTENIDO 4.10.0 API documentation generated by ApiGen 2.8.0