00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00047 require_once(PATH_t3lib.'class.t3lib_extobjbase.php');
00048 require_once(PATH_t3lib.'class.t3lib_tsfebeuserauth.php');
00049
00050
00051
00052
00060 class tx_indexedsearch_modfunc2 extends t3lib_extobjbase {
00061
00067 function main() {
00068
00069 global $SOBE,$BE_USER,$LANG,$BACK_PATH,$TCA_DESCR,$TCA,$CLIENT,$TYPO3_CONF_VARS;
00070
00071 $theOutput.=$this->pObj->doc->spacer(5);
00072 $theOutput.=$this->pObj->doc->section($LANG->getLL('title'),$this->showStats(),0,1);
00073
00074 $menu=array();
00075 $menu[]=t3lib_BEfunc::getFuncCheck($this->pObj->id,'SET[tx_indexedsearch_modfunc2_check]',$this->pObj->MOD_SETTINGS['tx_indexedsearch_modfunc2_check'],'','','id="checkTx_indexedsearch_modfunc2_check"').'<label for="checkTx_indexedsearch_modfunc2_check"'.$LANG->getLL('checklabel').'</label>';
00076 $theOutput.=$this->pObj->doc->spacer(5);
00077
00078 return $theOutput;
00079 }
00080
00081
00088 function showStats() {
00089 global $LANG,$HTTP_GET_VARS,$TYPO3_CONF_VARS;
00090
00091 $conf['words']=50;
00092 $conf['bid']=$HTTP_GET_VARS['id'];
00093
00094 $addwhere1='';
00095 $addwhere2=' AND tstamp > '.(time()-30*24*60*60);
00096 $addwhere3=' AND tstamp > '.(time()-24*60*60);
00097
00098 $content.= $LANG->getLL('title2').'
00099 <table cellpading="5" cellspacing="5" valign="top"><tr><td valign="top">'
00100 .$this->listSeveralStats($LANG->getLL('all'),$addwhere1,$conf).'</td><td valign="top">'
00101 .$this->listSeveralStats($LANG->getLL('last30days'),$addwhere2,$conf).'</td><td valign="top">'
00102 .$this->listSeveralStats($LANG->getLL('last24hours'),$addwhere3,$conf).'</td></tr></table>'
00103 .$this->note;
00104
00105
00106 if ($hookObj = &$this->hookRequest('additionalSearchStat')) {
00107 $content.= $hookObj->additionalSearchStat();
00108 }
00109
00110 return $content;
00111 }
00112
00121 function listSeveralStats($title,$addwhere,$conf) {
00122 global $LANG;
00123
00124 $queryParts['SELECT']= '*, COUNT(*) AS c';
00125 $queryParts['FROM']='index_stat_word';
00126 $queryParts['WHERE']=sprintf('pageid= %s '.$addwhere, $conf['bid']);
00127 $queryParts['GROUPBY']='word';
00128 $queryParts['ORDERBY']='c DESC,word';
00129 $queryParts['LIMIT']=$conf['words'];
00130
00131 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
00132 $queryParts['SELECT'],
00133 $queryParts['FROM'],
00134 $queryParts['WHERE'],
00135 $queryParts['GROUPBY'],
00136 $queryParts['ORDERBY'],
00137 $queryParts['LIMIT']
00138 );
00139
00140 if ($res) {
00141 $count = $GLOBALS['TYPO3_DB']->sql_num_rows($res);
00142 } else {
00143 $count = 0;
00144 }
00145
00146
00147 if ($count > 0) {
00148 $this->note = $LANG->getLL('justthispage');
00149 } else {
00150
00151 $secureaddwhere = ' AND pageid IN ('.($this->extGetTreeList($conf['bid'],100,0,'1')).$conf['bid'].') ';
00152 $this->note = $LANG->getLL('allpages');
00153
00154 $queryParts['WHERE']= '1 '.$addwhere.$secureaddwhere;
00155 }
00156
00157
00158 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
00159 $queryParts['SELECT'],
00160 $queryParts['FROM'],
00161 $queryParts['WHERE'],
00162 $queryParts['GROUPBY'],
00163 $queryParts['ORDERBY'],
00164 $queryParts['LIMIT']
00165 );
00166
00167 $table1='';
00168 $i=0;
00169 if ($res) {
00170 while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
00171 $i++;
00172 $table1.='<tr class="bgColor4"><td>'.$i.'.</td><td>'.$row['word'].'</td><td> '.$row['c'].'</td></tr>';
00173 }
00174 }
00175
00176 if ($i==0) {
00177 $table1='<tr class="bgColor4"><td callspan="3">'.$LANG->getLL("noresults").'</td></tr>';
00178 }
00179
00180 $table1='<table class="bgColor5" cellpadding="2" cellspacing="1"><tr class="tableheader"><td colspan="3">'.$title.'</td></tr>'.$table1.'</table>';
00181
00182 return $note.$table1;
00183 }
00184
00199 function extGetTreeList($id,$depth,$begin = 0,$perms_clause) {
00200 return t3lib_tsfeBeUserAuth::extGetTreeList($id,$depth,$begin,$perms_clause);
00201 }
00202
00210 function &hookRequest($functionName) {
00211 global $TYPO3_CONF_VARS;
00212
00213
00214 if ($TYPO3_CONF_VARS['EXTCONF']['indexed_search']['be_hooks'][$functionName]) {
00215 $hookObj = &t3lib_div::getUserObj($TYPO3_CONF_VARS['EXTCONF']['indexed_search']['be_hooks'][$functionName]);
00216 if (method_exists ($hookObj, $functionName)) {
00217 $hookObj->pObj = &$this;
00218 return $hookObj;
00219 }
00220 }
00221 }
00222 }
00223
00224
00225
00226 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/indexed_search/modfunc2/class.tx_indexedsearch_modfunc2.php']) {
00227 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/indexed_search/modfunc2/class.tx_indexedsearch_modfunc2.php']);
00228 }
00229
00230 ?>