2017-11-24 00:09:36 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								< ? php  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								//DIR Because of include problems
  
						 
					
						
							
								
									
										
										
										
											2018-01-18 22:57:12 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								require_once ( __DIR__  .  " /incident.php " );  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								require_once ( __DIR__  .  " /service.php " );  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								require_once ( __DIR__  .  " /user.php " );  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								require_once ( __DIR__  .  " /token.php " );  
						 
					
						
							
								
									
										
										
										
											2017-11-24 00:09:36 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								/**  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								*  Facade  class  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								*/  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								class  Constellation  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-01-07 20:39:10 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  /** 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   *  Renders  incidents  matching  specified  constraints . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   *  @ param  Boolean  $future  -  specifies  whether  to  render  old  or  upcoming  incidents 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   *  @ param  int  $offset  -  specifies  offset  -  used  for  pagination 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   *  @ param  int  $limit  -  limits  the  number  of  incidents  rendered 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   *  @ param  Boolean  $admin  -  specifies  whether  to  render  admin  controls 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   */ 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-24 00:09:36 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								  public  function  render_incidents ( $future = false ,  $offset = 0 ,  $limit  =  5 ,  $admin  =  0 ){ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( $offset < 0 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      $offset  =  0 ;  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2018-04-14 12:37:01 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    $limit  =  ( isset ( $_GET [ 'limit' ]) ? $_GET [ 'limit' ] : 5 ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    $offset  =  ( isset ( $_GET [ 'offset' ]) ? $_GET [ 'offset' ] : 0 ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    $timestamp  =  ( isset ( $_GET [ 'timestamp' ])) ? $_GET [ 'timestamp' ] : time (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    $incidents  =  $this -> get_incidents ( $future ,  $offset ,  $limit ,  $timestamp ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-01-02 19:37:15 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    $ajax  =  isset ( $_GET [ 'ajax' ]); 
							 
						 
					
						
							
								
									
										
										
										
											2018-04-14 12:37:01 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( $future  &&  count ( $incidents [ " incidents " ])  &&  ! $ajax ) 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-24 00:09:36 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    { 
							 
						 
					
						
							
								
									
										
										
										
											2017-12-31 00:41:58 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								      echo  " <h3> " . _ ( " Planned maintenance " ) . " </h3> " ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-24 00:09:36 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2018-04-14 12:37:01 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    else  if  ( count ( $incidents [ " incidents " ])  &&! $ajax ) 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-24 00:09:36 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      if  ( $offset )  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      { 
							 
						 
					
						
							
								
									
										
										
										
											2018-04-14 12:37:01 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        echo  '<noscript><div class="centered"><a href="' . WEB_URL . '/?offset=' . ( $offset - $limit ) . '×tamp=' . $timestamp . '" class="btn btn-default">' . _ ( " Back " ) . '</a></div></noscript>' ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-24 00:09:36 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      } 
							 
						 
					
						
							
								
									
										
										
										
											2017-12-31 00:41:58 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								      echo  " <h3> " . _ ( " Past incidents " ) . " </h3> " ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-24 00:09:36 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    else  if  ( ! $future  &&! $ajax ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    { 
							 
						 
					
						
							
								
									
										
										
										
											2017-12-31 00:41:58 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								      echo  " <h3> " . _ ( " No incidents " ) . " </h3> " ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-24 00:09:36 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2018-04-14 12:37:01 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    $show  =  ! $future  &&  $incidents [ " more " ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-11-24 00:09:36 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    $offset  +=  $limit ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-04-14 12:37:01 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    if  ( count ( $incidents [ " incidents " ])){ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      foreach  ( $incidents [ 'incidents' ]  as  $incident )  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-24 00:09:36 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								        $incident -> render ( $admin ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      } 
							 
						 
					
						
							
								
									
										
										
										
											2018-04-14 12:37:01 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-11-24 00:09:36 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      if  ( $show ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      { 
							 
						 
					
						
							
								
									
										
										
										
											2018-03-10 00:07:40 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        echo  '<div class="centered"><a href="' . WEB_URL . '/?offset=' . ( $offset ) . '×tamp=' . $timestamp . '" id="loadmore" class="btn btn-default">' . _ ( " Load more " ) . '</a></div>' ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-24 00:09:36 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-01-07 20:39:10 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  /** 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   *  Renders  service  status  -  in  admin  page  it  returns  array  so  it  can  be  processed  further . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   *  @ param  boolean  $admin 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   *  @ return  array  of  services  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   */ 
							 
						 
					
						
							
								
									
										
										
										
											2018-04-13 21:31:03 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  public  function  render_status ( $admin  =  false ,  $heading  =  true ){ 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-24 00:09:36 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    global  $mysqli ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    $query  =  $mysqli -> query ( " SELECT id, name  FROM services " ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    $array  =  array (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( $query -> num_rows ){ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      $timestamp  =  time (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      while ( $result  =  $query -> fetch_assoc ()) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $id  =  $result [ 'id' ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $sql  =  $mysqli -> prepare ( " SELECT type FROM services_status INNER JOIN status ON services_status.status_id = status.id WHERE service_id = ? AND `time` <= ? AND (`end_time` >= ? OR `end_time`=0) ORDER BY `time` DESC LIMIT 1 " ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $sql -> bind_param ( " iii " ,  $id ,  $timestamp ,  $timestamp ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $sql -> execute (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $tmp  =  $sql -> get_result (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if  ( $tmp -> num_rows ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								          $array []  =  new  Service ( $result [ 'id' ],  $result [ 'name' ],  $tmp -> fetch_assoc ()[ 'type' ]); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        else { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								          $array []  =  new  Service ( $result [ 'id' ],  $result [ 'name' ]); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      }       
							 
						 
					
						
							
								
									
										
										
										
											2018-04-13 21:31:03 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								      if  ( $heading ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        echo  Service :: current_status ( $array ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      } 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-24 00:09:36 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    else { 
							 
						 
					
						
							
								
									
										
										
										
											2017-12-31 00:41:58 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								      $array []  =  new  Service ( 0 ,  _ ( " No services " ),  - 1 ); 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-24 00:09:36 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( ! $admin ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      echo  '<div id="status-container" class="clearfix">' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      foreach ( $array  as  $service ){ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $service -> render (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      echo  '</div>' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    else { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      return  $array ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } 
							 
						 
					
						
							
								
									
										
										
										
											2018-04-14 12:37:01 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  function  get_incidents ( $future  =  false ,  $offset  =  0 ,  $limit  =  5 ,  $timestamp  =  0 ){ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    global  $mysqli ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( $timestamp  ==  0 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      $timestamp  =  time (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-04-20 17:39:34 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    $operator  =  ( $future ) ? " >= " : " <= " ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-04-14 12:37:01 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    $limit ++ ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-11-21 11:24:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    $sql  =  $mysqli -> prepare ( " SELECT users.id, status.type, status.title, status.text, status.time, status.end_time, users.username, status.id as status_id FROM status INNER JOIN users ON user_id=users.id WHERE `time`  $operator  ? AND `end_time`  $operator  ?  OR (`time`<=? AND `end_time`  $operator  ? ) ORDER BY `time` DESC LIMIT ? OFFSET ? " ); 
							 
						 
					
						
							
								
									
										
										
										
											2018-04-14 12:37:01 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    $sql -> bind_param ( " iiiiii " , $timestamp ,  $timestamp ,  $timestamp ,  $timestamp ,  $limit ,  $offset ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    $sql -> execute (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    $query  =  $sql -> get_result (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    $array  =  []; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    $limit -- ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    $more  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( $query -> num_rows > $limit ){ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      $more  =  true ;  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( $query -> num_rows ){ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      while (( $result  =  $query -> fetch_assoc ())  &&  $limit --  >  0 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      { 
							 
						 
					
						
							
								
									
										
										
										
											2018-11-21 10:50:21 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        // Add service id and service names to an array in the Incident class
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $stmt_service  =  $mysqli -> prepare ( " SELECT services.id,services.name FROM services 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                                 INNER  JOIN  services_status  ON  services . id  =  services_status . service_id  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                                 WHERE  services_status . status_id  =  ? " );
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $stmt_service -> bind_param ( " i " ,  $result [ 'status_id' ]); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $stmt_service -> execute (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $query_service  =  $stmt_service -> get_result (); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        while ( $result_service  =  $query_service -> fetch_assoc ())  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								          $result [ 'service_id' ][]  =  $result_service [ 'id' ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								          $result [ 'service_name' ][]  =  $result_service [ 'name' ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-04-14 12:37:01 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        $array []  =  new  Incident ( $result ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    return  [ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      " more "  =>  $more , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      " incidents "  =>  $array 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } 
							 
						 
					
						
							
								
									
										
										
										
											2018-11-24 21:13:57 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  function  render_warning ( $header ,  $message ,  $show_link  =  false ,  $url  =  null ,  $link_text  =  null ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    $this -> render_alert ( 'alert-warning' ,  $header ,  $message ,  $show_link ,  $url ,  $link_text );   
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  function  render_success ( $header ,  $message ,  $show_link  =  false ,  $url  =  null ,  $link_text  =  null ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    $this -> render_alert ( 'alert-success' ,  $header ,  $message ,  $show_link ,  $url ,  $link_text ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  /** 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   *  Renders  an  alert  on  screen  with  an  optional  button  to  return  to  a  given  URL 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   *  @ param  string  alert_type  -  Type  of  warning  to  render  alert - danger ,  alert - warning ,  alert - success  etc 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   *  @ param  string  header  -  Title  of  warning 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   *  @ param  string  message  -  Message  to  display 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   *  @ param  boolean  show_link  -  True  if  button  is  to  be  displayed 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   *  @ param  string  url  -  URL  for  button 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   *  @ param  string  link_txt  -  Text  for  button 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   *  @ return  void 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  function  render_alert ( $alert_type ,  $header ,  $message ,  $show_link  =  false ,  $url  =  null ,  $link_text  =  null ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    echo  ' < div >< h1 ></ h1 > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								         < div  class = " alert '. $alert_type .' "  role = " alert " > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								         < h4  class = " alert-heading " > '.$header.' </ h4 > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								         < hr > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								         < p  class = " mb-0 " > '.$message.' </ p > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								         </ div ></ div > ' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  (  $show_link  )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      echo  '<div class="clearfix"><a href="' . $url . '" class="btn btn-success" role="button">' . $link_text . '</a></div>' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2017-11-24 00:09:36 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								$constellation  =  new  Constellation ();