/** Генерирует pdf файлы с тестом с заданным количеством вариантов */
 public function pdfTest(Request $request)
 {
     $question = new Question();
     $test = new Test();
     $test_controller = new TestController($test);
     $question_controller = new QuestionController($question);
     $test_name = $request->input('test');
     $num_var = $request->input('num-variants');
     $query = Test::whereTest_name($test_name)->select('amount', 'id_test')->first();
     $id_test = $query->id_test;
     $amount = $query->amount;
     // кол-во вопрососв в тесте
     $today = date("Y-m-d H-i-s");
     $dir = 'download/pdf_tests/' . $today;
     mkdir($dir);
     define('FPDF_FONTPATH', 'C:\\wamp\\www\\uir\\public\\fonts');
     for ($k = 1; $k <= $num_var; $k++) {
         // генерируем необходимое число вариантов
         $fpdf = new Mypdf();
         $answered_fpdf = new Mypdf();
         $this->headOfPdf($fpdf, $test_name, $k, $amount);
         $this->headOfPdf($answered_fpdf, $test_name, $k, $amount);
         $ser_array = $question_controller->prepareTest($id_test);
         // подготавливаем тест
         for ($i = 0; $i < $amount; $i++) {
             // показываем каждый вопрос из теста
             $id = $question_controller->chooseQuestion($ser_array);
             if (!$test_controller->rybaTest($id)) {
                 //проверка на вопрос по рыбе
                 return view('no_access');
             }
             $this->pdfQuestion($fpdf, $id, $i + 1);
             $this->pdfQuestion($answered_fpdf, $id, $i + 1, true);
             $fpdf->Ln(10);
             $answered_fpdf->Ln(10);
         }
         $fpdf->Output(iconv('utf-8', 'windows-1251', $dir . '/variant' . $k . '.pdf'), 'F');
         $answered_fpdf->Output(iconv('utf-8', 'windows-1251', $dir . '/answered_variant' . $k . '.pdf'), 'F');
     }
     $zip = $this->pdfToZip($dir);
     // создаем архив
     $this->delPdf($dir);
     // удаляем созданную папку с тестами
     $this->download($zip);
     // скачать архив
 }