<meta charset="UTF-8"> <title>Site Checklist</title> <link rel="stylesheet" src="//normalize-css.googlecode.com/svn/trunk/normalize.min.css" /> <link href='//fonts.googleapis.com/css?family=Roboto:400,300,500,700,900' rel='stylesheet' type='text/css'> <link href='//maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css' rel='stylesheet' type='text/css'> <link rel="stylesheet" href="css/custom.css"> </head> <body> <?php $page = 'home'; //default page is homepage $errors = array(); // error messages $site_url = ''; if (isset($_GET['site']) && !empty($_GET['site'])) { $site_url = \Classes\Utility::xss_clean($_GET['site']); if (strpos($site_url, 'http') === false && strpos($site_url, 'https') === false) { $site_url = 'http://' . $site_url; } if (is_valid_url($site_url)) { $page = 'checklist'; } else { $errors[] = 'The URL ' . $site_url . ' is invalid.'; } } //list of mvcs $data = array('home' => array('model' => 'IndexModel', 'view' => 'IndexView', 'controller' => 'IndexController'), 'checklist' => array('model' => 'SiteChecklist', 'view' => 'ChecklistView', 'controller' => 'ChecklistController')); foreach ($data as $key => $components) { if ($page == $key) { $model = '\\Models\\' . $components['model']; $view = '\\Views\\' . $components['view'];
} } function Footer() { $this->SetY(-15); //position 1.5cm from bottom $this->Cell(0, 10, 'Page ' . $this->PageNo() . '/{nb}', 0, 0, 'C'); } } $data = array(); foreach ($view_data as $key => $article) { $data[$key]['title'] = $article['title']; foreach ($article['sections'] as $index => $section) { $section_data = array(); $section_data['title'] = $section['title']; if (isset($post_data[$key][$index]['checkbox']) && $post_data[$key][$index]['checkbox'] == 'on') { $section_data['checked'] = true; } else { $section_data['checked'] = false; } if (isset($post_data[$key][$index]['remarks']) && $post_data[$key][$index]['remarks'] !== '') { $section_data['remarks'] = Utility::xss_clean($post_data[$key][$index]['remarks']); } $data[$key]['sections'][] = $section_data; } } $pdf = new PDF(); $pdf->AliasNbPages(); $pdf->AddPage(); $pdf->AddTable($data, Utility::xss_clean($post_data['site_url'])); $pdf->Output();