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 type collection and item class.
  4:  *
  5:  * @package          Core
  6:  * @subpackage       GenericDB_Model
  7:  * @version          SVN Revision $Rev:$
  8:  *
  9:  * @author           Murat Purc <murat@purc.de>
 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:  * Type collection
 20:  *
 21:  * @package Core
 22:  * @subpackage GenericDB_Model
 23:  */
 24: class cApiTypeCollection extends ItemCollection {
 25: 
 26:     /**
 27:      * Constructor
 28:      */
 29:     public function __construct() {
 30:         global $cfg;
 31:         parent::__construct($cfg['tab']['type'], 'idtype');
 32:         $this->_setItemClass('cApiType');
 33:     }
 34: 
 35:     /**
 36:      * Creates a type entry.
 37:      *
 38:      * @param string $type
 39:      * @param string $description
 40:      * @param string $code
 41:      * @param int $status
 42:      * @param string $author
 43:      * @param string $created
 44:      * @param string $lastmodified
 45:      * @return cApiType
 46:      */
 47:     public function create($type, $description, $code = '', $status = 0, $author = '', $created = '', $lastmodified = '') {
 48:         global $auth;
 49: 
 50:         if (empty($author)) {
 51:             $author = $auth->auth['uname'];
 52:         }
 53:         if (empty($created)) {
 54:             $created = date('Y-m-d H:i:s');
 55:         }
 56:         if (empty($lastmodified)) {
 57:             $lastmodified = date('Y-m-d H:i:s');
 58:         }
 59: 
 60:         $item = $this->createNewItem();
 61: 
 62:         $item->set('type', $type);
 63:         $item->set('description', $description);
 64:         $item->set('code', $code);
 65:         $item->set('status', $status);
 66:         $item->set('author', $author);
 67:         $item->set('created', $created);
 68:         $item->set('lastmodified', $lastmodified);
 69:         $item->store();
 70: 
 71:         return $item;
 72:     }
 73: 
 74: }
 75: 
 76: /**
 77:  * Type item
 78:  *
 79:  * @package Core
 80:  * @subpackage GenericDB_Model
 81:  */
 82: class cApiType extends Item {
 83: 
 84:     /**
 85:      * Constructor Function
 86:      *
 87:      * @param mixed $id Specifies the ID of item to load
 88:      */
 89:     public function __construct($id = false) {
 90:         global $cfg;
 91:         parent::__construct($cfg['tab']['type'], 'idtype');
 92:         $this->setFilters(array(), array());
 93:         if ($id !== false) {
 94:             $this->loadByPrimaryKey($id);
 95:         }
 96:     }
 97: 
 98:     /**
 99:      * Loads an type entry by its type.
100:      *
101:      * @param string $type e. g. CMS_HTML, CMS_TEXT, etc.
102:      * @return bool
103:      */
104:     public function loadByType($type) {
105:         $aProps = array(
106:             'type' => $type
107:         );
108:         $aRecordSet = $this->_oCache->getItemByProperties($aProps);
109:         if ($aRecordSet) {
110:             // entry in cache found, load entry from cache
111:             $this->loadByRecordSet($aRecordSet);
112:             return true;
113:         } else {
114:             $where = $this->db->prepare("type = '%s'", $type);
115:             return $this->_loadByWhereClause($where);
116:         }
117:     }
118: 
119:     /**
120:      * Userdefined setter for item fields.
121:      *
122:      * @param string $name
123:      * @param mixed $value
124:      * @param bool $safe Flag to run defined inFilter on passed value
125:      * @todo should return return value of overloaded method
126:      */
127:     public function setField($name, $value, $safe = true) {
128:         if ('status' === $name) {
129:             $value = (int) $value;
130:         }
131: 
132:         parent::setField($name, $value, $safe);
133:     }
134: 
135: }
136: 
CMS CONTENIDO 4.9.7 API documentation generated by ApiGen