behruz_47

mpdf-behruz

Apr 22nd, 2019
103
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. $tedk=count($data[0]);
  3. for ($i=0 ;$i<$tedk;) {$txtx='';
  4.     $cps1 = $data[0][$i]['tarem'];
  5.     $cps2 = $data[0][$i]['rozn'];
  6.     $cps3 = $data[0][$i]['saat'];
  7.     $cps4 = $data[0][$i]['zaman'];
  8.     $cps5 = $data[0][$i]['onvan'];
  9.     $cps6 = $data[0][$i]['nam'] . '   ' . $data[0][$i]['famil'];
  10.     $cps7 = $data[1][0]['matnr'];
  11.     $cps8 = $data[1][0]['matnm'];
  12.     $bargx=$data[1][0]['barg'];
  13.     $safex=$data[1][0]['safe'];
  14.     $idkc = $data[0][$i]['id'];
  15.     $chpx = $data[0][$i]['chp'];
  16.     $ontx='';
  17.     if ($chpx=='c1'){$ontx='شرح سئوال';}if ($chpx=='c2'){$ontx='شرح سئوال';}if ($chpx=='c3'){$ontx='  پاسخنامه ';}
  18.     $txt='<table border=".5" cellspacing="1" cellpadding="1" style="direction: rtl;"><tr><td style="width: 185px"><b>کد ملی :<br>نام و نام خانوادگی:<br>نام پدر:<br>پایه  :____  رشته:<br>شماره صندلی:________ کلاس:<br>  نام درس :  </br>' . $cps5 . '</td><td style="width: 185px"><b align="center">' . $cps8 . '</b></td><td style="width: 185px"><b> ناریخ و روزآزمون :  </b><br>' . $cps2 . $cps1 . '<br><b>ساعت شروع   : </b>' . $cps3 . '<br><b>   مدت آزمون: </b>' . $cps4 . '<b>دقیقه </b><br><b>   طراح سئوال  : </b>' . $cps6 . '<br><b>نام دبیر:</b></td></tr></table><table border=".5" cellspacing="1" cellpadding="1" ><tr><td style="width: 30px;margin: 0 auto;">ردیف  </td><td style="width: 495px;margin: 0 auto;"><b align="center" >'.$ontx.'</b></td><td style="width: 30px;margin: 0 auto;">بارم </td></tr>';
  19.     $ib=1;
  20.     $bx=7;
  21.     $gnum=0;
  22.     $pg=1;
  23.     if ($chpx=='c2'){    $tedk2 = count($data[2]);
  24.         for ($bb = 0; $bb < $tedk2;) {
  25.             if ($data[2][$bb]['ente'] == $idkc) {
  26.                 $cpx1 = $data[2][$bb]['nomre'];
  27.                 $cpx2 = $data[2][$bb]['matn'];
  28.                 $gnum=$gnum+$cpx1;
  29.                 if($cpx1==0){$cpx1='';}
  30.                 $spc='';$mk=$data[2][$bb]['tedjx'];
  31.                 if($mk>0){for ($m=0;$m<$mk;){$spc=$spc.'<br>';$m++;}}
  32.                 $txt1 = '<tr cellspacing="1" cellpadding="1"><td style="width: 30px">' . $ib . '</td><td style="width: 495px" ><samp   align="right">' . $cpx2 . '</samp></td><td style="width: 30px">' . $cpx1 . $spc.'</td></tr>';
  33.                 //              print $htmlpersian;
  34.                 $bx=$bx+$mk+2;
  35.                 if ($bx>$safex){$txtx=$txtx.$txt1.'</table><div>صفحه :'.$pg.'</div><br><br>'.$txt;$bx=7;$pg++;}else{if($bx>$bargx){$txtx=$txtx.$txt1.'</table><div>صفحه :'.$pg.'</div><br><br>';}else{$txtx=$txtx.$txt1;}}
  36.                 $ib++;
  37.             }
  38.             $bb++;
  39.         }
  40.     }
  41.     if ($chpx=='c3'){
  42.         for ($bb = 0; $bb < $tedk2;) {
  43.             if ($data[2][$bb]['ente'] == $idkc) {
  44.                 $cpx1 = $data[2][$bb]['nomre'];
  45.                 $cpx2 = $data[2][$bb]['javab'];
  46.                 $gnum=$gnum+$cpx1;
  47.                 if($cpx1==0){$cpx1='';}
  48.                 $spc='';
  49.                 //$mk=$data[2][$bb]['tedjx'];
  50.  
  51.                 //if($mk>0){for ($m=0;$m<$mk;){$spc=$spc.'<br>';$m++;}}
  52.                 $txt1 = '<tr cellspacing="1" cellpadding="1"><td style="width: 30px">' . $ib . '</td><td style="width: 495px" ><samp   align="right">' . $cpx2 . '</samp></td><td style="width: 30px">' . $cpx1 . $spc.'</td></tr>';
  53.                 //              print $htmlpersian;
  54.                 $bx=$bx+2;
  55.  
  56.                 if ($bx>$safex){$txtx=$txtx.$txt1.'</table><div>صفحه :'.$pg.'</div><br><br>'.$txt;$bx=7;$pg++;}else{if($bx>$bargx){$txtx=$txtx.$txt1.'</table><div>صفحه :'.$pg.'</div><br><br>';}else{$txtx=$txtx.$txt1;}}
  57.                 $ib++;
  58.             }
  59.             $bb++;
  60.         }
  61.     }
  62.  
  63.     $spcc='';
  64.     if ($bx<$safex){$vt=$safex-$bx; for ($m=0;$m<$vt;){$spcc=$spcc.'<br>';$m++;}}
  65.     if($gnum==0){$gnum='';}
  66.     if ($chpx=='c2' ) {
  67.         $txte = '<tr>' . $spcc . '<td></td><td><b align="center">' . $cps7 . '</b></td><td>' . $gnum . '</td></tr></table> صقحه:' . $pg;
  68.         $txtj = $txt . $txtx . $txte;
  69.         //$pdf->WriteHTML($txtj, true, 0, true, 0);
  70.     }
  71.     if ($chpx=='c3' ) {
  72.         $txte = '<tr>' . $spcc . '<td></td><td><b align="center">' . $cps7 . '</b></td><td>' . $gnum . '</td></tr></table> صقحه:' . $pg;
  73.         $txtj = $txt . $txtx . $txte;
  74.         //$pdf->WriteHTML($txtj, true, 0, true, 0);
  75.     }
  76.  
  77.     if ($chpx=='c1' ){
  78.         $txte = '<tr><td>'. $spcc .'</td><td></td><td></td></tr><tr><td></td><td><b align="center">' . $cps7 . '</b></td><td>' . $gnum .'</td></tr></table>';
  79.         $txtj = $txt . $txte;
  80.     //    $pdf->WriteHTML($txtj, true, 0, true, 0);
  81.  
  82.     }
  83.     $i++;
  84. }
  85. //print $txtj;
  86. require_once __DIR__ . '/vendor/autoload.php';
  87. $mpdf = new \mPDF();
  88. $mpdf->AddPage(); // force pagebreak
  89. $mpdf->WriteHTML($txtj);
  90. $mpdf->Output();
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×