<?php

$jsondata = file_get_contents("./api/zyx.json");
$data = json_decode($jsondata, true);
$json = $data['themes'];
if(isset($_POST['submit_theme'])){
$message = '<div class="alert alert-primary" id="flash-msg"><h4><i class="icon fa fa-check"></i>Items Updated!</h4></div>';
$json = $data['themes'];
$jsonData = file_get_contents("./api/zyx.json");
$arrayData = json_decode($jsonData, true);
$replacementData = array('themes' =>  array(
	'theme_defult_layout'            => $_POST["theme_defult_layout"],
   'theme_color_1'               => $_POST["theme_color_1"],
   'theme_color_2'           => $_POST["theme_color_2"],
    'theme_color_3'                 => $_POST["theme_color_3"],
     'theme_change'      => $_POST["theme_change"]
     ));
  $newArrayData = array_replace_recursive($arrayData, $replacementData);
$newJsonData = json_encode($newArrayData, JSON_PRETTY_PRINT);
file_put_contents("./api/zyx.json", $newJsonData);
header("Location: image.php");
		}   

$jsondata2 = file_get_contents("./api/zyx.json");
$data2 = json_decode($jsondata2, true);
$json2 = $data2['app_image'];
if(isset($_POST['submit_image'])){
$message = '<div class="alert alert-primary" id="flash-msg"><h4><i class="icon fa fa-check"></i>Items Updated!</h4></div>';
$json2 = $data2['app_image'];
$jsonData2 = file_get_contents("./api/zyx.json");
$arrayData2 = json_decode($jsonData2, true);
$replacementData2 = array('app_image' =>  array(
	'app_logo'    => $_POST["app_logo"],
	'app_mobile_icon'    => $_POST["app_mobile_icon"],
	'app_tv_banner'	=> $_POST["app_tv_banner"],
	'splash_image'	=> $_POST["splash_image"],
	'back_image'	=> $_POST["back_image"],
	));
	$newArrayData2 = array_replace_recursive($arrayData2, $replacementData2);
$newJsonData2 = json_encode($newArrayData2, JSON_PRETTY_PRINT);
file_put_contents("./api/zyx.json", $newJsonData2);
header("Location: image.php");
		}
		$jsondata3 =file_get_contents("./api/zyx.json");
		$data3 = json_decode($jsondata3, true);
		$json2a = $data3['background'];
		$json3 = $data3['background']['background_url'];
		$jsonData3 = file_get_contents("./api/zyx.json");
$arrayData3 = json_decode($jsonData3, true);
if(isset($_POST['submit_background'])){  
    $replacementData2a = array('background' => array(
    'background_mannual_change' => $_POST['background_mannual_change'],
    'background_auto_change' => $_POST['background_auto_change'],
    'background_orverlay_color_code' => $_POST['background_orverlay_color_code']));
$replacementData3 = array('background'=>array('background_url'=>array('0'=>array('url'=>$_POST['url']))));
$replacementData4 = array('background'=>array('background_url'=>array('1'=>array('url'=>$_POST['url2']))));
$replacementData5 = array('background'=>array('background_url'=>array('2'=>array('url'=>$_POST['url3']))));
$replacementData6 = array('background'=>array('background_url'=>array('3'=>array('url'=>$_POST['url4']))));
$newArrayData2a = array_replace_recursive($arrayData3, $replacementData2a);
$newArrayData3 = array_replace_recursive($newArrayData2a, $replacementData3);
$newArrayData4 = array_replace_recursive($newArrayData3, $replacementData4);
$newArrayData5 = array_replace_recursive($newArrayData4, $replacementData5);
$newArrayData6 = array_replace_recursive($newArrayData5, $replacementData6);
$newJsonData3 = json_encode($newArrayData6, JSON_PRETTY_PRINT);
file_put_contents("./api/zyx.json", $newJsonData3);
header("Location: image.php");
}
include'includes/header.php';
?>
<!-- Begin Page Content -->
        <div class="container-fluid">

          <!-- Page Heading -->
          <h1 class="h3 mb-1 text-gray-800">App Theme Settings    Three Submenus</h1>
         
          <!-- Content Row -->
          <div class="row">

            <!-- First Column -->
            <div class="col-lg-4">
<div class="wrapper">
              <!-- Custom codes -->
                <div class="card border-left-primary alert-primary shadow h-100 card shadow mb-4">
                <div class="card-header py-3">
                <h6 class="m-0 font-weight-bold text-primary"><i class="fas fa-user-shield"></i> layout - colors </h6>
                </div>
                <div class="card-body">
                    
                    <form method="post">
                        
                    <div class="form-group">
							<label class="control-label " for="theme_defult_layout">
                            <strong>Layout = 
                              <?php echo $json['theme_defult_layout'];?> </strong>
                                    </label>
                                    <div class="form-group">
							<label>L1
                                <input type="radio" name="theme_defult_layout" value="L1"  
							<?php  if($json['theme_defult_layout'] == 'L1' ){ echo 'checked="checked"'; } ?> />
							</label>
							<label>L2
							<input type="radio" name="theme_defult_layout" value="L2" 
							<?php  if($json['theme_defult_layout'] == 'L2' ){ echo 'checked="checked"'; } ?> />
							</label>
							<label>L4
							<input type="radio" name="theme_defult_layout" value="L4" 
							<?php  if($json['theme_defult_layout'] == 'L4' ){ echo 'checked="checked"'; } ?> />
							</label>
							<label>L5
							<input type="radio" name="theme_defult_layout" value="L5"  
							<?php  if($json['theme_defult_layout'] == 'L5' ){ echo 'checked="checked"'; } ?> />
							</label>
							<label>L6
							<input type="radio" name="theme_defult_layout" value="L6"  
							<?php  if($json['theme_defult_layout'] == 'L6' ){ echo 'checked="checked"'; } ?> />
							</label>
							<label>L7
							<input type="radio" name="theme_defult_layout" value="L7"  
							<?php  if($json['theme_defult_layout'] == 'L7' ){ echo 'checked="checked"'; } ?> />
							</label>
							<label>L8
							<input type="radio" name="theme_defult_layout" value="L8" 
							<?php  if($json['theme_defult_layout'] == 'L8' ){ echo 'checked="checked"'; } ?> />
							</label>
							<label>L9
							<input type="radio" name="theme_defult_layout" value="L9"  
							<?php  if($json['theme_defult_layout'] == 'L9' ){ echo 'checked="checked"'; } ?> />
							</label>
							<label>L10
							<input type="radio" name="theme_defult_layout" value="L10"  
							<?php  if($json['theme_defult_layout'] == 'L10' ){ echo 'checked="checked"'; } ?> />
							</label>
							<label>L11
							<input type="radio" name="theme_defult_layout" value="L11"  
							<?php  if($json['theme_defult_layout'] == 'L11' ){ echo 'checked="checked"'; } ?> />
							</label>
							<label>L12
							<input type="radio" name="theme_defult_layout" value="L12" 
							<?php  if($json['theme_defult_layout'] == 'L12' ){ echo 'checked="checked"'; } ?> />
							</label>
							<label>L13
							<input type="radio" name="theme_defult_layout" value="L13"  
							<?php  if($json['theme_defult_layout'] == 'L13' ){ echo 'checked="checked"'; } ?> />
							</label>
							<label>L14
							<input type="radio" name="theme_defult_layout" value="L14" 
							<?php  if($json['theme_defult_layout'] == 'L14' ){ echo 'checked="checked"'; } ?> />
							</label>
							<label>L15
							<input type="radio" name="theme_defult_layout" value="L15"  
							<?php  if($json['theme_defult_layout'] == 'L15' ){ echo 'checked="checked"'; } ?> />
							</label>
                                          <label>L16
							<input type="radio" name="theme_defult_layout" value="L16"  
							<?php  if($json['theme_defult_layout'] == 'L16' ){ echo 'checked="checked"'; } ?> />
							</label>
                                          <label>L17
							<input type="radio" name="theme_defult_layout" value="L17"  
							<?php  if($json['theme_defult_layout'] == 'L17' ){ echo 'checked="checked"'; } ?> />
								</div>
                    </div>
<div class="form-group">
                    <h6 class="form-text"><strong>Theme color 1</strong></h6>
		<input type="text" class="form-control" placeholder=" ex #995643" name="theme_color_1" value="<? echo $json['theme_color_1'];?>">
							</div>
							<div class="form-group">
                    <h6 class="form-text"><strong>Theme color 2</strong></h6>
		<input type="text" class="form-control" placeholder=" ex #995643" name="theme_color_2" value="<? echo $json['theme_color_2'];?>">
							</div><div class="form-group">
                    <h6 class="form-text"><strong>Theme color 3</strong></h6>
		<input type="text" class="form-control" placeholder=" ex #995643" name="theme_color_3" value="<? echo $json['theme_color_3'];?>">
							</div>
							<div class="form-group ">
                        <label class="control-label requiredField" for="theme_change">
                        <strong>theme_change_allow=<?php echo $json['theme_change'];?></strong> </label>
                        	<p>		
							<label>True</label>
							<input type="radio" name="theme_change" value="true"  <?php  if($json['theme_change'] == 'true' ){ echo 'checked="checked"'; } ?> />							
							<label>False</label>
							<input type="radio" name="theme_change" value="false" <?php  if($json['theme_change'] == 'false' ){ echo 'checked="checked"'; } ?>/>							
							</p></p></div>

                        <button class="btn btn-primary btn-icon-split" name="submit_theme" type="submit">
                        <span class="icon text-white-50"><i class="fas fa-check"></i></span><span class="text">Submit</span>
                        </button>
                        </form>
                        </div>
                        </div>
                        </div>
                </div>
                    

<div class="col-lg-4">
                            <div class="wrapper">
              <!-- Custom codes -->
                <div class="card border-left-primary alert-primary shadow h-100 card shadow mb-4">
                <div class="card-header py-3">
                <h6 class="m-0 font-weight-bold text-primary"><i class="fa fa-wrench"></i> App Backgrounds </h6>
                </div>
                <div class="card-body">

						<form method="post">
							<div class="form-group">
                            <h6 class="form-text"><strong>App Logo</strong></h6>
								<input type="text" class="form-control" placeholder="http://link to image.jpg or .png" name="app_logo" value="<?php echo $json2['app_logo'];?>">
							</div>
							
			                
							<div class="form-group">
                            <h6 class="form-text"><strong>app_mobile_icon</strong></h6>
								<input type="text" class="form-control" placeholder="http://link to image.jpg or .png" name="app_mobile_icon" value="<?php echo $json2['app_mobile_icon'];?>">
							</div>
							
			              
							<div class="form-group">
                            <h6 class="form-text"><strong>App_Tv_Banner</strong></h6>
								<input type="text" class="form-control" placeholder="http://link to image.jpg or .png" name="app_tv_banner" value="<?php echo $json2['app_tv_banner'];?>">
							</div>
							
							<div class="form-group">
                            <h6 class="form-text"><strong>Splash_Image</strong></h6>
							    	<input type="text" class="form-control" placeholder="http://link to image.jpg or .png" name="splash_image" value="<?php echo $json2['splash_image']?>">
							</div>
							
							<div class="form-group">
                            <h6 class="form-text"><strong>back_image</strong></h6>
								<input type="text" class="form-control" placeholder="http://link to image.jpg or .png" name="back_image" value="<?php echo $json2['back_image']?>">
							</div>
                          
							
							<button class="btn btn-primary btn-icon-split" name="submit_image" type="submit">
                            <span class="icon text-white-50"><i class="fas fa-check"></i></span><span class="text">Submit</span>
                        </button>
                           </form>
                        </div>
                        </div>
                        </div>
                        </div>
                        
                        

 <div class="col-lg-4">
                            <div class="wrapper">

              <!-- Custom codes -->
                <div class="card border-left-primary alert-primary shadow h-100 card shadow mb-4">
                <div class="card-header py-3">
                    <h6 class="m-0 font-weight-bold text-primary"><i class="fa fa-cog"></i> Additional Background Images</h6>
                </div>
                <div class="card-body">
                <form method="post">
                    <div class="form-group ">
                        <label class="control-label requiredField" for="background_mannual_change">
                        <strong>background_mannual_change =<?php echo $json2a['background_mannual_change'];?></strong> </label>
                        	<p>		
							<label>True</label>
							<input type="radio" name="background_mannual_change" value="true"  <?php  if($json2a['background_mannual_change'] == 'true' ){ echo 'checked="checked"'; } ?> />							
							<label>False</label>
							<input type="radio" name="background_mannual_change" value="false" <?php  if($json2a['background_mannual_change'] == 'false' ){ echo 'checked="checked"'; } ?>/>							
							</p></p></div>
               <div class="form-group ">
                        <label class="control-label requiredField" for="background_auto_change">
                        <strong>background_auto_change =<?php echo $json2a['background_auto_change'];?></strong> </label>
                        	<p>		
							<label>True</label>
							<input type="radio" name="background_auto_change" value="true"  <?php  if($json2a['background_auto_change'] == 'true' ){ echo 'checked="checked"'; } ?> />							
							<label>False</label>
							<input type="radio" name="background_auto_change" value="false" <?php  if($json2a['background_auto_change'] == 'false' ){ echo 'checked="checked"'; } ?>/>							
							</p></p></div>
			
                        
                        <div class="form-group">
                            <h6 class="form-text"><strong>Background 2</strong></h6>
								<input type="text" class="form-control" placeholder="http://link to image.jpg or .png" name="url" value="<?php echo $json3['0']['url']?>">
							</div>
							<div class="form-group">
                            <h6 class="form-text"><strong>Background 3</strong></h6>
								<input type="text" class="form-control" placeholder="http://link to image.jpg or .png" name="url2" value="<?php echo $json3['1']['url'];?>">
							</div>
							<div class="form-group">
                            <h6 class="form-text"><strong>Background 4</strong></h6>
								<input type="text" class="form-control" placeholder="http://link to image.jpg or .png" name="url3" value="<?php echo $json3['2']['url'];?>">
							</div>
							<div class="form-group">
                            <h6 class="form-text"><strong>Background 5</strong></h6>
								<input type="text" class="form-control" placeholder="http://link to image.jpg or .png" name="url4" value="<?php echo $json3['3']['url'];?>">
							</div>
							<div class="form-group">
                    <h6 class="form-text"><strong>background_orverlay_color_code</strong></h6>
		<input type="text" class="form-control" placeholder=" ex #995643" name="background_orverlay_color_code" value="<? echo $json2a['background_orverlay_color_code'];?>">
							</div>
						<button class="btn btn-primary btn-icon-split" name="submit_background" type="submit">
                        <span class="icon text-white-50"><i class="fas fa-check"></i></span><span class="text">Submit back</span>
                        </button></div>
                        </div>
                        </form>
                        </div>
                        </div>
            
                     
                        
                        
                
 <!-- Theme -->
             <div class="col-xl-3 col-md-6 mb-4">
             <div class="card border-left-primary alert-primary  card shadow mb-4">
                <div class="card-header py-2">
                <h6 class="m-0 font-weight-bold text-primary"><i class="fa fa-picture-o"></i> App Logo</h6>
                </div>
                <div class="card-body">
                  <div class="row no-gutters align-items-center">
                   <div class="col mr-2"> 
                      <div class="h5 mb-0 font-weight-bold text-gray-800"><img class="card-img-bottom" src="<?php echo $json2['app_logo'];?>" alt="Card image" style="width:100%"></div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
            
            <!-- Theme -->
             <div class="col-xl-3 col-md-6 mb-4">
             <div class="card border-left-primary alert-primary  card shadow mb-4">
                <div class="card-header py-2">
                <h6 class="m-0 font-weight-bold text-primary"><i class="fa fa-picture-o">App Mobile Icon</i> </h6>
                </div>
                <div class="card-body">
                  <div class="row no-gutters align-items-center">
                   <div class="col mr-2"> 
                      <div class="h5 mb-0 font-weight-bold text-gray-800"><img class="card-img-bottom" src="<?php echo $json2['app_mobile_icon'];?>" alt="Card image" style="width:100%"></div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
        
            
            <!-- Theme -->
            <div class="col-xl-3 col-md-6 mb-4">
             <div class="card border-left-primary alert-primary  card shadow mb-4">
                <div class="card-header py-2">
                <h6 class="m-0 font-weight-bold text-primary"><i class="fa fa-picture-o"></i> App Tv Banner </h6>
                </div>
                <div class="card-body">
                  <div class="row no-gutters align-items-center">
                   <div class="col mr-2"> 
                      <div class="h5 mb-0 font-weight-bold text-gray-800"><img class="card-img-bottom" src="<?php echo $json2['app_tv_banner'];?>" alt="Card image" style="width:100%"></div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
            <!-- Theme -->
             <div class="col-xl-3 col-md-6 mb-4">
             <div class="card border-left-primary alert-primary  card shadow mb-4">
                <div class="card-header py-2">
                <h6 class="m-0 font-weight-bold text-primary"><i class="fa fa-picture-o"></i> Splash Image</h6>
                </div>
                <div class="card-body">
                  <div class="row no-gutters align-items-center">
                   <div class="col mr-2"> 
                      <div class="h5 mb-0 font-weight-bold text-gray-800"><img class="card-img-bottom" src="<?php echo $json2['splash_image'];?>" alt="Card image" style="width:100%"></div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
            
            
            <!-- Theme -->
             <div class="col-xl-3 col-md-6 mb-4">
             <div class="card border-left-primary alert-primary  card shadow mb-4">
                <div class="card-header py-2">
                <h6 class="m-0 font-weight-bold text-primary"><i class="fa fa-picture-o"></i> Background Image</h6>
                </div>
                <div class="card-body">
                  <div class="row no-gutters align-items-center">
                   <div class="col mr-2"> 
                      <div class="h5 mb-0 font-weight-bold text-gray-800"><img class="card-img-bottom" src="<?php echo $json2['back_image'];?>" alt="Card image" style="width:100%"></div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
            
            
            <!-- Theme -->
            <div class="col-xl-3 col-md-6 mb-4">
             <div class="card border-left-primary alert-primary  card shadow mb-4">
                <div class="card-header py-2">
                <h6 class="m-0 font-weight-bold text-primary"><i class="fa fa-picture-o"></i> Background2</h6>
                </div>
                <div class="card-body">
                  <div class="row no-gutters align-items-center">
                   <div class="col mr-2"> 
                      <div class="h5 mb-0 font-weight-bold text-gray-800"><img class="card-img-bottom" src="<?php echo $json3['0']['url'];?>" alt="Card image" style="width:100%"></div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
            
            
            <!-- Theme -->
           <div class="col-xl-3 col-md-6 mb-4">
             <div class="card border-left-primary alert-primary  card shadow mb-4">
                <div class="card-header py-2">
                <h6 class="m-0 font-weight-bold text-primary"><i class="fa fa-picture-o"></i> Background Image3</h6>
                </div>
                <div class="card-body">
                  <div class="row no-gutters align-items-center">
                   <div class="col mr-2"> 
                      <div class="h5 mb-0 font-weight-bold text-gray-800"><img class="card-img-bottom" src="<?php echo $json3['1']['url'];?>" alt="Card image" style="width:100%"></div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
            
            
            
            <!-- Theme -->
            <div class="col-xl-3 col-md-6 mb-4">
             <div class="card border-left-primary alert-primary  card shadow mb-4">
                <div class="card-header py-2">
                <h6 class="m-0 font-weight-bold text-primary"><i class="fa fa-picture-o"></i> Background Image 4</h6>
                </div>
                <div class="card-body">
                  <div class="row no-gutters align-items-center">
                   <div class="col mr-2"> 
                      <div class="h5 mb-0 font-weight-bold text-gray-800"><img class="card-img-bottom" src="<?php echo $json3['2']['url'];?>" alt="Card image" style="width:100%"></div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
            
            
            
            <!-- Theme -->
            <div class="col-xl-3 col-md-6 mb-4">
             <div class="card border-left-primary alert-primary  card shadow mb-4">
                <div class="card-header py-2">
                <h6 class="m-0 font-weight-bold text-primary"><i class="fa fa-picture-o"></i> Background Image 5</h6>
                </div>
                <div class="card-body">
                  <div class="row no-gutters align-items-center">
                   <div class="col mr-2"> 
                      <div class="h5 mb-0 font-weight-bold text-gray-800"><img class="card-img-bottom" src="<?php echo $json3['3']['url'];?>" alt="Card image" style="width:100%"></div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
            
            
            
    
                  </div>
                </div>
            
        
	
                
</body>
 <script> 
$(document).ready(function () {
    $("#flash-msg").delay(3000).fadeOut("slow");
});
  </script>
<?php include ('includes/footer.php');?>
</html>