Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

ezcalendar/user/yearview.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: yearview.php 6236 2001-07-20 11:57:16Z jakobn $
5 //
6 // Created on: <27-Dec-2000 11:29:22 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 // 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 $Language = $ini->variable( "eZCalendarMain", "Language" );
38 $Locale = new eZLocale( $Language );
39
40 $today = new eZDateTime();
41 if ( $Year == false )
42 $Year = $today->year();
43 $t = new eZTemplate( "kernel/ezcalendar/user/" . $ini->variable( "eZCalendarMain", "TemplateDir" ),
44 "kernel/ezcalendar/user/intl", $Language, "yearview.php",
45 "default", "ezcalendar" . "/user", $Year );
46
47 $t->set_file( "year_view_page_tpl", "yearview.tpl" );
48
49 $build = false;
50 if ( $t->hasCache() )
51 {
52 // print( "cached<br />" );
53 $file = new eZCacheFile( "kernel/ezcalendar/user/cache", array( "yearview.tpl", "default", $Language, $Year ), "cache", "-" );
54 $dt =& $file->lastModified();
55 if ( $Year == $today->year() && $dt->day() != $today->day() )
56 {
57 $file->delete();
58 $build = true;
59 }
60 else
61 {
62 print( $t->cache() );
63 }
64 }
65 else
66 {
67 $build = true;
68 }
69
70 if ( $build == true )
71 {
72 // print( "not cached<br />" );
73 $t->setAllStrings();
74
75 $t->set_block( "year_view_page_tpl", "month_tpl", "month" );
76 $t->set_block( "month_tpl", "week_tpl", "week" );
77 $t->set_block( "week_tpl", "day_tpl", "day" );
78 $t->set_block( "week_tpl", "empty_day_tpl", "empty_day" );
79
80 $session =& eZSession::globalSession();
81 $session->fetch();
82
83 $date = new eZDate();
84
85 if ( $Year != "" )
86 {
87 $date->setYear( $Year );
88 }
89 else
90 {
91 $Year = $date->year();
92 }
93
94 $session->setVariable( "Year", $Year );
95
96 $t->set_var( "year_number", $Year );
97 $t->set_var( "prev_year_number", $Year - 1 );
98 $t->set_var( "next_year_number", $Year + 1 );
99
100 $i=0;
101 for ( $month=1; $month<13; $month++ )
102 {
103 if ( ( $i % 3 ) == 0 )
104 {
105 $t->set_var( "begin_tr", "<tr>" );
106 $t->set_var( "end_tr", "" );
107 }
108 else if ( ( $i % 3 ) == 2 )
109 {
110 $t->set_var( "begin_tr", "" );
111 $t->set_var( "end_tr", "</tr>" );
112 }
113 else
114 {
115 $t->set_var( "begin_tr", "" );
116 $t->set_var( "end_tr", "" );
117 }
118
119 $date->setMonth( $month );
120 $t->set_var( "month_number", $month );
121 $t->set_var( "month_name", $Locale->monthName( $date->month(), false ) );
122
123 $t->set_var( "week", "" );
124 for ( $week=0; $week<6; $week++ )
125 {
126 $t->set_var( "day", "" );
127 $t->set_var( "empty_day", "" );
128
129 for ( $day=1; $day<=7; $day++ )
130 {
131 $date->setDay( 1 );
132 $firstDay = $date->dayOfWeek( $Locale->mondayFirst() );
133
134 $currentDay = $day + ( $week * 7 ) - $firstDay + 1;
135
136 if ( ( ( $day + ( $week * 7 ) ) >= $firstDay ) &&
137 ( $currentDay <= $date->daysInMonth() ) )
138 {
139 $date->setDay( $currentDay );
140
141 $t->set_var( "td_class", "bglight" );
142 if ( $date->equals( $today ) )
143 $t->set_var( "td_class", "bgcurrent" );
144
145 $t->set_var( "day_number", $currentDay );
146 $t->parse( "day", "day_tpl", true );
147 }
148 else
149 {
150 $t->set_var( "td_class", "bglight" );
151 $t->parse( "day", "empty_day_tpl", true );
152 }
153 }
154 $t->parse( "week", "week_tpl", true );
155
156 if ( $currentDay >= $date->daysInMonth() )
157 {
158 $week = 6;
159 }
160 }
161 $t->parse( "month", "month_tpl", true );
162
163
164 $i++;
165 }
166
167 $t->storeCache( "output", "year_view_page_tpl", true );
168 }
169
170 ?>
$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
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: ezcalendar/user/yearview.php:43
$build
$build
Definition: ezcalendar/user/yearview.php:49
$Locale
$Locale
Definition: ezcalendar/user/yearview.php:38
$Language
$Language
Definition: ezcalendar/user/yearview.php:37
$ini
$ini
Definition: ezcalendar/user/yearview.php:35
$today
$today
Definition: ezcalendar/user/yearview.php:40
$file
$file
Definition: ezfilemanager/user/filedownload.php:35
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.