70 $this->CachedMultyFS =
get_package(
'cached_multy_fs' ,
'last' , __FILE__ );
71 $this->Database =
get_package(
'database' ,
'last' , __FILE__ );
72 $this->GroupAccess =
get_package(
'permit::group_access' ,
'last' , __FILE__ );
73 $this->PermitAlgorithms =
get_package(
'permit::permit_algorithms' ,
'last' , __FILE__ );
74 $this->UserAlgorithms =
get_package(
'user::user_algorithms' ,
'last' , __FILE__ );
109 $Items = $this->Database->select(
'title' ,
'`umx_group`' ,
'1' );
110 $c = count( $Items );
112 foreach( $Items as $k => $i )
114 $AllGroups .= $i->title;
120 return( $AllGroups );
122 catch( Exception $e )
156 if( $this->PermitAlgorithms->object_has_permit(
false ,
'user' ,
'permit_manager' ) )
158 list( $Object , $Type ) = $Settings->get_settings(
'object,type' ,
'public,' );
160 $GroupList = $this->GroupAccess->get_groups_for_object( $Object , $Type );
162 $GroupList = implode(
', ' , $GroupList );
165 return( $GroupList );
167 catch( Exception $e )
195 private function get_groups( &$Settings )
199 $AllGroupList = $Settings->get_setting(
'all' ,
'' );
200 if( strlen( $AllGroupList ) == 0 )
202 $AllGroupList = array();
206 $AllGroupList = explode(
', ' , $AllGroupList );
209 $ObjectGroupList = $Settings->get_setting(
'object_groups' ,
'public' );
210 if( strlen( $ObjectGroupList ) == 0 )
212 $ObjectGroupList = array();
216 $ObjectGroupList = explode(
', ' , $ObjectGroupList );
219 return( array( $ObjectGroupList , $AllGroupList ) );
221 catch( Exception $e )
253 private function compile_object_groups( $ObjectGroupList , $GroupListWidget )
257 sort( $ObjectGroupList );
259 foreach( $ObjectGroupList as $key => $Group )
261 $Template = $this->CachedMultyFS->get_template( __FILE__ ,
'object_group.tpl' );
262 $Template = str_replace(
'{group}' , $Group , $Template );
263 $GroupListWidget = str_replace(
'{object_groups}' , $Template , $GroupListWidget );
266 $GroupListWidget = str_replace(
'{object_groups}' ,
'' , $GroupListWidget );
268 return( $GroupListWidget );
270 catch( Exception $e )
306 private function compile_all_groups( $AllGroupList , $ObjectGroupList , $GroupListWidget )
310 sort( $AllGroupList );
312 foreach( $AllGroupList as $key => $Group )
314 if(
in_array( $Group , $ObjectGroupList ) ===
false )
316 $Template = $this->CachedMultyFS->get_template( __FILE__ ,
'rest_groups.tpl' );
317 $Template = str_replace(
'{group}' , $Group , $Template );
318 $GroupListWidget = str_replace(
'{rest_groups}' , $Template , $GroupListWidget );
322 return( $GroupListWidget );
324 catch( Exception $e )
356 list( $ObjectGroupList , $AllGroupList ) = $this->get_groups( $Settings );
358 $GroupListWidget = $this->CachedMultyFS->get_template( __FILE__ ,
'group_list.tpl' );
359 $Object = $Settings->get_setting(
'object' );
360 $GroupListWidget = str_replace(
'{object}' , $Object , $GroupListWidget );
362 $GroupListWidget = $this->compile_object_groups( $ObjectGroupList , $GroupListWidget );
364 return( $this->compile_all_groups( $AllGroupList , $ObjectGroupList , $GroupListWidget ) );
366 catch( Exception $e )
398 list( $Name , $Class ) = $Settings->get_settings(
'name,class',
'group,flat width_160' );
400 $Code =
"{select:name=$Name;class=$Class;".
401 "query=SELECT id , title AS value FROM `umx_group` ORDER BY title}";
405 catch( Exception $e )