Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

entryexitpages.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: entryexitpages.php 6230 2001-07-20 11:28:54Z jakobn $
5 //
6 // Created on: <12-Jan-2001 16:31:41 bf>
7 //
8 // This source file is part of Exponential Basic, publishing software.
9 //
10 // Copyright (C) 1999-2001 eZ Systems. All rights reserved.
11 //
12 // This program is free software; you can redistribute it and/or
13 // modify it under the terms of the GNU General Public License
14 // as published by the Free Software Foundation; either version 2
15 // of the License, or (at your option) any later version.
16 //
17 // This program is distributed in the hope that it will be useful,
18 // but WITHOUT ANY WARRANTY; without even the implied warranty of
19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 // GNU General Public License for more details.
21 //
22 // You should have received a copy of the GNU General Public License
23 // along with this program; if not, write to the Free Software
24 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, US
25 //
26
27 // include_once( "classes/INIFile.php" );
28 $ini =& eZINI::instance( 'site.ini' );
29 $Language = $ini->variable( "eZStatsMain", "Language" );
30
31 // include_once( "classes/eztemplate.php" );
32 // include_once( "classes/ezdate.php" );
33
34 // include_once( "ezstats/classes/ezpageview.php" );
35 // include_once( "ezstats/classes/ezpageviewquery.php" );
36
37 $t = new eZTemplate( "kernel/ezstats/admin/" . $ini->variable( "eZStatsMain", "AdminTemplateDir" ),
38 "kernel/ezstats/admin/intl", $Language, "entryexitpages.php" );
39
40 $t->setAllStrings();
41
42 $t->set_file( array(
43 "entry_exit_report_tpl" => "entryexitpages.tpl"
44 ) );
45
46 $t->set_block( "entry_exit_report_tpl", "exit_page_tpl", "exit_page" );
47 $t->set_block( "entry_exit_report_tpl", "entry_page_tpl", "entry_page" );
48
49 $t->set_var( "exit_page", "" );
50 $t->set_var( "entry_page", "" );
51
52 $t->set_block( "entry_exit_report_tpl", "month_tpl", "month" );
53 $t->set_block( "month_tpl", "month_previous_tpl", "month_previous" );
54 $t->set_block( "month_tpl", "month_previous_inactive_tpl", "month_previous_inactive" );
55 $t->set_block( "month_tpl", "month_next_tpl", "month_next" );
56 $t->set_block( "month_tpl", "month_next_inactive_tpl", "month_next_inactive" );
57
58 if ( isset( $Year ) && !is_numeric( $Year ) || isset( $Month ) && !is_numeric( $Month ) )
59 {
60 $cur_date = new eZDate();
61 $Year = $cur_date->year();
62 $Month = $cur_date->month();
63 }
64
65 $query = new eZPageViewQuery();
66
67 // exit pages
68 $exitPages =& $query->topExitPage( $Month, $Year );
69 $exitPageArray = array();
70
71 foreach ( $exitPages as $index => $page )
72 {
73 $exitPageArray[$index] = array();
74 if( isset( $exitPageArray[$index]["Count"] ) )
75 {
76 $exitPageArray[$index]["Count"] += 1;
77 }
78 else
79 {
80 $exitPageArray[$index]["Count"] = 1;
81 }
82 $exitPageArray[$index]["PageID"] = $page["PageID"];
83 }
84
85 arsort( $exitPageArray );
86
87 $pageView = new eZPageView();
88 $ExitPageLimit = 20;
89
90 $i=0;
91 foreach ( $exitPageArray as $exitPage )
92 {
93 if ( ( $i %2 ) == 0 )
94 $t->set_var( "bg_color", "bglight" );
95 else
96 $t->set_var( "bg_color", "bgdark" );
97
98 $t->set_var( "page_uri", $pageView->requestPageByID( $exitPage["PageID"] ) );
99 $t->set_var( "exit_count", $exitPage["Count"] );
100
101 $t->parse( "exit_page", "exit_page_tpl", true );
102
103 $i++;
104 if ( $i>=$ExitPageLimit )
105 break;
106 }
107
108 // entry pages
109 $entryPages =& $query->topEntryPage( $Month, $Year );
110
111 $entryPageArray = array();
112
113 foreach ( $entryPages as $index => $page )
114 {
115 $entryPageArray[$index] = array();
116 if( isset( $entryPageArray[$index]["Count"] ) )
117 {
118 $entryPageArray[$index]["Count"] += 1;
119 }
120 else
121 {
122 $entryPageArray[$index]["Count"] = 1;
123 }
124 $entryPageArray[$index]["PageID"] = $page;
125 }
126
127 arsort( $entryPageArray );
128
129 $EntryPageLimit = 20;
130
131 $i=0;
132 foreach ( $entryPageArray as $entryPage )
133 {
134 if ( ( $i %2 ) == 0 )
135 $t->set_var( "bg_color", "bglight" );
136 else
137 $t->set_var( "bg_color", "bgdark" );
138
139 $t->set_var( "page_uri", $pageView->requestPageByID( $entryPage["PageID"] ) );
140 $t->set_var( "entry_count", isset( $entryPage["Count"] ) ? $entryPage["Count"] : 0 );
141
142 $t->parse( "entry_page", "entry_page_tpl", true );
143
144 $i++;
145 if ( $i>=$EntryPageLimit )
146 break;
147 }
148
149
150 $next_month = new eZDate( $Year, $Month, 1, 0, 1, 0 );
151 $prev_month = new eZDate( $Year, $Month, 1, 0, -1, 0 );
152
153 $t->set_var( "next_month", $next_month->month() );
154 $t->set_var( "previous_month", $prev_month->month() );
155 $t->set_var( "next_year", $next_month->year() );
156 $t->set_var( "previous_year", $prev_month->year() );
157
158 $t->set_var( "month_next_inactive", "" );
159 $t->set_var( "month_next", "" );
160 $t->set_var( "month_previous", "" );
161 $t->set_var( "month_previous_inactive", "" );
162
163 $cur_date = new eZDate();
164
165 if ( $cur_date->isGreater( $next_month ) )
166 $t->parse( "month_next_inactive", "month_next_inactive_tpl" );
167 else
168 $t->parse( "month_next", "month_next_tpl" );
169
170 $t->parse( "month_previous", "month_previous_tpl" );
171
172 $t->parse( "month", "month_tpl" );
173
174 $t->set_var( "this_month", $Month );
175 $t->set_var( "this_year", $Year );
176
177 $t->pparse( "output", "entry_exit_report_tpl" );
178
179 ?>
eZDate
Definition: ezdate.php:46
eZPageViewQuery
Definition: ezpageviewquery.php:45
eZPageView
Definition: ezpageview.php:47
eZTemplate
Definition: eztemplate.php:107
$next_month
foreach( $entryPageArray as $entryPage) $next_month
Definition: entryexitpages.php:150
$ExitPageLimit
$ExitPageLimit
Definition: entryexitpages.php:88
$t
$t
Definition: entryexitpages.php:37
$cur_date
$cur_date
Definition: entryexitpages.php:163
$entryPages
foreach( $exitPageArray as $exitPage) $entryPages
Definition: entryexitpages.php:109
$exitPages
$exitPages
Definition: entryexitpages.php:68
$i
$i
Definition: entryexitpages.php:90
$query
if(isset( $Year) &&!is_numeric( $Year)||isset( $Month) &&!is_numeric( $Month)) $query
Definition: entryexitpages.php:65
$Language
$Language
Definition: entryexitpages.php:29
$exitPageArray
$exitPageArray
Definition: entryexitpages.php:69
$ini
$ini
Definition: entryexitpages.php:28
$entryPageArray
$entryPageArray
Definition: entryexitpages.php:111
$EntryPageLimit
$EntryPageLimit
Definition: entryexitpages.php:129
$pageView
$pageView
Definition: entryexitpages.php:87
$prev_month
$prev_month
Definition: entryexitpages.php:151
$page
$page
Definition: ezarticle/modules/content.php:28
$Month
$Month
Definition: ezcalendar/user/dayview.php:78
$index
$index
Definition: ezforum/user/messageedit.php:36
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.