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