Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

moduleedit.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: moduleedit.php 9165 2002-02-07 08:12:04Z jhe $
5 //
6 // Created on: <23-Oct-2000 17:53:46 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 /*
28 Edit a module type.
29 */
30
31 // include_once( "classes/INIFile.php" );
32 // include_once( "ezuser/classes/ezpermission.php" );
33 // include_once( "ezuser/classes/ezobjectpermission.php" );
34
35 $ini = eZINI::instance( 'site.ini' );
36 $Language = $ini->variable( "eZBugMain", "Language" );
37
38 // include_once( "classes/eztemplate.php" );
39 // include_once( "ezuser/classes/ezusergroup.php" );
40 // include_once( "ezbug/classes/ezbugmodule.php" );
41
42 if( !isset( $ModuleID ) )
43 $ModuleID = 0;
44
45 if ( isset( $Action ) && $Action == "insert" )
46 {
47 $module = new eZBugModule();
48 $module->setName( $Name );
49 $parent = new eZBugModule( $ParentID );
50 $module->setParent( $parent );
51 $module->setOwnerGroup( $WriteGroupArrayID );
52 $module->store();
53 $ModuleID = $module->id();
54 eZObjectPermission::removePermissions( $ModuleID, "bug_module", "w" );
55 foreach ( $WriteGroupArrayID as $moduleOwner )
56 {
57 eZObjectPermission::setPermission( $moduleOwner, $ModuleID, "bug_module", 'w' );
58 }
59
60 // include_once( "classes/ezhttptool.php" );
61 eZHTTPTool::header( "Location: /bug/module/list/" );
62 exit();
63 }
64
65 // Updates a module.
66 if ( isset( $Action ) && $Action == "update" )
67 {
68 $module = new eZBugModule( $ModuleID );
69 $parent = new eZBugModule( $ParentID );
70 if ( $module->isChild( $ParentID, true ) != true )
71 {
72 $module->setName( $Name );
73 $module->setParent( $parent );
74
75 eZObjectPermission::removePermissions( $ModuleID, "bug_module", "w" );
76 foreach ( $WriteGroupArrayID as $moduleOwner )
77 {
78 eZObjectPermission::setPermission( $moduleOwner, $ModuleID, "bug_module", 'w' );
79 }
80
81 if ( isset( $Recursive ) )
82 {
83 $recursiveList = $module->getByParent( $module, "name", array() );
84
85 foreach ( $recursiveList as $itemID )
86 {
87 eZObjectPermission::removePermissions( $itemID, "bug_module", "w" );
88 if ( count ( $WriteGroupArrayID ) > 0 )
89 {
90 foreach ( $WriteGroupArrayID as $Write )
91 {
92 if ( $Write == -1 )
93 $group = -1;
94 else
95 $group = new eZUserGroup( $Write );
96
97 eZObjectPermission::setPermission( $group, $itemID, "bug_module", "w" );
98 }
99 }
100 }
101 }
102
103 $module->store();
104 }
105
106 // include_once( "classes/ezhttptool.php" );
107 eZHTTPTool::header( "Location: /bug/module/list/" );
108 exit();
109 }
110
111 // Delete a module.
112 if ( isset( $Action ) && $Action == "delete" )
113 {
114 $module = new eZBugModule( $ModuleID );
115 $module->delete();
116
117 // include_once( "classes/ezhttptool.php" );
118 eZHTTPTool::header( "Location: /bug/module/list/" );
119 exit();
120 }
121
122 $t = new eZTemplate( "kernel/ezbug/admin/" . $ini->variable( "eZBugMain", "AdminTemplateDir" ),
123 "kernel/ezbug/admin/intl", $Language, "moduleedit.php" );
124 $t->setAllStrings();
125
126 $t->set_file( array(
127 "moduleedit" => "moduleedit.tpl"
128 ) );
129
130 $t->set_block( "moduleedit", "module_item_tpl", "module_item" );
131 $t->set_block( "moduleedit", "module_owner_tpl", "module_owner" );
132
133 $t->set_block( "moduleedit", "write_group_item_tpl", "write_group_item" );
134
135 if ( isset( $Action ) && $Action == "new" )
136 {
137 $parent = new eZBugModule( $ParentID );
138 $t->set_var( "module_name", "" );
139 $t->set_var("module_id", 0);
140 $t->set_var( "action_value", "insert" );
141 }
142
143 // Edit a module.
144 if ( isset( $Action ) && $Action == "edit" )
145 {
146 $module = new eZBugModule( $ModuleID );
147
148 $parent = $module->parent();
149 $t->set_var( "module_name", $module->name() );
150 $t->set_var( "module_id", $module->id() );
151
152 $writeGroupArrayID =& eZObjectPermission::getGroups( $module->id(), "bug_module", "w", false );
153
154 $t->set_var( "action_value", "update" );
155 }
156
157 // Category selector
158
159 $module = new eZBugModule();
160
161 $moduleList = $module->getAll();
162
163 foreach ( $moduleList as $moduleItem )
164 {
165 if ( $ModuleID != $moduleItem->id() )
166 {
167 $t->set_var( "module_parent_name", $moduleItem->name() );
168 $t->set_var( "module_parent_id", $moduleItem->id() );
169
170
171 if ( is_a( $parent, "eZBugModule" ) )
172 {
173 if ( $parent->id() == $moduleItem->id() )
174 {
175 $t->set_var( "is_selected", "selected" );
176 }
177 else
178 {
179 $t->set_var( "is_selected", "" );
180 }
181 }
182 else
183 {
184 $t->set_var( "is_selected", "" );
185 }
186
187 $t->parse( "module_item", "module_item_tpl", true );
188 }
189 }
190
191 // group selector
192 $group = new eZUserGroup();
193 $groupList =& $group->getAll();
194
195 foreach ( $groupList as $groupItem )
196 {
197 $t->set_var( "group_id", $groupItem->id() );
198 $t->set_var( "group_name", $groupItem->name() );
199
200 $t->set_var( "is_write_selected1", "" );
201
202 if ( isset( $writeGroupArrayID ) && $writeGroupArrayID )
203 {
204 foreach ( $writeGroupArrayID as $writeGroup )
205 {
206 if ( $writeGroup == $groupItem->id() )
207 {
208 $t->set_var( "is_write_selected1", "selected" );
209 }
210 elseif ( $writeGroup == -1 )
211 {
212 $t->set_var( "write_everybody", "selected" );
213 }
214 else
215 {
216 $t->set_var( "is_write_selected", "" );
217 }
218 }
219 }
220
221 $t->parse( "write_group_item", "write_group_item_tpl", true );
222 }
223
224 $t->pparse( "output", "moduleedit" );
225
226 ?>
eZBugModule
Definition: ezbugmodule.php:56
eZHTTPTool\header
static header( $string)
Definition: ezhttptool.php:96
eZObjectPermission\getGroups
static getGroups( $objectID, $moduleTable, $permission, $GroupReturn=true)
Definition: ezobjectpermission.php:365
eZObjectPermission\setPermission
static setPermission( $group, $objectID, $moduleTable, $permission)
Definition: ezobjectpermission.php:236
eZObjectPermission\removePermissions
static removePermissions( $objectID, $moduleTable, $permission)
Definition: ezobjectpermission.php:320
eZTemplate
Definition: eztemplate.php:107
eZUserGroup
Definition: ezusergroup.php:66
$Action
$Action
Definition: companysearch.php:80
$ParentID
$ParentID
Definition: eztrade/admin/categorylist.php:171
exit
exit
Definition: folder.php:81
$groupList
$groupList
Definition: moduleedit.php:193
$Language
$Language
Definition: moduleedit.php:36
$group
foreach( $moduleList as $moduleItem) $group
Definition: moduleedit.php:192
$ini
$ini
Definition: moduleedit.php:35
$moduleList
$moduleList
Definition: moduleedit.php:161
$module
if(isset( $Action) && $Action=="new") if(isset( $Action) && $Action=="edit") $module
Definition: moduleedit.php:159
$t
if(isset( $Action) && $Action=="insert") if(isset( $Action) && $Action=="update") if(isset( $Action) && $Action=="delete") $t
Definition: moduleedit.php:122
$Name
$Name
Definition: polledit.php:250
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.