00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00046 require_once(PATH_t3lib."class.t3lib_extobjbase.php");
00047 require_once(PATH_t3lib."class.t3lib_tsfebeuserauth.php");
00048
00049
00050 class tx_indexedsearch_modfunc2 extends t3lib_extobjbase {
00051
00057 function main() {
00058
00059
00060 global $SOBE,$BE_USER,$LANG,$BACK_PATH,$TCA_DESCR,$TCA,$CLIENT,$TYPO3_CONF_VARS;
00061
00062 $theOutput.=$this->pObj->doc->spacer(5);
00063 $theOutput.=$this->pObj->doc->section($LANG->getLL('title'),$this->showStats(),0,1);
00064
00065 $menu=array();
00066 $menu[]=t3lib_BEfunc::getFuncCheck($this->pObj->id,"SET[tx_indexedsearch_modfunc2_check]",$this->pObj->MOD_SETTINGS["tx_indexedsearch_modfunc2_check"]).$LANG->getLL("checklabel");
00067 $theOutput.=$this->pObj->doc->spacer(5);
00068
00069 return $theOutput;
00070 }
00071
00072
00079 function showStats() {
00080 global $LANG,$HTTP_GET_VARS,$TYPO3_CONF_VARS;
00081
00082 $conf['words']=50;
00083 $conf['bid']=$HTTP_GET_VARS['id'];
00084
00085 $addwhere1='';
00086 $addwhere2=" AND tstamp > ".(time()-30*24*60*60);
00087 $addwhere3=" AND tstamp > ".(time()-24*60*60);
00088
00089 $content.= $LANG->getLL('title2').'
00090 <table cellpading="5" cellspacing="5" valign=top><tr><td valign=top>'
00091 .$this->listSeveralStats($LANG->getLL("all"),$addwhere1,$conf).'</td><td valign=top>'
00092 .$this->listSeveralStats($LANG->getLL("last30days"),$addwhere2,$conf).'</td><td valign=top>'
00093 .$this->listSeveralStats($LANG->getLL("last24hours"),$addwhere3,$conf).'</td></tr></table>'
00094 .$this->note;
00095
00096 return $content;
00097 }
00098
00107 function listSeveralStats($title,$addwhere,$conf) {
00108 global $LANG;
00109
00110 $queryParts['SELECT']= "* , count( * ) AS c";
00111 $queryParts['FROM']="index_stat_word";
00112 $queryParts['WHERE']=sprintf("pageid= %s ".$addwhere, $conf['bid']);
00113 $queryParts['GROUPBY']="word";
00114 $queryParts['ORDERBY']="c DESC,word";
00115 $queryParts['LIMIT']=$conf['words'];
00116
00117 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
00118 $queryParts['SELECT'],
00119 $queryParts['FROM'],
00120 $queryParts['WHERE'],
00121 $queryParts['GROUPBY'],
00122 $queryParts['ORDERBY'],
00123 $queryParts['LIMIT']
00124 );
00125
00126 if ( $res ) {
00127 $count = $GLOBALS['TYPO3_DB']->sql_num_rows( $res );
00128 }else{
00129 $count = 0;
00130 }
00131
00132
00133 if( $count > 0 ){
00134 $this->note = $LANG->getLL("justthispage");
00135 }else{
00136
00137 $secureaddwhere = " AND pageid IN (".($this->extGetTreeList($conf['bid'],100,0,'1')).$conf['bid'].") ";
00138 $this->note = $LANG->getLL("allpages");
00139
00140 $queryParts['WHERE']= '1 '.$addwhere.$secureaddwhere;
00141 }
00142
00143
00144 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
00145 $queryParts['SELECT'],
00146 $queryParts['FROM'],
00147 $queryParts['WHERE'],
00148 $queryParts['GROUPBY'],
00149 $queryParts['ORDERBY'],
00150 $queryParts['LIMIT']
00151 );
00152
00153 $table1='';
00154 $i=0;
00155 if( $res ){
00156 while( $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc( $res ) ) {
00157 $i++;
00158 $table1.='<tr class="bgColor4"><td>'.$i.'.</td><td>'.$row['word'].'</td><td> '.$row['c'].'</td></tr>';
00159 }
00160 }
00161
00162 if( $i==0 ){
00163 $table1='<tr class="bgColor4"><td callspan="3">'.$LANG->getLL("noresults").'</td></tr>';
00164 }
00165
00166 $table1='<table class="bgColor5" cellpadding="2" cellspacing="1"><tr class="tableheader"><td colspan="3">'.$title.'</td></tr>'.$table1.'</table>';
00167
00168
00169 return $note.$table1;
00170 }
00171
00186 function extGetTreeList($id,$depth,$begin = 0,$perms_clause){
00187 return t3lib_tsfeBeUserAuth::extGetTreeList($id,$depth,$begin,$perms_clause);
00188 }
00189
00190
00191 }
00192
00193
00194
00195 if (defined("TYPO3_MODE") && $TYPO3_CONF_VARS[TYPO3_MODE]["XCLASS"]["ext/indexed_search/modfunc2/class.tx_indexedsearch_modfunc2.php"]) {
00196 include_once($TYPO3_CONF_VARS[TYPO3_MODE]["XCLASS"]["ext/indexed_search/modfunc2/class.tx_indexedsearch_modfunc2.php"]);
00197 }
00198
00199 ?>