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
  • Smarty
    • Cacher
    • Compiler
    • Config
    • Debug
    • PluginsBlock
    • PluginsFilter
    • PluginsFunction
    • PluginsInternal
    • PluginsModifier
    • PluginsModifierCompiler
    • PluginsShared
    • Security
    • Template
    • TemplateResources
  • Swift
    • ByteStream
    • CharacterStream
    • Encoder
    • Events
    • KeyCache
    • Mailer
    • Mime
    • Plugins
    • Transport

Classes

  • Swift_FailoverTransport
  • Swift_LoadBalancedTransport
  • Swift_MailTransport
  • Swift_Plugins_Loggers_ArrayLogger
  • Swift_Plugins_Loggers_EchoLogger
  • Swift_SendmailTransport
  • Swift_SmtpTransport
  • Swift_Transport_AbstractSmtpTransport
  • Swift_Transport_Esmtp_Auth_CramMd5Authenticator
  • Swift_Transport_Esmtp_Auth_LoginAuthenticator
  • Swift_Transport_Esmtp_Auth_PlainAuthenticator
  • Swift_Transport_Esmtp_AuthHandler
  • Swift_Transport_EsmtpTransport
  • Swift_Transport_FailoverTransport
  • Swift_Transport_LoadBalancedTransport
  • Swift_Transport_MailTransport
  • Swift_Transport_SendmailTransport
  • Swift_Transport_SimpleMailInvoker
  • Swift_Transport_StreamBuffer

Interfaces

  • Swift_Plugins_Logger
  • Swift_Plugins_Pop_Pop3Exception
  • Swift_Transport
  • Swift_Transport_Esmtp_Authenticator
  • Swift_Transport_EsmtpHandler
  • Swift_Transport_IoBuffer
  • Swift_Transport_MailInvoker
  • Swift_Transport_SmtpAgent
  • Swift_TransportException
  • Overview
  • Package
  • Function
  • Todo
  • Download
  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 = $this->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.7 API documentation generated by ApiGen