<?php

	session_start(); 
	include("../include/config.php");
	include("../include/simpleimage.php");
	include("../include/functions.php"); 
	$BASE_URL = 'https://www.dev.goquicklly.com/';

	//$BASE_URL ='https://www.quicklly.com/';
		function isValidImage($file)
{
    if (!isset($file['tmp_name']) || !is_uploaded_file($file['tmp_name'])) {
        return false;
    }

    $allowedMime = ['image/jpeg', 'image/png', 'image/webp'];

    $finfo = finfo_open(FILEINFO_MIME_TYPE);
    $mime  = finfo_file($finfo, $file['tmp_name']);
    finfo_close($finfo);

    if (!in_array($mime, $allowedMime)) {
        return false;
    }

    if (getimagesize($file['tmp_name']) === false) {
        return false;
    }

    $head = file_get_contents($file['tmp_name'], false, null, 0, 512);
    if (preg_match('/<\?php|<script|<html|<!DOCTYPE/i', $head)) {
        return false;
    }

    return true;
}


	validate_admin();
	if($_REQUEST['submitForm']=='yes'){
	    $id=$_POST['id'];
	    $showing_name=$_POST['showing_name'];
	    $app_font_color=$_POST['app_font_color'];
	    $subTitle=$_POST['subTitle'];
	    $deliveryInfo=$_POST['deliveryInfo'];
	    $deliveryInfoColor=$_POST['deliveryInfoColor'];
	    $bgColor=$_POST['bgColor'];
	    $tagText=$_POST['tagText'];
	    $tagTextColor=$_POST['tagTextColor'];
	    $tagBgColor=$_POST['tagBgColor'];
	    $display_order_web=$_POST['display_order_web'];
	    $status=$_POST['status'];
	    $isBrand=$_POST['isBrand'];
	    $showingOn=$_POST['showingOn'];
		
		require_once __DIR__ . '/../include/S3Helper.php';
    	$s3 = new S3Helper();
	    // start website icon
		if(isset($_FILES['websiteIcon']) && $_FILES['websiteIcon']['error'] === 0 && isValidImage($_FILES['websiteIcon'])) {
                $Image= new SimpleImage();
                $filename = $_FILES['websiteIcon']['name'];
                $ext = pathinfo($filename, PATHINFO_EXTENSION);
                
                $img=time()."-".$filename;

				$url = $s3->upload($_FILES['websiteIcon']['tmp_name'], 'images/feature/home/categories',$img);
				if (!$url) {
					die('Website icon upload failed');
				}

			   $websiteIcon = 'images/feature/home/categories/' . $img;

                // Upload to main website FTP
            //     $url = SITE_URL;

            //     if($url ==MAINSITE_URL || $url==DEVSITE_URL ||
            //         $url==UATSITE_URL){

            //          if($url ==MAINSITE_URL){
            //             $conn_id = ftp_connect("3.133.214.148") or die("Error in FTP connection - Live");
            //             $login_status = ftp_login($conn_id, "mainuser@quicklly.com", "n3At8hv3LZKCiF6") or die("Error in FTP login - Live");
						
			// 	   }
            //         else {
            //             $conn_id = ftp_connect("92.204.135.155") or die("Error in FTP connection");
            //             ftp_pasv($conn_id, true);
                        
            //             if($url==UATSITE_URL)
            //                 $login_status = ftp_login($conn_id, "devgoquicklly", "7ZcS58nmn_MH31") or die("Error in FTP login");
            //             else
            //                 $login_status = ftp_login($conn_id, "devpuneet@dev.goquicklly.com", "1}PG%zK}Ymvi") or die("Error in FTP login");
            //         }
            //          ftp_pasv($conn_id, true); 
    
            //         $destination_file = "images/feature/home/categories/".$img;
            //         $upload_status = ftp_put($conn_id, $destination_file, $_FILES['websiteIcon']['tmp_name'], FTP_BINARY);
                        
            //         if (!$upload_status)
            //             echo "Something went wrong, Contact to site administrator.";
                        
            //         ftp_close($conn_id);
            //     }
                
            //     // Upload locally to admin
            //     move_uploaded_file($_FILES['websiteIcon']['tmp_name'],"../images/feature/home/categories/".$img);
                
            //     //$Image->load("../upload_images/prods-deals/".$img);	  
            //     //$Image->resize(300,300);	  
            //     //$Image->save("../upload_images/prods-deals/".$img);	 
            //     //CompressImage('../upload_images/prods-deals/'.$img, '../upload_images/prods-deals/'.$img, 50);

            //     $websiteIcon = 'images/feature/home/categories/' . $img;
            // }
		}else{ 
			$websiteIcon=$_POST['websiteIcon_tmp'];
		}
            //end website icon
            
            // srtart app icon
		if(isset($_FILES['AppIcon']) && $_FILES['AppIcon']['error'] === 0 && isValidImage($_FILES['AppIcon'])) {
        
                $Image= new SimpleImage();
                $filename = $_FILES['AppIcon']['name'];
                $ext = pathinfo($filename, PATHINFO_EXTENSION);
                
                $img=time()."-".$filename;
				$path = $s3->upload($_FILES['AppIcon']['tmp_name'], 'images/feature/home/categories/app-photo',$img);
				if (!$path) {
					die('App icon upload failed');
				}

				$AppIcon_tmp = 'images/feature/home/categories/app-photo/' . $img;

                // Upload to main website FTP
                // $url = SITE_URL;

                // if($url ==MAINSITE_URL || $url==DEVSITE_URL ||
                //     $url==UATSITE_URL){

                //      if($url ==MAINSITE_URL){
                //         $conn_id = ftp_connect("3.133.214.148") or die("Error in FTP connection - Live");
                //         $login_status = ftp_login($conn_id, "mainuser@quicklly.com", "n3At8hv3LZKCiF6") or die("Error in FTP login - Live");
						
				//    }
                //     else {
                //         $conn_id = ftp_connect("92.204.135.155") or die("Error in FTP connection");
                //         ftp_pasv($conn_id, true);
                        
                //         if($url==UATSITE_URL)
                //             $login_status = ftp_login($conn_id, "devgoquicklly", "7ZcS58nmn_MH31") or die("Error in FTP login");
                //         else
                //             $login_status = ftp_login($conn_id, "devpuneet@dev.goquicklly.com", "1}PG%zK}Ymvi") or die("Error in FTP login");
                //     }
                //      ftp_pasv($conn_id, true); 
    
                //     $destination_file = "images/feature/home/categories/app-photo/".$img;
                //     $upload_status = ftp_put($conn_id, $destination_file, $_FILES['AppIcon']['tmp_name'], FTP_BINARY);
                        
                //     if (!$upload_status)
                //         echo "Something went wrong, Contact to site administrator.";
                        
                //     ftp_close($conn_id);
                // }
                
                // // Upload locally to admin
                // move_uploaded_file($_FILES['AppIcon']['tmp_name'],"../images/feature/home/categories/app-photo/".$img);
                
                // //$Image->load("../upload_images/prods-deals/".$img);	  
                // //$Image->resize(300,300);	  
                // //$Image->save("../upload_images/prods-deals/".$img);	 
                // //CompressImage('../upload_images/prods-deals/'.$img, '../upload_images/prods-deals/'.$img, 50);

                // $AppIcon_tmp = 'images/feature/home/categories/app-photo/' . $img;
            }else{
                $AppIcon_tmp=$_POST['AppIcon_tmp'];
            }    
            // end app icon
            
             // start bgImage  
		if(isset($_FILES['bgImage']) && $_FILES['bgImage']['error'] === 0 && isValidImage($_FILES['bgImage'])) {
         
                $Image= new SimpleImage();
                $filename = $_FILES['bgImage']['name'];
                $ext = pathinfo($filename, PATHINFO_EXTENSION);
                
                $img=time()."-".$filename;

				$bgpath = $s3->upload($_FILES['bgImage']['tmp_name'], 'images/feature/home/bg-category-img',$img);

				if (!$bgpath) {
					die('BG image upload failed');
				}

				 $bgImage_tmp = 'images/feature/home/bg-category-img/' . $img;

                // Upload to main website FTP
            //     $url = SITE_URL;

            //     if($url ==MAINSITE_URL || $url==DEVSITE_URL ||
            //         $url==UATSITE_URL){

            //          if($url ==MAINSITE_URL){
            //             $conn_id = ftp_connect("3.133.214.148") or die("Error in FTP connection - Live");
            //             $login_status = ftp_login($conn_id, "mainuser@quicklly.com", "n3At8hv3LZKCiF6") or die("Error in FTP login - Live");
						
			// 	   }
            //         else {
            //             $conn_id = ftp_connect("92.204.135.155") or die("Error in FTP connection");
            //             ftp_pasv($conn_id, true);
                        
            //             if($url==UATSITE_URL)
            //                 $login_status = ftp_login($conn_id, "devgoquicklly", "7ZcS58nmn_MH31") or die("Error in FTP login");
            //             else
            //                 $login_status = ftp_login($conn_id, "devpuneet@dev.goquicklly.com", "1}PG%zK}Ymvi") or die("Error in FTP login");
            //         }
            //          ftp_pasv($conn_id, true); 
    
            //         $destination_file = "images/feature/home/bg-category-img/".$img;
            //         $upload_status = ftp_put($conn_id, $destination_file, $_FILES['bgImage']['tmp_name'], FTP_BINARY);
                        
            //         if (!$upload_status)
            //             echo "Something went wrong, Contact to site administrator.";
                        
            //         ftp_close($conn_id);
            //     }
                
            //     // Upload locally to admin
            //     move_uploaded_file($_FILES['bgImage']['tmp_name'],"../images/feature/home/bg-category-img/".$img);
                
            //     //$Image->load("../upload_images/prods-deals/".$img);	  
            //     //$Image->resize(300,300);	  
            //     //$Image->save("../upload_images/prods-deals/".$img);	 
            //     //CompressImage('../upload_images/prods-deals/'.$img, '../upload_images/prods-deals/'.$img, 50);

            //     $bgImage_tmp = 'images/feature/home/bg-category-img/' . $img;
            // }
		} else {
            $bgImage_tmp=$_POST['bgImage_tmp'];
        }     
        // end bgImage    
        
        //brand logo
		if (isset($_FILES['brandLogo']) && $_FILES['brandLogo']['error'] === 0 && isValidImage($_FILES['brandLogo'])) {
                $Image= new SimpleImage();
                $filename = $_FILES['brandLogo']['name'];
                $ext = pathinfo($filename, PATHINFO_EXTENSION);
                
                $img=time()."-".$filename;

				$brandpath = $s3->upload($_FILES['brandLogo']['tmp_name'], 'images/feature/home/brand',$img);
				if (!$brandpath) {
					die('Brand logo upload failed');
				}

				$brand_tmp = 'images/feature/home/brand/' . $img;

                // Upload to main website FTP
            //     $url = SITE_URL;

            //     if($url ==MAINSITE_URL || $url==DEVSITE_URL ||
            //         $url==UATSITE_URL){

            //         if($url ==MAINSITE_URL){
            //             $conn_id = ftp_connect("3.133.214.148") or die("Error in FTP connection - Live");
            //             $login_status = ftp_login($conn_id, "mainuser@quicklly.com", "n3At8hv3LZKCiF6") or die("Error in FTP login - Live");
						
			// 	   }
            //         else {
            //             $conn_id = ftp_connect("92.204.135.155") or die("Error in FTP connection");
            //             ftp_pasv($conn_id, true);
                        
            //             if($url==UATSITE_URL)
            //                 $login_status = ftp_login($conn_id, "devgoquicklly", "7ZcS58nmn_MH31") or die("Error in FTP login");
            //             else
            //                 $login_status = ftp_login($conn_id, "devpuneet@dev.goquicklly.com", "1}PG%zK}Ymvi") or die("Error in FTP login");
            //         }
            //          ftp_pasv($conn_id, true); 
    
            //         $destination_file = "images/feature/home/brand/".$img;
            //         $upload_status = ftp_put($conn_id, $destination_file, $_FILES['brandLogo']['tmp_name'], FTP_BINARY);
                        
            //         if (!$upload_status)
            //             echo "Something went wrong, Contact to site administrator.";
                        
            //         ftp_close($conn_id);
            //     }
                
            //     // Upload locally to admin
            //     move_uploaded_file($_FILES['brandLogo']['tmp_name'],"../images/feature/home/brand/".$img);
                
            //     //$Image->load("../upload_images/prods-deals/".$img);	  
            //     //$Image->resize(300,300);	  
            //     //$Image->save("../upload_images/prods-deals/".$img);	 
            //     //CompressImage('../upload_images/prods-deals/'.$img, '../upload_images/prods-deals/'.$img, 50);

            //     $brand_tmp = 'images/feature/home/brand/' . $img;
            // }
			} else {
                $brand_tmp=$_POST['bgImage_tmp'];
            }  
        //end brnd logo
            if($id=='')
            {
	    
            //$_SESSION['sess_msg']='Data added sucessfully';
            }
            else
            {
                $obj->query("update tbl_section set showing_name='".$showing_name."',app_font_color='$app_font_color',subTitle='".$subTitle."',
                deliveryInfo='".$deliveryInfo."',deliveryInfoColor='".$deliveryInfoColor."',bgColor='".$bgColor."',tagText='$tagText',tagTextColor='$tagTextColor',
                tagBgColor='$tagBgColor',display_order_web='$display_order_web',status='$status',sec_photo='$websiteIcon',app_photo='$AppIcon_tmp',bgImage='$bgImage_tmp',
                isBrand='$isBrand',brandImage='$brand_tmp',showingOn='$showingOn' where id='".$id."'");
    
            $_SESSION['sess_msg']='Data updated sucessfully';
            }
	 
                      header("location:manage-section.php");
		              exit();	
  	}  
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><?php echo SITE_TITLE; ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="css/admin.css" rel="stylesheet" type="text/css" />
<script>
  
	function checkall(objForm)
    {
	len = objForm.elements.length;
	var i=0;
	for( i=0 ; i<len ; i++){
		if (objForm.elements[i].type=='checkbox') 
		objForm.elements[i].checked=objForm.check_all.checked;
	}
   }
	function del_prompt(frmobj,comb)
		{
		//alert(comb);
			if(comb=='Delete'){
				if(confirm ("Are you sure you want to delete record(s)"))
				{
					frmobj.action = "home-page-del.php";
					frmobj.what.value="Delete";
					frmobj.submit();
					
				}
				else{ 
				return false;
				}
		}
		else if(comb=='Deactivate'){
			frmobj.action = "home-page-del.php";
			frmobj.what.value="Deactivate";
			frmobj.submit();
		}
		else if(comb=='Activate'){
			frmobj.action = "home-page-del.php";
			frmobj.what.value="Activate";
			frmobj.submit();
		}
		
		
	}

</script>

</head>
<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<?php include("header.php"); 
if(isset($_GET['id']))
{
    	$cardsname = $obj->query("SELECT * FROM tbl_section where id='".$_GET['id']."'");
                            $cardrow = $obj->fetchNextObject($cardsname);   
}
?>
<tr>
		<td align="right" class="paddRtLt70" valign="top">
			<table width="99%" border="0" cellspacing="0" cellpadding="0">
					<tr>
						
						<td align="right" valign="top">
							<table width="100%" border="0" cellspacing="0" cellpadding="0">
                               <!------------ Search Section ----------------->
                            <tr>
									<td align="left" valign="middle" class="bodr" style="padding-bottom:20px;">
									<table width="100%" border="0" cellspacing="0" cellpadding="3">
  
  <tr><td height="10"></td></tr>
  <tr>
    <td>
    <td height="100" align="left" valign="top" bgcolor="#f3f4f6" class="bodr">
                            <form name="frm" method="POST" enctype="multipart/form-data" action="">
						<input type="hidden" name="submitForm" value="yes" />
						<input type="hidden" name="display_page" value="2">
						<input type="hidden" name="id" value="<?php echo $_REQUEST['id'];?>" />
						<input type="hidden" name="websiteIcon_tmp" value="<?=@$cardrow->sec_photo?>">
						<input type="hidden" name="AppIcon_tmp" value="<?=@$cardrow->app_photo?>">
						<input type="hidden" name="bgImage_tmp" value="<?=@$cardrow->bgImage?>">
						<input type="hidden" name="brandLogo_tmp" value="<?=@$cardrow->brandLogo?>">
						
						
						
							<table width="100%" cellpadding="0" cellspacing="0">
									<tr>
										<td align="center" colspan="2" class="paddRt14 paddBot11">
										<font color="#FF0000"><strong><?php echo $_SESSION['sess_msg']; $_SESSION['sess_msg']='';?></strong></font></td>
									</tr>
									
										
									
										<tr >
										<td width="18%" align="right" class="paddBot11 paddRt14"> Display Name</td>
										<td width="82%" align="left" class="paddBot11">
									<input type="text" name="showing_name" value="<?=@$cardrow->showing_name?>" required>
										</td> 
									</tr>
										<tr >
										<td width="18%" align="right" class="paddBot11 paddRt14"> Display Name Font Color</td>
										<td width="82%" align="left" class="paddBot11">
									<input type="text" name="app_font_color" value="<?=@$cardrow->app_font_color?>" >
										</td> 
									</tr>
										<tr >
										<td width="18%" align="right" class="paddBot11 paddRt14">Sub Title</td>
										<td width="82%" align="left" class="paddBot11">
									<input type="text" name="subTitle" value="<?=@$cardrow->subTitle?>" >
										</td> 
									</tr>
										<tr >
										<td width="18%" align="right" class="paddBot11 paddRt14">Delivery Info</td>
										<td width="82%" align="left" class="paddBot11">
									<input type="text" name="deliveryInfo" value="<?=@$cardrow->deliveryInfo?>" >
										</td> 
									</tr>
										<tr >
										<td width="18%" align="right" class="paddBot11 paddRt14">Delivery Font Color</td>
										<td width="82%" align="left" class="paddBot11">
									<input type="text" name="deliveryInfoColor" value="<?=@$cardrow->deliveryInfoColor?>"  >
										</td> 
									</tr>
										<tr >
										<td width="18%" align="right" class="paddBot11 paddRt14">Website Icon</td>
										<td width="82%" align="left" class="paddBot11">
									<input type="file" name="websiteIcon"  >
									<br>
									<?php
									if($cardrow->sec_photo!='')
									{
									?>
									<img style="width:60px;" src="<?= SITE_URL_CDN . $cardrow->sec_photo ?>">
									<?php
									}
									?>
										</td> 
									</tr>
										<tr >
										<td width="18%" align="right" class="paddBot11 paddRt14">APP Icon</td>
										<td width="82%" align="left" class="paddBot11">
									<input type="file" name="AppIcon"  >
										<?php
									if($cardrow->app_photo!='')
									{
									?>
										<br>
									<img style="width:60px;" src="<?= SITE_URL_CDN . $cardrow->app_photo ?>">
										</td> 
										<?php
									}
										?>
									</tr>
										<tr >
										<td width="18%" align="right" class="paddBot11 paddRt14">BG Image</td>
										<td width="82%" align="left" class="paddBot11">
									<input type="file" name="bgImage"  >
										<?php
									if($cardrow->bgImage!='')
									{
									?>
										<br>
										<img style="width:60px;" src="<?= SITE_URL_CDN . $cardrow->bgImage ?>">
									<?php
									}
									?>
										</td> 
									</tr>
										<tr >
										<td width="18%" align="right" class="paddBot11 paddRt14">BG Color</td>
										<td width="82%" align="left" class="paddBot11">
									<input type="text" name="bgColor" value="<?=$cardrow->bgColor?>" >
									
										</td> 
									</tr>
									
										<tr >
										<td width="18%" align="right" class="paddBot11 paddRt14">Brand Logo</td>
										<td width="82%" align="left" class="paddBot11">
									<input type="file" name="brandLogo"  >
										<?php
									if($cardrow->brandImage!='')
									{
									?>
										<br>
								<img style="width:60px;" src="<?= SITE_URL_CDN . $cardrow->brandImage ?>">
									<?php
									}
									?>
										</td> 
									</tr>
										<tr >
										<td width="18%" align="right" class="paddBot11 paddRt14">Tag Name</td>
										<td width="82%" align="left" class="paddBot11">
									<input type="text" name="tagText" value="<?=$cardrow->tagText?>" >
									
										</td> 
									</tr>
									<tr >
										<td width="18%" align="right" class="paddBot11 paddRt14">Tag Name Color</td>
										<td width="82%" align="left" class="paddBot11">
									<input type="text" name="tagTextColor" value="<?=$cardrow->tagTextColor?>" >
									
										</td> 
									</tr>
										<tr >
										<td width="18%" align="right" class="paddBot11 paddRt14">Tag Name Bg Color</td>
										<td width="82%" align="left" class="paddBot11">
									<input type="text" name="tagBgColor" value="<?=$cardrow->tagBgColor?>" >
									
										</td> 
									</tr>
								    <tr >
										<td width="18%" align="right" class="paddBot11 paddRt14"> Is Brand</td>
										<td width="82%" align="left" class="paddBot11">
									<input type="checkbox" name="isBrand" value="1" <?php if($cardrow->isBrand==1){ echo "checked"; } ?>  >
										</td> 
									</tr>
									<tr >
										<td width="18%" align="right" class="paddBot11 paddRt14"> Display Order</td>
										<td width="82%" align="left" class="paddBot11">
									<input type="number" name="display_order_web" value="<?=@$cardrow->display_order_web?>" >
										</td> 
									</tr>
									
										<tr >
										<td width="18%" align="right" class="paddBot11 paddRt14">Showing PlatForm</td>
										<td width="82%" align="left" class="paddBot11">
									<input type="text" name="showingOn" value="<?=@$cardrow->showingOn?>" placeholder="WEBSITE,IOS,ANDROID">
										</td> 
									</tr>
									
								<tr >
										<td width="18%" align="right" class="paddBot11 paddRt14"> Status</td>
										<td width="82%" align="left" class="paddBot11">
										<select name="status" required>
                                      <option value="">Select Status</option>
                                      <option value="1" <?php if(@$cardrow->status=="1"){ echo "selected"; } ?>>Active</option>
                                      <option value="0" <?php if(@$cardrow->status=="0"){ echo "selected"; } ?>>Deactive</option>
                                      </select>
										</td> 
									</tr>
									
							  
								
									
									
						
									<tr>
										<td width="18%" align="right" class="paddRt14 paddBot11">&nbsp;</td>
										<td width="82%" align="left" class="paddBot11">
											<input type="submit" name="submit" value="Submit"  class="submit" border="0"/> 	                  		 &nbsp;&nbsp;
											<input name="Reset" type="reset" id="Reset" value="Reset" class="submit" border="0" /></td>
									</tr>
								</table></form>
							</td>
</td>
  </tr>
</table>

									</td>
								</tr>
                                <tr><td height="10"></td></tr>
                                
                                <!----- Search End --------->
								<tr>
									<td align="left" valign="middle" class="headingbg bodr text14">
									<em><img src="images/arrow2.gif" width="21" height="21" hspace="10" align="absmiddle" /></em>
									<span  style="float:right; padding-right:10px;">
					                </span>
									</td>
								</tr>
								<form name="frm" method="post" action="#" enctype="multipart/form-data">
									<tr>
										<td height="100" align="left" valign="top" bgcolor="#FFFFFF" class="bodr">
											<table width="100%" cellpadding="0" cellspacing="0">
											<?php if($_SESSION['sess_msg']){ ?>
											<tr><td  align="center"><font color="#FF0000"><strong><?php echo $_SESSION['sess_msg'];$_SESSION['sess_msg']='';?></strong></font></td></tr>
											
											<?php }?>
												<tr>
														<td align="left">
															<?php 

$sql2=$obj->query("select * from tbl_section order by id asc");
$reccnt=$obj->numRows($sql2);

															if($reccnt==0)
															{
															?>
																<table width="100%" border="0" cellspacing="0" cellpadding="0">
																	<tr>
																		<td align="center" valign="middle"><font face="Arial, Helvetica, sans-serif"   color="#FF0000" size="+1">No Record</font></td>
																	</tr>
																</table>
															<?php 
															}
															else
															{
															?>
															<table width="100%" border="0" cellspacing="0" cellpadding="0">
                                                            <tr><td align="center" colspan="15"><strong><?php echo $reccnt; ?> Record Found.</strong></td></tr>
																<tr>
																	<td width="2%" align="left" class="padd5" bgcolor="#f3f4f6"><strong>S No.</strong></td>
																	<td width="2%" align="left" class="padd5" bgcolor="#f3f4f6"><strong>SectionID</strong></td>
																		<td width="2%" align="left" class="padd5" bgcolor="#f3f4f6"><strong>Section Name</strong></td>
																	<td width="5%" align="left" class="padd5" bgcolor="#f3f4f6"><strong>Section Slug</strong></td>
                                                      <td width="5%" align="center" bgcolor="#f3f4f6" class="padd5"><strong>Display Name</strong></td>
                                               
                                               					<td width="9%" align="center" bgcolor="#f3f4f6" class="padd5"><strong>Subtitle</strong></td>
                                               					
                                               					<td width="9%" align="center" bgcolor="#f3f4f6" class="padd5"><strong>DeliveryInfo</strong></td>
                                               					<td width="9%" align="center" bgcolor="#f3f4f6" class="padd5"><strong>Showing On</strong></td>
                                               				<td width="9%" align="center" bgcolor="#f3f4f6" class="padd5"><strong>Is Brand</strong></td>
                                               				
																	<td width="9%" align="center" bgcolor="#f3f4f6" class="padd5"><strong>Status</strong></td>
															
																	<td width="4%" align="center" class="padd5" bgcolor="#f3f4f6"><strong>Action</strong></td>
																  <td width="14%" align="center" bgcolor="#f3f4f6" class="padd5" >  <input name="check_all" type="checkbox"   id="check_all" onclick="checkall(this.form)" value="check_all" /></td>
																</tr><form method="post">
																<?php
																$i=0;
																while($line=$obj->fetchNextObject($sql2))
																{
																$i++;
															
																
																if($i%2==0)
																{
																$bgcolor = "#f3f4f6";
																}
																else
																{
																$bgcolor = "";
																}
																?>
																	<tr bgcolor="<?php echo $bgcolor;?>">
																		<td class="padd5"><strong><?php echo $i+$start; ?>.</strong></td>
																		
																	
																		<td class="padd5"><?php  echo $line->id; ?></td>
                                                                     
									
                                        <td class="padd5"><?php echo $line->section_name; ?></td>
                                         
                                          
                                         
                                                                        <td align="center" valign="middle" class="padd5"><?=$line->section_slug;?></td>
                                                                        <td align="center" valign="middle" class="padd5"><?=$line->showing_name;?></td>
                                                                        <td align="center" valign="middle" class="padd5"><?=$line->subTitle;?></td>
                                                                        <td align="center" valign="middle" class="padd5"><?=$line->deliveryInfo;?></td>
                                                                        <td align="center" valign="middle" class="padd5"><?=$line->showingOn;?></td>
                                                                         <td align="center" valign="middle" class="padd5"><?=$line->isBrand;?></td>
																		<td align="center" valign="middle" class="padd5">
																		<?php if($line->status==1){?><img src="images/enable.gif" border="0" title="Activated" /> <?php } else{ ?><img src="images/disable.gif" border="0" title="Deactivated" /><?php }?>																			</td>
																		<td align="center" valign="middle" class="padd5">
<a href="manage-section.php?id=<?php echo $line->id;?>" ><img src="images/edit3.gif" border="0" title="Edit" /></a><br/>
                                                                    
																																		</td>
																		<td align="center" valign="middle" class="padd5">
																	<input type="checkbox" name="ids[]" value="<?php echo $line->id;?>" />																		</td>
																	</tr>
																<?php
																
																}
																
																?>																<tr></tr>																<tr>															
															<!--	<td colspan="5"><button class="button" type="submit">Change Display Order</button></td>	-->															</tr></form>
													<tr>
                          <td valign="top" colspan="15"  align="right">&nbsp;</td>   </tr>    			
	<tr>
                          <td valign="top" colspan="15"  align="right" class="dark_red" style="padding-right:150px;"><?php include("../include/paging.inc.php"); ?></td>   </tr>    			
	<tr>
	  <td align="right"  style="padding-right:80px;" colspan="15">&nbsp;</td>
	  </tr>
	<tr>
	  <td align="right"  style="padding-right:80px;" colspan="15">&nbsp;</td>
	  </tr>
	<!--<tr><td align="right"  style="padding-right:80px;" colspan="15"> <input type="hidden" name="what" value="what" />
						<input type="submit" name="Submit" value="Activate" class="button" onclick="return del_prompt(this.form,this.value)" />
                        <input type="submit" name="Submit" value="Deactivate" class="button" onclick="return del_prompt(this.form,this.value)" />
                        <input type="submit" name="Submit" value="Delete" class="button" onclick="return del_prompt(this.form,this.value)" /></td></tr>-->
															</table>
															<?php }?>
														</td>
												</tr>
												
											</table>
										</td>
									</tr>
								</form>
							</table>
						</td>
					</tr>
			</table>
		</td>
</tr>
<tr><td height="100"></td></tr>
<?php include('footer.php'); ?>
<script src="https://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<script>
    function get_type(a)
    {
       
        if(a=='predefined'){
            $("#type").show();
            $("#sections").prop('required',true);
            $("#section_id").hide();
            $("#store_id").hide();
        }else
        {
            $("#sections").prop('required',false);
            $("#type").hide();
            $("#section_id").show();
            $("#store_id").show();
            
        }
        
    }
     function getStores(section_id)
     {
       
      $.ajax({
        url: 'ajax-get-store.php',
        type: 'post',
        data: { "sectionid": section_id},
        success: function(response) { 
            
            $("#stores_id").html(response);
        }
    });
     }
</script>

</table>
</body>
</html>