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: /**
  4:  * This file contains the collections and items for search tracking
  5:  *
  6:  * @package Core
  7:  * @subpackage GenericDB_Model
  8:  * @author Mischa Holz
  9:  * @copyright four for business AG <www.4fb.de>
 10:  * @license http://www.contenido.org/license/LIZENZ.txt
 11:  * @link http://www.4fb.de
 12:  * @link http://www.contenido.org
 13:  */
 14: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
 15: 
 16: /**
 17:  * Tracking collection
 18:  *
 19:  * @package Core
 20:  * @subpackage GenericDB_Model
 21:  */
 22: class cApiSearchTrackingCollection extends ItemCollection {
 23: 
 24:     /**
 25:      * Constructor to create an instance of this class.
 26:      */
 27:     public function __construct() {
 28:         global $cfg;
 29:         parent::__construct($cfg['tab']['search_tracking'], 'idsearchtracking');
 30: 
 31:         $this->_setItemClass('cApiSearchTracking');
 32:     }
 33: 
 34:     /**
 35:      * Create a new tracking row
 36:      *
 37:      * @param string $searchTerm
 38:      *         Term the user searched for
 39:      * @param int $searchResults
 40:      *         Number of results
 41:      * @param string $timestamp [optional]
 42:      *         Timestamp of the search
 43:      * @param number $idclient [optional]
 44:      *         Client
 45:      * @param number $idlang [optional]
 46:      *         Language
 47:      * @return bool
 48:      */
 49:     public function create($searchTerm, $searchResults, $timestamp = "", $idclient = 0, $idlang = 0) {
 50:         $item = $this->createNewItem();
 51:         $item->set("searchterm", $searchTerm);
 52:         $item->set("results", $searchResults);
 53:         $item->set("datesearched", ($timestamp == "") ? date('Y-m-d H:i:s') : $timestamp);
 54:         $item->set("idclient", ($idclient == 0) ? cRegistry::getClientId() : $idclient);
 55:         $item->set("idlang", ($idlang == 0) ? cRegistry::getLanguageId() : $idlang);
 56: 
 57:         return $item->store();
 58:     }
 59: 
 60:     /**
 61:      * Track a search if the setting allows it.
 62:      *
 63:      * @param string $searchTerm
 64:      *         Term the user searched for
 65:      * @param int $resultCount
 66:      *         Number of results
 67:      * @return bool
 68:      */
 69:     public function trackSearch($searchTerm, $resultCount) {
 70:         if (getEffectiveSetting("search", "term_tracking", "on") != "on") {
 71:             return false;
 72:         }
 73: 
 74:         return $this->create($searchTerm, $resultCount);
 75:     }
 76: 
 77:     /**
 78:      * Select all search terms of this client and language and sort them by
 79:      * popularity
 80:      *
 81:      * @param number $idclient [optional]
 82:      *         Use this client instead of the current one
 83:      * @param number $idlang [optional]
 84:      *         Use this language instead of the current one
 85:      * @return bool
 86:      */
 87:     public function selectPopularSearchTerms($idclient = 0, $idlang = 0) {
 88:         return $this->select('idclient=' . (($idclient == 0) ? cRegistry::getClientId() : $idclient) . ' AND idlang=' . (($idlang == 0) ? cRegistry::getLanguageId() : $idlang), 'searchterm', 'COUNT(searchterm) DESC');
 89:     }
 90: 
 91:     /**
 92:      * Select all entries about one search term for this client and language
 93:      * sorted by the date
 94:      *
 95:      * @param string $term
 96:      *         Term the user searched for
 97:      * @param number $idclient [optional]
 98:      *         Use this client instead of the current one
 99:      * @param number $idlang [optional]
100:      *         Use this language instead of the current one
101:      * @return bool
102:      */
103:     public function selectSearchTerm($term, $idclient = 0, $idlang = 0) {
104:         return $this->select('searchterm=\'' . addslashes($term) . '\' AND idclient=' . (($idclient == 0) ? cRegistry::getClientId() : $idclient) . ' AND idlang=' . (($idlang == 0) ? cRegistry::getLanguageId() : $idlang), '', 'datesearched DESC');
105:     }
106: 
107: }
108: 
109: /**
110:  * SearchTracking item
111:  *
112:  * @package Core
113:  * @subpackage GenericDB_Model
114:  */
115: class cApiSearchTracking extends Item {
116: 
117:     /**
118:      * Constructor to create an instance of this class.
119:      *
120:      * @param string $mId [optional]
121:      *         Item Id
122:      */
123:     public function __construct($mId = false) {
124:         global $cfg;
125: 
126:         parent::__construct($cfg['tab']['search_tracking'], 'idsearchtracking');
127:         $this->setFilters(array(
128:             'addslashes'
129:         ), array(
130:             'stripslashes'
131:         ));
132: 
133:         if ($mId !== false) {
134:             $this->loadByPrimaryKey($mId);
135:         }
136:     }
137: 
138: }
139: 
CMS CONTENIDO 4.9.11 API documentation generated by ApiGen 2.8.0