TYPO3 API  SVNRelease
class.tx_cms_webinfo.php
Go to the documentation of this file.
00001 <?php
00002 /***************************************************************
00003 *  Copyright notice
00004 *
00005 *  (c) 1999-2011 Kasper Skårhøj (kasperYYYY@typo3.com)
00006 *  All rights reserved
00007 *
00008 *  This script is part of the TYPO3 project. The TYPO3 project is
00009 *  free software; you can redistribute it and/or modify
00010 *  it under the terms of the GNU General Public License as published by
00011 *  the Free Software Foundation; either version 2 of the License, or
00012 *  (at your option) any later version.
00013 *
00014 *  The GNU General Public License can be found at
00015 *  http://www.gnu.org/copyleft/gpl.html.
00016 *  A copy is found in the textfile GPL.txt and important notices to the license
00017 *  from the author is found in LICENSE.txt distributed with these scripts.
00018 *
00019 *
00020 *  This script is distributed in the hope that it will be useful,
00021 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00022 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00023 *  GNU General Public License for more details.
00024 *
00025 *  This copyright notice MUST APPEAR in all copies of the script!
00026 ***************************************************************/
00027 /**
00028  * Contains a class with functions for page related statistics added to the backend Info module
00029  *
00030  * $Id: class.tx_cms_webinfo.php 10120 2011-01-18 20:03:36Z ohader $
00031  * Revised for TYPO3 3.6 5/2003 by Kasper Skårhøj
00032  *
00033  * @author  Kasper Skårhøj <kasperYYYY@typo3.com>
00034  */
00035 /**
00036  * [CLASS/FUNCTION INDEX of SCRIPT]
00037  *
00038  *
00039  *
00040  *   66: class tx_cms_webinfo_page extends t3lib_extobjbase
00041  *   73:     function modMenu()
00042  *  100:     function main()
00043  *
00044  *
00045  *  198: class tx_cms_webinfo_hits extends tx_cms_webinfo_page
00046  *
00047  * TOTAL FUNCTIONS: 2
00048  * (This index is automatically created/updated by the extension "extdeveval")
00049  *
00050  */
00051 
00052 require_once(PATH_typo3.'class.db_list.inc');
00053 require_once(t3lib_extMgm::extPath('cms').'layout/class.tx_cms_layout.php');
00054 
00055 
00056 /**
00057  * Class for displaying page information (records, page record properties)
00058  *
00059  * @author  Kasper Skårhøj <kasperYYYY@typo3.com>
00060  * @package TYPO3
00061  * @subpackage tx_cms
00062  */
00063 class tx_cms_webinfo_page extends t3lib_extobjbase {
00064 
00065     /**
00066      * Returns the menu array
00067      *
00068      * @return  array
00069      */
00070     function modMenu()  {
00071         global $LANG;
00072         return array (
00073             'pages' => array (
00074                 0 => $LANG->getLL('pages_0'),
00075                 2 => $LANG->getLL('pages_2'),
00076                 1 => $LANG->getLL('pages_1')
00077             ),
00078             'stat_type' => array(
00079                 0 => $LANG->getLL('stat_type_0'),
00080                 1 => $LANG->getLL('stat_type_1'),
00081                 2 => $LANG->getLL('stat_type_2'),
00082             ),
00083             'depth' => array(
00084                 0 => $LANG->getLL('depth_0'),
00085                 1 => $LANG->getLL('depth_1'),
00086                 2 => $LANG->getLL('depth_2'),
00087                 3 => $LANG->getLL('depth_3'),
00088                 999 => $LANG->sL('LLL:EXT:lang/locallang_core.xml:labels.depth_infi'),
00089             )
00090         );
00091     }
00092 
00093     /**
00094      * MAIN function for page information display (including hit statistics)
00095      *
00096      * @return  string      Output HTML for the module.
00097      */
00098     function main() {
00099         global $BACK_PATH,$LANG,$SOBE;
00100 
00101         $dblist = t3lib_div::makeInstance('tx_cms_layout');
00102         $dblist->descrTable = '_MOD_'.$GLOBALS['MCONF']['name'];
00103         $dblist->backPath = $BACK_PATH;
00104         $dblist->thumbs = 0;
00105         $dblist->script = 'index.php';
00106         $dblist->showIcon = 0;
00107         $dblist->setLMargin=0;
00108         $dblist->agePrefixes=$LANG->sL('LLL:EXT:lang/locallang_core.php:labels.minutesHoursDaysYears');
00109 
00110         $dblist->pI_showUser=1;
00111         $dblist->pI_showStat=0;
00112 
00113 
00114             // PAGES:
00115         $this->pObj->MOD_SETTINGS['pages_levels']=$this->pObj->MOD_SETTINGS['depth'];       // ONLY for the sake of dblist module which uses this value.
00116 
00117         $h_func = t3lib_BEfunc::getFuncMenu($this->pObj->id,'SET[depth]',$this->pObj->MOD_SETTINGS['depth'],$this->pObj->MOD_MENU['depth'],'index.php');
00118         if ($this->pObj->MOD_SETTINGS['function']=='tx_cms_webinfo_hits')   {
00119             $h_func.= t3lib_BEfunc::getFuncMenu($this->pObj->id,'SET[stat_type]',$this->pObj->MOD_SETTINGS['stat_type'],$this->pObj->MOD_MENU['stat_type'],'index.php');
00120 
00121             if ($this->pObj->MOD_SETTINGS['stat_type']==1)  $dblist->stat_select_field='rl0';
00122             if ($this->pObj->MOD_SETTINGS['stat_type']==2)  $dblist->stat_select_field='rl1';
00123 
00124                 // Timespan
00125             for ($a=0;$a<30;$a++)   {
00126                 $dblist->stat_codes[]='HITS_days:'.(-$a);
00127             }
00128             $timespan_b = mktime (0,0,0);
00129             $timespan_e = mktime (0,0,0)-(30-1)*3600*24+1;
00130             $header='<br />'.sprintf($LANG->getLL('stat_period'),t3lib_BEfunc::date($timespan_b),t3lib_BEfunc::date($timespan_e)).'<br />';
00131 
00132                 //
00133             $dblist->start($this->pObj->id,'pages',0);
00134             $dblist->pages_noEditColumns=1;
00135             $dblist->generateList();
00136 
00137 
00138             $theOutput.= $this->pObj->doc->section($LANG->getLL('hits_title'),
00139                 t3lib_BEfunc::cshItem($dblist->descrTable, 'stat', $GLOBALS['BACK_PATH'], '|<br />') . // CSH
00140                     $h_func.
00141                     $header.
00142                     $dblist->HTMLcode,
00143                 0,
00144                 1
00145             );
00146         } else {
00147             $h_func.= t3lib_BEfunc::getFuncMenu($this->pObj->id,'SET[pages]',$this->pObj->MOD_SETTINGS['pages'],$this->pObj->MOD_MENU['pages'],'index.php');
00148             $dblist->start($this->pObj->id,'pages',0);
00149             $dblist->generateList();
00150 
00151                 // CSH
00152             $theOutput.=$this->pObj->doc->section($LANG->getLL('page_title'),
00153                 t3lib_BEfunc::cshItem($dblist->descrTable, 'pagetree_overview', $GLOBALS['BACK_PATH'], '|<br />') . // CSH
00154                     $h_func.
00155                     $dblist->HTMLcode,
00156                 0,
00157                 1
00158             );
00159 
00160                 // SYS_NOTES:
00161             if (t3lib_extMgm::isLoaded('sys_note')) {
00162                 $dblist->start($this->pObj->id,'sys_note',0);
00163                 $dblist->generateList();
00164                 if ($dblist->HTMLcode)  {
00165                     $theOutput.=$this->pObj->doc->spacer(10);
00166                     $theOutput.=$this->pObj->doc->section($LANG->getLL('page_sysnote'),
00167                         $dblist->HTMLcode,
00168                         0,
00169                         1
00170                     );
00171                 }
00172             }
00173 
00174                 // PAGE INFORMATION
00175             if ($this->pObj->pageinfo['uid'])   {
00176                 $theOutput.=$this->pObj->doc->spacer(10);
00177                 $theOutput.=$this->pObj->doc->section($LANG->getLL('pageInformation'),$dblist->getPageInfoBox($this->pObj->pageinfo,$this->pObj->CALC_PERMS&2),0,1);
00178             }
00179         }
00180 
00181         return $theOutput;
00182     }
00183 }
00184 
00185 /**
00186  * Extension class for hits display, basically using tx_cms_webinfo_page (internally this is detected).
00187  * This construction is due to the old "pre-extensions" structure
00188  *
00189  * IMPORTANT: This class is used by the extension "sys_stat" and will be added to the Info module only when "sys_stat" is installed.
00190  * The display of statistics goes on in "tx_cms_webinfo_page" though
00191  *
00192  * @author  Kasper Skårhøj <kasperYYYY@typo3.com>
00193  * @package TYPO3
00194  * @subpackage tx_cms
00195  */
00196 class tx_cms_webinfo_hits extends tx_cms_webinfo_page {
00197 }
00198 
00199 
00200 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/cms/web_info/class.tx_cms_webinfo.php'])) {
00201     include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/cms/web_info/class.tx_cms_webinfo.php']);
00202 }
00203 ?>