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
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationTop
    • ScriptCookieDirective
  • mpAutoloaderClassMap
  • None
  • PHP
  • Plugin
    • ContentAllocation
    • CronjobOverview
    • FormAssistant
    • FrontendLogic
    • FrontendUsers
    • Linkchecker
    • ModRewrite
    • Newsletter
    • Repository
      • FrontendNavigation
      • KeywordDensity
    • 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 type collection and item class.
  5:  *
  6:  * @package          Core
  7:  * @subpackage       GenericDB_Model
  8:  * @author           Murat Purc <murat@purc.de>
  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:  * Type collection
 19:  *
 20:  * @package Core
 21:  * @subpackage GenericDB_Model
 22:  */
 23: class cApiTypeCollection extends ItemCollection {
 24:     /**
 25:      * Constructor to create an instance of this class.
 26:      *
 27:      * @throws cInvalidArgumentException
 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         [optional]
 41:      * @param int    $status       [optional]
 42:      * @param string $author       [optional]
 43:      * @param string $created      [optional]
 44:      * @param string $lastmodified [optional]
 45:      *
 46:      * @return cApiType
 47:      * @throws cDbException
 48:      * @throws cException
 49:      * @throws cInvalidArgumentException
 50:      */
 51:     public function create($type, $description, $code = '', $status = 0, $author = '', $created = '', $lastmodified = '') {
 52:         global $auth;
 53: 
 54:         if (empty($author)) {
 55:             $author = $auth->auth['uname'];
 56:         }
 57:         if (empty($created)) {
 58:             $created = date('Y-m-d H:i:s');
 59:         }
 60:         if (empty($lastmodified)) {
 61:             $lastmodified = date('Y-m-d H:i:s');
 62:         }
 63: 
 64:         $item = $this->createNewItem();
 65: 
 66:         $item->set('type', $type);
 67:         $item->set('description', $description);
 68:         $item->set('code', $code);
 69:         $item->set('status', $status);
 70:         $item->set('author', $author);
 71:         $item->set('created', $created);
 72:         $item->set('lastmodified', $lastmodified);
 73:         $item->store();
 74: 
 75:         return $item;
 76:     }
 77: 
 78: }
 79: 
 80: /**
 81:  * Type item
 82:  *
 83:  * @package Core
 84:  * @subpackage GenericDB_Model
 85:  */
 86: class cApiType extends Item
 87: {
 88:     /**
 89:      * Constructor to create an instance of this class.
 90:      *
 91:      * @param mixed $id [optional]
 92:      *                  Specifies the ID of item to load
 93:      *
 94:      * @throws cDbException
 95:      * @throws cException
 96:      */
 97:     public function __construct($id = false) {
 98:         global $cfg;
 99:         parent::__construct($cfg['tab']['type'], 'idtype');
100:         $this->setFilters(array(), array());
101:         if ($id !== false) {
102:             $this->loadByPrimaryKey($id);
103:         }
104:     }
105: 
106:     /**
107:      * Loads an type entry by its type.
108:      *
109:      * @param string $type
110:      *         e.g. CMS_HTML, CMS_TEXT, etc.
111:      *
112:      * @return bool
113:      * 
114:      * @throws cException
115:      */
116:     public function loadByType($type) {
117:         $aProps = array(
118:             'type' => $type
119:         );
120:         $aRecordSet = $this->_oCache->getItemByProperties($aProps);
121:         if ($aRecordSet) {
122:             // entry in cache found, load entry from cache
123:             $this->loadByRecordSet($aRecordSet);
124:             return true;
125:         } else {
126:             $where = $this->db->prepare("type = '%s'", $type);
127:             return $this->_loadByWhereClause($where);
128:         }
129:     }
130: 
131:     /**
132:      * Userdefined setter for item fields.
133:      *
134:      * @param string $name
135:      * @param mixed $value
136:      * @param bool $safe [optional]
137:      *         Flag to run defined inFilter on passed value
138:      *                   
139:      * @return bool
140:      */
141:     public function setField($name, $value, $safe = true) {
142:         if ('status' === $name) {
143:             $value = (int) $value;
144:         }
145: 
146:         return parent::setField($name, $value, $safe);
147:     }
148: 
149: }
150: 
CMS CONTENIDO 4.10.0 API documentation generated by ApiGen 2.8.0