function counting($a) { global $totali, $totalt; $c = 0; $d = 0; if ($a == 'i') { while ($d < 90) { $c = $c + $totali[$d]; $d = nextdpt($d); } } if ($a == 't') { while ($d < 90) { $c = $c + $totalt[$d]; $d = nextdpt($d); } } return $c; }
function detailsprint() { global $dpt_hal, $pdf, $allhalls, $final_hall, $final_reg; $width = array(37, 150, 30, 7); $height = array(8, 7, 0); $hall; $pdf->AddPage(); $pdf->SetFont('Helvetica', 'BU', 14); $pdf->Cell(0, '10', 'All Exam-Halls (course-wise)', '', 0, 'C'); $pdf->Ln(); $pdf->SetFont('', 'BI', 14); $pdf->Cell($width[0], $height[0], 'Deg./Dept.', 'BTLR', 0, 'C'); $pdf->Cell($width[1], $height[0], 'Exam-Halls', 'BTLR', 0, 'C'); $pdf->Ln(); $pdf->SetFont('', ''); for ($z = 0; $z < 90; $z = nextdpt($z)) { $hall = ' '; if (isset($dpt_hal[$z])) { $pdf->Cell($width[2], $height[1], dpt($z), 'L'); $m = count($dpt_hal[$z]); $pdf->SetFont('', 'BI', 8); $pdf->Cell($width[3], $height[1], $m, 'R', 0, 'R'); $pdf->SetFont('', '', 14); $j = 0; $k = 0; $m = 0; $sym = ', '; foreach ($dpt_hal[$z] as $i) { $m = $m + 1; //manual increment for the halls $k = $k + 1; //calculation as a whole if (!isset($dpt_hal[$z][$k])) { $sym = '.'; } $l = strlen($allhalls[$i]); //stores length of hall name $j = $j + $l; //calculation for every line if (isset($dpt_hal[$z][$k])) { $j = $j + 1; } $hall .= $allhalls[$i] . $sym; if ($j >= 47 && isset($dpt_hal[$z][$m])) { $pdf->Cell($width[1], $height[1], $hall, 'LR'); $pdf->Ln(); $pdf->Cell($width[0], $height[1], '', 'LR'); $hall = ' '; $j = 0; $m = 0; } } $pdf->Cell($width[1], $height[1], $hall, 'BLR'); $pdf->Ln(); } } $pdf->Cell($width[0], $height[2], '', 'BLR'); $pdf->Cell($width[1], $height[2], '', 'BLR'); $pdf->Ln(); $pdf->SetFont('Times', 'I', 15); $spacer = ' '; $details = 'Total Candidates: ' . $final_reg . ' ' . $spacer . ' Total Halls: ' . $final_hall; $pdf->Cell(0, '10', $details, '', 0, 'C'); }
function mainarranger($sessget) { global $file, $line, $z, $proceeder, $bcode, $ttlb, $nodept2, $nodept; global $b; global $totali, $totalt, $totalb; $proceeder = 0; unset($b); unset($totali); unset($totalb); unset($totalt); global $b; global $totali, $totalt, $totalb; $b = array(array()); //the main array which contains all reg nos. $totalb = array(); // saves the total of indiviual department $totali = array(); // used in arrange() function $totalt = array(); // used in arrange() function $ttlb = 0; $nodept = $nodept2; if ($sessget == 'FN') { $sessput = 'FN('; //for forenoon 'FN(' is set because PDF mismatches other words when 'FN' standing alone $sessputalt = 'AN('; //the alternative option } elseif ($sessget == 'AN') { $sessput = 'AN('; //for afternoon $sessputalt = 'FN('; } if (is_resource($file)) { rewind($file); } else { die('Cannot open the file.<br>'); } while (!feof($file)) { $line = fgets($file); //scans the file line by line and stores it in $line $pieces = explode(" ", $line); if (isset($pieces)) { while ($z < 90) { foreach ($pieces as $slice) { if ($sessget != 'none') { if (stripos($slice, $sessput) !== FALSE) { $proceeder = 1; } elseif (stripos($slice, $sessputalt) !== FALSE) { $proceeder = 0; } if ($proceeder == 1) { foreach ($bcode[$z] as $a) { if (stripos($slice, $a) !== FALSE) { $b[$z][] = $slice; //confirms students and saves in this array } if (empty($b[$z])) { unset($b[$z]); } } } } if ($sessget == 'none') { foreach ($bcode[$z] as $a) { if (stripos($slice, $a) !== FALSE) { $b[$z][] = $slice; //confirms students and saves in this array } if (empty($b[$z])) { unset($b[$z]); } } } } $z = nextdpt($z); } $z = 0; } } $z = 0; while ($z < 90) { if (isset($b[$z])) { sort($b[$z]); $totalb[$z] = count($b[$z]); } else { $totalb[$z] = 0; $nodept = $nodept - 1; } $totali[$z] = 0; $totalt[$z] = 0; $z = nextdpt($z); } /* print_r($b); print_r($totali); echo "\n\n"; print_r($totalt); echo "\n\n"; print_r($totalb);*/ $ttlb = count($b, COUNT_RECURSIVE) - $nodept; //echo "\nttlb = ".$ttlb."\nno dept".$nodept."\n"; }