<?php
define('Admin_USER',true);
session_start();
if(!isset($_SESSION['adm1n']) || $_SESSION['adm1n']['Nbr'] == ''){
  
       header("Location: ../misc/default.php");
       exit;
       
}
require_once("../../includes/php/defines.php");
require_once("../../includes/php/classes/mainClass.php");
require_once("../../includes/php/classes/navUtility.php");

$nav = new navigationUtility();
$categories = $nav->getOptionCategories();
$options = $nav->getCategoryOptions('',true);
?>
<section>
<div class="container-fluid">
    <div class="container">
        <div class="col-md-4">
            <div class="col-md-12 result-heading">
                <div class="rh-form">
                    <div class="col-md-10"> 
                        <h1>&nbsp;</h1>
                        <form id="Search_Form">                            
                            <div class="form-group">
                                   <label>Category Option</label>
                                   <select  class="col-md-12" id="Category" name="Category">
                                          <option value="">- choose -</option>
                                          <?php
                                            for($i=0;$i<count($categories);$i++){

                                                    echo '<option value="'.$categories[$i]['Nbr'].'">'.$categories[$i]['Name'].'</option>';

                                            }
                                          ?>
                                   </select>
                            </div>
                            <div class="form-group" id="Search_Submit_Paragraph" name="Search_Submit_Paragraph">
                                <input type="button" value="submit" onclick="processSearch('Category-Options','No_Clear');">
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
        <div class="col-md-8">
            <div class="col-md-12 result-heading">
                <h1 id="ResultsTitle" name="ResultsTitle">your results</h1>&nbsp;
              <div id="Animation">
                  <div class="blockG" id="rotateG_01"></div>
                  <div class="blockG" id="rotateG_02"></div>
                  <div class="blockG" id="rotateG_03"></div>
                  <div class="blockG" id="rotateG_04"></div>
                  <div class="blockG" id="rotateG_05"></div>
                  <div class="blockG" id="rotateG_06"></div>
                  <div class="blockG" id="rotateG_07"></div>
                  <div class="blockG" id="rotateG_08"></div>                                            
              </div>
              <div id="Result" style="margin-bottom:25px;"></div>               
            </div>
              <div id="RowContainer">
              <?php             
                    if($options[0]['Nbr'] != ''){

                           for($i=0;$i<count($options);$i++){

                                  echo '<div class="col-md-12';
                                  if($i == 0 || $i%2 == 0) { echo ' light-white'; }
                                  echo '" id="Row_'.$options[$i]['Nbr'].'" name="Row_'.$options[$i]['Nbr'].'">';
                                  echo '<div class="result-form">';
                                  echo '<h2>'.$options[$i]['Category_Name'].' | <em>'.$options[$i]['Name'].'</em></h2>';
                                  echo '<p>'.$options[$i]['Desc'].'</p>';
                                  echo '<p style="padding-top:20px;">[ <span class="edit" title="Edit '.$options[$i]['Name'].'" onclick="contentChanger(\'navigation/edit-option.php\',\''.$options[$i]['Nbr'].'\');">EDIT</span> ] &nbsp;|&nbsp; [ <span class="delete" title="Delete '.$options[$i]['Name'].'" onclick="deleteRow(\'Delete-Navigation-Option\',\''.$options[$i]['Nbr'].'\')">DELETE</span> ]</p>';
                                  echo '</div>';
                                  echo '</div>';

                           }

                    }else{
                           
                           echo '<div class="col-md-12 light-white><div class="result-form"><h2>Your search returned no records matching your search criteria</h2></div></div>';
                           
                    }  
               ?>
              </div>            
        </div>
    </div>
</div>
</section>