<?php require_once './utility/texteditor_utility.php';?>
<?php
$req = $_POST['List'];
if(empty($req)){
		$req ="Add";
}
$ctrl_name = BASE_URL."/homebanners";
$page_name = BASE_URL."/homebanners/".$req;
$num = $cnt;
?>
<style>
		.black_overlay{
			display: none;
			position:fixed;
			top: 0%;
			left: 0%;
			width: 100%;
			height: 100%;
			background-color: black;
			z-index:1001;
			-moz-opacity: 0.7;
			opacity:.70;
			filter: alpha(opacity=70);
		}
		.white_content {
			display: none;
			position:fixed;
			top: 30%;
			left: 32%;
			width: 470px;
			height: 600px;
			z-index:1002;
			overflow: auto;
		}
</style>
<h1 class="page-header"><?php echo $_REQUEST["List"]?> Home Banner</h1>          
<div class="bs-example table-responsive">
	<table align="center" width="100%" border="0">    	
    	 <?php if(!empty($error_msg)) {?>     
            <tr>
                <td align="center">  
                  <div class="col-lg-8 alert alert-danger" style="clear:right">
                    <?php echo $error_msg;?>
                 </div>             
                </td>
             </tr>   
			 
         <?php } ?> 
		 	<tr>
                <td align="center">  
                  <div style="clear:right" align="right">
                   <button value="AddRecord" type="button" name="AddButton" class="btn btn-primary" onclick="location.href='<?php echo BASE_URL?>/homebanners/index'">Back to Home Banners</button>
                 </div>             
                </td>
             </tr>   
        <tr>
        	<td align="center">       
             <div class="col-lg-12">
             <div class="well">
                  <form name="frm" id="frm" method="post" class="bs-example form-horizontal" enctype="multipart/form-data">
                  <input type="hidden" name="act" id="act" value="" />
				  <input type="hidden" name="List" value="<?php echo $_REQUEST['List']?>">
					<input type="hidden" name="homebanner_id" id="homebanner_id" value="<?php echo $userDetails->id?>" />
                    <fieldset>                  
                      <div class="form-group">
                          <label class="col-lg-2 control-label" for="name">Title</label>
                        <div class="col-lg-8">
                          <input name="title" type="text" class="validate[required] form-control" id="title" value="<?php echo $userDetails->title?>" />
                        </div>
                      </div>
                      <div class="form-group">
                          <label class="col-lg-2 control-label" for="name">Image</label>
                        <div class="col-lg-8" align="left">
                          <input type="file" name="simage" id="simage" /> (only <?php echo VALID_EXT_HOMEBANNERS." files allowed";?>) 
                        </div>
                      </div>
                      <div class="form-group">
                          <label class="col-lg-3 control-label" for="page_content"></label>
                        <div class="col-lg-6">
                          <?php 
					  if(!empty($userDetails->simage)){
								 ?>
							 	<table align="center" border="0" cellpadding="3" cellspacing="3" width="100%">
                               	   <tr>	
                                   		<td width="133"><?php if(!empty($userDetails->simage)){?> <img src="<?php echo "../". UPLOADDIR_HOMEBANNERS."/".$userDetails->simage?>?<?php echo date("YmdHis")?>" width="100" height="100" alt="<?php echo SEO_IMAGE_ALT; ?>" title="<?php echo SEO_IMAGE_TITLE; ?>"> <?php }?><input type="hidden" name="homebanner_image_old" value="<?php echo $userDetails->simage?>">
										</td>
                                   	   
                                   </tr>
                               </table>
                             <?php } ?>
                        </div>
                      </div>
					  <div class="form-group">
                          <label class="col-lg-2 control-label" for="designer_email">Status</label>
                        <div class="col-lg-8" align="left">
                          <select name="status" id="status" class="form-control" style="width:100px; text-align:left">
												  	<option value="1" <?php if($userDetails->status==1){echo "selected";}?>>Active</option>
													<option value="0" <?php if($userDetails->status==0){echo "selected";}?>>Inactive</option>
												  </select>
                        </div>
                      </div>
                  
                      <div class="form-group">
                        <div class="col-lg-8 col-lg-offset-1">                    
                          <button class="btn btn-primary" name="Submit" type="submit" value="Submit">Submit</button>&nbsp; <button class="btn btn-primary" name="Cancel" type="button" value="Cancel" onclick="location.href='<?php echo BASE_URL?>/homebanners/index'">Cancel</button>
                        </div>
                      </div>
                    </fieldset>
                  </form>
            </div>
          </div>
            </td>
        </tr>
    </table>
</div>
<script type="text/javascript">
$(document).ready(function() {
    $('#frm').bootstrapValidator({
        message: 'This value is not valid',
        fields: {
            title: {
                message: 'The Title is not valid',
                validators: {
                    notEmpty: {
                        message: 'The Title is required and can\'t be empty'
                    }
                }
            },simage: {
                message: 'The Image is not valid',
                validators: {
                    notEmpty: {
                        message: 'The Image is required and can\'t be empty'
                    }
                }
            }
        }
    });
});
</script>