<script src="https://cdn.ckeditor.com/4.7.1/standard/ckeditor.js"></script>
<section class="content-header">
  <h1>Testimonials</h1>
  <ol class="breadcrumb">
    <li><a href="<?php echo base_url().'admin';?>"><i class="fa fa-dashboard"></i> Home</a></li>
    <li><a href="<?php echo base_url('admin/testimonial');?>">Testimonials</a></li>
    <li class="active">Add</li>
  </ol>
</section>
<section class="content">
  <div class="row">
    <?php echo $this->utility->showMsg();?>
    <div class="col-md-12">
      <div class="loader" style="display:none;"><img src='<?php echo base_url();?>assets/images/loading.gif' alt='loading' /></div>
      <div class="box box-info">
        <div class="box-header with-border">
          <h3 class="box-title">Edit </h3>
        </div>
        <form id="add_frm" name="add_frm" class="form-horizontal" method="post" action="" enctype="multipart/form-data" onsubmit="return formValidate();">
        
          <div class="box-body">
            <div class="form-group">
              <label class="col-sm-2 control-label">Name</label>
              <div class="col-sm-6">
              <input type="text" class="form-control required" required id="name" name="name" value="<?php if(!empty($advertDetails['name'])){ echo $advertDetails['name']; }?>" placeholder="Please enter name">
              </div>
            </div>
          </div>
     
          <div class="box-body">
            <div class="form-group">
              <label class="col-sm-2 control-label">Text</label>
              <div class="col-sm-6">
              <textarea name="text" class="form-control"><?php echo $advertDetails['text']; ?></textarea>
                  <script>
                           CKEDITOR.replace( 'text',{
                                    filebrowserBrowseUrl : '/castle/fileman/index.html',
                                    filebrowserImageBrowseUrl : '/castle/fileman/index.html?type=image',
                                    removeDialogTabs: 'link:upload;image:upload'
                            });
                        </script> 
              </div>
            </div>
          </div>
     
        <div class="box-body">
            <div class="form-group">
              <label class="col-sm-2 control-label">Image</label>
              <div class="col-sm-6">
              <?php $files = getFiles($advertDetails['image_id']); ?>
                    <img src="<?php echo base_url().'assets/userfiles/'.$files['path'].'/'.$files['filename'].'.'.$files['extension']; ?>" width="100">
					<input type="file" class="form-control" name="file">
                
              </div>
            </div>
          </div>
          <div class="box-footer">
            <button type="button" onclick="return_back()"class="btn btn-default  margin-left  " >Cancel</button>
            <input type="submit" class="btn btn-info " value="Update" id="add">
          </div>
        </form>
      </div>
    </div>
  </div>
</section>
 <script type='text/javascript'>
  $("#add_frm").validate({
        rules: {
          'name': {
            required: true,
          },
          'text': {
            required: true,
          }
        }
      });
      
</script>
 <script type="text/javascript">
  function return_back(){
    var back_url='<?php echo base_url()?>admin/testimonial';
    window.location=back_url;
  }
 </script>