<?
include_once('../hdr_general.php');		// fails!!
/* **************************************************************************************************** */
$pubmodule = $_REQUEST["module"];
$pubtask = $_REQUEST["task"];
$pubitemid = $_REQUEST["itemid"];

$pubgroupid=$_REQUEST['groupid'];

/* **************************************************************************************************** */
?>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="../css/general.css" type="text/css" media=all>
<link rel="stylesheet" href="../css/print.css" type="text/css" media="print">
<title>CS-SECURE : Reports</title>
</head>
<body leftmargin=5 topmargin=5 style="background: #ffffff;">
<table border=0 cellspacing=0 cellpadding=0 width=760>
<tr valign=top>
<td valign=top width=760px>

  <?
  include_once('../models/systemModel.php');
  include_once('../models/userModel.php');
  $mysystemModel=new systemModel;
  $myuserModel=new userModel;

  $group_list = $myuserModel->getlist_usergroups($pubgroupid);
  if ($pubgroupid=="") { $mygroupname="All Groups"; } else { $mygroupname=$group_list[0]['group_name']; }
  ?>  

  <table border=0 cellspacing=1 cellpadding=2 width=760 style="border: 0px;">
  <tr valign=top>
  <td valign=top width=420 class=reportpageheader align=left><font style="font-size: 12px; font-weight: bold;">CyberSecurity Malaysia</font></td>
  <td valign=top width=340 colspan=2 class=reportpageheader align=right><font style="font-size: 12px; font-weight: bold;">Confidential</font></td>
  </tr>
  <tr valign=top>
  <td valign=top width=100% colspan=3 class=newscontent><hr size=1 style="border: 1px solid black;"><br></td>
  </tr>
  <tr valign=top>
  <td valign=top width=420 class=reportheader><font style="font-size: 14px; font-weight: bold;">User Groups Report</font></td>
  <td valign=top width=100 class=reportheader>User Name</td>
  <td valign=top width=240 class=reportheader>: <?=$_SESSION['Xstaffname'];?></td>
  </tr>
  <tr valign=top>
  <td valign=top width=420 class=reportcontent>User Group: <?=$mygroupname;?></td>
  <td valign=top width=100 class=reportcontent>Print Date</td>
  <td valign=top width=240 class=reportcontent>: <?=date('d F Y - h:i A');?></td>
  </tr>
  </table>

  <br>

  <? foreach ($group_list as $mygroup) { ?>

    <table border=0 cellspacing=1 cellpadding=2 width=760 style="border: 0px;">
    <tr valign=top>
    <td valign=top width=100% colspan=2 class=newscontent><hr size=2 style="border: 2px solid black;"><br></td>
    </tr>
    <tr valign=top>
    <td valign=top width=150 class=reportcontent>Group Name</td>
    <td valign=top width=610 class=reportcontent>: <?=$mygroup['group_name'];?></td>
    </tr>
    <tr valign=top>
    <td valign=top width=150 class=reportcontent>Description</td>
    <td valign=top width=610 class=reportcontent>: <?=$mygroup['group_description'];?></td>
    </tr>
    </table>

    <br>

    <table border=0 cellspacing=0 cellpadding=2 width=760 style="border: 0px;">
    <tr valign=top>
    <td valign=top width=40 class=reportlistheader>No</td>
    <td valign=top width=250 class=reportlistheader>Name</td>
    <td valign=top width=220 class=reportlistheader>Designation</td>
    <td valign=top width=250 class=reportlistheader>Department</td>
    </tr>
    <tr valign=top>
    <td valign=top width=760 colspan=4 class=reportcontent>&nbsp;</td>
    </tr>
    </table>

    <? $staff_list = $myuserModel->getlist_staffbygroup($mygroup['group_pkey']); ?>

    <table border=0 cellspacing=1 cellpadding=2 width=760 style="border: 0px;">

    <? foreach ($staff_list as $mystaff) { ?>

      <tr valign=top>
      <td valign=top width=40 class=reportlistnumber><?=$mystaff['recordno'];?>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
      <td valign=top width=250 class=reportlistcontent><?=$mystaff['staff_name'];?></td>
      <td valign=top width=220 class=reportlistcontent><?=$mystaff['staff_designation'];?></td>
      <td valign=top width=250 class=reportlistcontent><?=$mystaff['dept_name'];?></td>
      </tr> 

    <? } ?>

    <tr valign=top>
    <td valign=top width=760 colspan=4 class=reportcontent>&nbsp;</td>
    </tr>
    </table>

  <? } ?>

  </table>

  <span class="noprint">
  <br><hr size=1 style="border: 1px solid black;"><br>
  <button name="printreport" id="printreport" onClick="javascript:print_report();">&nbsp;Print&nbsp;</button>
  </span>

</tr>
</table>
</body>
</html>

<!-- MeadCo ScriptX -->
<!-- For IE 7 only (not using MeadCo's scale-to-fit)
<object id="factory" viewastext style="display:none"
   classid="clsid:1663ed61-23eb-11d2-b92f-008048fdd814"
   codebase="http://[your_path]/smsx.cab#Version=6,4,438,06">
</object>
-->

<!-- MeadCo ScriptX -->
<object id="factory" viewastext style="display:none"
   classid="clsid:1663ed61-23eb-11d2-b92f-008048fdd814"
   codebase="lib/smsx.cab#Version=6,4,438,06">
   <param name="template" value="MeadCo://IE7" />
</object>

<script type="text/javascript">
function print_report() {
  //window.print();
  // save before meadco
  var h=factory.printing.header;
  var f=factory.printing.footer;
  var o=factory.printing.portrait;
  var lm=factory.printing.leftMargin;
  var tm=factory.printing.topMargin;
  var rm=factory.printing.rightMargin;
  var bm=factory.printing.bottomMargin;
  // set and print (&b for tab)
  //factory.printing.header = "CyberSecurity Malaysia&b&bConfidential";
  factory.printing.header = "";
  factory.printing.footer = "&b&bPage &p";
  factory.printing.portrait = true;
  factory.printing.leftMargin = 0.5;
  factory.printing.topMargin = 0.3;
  factory.printing.rightMargin = 0.5;
  factory.printing.bottomMargin = 0.5;
  factory.printing.Print(true);
  // restore..
  factory.printing.header=h;
  factory.printing.footer=f;
  factory.printing.portrait=o;
  factory.printing.leftMargin=lm;
  factory.printing.topMargin=tm;
  factory.printing.rightMargin=rm;
  factory.printing.bottomMargin=bm;
}
</script>
