PageRenderTime 47ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 1ms

/reports/ebpls_activity_log1.php

http://ebpls.googlecode.com/
PHP | 181 lines | 141 code | 21 blank | 19 comment | 12 complexity | 4b21755e97ad5a6e51de0fa750c7942d MD5 | raw file
  1. <?php
  2. require_once("../lib/ebpls.utils.php");
  3. define('FPDF_FONTPATH','font/');
  4. require('../ebpls-php-lib/html2pdf_lib/fpdf.php');
  5. include("../lib/phpFunctions-inc.php");
  6. include("../includes/variables.php");
  7. include("../lib/multidbconnection.php");
  8. class PDF extends FPDF
  9. {
  10. var $prov;
  11. var $lgu;
  12. var $office;
  13. var $y0;
  14. function setLGUinfo($p='', $l='', $o='') {
  15. $this->prov = $p;
  16. $this->lgu = $l;
  17. $this->office = $o;
  18. // echo 'setLGUinfo'.$this->prov;
  19. }
  20. function AcceptPageBreak()
  21. {
  22. //Method accepting or not automatic page break
  23. if($this->y<2)
  24. {
  25. //Set ordinate to top
  26. $this->SetY($this->y0);
  27. //Keep on page
  28. return false;
  29. }
  30. else
  31. {
  32. return true;
  33. }
  34. }
  35. //Page header
  36. function Header()
  37. {
  38. //Logo
  39. //$this->Image('logo_pb.png',10,8,33);
  40. //Arial bold 15
  41. $this->Image('../images/ebpls_logo.jpg',10,8,33);
  42. $this->SetFont('Arial','B',12);
  43. $this->Cell(340,5,'REPUBLIC OF THE PHILIPPINES',0,1,'C');
  44. $this->Cell(340,5,$this->lgu,0,1,'C');
  45. $this->Cell(340,5,$this->prov,0,2,'C');
  46. $this->SetFont('Arial','B',12);
  47. $this->Cell(340,5,$this->office,0,2,'C');
  48. $this->Cell(340,5,'',0,2,'C');
  49. $this->SetFont('Arial','BU',16);
  50. $this->Cell(340,5,'ACTIVITY LOG',0,1,'C');
  51. $this->SetFont('Arial','BU',12);
  52. $this->Ln(22);
  53. }
  54. //Page footer
  55. function Footer()
  56. {
  57. //Position at 1.5 cm from bottom
  58. $this->SetY(-15);
  59. //Arial italic 8
  60. $this->SetFont('Arial','I',8);
  61. //Page number
  62. $this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C');
  63. }
  64. } // end of PDF class
  65. $dbLink =Open($dbtype,$connecttype,$dbhost,$dbuser,$dbpass,$dbname);
  66. $result=mysql_query("select lguname, lguprovince, lguoffice from ebpls_buss_preference") or die(mysql_error());
  67. $resulta=mysql_fetch_row($result);
  68. $getlgu = @mysql_query("select city_municipality_desc from ebpls_city_municipality where city_municipality_code = '$resulta[0]'");
  69. $getlgu = @mysql_fetch_row($getlgu);
  70. $getprov = @mysql_query("select province_desc from ebpls_province where province_code = '$resulta[1]'");
  71. $getprov = @mysql_fetch_row($getprov);
  72. $pdf=new FPDF('L','mm','A4');
  73. $pdf->setLGUinfo($getlgu[0],$getprov[0],'Office of the Treasurer');
  74. $pdf->AddPage();
  75. $pdf->AliasNbPages();
  76. $pdf->Image('../images/ebpls_logo.jpg',10,8,33);
  77. $pdf->SetFont('Arial','B',8);
  78. $pdf->Cell(300,5,'REPUBLIC OF THE PHILIPPINES',0,1,'C');
  79. //$pdf->Cell(300,5,$getprov[0],0,1,'C');
  80. //$pdf->Cell(300,5,$getlgu[0],0,1,'C');
  81. $pdf->SetFont('Arial','B',8);
  82. $pdf->Cell(300,5,'Office of the Treasurer',0,1,'C');
  83. $pdf->Cell(270,5,'',0,1,'C');
  84. $pdf->SetFont('Arial','BU',8);
  85. $pdf->Cell(300,5,'ACTIVITY LOG',0,1,'C');
  86. $pdf->SetLineWidth(2);
  87. $pdf->Line(0,45,360,45);
  88. $pdf->SetLineWidth(0);
  89. $pdf->Cell(270,5,'',0,1,'C');
  90. $pdf->Cell(270,5,'',0,1,'C');
  91. $pdf->SetLineWidth(2);
  92. $pdf->Line(0,45,360,45);
  93. $pdf->SetLineWidth(0);
  94. //$pdf->Cell(270,5,'',0,1,'C');
  95. //$pdf->Cell(270,5,'',0,1,'C');
  96. $Y_Label_Position = 50;
  97. $Y_Table_Position = 55;
  98. $pdf->SetFont('Arial','B',6);
  99. $pdf->SetY($Y_Label_Position);
  100. $pdf->SetX(5);
  101. $pdf->Cell(10,5,'USER ID',1,0,'C');
  102. $pdf->SetX(15);
  103. $pdf->Cell(30,5,'USER LEVEL',1,0,'C');
  104. $pdf->SetX(45);
  105. $pdf->Cell(20,5,'USERNAME',1,0,'C');
  106. $pdf->SetX(65);
  107. $pdf->Cell(20,5,'REMOTE IP',1,0,'C');
  108. $pdf->SetX(85);
  109. $pdf->Cell(25,5,'DATE UPDATED',1,0,'C');
  110. $pdf->SetX(110);
  111. $pdf->Cell(180,5,'QUERY STRING',1,1,'C');
  112. $date_from = str_replace("/", "", $date_from);
  113. $idate = strtotime($date_from);
  114. $idate = $idate - (60*60*24);
  115. $date_from = date('Y-m-d', $idate);
  116. $date_to = str_replace("/", "", $date_to);
  117. $xdate = strtotime($date_to);
  118. $xdate = $xdate + (60*60*24);
  119. $date_to = date('Y-m-d', $xdate);
  120. /* $result=mysql_query("select userid, userlevel, username, action, remoteip, lastupdated
  121. from ebpls_activity_log where lastupdated between '$date1' and '$date2' ") or die(mysql_error());
  122. */
  123. $result=mysql_query("select userid, userlevel, username, action, remoteip, lastupdated,querystring from ebpls_activity_log where
  124. username like '$owner_last%' and lastupdated between '$date_from' and '$date_to'") or die(mysql_error());
  125. $number_of_rows = mysql_numrows($result);
  126. while($resulta=mysql_fetch_row($result))
  127. {
  128. if ($resulta[1] == "" || $resulta[1] == "0") {
  129. $nUserLevel = "CTC Officer";
  130. } elseif ($resulta[1] == "1") {
  131. $nUserLevel = "Application Officer";
  132. } elseif ($resulta[1] == "2") {
  133. $nUserLevel = "Assessment Officer";
  134. } elseif ($resulta[1] == "3") {
  135. $nUserLevel = "Payment Officer";
  136. } elseif ($resulta[1] == "4") {
  137. $nUserLevel = "Approving Officer";
  138. } elseif ($resulta[1] == "5") {
  139. $nUserLevel = "Releasing Officer";
  140. } elseif ($resulta[1] == "6") {
  141. $nUserLevel = "eBPLS Administrator";
  142. } elseif ($resulta[1] == "7") {
  143. $nUserLevel = "Root Administrator";
  144. }
  145. $pdf->SetFont('Arial','',6);
  146. $pdf->SetX(5);
  147. $pdf->Cell(10,5,$resulta[0],1,0,'C');
  148. $pdf->SetX(15);
  149. $pdf->Cell(30,5,$nUserLevel,1,0,'C');
  150. $pdf->SetX(45);
  151. $pdf->Cell(20,5,$resulta[2],1,0,'C');
  152. $pdf->SetX(65);
  153. $pdf->Cell(20,5,$resulta[4],1,0,'C');
  154. $pdf->SetX(85);
  155. $pdf->Cell(25,5,$resulta[5],1,0,'C');
  156. $pdf->SetX(110);
  157. $pdf->Cell(180,5,$resulta[6],1,1,'L');
  158. }
  159. $pdf->Output();
  160. ?>