123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131 |
- <?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:
- //x,left,x,top
- $mpdf = new mPDF('c', 'A4-L', '', 0,4,0,3);
- //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;
- }
- $html='<div class="wrapper">
- <div class="page_title">
- <div class="logo"><div class="logo-icon"></div>
- </div>
- <div class="project_title"><span>Project name: </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"><h1>1. Individuals Affected</h1>'.fillItems("field_01").'
- <div class="field-icons"></div>
- </div>
- <div class="card field_02"><h1>2. Organisations and Groups Affected</h1>'.fillItems("field_02").'
- <div class="field-icons"></div>
- </div>
- <div class="card field_03"><h1>3. Products and Services provided</h1>'.fillItems("field_03").'
- <div class="field-icons"></div>
- </div>
- <div class="card field_04"><h1>4. Resources needed</h1>'.fillItems("field_04").'
- <div class="field-icons"></div>
- </div>
- <div class="card field_05"><h1>5. Changes in Behaviour</h1>'.fillItems("field_05").'
- <div class="field-icons"></div>
- </div>
- </div>
- <!-- end of Row2 -->
- <div class="row2">
- <div class=" card field_06"><h1>6. Changes in Relations</h1>'.fillItems("field_06").'
- <div class="field-icons"></div>
- </div>
- <div class="card field_07"><h1>7. Group Interests</h1>'.fillItems("field_07").'
- <div class="field-icons"></div>
- </div>
- <div class="card field_08"><h1>8. Public Sphere</h1>'.fillItems("field_08").'
- <div class="field-icons"></div>
- </div>
- <div class="card field_09"><h1>9. Impact of product or service failure</h1>'.fillItems("field_09").'
- <div class="field-icons"></div>
- </div>
- <div class="card field_10"><h1>10. Impact of use of resources</h1>'.fillItems("field_10").'
- <div class="field-icons"></div>
- </div>
- </div>
- <!-- end of Row2 -->
- <div class="row3">
- <div class=" card field_11"><h1>11. Social Conflicts</h1>'.fillItems("field_11").'
- <div class="field-icons"></div>
- </div>
- <div class="card field_12"><h1>12. Resolving ethical impacts</h1>'.fillItems("field_12").'
- <div class="field-icons"></div>
- </div>
- </div>
- <!-- end of Row3 -->
- <footer>
- <p><span>Ethics Canvas v1.7</span>|<span>© ADAPT Center & Trinity College Dublin & Dublin City University, 2016</span>
- The Ethics Canvas is adapted from Alex Osterwalder’s Business Model Canvas. The Business Model Canvas is designed by: Business Model Foundry AG. This work is licensed under the Creative Commons Attribution-Share Alike 3.0 unported license. View a copy of this license at: https://creativecommons.org/licenses/by-sa/3.0/. View the original Business Model Canvas at https://strategyzer.com/canvas.
- <span class="contact-email">Contact us at: hello@ethicscanvas.org</span>
- </p>
- <div class="license-icons">
- <img src="../../icon/canvas-pdf-icons.png" alt="ethics-canvas-license-icon"/>
- </div>
- </footer>
- </div>';
- $mpdf->WriteHTML($html,2);
- if (isset($_POST['share-canvas'])) {
- // Share Canvas clicked: save on server
- $mpdf->Output('../saved-pdf/Ethics-Canvas.pdf','F');
- }
- else {
- // Export PDF clicked: download
- $mpdf->Output('Ethics-Canvas.pdf', 'D');
- }
- /* There are 3 ways to get the pdf:
- A. open the pdf in the users browser--> $mpdf->Output();
- B. force download the pdf to the users device --> $mpdf->Output('name-of-file.pdf', 'D');
- c. Save the pdf file on our server on the url that we say
- $mpdf->Output('my-directory/saved.pdf','F');
- */
- // A. Output a PDF file directly to the browser
- // $mpdf->Output();
- //B. Adding the 'D' parameter for download to user's device
- // $mpdf->Output('OnlineEthicsCanvas.pdf', 'D');
- //C. adding the 'F' to save the file
- //$mpdf->Output('../saved-pdf/Ethics-Canvas.pdf','F');
- // Close the window after creating the PDF
- echo "<script>window.close();</script>";
- ?>
|