[ Index ] |
PHP Cross Reference of Unnamed Project |
[Summary view] [Print] [Text view]
1 <?php 2 // This file is part of Moodle - http://moodle.org/ 3 // 4 // Moodle is free software: you can redistribute it and/or modify 5 // it under the terms of the GNU General Public License as published by 6 // the Free Software Foundation, either version 3 of the License, or 7 // (at your option) any later version. 8 // 9 // Moodle is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU General Public License for more details. 13 // 14 // You should have received a copy of the GNU General Public License 15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 16 17 /** 18 * html data format writer 19 * 20 * @package dataformat_html 21 * @copyright 2016 Brendan Heywood (brendan@catalyst-au.net) 22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 */ 24 25 namespace dataformat_html; 26 27 defined('MOODLE_INTERNAL') || die(); 28 29 /** 30 * html data format writer 31 * 32 * @package dataformat_html 33 * @copyright 2016 Brendan Heywood (brendan@catalyst-au.net) 34 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 35 */ 36 class writer extends \core\dataformat\base { 37 38 /** @var $mimetype */ 39 public $mimetype = "text/html"; 40 41 /** @var $extension */ 42 public $extension = ".html"; 43 44 /** 45 * Write the start of the format 46 * 47 * @param array $columns 48 */ 49 public function write_header($columns) { 50 echo "<!DOCTYPE html><html>"; 51 echo \html_writer::tag('title', $this->filename); 52 echo "<style> 53 html, body { 54 margin: 0; 55 padding: 0; 56 font-family: sans-serif; 57 font-size: 13px; 58 background: #eee; 59 } 60 th { 61 border: solid 1px #999; 62 background: #eee; 63 } 64 td { 65 border: solid 1px #999; 66 background: #fff; 67 } 68 tr:hover td { 69 background: #eef; 70 } 71 table { 72 border-collapse: collapse; 73 border-spacing: 0pt; 74 width: 80%; 75 margin: auto; 76 } 77 </style> 78 <body> 79 <table border=1 cellspacing=0 cellpadding=3> 80 "; 81 echo \html_writer::start_tag('tr'); 82 foreach ($columns as $k => $v) { 83 echo \html_writer::tag('th', $v); 84 } 85 echo \html_writer::end_tag('tr'); 86 } 87 88 /** 89 * Write a single record 90 * 91 * @param array $record 92 * @param int $rownum 93 */ 94 public function write_record($record, $rownum) { 95 echo \html_writer::start_tag('tr'); 96 foreach ($record as $cell) { 97 echo \html_writer::tag('td', $cell); 98 } 99 echo \html_writer::end_tag('tr'); 100 } 101 102 /** 103 * Write the end of the format 104 * 105 * @param array $columns 106 */ 107 public function write_footer($columns) { 108 echo "</table></body></html>"; 109 } 110 111 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Thu Aug 11 10:00:09 2016 | Cross-referenced by PHPXref 0.7.1 |