84 $this->CachedMultyFS =
get_package(
'cached_multy_fs' ,
'last' , __FILE__ );
85 $this->Database =
get_package(
'database' ,
'last' , __FILE__ );
86 $this->PermitAccess =
get_package(
'permit::permit_access' ,
'last' , __FILE__ );
87 $this->PermitAlgorithms =
get_package(
'permit::permit_algorithms' ,
'last' , __FILE__ );
89 $this->String =
get_package(
'string' ,
'last' , __FILE__ );
90 $this->UserAlgorithms =
get_package(
'user::user_algorithms' ,
'last' , __FILE__ );
122 if( $this->ControllerWasAdded ===
false )
124 $Code =
'{direct_controller:set_permit=1;delete_permit=1;toggle_permit=1'.
125 'package_name=permit::permit_controller}';
127 $this->ControllerWasAdded =
true;
132 catch( Exception $e )
152 private function load_permits()
156 $UserId = $this->UserAlgorithms->get_id();
158 if( isset( $this->Permits[ $UserId ] ) ===
false )
160 $this->Permits[ $UserId ] = $this->PermitAlgorithms->get_permits_for_object( $UserId ,
'user' );
163 catch( Exception $e )
195 private function compile_permit_button( &
$Settings , $Type )
199 $this->load_permits();
201 list( $Text , $Group , $MasterId ) =
$Settings->get_settings(
'text,group,master_id' );
202 $MasterType =
$Settings->get_setting(
'master_type' ,
'user' );
203 $CheckBoxes =
$Settings->get_setting(
'checkboxes' ,
'user' );
206 $Code .=
"{href:text=$Text;page=javascript:ultimix.permit.".$Type.
"PermitButton".
207 "( '$Permit' , $MasterId , '$MasterType' , '$CheckBoxes' )}";
211 catch( Exception $e )
243 return( $this->compile_permit_button(
$Settings ,
'Set' ) );
245 catch( Exception $e )
277 return( $this->compile_permit_button(
$Settings ,
'Delete' ) );
279 catch( Exception $e )
311 return( $this->compile_permit_button(
$Settings ,
'Toggle' ) );
313 catch( Exception $e )