home *** CD-ROM | disk | FTP | other *** search
/ Enter 2004 June / ENTER.ISO / files / xampp-win32-1.4.5-installer.exe / xampp / gettingstarted.pkg < prev    next >
Encoding:
Text File  |  2004-03-24  |  11.6 KB  |  316 lines

  1. <refentry id="{@id}">
  2.  <refnamediv>
  3.   <refname>Getting Started</refname>
  4.   <refpurpose>how to begin with HTML_Progress package</refpurpose>
  5.  </refnamediv>
  6.  <refsynopsisdiv>
  7.   <refsynopsisdivinfo>
  8.    <author>
  9.     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.  {@toc}
  17.  <refsect1 id="{@id installing}">
  18.   <title>Installing</title>
  19.   <orderedlist>
  20.     <listitem><para>Setup the PEAR package manager (if you haven't got it already) - 
  21.      see {@link http://pear.php.net/manual/en/installation.getting.php Getting the manager}
  22.      (command line version) - or
  23.      {@link http://www.phpkitchen.com/article.php?story=20021201062516970 Getting Up and Running with the PEAR Web Installer}
  24.      (web package manager).
  25.      </para>
  26.     </listitem>
  27.     <listitem><para>Type <emphasis>pear install HTML_Progress</emphasis> 
  28.      (using the command line manager)</para></listitem>
  29.     <listitem><para>PEAR::HTML_Progress is now installed</para></listitem>
  30.   </orderedlist>
  31.  </refsect1>
  32.  <refsect1 id="{@id inahurry}">
  33.   <title>In a hurry</title>
  34.    <para>You can't wait to read the full documentation and tutorials, so you write few lines
  35.     of code as below ...
  36.    </para>
  37.    <para>
  38.     <programlisting role="php">
  39.     <![CDATA[
  40. <?php
  41. require_once ('HTML/Progress.php');
  42.  
  43. $bar = new HTML_Progress();
  44.  
  45. echo $bar->toHtml(); 
  46. ?>
  47.     ]]>
  48.     </programlisting>
  49.    </para>
  50.    <para>And you only get a such result :
  51.    <graphic fileref="../media/screenshots/inahurry.png"></graphic></para>
  52.    <para>What's wrong ? Read the {@tutorial HTML_Progress.pkg#faq} to know why, or start out 
  53.     right away, and read {@tutorial howto.pkg}
  54.    </para>
  55.  </refsect1>
  56.  <refsect1 id="{@id intro}">
  57.   <title>Introduction</title>
  58.    <para>
  59.     Sometimes a task running within a program might take a while to complete. A user-friendly 
  60.     program provides some indication to the user that the task is occurring, how long the task 
  61.     might take, and how much work has already been done. One way of indicating work, and perhaps 
  62.     the amount of progress, is to use an animated image.
  63.    </para>
  64.    <para>
  65.     Another way of indicating work is to set the wait cursor.
  66.     To convey how complete a task is, you can use a progress bar like this one:
  67.    <para><graphic fileref="../media/screenshots/nostring.png"></graphic></para>
  68.    </para>
  69.    <para>
  70.     Sometimes you can't immediately determine the length of a long-running task, or the task 
  71.     might stay stuck at the same state of completion for a long time. You can show work without 
  72.     measurable progress by putting the progress bar in indeterminate mode. A progress bar in 
  73.     indeterminate mode displays animation to indicate that work is occurring. As soon as the 
  74.     progress bar can display more meaningful information, you should switch it back into its 
  75.     default, determinate mode. Indeterminate progress bars look like this:
  76.    <para><graphic fileref="../media/screenshots/indeterminate.png"></graphic></para>
  77.    </para>
  78.  </refsect1>
  79.  <refsect1 id="{@id pkg-overview}">
  80.   <title>Package Overview</title>
  81.    <para>
  82.     HTML_Progress provides 6 main classes to help you use progress bars:
  83.    </para>
  84.   <refsect2 id="{@id class-bar}">
  85.    <title>Global Classes</title>
  86.    <para>
  87.     <unorderedlist>
  88.      <listitem>HTML_Progress
  89.       <para>Main component to graphically display how much of a total task has completed.
  90.        See (Using Determinate Progress Bars) for information and an example of using a typical
  91.        progress bar. The section {@tutorial indeterminate.pkg} tells you how to animate a progress
  92.        bar to show activity before the task's scope is known.
  93.       </para>
  94.      </listitem>
  95.      <listitem>Error_Raise
  96.       <author>
  97.        by Greg Beaver
  98.        <authorblurb>{@link mailto:cellog@php.net}</authorblurb>
  99.       </author>
  100.       <para>The Error_Raise static class contains tremendously simple and powerful
  101.        error management based on error codes.
  102.       </para>
  103.      </listitem>
  104.      <listitem>Error_Util
  105.       <author>
  106.        by Greg Beaver
  107.        <authorblurb>{@link mailto:cellog@php.net}</authorblurb>
  108.       </author>
  109.       <para>This class is used for advanced retrieval of context information, and for
  110.        callback validation.  It also has a few miscellaneous functions for processing
  111.        display of variables.
  112.       </para>
  113.      </listitem>
  114.      <para>Until this package is accepted as a PEAR package, it can be downloaded at 
  115.       {@link http://www.chiaraquartet.net/Error_Raise-0.2.2.tgz}, and was integrated
  116.       in {@link http://pear.php.net/package/HTML_Progress HTML_Progress} package.
  117.      </para>
  118.     </unorderedlist>
  119.    </para>
  120.   </refsect2>
  121.   <refsect2 id="{@id class-dm}">
  122.    <title>DataModel Classes</title>
  123.    <para>
  124.     <unorderedlist>
  125.      <listitem>HTML_Progress_DM
  126.       <para>This class handles any mathematical issues arising from assigning faulty values.
  127.        You can overload it with {@link HTML_Progress::setDM()} method.
  128.       </para>
  129.      </listitem>
  130.     </unorderedlist>
  131.    </para>
  132.   </refsect2>
  133.   <refsect2 id="{@id class-ui}">
  134.    <title>User Interface Classes</title>
  135.    <para>
  136.     <unorderedlist>
  137.      <listitem>HTML_Common
  138.       <para>This class provides methods for html code display and attributes handling.
  139.        It is a base class for other HTML classes and can be downloaded at PEAR under 
  140.        {@link http://pear.php.net/package/HTML_Common HTML_Common} package.
  141.       </para>
  142.      </listitem>
  143.      <listitem>HTML_Progress_UI
  144.       <para>This class provides a basic look and feel implementation of a progress bar.
  145.        You can overload it with {@link HTML_Progress::setUI()} method.
  146.       </para>
  147.      </listitem>
  148.      <listitem>HTML_Progress_Model
  149.       <para>This class provides an easy way to set look and feel of a progress bar with 
  150.        external config file. This class requires another great PEAR package, the
  151.        {@link http://pear.php.net/package/Config Config} package which provides methods 
  152.        for configuration manipulation.
  153.       </para>
  154.      </listitem>
  155.     </unorderedlist>
  156.    </para>
  157.   </refsect2>
  158.   <refsect2 id="{@id class-observer}">
  159.    <title>Observers Classes</title>
  160.    <para>
  161.     <unorderedlist>
  162.      <listitem>HTML_Progress_Observer
  163.       <para>This class implements the observer pattern for watching progress bar activity 
  164.        and taking actions on exceptional events.
  165.       </para>
  166.      </listitem>
  167.      <listitem>HTML_Progress_Monitor
  168.       <para>This class allow an easy way to display progress in a dialog. The user can cancel 
  169.        the task.
  170.        It requires another PEAR package, the 
  171.        {@link http://pear.php.net/package/HTML_QuickForm HTML_QuickForm} package which 
  172.        provides methods for creating, validating, processing HTML forms.
  173.       </para>
  174.      </listitem>
  175.     </unorderedlist>
  176.    </para>
  177.   </refsect2>
  178.  </refsect1>
  179.  <refsect1 id="{@id cls-overview}">
  180.   <title>Method Overview</title>
  181.   <refsect2 id="{@id constructors}">
  182.    <title>Constructors</title>
  183.    <para>
  184.     The constructors of the Main class accept integer values as their arguments, beginning with 
  185.     the orientation (on the left) across to the maximum (on the right), depending on what value
  186.     you've at your disposal, for example;   
  187.    </para>
  188.    <para>
  189.     <programlisting role="php">
  190.     <![CDATA[
  191. <?php
  192. require_once ('HTML/Progress.php');
  193.  
  194. $bar1 = new HTML_Progress();
  195. $bar2 = new HTML_Progress(HTML_PROGRESS_BAR_VERTICAL);
  196. $bar3 = new HTML_Progress(0,100);
  197. $bar4 = new HTML_Progress(HTML_PROGRESS_BAR_VERTICAL,0,100);
  198.  
  199. ?>
  200.     ]]>
  201.     </programlisting>
  202.    </para>
  203.    <para>
  204.     The exception to that is a <emphasis>HTML_Progress($model)</emphasis> which takes an 
  205.     HTML_Progress_Model object as it's first argument.
  206.    </para>
  207.   </refsect2>
  208.   <refsect2 id="{@id mth-math}">
  209.    <title>Mathematical Methods</title>
  210.    <para>
  211.     Default mathematical model ({@link HTML_Progress_DM} class) handles a common progress bar
  212.     with a minimum and initial value sets to 0, a maximum set to 100, and an increment set to 1.
  213.     But in particular cases, you may have another limit. It's up to you to defines these limits,
  214.     with 4 methods:
  215.    </para>
  216.    <para>
  217.     <unorderedlist>
  218.      <listitem>{@link HTML_Progress::setMinimum()}   </listitem>
  219.      <listitem>{@link HTML_Progress::setMaximum()}   </listitem>
  220.      <listitem>{@link HTML_Progress::setValue()}     </listitem>
  221.      <listitem>{@link HTML_Progress::setIncrement()} </listitem>
  222.     </unorderedlist>
  223.    </para>
  224.    <para>
  225.     <programlisting role="php">
  226.     <![CDATA[
  227. <?php
  228. require_once ('HTML/Progress.php');
  229.  
  230. $bar = new HTML_Progress();
  231. $bar->setMinimum(0);
  232. $bar->setMaximum(60);
  233. $bar->setValue(10);
  234. $bar->setIncrement(10);
  235.  
  236. ?>
  237.     ]]>
  238.     </programlisting>
  239.    </para>
  240.   </refsect2>
  241.   <refsect2 id="{@id mth-graphic}">
  242.    <title>Graphical Methods</title>
  243.    <para>
  244.     Default user interface ({@link HTML_Progress_UI} class) handles a common progress bar
  245.     with 10 cells, no border and a percent string information.
  246.     But in most of case, you would change these default and give your own graphical chart.
  247.     You can do it with 7 methods:
  248.    </para>
  249.    <para>
  250.     <unorderedlist>
  251.      <listitem>{@link HTML_Progress_UI::setProgressAttributes()} </listitem>
  252.      <listitem>{@link HTML_Progress_UI::setStringAttributes()}   </listitem>
  253.      <listitem>{@link HTML_Progress_UI::setBorderAttributes()}   </listitem>
  254.      <listitem>{@link HTML_Progress_UI::setCellAttributes()}     </listitem>
  255.      <listitem>{@link HTML_Progress_UI::setCellCount()}          </listitem>
  256.      <listitem>{@link HTML_Progress_UI::setOrientation()}        </listitem>
  257.      <listitem>{@link HTML_Progress_UI::setFillWay()}            </listitem>
  258.     </unorderedlist>
  259.    </para>
  260.    <para>
  261.     <programlisting role="php">
  262.     <![CDATA[
  263. <?php
  264. require_once ('HTML/Progress.php');
  265.  
  266. $bar = new HTML_Progress();
  267.  
  268. $ui =& $bar->getUI();
  269. $ui->setProgressAttributes(array(
  270.     'background-color' => '#e0e0e0'
  271. ));        
  272. $ui->setStringAttributes(array(
  273.     'valign' => 'left',
  274.     'color'  => 'red',
  275.     'background-color' => 'lightblue'
  276. ));
  277. $ui->setBorderAttributes(array(
  278.         'width' => 1,
  279.         'style' => 'solid',
  280.         'color' => 'navy'
  281. ));
  282. $ui->setCellAttributes(array(
  283.         'active-color' => '#3874B4',
  284.         'inactive-color' => '#EEEECC'
  285. ));        
  286. $ui->setCellCount(20);
  287. $ui->setOrientation(HTML_PROGRESS_BAR_VERTICAL);
  288. $ui->setFillWay('reverse');
  289.  
  290. ?>
  291.     ]]>
  292.     </programlisting>
  293.    </para>
  294.   </refsect2>
  295.   <refsect2 id="{@id mth-listeners}">
  296.    <title>Listeners Methods</title>
  297.    <para>
  298.     {@link HTML_Progress_Observer} class provide an implementation of the observer pattern.
  299.     In the content of the HTML_Progress package, it provide a mechanism by which you can 
  300.     examine special event as it is happened. This allows the implementation of special behavior.
  301.     For example, the observer code could send an email when the progress bar reach 100%.
  302.    </para>
  303.    <para>Observer pattern is explains on details in {@tutorial observers.pkg}. To display,
  304.     activate, or remove the listener mechanism, you have 3 methods :
  305.    </para>
  306.    <para>
  307.     <unorderedlist>
  308.      <listitem>{@link HTML_Progress::addListener()}    </listitem>
  309.      <listitem>{@link HTML_Progress::removeListener()} </listitem>
  310.      <listitem>{@link HTML_Progress::getListeners()}   </listitem>
  311.     </unorderedlist>
  312.    </para>
  313.   </refsect2>
  314.  </refsect1>
  315. </refentry>
  316.