Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

ezarticle/admin/typeedit.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: typeedit.php 6206 2001-07-19 12:19:22Z jakobn $
5 //
6 // Created on: <20-Dec-2000 18:24:06 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/ezhttptool.php" );
28
29 if ( isset( $Cancel ) )
30 {
31 eZHTTPTool::header( "Location: /article/type/list/" );
32 exit();
33 }
34
35 // include_once( "classes/INIFile.php" );
36 // include_once( "classes/eztemplate.php" );
37
38
39 $ini =& eZINI::instance( 'site.ini' );
40 $Language = $ini->variable( "eZTradeMain", "Language" );
41 $move_item = true;
42
43 // include_once( "ezarticle/classes/ezarticletype.php" );
44 // include_once( "ezarticle/classes/ezarticleattribute.php" );
45
46 if( isset( $Ok ) || isset( $NewAttribute ) )
47 {
48 if( is_numeric( $TypeID ) )
49 {
50 $type = new eZArticleType( $TypeID );
51 }
52 else
53 {
54 $type = new eZArticleType();
55 }
56
57 $type->setName( htmlspecialchars( $Name ) );
58 $type->store();
59
60 $TypeID = $type->id();
61
62 // update attributes
63 $i =0;
64 if ( isset( $AttributeName ) && count( $AttributeName ) > 0 )
65 {
66
67 foreach ( $AttributeName as $attribute )
68 {
69 $att = new eZArticleAttribute( $AttributeID[$i] );
70 $att->setName( htmlspecialchars( $attribute ) );
71 $att->setType( $type );
72 $att->store();
73
74 $i++;
75 }
76 }
77
78 $Action = "edit";
79 $ActionValue = "update";
80 }
81
82 if ( isset( $NewAttribute ) )
83 {
84 $attribute = new eZArticleAttribute();
85 $attribute->setType( $type );
86 $attribute->setName( "New attribute" );
87 $attribute->store();
88 $ActionValue = "update";
89 $Action = "edit";
90 }
91
92
93 if( isset( $Action ) && $Action == "up" && isset( $AttributeID ) )
94 {
95 $attribute = new eZArticleAttribute( $AttributeID );
96 $attribute->moveUp();
97 // include_once( "classes/ezhttptool.php" );
98 eZHTTPTool::header( "Location: /article/type/edit/$TypeID/?$Action=update" );
99 exit();
100 }
101
102 if( isset( $Action ) && $Action == "down" && isset( $AttributeID ) )
103 {
104 $attribute = new eZArticleAttribute( $AttributeID );
105 $attribute->moveDown();
106 // include_once( "classes/ezhttptool.php" );
107 eZHTTPTool::header( "Location: /article/type/edit/$TypeID/?$Action=update" );
108 exit();
109 }
110
111 if( isset( $Ok ) )
112 {
113 eZHTTPTool::header( "Location: /article/type/list/" );
114 exit();
115 }
116
117 if ( isset ( $DeleteSelected ) )
118 {
119 if ( count ( $DeleteAttributes ) > 0 )
120 {
121 foreach ( $DeleteAttributes as $attID )
122 {
123 $attribute = new eZArticleAttribute( $attID );
124 $attribute->delete();
125 }
126 }
127 $Action = "edit";
128 $ActionValue = "update";
129 }
130
131
132 if ( $Action == "delete" )
133 {
134 $type = new eZArticleType();
135 $type->get( $TypeID );
136
137 $type->delete();
138
139 eZHTTPTool::header( "Location: /article/type/list/" );
140 exit();
141 }
142
143 $t = new eZTemplate( "kernel/ezarticle/admin/" . $ini->variable( "eZArticleMain", "AdminTemplateDir" ),
144 "kernel/ezarticle/admin/intl/", $Language, "typeedit.php" );
145
146 $t->setAllStrings();
147
148 $t->set_file( array( "type_edit_tpl" => "typeedit.tpl" ) );
149
150
151 $t->set_block( "type_edit_tpl", "value_tpl", "value" );
152
153 $t->set_block( "type_edit_tpl", "attribute_list_tpl", "attribute_list" );
154 $t->set_block( "attribute_list_tpl", "attribute_tpl", "attribute" );
155
156 $t->set_block( "attribute_tpl", "item_move_up_tpl", "item_move_up" );
157 $t->set_block( "attribute_tpl", "item_separator_tpl", "item_separator" );
158 $t->set_block( "attribute_tpl", "item_move_down_tpl", "item_move_down" );
159 $t->set_block( "attribute_tpl", "no_item_move_up_tpl", "no_item_move_up" );
160 $t->set_block( "attribute_tpl", "no_item_separator_tpl", "no_item_separator" );
161 $t->set_block( "attribute_tpl", "no_item_move_down_tpl", "no_item_move_down" );
162
163
164 $type = new eZArticleType();
165
166 $typeArray = $type->getAll( );
167
168 $t->set_var( "attribute_list", "" );
169 $t->set_var( "description_value", "" );
170 $t->set_var( "name_value", "" );
171 $t->set_var( "type_id", "" );
172
173 if( !isset( $ActionValue ) )
174 {
175 $ActionValue = "insert";
176 }
177 // edit
178 if ( $Action == "edit" )
179 {
180 $type = new eZArticleType();
181 $type->get( $TypeID );
182
183 $t->set_var( "name_value", $type->name() );
184
185 $t->set_var( "action_value", $ActionValue );
186 $t->set_var( "type_id", $TypeID );
187
188
189 $attributes = $type->attributes();
190
191 $count = count ( $attributes );
192 $i = 0;
193 foreach ( $attributes as $attribute )
194 {
195 $t->set_var( "item_move_up", "" );
196 $t->set_var( "no_item_move_up", "" );
197 $t->set_var( "item_move_down", "" );
198 $t->set_var( "no_item_move_down", "" );
199 $t->set_var( "item_separator", "" );
200 $t->set_var( "no_item_separator", "" );
201
202 $t->set_var( "attribute_id", $attribute->id( ) );
203 $t->set_var( "attribute_name", $attribute->name( ) );
204
205
206 if ( isset( $move_item ) )
207 {
208 $t->parse( "item_move_up", "item_move_up_tpl" );
209 }
210
211 if ( isset( $move_item ) )
212 {
213 $t->parse( "item_separator", "item_separator_tpl" );
214 }
215
216 if ( isset( $move_item ) )
217 {
218 $t->parse( "item_move_down", "item_move_down_tpl" );
219 }
220
221 if ( ( $i % 2 ) == 0 )
222 {
223 $t->set_var( "td_class", "bglight" );
224 }
225 else
226 {
227 $t->set_var( "td_class", "bgdark" );
228 }
229 $t->set_var( "counter", $i );
230 $t->parse( "attribute", "attribute_tpl", true );
231 $i++;
232 }
233
234 if ( count( $attributes ) > 0 )
235 {
236 $t->parse( "attribute_list", "attribute_list_tpl", true );
237 }
238 else
239 {
240 $t->set_var( "attribute_list", "" );
241 }
242
243 }
244
245
246 $t->pparse( "output", "type_edit_tpl" );
247
248 ?>
$i
$i
Definition: admin/adlist.php:91
eZArticleAttribute
Definition: ezarticleattribute.php:49
eZArticleType
Definition: ezarticletype.php:46
eZHTTPTool\header
static header( $string)
Definition: ezhttptool.php:96
eZTemplate
Definition: eztemplate.php:107
$Action
$Action
Definition: companysearch.php:80
$ActionValue
$ActionValue
Definition: ezarticle/admin/attributeedit.php:79
$t
if(isset( $Ok)||isset( $NewAttribute)) if(isset( $NewAttribute)) if(isset( $Action) && $Action=="up" &&isset( $AttributeID)) if(isset( $Action) && $Action=="down" &&isset( $AttributeID)) if(isset( $Ok)) if(isset( $DeleteSelected)) if( $Action=="delete") $t
Definition: ezarticle/admin/typeedit.php:143
$ini
if(isset( $Cancel)) $ini
Definition: ezarticle/admin/typeedit.php:39
$Language
$Language
Definition: ezarticle/admin/typeedit.php:40
$type
$type
Definition: ezarticle/admin/typeedit.php:164
$move_item
$move_item
Definition: ezarticle/admin/typeedit.php:41
$typeArray
$typeArray
Definition: ezarticle/admin/typeedit.php:166
exit
exit
Definition: folder.php:81
$count
$count
Definition: onlinetypelist.php:108
$Name
$Name
Definition: polledit.php:250
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.