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 / HTMLPage.php < prev    next >
Encoding:
PHP Script  |  2008-07-02  |  4.1 KB  |  133 lines

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