

         <script type="text/javascript">
  
		
		 $(document).on("click", "#managebtndelete", function()
        {
          var itemid = $(this).data('id');
		  $("#itemid1").val(itemid); 
		  
		  
		   
        });
		$(document).on("click", "#editbtn", function()
        {
          var mycategoryid = $(this).data('id');
		  $("#mycategoryid").val(mycategoryid); 
		   
		   		   
   var maincategory = $(this).data('maincategory');
		   $("#maincategory").val(maincategory);
 
		    var name = $(this).data('name');
		   $("#name").val(name); 
		   
		     var description = $(this).data('description');
		   $("#description").val(description); 
		 
		  
		     
		     var invoice = $(this).data('invoice');
		   $("#invoice").val(invoice); 
		   
        });
		
		
		
		
    </script>   
 
 <div class="row">
  
   	

   	<div class="col-md-10">
	
  
		<div class="panel panel-default" data-collapsed="0">
        	<div class="panel-heading">
            	<div class="panel-title" id="redcolor" >
            		<i class="entypo-plus-circled"></i>
						 <span class="pull-right"><br> VIEW  Backup </span>					                   


						 
					
						 <a href="<?php echo base_url();?>user/viewconfiguration" class="btn btn-success"> Back Backups</a>	
						 <a href="<?php echo base_url();?>user/viewbackup" class="btn btn-success"> Back to configuration</a>	

            	</div>
            </div>
			<div class="panel-body">
View all the backups
				<div class="widget-content nopadding table_holder table-responsive" >				
	<?PHP
//
 $session_data = $this->session->userdata('logged_in');

   
 	$data['id'] = $session_data['id'];
        
		 $userid = $data['id'];

 $data['companyid'] = $session_data['companyid'];
	 $companyid = $data['companyid'];
		 $data['usertype'] = $session_data['usertype'];
	 $usertype = $data['usertype'];	
	  echo $this->session->flashdata('deletemsg'); 

				echo $this->session->flashdata('msg'); 
				
				
					$database  = $this->usermodel->populatealldataarray('backup','id', $itemid,'status',"active" );
		


			    $dir=$database[0]["path"];
						    $server=$database[0]["server"];

	 // $mypath=$database[0]["path"];
		    $user=$database[0]["user"];
			    $password=$database[0]["password"];
				    $host=$database[0]["host"];
					    $database=$database[0]["database"];
						
						
						
						
						
						
						
						
						
						
						
						
						
						
						
						if (isset($_POST['Download'])){
						$filename=	$_POST['filename'];



$file = $dir . $filename;



if (file_exists($file))
    {
    header('Content-Description: File Transfer');
    header('Content-Type: application/octet-stream');
    header('Content-Disposition: attachment; filename='.basename($file));
    header('Expires: 0');
    header('Cache-Control: must-revalidate');
    header('Pragma: public');
    header('Content-Length: ' . filesize($file));
    ob_clean();
    flush();
    readfile($file);
    exit;
    }
 //- the missing closing brace

				
			







							
						}
				
				
?>
										
					<div class="row">
						<div class="col-md-12">
							
							<div class="panel-body">
	
						







  <table cellpadding="0" cellspacing="0" border="1" class="table  table-striped" id="example" style="border-color:#CCCCCC; width:100%;"  >

             <thead>
         <tr>
		      <th>No</th>
     <th>File Name</th>
  <th>Download</th>
</tr>
   </thead>
    <tbody>
<?php

$i=0;
			
    //$dir = "D:/Backup/"; 
     
    // Open a directory, and read its contents 
    if (is_dir($dir)){ 
      if ($dh = opendir($dir)){ 
        while (($file = readdir($dh)) !== false){ 
		  if(strpos($file, $database) !== false){
			  $i++;
             ?>
			
			 <tr>
			 			 <td>
		<?php
		
		
	
		  
		
    echo $i;

		
		  ?>
		  	 	
</td>
			 <td>
		<?php
		
		
	
		  
		
    echo $file;

		
		  ?>
		  	 	
</td>
<td>
<form method='post' action=''>
<input type='hidden' name='filename' value="<?php echo $file; ?>" />
<input type='hidden' name='path' value="<?php echo $dir; ?>" />

<input type='hidden' name='action' value="remove" />
<button type='submit' class="btn btn-success" name="Download" value="Download">Download Now</button>
</form>

</td>
</tr>

		  <?php
       } } 
        closedir($dh); 
      } 
    } 
  
				
				
	?>			
				
				
</tbody>
        </table>











			
									
									
									
					</div>	

					
					
					
					
					
<div id="editProductModel" class="modal fade" role="dialog">
  <div class="modal-dialog">

    <!-- Modal content-->
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal">&times;</button>
        <h4 class="modal-title">Update branch</h4>
      </div>
      <div class="modal-body">
      
	  	

				<?PHP
//$session_data = $this->session->userdata('logged_in');



				echo $this->session->flashdata('msg'); 
		
                 echo form_open('user/updatebranch' , array('class' => 'form-horizontal form-groups-bordered validate', 'enctype' => 'multipart/form-data'));
				 if(validation_errors()):?>
<div class='alert alert-danger text-center'><?php echo validation_errors(); ?></div>
<?php endif;?>
	<input type="hidden" name="mycategoryid" value=""id="mycategoryid" class="form-control" required placeholder="Enter mycategoryid">
			  		
	<div class="form-group">
    <label for="inputname" class="col-sm-2 control-label">	Name </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="name" value="<?php echo set_value('name'); ?>" id="name" class="form-control" required placeholder="Enter name">
		 
				
		<span class="text-danger"> <?php echo form_error('name'); ?>
		
		</span>
	</div>
  </div>
  
  
  
  
  

	<div class="form-group">
    <label for="inputdescription" class="col-sm-2 control-label">	Receipt Details (Header)</label>
    <div class="col-sm-10">

				<textarea name="description" value="<?php echo set_value('description'); ?>"  id="description" class="form-control"  placeholder="Enter description"></textarea>
			
		<span class="text-danger"> <?php echo form_error('description'); ?>
		
		</span>
	</div>
  </div>
		
<div class="form-group">
    <label for="inputinvoice" class="col-sm-2 control-label">	Invoice Details(Header)</label>
    <div class="col-sm-10">

				<textarea name="invoice" value="<?php echo set_value('invoice'); ?>"  id="invoice" class="form-control"  placeholder="Enter invoice"></textarea>
			
		<span class="text-danger"> <?php echo form_error('invoice'); ?>
		
		</span>
	</div>
  </div>
		

	

	
	 <div class="form-group">

    <div class="col-sm-offset-2 col-sm-10">
     
	         <button type="submit"  value="branch" name="btn_updatebranch" class="btn btn-primary"> Update Branch   </button>

    </div>
  </div>
  					<?php echo form_close();?>
			</div>							   
				
									
							
								
			<div class="modal-footer">

    

				</div>

		</div>
	    </div>
    </div>
					
					
					
					
					
					
					
					
					
					
					
					
						<div id="myModal" class="modal fade" role="dialog">
  <div class="modal-dialog">

    <!-- Modal content-->
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal">&times;</button>
        <h4 class="modal-title">Delete</h4>
      </div>
      <div class="modal-body">
        <h3>Are you sure you want to delete this item? </h3>
      </div>
      <div class="modal-footer">
	  	

     
		<?PHP
				$session_data = $this->session->userdata('logged_in');
 echo $this->session->flashdata('deletemsg'); 

		
                 echo form_open('user/deletebyid' , array('class' => 'form-horizontal ', 'enctype' => 'multipart/form-data'));
				 if(validation_errors()):?>
<div class='alert alert-danger text-center'><?php echo validation_errors(); ?></div>
<?php endif;?>
 <input type="hidden" id="table"name="table" class="table" placeholder="view" value="backup">

 <input type="hidden" id="view"name="view" class="view" placeholder="view" value="user/viewbackup">
 <input type="hidden" id="itemid1"name="itemid" class="itemid" placeholder="itemid" value=""><br>
 <button type="button" class="btn btn-success" data-dismiss="modal">No</button>
 		  	         <button type="submit" name="btn_delete" value="deletebyid" class="btn btn-danger"> Delete  </button>

	<?php echo form_close();?>
      </div>
    </div>

  </div>

  </div>					
<div id="addModal" class="modal fade" role="dialog">
  <div class="modal-dialog">

    <!-- Modal content-->
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal">&times;</button>
        <h4 class="modal-title">Add new Backup</h4>
      </div>
      <div class="modal-body">
      
	  	

				<?PHP
//$session_data = $this->session->userdata('logged_in');

				echo $this->session->flashdata('deletemsg'); 


				echo $this->session->flashdata('msg'); 
		
                 echo form_open('user/addbbackup' , array('class' => 'form-horizontal form-groups-bordered validate', 'enctype' => 'multipart/form-data'));
				 if(validation_errors()):?>
<div class='alert alert-danger text-center'><?php echo validation_errors(); ?></div>
<?php endif;?>
						  		<input type="hidden" name="action" value="insert" class="form-control" required placeholder="Enter action ">
  		
	<div class="form-group">
    <label for="inputuser" class="col-sm-2 control-label">	Username </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="user" value="<?php echo set_value('user'); ?>" class="form-control" required placeholder="Enter user name e.g root">
		 
				
		<span class="text-danger"> <?php echo form_error('user'); ?>
		
		</span>
	</div>
  </div>

  
  
  
  <div class="form-group">
    <label for="inputpassword" class="col-sm-2 control-label">	Password </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="password" value="<?php echo set_value('password'); ?>" class="form-control" required placeholder="Enter password ">
		 
				
		<span class="text-danger"> <?php echo form_error('password'); ?>
		
		</span>
	</div>
  </div>

  
  
    <div class="form-group">
    <label for="inputdatabase" class="col-sm-2 control-label">	Database </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="database" value="<?php echo set_value('database'); ?>" class="form-control" required placeholder="Enter database ">
		 
				
		<span class="text-danger"> <?php echo form_error('database'); ?>
		
		</span>
	</div>
  </div>

  
  
    <div class="form-group">
    <label for="inputhost" class="col-sm-2 control-label">	Host </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="host" value="<?php echo set_value('host'); ?>"   class="form-control" required placeholder="Enter e.g Localhost  ">
		 
				
		<span class="text-danger"> <?php echo form_error('host'); ?>
		
		</span>
	</div>
  </div>

  
  
  
    
  
    <div class="form-group">
    <label for="inputserver" class="col-sm-2 control-label">	Server Path </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="server" value="<?php echo set_value('server'); ?>" class="form-control"  placeholder="Enter e.g server path  ">
		 
				
		<span class="text-danger"> <?php echo form_error('server'); ?>
		
		</span>
	</div>
  </div>
  
   
    <div class="form-group">
    <label for="inputpath" class="col-sm-2 control-label">	Backup Full Path </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="path" value="<?php echo set_value('path'); ?>" class="form-control" required placeholder="Enter e.g Backup Full Path   ">
		 
				
		<span class="text-danger"> <?php echo form_error('path'); ?>
		
		</span>
	</div>
  </div>
  
  
  
  
		  <div class="form-group">
    <label for="inputstatus" class="col-sm-2 control-label">Status?</label>
    <div class="col-sm-10">
	<select class="form-control" name="status"  required>
		<option value=""  >---Select  Status ---</option>


		 	<option value="active" selected  >Active</option>
					 	<option value="inactive"  >Inactive</option>


</select>
		

	</div>
  </div>	
  
  
	

	

	
	 <div class="form-group">

    <div class="col-sm-offset-2 col-sm-10">
     
	         <button type="submit"  value="backup" name="btn_addbackup" class="btn btn-primary"> Add Backup   </button>

    </div>
  </div>
  					<?php echo form_close();?>
			</div>							   
				
									
							
								
			<div class="modal-footer">

    

				</div>

		</div>
	    </div>
    </div>





					
									
									
							</div>		
									
							</div>
						</div>
				

			
			</div>
		</div>
  
  </div>
			
		<div class="col-md-2">
			  <div class="panel panel-default" data-collapsed="0">
        	<div class="panel-heading">
            	<div class="panel-title" id="redcolor" >
            		<i class="entypo-plus-circled"></i>
				<p>Help/More Explanation </p>

				
            	</div>
            </div>
      
			<p>Create various  branches.</p>
			
			
		</div>			
	</div>			
		
		
  

 
</div>


















