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