home *** CD-ROM | disk | FTP | other *** search
/ Enter 2004 June / ENTER.ISO / files / xampp-win32-1.4.5-installer.exe / xampp / ui.setprogressattributes.cls < prev    next >
Encoding:
Text File  |  2004-03-24  |  3.7 KB  |  138 lines

  1. <refentry id="{@id}">
  2.  <refnamediv>
  3.   <refname>setProgressAttributes Manual</refname>
  4.   <refpurpose>defines look and feel of the core of progress bar</refpurpose>
  5.  </refnamediv>
  6.  <refsynopsisdiv>
  7.   <refsynopsisdivinfo>
  8.    <author>
  9.     by Laurent Laville
  10.     <authorblurb>{@link mailto:pear@laurent-laville.org}</authorblurb>
  11.    </author>
  12.    <copyright>November 2003, Laurent Laville</copyright>
  13.    <releaseinfo>HTML_Progress 1.0+</releaseinfo>
  14.   </refsynopsisdivinfo>
  15.  </refsynopsisdiv>
  16.  <refsect1 id="{@id synopsis}">
  17.   <title>Synopsis</title>
  18.   <para><emphasis>void</emphasis> <important>setProgressAttributes</important>( $attributes )</para>
  19.  </refsect1>
  20.  <refsect1 id="{@id attributes}">
  21.   <title>Attributes</title>
  22.   <para>
  23.    <table frame="all">
  24.     <tgroup cols="3">
  25.     <thead align="center">
  26.       <row>
  27.        <entry><important>Name</important></entry>
  28.        <entry><important>Type</important></entry>
  29.        <entry><important>Default</important></entry>
  30.       </row>
  31.     </thead>
  32.     <tbody>
  33.      <row>
  34.       <entry><emphasis>attributes</emphasis> </entry>
  35.       <entry>array                  </entry>
  36.       <entry>
  37.        <itemizedlist>
  38.         <listitem>class => progressBar     </listitem>
  39.         <listitem>background-color => #FFFFFF              </listitem>
  40.         <listitem>auto-size => true | [ false ]            </listitem>
  41.         <listitem>width             </listitem>
  42.         <listitem>height            </listitem>
  43.        </itemizedlist>
  44.       </entry>
  45.      </row>
  46.     </tbody>
  47.     </tgroup>
  48.    </table>
  49.   </para>
  50.   <para>
  51.    <emphasis>$attributes</emphasis> is an associative array or string of HTML tag attributes.
  52.   </para>
  53.  </refsect1>
  54.  <refsect1 id="{@id description}">
  55.   <title>Description</title>
  56.   <para>The <emphasis>setProgressAttributes()</emphasis> method is used to give a look and feel,
  57.    such as size and color, to the core of progress bar.
  58.   </para>
  59.  </refsect1>
  60.  <refsect1 id="{@id example}">
  61.   <title>Example</title>
  62.   <para>
  63.    Example below will produced a plain progress bar. It's a dynamic example, the progress bar
  64.    will run.
  65.    <para><graphic fileref="../media/screenshots/bullit.png"></graphic></para>
  66.    <programlisting role="php">
  67.    <![CDATA[
  68. <?php
  69. require_once ('HTML/Progress.php');
  70.  
  71. $bar = new HTML_Progress();
  72. $bar->setIncrement(10);
  73. $bar->setBorderPainted(true);
  74.  
  75. $ui =& $bar->getUI();
  76. $ui->setCellAttributes(array(
  77.     'active-color' => '#000084',
  78.     'inactive-color' => '#3A6EA5',
  79.     'width' => 20,
  80.     'spacing' => 0
  81. ));
  82. $ui->setBorderAttributes('width=1 style=inset color=white');
  83. $ui->setStringAttributes(array(
  84.     'width' => 200,
  85.     'height' => 20,
  86.     'font-size' => 14,
  87.     'background-color' => '#C3C6C3',
  88.     'valign' => 'top'
  89. ));
  90.  
  91. ?>
  92. <!DOCTYPE html
  93.     PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  94.     "http://www.w3c.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  95.  
  96. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
  97. <head>
  98. <title>Progress example</title>
  99. <style type="text/css">
  100. <!--
  101. <?php echo $bar->getStyle(); ?>
  102. // -->
  103. </style>
  104. <script type="text/javascript">
  105. <!--
  106. <?php echo $ui->getScript(); ?>
  107. //-->
  108. </script>
  109. </head>
  110. <body bgcolor="#C3C6C3">
  111.  
  112. <?php 
  113. echo $bar->toHtml(); 
  114.  
  115. do {
  116.     $bar->display();
  117.     if ($bar->getPercentComplete() == 1) {
  118.         break;   // the progress bar has reached 100%
  119.     }
  120.     $bar->incValue();
  121. } while(1);
  122. ?>
  123.  
  124. </body>
  125. </html>
  126.    ]]>
  127.    </programlisting>
  128.   </para>
  129.  </refsect1>
  130.  <refsect1 id="{@id seealso}">
  131.   <title>See Also</title>
  132.   <para>
  133.    To build a plain bar the cell spacing should be set to zero. To do it,
  134.    see {@tutorial ui.setcellattributes.cls} 
  135.   </para>
  136.  </refsect1>
  137. </refentry>
  138.