Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

ezgroupeventcalendar/user/fileedit.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: fileedit.php,v 1.7 2001/08/30 07:55:56 bf Exp $
5 //
6 // Created on: <21-Dec-2000 18:01:48 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
31 // include_once( "classes/ezfile.php" );
32
33 // include_once( "ezfilemanager/classes/ezvirtualfile.php" );
34 // include_once( "ezuser/classes/ezobjectpermission.php" );
35
36 $ini =& eZINI::instance( 'site.ini' );
37 $Language = $ini->variable( "eZGroupEventCalendarMain", "Language" );
38
39 //include_once( "ezgroupeventcalendar/classes/ezgroupeventcategory.php" );
40 //include_once( "ezgroupeventcalendar/classes/ezgroupevent.php" );
41
42 if ( isset( $DeleteSelected ) )
43 $Action = "Delete";
44
45 if ( $Action == "Insert" )
46 {
47 $file = new eZFile();
48
49 if ( $file->getUploadedFile( "userfile" ) )
50 {
51 $event = new eZGroupEvent( $EventID );
52
53 $uploadedFile = new eZVirtualFile();
54 $uploadedFile->setName( $Name );
55 $uploadedFile->setDescription( $Description );
56
57 $uploadedFile->setFile( $file );
58
59 $uploadedFile->store();
60
61 eZObjectPermission::removePermissions( $uploadedFile->id(), "filemanager_file", "r" );
62 eZObjectPermission::removePermissions( $uploadedFile->id(), "filemanager_file", "w" );
63
64 eZObjectPermission::setPermission( -1, $uploadedFile->id(), "filemanager_file", "r" );
65 eZObjectPermission::setPermission( 1, $uploadedFile->id(), "filemanager_file", "w" );
66
67 $event->addFile( $uploadedFile );
68
69 eZPBLog::writeNotice( "File added to event $EventID from IP: $REMOTE_ADDR" );
70 }
71 else
72 {
73 print( $file->name() . " not uploaded successfully" );
74 }
75
76 // include_once( "classes/ezhttptool.php" );
77 eZHTTPTool::header( "Location: /groupeventcalendar/eventedit/filelist/" . $EventID . "/" );
78 exit();
79 }
80
81 if ( $Action == "Update" )
82 {
83 $file = new eZFile();
84
85 if ( $file->getUploadedFile( "userfile" ) )
86 {
87 $event = new eZGroupEvent( $EventID );
88
89 $oldFile = new eZFile( $FileID );
90 $event->deleteFile( $oldFile );
91
92 $uploadedFile = new eZVirtualFile();
93 $uploadedFile->setName( $Name );
94 $uploadedFile->setDescription( $Description );
95
96 $uploadedFile->setFile( $file );
97
98 $uploadedFile->store();
99
100 $event->addFile( $uploadedFile );
101 }
102 else
103 {
104 $uploadedFile = new eZVirtualFile( $FileID );
105 $uploadedFile->setName( $Name );
106 $uploadedFile->setDescription( $Description );
107 $uploadedFile->store();
108 }
109
110 // include_once( "classes/ezhttptool.php" );
111 eZHTTPTool::header( "Location: /groupeventcalendar/eventedit/filelist/" . $EventID . "/" );
112 exit();
113 }
114
115
116 if ( $Action == "Delete" )
117 {
118 $event = new eZGroupEvent( $EventID );
119
120 if ( count ( $FileArrayID ) != 0 )
121 {
122 foreach( $FileArrayID as $FileID )
123 {
124 $file = new eZVirtualFile( $FileID );
125 $event->deleteFile( $file );
126 }
127 }
128
129 // include_once( "classes/ezhttptool.php" );
130 eZHTTPTool::header( "Location: /groupeventcalendar/eventedit/filelist/" . $EventID . "/" );
131 exit();
132 }
133
134 $t = new eZTemplate( "kernel/ezgroupeventcalendar/user/" . $ini->variable( "eZGroupEventCalendarMain", "AdminTemplateDir" ),
135 "kernel/ezgroupeventcalendar/user/intl/", $Language, "fileedit.php" );
136
137 $t->setAllStrings();
138
139 $t->set_file( "file_edit_page", "fileedit.tpl" );
140
141
142 //default values
143 $t->set_var( "name_value", "" );
144 $t->set_var( "description_value", "" );
145 $t->set_var( "action_value", "Insert" );
146 $t->set_var( "option_id", "" );
147 $t->set_var( "file", "" );
148
149 if ( $Action == "Edit" )
150 {
151 $event = new eZGroupEvent( $EventID );
152 $file = new eZVirtualFile( $FileID );
153
154 $t->set_var( "event_name", $event->name() );
155
156 $t->set_var( "file_id", $file->id() );
157 $t->set_var( "name_value", $file->name() );
158 $t->set_var( "description_value", $file->description() );
159 $t->set_var( "action_value", "Update" );
160 }
161
162 $event = new eZGroupEvent( $EventID );
163
164 $t->set_var( "event_name", $event->name() );
165 $t->set_var( "event_id", $event->id() );
166
167 $t->pparse( "output", "file_edit_page" );
168
169 ?>
$Description
$Description
Definition: articlelistrss.php:38
eZFile
Tool class which has convencience functions for files and directories.
Definition: ezfile.php:19
eZGroupEvent
Definition: ezgroupevent.php:85
eZHTTPTool\header
static header( $string)
Definition: ezhttptool.php:96
eZObjectPermission\setPermission
static setPermission( $group, $objectID, $moduleTable, $permission)
Definition: ezobjectpermission.php:236
eZObjectPermission\removePermissions
static removePermissions( $objectID, $moduleTable, $permission)
Definition: ezobjectpermission.php:320
eZPBLog\writeNotice
static writeNotice( $notice)
Definition: ezpblog.php:166
eZTemplate
Definition: eztemplate.php:107
eZVirtualFile
Definition: ezvirtualfile.php:42
$Action
$Action
Definition: companysearch.php:80
$file
$file
Definition: ezfilemanager/user/filedownload.php:35
$event
if( $Action=="Edit") $event
Definition: ezgroupeventcalendar/user/fileedit.php:162
$Language
$Language
Definition: ezgroupeventcalendar/user/fileedit.php:37
$ini
$ini
Definition: ezgroupeventcalendar/user/fileedit.php:36
$t
if( $Action=="Insert") if( $Action=="Update") if( $Action=="Delete") $t
Definition: ezgroupeventcalendar/user/fileedit.php:134
exit
exit
Definition: folder.php:81
$Name
$Name
Definition: polledit.php:250
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.