public function getData() { # Получили всех инструкторов $instructors = Driver::findAll('instructor'); $payments = array(); # Получить все патежи клиентов foreach ($instructors as $i) { $payments[$i->getId()] = Driver::payment('Instructor', $i->getId(), new \DateTime()); } # Получить стоимость аренды помещения $roomPrices = new RoomPrices(); # Получить ЗП инструктора $instructorPrices = new InstructorPrices(); return array('instructors' => $instructors, 'payments' => $payments, 'roomPrices' => $roomPrices, 'instructorPrices' => $instructorPrices); }
$namespace = substr($className, 0, $lastNsPos); $className = substr($className, $lastNsPos + 1); $fileName = str_replace('\\', DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR; } $fileName .= str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php'; require $fileName; } spl_autoload_register('autoload'); if ($_GET['pdf'] == 1) { $htmlOut = file_get_contents('http://aik.loc/index.php?type=' . $_GET['type']); $mpdf = new mPDF('utf-8', 'A4-L', '', '', 22, 14, 12, 23, 9, 9); // $mpdf->charset_in = 'utf-8'; $mpdf->SetDisplayMode('fullpage'); $mpdf->list_indent_first_level = 0; $mpdf->WriteHTML($htmlOut); $mpdf->Output("filename.pdf", 'I'); } else { # Далее код $db = new Driver(); $db->connect(); if ($_GET['type'] == 'group') { $groups = $db->findAll('group'); include 'Views/main.php'; } elseif ($_GET['type'] == 'instructor') { $instructors = $db->findAll('instructor'); include 'Views/instructor.php'; } elseif ($_GET['type'] == 'room') { $rooms = $db->findAll('room'); include 'Views/room.php'; } }