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 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 = $this->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=\'' . addslashes($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.7 API documentation generated by ApiGen