home *** CD-ROM | disk | FTP | other *** search
/ Enter 2004 June / ENTER.ISO / files / xampp-win32-1.4.5-installer.exe / xampp / HTMLPage.php < prev    next >
Encoding:
PHP Script  |  2004-03-24  |  4.5 KB  |  98 lines

  1. <?php
  2. // +----------------------------------------------------------------------+
  3. // | PHP Version 4                                                        |
  4. // +----------------------------------------------------------------------+
  5. // | Copyright (c) 1997-2004 The PHP Group                                |
  6. // +----------------------------------------------------------------------+
  7. // | This source file is subject to version 3.0 of the PHP license,       |
  8. // | that is bundled with this package in the file LICENSE, and is        |
  9. // | available at through the world-wide-web at                           |
  10. // | http://www.php.net/license/3_0.txt.                                  |
  11. // | If you did not receive a copy of the PHP license and are unable to   |
  12. // | obtain it through the world-wide-web, please send a note to          |
  13. // | license@php.net so we can mail you a copy immediately.               |
  14. // +----------------------------------------------------------------------+
  15. // | Author: Laurent Laville <pear@laurent-laville.org>                   |
  16. // +----------------------------------------------------------------------+
  17. //
  18. // $Id: HTMLPage.php,v 1.1 2004/02/13 15:36:55 farell Exp $
  19.  
  20. require_once 'HTML/Page.php';
  21.  
  22. /**
  23.  * The ActionDisplay class provides a HTML_Page form rendering.
  24.  *
  25.  * @version    1.1
  26.  * @author     Laurent Laville <pear@laurent-laville.org>
  27.  * @access     public
  28.  * @category   HTML
  29.  * @package    HTML_Progress
  30.  * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
  31.  */
  32.  
  33. class ActionDisplay extends HTML_QuickForm_Action_Display
  34. {
  35.     function _renderForm(&$page) 
  36.     {
  37.         $pageName = $page->getAttribute('name');
  38.         $tabPreview = array_slice ($page->controller->_tabs, -2, 1);
  39.  
  40.         $p = new HTML_Page(array(
  41.                  'lineend'  => OS_WINDOWS ? 'win' : 'unix',
  42.                  'doctype'  => "XHTML 1.0 Strict",
  43.                  'language' => 'en',
  44.                  'cache'    => 'false'
  45.              ));        
  46.         $p->disableXmlProlog();
  47.         $p->setTitle("PEAR::HTML_Progress - Generator");
  48.         $p->setMetaData("author", "Laurent Laville");
  49.  
  50.         $css = new HTML_CSS();
  51.         $css->setStyle('body', 'background-color', '#7B7B88');
  52.         $css->setStyle('body', 'font-family', 'Verdana, Arial, helvetica');
  53.         $css->setStyle('body', 'font-size', '10pt');
  54.         $css->setStyle('h1', 'color', '#FFC');
  55.         $css->setStyle('h1', 'text-align', 'center');
  56.         $css->setStyle('.maintable', 'width', '100%');
  57.         $css->setStyle('.maintable', 'border-width', '0');
  58.         $css->setStyle('.maintable', 'border-style', 'thin dashed');
  59.         $css->setStyle('.maintable', 'border-color', '#D0D0D0');
  60.         $css->setStyle('.maintable', 'background-color', '#EEE');
  61.         $css->setStyle('.maintable', 'cellspacing', '2');
  62.         $css->setStyle('.maintable', 'cellspadding', '3');
  63.         $css->setStyle('th', 'text-align', 'center');
  64.         $css->setStyle('th', 'color', '#FFC');
  65.         $css->setStyle('th', 'background-color', '#AAA');
  66.         $css->setStyle('th', 'white-space', 'nowrap');
  67.         $css->setStyle('input', 'font-family', 'Verdana, Arial, helvetica');
  68.         $css->setStyle('input.flat', 'border-style', 'solid');
  69.         $css->setStyle('input.flat', 'border-width', '2px 2px 0px 2px');
  70.         $css->setStyle('input.flat', 'border-color', '#996');
  71.  
  72.         // on preview tab, add progress bar javascript and stylesheet
  73.         if ($pageName == $tabPreview[0][0]) {
  74.             $bar = $page->controller->createProgressBar();
  75.  
  76.             $p->addStyleDeclaration( $css->toString() . $bar->getStyle() );
  77.             $p->addScriptDeclaration( $bar->getScript() );
  78.  
  79.             $barElement =& $page->getElement('progressBar');
  80.             $barElement->setText( $bar->toHtml() );
  81.         } else {
  82.             $p->addStyleDeclaration( $css->toString() );
  83.         }
  84.  
  85.         $renderer =& $page->defaultRenderer();
  86.  
  87.         $renderer->setFormTemplate('<table class="maintable"><form{attributes}>{content}</form></table>');
  88.         $renderer->setHeaderTemplate('<tr><th colspan="2">{header}</th></tr>');
  89.         $renderer->setGroupTemplate('<table><tr>{content}</tr></table>', 'name');
  90.         $renderer->setGroupElementTemplate('<td>{element}<br /><span style="font-size:10px;"><span class="label">{label}</span></span></td>', 'name');
  91.  
  92.         $page->accept($renderer);
  93.  
  94.         $p->addBodyContent( $renderer->toHtml() );
  95.     $p->display();
  96.     }
  97. }
  98. ?>