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