123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- <?php
- error_reporting(E_ALL);
- ini_set('display_errors', 1);
-
- // Require composer autoload
- require_once __DIR__ . '/vendor/autoload.php';
-
- // Create an instance of the class in landscape
- $mpdf = new mPDF('c', 'A4-L', '', 5, 7, 3, 7);
-
- // Use a style sheet
- $stylesheet = file_get_contents('canvas-pdf.css');
- $mpdf->WriteHTML($stylesheet, 1);
-
- // Write some HTML code
- $title = $_POST['field_00']; // Returns an array
- $field1Items = $_POST['field_01'];
-
- function fillItems($field_name){
- $item = '';
- $fieldItems = $_POST[$field_name];
-
- for($i = 0; $i < count($fieldItems); $i++){
- $item .= '<ul class="items"><li>' . $fieldItems[$i] . '</li></ul>';
- }
-
- return $item;
- }
-
- // $items_01 = '';
- // $field1Items = $_POST['field_01'];
- // for($i = 0; $i<count($field1Items); $i++){
- // $items_01 .= '<ul class="items"><li>'.$field1Items[$i].'</li></ul>';
- // }
- $html = '<div class="wrapper">
- <div class="page_title">
- <div class="logo"><div class="logo-icon"></div><h1 class="ethics-title">Online Ethics Canvas</h1></div>
- <div class="project_title"><span>Canvas Title: </span>' . $title[0] . '</div>
- <div class="project_date"><span>Date: </span>' . $title[1] . '</div>
- </div>
- <!-- end of .page_title -->
-
- <div class="row1">
- <div class="card field_01"><h3>Individuals Affected</h3>' . fillItems("field_01") . '
- <div class="field-icons"></div>
- </div>
- <div class="card field_02"><h3>Groups Affected</h3>' . fillItems("field_02") . '
- <div class="field-icons"></div>
- </div>
- <div class="card field_03"><h3>Behaviour</h3>' . fillItems("field_03") . '
- <div class="field-icons"></div>
- </div>
- <div class="card field_04"><h3>Relations</h3>' . fillItems("field_04") . '
- <div class="field-icons"></div>
- </div>
- <div class="card field_05"><h3>Worldviews</h3>' . fillItems("field_05") . '
- <div class="field-icons"></div>
- </div>
- </div>
- <!-- end of Row1 -->
-
- <div class="row2">
- <div class="card field_06"><h3>Group Conflicts</h3>' . fillItems("field_06") . '
- <div class="field-icons"></div>
- </div>
- <div class="card field_07"><h3>Product or Service Failure</h3>' . fillItems("field_07") . '
- <div class="field-icons"></div>
- </div>
- <div class="card field_08"><h3>Problematic Use of Resources</h3>' . fillItems("field_08") . '
- <div class="field-icons"></div>
- </div>
- <div class="card field_09"><h3>What can we do?</h3>' . fillItems("field_09") . '
- <div class="field-icons"></div>
- </div>
- <div class="card field_10"><h3>Uncategorised Ideas</h3>' . fillItems("field_10") . '
- <div class="field-icons"></div>
- </div>
- </div>
- <!-- end of Row2 -->
-
- <!--
- <footer class="col-md-12 text-center">
- <p class="ethics-copy">Ethics Canvas v1.8</p>
- <p class="ethics-copy">© ADAPT Center, 2017</p>
- </footer>
- -->
- </div>';
-
- $mpdf->WriteHTML($html, 2);
-
- // Output a PDF file directly to the browser
- $mpdf->Output('../saved-pdf/Ethics-Canvas.pdf', 'F');
- // Add 'D' parameter for download
- // $mpdf->Output('MyEthicsCanvas.pdf', 'D');
- ?>
|