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 meta tag version collection and item class.
  5:  *
  6:  * @package          Core
  7:  * @subpackage       GenericDB_Model
  8:  * @author           Jann Dieckmann
  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:  * Metatag version collection
 19:  *
 20:  * @package Core
 21:  * @subpackage GenericDB_Model
 22:  */
 23: class cApiMetaTagVersionCollection 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']['meta_tag_version'], 'idmetatagversion');
 31:         $this->_setItemClass('cApiMetaTagVersion');
 32: 
 33:         // set the join partners so that joins can be used via link() method
 34:         $this->_setJoinPartner('cApiArticleLanguageVersionCollection');
 35:         $this->_setJoinPartner('cApiMetaTypeCollection');
 36:     }
 37: 
 38:     /**
 39:      * Creates a meta tag entry.
 40:      *
 41:      * @param int $idMetaTag
 42:      * @param int $idArtLang
 43:      * @param int $idMetaType
 44:      * @param string $metaValue
 45:      * @param string $version
 46:      * @return cApiMetaTagVersion
 47:      */
 48:     public function create($idMetaTag, $idArtLang, $idMetaType, $metaValue, $version) {
 49: 
 50:         // create item
 51:         $item = $this->createNewItem();
 52: 
 53:         $item->set('idmetatag', $idMetaTag, false);
 54:         $item->set('idartlang', $idArtLang, false);
 55:         $item->set('idmetatype', $idMetaType, false);
 56:         $item->set('metavalue', $metaValue, false);
 57:         $item->set('version', $version, false);
 58:         $item->store();
 59: 
 60:         return $item;
 61: 
 62:     }
 63: 
 64:     /**
 65:      * Returns a meta tag entry by article language and meta type and version.
 66:      *
 67:      * @param int $idArtLang
 68:      * @param int $idMetaType
 69:      * @param int $version
 70:      * @return cApiMetaTagVersion|NULL
 71:      */
 72:     public function fetchByArtLangMetaTypeAndVersion($idArtLang, $idMetaType, $version) {
 73:         $sql = 'SELECT idmetatagversion FROM %s
 74:                 WHERE (idmetatype, version)
 75:                     IN (SELECT idmetatype, max(version)
 76:                     FROM %s
 77:                     WHERE idartlang = %d AND version <= %d AND idmetatype = %d group by idmetatype)
 78:                 AND idartlang = %d';
 79: 
 80:         $this->db->query(
 81:             $sql,
 82:             cRegistry::getDbTableName('meta_tag_version'),
 83:             cRegistry::getDbTableName('meta_tag_version'),
 84:             (int) $idArtLang,
 85:             (int) $version,
 86:             (int) $idMetaType,
 87:             (int) $idArtLang
 88:         );
 89: 
 90:         $this->db->nextRecord();
 91: 
 92:         return new cApiMetaTagVersion($this->db->f('idmetatagversion'));
 93:     }
 94: 
 95: 
 96:     /**
 97:      * Returns idmetatagversions by where-clause
 98:      *
 99:      * @param string $where
100:      * @return int[]
101:      */
102:     public function fetchByArtLangAndMetaType($where) {
103:         $metaTagVersionColl = new cApiMetaTagVersionCollection();
104:         $metaTagVersionColl->select($where);
105: 
106:         while($item = $metaTagVersionColl->next()){
107:             $ids[] = $item->get('idmetatagversion');
108:         }
109:         return $ids;
110: 
111:     }
112: 
113: }
114: 
115: /**
116:  * Metatag version item
117:  *
118:  * @package Core
119:  * @subpackage GenericDB_Model
120:  */
121: class cApiMetaTagVersion extends Item {
122: 
123:     /**
124:      * Constructor to create an instance of this class.
125:      *
126:      * @param mixed $id
127:      *         Specifies the ID of item to load
128:      */
129:     public function __construct($id = false) {
130:         global $cfg;
131:         parent::__construct($cfg['tab']['meta_tag_version'], 'idmetatagversion');
132:         $this->setFilters(array(), array());
133:         if ($id !== false) {
134:             $this->loadByPrimaryKey($id);
135:         }
136:     }
137: 
138:     /**
139:      * Updates meta value of an entry.
140:      *
141:      * @param string $metaValue
142:      * @return bool
143:      */
144:     public function updateMetaValue($metaValue) {
145:         $this->set('metavalue', $metaValue, false);
146:         return $this->store();
147:     }
148: 
149:     /**
150:      * Marks this meta value as current.
151:      *
152:      * @return bool|void
153:      */
154:     public function markAsCurrent() {
155:         $metaTagColl = new cApiMetaTagCollection();
156:         $metaTag = $metaTagColl->fetchByArtLangAndMetaType($this->get('idartlang'), $this->get('idmetatype'));
157:         if ($metaTag != NULL) {
158:             $metaTag->set('metavalue', $this->get('metavalue'), false);
159:             return $metaTag->store();
160:         } else {
161:             $metaTag = new cApiMetaTagCollection();
162:             $metaTag->create($this->get('idartlang'), $this->get('idmetatype'), $this->get('metavalue'));
163:         }
164:     }
165: 
166:     /**
167:      * Marks this meta value as editable.
168:      *
169:      * @param int $version
170:      */
171:     public function markAsEditable($version) {
172:         $metaTagVersionColl = new cApiMetaTagVersionCollection();
173:         $metaTagVersionColl->create($this->get('idmetatag'), $this->get('idartlang'), $this->get('idmetatype'), $this->get('metavalue'), $version);
174:     }
175: 
176:     /**
177:      * Userdefined setter for meta tag fields.
178:      *
179:      * @see Item::setField()
180:      * @param string $name
181:      *         Field name
182:      * @param mixed $value
183:      *         Value to set
184:      * @param bool $safe
185:      *         Flag to run defined inFilter on passed value
186:      * @return bool
187:      */
188:     public function setField($name, $value, $safe = true) {
189:         switch ($name) {
190:             case 'idartlang':
191:                 $value = (int) $value;
192:                 break;
193:             case 'idmetatype':
194:                 $value = (int) $value;
195:                 break;
196:         }
197: 
198:         return parent::setField($name, $value, $safe);
199:     }
200: 
201: }
202: 
CMS CONTENIDO 4.9.11 API documentation generated by ApiGen 2.8.0