home *** CD-ROM | disk | FTP | other *** search
/ Cricao de Sites - 650 Layouts Prontos / WebMasters.iso / Servidores / xampp-win32-1.6.7-installer.exe / php / PEAR / HTML / Progress / generator / default.php next >
Encoding:
PHP Script  |  2008-07-02  |  3.8 KB  |  132 lines

  1. <?php
  2. /**
  3.  * The ActionDisplay class provides the default form rendering.
  4.  *
  5.  * PHP versions 4 and 5
  6.  *
  7.  * LICENSE: This source file is subject to version 3.0 of the PHP license
  8.  * that is available through the world-wide-web at the following URI:
  9.  * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
  10.  * the PHP License and are unable to obtain it through the web, please
  11.  * send a note to license@php.net so we can mail you a copy immediately.
  12.  *
  13.  * @category   HTML
  14.  * @package    HTML_Progress
  15.  * @subpackage Progress_UI
  16.  * @author     Laurent Laville <pear@laurent-laville.org>
  17.  * @copyright  1997-2005 The PHP Group
  18.  * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
  19.  * @version    CVS: $Id: default.php,v 1.4 2005/07/25 13:00:37 farell Exp $
  20.  * @link       http://pear.php.net/package/HTML_Progress
  21.  */
  22.  
  23. /**
  24.  * The ActionDisplay class provides the default form rendering.
  25.  *
  26.  * PHP versions 4 and 5
  27.  *
  28.  * LICENSE: This source file is subject to version 3.0 of the PHP license
  29.  * that is available through the world-wide-web at the following URI:
  30.  * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
  31.  * the PHP License and are unable to obtain it through the web, please
  32.  * send a note to license@php.net so we can mail you a copy immediately.
  33.  *
  34.  * @category   HTML
  35.  * @package    HTML_Progress
  36.  * @subpackage Progress_UI
  37.  * @author     Laurent Laville <pear@laurent-laville.org>
  38.  * @copyright  1997-2005 The PHP Group
  39.  * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
  40.  * @version    Release: 1.2.5
  41.  * @link       http://pear.php.net/package/HTML_Progress
  42.  */
  43.  
  44. class ActionDisplay extends HTML_QuickForm_Action_Display
  45. {
  46.     function _renderForm(&$page)
  47.     {
  48.         $pageName = $page->getAttribute('name');
  49.         $tabPreview = array_slice ($page->controller->_tabs, -2, 1);
  50.  
  51.         $header = '
  52. <style type="text/css">
  53. <!--
  54. body {
  55.   background-color: #7B7B88;
  56.   font-family: Verdana, Arial, helvetica;
  57.   font-size: 10pt;
  58. }
  59.  
  60. h1 {
  61.   color: #FFC;
  62.   text-align: center;
  63. }
  64.  
  65. .maintable {
  66.   width: 100%;
  67.   border-width: 0;
  68.   border-style: thin dashed;
  69.   border-color: #D0D0D0;
  70.   background-color: #EEE;
  71.   cellspacing: 2;
  72.   cellspadding: 3;
  73. }
  74.  
  75. th {
  76.   text-align: center;
  77.   color: #FFC;
  78.   background-color: #AAA;
  79.   white-space: nowrap;
  80. }
  81.  
  82. input {
  83.   font-family: Verdana, Arial, helvetica;
  84. }
  85.  
  86. input.flat {
  87.   border-style: solid;
  88.   border-width: 2px 2px 0 2px;
  89.   border-color: #996;
  90. }
  91.  
  92. {%style%}
  93. // -->
  94. </style>
  95. ';
  96.         // on preview tab, add progress bar javascript and stylesheet
  97.         if ($pageName == $tabPreview[0][0]) {
  98.             $bar = $page->controller->createProgressBar();
  99.             $ui =& $bar->getUI();
  100.             $ui->setTab('  ');
  101.  
  102.             $header .= '
  103. <script type="text/javascript">
  104. <!--
  105. {%javascript%}
  106. //-->
  107. </script>
  108. ';
  109.             $placeHolders = array('{%style%}', '{%javascript%}');
  110.             $htmlElement = array( $bar->getStyle(), $bar->getScript() );
  111.  
  112.             $header = str_replace($placeHolders, $htmlElement, $header);
  113.  
  114.             $barElement =& $page->getElement('progressBar');
  115.             $barElement->setText( $bar->toHtml() );
  116.         } else {
  117.             $header = str_replace('{%style%}', '', $header);
  118.         }
  119.  
  120.         $renderer =& $page->defaultRenderer();
  121.  
  122.         $renderer->setFormTemplate($header.'<table class="maintable"><form{attributes}>{content}</form></table>');
  123.         $renderer->setHeaderTemplate('<tr><th colspan="2">{header}</th></tr>');
  124.         $renderer->setGroupTemplate('<table><tr>{content}</tr></table>', 'name');
  125.         $renderer->setGroupElementTemplate('<td>{element}<br /><span class="qfLabel">{label}</span></td>', 'name');
  126.  
  127.         $page->accept($renderer);
  128.  
  129.         echo $renderer->toHtml();
  130.     }
  131. }
  132. ?>