2017-11-24 00:09:36 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								< ? php  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/**  
						 
					
						
							
								
									
										
										
										
											2018-01-07 20:39:10 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								*  Class  for  managing  services  
						 
					
						
							
								
									
										
										
										
											2017-11-24 00:09:36 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								*/  
						 
					
						
							
								
									
										
										
										
											2018-04-13 21:31:03 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								class  Service  implements  JsonSerializable  
						 
					
						
							
								
									
										
										
										
											2017-11-24 00:09:36 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  private  $id ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  private  $name ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  private  $status ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-01-07 20:39:10 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  /** 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   *  Constructs  service  from  its  data . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   *  @ param  int  $id  service  ID 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   *  @ param  String  $name  service  name 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   *  @ param  int  $status  current  service  status 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   */ 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-24 00:09:36 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								  function  __construct ( $id ,  $name ,  $status = 3 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-01-07 20:39:10 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    //TODO: Maybe get data from ID?
 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-24 00:09:36 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    $this -> id  =  $id ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    $this -> name  =  $name ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    $this -> status  =  $status ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-01-07 20:39:10 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  /** 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   *  Returns  status  of  this  service 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   *  @ return  int  status 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   */ 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-24 00:09:36 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								  public  function  get_status () 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    return  $this -> status ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-01-07 20:39:10 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  /** 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   *  Returns  id  of  this  service 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   *  @ return  int  id 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   */ 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-24 00:09:36 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								  public  function  get_id () 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    return  $this -> id ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-01-07 20:39:10 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  /** 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   *  Returns  name  of  this  service 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   *  @ return  String  name 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   */ 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-24 00:09:36 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								  public  function  get_name () 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    return  $this -> name ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-01-07 20:39:10 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  /** 
							 
						 
					
						
							
								
									
										
										
										
											2020-06-16 20:11:25 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								   *  Processes  submitted  form  and  adds  service  unless  problem  is  encountered , 
							 
						 
					
						
							
								
									
										
										
										
											2018-01-18 22:59:34 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								   *  calling  this  is  possible  only  for  admin  or  higher  rank .  Also  checks  requirements 
							 
						 
					
						
							
								
									
										
										
										
											2018-01-07 20:39:10 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								   *  for  char  limits . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   *  @ return  void 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   */ 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-24 00:09:36 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								  public  static  function  add () 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    global  $user ,  $message ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( strlen ( $_POST [ 'service' ]) > 50 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    { 
							 
						 
					
						
							
								
									
										
										
										
											2017-12-31 00:41:58 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								      $message  =  _ ( " Service name is too long! Character limit is 50 " ); 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-24 00:09:36 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } else  if  ( strlen ( trim ( $_POST [ 'service' ])) == 0 ){ 
							 
						 
					
						
							
								
									
										
										
										
											2017-12-31 00:41:58 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								      $message  =  _ ( " Please enter name! " ); 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-24 00:09:36 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( $user -> get_rank () <= 1 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      global  $mysqli ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      $name  =  $_POST [ 'service' ]; 
							 
						 
					
						
							
								
									
										
										
										
											2018-11-25 18:26:30 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								      $stmt  =  $mysqli -> prepare ( " INSERT INTO services ( name ) VALUES ( ? ) " ); 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-24 00:09:36 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      $stmt -> bind_param ( " s " ,  $name ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      $stmt -> execute (); 
							 
						 
					
						
							
								
									
										
										
										
											2018-04-20 16:40:12 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								      $stmt -> get_result (); 
							 
						 
					
						
							
								
									
										
										
										
											2018-01-12 21:35:31 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								      header ( " Location:  " . WEB_URL . " /admin/?do=settings " ); 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-24 00:09:36 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    } else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    { 
							 
						 
					
						
							
								
									
										
										
										
											2017-12-31 00:41:58 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								      $message  =  _ ( " You don't have the permission to do that! " ); 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-24 00:09:36 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-01-07 20:39:10 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  /** 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   *  Deletes  this  service  -  first  checks  if  user  has  permission  to  do  that . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   *  @ return  void 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   */ 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-24 00:09:36 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								  public  static  function  delete () 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-04-20 16:40:12 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    global  $user ,  $message ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-24 00:09:36 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    if  ( $user -> get_rank () <= 1 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      global  $mysqli ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      $id  =  $_GET [ 'delete' ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-07-10 14:33:37 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								      $stmt  =  $mysqli -> prepare ( " SELECT status_id as status, (SELECT count(*) FROM services_status as s WHERE s.status_id=status) as count FROM services_status WHERE service_id = ? GROUP BY status " ); 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-24 00:09:36 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      $stmt -> bind_param ( " i " ,  $id ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      $stmt -> execute (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      $query  =  $stmt -> get_result (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      while  ( $res  =  $query -> fetch_assoc ())  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if  ( $res [ 'count' ] == 1 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								          Incident :: delete ( $res [ 'status' ]); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      $stmt  =  $mysqli -> prepare ( " DELETE FROM services WHERE id = ? " ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      $stmt -> bind_param ( " i " ,  $id ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      $stmt -> execute (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      $query  =  $stmt -> get_result (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      $stmt  =  $mysqli -> prepare ( " DELETE FROM services_status WHERE service_id = ? " ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      $stmt -> bind_param ( " i " ,  $id ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      $stmt -> execute (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      $query  =  $stmt -> get_result (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-01-12 21:35:31 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								      header ( " Location:  " . WEB_URL . " /admin/?do=settings " ); 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-24 00:09:36 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    { 
							 
						 
					
						
							
								
									
										
										
										
											2017-12-31 00:41:58 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								      $message  =  _ ( " You don't have the permission to do that! " ); 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-24 00:09:36 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-01-07 20:39:10 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  /** 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   *  Renders  current  status  for  services  from  passed  array  of  services . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   *  @ param  Service []  $array  array  of  services 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   *  @ return  void 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   */ 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-24 00:09:36 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								  public  static  function  current_status ( $array ){ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    global  $all ,  $some ,  $classes ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    $statuses  =  array ( 0 , 0 , 0 , 0 ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    $worst  =  5 ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-01-12 21:35:31 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-11-24 00:09:36 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    foreach  ( $array  as  $service )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      if  ( $service -> status < $worst ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $worst  =  $service -> get_status (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      $statuses [ $service -> get_status ()] ++ ;  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    echo  '<div id="status-big" class="status ' . $classes [ $worst ] . '">' ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-06-16 20:11:25 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-11-24 00:09:36 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    if  ( $statuses [ $worst ]  ==  count ( $array )) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    { 
							 
						 
					
						
							
								
									
										
										
										
											2018-11-25 18:26:30 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								      echo  $all [ $worst ]; 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-24 00:09:36 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    } else { 
							 
						 
					
						
							
								
									
										
										
										
											2018-11-25 18:26:30 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								      echo  $some [ $worst ]; 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-24 00:09:36 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    echo  '</div>' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-01-07 20:39:10 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  /** 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   *  Renders  this  service . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   *  @ return  void 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   */ 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-24 00:09:36 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								  public  function  render (){ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    global  $statuses ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    global  $classes ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ?> 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      < div  class = " item clearfix " > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        < div  class = " service " >< ? php  echo  $this -> name ;  ?> </div>
 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-23 17:03:08 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        < ? php  if  ( $this -> status !=- 1 ){ ?> <div class="status <?php echo $classes[$this->status];?>"><?php echo _($statuses[$this->status]);?></div><?php }?>
 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-24 00:09:36 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      </ div > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  < ? php 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } 
							 
						 
					
						
							
								
									
										
										
										
											2018-04-13 21:31:03 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  public  function  jsonSerialize ()  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    global  $statuses ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    return  [ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      " id "  =>  $this -> id , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      " name "  =>  $this -> name , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      " status "  =>  $this -> status , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      " status_string "  =>  $statuses [ $this -> status ] 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-11-05 23:57:54 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}