<?php
include("lib/config.php");

$groupID = isset($_GET["gid"])?$_GET["gid"]:'';
?>

<div class="box-content">
  <form method="post" name="frmGroups" id="frmGroups">
    <input type="hidden" name="action" value="modulesAccess">
    <input type="hidden" name="group_id" value="<?php echo(isset($groupID))?$groupID:'';?>">
   
    <div>
    <table class="table table-striped table-bordered dataTable no-footer">
        <thead>
          <tr>
            <th>Sr#</th>
            <th>Module</th>
          </tr>
        </thead>
        <tbody>
		  <?php 
            $counter_modules = 0;
            $selQry_mod = "SELECT ".TBL_MODULES.".module_name,".TBL_MODULES.".module_description 
            FROM ".TBL_GROUPS_PERMISSIONS."
            INNER JOIN ".TBL_MODULES." ON (".TBL_GROUPS_PERMISSIONS.".module_id = ".TBL_MODULES.".id)
            WHERE ".TBL_GROUPS_PERMISSIONS.".group_id = '".$groupID."';";
            $modInfo =  $con->getMultiRow($selQry_mod, __FILE__,__LINE__);
            $totMods = count($modInfo);	
                for($m=0;$m<$totMods;$m++)
                {
                    $counter_modules++;
           ?>
          <tr>
            <td><?php echo $counter_modules;?>.</td>
            <td><?php echo $modInfo[$m]['module_name'];?></td>
          </tr>
          <?php }?>
        </tbody>
      </table>
    </div>    
    <div style="margin-top:30px; text-align:right;">
      <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
    </div>
  </form>
</div>