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
    • 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:     /**
 27:      * Create a new collection of items.
 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
 48:      * @param string $created
 49:      * @param string $lastmodified
 50:      * @return cApiContent
 51:      */
 52:     public function create($idArtLang, $idType, $typeId, $value, $version, $author = '', $created = '', $lastmodified = '') {
 53:         global $auth;
 54: 
 55:         if (empty($author)) {
 56:             $author = $auth->auth['uname'];
 57:         }
 58:         if (empty($created)) {
 59:             $created = date('Y-m-d H:i:s');
 60:         }
 61:         if (empty($lastmodified)) {
 62:             $lastmodified = date('Y-m-d H:i:s');
 63:         }
 64: 
 65:         $oItem = parent::createNewItem();
 66: 
 67:         $oItem->set('idartlang', $idArtLang);
 68:         $oItem->set('idtype', $idType);
 69:         $oItem->set('typeid', $typeId);
 70:         $oItem->set('value', $value);
 71:         $oItem->set('version', $version);
 72:         $oItem->set('author', $author);
 73:         $oItem->set('created', $created);
 74:         $oItem->set('lastmodified', $lastmodified);
 75: 
 76:         $oItem->store();
 77: 
 78:         return $oItem;
 79:     }
 80: 
 81: }
 82: 
 83: /**
 84:  * Content item
 85:  *
 86:  * @package Core
 87:  * @subpackage GenericDB_Model
 88:  */
 89: class cApiContent extends Item {
 90: 
 91:     /**
 92:      * Constructor Function
 93:      *
 94:      * @param mixed $mId 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 Flag to run defined inFilter on passed value
111:      * @todo should return return value of overloaded method
112:      */
113:     public function setField($name, $value, $bSafe = true) {
114:         switch ($name) {
115:             case 'idartlang':
116:             case 'idtype':
117:             case 'typeid':
118:             case 'version':
119:                 $value = (int) $value;
120:                 break;
121:         }
122: 
123:         parent::setField($name, $value, $bSafe);
124:     }
125: 
126:     /**
127:      * Loads an content entry by its article language id, idtype and type id.
128:      *
129:      * @param int $idartlang
130:      * @param int $idtype
131:      * @param int $typeid
132:      * @return bool
133:      */
134:     public function loadByArticleLanguageIdTypeAndTypeId($idartlang, $idtype, $typeid) {
135:         $aProps = array(
136:             'idartlang' => $idartlang,
137:             'idtype' => $idtype,
138:             'typeid' => $typeid
139:         );
140:         $aRecordSet = $this->_oCache->getItemByProperties($aProps);
141:         if ($aRecordSet) {
142:             // entry in cache found, load entry from cache
143:             $this->loadByRecordSet($aRecordSet);
144:             return true;
145:         } else {
146:             $where = $this->db->prepare("idartlang = %d AND idtype = %d AND typeid = %d", $idartlang, $idtype, $typeid);
147:             return $this->_loadByWhereClause($where);
148:         }
149:     }
150: 
151: }
152: 
CMS CONTENIDO 4.9.1 API documentation generated by ApiGen 2.8.0