<?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/adminUtility.php");

$admin = new adminUtility;
$info = $admin->getAdministrators();

?>
<section>
<div class="container-fluid">
    <div class="container">
            <div class="col-md-12 result-heading">
                <h1>Administrators</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($info[0]['Nbr'] != ''){
                     
                     for($i=0;$i<count($info);$i++){
                         
                            echo '<div class="col-md-12';
                            if($i == 0 || $i%2 == 0) { echo ' light-white'; }
                            echo '" id="Row_'.$info[$i]['Nbr'].'" name="Row_'.$info[$i]['Nbr'].'">';
                            echo '<div class="result-form">';
                            echo '<h2>'.$info[$i]['First_Name'].' '.$info[$i]['Last_Name'].'</h2>';
                            echo $info[$i]['Email'];
                            echo '<p style="padding-top:20px;">';
                            echo '[ <span class="edit" title="Edit '.$info[$i]['First_Name'].' '.$info[$i]['Last_Name'].'" onclick="contentChanger(\'administrative/modify-administrator.php\',\''.$info[$i]['Nbr'].'\');">EDIT</span> ] &nbsp;|&nbsp; ';
                            echo '[ <span class="edit" title="Change Password For '.$info[$i]['First_Name'].' '.$info[$i]['Last_Name'].'" onclick="contentChanger(\'administrative/change-admin-password.php\',\''.$info[$i]['Nbr'].'\');">CHANGE PASSWORD</span> ] &nbsp;|&nbsp; ';
                            echo '[ <span class="delete" title="Delete '.$info[$i]['First_Name'].' '.$info[$i]['Last_Name'].'" onclick="deleteRow(\'Delete-Admin\',\''.$info[$i]['Nbr'].'\')">DELETE</span> ]';                            
                            echo '</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>
</section>