private function createMailBody() { $email = new HTML_Page(); $email->setTitle(ucwords($this->template)); $email->setMetaData("content-type", "text/html; charset=utf-8", true); $email->setMetaData("Content-Language", "english"); if ($this->css) { $email->addStyleDeclaration($this->css); } $email->xmlProlog = false; switch ($this->email_type) { case 'html': $email->addBodyContent($this->mail_body); break; case 'plain': $email->addBodyContent(html_entity_decode(strip_tags($this->mail_body), ENT_QUOTES, 'UTF-8')); break; } return $email->toHTML(); }
function _renderForm(&$page) { $pageName = $page->getAttribute('name'); $tabPreview = array_slice($page->controller->_tabs, -2, 1); $p = new HTML_Page(array('lineend' => OS_WINDOWS ? 'win' : 'unix', 'doctype' => "XHTML 1.0 Strict", 'language' => 'en', 'cache' => 'false')); $p->disableXmlProlog(); $p->setTitle("PEAR::HTML_Progress - Generator"); $p->setMetaData("author", "Laurent Laville"); $css = new HTML_CSS(); $css->setStyle('body', 'background-color', '#7B7B88'); $css->setStyle('body', 'font-family', 'Verdana, Arial, helvetica'); $css->setStyle('body', 'font-size', '10pt'); $css->setStyle('h1', 'color', '#FFC'); $css->setStyle('h1', 'text-align', 'center'); $css->setStyle('.maintable', 'width', '100%'); $css->setStyle('.maintable', 'border-width', '0'); $css->setStyle('.maintable', 'border-style', 'thin dashed'); $css->setStyle('.maintable', 'border-color', '#D0D0D0'); $css->setStyle('.maintable', 'background-color', '#EEE'); $css->setStyle('.maintable', 'cellspacing', '2'); $css->setStyle('.maintable', 'cellspadding', '3'); $css->setStyle('th', 'text-align', 'center'); $css->setStyle('th', 'color', '#FFC'); $css->setStyle('th', 'background-color', '#AAA'); $css->setStyle('th', 'white-space', 'nowrap'); $css->setStyle('input', 'font-family', 'Verdana, Arial, helvetica'); $css->setStyle('input.flat', 'border-style', 'solid'); $css->setStyle('input.flat', 'border-width', '2px 2px 0px 2px'); $css->setStyle('input.flat', 'border-color', '#996'); // on preview tab, add progress bar javascript and stylesheet if ($pageName == $tabPreview[0][0]) { $bar = $page->controller->createProgressBar(); $p->addStyleDeclaration($css->toString() . $bar->getStyle()); $p->addScriptDeclaration($bar->getScript()); $barElement =& $page->getElement('progressBar'); $barElement->setText($bar->toHtml()); } else { $p->addStyleDeclaration($css->toString()); } $renderer =& $page->defaultRenderer(); $renderer->setFormTemplate('<table class="maintable"><form{attributes}>{content}</form></table>'); $renderer->setHeaderTemplate('<tr><th colspan="2">{header}</th></tr>'); $renderer->setGroupTemplate('<table><tr>{content}</tr></table>', 'name'); $renderer->setGroupElementTemplate('<td>{element}<br /><span style="font-size:10px;"><span class="label">{label}</span></span></td>', 'name'); $page->accept($renderer); $p->addBodyContent($renderer->toHtml()); $p->display(); }
function _renderForm(&$page) { $pageName = $page->getAttribute('name'); $tabPreview = array_slice($page->controller->_tabs, -2, 1); $tab = ' '; $p = new HTML_Page(array('lineend' => OS_WINDOWS ? 'win' : 'unix', 'tab' => $tab, 'doctype' => "XHTML 1.0 Strict", 'language' => 'en', 'cache' => 'false')); $p->disableXmlProlog(); $p->setTitle("PEAR::HTML_Progress - Generator"); $p->setMetaData("author", "Laurent Laville"); $css = ' body { background-color: #7B7B88; font-family: Verdana, Arial, helvetica; font-size: 10pt; } h1 { color: #FFC; text-align: center; } .maintable { width: 100%; border-width: 0; border-style: thin dashed; border-color: #D0D0D0; background-color: #EEE; cellspacing: 2; cellspadding: 3; } th { text-align: center; color: #FFC; background-color: #AAA; white-space: nowrap; } input { font-family: Verdana, Arial, helvetica; } input.flat { border-style: solid; border-width: 2px 2px 0px 2px; border-color: #996; } '; // on preview tab, add progress bar javascript and stylesheet if ($pageName == $tabPreview[0][0]) { $bar = $page->controller->createProgressBar(); $ui =& $bar->getUI(); $ui->setTab($tab); $p->addStyleDeclaration($css . $bar->getStyle()); $p->addScriptDeclaration($bar->getScript()); $barElement =& $page->getElement('progressBar'); $barElement->setText($bar->toHtml()); } else { $p->addStyleDeclaration($css); } $renderer =& $page->defaultRenderer(); $renderer->setFormTemplate('<table class="maintable"><form{attributes}>{content}</form></table>'); $renderer->setHeaderTemplate('<tr><th colspan="2">{header}</th></tr>'); $renderer->setGroupTemplate('<table><tr>{content}</tr></table>', 'name'); $renderer->setGroupElementTemplate('<td>{element}<br /><span style="font-size:10px;"><span class="label">{label}</span></span></td>', 'name'); $page->accept($renderer); $p->addBodyContent($renderer->toHtml()); $p->display(); }
$j = 0; } // end of HTML_Table example // The initializing code can also be in in the form of an HTML // attr="value" string. // Possible attributes are: // - cache ("true" or "false") // - charset (e.g., "utf-8") // - doctype (e.g., "XHTML Basic 1.0") // - language (two letter designator: e.g., "en") // - lineend ("unix", "win", "mac", custom string) // - mime (e.g., "application/xhtml+xml") // - namespace (string) // - tab (e.g., " ") // All the above have defaults, so it is not necessary // to specify everything. For example, the proper namespace // is chosen by default. $p = new HTML_Page(array('lineend' => 'unix', 'doctype' => 'XHTML 1.0 Strict', 'language' => 'en', 'cache' => 'false')); // Page title defaults to "New XHTML 1.0 Page" $p->setTitle("HTML_Page Color Chart example"); $p->setMetaData("author", "Klaus Guenther"); // let's add a Content-Type meta tag $p->setMetaContentType(); $p->addBodyContent("<h1>Color Chart</h1>"); // Objects with toHtml and toString are supported. $p->addBodyContent(&$table); $p->addBodyContent('<p>Copyright 2003 The PHP Group</p>'); // output to browser $p->display(); // or to a file //$p->toFile('example.html');
<?php @(include '../include_path.php'); /** * PEAR::HTML_Page package made it easy to build * a very simple ProgressBar Monitor. * * @version $Id: htmlpage.php,v 1.1 2004/06/27 13:08:50 farell Exp $ * @author Laurent Laville <*****@*****.**> * @package HTML_Progress */ require_once 'HTML/Progress/monitor.php'; require_once 'HTML/Page.php'; $p = new HTML_Page(array('charset' => 'utf-8', 'lineend' => OS_WINDOWS ? 'win' : 'unix', 'doctype' => "XHTML 1.0 Strict", 'language' => 'en', 'cache' => 'false')); $p->setTitle("PEAR::HTML_Progress - Simple Monitor demo"); $p->setMetaData("author", "Laurent Laville"); $progressMonitor = new HTML_Progress_Monitor(); $bar =& $progressMonitor->getProgressElement(); $bar->setAnimSpeed(20); $p->addStyleDeclaration($progressMonitor->getStyle()); $p->addScriptDeclaration($progressMonitor->getScript()); $p->addBodyContent('<h1>PEAR::HTML_Page renderer without user-callback</h1>'); $p->addBodyContent($progressMonitor->toHtml()); $p->addBodyContent('<p><< <a href="../index.html">Back examples TOC</a></p>'); $p->display(); $progressMonitor->run();