Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

ezgroupeventcalendar/admin/categoryedit.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: categoryedit.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/categorylist/" );
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
39 $ini =& eZINI::instance( 'site.ini' );
40 $Language = $ini->variable( "eZGroupEventCalendarMain", "Language" );
41 $LanguageIni = new eZINI( "kernel/ezgroupeventcalendar/admin/intl/" . $Language . "/categoryedit.php.ini", false );
42
43 // include_once( "kernel/ezgroupeventcalendar/classes/ezgroupevent.php" );
44 // include_once( "kernel/ezgroupeventcalendar/classes/ezgroupeventcategory.php" );
45
46
47 if ( $Action == "Insert" )
48 {
49 $category = new eZGroupEventCategory();
50 $category->setName( $Name );
51 $category->setDescription( $Description );
52
53 if ( $ParentID != 0 && $ParentID != $category->id() )
54 {
55 $category->setParent( new eZGroupEventCategory( $ParentID ) );
56 }
57
58 $category->store();
59
60 eZHTTPTool::header( "Location: /groupeventcalendar/categorylist/" );
61 exit();
62 }
63
64 if ( $Action == "Update" )
65 {
66 $category = new eZGroupEventCategory( $CategoryID );
67 $category->setName( $Name );
68 $category->setDescription( $Description );
69
70 if ( $ParentID != 0 && $ParentID != $category->id() )
71 {
72 $category->setParent( new eZGroupEventCategory( $ParentID ) );
73 }
74
75 $category->store();
76
77 eZHTTPTool::header( "Location: /groupeventcalendar/categorylist/" );
78 exit();
79 }
80
81 if ( $Action == "Delete" )
82 {
83 if ( count ( $CategoryArrayID ) != 0 )
84 {
85 foreach( $CategoryArrayID as $CategoryID )
86 {
87 $category = new eZGroupEventCategory( $CategoryID );
88 $categoryName = $category->name();
89
90 $category->delete();
91
92 eZPBLog::writeNotice( "Appointment Category deleted: $categoryName from IP: $REMOTE_ADDR" );
93 }
94 eZHTTPTool::header( "Location: /groupeventcalendar/categorylist/" );
95 exit();
96 }
97 }
98
99
100 $t = new eZTemplate( "kernel/ezgroupeventcalendar/admin/" . $ini->variable( "eZGroupEventCalendarMain", "AdminTemplateDir" ),
101 "kernel/ezgroupeventcalendar/admin/intl/", $Language, "categoryedit.php" );
102
103 $t->setAllStrings();
104
105 $t->set_file( array( "category_edit_tpl" => "categoryedit.tpl" ) );
106
107 $t->set_block( "category_edit_tpl", "parent_item_tpl", "parent_item" );
108
109
110 $t->set_var( "parent_is_selected", "selected" );
111
112 if ( $Action == "Edit" )
113 {
114 $category = new eZGroupEventCategory( $CategoryID );
115 if ( $category->parentID() != 0 )
116 $t->set_var( "parent_is_selected", "" );
117 }
118 else
119 {
120 $category = new eZGroupEventCategory();
121 }
122
123 $t->set_var( "parent_name", "No parent" );
124 $t->set_var( "parent_id", "0" );
125 $t->parse( "parent_item", "parent_item_tpl", true );
126
127
128 $categoryList = $category->getTree();
129 foreach ( $categoryList as $categorySubList )
130 {
131 $categoryItem = $categorySubList[0];
132 $categoryLevel = $categorySubList[1];
133 $indent = "";
134
135 if ( $categoryLevel > 1 )
136 $indent = str_repeat( "&nbsp;&nbsp;", $categoryLevel - 1 );
137
138 $t->set_var( "parent_name", $indent . $categoryItem->name() );
139 $t->set_var( "parent_id", $categoryItem->id() );
140 $t->set_var( "parent_is_selected", "" );
141
142 if ( $Action == "Edit" && $category->parentID() == $categoryItem->id() )
143 $t->set_var( "parent_is_selected", "selected" );
144
145 if ( $category->id() != $categoryItem->id() )
146 $t->parse( "parent_item", "parent_item_tpl", true );
147 }
148
149
150 if ( $Action == "Edit" )
151 {
152 $t->set_var( "header", $LanguageIni->variable( "strings", "edit_appointment_category" ) );
153 $t->set_var( "name_value", $category->name() );
154 $t->set_var( "description_value", $category->description() );
155 $t->set_var( "category_id", $category->id() );
156 $t->set_var( "action_value", "Update" );
157 }
158 else
159 {
160 $t->set_var( "header", $LanguageIni->variable( "strings", "new_appointment_category" ) );
161 $t->set_var( "description_value", "" );
162 $t->set_var( "name_value", "" );
163 $t->set_var( "category_id", "" );
164 $t->set_var( "action_value", "Insert" );
165 }
166
167
168 $t->pparse( "output", "category_edit_tpl" );
169
170 ?>
$category
if( $Action=="Edit") $category
Definition: adedit.php:378
$CategoryID
$CategoryID
Definition: admin/articleedit.php:53
$Description
$Description
Definition: articlelistrss.php:38
eZGroupEventCategory
Definition: ezgroupeventcategory.php:39
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
$Action
$Action
Definition: companysearch.php:80
$ini
if(isset( $Cancel)) $ini
Definition: ezgroupeventcalendar/admin/categoryedit.php:39
$Language
$Language
Definition: ezgroupeventcalendar/admin/categoryedit.php:40
$t
if( $Action=="Insert") if( $Action=="Update") if( $Action=="Delete") $t
Definition: ezgroupeventcalendar/admin/categoryedit.php:100
$LanguageIni
$LanguageIni
Definition: ezgroupeventcalendar/admin/categoryedit.php:41
$categoryList
$categoryList
Definition: ezgroupeventcalendar/admin/categoryedit.php:128
$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+.