Current File : /home/inlingua/public_html/sensoriumpsychologists.com/backup/diagnostics/admin/all_franchise.php
<?php require_once("../franchise_between/admin_constants.php");?>
<?php require_once("../franchise_between/check_admin.php");?>
<?php require_once("../franchise_between/user_details_msg_setup.php");?>
<?php require_once("../franchise_back/connection.php");?>
<?php require_once("../franchise_back/database_admin.php");?>
<?php require_once("../franchise_back/validate_admin.php");?>
<?php require_once("../franchise_between/admin.php");?>
<?php
$fetch_obj=new admin;
if(isset($_POST['to_delete']) && ($_POST['to_delete']!=""))
{
	$res=$fetch_obj->delete_franchise($_POST['to_delete']);
	if($msg=="ok")
	{
		$msg_print="Deleted Successfully...!!!";
		$temp_filename="all_franchise.php";
		header("location:redirect_msg.php?q=".$temp_filename."&msg=".$msg_print);
		exit(EXIT_ERROR);
	}
}

$page_no=0;
$pages_return=0;
if(isset($_GET['page_no']))
{
	$page_no = $_GET['page_no'];
}
$result=$fetch_obj->all_franchise($page_no,$pages_return);
?>
<?php 
error_reporting(0);
$msg=NULL;
$new_conn = new mysqli($host_db,$user_db,$pass_db,$name_db);
if ($new_conn->connect_errno){
	echo("COULD NOT CONNECT TO THE SERVER.....TRY AGAIN LATER");
	exit();
}else{
//for active 5 month view();
if(isset($_GET['fied']) && ($_GET['fied']!="")){
	
			$statement = "UPDATE shristi_login  SET 5month_view='0' WHERE table_id='".$_GET['fied']."'";
			//$result =$conn->query($sql);
			$result=$new_conn->query($statement);
			if($result){
				$msg='<div class="alert alert-success" >
                         <a class="close" data-dismiss="alert" href="#">&times;</a>
                         <strong>Successfully!</strong>operation done.</div>';
				echo "<meta http-equiv=\"refresh\" content=\"1;URL=all_franchise.php\">";
				}else{
					$msg= ' <div class="alert alert-warning" >
                           <a class="close" data-dismiss="alert" href="#">&times;</a>
                           <strong>Warning!</strong>some thing wrong.
                           </div>';	
				}
			}


//for inactive 5 month view();
if(isset($_GET['fieds']) && ($_GET['fieds']!="")){
	
			$statement = "UPDATE shristi_login  SET 5month_view='1' WHERE table_id='".$_GET['fieds']."'";
			$result=$new_conn->query($statement);
			if($result){
				$msg='<div class="alert alert-success" >
                         <a class="close" data-dismiss="alert" href="#">&times;</a>
                         <strong>Successfully!</strong>operation done.</div>';
				echo "<meta http-equiv=\"refresh\" content=\"1;URL=all_franchise.php\">";
				}else{
					$msg=' <div class="alert alert-warning" >
                           <a class="close" data-dismiss="alert" href="#">&times;</a>
                           <strong>Warning!</strong>some thing wrong.
                           </div>';
					
				}
			}
}
?>

<!DOCTYPE html>
<html>
  <head>
    <?php require("common/head_links.php");?>
    
  </head>
  <body class="hold-transition skin-blue sidebar-mini">
    <div class="wrapper">

      <?php require("common/header.php");?>
      
      <?php require("common/left_side_bar.php");?>

      <!-- Content Wrapper. Contains page content -->
      <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section class="content-header">
          <h1>
            All Franchise
          </h1><br>
          <a href="add_edit_franchise.php"><div class="btn btn-primary">+ Add New</div></a>
      	</section>
        <!-- Main content -->
        <section class="content">
        	<div class="row" style="margin-top:20px;">
        <div class="col-xs-12">
          <div class="box box-primary">
            <div class="box-body table-responsive">
            <?php echo $msg;?>
              <table id="example2" class="table table-bordered table-hover">
                <thead>
                  <tr>
                    <th style="width:30px;">S.NO</th>
                    <th>NAME</th>
                    <th>USERNAME</th>
                    <th>PASSWORD</th>
                    <th>REG DATE</th>
                    <th>STATUS</th>
                    <th>5Month View</th>
                  </tr>
                </thead>
                <tbody>
                  <?php	
				  if($result==="not found"){
				  ?>
                  <tr>
                  	<td colspan="6" style="color:#F00;">No records found...</td>
                  </tr>
                  <?php
				  }
				  else
				  {
					 $x=1;
					 while($DATA = $result->fetch_assoc())
					 {
		 				$sno=$page_no*PER_PAGE_STUDENTS+$x;
   				?>
								  <tr>
									<td><?php echo $sno;?></td>
									<td><?php echo $DATA['name'];?></td>
									<td><?php echo $DATA['username'];?></td>
									<td><?php echo $DATA['password'];?></td>
									<?php
                                    $dob=$DATA['reg_date'];
                                    if($dob!="0000-00-00")
                                    {
                                        $date_obj = new DateTime($dob);
                                        $dob=$date_obj->format(DATE_FORMAT);
                                    }
                                    ?>
                                    <td><?php echo($dob);?></td>
									<td><?php echo $DATA['status'];?></td>
                                    <td>
									<?php
									  if($DATA['5month_view']==1){?><a href="all_franchise.php?fied=<?php echo($DATA['table_id']);?>&action=0" class="btn btn-success" onclick="return confirm('sure to Inactive 5 month view !');"><?php echo "Active";}?></a> 
									 <?php  if($DATA['5month_view']==0){?><a href="all_franchise.php?fieds=<?php echo($DATA['table_id']);?>&action=1" class="btn btn-danger" onclick="return confirm('sure to active 5 month view !');"><?php echo "Inactive";}
									?>
                                    </td>
									<td><A href="add_edit_franchise.php?fid=<?php echo($DATA['table_id']);?>"><div class="btn btn-warning">Edit</div></A></td>
									<td>
                                    <?php
									if(!($DATA['children_count']>0))
									{
									?>
                                    	<A href="javascript:delete_func('<?php echo($DATA['table_id']);?>')"><div class="btn btn-danger">Delete</div></A></td>
                                    <?php
									}
									?>
								  </tr>
								  <?php
					  $x++;
					  }
				  }
	  ?>
                </tbody>
              </table>
            </div>
            <!-- /.box-body --> 
            
            <?php
			if($pages_return>1)
			{
			?>
                <div class="box-footer clearfix">
                  <ul class="pagination pagination-sm no-margin pull-right">
                  	<?php
					if($page_no==0)
					{
						echo("<li class=\"disabled\"><a href=\"#\">&laquo;</a></li>");
					}
					else
					{
						echo("<li><a href=\"javascript:submit_form_page_no('".($page_no-1)."')\">&laquo;</a></li>");
					}
					?>
                    <?php
					for($i=1;$i<=$pages_return;$i++)
					{
						$j=$i-1;
						echo("<li");
						if($j==$page_no)echo(" class=\"active\"");
						echo("><a href=\"javascript:submit_form_page_no('".$j."')\">".$i."</a></li>");
					}
					?>
                  	<?php
					if(($page_no+1)==$pages_return)
					{
						echo("<li class=\"disabled\"><a href=\"#\">&raquo;</a></li>");
					}
					else
					{
						echo("<li><a href=\"javascript:submit_form_page_no('".($page_no+1)."')\">&raquo;</a></li>");
					}
					?>
                  </ul>
                </div>
            <?php
			}
			?>
            
            
          </div>
          <!-- /.box --> 
        </div>
        <!-- /.col --> 
      </div>
        </section><!-- /.content -->
      </div><!-- /.content-wrapper -->
      <?php require("common/footer.php");?>

      

    </div><!-- ./wrapper -->
<?php require("common/footer_links.php");?>

<form name="delete_form" method="post">
	<input type="hidden" name="to_delete" id="to_delete" value="" />
</form>

<script>
function submit_form_page_no(temp_val)
{
	$("#page_no").val(temp_val);
	submit_form();
}
function submit_form()
{
	$("#blackout").css({'visibility':'visible'});
	document.filter_form.submit();
}
function delete_func(val)
{
	var ans=confirm("Delete Permanently?");
	if(ans==true)
	{
		$("#to_delete").val(val);
		document.delete_form.submit();
		return true;
	}
	else
	{
		return false;
	}
}
</script>
  </body>
</html>