2017-11-24 00:09:36 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								< ? php  
						 
					
						
							
								
									
										
										
										
											2020-11-05 16:54:04 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								if  ( isset ( $_GET [ 'delete' ])  &&  isset ( $_GET [ 'type' ]))  
						 
					
						
							
								
									
										
										
										
											2017-11-24 00:09:36 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2020-11-05 16:54:04 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  (  $_GET [ 'type' ]  ==  'service' )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Service :: delete (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									elseif  (  $_GET [ 'type' ]  ==  'groups' )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										ServiceGroup :: delete (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-24 00:09:36 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-01-07 20:39:10 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Template :: render_header ( _ ( " Settings " ),  true );  
						 
					
						
							
								
									
										
										
										
											2017-11-24 00:09:36 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								?> 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								< div  class = " text-center " >  
						 
					
						
							
								
									
										
										
										
											2018-03-10 01:15:47 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									< h2 > Settings </ h2 > 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-24 00:09:36 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								</ div >  
						 
					
						
							
								
									
										
										
										
											2020-11-05 16:54:04 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								< ? php  
						 
					
						
							
								
									
										
										
										
											2017-11-24 00:09:36 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								if  ( isset ( $message )){  
						 
					
						
							
								
									
										
										
										
											2018-03-10 01:15:47 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									?> 
 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-24 00:09:36 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								< p  class = " alert alert-danger " >< ? php  echo  $message ;  ?> </p>
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								< ? php  } ?> 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								< section >  
						 
					
						
							
								
									
										
										
										
											2018-03-10 01:15:47 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									< h3  class = " pull-left " >< ? php  echo  _ ( " Services " ); ?> </h3>
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									< ? php  if  ( $user -> get_rank ()  <=  1 ){ ?> 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									< form  action = " ?do=settings&new=service "  method = " post " > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										< div  class = " input-group pull-right new-service " > 
							 
						 
					
						
							
								
									
										
										
										
											2020-11-05 16:54:04 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											< a  href = " <?php echo WEB_URL;?>/admin/?do=new-service "  class = " btn btn-success pull-right " >< ? php  echo  _ ( " Add new service " ); ?> </a>
 
							 
						 
					
						
							
								
									
										
										
										
											2018-03-10 01:15:47 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										</ div > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									</ form > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									< ? php  } ?> 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									< div  class = " table-responsive " > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										< table  class = " table " > 
							 
						 
					
						
							
								
									
										
										
										
											2020-11-05 16:54:04 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-03-10 01:15:47 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											< thead >< tr > 
							 
						 
					
						
							
								
									
										
										
										
											2020-11-05 16:54:04 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												<!--< th  scope = " col " >< ? php  echo  _ ( " ID " ); ?> </th>-->
 
							 
						 
					
						
							
								
									
										
										
										
											2018-03-10 01:15:47 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												< th  scope = " col " >< ? php  echo  _ ( " Name " ); ?> </th>
 
							 
						 
					
						
							
								
									
										
										
										
											2020-11-05 16:54:04 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												< th  scope = " col " >< ? php  echo  _ ( " Description " ); ?> </th>
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												< th  scope = " col " >< ? php  echo  _ ( " Group " ); ?> </th>
 
							 
						 
					
						
							
								
									
										
										
										
											2018-03-10 01:15:47 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												< ? php  if  ( $user -> get_rank () <= 1 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												{ ?> 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													< th  scope = " col " >< ? php  echo  _ ( " Delete " ); ?> </th>
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													< ? php  }  ?> 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												</ tr > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											</ thead > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											< tbody > 
							 
						 
					
						
							
								
									
										
										
										
											2020-11-05 16:54:04 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												< ? php 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$query  =  $mysqli -> query ( " SELECT services.*, services_groups.name AS group_name FROM `services` LEFT JOIN services_groups ON services.group_id = services_groups.id ORDER BY services.name ASC " ); 
							 
						 
					
						
							
								
									
										
										
										
											2018-03-10 01:15:47 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												while ( $result  =  $query -> fetch_assoc ()) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													echo  " <tr> " ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-11-05 16:54:04 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													//echo "<td>".$result['id']."</td>";
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													echo  '<td><a href="' . WEB_URL . '/admin?do=edit-service&id=' . $result [ 'id' ] . '">' . $result [ 'name' ] . '</a></th>' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													echo  " <td> " . $result [ 'description' ] . " </td> " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													echo  " <td> " . $result [ 'group_name' ] . " </td> " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-09-27 14:01:54 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													if  ( $user -> get_rank () <= 1 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													{ 
							 
						 
					
						
							
								
									
										
										
										
											2020-11-05 16:54:04 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														echo  '<td><a href="' . WEB_URL . '/admin/?do=settings&type=service&delete=' . $result [ 'id' ] . '" class="pull-right delete-service"><i class="fa fa-trash"></i></a></td>' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													echo  " </tr> " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} ?> 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											</ tbody > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										</ table > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									</ div > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								</ section >  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								< section >  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									< h3  class = " pull-left " >< ? php  echo  _ ( " Services Groups " ); ?> </h3>
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									< ? php  if  ( $user -> get_rank ()  <=  1 ){ ?> 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									< form  action = " ?do=settings&new=service-group "  method = " post " > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										< div  class = " input-group pull-right new-service " > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											< a  href = " <?php echo WEB_URL;?>/admin/?do=new-service-group "  class = " btn btn-success pull-right " >< ? php  echo  _ ( " Add new service group " ); ?> </a>
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										</ div > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									</ form > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									< ? php  } ?> 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									< div  class = " table-responsive " > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										< table  class = " table " > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											< thead >< tr > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												<!--< th  scope = " col " >< ? php  echo  _ ( " ID " ); ?> </th>-->
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												< th  scope = " col " >< ? php  echo  _ ( " Group Name " ); ?> </th>
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												< th  scope = " col " >< ? php  echo  _ ( " In use by " ); ?> </th>
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												< th  scope = " col " >< ? php  echo  _ ( " Description " ); ?> </th>
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												< th  scope = " col " >< ? php  echo  _ ( " Visibility " ); ?> </th>
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												< ? php  if  ( $user -> get_rank () <= 1 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												{ ?> 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													< th  scope = " col " >< ? php  echo  _ ( " Delete " ); ?> </th>
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													< ? php  }  ?> 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												</ tr > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											</ thead > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											< tbody > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												< ? php 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												$query  =  $mysqli -> query ( " SELECT sg.* , (SELECT COUNT(*) FROM services WHERE services.group_id = sg.id) AS counter FROM services_groups AS sg ORDER BY sg.id ASC " ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												while ( $result  =  $query -> fetch_assoc ()) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													echo  " <tr> " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													//echo "<td>".$result['id']."</td>";
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													echo  '<td><a href="' . WEB_URL . '/admin?do=edit-service-group&id=' . $result [ 'id' ] . '">' . $result [ 'name' ] . '</a></th>' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													echo  '<td> <span class="badge badge-danger ml-2">' . $result [ 'counter' ] . '</span>' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													echo  " <td> " . $result [ 'description' ] . " </td> " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													echo  " <td> " . $visibility [ $result [ 'visibility' ]] . " </td> " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( $user -> get_rank () <= 1 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														echo  '<td><a href="' . WEB_URL . '/admin/?do=settings&type=groups&delete=' . $result [ 'id' ] . '" class="pull-right delete-service"><i class="fa fa-trash"></i></a></td>' ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-03-10 01:15:47 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													echo  " </tr> " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} ?> 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											</ tbody > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										</ table > 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-24 00:09:36 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									</ div > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								</ section >  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								< section >  
						 
					
						
							
								
									
										
										
										
											2018-03-10 01:15:47 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									< h3  class = " pull-left " >< ? php  echo  _ ( " Users " ); ?> </h3>
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									< ? php  if  ( $user -> get_rank ()  ==  0 ){ ?>  <a href="<?php echo WEB_URL;?>/admin/?do=new-user" class="btn btn-success pull-right"><?php echo _("Add new user");?></a><?php }?>
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									< div  class = " table-responsive " > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										< table  class = " table " > 
							 
						 
					
						
							
								
									
										
										
										
											2020-11-05 16:54:04 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-03-10 01:15:47 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											< thead >< tr >< th  scope = " col " >< ? php  echo  _ ( " ID " ); ?> </th><th scope="col"><?php echo _("Username");?></th><th scope="col"><?php echo _("Name");?></th><th scope="col"><?php echo _("Surname");?></th><th scope="col"><?php echo _("Email");?></th><th scope="col"><?php echo _("Role");?></th><th scope="col">Active</th></tr></thead>
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											< tbody > 
							 
						 
					
						
							
								
									
										
										
										
											2020-11-05 16:54:04 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												< ? php 
							 
						 
					
						
							
								
									
										
										
										
											2018-03-10 01:15:47 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												$query  =  $mysqli -> query ( " SELECT *  FROM users " ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												while ( $result  =  $query -> fetch_assoc ()) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													echo  " <tr> " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													echo  " <td> " . $result [ 'id' ] . " </td> " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													echo  " <td><a href=' " . WEB_URL . " /admin/?do=user&id= " . $result [ 'id' ] . " '> " . $result [ 'username' ] . " </a></td> " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													echo  " <td> " . $result [ 'name' ] . " </td> " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													echo  " <td> " . $result [ 'surname' ] . " </td> " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													echo  " <td><a href= \" mailto: " . $result [ 'email' ] . " \" > " . $result [ 'email' ] . " </a></td> " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													echo  " <td> " . $permissions [ $result [ 'permission' ]] . " </td><td> " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													echo  " <i class='fa fa- " . ( $result [ 'active' ] ? " check success " : " times danger " ) . " '></i> " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													echo  " </td> " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													echo  " </tr> " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} ?> 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											</ tbody > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										</ table > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									</ div > 
							 
						 
					
						
							
								
									
										
										
										
											2020-11-05 16:54:04 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								</ section >