Your IP : 18.227.21.101


Current Path : /home/lentoinv/churchmr.com/retreat/search/
Upload File :
Current File : /home/lentoinv/churchmr.com/retreat/search/index2.php

<?php
session_start(); ob_start();
	   include("../data.inc.php");
	   
$repx = isset($_SESSION['sn'])?$_SESSION['sn']:$_SESSION['rid'];

$did=''; $section='';  $search='';

if(isset($_GET['did'])){ $did = $_GET['did'];  $section = $_GET['section'];  }
if(isset($_GET['search'])){ $search = $_GET['search']; }


?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <title>Auto Registration</title>

    <!-- Bootstrap 3.3.5 -->
    <link rel="stylesheet" href="../../bootstrap/css/bootstrap.min.css">
    <!-- <link rel="stylesheet" href="../../dist/css/AdminLTE.min.css"> -->
    <!-- jQuery libs -->
  
 <link rel="stylesheet" href="../../plugins/select2/select2.min.css">
 

</head>
<body>

<div id="container" style="width:100%; margin:0px;">
<form method="get">
 <p> <input type="text" name="search" class="form-control" placeholder="Enter Search Criteria" value="<?php echo $search; ?>" required></p><p>
  <button style="float:right" type="submit" class="btn btn-primary">Search Participant</button>
</p>
</form>
<center><br>OR<br><br></center>
<form method="get">
<select name="did" class="form-control select2" required >
                         
                        
  <option selected disabled value="">SELECT DISTRICT...</option> 
  <?php   $sql=$db->query("SELECT * FROM district WHERE rid='$rid' ORDER BY zone ASC, district ASC " )or die(mysqli_error());  
           while($row=mysqli_fetch_array($sql)){ ?>
                    
                           <option value="<?php echo $row['sn'] ;  ?>" <?php if($row['sn']==$did){ echo 'selected' ; } ?>><?php echo $row['zone'].' | '.$row['district'] ;  ?></option>
                            <?php  }  ?>
                        </select>

              <select name="section" class="form-control" required  style = "color:blue; font-weight:bold" >
                          <option selected disabled value="">SELECT SECTION...</option>
                          <option <?php if('Adult'==$section){ echo 'selected' ; } ?>>Adult</option>
                          <option <?php if('Campus'==$section){ echo 'selected' ; } ?>>Campus</option>
                          <option <?php if('Youth'==$section){ echo 'selected' ; } ?>>Youth</option>  
                          <option <?php if('Children'==$section){ echo 'selected' ; } ?> >Children</option>
                        </select>
            </p>

<p>
  <button style="float:right" type="submit" class="btn btn-primary">Search Participant</button>
</p></form></div>
           
         
               <div>
                  <?php if(isset($_GET['did']) OR isset($_GET['search'])){ 
if(isset($_GET['search'])){ $search = $_GET['search'];
                  $fetch = $db->query("SELECT * from mdata where (surname like '%".$search."%' or firstname like '%".$search."%' or othername like '%".$search."%' or phone like '%".$search."%' or phone2 like '%".$search."%') and rid = '$rid' order by surname asc, firstname asc limit 400");}
                  else{  $fetch = $db->query("SELECT * from mdata where did = '$did' AND section = '$section' AND rid = '$rid' order by surname asc, firstname asc limit 400");}
$num=mysqli_num_rows($fetch);
 $sResults = '';
      $sResults .= '<table class="table table-hover no-border" width="100%">
              
                         <tr>
          
             <th  width="55%">Name</th>
                     
                    </tr>';
     
      $x = 0;
        while ( $row = mysqli_fetch_object( $fetch ) ) { $id = $row->sn;
          if($row->section=='Adult'){$btn = 'primary'; $required='required';   $co = 'orange'; }
elseif($row->section=='Campus'){$btn = 'info'; $required='required';  $co = '#7598E8'; }
elseif($row->section=='Youth'){$btn = 'success'; $required='required';   $co = '#8CD789';  }
elseif($row->section=='Children'){$btn = 'warning'; $required='';  $co = 'pink'; }



      $x = $x + 1;
       if(regStatus($id)>0){ $col = 'bgcolor="'.$co.'"'; } else{ $col = '';}
      
      $sResults .= '<form method="post"> <tr '.$col.'>';
          //  $sResults .= '<td>' . $x . '</td>';
      $sResults .= '<td>';    
       $sResults .= '<input name="id" type="hidden" value="'. $id.'" >';  $sResults .= '<a href="?user='.$row->sn.'">' .ucwords(strtolower($row->surname . ' ' . $row->firstname. ' ' . $row->othername)).'</a> ['.didName($row->did) . ']</td>';
     if(regStatus($id)==0){
      $sResults .= '<td>' ;
      $sResults .= '<button type="submit" class="btn btn-xs btn-'.$btn.'" name="RegUser">Register</button></td>'; }
      else{$sResults .= '<td>'.snToTag($id).'</td>';}
       $sResults .='</a></tr></form>';
      
      

        }
   $sResults .= '</table>';

   echo $sResults.'Found: '.$x;

                  }
                  ?>
                </div>
              
<script type="text/javascript">
   setInterval(function() {
    $("#refresh").load(location.href+" #refresh>*","");
}, 3000); // seconds to wait, miliseconds. 1s = 1000
 </script>    

            <?php if(isset($report)){  ?> <div id="refresh" >  <?php
				 echo '<div class="alert alert-success alert-dismissible" style="position:fixed; top:50px; z-index:10000">
                <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
                <i class="icon fa fa-check"></i>'. $report .'
              </div>';   ?>   </div>   <?php  }  ?>
              
              
              
               <?php if(isset($reportx)){  ?> <div id="refresh" >  <?php
				 echo '<div class="alert alert-danger alert-dismissible" style="position:fixed; top:50px; z-index:10000">
                <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
                <i class="icon fa fa-check"></i>'. $reportx .'
              </div>';   ?>   </div>   <?php  }  ?>
  
              
<?php if(isset($_GET['user'])){
  $user = $_GET['user']; 
  
$sq = $db->query("SELECT * FROM mdata WHERE sn = '$user' "); 
$rr = mysqli_fetch_assoc($sq); 

    if($rr['section']=='Adult'){$btn = 'primary';  $co = 'orange';}
elseif($rr['section']=='Campus'){$btn = 'info';    $co = '#7598E8'; }
elseif($rr['section']=='Youth'){$btn = 'success';  $co = '#8CD789';  }
elseif($rr['section']=='Children'){$btn = 'warning'; $co = 'pink';  }
 ?>

 <p style="display: block; background-color: <?php echo $co ?>; width: 100%; padding: 10px; margin-top: 40px"> SECTION: <strong><?php echo strtoupper($rr['section']); ?></strong> </p>
                      <p> Name: <strong><?php echo userName($rr['id']); ?></strong> </p>
                     <p> Group: <strong><?php echo gName($rr['gid']); ?></strong> </p>
                      <p> District: <strong><?php echo didName($rr['did']); ?></strong> </p>
                      <?php if($rr['worker']==1){ ?>
                     <p> Area of Work: <strong><?php echo $rr['aow']; ?></strong> </p>
                     <p> Designation: <strong><?php echo $rr['designation']; ?></strong> </p>
                     <?php } ?>
                      
               
                       <p> Gender: <strong><?php echo $rr['sex'] ?></strong> </p>
   <form method="post">                      
   <input name="id" type="hidden" value="<?php echo $rr['sn'] ?>"> 
  <?php if(regStatus($rr['sn'])==1){   ?>       
<?php if($rr['section'] != 'Children' AND $rid==1){ ?>
 <p><i>Tag Number</i> <input type="number" name="tag" class="form-control" min="1" max="20000" value="<?php echo userEvent($rr['sn']) ?>" placeholder="Tag Number" required></p>  <?php } ?>                            
<table><tr><td> <?php if($rr['section'] != 'Children' AND $rid==1){ ?>
<button type="submit" class="btn btn-warning" name="ChangeTag" style="width:100%">CHANGE TAG</button> <?php } ?>
</td><td>&nbsp;&nbsp;&nbsp;&nbsp;</td><td>
<button type="submit" class="btn btn-danger" name="UnRegUser" style="width:100%">UN-REGISTER</button>
</td></tr> </table>
<?php } else{ ?>
<?php if($rr['section'] != 'Children' AND $rid==1){ ?>
<p><input type="number" name="tag" class="form-control" min="0" max="20000" placeholder="Tag Number" required></p> 
<?php } ?> <p>                            
<button type="submit" class="btn btn-<?php echo $btn ?>" name="RegUser" style="width:100%">REGISTER <?php echo strtoupper($rr['section']); ?> PARTICIPANT</button></p>
<?php } ?>
                    </form>  
                    

                </div><!-- /.tab-content -->

<?php  } ?>  
            
</div>



<!-- <?php if(tagIssued($rep) >= tagReceived($rep) AND $_SESSION['retreat']!='Retreat User'){  ?>show<?php }  ?> -->

 <div class="modal modal-danger   " id="modal-danger">
          <div class="modal-dialog">
            <div class="modal-content">
              <div class="modal-header">
                <!-- <button type="button" class="close" data-dismiss="modal" aria-label="Close" onclick = "$('.modal').removeClass('show').addClass('fade');">
                  <span aria-hidden="true">&times;</span></button> -->
                <h4 class="modal-title">REGISTRATION TAGS EXHAUSTED</h4>
              </div>
              <div class="modal-body">
                <h4 class="text-center" >You have exhausted your registration tag. Request more tags to continue registrations </h4>
               <br>
              </div>
              <div class="modal-footer">
               <!--  <button onclick = "$('.modal').removeClass('show').addClass('fade');" type="button" class="btn btn-outline pull-left" data-dismiss="modal">Close</button>   -->

               <form method="post">
                <button type="submit" class="btn btn-danger" name="">Tags Received</button> 
               </form>
               
              </div>
            </div>
            <!-- /.modal-content -->
          </div>
          <!-- /.modal-dialog -->
        </div>
        <!-- /.modal -->


 <script src="../../plugins/jQuery/jQuery-2.1.4.min.js"></script>
 <script src="../../bootstrap/js/bootstrap.min.js"></script>
    <script src="../../plugins/select2/select2.full.min.js"></script>

 <script>
      $(function () {
        //Initialize Select2 Elements
        $(".select2").select2();
        });
      </script>
</body>
</html>

?>