ultimix
group_buttons.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 
27 
38  var $CachedMultyFS = false;
39  var $String = false;
40 
51  var $ControllerWasAdded = false;
52 
63  function __construct()
64  {
65  try
66  {
67  $this->CachedMultyFS = get_package( 'cached_multy_fs' , 'last' , __FILE__ );
68  $this->String = get_package( 'string' , 'last' , __FILE__ );
69  }
70  catch( Exception $e )
71  {
72  $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
73  }
74  }
75 
94  function get_controller()
95  {
96  try
97  {
98  $Code = '';
99 
100  if( $this->ControllerWasAdded === false )
101  {
102  $Code = '{direct_controller:set_group=1;delete_group=1;toggle_group=1;'.
103  'package_name=permit::permit_controller}';
104 
105  $this->ControllerWasAdded = true;
106  }
107 
108  return( $Code );
109  }
110  catch( Exception $e )
111  {
112  $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
113  }
114  }
115 
138  private function compile_group_button( &$Settings , $Name )
139  {
140  try
141  {
142  list( $Text , $Group , $MasterId ) = $Settings->get_settings( 'text,group,master_id' );
143  $MasterType = $Settings->get_setting( 'master_type' , 'user' );
144  $CheckBoxes = $Settings->get_setting( 'checkboxes' , 'user' );
145 
146  $Code = $this->get_controller();
147  $Code .= "{href:text=$Text;page=javascript:ultimix.permit.".$Name."GroupButton".
148  "( '$Group' , $MasterId , '$MasterType' , '$CheckBoxes' )}";
149 
150  return( $Code );
151  }
152  catch( Exception $e )
153  {
154  $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
155  }
156  }
157 
180  function compile_set_group_button( &$Settings )
181  {
182  try
183  {
184  return( $this->compile_group_button( $Settings , 'Set' ) );
185  }
186  catch( Exception $e )
187  {
188  $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
189  }
190  }
191 
214  function compile_delete_group_button( &$Settings )
215  {
216  try
217  {
218  return( $this->compile_group_button( $Settings , 'Delete' ) );
219  }
220  catch( Exception $e )
221  {
222  $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
223  }
224  }
225 
248  function compile_toggle_group_button( &$Settings )
249  {
250  try
251  {
252  return( $this->compile_group_button( $Settings , 'Toggle' ) );
253  }
254  catch( Exception $e )
255  {
256  $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
257  }
258  }
259  }
260 
261 ?>