PageRenderTime 38ms CodeModel.GetById 11ms RepoModel.GetById 0ms app.codeStats 0ms

/applicationforms.php

https://bitbucket.org/mannir/agp
PHP | 173 lines | 169 code | 4 blank | 0 comment | 7 complexity | 673a601fb9240b6277a05747f87df132 MD5 | raw file
Possible License(s): LGPL-2.1
  1. <?php
  2. global $url; if($_SERVER['HTTP_HOST']=='localhost') { $cn=mysql_connect("localhost","root",""); mysql_select_db("agpapp");
  3. $url='http://localhost/agpapp/sites/all/modules/manniragp/'; }
  4. else { $cn=mysql_connect("agpapp.db.8855061.hostedresource.com","agpapp","Customer13131"); mysql_select_db("agpapp");
  5. global $url; $url='http://agpapp.esystems.me/sites/all/modules/manniragp/'; }
  6. require_once('tcpdf/config/lang/eng.php');
  7. require_once('tcpdf/tcpdf.php');
  8. if(isset($_REQUEST['from']) && isset($_REQUEST['to']) && isset($_REQUEST['sortby'])) { $fr=$_REQUEST['from']; $to=$_REQUEST['to']; $sb=$_REQUEST['sortby'];
  9. $query = mysql_query("SELECT *,(select department from _programmes where _programmes.PROGRAMME=_application.programme1 LIMIT 1) AS department FROM `_application`
  10. WHERE id>='$fr' AND id<='$to' ORDER BY '$sb'"); $ar = array(); while($line = mysql_fetch_array($query, MYSQL_ASSOC)){ $ar[] = $line; }
  11. }
  12. else {
  13. $o = (object) mysqli_fetch_assoc(mysqli_query($con,"SELECT max(id) as mxid FROM _application")); $mxid=$o->mxid;
  14. $query = mysql_query("SELECT *,(select department from _programmes where _programmes.PROGRAMME=_application.programme1 LIMIT 1) AS department FROM `_application`
  15. WHERE id>=1 AND id<='$mxid'"); $ar = array(); while($line = mysql_fetch_array($query, MYSQL_ASSOC)){ $ar[] = $line; }
  16. }
  17. class MYPDF extends TCPDF {
  18. public function Header() { global $uid; global $url;
  19. $url='/sites/default/files/pictures/'; if($_SERVER['HTTP_HOST']=='localhost'){ $url='agp\sites\default\files\pictures\\'; }
  20. $p = (object) mysqli_fetch_assoc(mysqli_query($con,"SELECT filename FROM file_managed WHERE fid=(SELECT picture FROM users WHERE uid='$uid')"));
  21. $this->Image('logo.jpg', 10, 10, 25, '', 'JPG', '', 'T', false, 300, '', false, false, 0, false, false, false);
  22. $filename = '../../../default/files/pictures/'.$p->filename;
  23. $jpg=stristr($p->filename,".jpg"); $png=stristr($p->filename,".png"); if(isset($png)) { $tp='PNG'; } if(isset($jpg)) { $tp='JPG'; }
  24. //if (file_exists($filename)) { $this->Image($filename,175,10,25,25,$tp,'','R',false,300,'',false,false,0,false,0,false,false,false); }
  25. if(stristr($filename,$p->filename)!='') {
  26. $this->Image($filename,175,10,25,25,'','','R',false,300,'',false,false,0,false,0,false,false,false);
  27. //$this->Image($filename, 0, 0, '', '', '', '', '', false, 300, '', false, false, 0);
  28. }
  29. $this->SetFont('helvetica', 'B', 18);
  30. $this->SetY(10); $this->Cell(0, 15, 'ABDU GUSAU POLYTECHNIC, P.M.B. 1021', 0, false, 'C', 0, '', 0, false, 'M', 'M');
  31. $this->SetY(17); $this->Cell(0, 15, 'TALATA-MAFARA. ZAMFARA STATE', 0, false, 'C', 0, '', 0, false, 'M', 'M');
  32. $this->SetY(25); $this->Cell(0, 15, 'ONLINE APPLICATION FORM', 0, false, 'C', 0, '', 0, false, 'M', 'M');
  33. }
  34. public function Footer() {
  35. $this->SetY(-10);
  36. $this->SetFont('helvetica', 'I', 8);
  37. $this->Cell(0, 10, 'ABDU GUSAU POLYTECHNIC, TALATA-MAFARA, ZAMFARA STATE, System Developed By MANNIR ESYSTEMS LIMITED 2012 (www.mannir.net)', 0,
  38. false, 'C', 0, '', 0, false, 'T', 'M');
  39. // $this->Cell(0, 10, 'Page '.$this->getAliasNumPage().'/'.$this->getAliasNbPages(), 0, false, 'C', 0, '', 0, false, 'T', 'M');
  40. }}
  41. $pdf = new MYPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
  42. $pdf->SetCreator(PDF_CREATOR);
  43. $pdf->SetAuthor('MUHAMMAD MANNIR AHMAD');
  44. $pdf->SetTitle('ABDUGUSAU POLYTECHNIC TALATA MAFARA: Online Application Form');
  45. $pdf->SetSubject('Application Form');
  46. $pdf->SetKeywords('Mannir, Mannir.com, eapplication');
  47. $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING);
  48. $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
  49. $pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
  50. $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
  51. $pdf->SetMargins(10, 10, 10);
  52. $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
  53. $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
  54. $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
  55. $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
  56. $pdf->setLanguageArray($l);
  57. //$pdf->SetFont('times', 'BI', 12);
  58. $pdf->SetDisplayMode('fullpage', 'SinglePage', 'UseNone');
  59. $pdf->SetFont('times', 'B', 10);
  60. foreach($ar as $k=>$v) {
  61. session_start(); error_reporting(0); global $uid; $uid=$ar[$k]['uid']; //$uid = $_REQUEST['uid'];
  62. $a = (object) mysqli_fetch_assoc(mysqli_query($con,"SELECT * FROM _application WHERE uid='$uid'"));
  63. $ap = (object) mysqli_fetch_assoc(mysqli_query($con,"SELECT * FROM _application WHERE uid='$uid'"));
  64. $sc=explode(',',$a->schoolinfo); $s1=explode(':',$sc[0]); $s2=explode(':',$sc[1]); $s3=explode(':',$sc[2]); $s4=explode(':',$sc[3]);
  65. $s5=explode(':',$sc[4]); $e1=explode(',',$ap->examinfo1); $ee1=explode(':',$e1[0]); $e2=explode(',',$ap->examinfo2); $ee2=explode(':',$e2[0]);
  66. $pdf->AddPage('P', 'A4');
  67. $pdf->SetY(35); $pdf->Write(0, 'APPLICATION INFORMATION', '', 0, 'C', true, 0, false, false, 0);
  68. $pdf->SetY(40); $pdf->Cell(100, 0, 'User ID: '.$a->uid,1);
  69. $pdf->SetY(40); $pdf->SetX(115); $pdf->Cell(85, 0, 'Application No: '.$a->appno, 1);
  70. $pdf->SetY(46); $pdf->Cell(100, 0, 'Fullname: '.$a->fullname, 1);
  71. $pdf->SetY(46); $pdf->SetX(115); $pdf->Cell(85,0,'Gender: '.$a->gender,1,1,'L');
  72. $pdf->SetY(52); $pdf->Cell(100, 0, 'Date of Birth: '.$a->dob, 1);
  73. $pdf->SetY(52); $pdf->SetX(115); $pdf->Cell(85, 0, 'Religion: '.$a->religion, 1);
  74. $pdf->SetY(58); $pdf->Cell(100, 0, 'Marital Status: '.$a->maritalstatus, 1, 1,'','','',FALSE);
  75. $pdf->SetY(58); $pdf->SetX(115); $pdf->Cell(85,0,'Bloog Group: '.$a->bloodgroup,1);
  76. $pdf->SetY(64); $pdf->Cell(100, 0, 'Addres: '.$a->address,1);
  77. $pdf->SetY(64); $pdf->SetX(115); $pdf->Cell(85, 0, 'Place of Birth: '.$a->placeofbirth, 1);
  78. $pdf->SetY(70); $pdf->Cell(100, 0, 'Country: '.$a->country, 1);
  79. $pdf->SetY(70); $pdf->SetX(115); $pdf->Cell(85,0,'State: '.$a->state,1,1,'L');
  80. $pdf->SetY(77); $pdf->Cell(100, 0, 'L.G.A.: '.$a->lga, 1);
  81. $pdf->SetY(77); $pdf->SetX(115); $pdf->Cell(85, 0, 'Mobile No: '.$a->mobileno, 1);
  82. $pdf->SetY(84); $pdf->Cell(100, 0, 'PIN Code: '.$a->appno, 1);
  83. $pdf->SetY(84); $pdf->SetX(115); $pdf->Cell(85, 0, 'Teller No: '.$a->tellerno, 1);
  84. $pdf->SetY(92); $pdf->Write(0, 'SCHOOLS/ACADEMIC INFORMATION', '', 0, 'C', true, 0, false, false, 0);
  85. $pdf->SetY(97); $pdf->Cell(5, 0, 'SN', 0);
  86. $pdf->SetX(16); $pdf->Cell(70, 0, 'NAME OF SCHOOL', 0,'','C'); $pdf->SetX(87); $pdf->Cell(30, 0, 'DATE FROM', 0,'','C');
  87. $pdf->SetX(118); $pdf->Cell(30, 0, 'DATE TO', 0,'','C'); $pdf->SetX(149); $pdf->Cell(51, 0, 'CERTIFICATE', 0,'','C');
  88. $pdf->SetY(103); $pdf->Cell(5, 0, '1.', 1,'','C');
  89. $pdf->SetX(16); $pdf->Cell(70, 0, $s1[0], 1,'','C'); $pdf->SetX(87); $pdf->Cell(30, 0, $s1[1], 1,'','C');
  90. $pdf->SetX(118); $pdf->Cell(30, 0,$s1[2], 1,'','C'); $pdf->SetX(149); $pdf->Cell(51, 0,$s1[3], 1,'','C');
  91. $pdf->SetY(109); $pdf->Cell(5, 0, '2.', 1,'','C');
  92. $pdf->SetX(16); $pdf->Cell(70, 0,$s2[0], 1,'','C'); $pdf->SetX(87); $pdf->Cell(30, 0,$s2[1], 1,'','C');
  93. $pdf->SetX(118); $pdf->Cell(30, 0,$s2[2], 1,'','C'); $pdf->SetX(149); $pdf->Cell(51, 0,$s2[3], 1,'','C');
  94. $pdf->SetY(115); $pdf->Cell(5, 0, '3.', 1,'','C');
  95. $pdf->SetX(16); $pdf->Cell(70, 0,$s3[0], 1,'','C'); $pdf->SetX(87); $pdf->Cell(30, 0,$s3[1], 1,'','C');
  96. $pdf->SetX(118); $pdf->Cell(30, 0,$s3[2], 1,'','C'); $pdf->SetX(149); $pdf->Cell(51, 0,$s3[3], 1,'','C');
  97. $pdf->SetY(121); $pdf->Cell(5, 0, '4.', 1,'','C');
  98. $pdf->SetX(16); $pdf->Cell(70, 0,$s4[0], 1,'','C'); $pdf->SetX(87); $pdf->Cell(30, 0,$s4[1], 1,'','C');
  99. $pdf->SetX(118); $pdf->Cell(30, 0,$s4[2], 1,'','C'); $pdf->SetX(149); $pdf->Cell(51, 0,$s4[3], 1,'','C');
  100. $pdf->SetY(127); $pdf->Cell(5, 0, '5.', 1);
  101. $pdf->SetX(16); $pdf->Cell(70, 0,$s5[0], 1,'','C'); $pdf->SetX(87); $pdf->Cell(30, 0,$s5[1], 1,'','C');
  102. $pdf->SetX(118); $pdf->Cell(30, 0,$s5[2], 1,'','C'); $pdf->SetX(149); $pdf->Cell(51, 0,$s5[3], 1,'','C');
  103. $pdf->SetY(133); $pdf->Write(0, 'EXAMINATION INFORMATION', '', 0, 'C', true, 0, false, false, 0);
  104. $pdf->SetY(138); $pdf->Cell(93, 0, 'EXAM 1: '.$e1[0], 1,'','C');// $pdf->SetX(60); $pdf->Cell(40, 0, 'EXAMNO: '.$ee1[3], 1);
  105. $pdf->SetX(108); $pdf->Cell(92, 0, 'EXAM 2: '.$e2[0], 1,'','C');// $pdf->SetX(160); $pdf->Cell(40, 0, 'EXAMNO: '.$ee2[3], 1);
  106. $_SESSION['y']=144;
  107. for($i=1;$i<=9;$i++) {
  108. $pdf->SetY($_SESSION['y']); $pdf->Cell(6, 0, $i.'.', 1);
  109. $pdf->SetX(17); $pdf->Cell(70, 0,substr($e1[$i],0,strpos($e1[$i],'=')), 1,'','C');
  110. $pdf->SetX(88); $pdf->Cell(15, 0,substr($e1[$i],strpos($e1[$i],'=')+1), 1,'','C');
  111. $pdf->SetX(108); $pdf->Cell(5, 0, $i.'.', 1);
  112. $pdf->SetX(114); $pdf->Cell(70, 0,substr($e2[$i],0,strpos($e2[$i],'=')), 1,'','C');
  113. $pdf->SetX(185); $pdf->Cell(15, 0,substr($e2[$i],strpos($e2[$i],'=')+1), 1);
  114. $_SESSION['y']=$_SESSION['y']+6;
  115. }
  116. $pdf->SetY(199); $pdf->Write(0, 'CONTACT INFORMATION', '', 0, 'C', true, 0, false, false, 0);
  117. $pdf->SetY(203); $pdf->Cell(100,0,'Next of Kin Name: '.$a->nkname,1);
  118. $pdf->SetY(203); $pdf->SetX(115); $pdf->Cell(85, 0, 'Next of Kin Type: '.$a->nktype, 1);
  119. $pdf->SetY(209); $pdf->Cell(100, 0, 'Next of Kin Address: '.$a->address,1);
  120. $pdf->SetY(209); $pdf->SetX(115); $pdf->Cell(85, 0, 'Next of Kin Mobile No: '.$a->nkmobileno, 1);
  121. $pdf->SetY(215); $pdf->Cell(100, 0, 'Sponsor Name: '.$a->spname,1);
  122. $pdf->SetY(215); $pdf->SetX(115); $pdf->Cell(85, 0, 'Sponsor Type: '.$a->sptype, 1);
  123. $pdf->SetY(221); $pdf->Cell(190, 0, 'Sponsor Address: '.$a->spaddress, 1,'','C');
  124. $pdf->SetY(228); $pdf->Write(0, 'APPLICATION INFORMATION', '', 0, 'C', true, 0, false, false, 0);
  125. $pdf->SetY(233); $pdf->Cell(190, 0, 'Programme First Choice: '.$a->programme1, 1,'','C');
  126. $pdf->SetY(239); $pdf->Cell(190, 0, 'Programme Second Choice: '.$a->programme2, 1,'','C');
  127. $pdf->SetY(245); $pdf->Cell(190, 0, 'Programme Third Choice: '.$a->programme3, 1,'','C');
  128. //$pdf->SetY(253); $pdf->Cell(190, 0, 'User ID: 1 PIN Number: '.$a->pincode.' Teller Number: 0123456789', 1,'','C');
  129. //$pdf->SetY(255); $pdf->Cell(190, 15, 'Decalaration: ', 1);
  130. $pdf->SetY(255);
  131. $style = array(
  132. 'position' => 'C',
  133. 'align' => 'C',
  134. 'stretch' => false,
  135. 'fitwidth' => true,
  136. 'cellfitalign' => '',
  137. 'border' => true,
  138. 'hpadding' => 'auto',
  139. 'vpadding' => 'auto',
  140. 'fgcolor' => array(0,0,0),
  141. 'bgcolor' => false, //array(255,255,255),
  142. 'text' => false,
  143. 'font' => 'helvetica',
  144. 'fontsize' => 10,
  145. 'stretchtext' => 4);
  146. $pdf->write1DBarcode($ap->appno, 'C39E+', '', '', '', 16, 0.4, $style, 'C');
  147. }
  148. //$pdf->lastPage();
  149. $pdf->Output('AGP ePortal Application Forms.', 'D');