Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

appointmentview.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: appointmentview.php 7697 2001-10-08 14:39:10Z jhe $
5 //
6 // Created on: <08-Jan-2001 11:53:05 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/ezdatetime.php" );
31 // include_once( "classes/ezdate.php" );
32 // include_once( "classes/eztime.php" );
33 // include_once( "classes/ezlocale.php" );
34
35 // include_once( "ezcalendar/classes/ezappointment.php" );
36 // include_once( "ezcalendar/classes/ezappointmenttype.php" );
37
38 $ini =& eZINI::instance( 'site.ini' );
39
40 $Language = $ini->variable( "eZCalendarMain", "Language" );
41 $locale = new eZLocale( $Language );
42
43 $t = new eZTemplate( "kernel/ezcalendar/user/" . $ini->variable( "eZCalendarMain", "TemplateDir" ),
44 "kernel/ezcalendar/user/intl/", $Language, "appointmentview.php" );
45
46 $t->set_file( "appointment_view_tpl", "appointmentview.tpl" );
47
48 $t->setAllStrings();
49
50 $t->set_block( "appointment_view_tpl", "error_tpl", "error" );
51 $t->set_block( "appointment_view_tpl", "view_tpl", "view" );
52 $t->set_block( "view_tpl", "public_tpl", "public" );
53 $t->set_block( "view_tpl", "private_tpl", "private" );
54 $t->set_block( "view_tpl", "low_tpl", "low" );
55 $t->set_block( "view_tpl", "normal_tpl", "normal" );
56 $t->set_block( "view_tpl", "high_tpl", "high" );
57
58 $user =& eZUser::currentUser();
59 $session =& eZSession::globalSession();
60 $session->fetch();
61
62 $t->set_var( "view", "" );
63 if ( $user == false )
64 $userID = false;
65 else
66 $userID = $user->id();
67
68 if ( isset( $GetByUserID ) && $GetByUserID == false )
69 {
70 $GetByUserID = $userID;
71 }
72
73 if ( ( $session->variable( "ShowOtherCalendarUsers" ) == false ) || ( isset( $GetByUser ) ) )
74 {
75 $session->setVariable( "ShowOtherCalendarUsers", $GetByUserID );
76 }
77
78 $tmpUser = new eZUser( $session->variable( "ShowOtherCalendarUsers" ) );
79
80 if ( $tmpUser->id() == $userID )
81 {
82 $showPrivate = true;
83 }
84 else
85 {
86 $showPrivate = false;
87 }
88
89 $appointment = new eZAppointment( $AppointmentID );
90 $foundAppointment = false;
91
92 if ( $appointment->id() > 0 )
93 {
94 $ownerUser = new eZUser( $appointment->userID() );
95 $trusteeList = array_merge( $ownerUser->trustees(), array( $ownerUser->id() ) );
96 if ( in_array( $user->id(), $trusteeList ) )
97 $foundAppointment = true;
98 }
99
100 if ( $foundAppointment == false )
101 {
102 $t->parse( "error", "error_tpl" );
103 }
104 else
105 {
106 $appointment = new eZAppointment( $AppointmentID );
107 $appointmentType = $appointment->type();
108 $datetime = $appointment->dateTime();
109
110 $t->set_var( "appointment_id", $appointment->id() );
111 $t->set_var( "appointment_title", $appointment->name() );
112 $t->set_var( "appointment_type", $appointmentType->name() );
113 $t->set_var( "appointment_date", $locale->format( $datetime->date() ) );
114 $t->set_var( "appointment_starttime", $locale->format( $appointment->startTime(), true ) );
115 $t->set_var( "appointment_stoptime", $locale->format( $appointment->stopTime(), true ) );
116 $t->set_var( "appointment_description", $appointment->description() );
117
118 $userID = $appointment->userID();
119 if ( $userID != false )
120 {
121 $owner = new eZUser( $userID );
122 $t->set_var( "appointment_owner", $owner->name() );
123 }
124 else
125 $t->set_var( "appointment_owner", "unknown user" );
126
127 if ( $appointment->isPrivate() == true )
128 {
129 $t->parse( "private", "private_tpl" );
130 $t->set_var( "public", "" );
131 }
132 else
133 {
134 $t->parse( "public", "public_tpl" );
135 $t->set_var( "private", "" );
136 }
137 switch ( $appointment->priority() )
138 {
139 case 0:
140 {
141 $t->parse( "low", "low_tpl" );
142 $t->set_var( "normal", "" );
143 $t->set_var( "high", "" );
144 }
145 break;
146 case 1:
147 {
148 $t->parse( "normal", "normal_tpl" );
149 $t->set_var( "low", "" );
150 $t->set_var( "high", "" );
151 }
152 break;
153 case 2:
154 {
155 $t->parse( "high", "high_tpl" );
156 $t->set_var( "low", "" );
157 $t->set_var( "normal", "" );
158 }
159 break;
160 }
161
162 $t->set_var( "error", "" );
163
164 $t->parse( "view", "view_tpl" );
165 }
166
167 $t->pparse( "output", "appointment_view_tpl" );
168
169 ?>
$datetime
$datetime
Definition: appointmentview.php:108
$locale
$locale
Definition: appointmentview.php:41
$t
$t
Definition: appointmentview.php:43
$user
$user
Definition: appointmentview.php:58
$appointmentType
$appointmentType
Definition: appointmentview.php:107
$Language
$Language
Definition: appointmentview.php:40
$ini
$ini
Definition: appointmentview.php:38
$appointment
$appointment
Definition: appointmentview.php:89
$tmpUser
if(isset( $GetByUserID) && $GetByUserID==false) if(( $session->variable("ShowOtherCalendarUsers")==false)||(isset( $GetByUser))) $tmpUser
Definition: appointmentview.php:78
$session
$session
Definition: appointmentview.php:59
$foundAppointment
$foundAppointment
Definition: appointmentview.php:90
$userID
else $userID
Definition: appointmentview.php:66
$owner
$owner
Definition: bugedit.php:555
eZAppointment
Definition: ezappointment.php:43
eZLocale
Definition: ezlocale.php:119
eZSession\globalSession
static & globalSession( $id="", $fetch=true)
Definition: kernel/ezsession/classes/ezsession.php:614
eZTemplate
Definition: eztemplate.php:107
eZUser
Definition: ezuser.php:76
eZUser\currentUser
static & currentUser()
Definition: ezuser.php:896
$showPrivate
$showPrivate
Definition: eventview.php:106
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.