home *** CD-ROM | disk | FTP | other *** search
/ Enter 2004 June / ENTER.ISO / files / xampp-win32-1.4.5-installer.exe / xampp / default.php < prev    next >
Encoding:
PHP Script  |  2004-03-24  |  4.2 KB  |  99 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: default.php,v 1.1 2004/02/13 15:36:55 farell Exp $
  19.  
  20. /**
  21.  * The ActionDisplay class provides the default form rendering.
  22.  *
  23.  * @version    1.1
  24.  * @author     Laurent Laville <pear@laurent-laville.org>
  25.  * @access     public
  26.  * @category   HTML
  27.  * @package    HTML_Progress
  28.  * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
  29.  */
  30.  
  31. class ActionDisplay extends HTML_QuickForm_Action_Display
  32. {
  33.     function _renderForm(&$page) 
  34.     {
  35.         $pageName = $page->getAttribute('name');
  36.         $tabPreview = array_slice ($page->controller->_tabs, -2, 1);
  37.  
  38.         $css = new HTML_CSS();
  39.         $css->setStyle('body', 'background-color', '#7B7B88');
  40.         $css->setStyle('body', 'font-family', 'Verdana, Arial, helvetica');
  41.         $css->setStyle('body', 'font-size', '10pt');
  42.         $css->setStyle('h1', 'color', '#FFC');
  43.         $css->setStyle('h1', 'text-align', 'center');
  44.         $css->setStyle('.maintable', 'width', '100%');
  45.         $css->setStyle('.maintable', 'border-width', '0');
  46.         $css->setStyle('.maintable', 'border-style', 'thin dashed');
  47.         $css->setStyle('.maintable', 'border-color', '#D0D0D0');
  48.         $css->setStyle('.maintable', 'background-color', '#EEE');
  49.         $css->setStyle('.maintable', 'cellspacing', '2');
  50.         $css->setStyle('.maintable', 'cellspadding', '3');
  51.         $css->setStyle('th', 'text-align', 'center');
  52.         $css->setStyle('th', 'color', '#FFC');
  53.         $css->setStyle('th', 'background-color', '#AAA');
  54.         $css->setStyle('th', 'white-space', 'nowrap');
  55.         $css->setStyle('input', 'font-family', 'Verdana, Arial, helvetica');
  56.         $css->setStyle('input.flat', 'border-style', 'solid');
  57.         $css->setStyle('input.flat', 'border-width', '2px 2px 0px 2px');
  58.         $css->setStyle('input.flat', 'border-color', '#996');
  59.  
  60. $header = '
  61. <style type="text/css">
  62. <!--
  63. {%style%}
  64. // -->
  65. </style>
  66. ';
  67.         // on preview tab, add progress bar javascript and stylesheet
  68.         if ($pageName == $tabPreview[0][0]) {
  69.             $bar = $page->controller->createProgressBar();
  70.  
  71.             $header .= '
  72. <script type="text/javascript">
  73. <!--
  74. {%javascript%}
  75. //-->
  76. </script>
  77. ';
  78.             $header = str_replace('{%style%}', $css->toString() . $bar->getStyle(), $header);
  79.             $header = str_replace('{%javascript%}', $bar->getScript(), $header);
  80.  
  81.             $barElement =& $page->getElement('progressBar');
  82.             $barElement->setText( $bar->toHtml() );
  83.         } else {
  84.             $header = str_replace('{%style%}', $css->toString(), $header);
  85.         }
  86.  
  87.         $renderer =& $page->defaultRenderer();
  88.  
  89.         $renderer->setFormTemplate($header.'<table class="maintable"><form{attributes}>{content}</form></table>');
  90.         $renderer->setHeaderTemplate('<tr><th colspan="2">{header}</th></tr>');
  91.         $renderer->setGroupTemplate('<table><tr>{content}</tr></table>', 'name');
  92.         $renderer->setGroupElementTemplate('<td>{element}<br /><span class="qfLabel">{label}</span></td>', 'name');
  93.  
  94.         $page->accept($renderer);
  95.  
  96.         echo $renderer->toHtml();
  97.     }
  98. }
  99. ?>