Overview

Packages

  • Core
    • Authentication
    • Backend
    • Cache
    • CEC
    • Chain
    • ContentType
    • Database
    • Datatype
    • Debug
    • Exception
    • Frontend
      • Search
      • URI
      • Util
    • GenericDB
      • Model
    • GUI
      • HTML
    • I18N
    • LayoutHandler
    • Log
    • Security
    • Session
    • Util
    • Validation
    • Versioning
    • XML
  • Module
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationTop
  • 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
  • cApiArticleSpecification
  • cApiArticleSpecificationCollection
  • cApiCategory
  • cApiCategoryArticle
  • cApiCategoryArticleCollection
  • cApiCategoryCollection
  • cApiCategoryLanguage
  • cApiCategoryLanguageCollection
  • cApiCategoryTree
  • cApiCategoryTreeCollection
  • cApiClient
  • cApiClientCollection
  • cApiClientLanguage
  • cApiClientLanguageCollection
  • cApiCommunication
  • cApiCommunicationCollection
  • cApiContainer
  • cApiContainerCollection
  • cApiContainerConfiguration
  • cApiContainerConfigurationCollection
  • cApiContent
  • cApiContentCollection
  • 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
  • cApiMetaType
  • cApiMetaTypeCollection
  • cApiModule
  • cApiModuleCollection
  • cApiNavMain
  • cApiNavMainCollection
  • cApiNavSub
  • cApiNavSubCollection
  • cApiOnlineUser
  • cApiOnlineUserCollection
  • cApiPathresolveCache
  • cApiPathresolveCacheCollection
  • cApiProperty
  • cApiPropertyCollection
  • cApiRight
  • cApiRightCollection
  • cApiStat
  • cApiStatCollection
  • cApiSystemProperty
  • cApiSystemPropertyCollection
  • cApiTemplate
  • cApiTemplateCollection
  • cApiTemplateConfiguration
  • cApiTemplateConfigurationCollection
  • cApiType
  • cApiTypeCollection
  • cApiUpload
  • cApiUploadCollection
  • cApiUploadMeta
  • cApiUploadMetaCollection
  • cApiUser
  • cApiUserCollection
  • cApiUserProperty
  • cApiUserPropertyCollection
  • NoteCollection
  • NoteItem
  • TODOCollection
  • TODOItem
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo
  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 = parent::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.2 API documentation generated by ApiGen 2.8.0