<?php $this->load->view("includes/header");
$id = $this->uri->segment(4, 0);
$res = $this->db->query("SELECT * FROM wps_categories WHERE category_id='".$id."'")->row_array();
//echo "select location_id from wps_subcontent where category_id = '".$res['category_id']."' group by location_id";
//echo "SELECT meta_id,page_url FROM wps_meta_tags WHERE is_fixed='L' and meta_id NOT IN(select location_id from wps_subcontent where category_id = '".$res['category_id']."' group by location_id) ORDER BY page_url";
$locations = $this->db->query("SELECT meta_id,page_url FROM wps_meta_tags WHERE is_fixed='L' and meta_id NOT IN(select location_id from wps_subcontent where category_id = '".$res['category_id']."' group by location_id) ORDER BY meta_id asc")->result_array();
 ?>
<div class="page-title">
  <h2><span><?php echo $heading_title; ?></span></h2>
  <a href="javascript:void(0);" onclick="history.back();" class="btn btn-primary pull-right">Cancel</a>
</div>
<div class="page-content-wrap"> 
  <div class="fix"></div>

  <div class="row">

    <div class="col-md-12">

      <div class="panel panel-default">
        <div class="panel-body">
          <?php echo form_open_multipart("", 'class="form-horizontal"'); ?>
          <div class="form-group">
            <label class="col-md-3 col-xs-12 control-label"><span class="required">*</span>Category</label>
            <div class="col-md-6">
              <select name="category_id[]" id="categorIds" class="form-control" required >
                <option value="<?=$res['category_id'];?>"><?=$res['category_name'];?></option>
              </select>
              <?php echo form_error('category_id'); ?>
            </div>
          </div>
          <div class="form-group">
            <label class="col-md-3 col-xs-12 control-label">Locations</label>
            <div class="col-md-6">
              <select name="location_id[]" id="categorIds" class="form-control" multiple size="7">
                <option value="">--Select--</option>
                <?php
                foreach($locations as $lk=>$lval){
                  $selArray = ($this->input->post('location_id'))?$this->input->post('location_id'):array();
                  $sel = (in_array($lval['meta_id'], $selArray))?'selected':'';
                  ?><option value="<?php echo $lval['meta_id'];?>" <?php echo $sel; ?>>-<?php echo ucwords($lval['page_url']);?></option><?php
                }
                ?>
              </select>
            </div>
          </div>
          <div class="form-group">
            <label class="col-md-3 col-xs-12 control-label">Page Heading</label>
            <div class="col-md-6 col-xs-12">     
              <input type="text" class="form-control" name="page_heading" id="title" value="<?php echo set_value('page_heading'); ?>" />
              <?php echo form_error('page_heading'); ?>
              <br /><b style="color:#660000;">Buy {catname} online in {location}</b>
            </div>
          </div>
          
          <div class="form-group">
            <label class="col-md-3 col-xs-12 control-label"><span class="required">**</span>Description</label>
            <div class="col-md-6 col-xs-12">     
              <textarea class="form-control" name="description" id="description"><?php echo set_value('description'); ?></textarea><?php echo form_error('description'); ?><?php echo display_ckeditor($ckeditor); ?><br /><b style="color:#660000;">Contrary to {location} belief, Lorem {catname} is not simply random text.</b>
            </div>
          </div>

          <div class="form-group">
            <label class="col-md-3 col-xs-12 control-label"><span class="required">**</span>Short Description</label>
            <div class="col-md-6 col-xs-12">     
              <textarea class="form-control" name="short_description" id="short_description"><?php echo set_value('short_description'); ?></textarea><?php echo form_error('short_description'); ?><br /><b style="color:#660000;">Contrary to {location} belief, Lorem {catname} is not simply random text.</b>
            </div>
          </div>

          <div class="form-group">
            <label class="col-md-3 col-xs-12 control-label"><span class="required">**</span>Title</label>
            <div class="col-md-6 col-xs-12">     
              <input type="text" class="form-control" name="meta_title" id="title" value="<?php echo set_value('meta_title'); ?>" />
              <?php echo form_error('meta_title'); ?>
              <br /><b style="color:#660000;">{catname} manufacturer in {location}</b>
            </div>
          </div>

          <div class="form-group">
            <label class="col-md-3 col-xs-12 control-label"><span class="required">**</span>Keywords</label>
            <div class="col-md-6 col-xs-12"> 
              <textarea class="form-control" name="meta_keyword" rows="5" cols="80" id="keyword" ><?php echo set_value('meta_keyword'); ?></textarea><?php echo form_error('meta_keyword'); ?>
              <br /><b style="color:#660000;">{catname} manufacturer in {location}</b>
            </div> 
          </div>

          <div class="form-group">
            <label class="col-md-3 col-xs-12 control-label"><span class="required">**</span>Description</label>
            <div class="col-md-6 col-xs-12"> 
              <textarea class="form-control" name="meta_description" rows="5" cols="80" id="description" ><?php echo set_value('meta_description'); ?></textarea><?php echo form_error('meta_description'); ?>
              <br /><b style="color:#660000;">{catname} manufacturer in {location}</b>
            </div> 
          </div>
          
         


          <div class="form-group">
            <div class="col-md-9">                                                     
              <input type="submit" class="btn bg-red pull-right" name="submit" value="Submit">                    </div>
          </div>
          <?php echo form_close(); ?>
        </div>
      </div>
    </div>
  </div>
</div>
<?php $this->load->view("includes/footer"); ?>


