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:  * This file contains the article collection and item class.
  4:  *
  5:  * @package Core
  6:  * @subpackage GenericDB_Model
  7:  * @author Timo Hummel
  8:  * @copyright four for business AG <www.4fb.de>
  9:  * @license http://www.contenido.org/license/LIZENZ.txt
 10:  * @link http://www.4fb.de
 11:  * @link http://www.contenido.org
 12:  */
 13: 
 14: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
 15: 
 16: cInclude('includes', 'functions.str.php');
 17: 
 18: /**
 19:  * Article collection
 20:  *
 21:  * @package Core
 22:  * @subpackage GenericDB_Model
 23:  */
 24: class cApiArticleCollection extends ItemCollection {
 25: 
 26:     /**
 27:      * Constructor to create an instance of this class.
 28:      *
 29:      * @param string $select [optional]
 30:      *         where clause to use for selection (see ItemCollection::select())
 31:      */
 32:     public function __construct($select = false) {
 33:         global $cfg;
 34:         parent::__construct($cfg['tab']['art'], 'idart');
 35:         $this->_setItemClass('cApiArticle');
 36: 
 37:         // set the join partners so that joins can be used via link() method
 38:         $this->_setJoinPartner('cApiClientCollection');
 39: 
 40:         if ($select !== false) {
 41:             $this->select($select);
 42:         }
 43:     }
 44: 
 45:     /**
 46:      * Creates an article item entry
 47:      *
 48:      * @param int $idclient
 49:      * @return cApiArticle
 50:      */
 51:     public function create($idclient) {
 52:         $item = $this->createNewItem();
 53: 
 54:         $item->set('idclient', $idclient);
 55:         $item->store();
 56: 
 57:         return $item;
 58:     }
 59: 
 60:     /**
 61:      * Returns list of ids by given client id.
 62:      *
 63:      * @param int $idclient
 64:      * @return array
 65:      */
 66:     public function getIdsByClientId($idclient) {
 67:         $sql = "SELECT idart FROM `%s` WHERE idclient=%d";
 68:         $this->db->query($sql, $this->table, $idclient);
 69:         $list = array();
 70:         while ($this->db->next_record()) {
 71:             $list[] = $this->db->f('idart');
 72:         }
 73:         return $list;
 74:     }
 75: }
 76: 
 77: /**
 78:  * Article item
 79:  *
 80:  * @package Core
 81:  * @subpackage GenericDB_Model
 82:  */
 83: class cApiArticle extends Item {
 84: 
 85:     /**
 86:      * Constructor to create an instance of this class.
 87:      *
 88:      * @param mixed $mId [optional]
 89:      *         Specifies the ID of item to load
 90:      */
 91:     public function __construct($mId = false) {
 92:         global $cfg;
 93:         parent::__construct($cfg['tab']['art'], 'idart');
 94:         $this->setFilters(array(), array());
 95:         if ($mId !== false) {
 96:             $this->loadByPrimaryKey($mId);
 97:         }
 98:     }
 99: 
100:     /**
101:      * Returns the link to the current object.
102:      *
103:      * @param int $changeLangId [optional]
104:      *         change language id for URL (optional)
105:      * @return string
106:      *         link
107:      */
108:     public function getLink($changeLangId = 0) {
109:         if ($this->isLoaded() === false) {
110:             return '';
111:         }
112: 
113:         $options = array();
114:         $options['idart'] = $this->get('idart');
115:         $options['lang'] = ($changeLangId == 0) ? cRegistry::getLanguageId() : $changeLangId;
116:         if ($changeLangId > 0) {
117:             $options['changelang'] = $changeLangId;
118:         }
119: 
120:         return cUri::getInstance()->build($options);
121:     }
122: 
123:     /**
124:      * Userdefined setter for article fields.
125:      *
126:      * @param string $name
127:      * @param mixed $value
128:      * @param bool $bSafe [optional]
129:      *         Flag to run defined inFilter on passed value
130:      * @return bool
131:      */
132:     public function setField($name, $value, $bSafe = true) {
133:         switch ($name) {
134:             case 'idclient':
135:                 $value = (int) $value;
136:                 break;
137:         }
138: 
139:         return parent::setField($name, $value, $bSafe);
140:     }
141: 
142: }
143: 
CMS CONTENIDO 4.9.11 API documentation generated by ApiGen 2.8.0