ultimix

- Main Page
- Data Structures
- Files
- Examples

- File List
- Globals

group_manager.php
Go to the documentation of this file.
1 <?php
2
3 /*
4 * This source code is a part of the Ultimix Project.
5 * It is distributed under BSD license. All other third side source code (like tinyMCE) is distributed under
6 * it's own license wich could be found from the corresponding files or sources.
7 * This source code is provided "as is" without any warranties or garanties.
8 *
9 * Have a nice day!
10 *
11 * @url http://ultimix.sorceforge.net
12 *
13 * @author Alexey "gdever" Dodonov
14 */
15
26 class group_manager_1_0_0{
27
38 var $CachedMultyFS = false;
39 var $GroupAccess = false;
40 var $Link = false;
41 var $PermitAccess = false;
42 var $PermitAlgorithms = false;
43 var $Security = false;
44
55 function __construct()
56 {
57 try
58 {
59 $this->CachedMultyFS = get_package( 'cached_multy_fs' , 'last' , __FILE__ );
60 $this->GroupAccess = get_package( 'permit::group_access' , 'last' , __FILE__ );
61 $this->Link = get_package( 'link' , 'last' , __FILE__ );
62 $this->PermitAccess = get_package( 'permit::permit_access' , 'last' , __FILE__ );
63 $this->PermitAlgorithms = get_package( 'permit::permit_algorithms' , 'last' , __FILE__ );
64 $this->Security = get_package( 'security' , 'last' , __FILE__ );
65 }
66 catch( Exception $e )
67 {
68 $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
69 }
70 }
71
90 function change_permits_controller( $Options )
91 {
92 try
93 {
94 $Group = $this->GroupAccess->get_group_by_id( $this->Security->get_p( 'record_id' , 'integer' ) );
95 $Permits = $this->Security->get_p( 'permits' , 'command' , array() );
96
97 $HasPermits = $this->PermitAlgorithms->get_permits_for_object( $Group->id , 'group' , false );
98
99 foreach( $HasPermits as $p )
100 {
101 if( in_array( $p , $Permits ) === false )
102 {
103 $p = $this->PermitAccess->get_permit_by_name( $p );
104 $this->Link->delete_link( $Group->id , $p->id , 'group' , 'permit' );
105 }
106 }
107
108 foreach( $Permits as $p )
109 {
110 $this->PermitAccess->add_permit_for_object( $p , $Group->id , 'group' );
111 }
112 }
113 catch( Exception $e )
114 {
115 $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
116 }
117 }
118
137 function change_permits_view( $Options )
138 {
139 try
140 {
141 $Group = $this->GroupAccess->get_group_by_id( $this->Security->get_p( 'group_record_id' , 'integer' ) );
142
143 $this->Output = $this->CachedMultyFS->get_template( __FILE__ , 'group_permits_view.tpl' );
144
145 $this->Output = str_replace( '{path}' , dirname( __FILE__ ) , $this->Output );
146 $this->Output = str_replace( '{title}' , get_field( $Group , 'title' ) , $this->Output );
147 }
148 catch( Exception $e )
149 {
150 $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
151 }
152 }
153
172 function controller( $Options )
173 {
174 try
175 {
176 $ContextSet = get_package_object( 'gui::context_set' , 'last' , __FILE__ );
177
178 $ContextSet->add_context( dirname( __FILE__ ).'/conf/cfcx_change_permits_controller' );
179 $ContextSet->execute( $Options , $this , __FILE__ );
180 }
181 catch( Exception $e )
182 {
183 $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
184 }
185 }
186
209 function view( $Options )
210 {
211 try
212 {
213 $ContextSet = get_package_object( 'gui::context_set' , 'last' , __FILE__ );
214
215 $ContextSet->add_context( dirname( __FILE__ ).'/conf/cfcx_change_permits_view' );
216
217 $ContextSet->execute( $Options , $this , __FILE__ );
218
219 return( $this->Output );
220 }
221 catch( Exception $e )
222 {
223 $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
224 }
225 }
226 }
227
228 ?>