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 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:     /**
 26:      * Constructor to create an instance of this class.
 27:      */
 28:     public function __construct() {
 29:         global $cfg;
 30:         parent::__construct($cfg['tab']['type'], 'idtype');
 31:         $this->_setItemClass('cApiType');
 32:     }
 33: 
 34:     /**
 35:      * Creates a type entry.
 36:      *
 37:      * @param string $type
 38:      * @param string $description
 39:      * @param string $code [optional]
 40:      * @param int $status [optional]
 41:      * @param string $author [optional]
 42:      * @param string $created [optional]
 43:      * @param string $lastmodified [optional]
 44:      * @return cApiType
 45:      */
 46:     public function create($type, $description, $code = '', $status = 0, $author = '', $created = '', $lastmodified = '') {
 47:         global $auth;
 48: 
 49:         if (empty($author)) {
 50:             $author = $auth->auth['uname'];
 51:         }
 52:         if (empty($created)) {
 53:             $created = date('Y-m-d H:i:s');
 54:         }
 55:         if (empty($lastmodified)) {
 56:             $lastmodified = date('Y-m-d H:i:s');
 57:         }
 58: 
 59:         $item = $this->createNewItem();
 60: 
 61:         $item->set('type', $type);
 62:         $item->set('description', $description);
 63:         $item->set('code', $code);
 64:         $item->set('status', $status);
 65:         $item->set('author', $author);
 66:         $item->set('created', $created);
 67:         $item->set('lastmodified', $lastmodified);
 68:         $item->store();
 69: 
 70:         return $item;
 71:     }
 72: 
 73: }
 74: 
 75: /**
 76:  * Type item
 77:  *
 78:  * @package Core
 79:  * @subpackage GenericDB_Model
 80:  */
 81: class cApiType extends Item {
 82: 
 83:     /**
 84:      * Constructor to create an instance of this class.
 85:      *
 86:      * @param mixed $id [optional]
 87:      *         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
102:      *         e.g. CMS_HTML, CMS_TEXT, etc.
103:      * @return bool
104:      */
105:     public function loadByType($type) {
106:         $aProps = array(
107:             'type' => $type
108:         );
109:         $aRecordSet = $this->_oCache->getItemByProperties($aProps);
110:         if ($aRecordSet) {
111:             // entry in cache found, load entry from cache
112:             $this->loadByRecordSet($aRecordSet);
113:             return true;
114:         } else {
115:             $where = $this->db->prepare("type = '%s'", $type);
116:             return $this->_loadByWhereClause($where);
117:         }
118:     }
119: 
120:     /**
121:      * Userdefined setter for item fields.
122:      *
123:      * @param string $name
124:      * @param mixed $value
125:      * @param bool $safe [optional]
126:      *         Flag to run defined inFilter on passed value
127:      *                   
128:      * @return bool
129:      */
130:     public function setField($name, $value, $safe = true) {
131:         if ('status' === $name) {
132:             $value = (int) $value;
133:         }
134: 
135:         return parent::setField($name, $value, $safe);
136:     }
137: 
138: }
139: 
CMS CONTENIDO 4.9.11 API documentation generated by ApiGen 2.8.0