00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055 class tx_indexedsearch_modfunc2 extends t3lib_extobjbase {
00056
00057
00058
00059
00060
00061
00062 function main() {
00063
00064 global $SOBE,$BE_USER,$LANG,$BACK_PATH,$TCA_DESCR,$TCA,$CLIENT,$TYPO3_CONF_VARS;
00065
00066 $theOutput.=$this->pObj->doc->spacer(5);
00067 $theOutput.=$this->pObj->doc->section($LANG->getLL('title'),$this->showStats(),0,1);
00068
00069 $menu=array();
00070 $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>';
00071 $theOutput.=$this->pObj->doc->spacer(5);
00072
00073 return $theOutput;
00074 }
00075
00076
00077
00078
00079
00080
00081
00082
00083 function showStats() {
00084 global $LANG, $TYPO3_CONF_VARS;
00085
00086 $conf['words']=50;
00087 $conf['bid'] = intval(t3lib_div::_GET('id'));
00088
00089 $addwhere1='';
00090 $addwhere2=' AND tstamp > ' . ($GLOBALS['EXEC_TIME'] - 30 * 24 * 60 * 60);
00091 $addwhere3=' AND tstamp > ' . ($GLOBALS['EXEC_TIME'] - 24 * 60 * 60);
00092
00093 $content.= $LANG->getLL('title2').'
00094 <table cellpading="5" cellspacing="5" valign="top"><tr><td valign="top">'
00095 .$this->listSeveralStats($LANG->getLL('all'),$addwhere1,$conf).'</td><td valign="top">'
00096 .$this->listSeveralStats($LANG->getLL('last30days'),$addwhere2,$conf).'</td><td valign="top">'
00097 .$this->listSeveralStats($LANG->getLL('last24hours'),$addwhere3,$conf).'</td></tr></table>'
00098 .$this->note;
00099
00100
00101 if ($hookObj = $this->hookRequest('additionalSearchStat')) {
00102 $content.= $hookObj->additionalSearchStat();
00103 }
00104
00105 return $content;
00106 }
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116 function listSeveralStats($title,$addwhere,$conf) {
00117 global $LANG;
00118
00119 $queryParts['SELECT'] = 'word, COUNT(*) AS c';
00120 $queryParts['FROM']='index_stat_word';
00121 $queryParts['WHERE']=sprintf('pageid= %d '.$addwhere, $conf['bid']);
00122 $queryParts['GROUPBY']='word';
00123 $queryParts['ORDERBY']='c DESC,word';
00124 $queryParts['LIMIT']=$conf['words'];
00125
00126 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
00127 $queryParts['SELECT'],
00128 $queryParts['FROM'],
00129 $queryParts['WHERE'],
00130 $queryParts['GROUPBY'],
00131 $queryParts['ORDERBY'],
00132 $queryParts['LIMIT']
00133 );
00134
00135 if ($res) {
00136 $count = $GLOBALS['TYPO3_DB']->sql_num_rows($res);
00137 } else {
00138 $count = 0;
00139 }
00140
00141
00142 if ($count > 0) {
00143 $this->note = $LANG->getLL('justthispage');
00144 } else {
00145
00146 $secureaddwhere = ' AND pageid IN (' . ($this->extGetTreeList($conf['bid'], 100, 0, '1=1')) . $conf['bid'] . ') ';
00147 $this->note = $LANG->getLL('allpages');
00148
00149 $queryParts['WHERE'] = '1=1 ' . $addwhere . $secureaddwhere;
00150 }
00151
00152
00153 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
00154 $queryParts['SELECT'],
00155 $queryParts['FROM'],
00156 $queryParts['WHERE'],
00157 $queryParts['GROUPBY'],
00158 $queryParts['ORDERBY'],
00159 $queryParts['LIMIT']
00160 );
00161
00162 $table1='';
00163 $i=0;
00164 if ($res) {
00165 while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
00166 $i++;
00167 $table1.='<tr class="bgColor4"><td>'.$i.'.</td><td>'.$row['word'].'</td><td> '.$row['c'].'</td></tr>';
00168 }
00169 }
00170
00171 if ($i==0) {
00172 $table1='<tr class="bgColor4"><td callspan="3">'.$LANG->getLL("noresults").'</td></tr>';
00173 }
00174
00175 $table1='<table class="bgColor5" cellpadding="2" cellspacing="1"><tr class="tableheader"><td colspan="3">'.$title.'</td></tr>'.$table1.'</table>';
00176
00177 return $note.$table1;
00178 }
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194 function extGetTreeList($id,$depth,$begin = 0,$perms_clause) {
00195 return t3lib_tsfeBeUserAuth::extGetTreeList($id,$depth,$begin,$perms_clause);
00196 }
00197
00198
00199
00200
00201
00202
00203
00204
00205 function hookRequest($functionName) {
00206 global $TYPO3_CONF_VARS;
00207
00208
00209 if ($TYPO3_CONF_VARS['EXTCONF']['indexed_search']['be_hooks'][$functionName]) {
00210 $hookObj = t3lib_div::getUserObj($TYPO3_CONF_VARS['EXTCONF']['indexed_search']['be_hooks'][$functionName]);
00211 if (method_exists ($hookObj, $functionName)) {
00212 $hookObj->pObj = $this;
00213 return $hookObj;
00214 }
00215 }
00216 }
00217 }
00218
00219
00220
00221 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/indexed_search/modfunc2/class.tx_indexedsearch_modfunc2.php']) {
00222 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/indexed_search/modfunc2/class.tx_indexedsearch_modfunc2.php']);
00223 }
00224
00225 ?>