Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

ezad/admin/categoryedit.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: categoryedit.php 6203 2001-07-19 11:56:33Z jakobn $
5 //
6 // Created on: <18-Sep-2000 14:46:19 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: /ad/archive/$categoryID/" );
32 exit();
33 }
34
35 if ( isset ( $DeleteCategories ) )
36 {
37 $Action = "DeleteCategories";
38 }
39
40 // include_once( "classes/INIFile.php" );
41 // include_once( "classes/eztemplate.php" );
42
43 $ini =& eZINI::instance( 'site.ini' );
44 $Language = $ini->variable( "eZAdMain", "Language" );
45
46 // include_once( "ezad/classes/ezad.php" );
47 // include_once( "ezad/classes/ezadcategory.php" );
48
49
50 // Direct actions
51 if ( isset( $Action ) && $Action == "Insert" )
52 {
53
54 $category = new eZAdCategory();
55 $category->setName( $Name );
56
57 $parentCategory = new eZAdCategory();
58 if ( $parentCategory->get( $ParentID ) == true )
59 $category->setParent( $parentCategory );
60
61 $category->setDescription( $Description );
62
63
64 $category->store();
65
66 $categoryID = $category->id();
67
68 eZHTTPTool::header( "Location: /ad/archive/$categoryID/" );
69 exit();
70 }
71
72 if ( isset( $Action ) && $Action == "Update" )
73 {
74 $category = new eZAdCategory();
75 $category->get( $CategoryID );
76 $category->setName( $Name );
77
78 $parentCategory = new eZAdCategory();
79 if ( $parentCategory->get( $ParentID ) == true )
80 $category->setParent( $parentCategory );
81
82 $category->setDescription( $Description );
83
84 $category->store();
85
86 $categoryID = $category->id();
87
88 eZHTTPTool::header( "Location: /ad/archive/$categoryID/" );
89 exit();
90 }
91
92 if ( isset( $Action ) && $Action == "Delete" )
93 {
94 $category = new eZAdCategory();
95 $category->get( $CategoryID );
96
97 $category->delete();
98
99 eZHTTPTool::header( "Location: /ad/archive/" );
100 exit();
101 }
102
103 if ( isset( $Action ) && $Action == "DeleteCategories" )
104 {
105 if ( count ( $CategoryArrayID ) != 0 )
106 {
107 foreach( $CategoryArrayID as $ID )
108 {
109 $category = new eZAdCategory( $ID );
110 $category->delete();
111 }
112 }
113
114 eZHTTPTool::header( "Location: /ad/archive/" );
115 exit();
116 }
117
118 if ( isset( $Action ) && $Action == "New" )
119 {
120 $parentID = false;
121 }
122
123 $t = new eZTemplate( "kernel/ezad/admin/" . $ini->variable( "eZAdMain", "AdminTemplateDir" ),
124 "kernel/ezad/admin/intl/", $Language, "categoryedit.php" );
125
126 $t->setAllStrings();
127
128 $t->set_file( array( "category_edit_tpl" => "categoryedit.tpl" ) );
129
130
131 $t->set_block( "category_edit_tpl", "value_tpl", "value" );
132
133 $category = new eZAdCategory();
134
135 $categoryArray = $category->getAll( );
136
137 $t->set_var( "description_value", "" );
138 $t->set_var( "name_value", "" );
139 $t->set_var( "action_value", "insert" );
140 $t->set_var( "category_id", "" );
141
142
143 // edit
144 if ( isset( $Action ) && $Action == "Edit" )
145 {
146 $category = new eZAdCategory();
147 $category->get( $CategoryID );
148
149 $t->set_var( "name_value", $category->name() );
150 $t->set_var( "description_value", $category->description() );
151 $t->set_var( "action_value", "update" );
152 $t->set_var( "category_id", $category->id() );
153
154 $parent = $category->parent();
155
156 if( is_object( $parent ) )
157 {
158 $parentID = $parent->id();
159 }
160 else
161 {
162 $parentID = 0;
163 }
164 if ( $category->excludeFromSearch() == true )
165 {
166 $t->set_var( "exclude_checked", "checked" );
167 }
168 }
169
170 $category = new eZAdCategory();
171
172 $tree = $category->getTree();
173
174 foreach( $tree as $item )
175 {
176 $t->set_var( "option_value", $item[0]->id() );
177 $t->set_var( "option_name", $item[0]->name() );
178
179 if ( $item[1] > 0 )
180 $t->set_var( "option_level", str_repeat( "&nbsp;", $item[1] ) );
181 else
182 $t->set_var( "option_level", "" );
183
184 if ( $item[0]->id() == $parentID )
185 {
186 $t->set_var( "selected", "selected" );
187 $selected = true;
188 }
189 else
190 {
191 $t->set_var( "selected", "" );
192 }
193
194
195 $t->parse( "value", "value_tpl", true );
196 }
197
198 $t->pparse( "output", "category_edit_tpl" );
199
200 ?>
$CategoryID
$CategoryID
Definition: admin/articleedit.php:53
$Description
$Description
Definition: articlelistrss.php:38
eZAdCategory
Definition: ezadcategory.php:44
eZHTTPTool\header
static header( $string)
Definition: ezhttptool.php:96
eZTemplate
Definition: eztemplate.php:107
$item
$item
Definition: classes/admin/linklist.php:228
$Action
$Action
Definition: companysearch.php:80
$tree
$tree
Definition: ezad/admin/categoryedit.php:172
$ini
if(isset( $Cancel)) if(isset( $DeleteCategories)) $ini
Definition: ezad/admin/categoryedit.php:43
$Language
$Language
Definition: ezad/admin/categoryedit.php:44
$t
if(isset( $Action) && $Action=="Insert") if(isset( $Action) && $Action=="Update") if(isset( $Action) && $Action=="Delete") if(isset( $Action) && $Action=="DeleteCategories") if(isset( $Action) && $Action=="New") $t
Definition: ezad/admin/categoryedit.php:123
$categoryArray
$categoryArray
Definition: ezad/admin/categoryedit.php:135
$category
$category
Definition: ezad/admin/categoryedit.php:133
$ParentID
$ParentID
Definition: eztrade/admin/categorylist.php:171
exit
exit
Definition: folder.php:81
$Name
$Name
Definition: polledit.php:250
$categoryID
else $categoryID
Definition: productview.php:66
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.