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
  • cApiSearchTracking
  • cApiSearchTrackingCollection
  • 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 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 = parent::createNewItem();
 68: 
 69:         $oItem->set('visited', (int) $iVisited);
 70:         $oItem->set('idcatart', (int) $iIdCatArt);
 71:         $oItem->set('idlang', (int) $iIdLang);
 72:         $oItem->set('idclient', (int) $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: 
CMS CONTENIDO 4.9.3 API documentation generated by ApiGen 2.8.0