Пример #1
0
 if ($random_questions) {
     shuffle($questions_data);
 } else {
     ksort($questions_data);
 }
 // *-*-*-*-*
 // 4. PRINT QUESTIONS
 // ------------------------------
 $question_order = 0;
 foreach ($questions_data as $key => $q) {
     ++$question_order;
     // add question ID to QR-Code data
     $barcode_test_data[$question_order] = array(0 => $q['id'], 1 => array());
     // start transaction
     $pdf->startTransaction();
     $block_page = $pdf->getPage();
     $print_block = 2;
     // 2 tries max
     while ($print_block > 0) {
         // ------------------------------
         // add question number
         $pdf->Cell($data_cell_width_third, $data_cell_height, '' . $itemcount . ' ' . $qtype[$q['type'] - 1] . '', 1, 0, 'R', 0);
         // add max points
         $pdf->Cell($data_cell_width_third, $data_cell_height, '' . $q['difficulty'] * $testdata['test_score_right'] . '', 1, 0, 'R', 0);
         // add question description
         $pdf->writeHTMLCell(0, $data_cell_height, PDF_MARGIN_LEFT + 2 * $data_cell_width_third, $pdf->GetY(), F_decode_tcecode($q['description']), 1, 1);
         // ------------------------------
         // do not split BLOCKS in multiple pages
         if ($pdf->getPage() == $block_page) {
             $print_block = 0;
         } else {