Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

ezgroupeventcalendar/user/yearview.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: yearview.php,v 1.16 2001/04/20 15:32:00 gl Exp $
5 //
6 // Adam Fallert <FallertA@umsystem.edu>
7 // Created on: <3-Oct-2001 14:36:00>
8 //
9 // This source file is part of Exponential Basic, publishing software.
10 // Copyright (C) 1999-2001 eZ systems as
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 // include_once( "classes/eztemplate.php" );
29 // include_once( "classes/ezlog.php" );
30 // include_once( "classes/ezlocale.php" );
31 // include_once( "classes/ezdate.php" );
32 // include_once( "classes/ezdatetime.php" );
33 // include_once( "classes/ezcachefile.php" );
34
35 $ini =& eZINI::instance( 'site.ini' );
36
37 $SiteDesign = $ini->variable( "site", "SiteDesign" );
38 $Language = $ini->variable( "eZGroupEventCalendarMain", "Language" );
39
40 $TemplateDir = $ini->variable( "eZGroupEventCalendarMain", "TemplateDir" );
41 $GlobalSectionID = $ini->variable( "eZGroupEventCalendarMain", "DefaultSection" );
42
43 $Locale = new eZLocale( $Language );
44
45 $today = new eZDateTime();
46 if ( $Year == false )
47 $Year = $today->year();
48
49 // init the section
50 $sectionObject =& eZSection::globalSectionObject( $GlobalSectionID );
51 $sectionObject->setOverrideVariables();
52
53 $templateDirTmp = $sectionObject->templateStyle();
54
55 if ( $templateDirTmp != null && trim( $templateDirTmp ) != "" )
56 {
57 $TemplateDir = "kernel/ezgroupeventcalendar/user/" . preg_replace( "/(.+)\/.+(\/?)/", "/\\1/$templateDirTmp\\2", $TemplateDir );
58 }
59 else
60 {
61 $TemplateDir = "kernel/ezgroupeventcalendar/user/" . $ini->variable( "eZGroupEventCalendarMain", "TemplateDir" );
62 }
63
64 $t = new eZTemplate( $TemplateDir,
65 "kernel/ezgroupeventcalendar/user/intl", $Language, "yearview.php",
66 "default", "kernel/ezgroupeventcalendar" . "/user", $Year );
67
68 $t->set_file( "year_view_page_tpl", "yearview.tpl" );
69 $t->set_var("date_year", $today->year());
70 $t->set_var("date_month", $today->month());
71 $t->set_var("date_day", $today->day());
72 /*
73 $build = false;
74 if ( $t->hasCache() )
75 {
76 // print( "cached<br />" );
77 $file = new eZCacheFile( "ezgroupeventcalendar/user/cache", array( "yearview.tpl", "default", $Language, $Year ), "cache", "-" );
78 $dt =& $file->lastModified();
79
80 if ( $Year == $today->year() && $dt->day() != $today->day() )
81 {
82 $file->delete();
83 $build = true;
84 }
85 else
86 {
87 print( $t->cache() );
88 }
89 }
90 else
91 {
92 $build = true;
93 } */
94 $build = true;
95 if ( $build == true )
96 {
97 // print( "not cached<br />" );
98 $t->setAllStrings();
99
100 $t->set_block( "year_view_page_tpl", "month_tpl", "month" );
101 $t->set_block( "month_tpl", "week_tpl", "week" );
102 $t->set_block( "week_tpl", "day_tpl", "day" );
103 $t->set_block( "week_tpl", "empty_day_tpl", "empty_day" );
104
105 $t->set_var( "sitedesign", $SiteDesign );
106
107 $session =& eZSession::globalSession();
108 $session->fetch();
109
110 $date = new eZDate();
111
112 if ( $Year != "" )
113 {
114 $date->setYear( $Year );
115 }
116 else
117 {
118 $Year = $date->year();
119 }
120
121 $session->setVariable( "Year", $Year );
122
123 $t->set_var( "year_number", $Year );
124 $t->set_var( "prev_year_number", $Year - 1 );
125 $t->set_var( "next_year_number", $Year + 1 );
126
127 $i=0;
128 for ( $month=1; $month<13; $month++ )
129 {
130 if ( ( $i % 3 ) == 0 )
131 {
132 $t->set_var( "begin_tr", "<tr>" );
133 $t->set_var( "end_tr", "" );
134 }
135 else if ( ( $i % 3 ) == 2 )
136 {
137 $t->set_var( "begin_tr", "" );
138 $t->set_var( "end_tr", "</tr>" );
139 }
140 else
141 {
142 $t->set_var( "begin_tr", "" );
143 $t->set_var( "end_tr", "" );
144 }
145
146 $date->setMonth( $month );
147 $t->set_var( "month_number", $month );
148 $t->set_var( "month_name", $Locale->monthName( $date->month(), false ) );
149
150 $t->set_var( "week", "" );
151 for ( $week=0; $week<6; $week++ )
152 {
153 $t->set_var( "day", "" );
154 $t->set_var( "empty_day", "" );
155
156 for ( $day=1; $day<=7; $day++ )
157 {
158 $date->setDay( 1 );
159 $firstDay = $date->dayOfWeek( $Locale->mondayFirst() );
160
161 $currentDay = $day + ( $week * 7 ) - $firstDay + 1;
162
163 if ( ( ( $day + ( $week * 7 ) ) >= $firstDay ) &&
164 ( $currentDay <= $date->daysInMonth() ) )
165 {
166 $date->setDay( $currentDay );
167
168 $t->set_var( "td_class", "gcalYearViewReg" );
169 if ( $date->equals( $today ) )
170 $t->set_var( "td_class", "gcalYearViewCur" );
171
172 $t->set_var( "day_number", $currentDay );
173 $t->parse( "day", "day_tpl", true );
174 }
175 else
176 {
177 $t->set_var( "td_class", "gcalYearViewOff" );
178 $t->parse( "day", "empty_day_tpl", true );
179 }
180 }
181 $t->parse( "week", "week_tpl", true );
182
183 if ( $currentDay >= $date->daysInMonth() )
184 {
185 $week = 6;
186 }
187 }
188 $t->parse( "month", "month_tpl", true );
189
190
191 $i++;
192 }
193
194 $t->storeCache( "output", "year_view_page_tpl", true );
195 }
196
197 ?>
$i
$i
Definition: admin/adlist.php:91
$session
$session
Definition: admin/articlelist.php:44
$day
else $day
Definition: appointmentedit.php:665
$month
else $month
Definition: appointmentedit.php:660
$date
$date
Definition: bugpreview.php:66
eZDateTime
Definition: ezdatetime.php:55
eZDate
Definition: ezdate.php:46
eZLocale
Definition: ezlocale.php:119
eZSection\globalSectionObject
static & globalSectionObject( $sectionID)
Definition: ezsection.php:366
eZSession\globalSession
static & globalSession( $id="", $fetch=true)
Definition: kernel/ezsession/classes/ezsession.php:614
eZTemplate
Definition: eztemplate.php:107
$firstDay
$firstDay
Definition: ezcalendar/user/monthview.php:134
$t
$t
Definition: ezgroupeventcalendar/user/yearview.php:64
$TemplateDir
$TemplateDir
Definition: ezgroupeventcalendar/user/yearview.php:40
$build
$build
Definition: ezgroupeventcalendar/user/yearview.php:94
$GlobalSectionID
$GlobalSectionID
Definition: ezgroupeventcalendar/user/yearview.php:41
$sectionObject
$sectionObject
Definition: ezgroupeventcalendar/user/yearview.php:50
$Locale
$Locale
Definition: ezgroupeventcalendar/user/yearview.php:43
$Language
$Language
Definition: ezgroupeventcalendar/user/yearview.php:38
$ini
$ini
Definition: ezgroupeventcalendar/user/yearview.php:35
$templateDirTmp
$templateDirTmp
Definition: ezgroupeventcalendar/user/yearview.php:53
$SiteDesign
$SiteDesign
Definition: ezgroupeventcalendar/user/yearview.php:37
$today
$today
Definition: ezgroupeventcalendar/user/yearview.php:45
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.