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