Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

ezgroupeventcalendar/admin/typeedit.php
Go to the documentation of this file.
1 <?
3 //
4 // $Id: typeedit.php,v 1.5 2001/02/20 12:33:38 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-2000 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
28 if ( isset( $Cancel ) )
29 {
30 Header( "Location: /groupeventcalendar/typelist/" );
31 exit();
32 }
33
34 // include_once( "classes/INIFile.php" );
35 // include_once( "classes/eztemplate.php" );
36 // include_once( "classes/ezhttptool.php" );
37 // include_once( "classes/ezlog.php" );
38 $ini =& eZINI::instance( 'site.ini' );
39 $Language = $ini->variable( "eZGroupEventCalendarMain", "Language" );
40 $LanguageIni = new eZINI( "kernel/ezgroupeventcalendar/admin/intl/" . $Language . "/typeedit.php.ini", false );
41
42 // include_once( "ezgroupeventcalendar/classes/ezgroupevent.php" );
43 // include_once( "ezgroupeventcalendar/classes/ezgroupeventtype.php" );
44
45 if ( $Action == "Insert" )
46 {
47 $type = new eZGroupEventType();
48 $type->setName( $Name );
49 $type->setDescription( $Description );
50
51 if ( $ParentID != 0 && $ParentID != $type->id() )
52 {
53 $type->setParent( new eZGroupEventType( $ParentID ) );
54 }
55
56 $type->store();
57
58 eZHTTPTool::header( "Location: /groupeventcalendar/typelist/" );
59 exit();
60 }
61
62 if ( $Action == "Update" )
63 {
64 $type = new eZGroupEventType( $TypeID );
65 $type->setName( $Name );
66 $type->setDescription( $Description );
67
68 if ( $ParentID != 0 && $ParentID != $type->id() )
69 {
70 $type->setParent( new eZGroupEventType( $ParentID ) );
71 }
72
73 $type->store();
74
75 eZHTTPTool::header( "Location: /groupeventcalendar/typelist/" );
76 exit();
77 }
78
79 if ( $Action == "Delete" )
80 {
81 if ( count ( $TypeArrayID ) != 0 )
82 {
83 foreach( $TypeArrayID as $TypeID )
84 {
85 $type = new eZGroupEventType( $TypeID );
86 $typeName = $type->name();
87
88 $type->delete();
89
90 eZPBLog::writeNotice( "Appointment Type deleted: $typeName from IP: $REMOTE_ADDR" );
91 }
92 eZHTTPTool::header( "Location: /groupeventcalendar/typelist/" );
93 exit();
94 }
95 }
96
97
98 $t = new eZTemplate( "kernel/ezgroupeventcalendar/admin/" . $ini->variable( "eZGroupEventCalendarMain", "AdminTemplateDir" ),
99 "kernel/ezgroupeventcalendar/admin/intl/", $Language, "typeedit.php" );
100
101 $t->setAllStrings();
102
103 $t->set_file( array( "type_edit_tpl" => "typeedit.tpl" ) );
104
105 $t->set_block( "type_edit_tpl", "parent_item_tpl", "parent_item" );
106
107
108 $t->set_var( "parent_is_selected", "selected" );
109
110 if ( $Action == "Edit" )
111 {
112 $type = new eZGroupEventType( $TypeID );
113 if ( $type->parentID() != 0 )
114 $t->set_var( "parent_is_selected", "" );
115 }
116 else
117 {
118 $type = new eZGroupEventType();
119 }
120
121 $t->set_var( "parent_name", "No parent" );
122 $t->set_var( "parent_id", "0" );
123 $t->parse( "parent_item", "parent_item_tpl", true );
124
125
126 $typeList = $type->getTree();
127 foreach ( $typeList as $typeSubList )
128 {
129 $typeItem = $typeSubList[0];
130 $typeLevel = $typeSubList[1];
131 $indent = "";
132
133 if ( $typeLevel > 1 )
134 $indent = str_repeat( "&nbsp;&nbsp;", $typeLevel - 1 );
135
136 $t->set_var( "parent_name", $indent . $typeItem->name() );
137 $t->set_var( "parent_id", $typeItem->id() );
138 $t->set_var( "parent_is_selected", "" );
139
140 if ( $Action == "Edit" && $type->parentID() == $typeItem->id() )
141 $t->set_var( "parent_is_selected", "selected" );
142
143 if ( $type->id() != $typeItem->id() )
144 $t->parse( "parent_item", "parent_item_tpl", true );
145 }
146
147
148 if ( $Action == "Edit" )
149 {
150 $t->set_var( "header", $LanguageIni->variable( "strings", "edit_appointment_type" ) );
151 $t->set_var( "name_value", $type->name() );
152 $t->set_var( "description_value", $type->description() );
153 $t->set_var( "type_id", $type->id() );
154 $t->set_var( "action_value", "Update" );
155 }
156 else
157 {
158 $t->set_var( "header", $LanguageIni->variable( "strings", "new_appointment_type" ) );
159 $t->set_var( "description_value", "" );
160 $t->set_var( "name_value", "" );
161 $t->set_var( "type_id", "" );
162 $t->set_var( "action_value", "Insert" );
163 }
164
165
166 $t->pparse( "output", "type_edit_tpl" );
167
168 ?>
$Description
$Description
Definition: articlelistrss.php:38
eZGroupEventType
Definition: ezgroupeventtype.php:37
eZHTTPTool\header
static header( $string)
Definition: ezhttptool.php:96
eZINI
Reads and writes .ini style configuration files.
eZPBLog\writeNotice
static writeNotice( $notice)
Definition: ezpblog.php:166
eZTemplate
Definition: eztemplate.php:107
$type
$type
Definition: classes/admin/linkselect.php:220
$Action
$Action
Definition: companysearch.php:80
$typeList
$typeList
Definition: ezgroupeventcalendar/admin/typeedit.php:126
$ini
if(isset( $Cancel)) $ini
Definition: ezgroupeventcalendar/admin/typeedit.php:38
$Language
$Language
Definition: ezgroupeventcalendar/admin/typeedit.php:39
$t
if( $Action=="Insert") if( $Action=="Update") if( $Action=="Delete") $t
Definition: ezgroupeventcalendar/admin/typeedit.php:98
$LanguageIni
$LanguageIni
Definition: ezgroupeventcalendar/admin/typeedit.php:40
$ParentID
$ParentID
Definition: eztrade/admin/categorylist.php:171
exit
exit
Definition: folder.php:81
$Name
$Name
Definition: polledit.php:250
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.