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 stat 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:  * Statistic collection
 20:  *
 21:  * @package Core
 22:  * @subpackage GenericDB_Model
 23:  */
 24: class cApiStatCollection extends ItemCollection {
 25: 
 26:     /**
 27:      * Constructor
 28:      */
 29:     public function __construct() {
 30:         global $cfg;
 31:         parent::__construct($cfg['tab']['stat'], 'idstat');
 32:         $this->_setItemClass('cApiStat');
 33: 
 34:         // set the join partners so that joins can be used via link() method
 35:         $this->_setJoinPartner('cApiCategoryArticleCollection');
 36:         $this->_setJoinPartner('cApiLanguageCollection');
 37:         $this->_setJoinPartner('cApiClientCollection');
 38:     }
 39: 
 40:     /**
 41:      * Tracks a visit.
 42:      * Increments a existing entry or creates a new one.
 43:      *
 44:      * @param int $iIdCatArt
 45:      * @param int $iIdLang
 46:      * @param int $iIdClient
 47:      */
 48:     public function trackVisit($iIdCatArt, $iIdLang, $iIdClient) {
 49:         $oStat = $this->fetchByCatArtAndLang($iIdCatArt, $iIdLang);
 50:         if (is_object($oStat)) {
 51:             $oStat->increment();
 52:         } else {
 53:             $this->create($iIdCatArt, $iIdLang, $iIdClient);
 54:         }
 55:     }
 56: 
 57:     /**
 58:      * Creates a stat entry.
 59:      *
 60:      * @param int $iIdCatArt
 61:      * @param int $iIdLang
 62:      * @param int $iIdClient
 63:      * @param int $iVisited
 64:      * @return cApiStat
 65:      */
 66:     public function create($iIdCatArt, $iIdLang, $iIdClient, $iVisited = 1) {
 67:         $oItem = $this->createNewItem();
 68: 
 69:         $oItem->set('visited', $iVisited);
 70:         $oItem->set('idcatart', $iIdCatArt);
 71:         $oItem->set('idlang', $iIdLang);
 72:         $oItem->set('idclient', $iIdClient);
 73:         $oItem->store();
 74: 
 75:         return $oItem;
 76:     }
 77: 
 78:     /**
 79:      * Returns a stat entry by category article and language.
 80:      *
 81:      * @param int $iIdCatArt
 82:      * @param int $iIdLang
 83:      * @return cApiStat NULL
 84:      */
 85:     public function fetchByCatArtAndLang($iIdCatArt, $iIdLang) {
 86:         $this->select('idcatart=' . (int) $iIdCatArt . ' AND idlang=' . (int) $iIdLang);
 87:         return $this->next();
 88:     }
 89: 
 90:     /**
 91:      * Deletes statistics entries by category article id and language id.
 92:      *
 93:      * @param int $idcatart
 94:      * @param int $idlang
 95:      * @return int Number of deleted items
 96:      */
 97:     public function deleteByCategoryArticleAndLanguage($idcatart, $idlang) {
 98:         $where = 'idcatart = ' . (int) $idcatart . ' AND idlang = ' . (int) $idlang;
 99:         return $this->deleteByWhereClause($where);
100:     }
101: }
102: 
103: /**
104:  * Statistic item
105:  *
106:  * @package Core
107:  * @subpackage GenericDB_Model
108:  */
109: class cApiStat extends Item {
110: 
111:     /**
112:      * Constructor Function
113:      *
114:      * @param mixed $mId Specifies the ID of item to load
115:      */
116:     public function __construct($mId = false) {
117:         global $cfg;
118:         parent::__construct($cfg['tab']['stat'], 'idstat');
119:         $this->setFilters(array(), array());
120:         if ($mId !== false) {
121:             $this->loadByPrimaryKey($mId);
122:         }
123:     }
124: 
125:     /**
126:      * Increment and store property 'visited'.
127:      */
128:     public function increment() {
129:         $this->set('visited', $this->get('visited') + 1);
130:         $this->store();
131:     }
132:     
133:     /**
134:      * Userdefined setter for stat fields.
135:      *
136:      * @param string $name
137:      * @param mixed $value
138:      * @param bool $bSafe Flag to run defined inFilter on passed value
139:      */
140:     public function setField($name, $value, $bSafe = true) {
141:         switch ($name) {
142:             case 'visited':
143:                 $value = (int) $value;
144:                 break;
145:             case 'idcatart':
146:                 $value = (int) $value;
147:                 break;
148:             case 'idlang':
149:                 $value = (int) $value;
150:                 break;
151:             case 'idclient':
152:                 $value = (int) $value;
153:                 break;
154:         }
155: 
156:         return parent::setField($name, $value, $bSafe);
157:     }
158:     
159: }
160: 
CMS CONTENIDO 4.9.7 API documentation generated by ApiGen