Skip to content
Newer
Older
100644 54 lines (41 sloc) 1.34 KB
d94cdcf initial import on PEAR cvs
Stephan Schmidt authored
1 <?PHP
2 /**
3 * Simple example that builds two progress bars,
4 * one determined and one undetermined.
5 *
6 * @author Stephan Schmidt <schst@php.net>
7 * @package XML_XUL
8 * @subpackage Examples
9 */
10
11 /**
12 * require XML_XUL package
13 */
14 require_once 'XML/XUL.php';
15
ed444d1 @CloCkWeRX PHP5-ify
CloCkWeRX authored
16 $doc = XML_XUL::createDocument();
d94cdcf initial import on PEAR cvs
Stephan Schmidt authored
17
18 $doc->addStylesheet('chrome://global/skin/');
19
ed444d1 @CloCkWeRX PHP5-ify
CloCkWeRX authored
20 $win = $doc->createElement('window', array('title'=> 'Example for PEAR::XML_XUL'));
d94cdcf initial import on PEAR cvs
Stephan Schmidt authored
21 $doc->addRoot($win);
22
ed444d1 @CloCkWeRX PHP5-ify
CloCkWeRX authored
23 $box = $doc->createElement( 'Groupbox' );
d94cdcf initial import on PEAR cvs
Stephan Schmidt authored
24 $win->appendChild($box);
25
26 $box->setCaption( 'Using a progressmeter' );
27
28 $box->addDescription( 'Progressmeters can either be determined...' );
29
ed444d1 @CloCkWeRX PHP5-ify
CloCkWeRX authored
30 $meter = $doc->createElement( 'Progressmeter', array( 'mode' => 'determined', 'value' => '30%', 'height' => 20 ) );
d94cdcf initial import on PEAR cvs
Stephan Schmidt authored
31 $box->appendChild( $meter );
32
33 $box->addDescription( '...or undetermined.' );
34
ed444d1 @CloCkWeRX PHP5-ify
CloCkWeRX authored
35 $meter2 = $doc->createElement( 'Progressmeter', array( 'mode' => 'undetermined', 'height' => 20 ) );
d94cdcf initial import on PEAR cvs
Stephan Schmidt authored
36 $box->appendChild( $meter2 );
37
7a0fea7 fixed E_ALL notices
Stephan Schmidt authored
38 if (!isset($_GET['mode'])) {
39 $_GET['mode'] = 'default';
40 }
41
d94cdcf initial import on PEAR cvs
Stephan Schmidt authored
42 if ($_GET['mode'] == 'debug') {
43 require_once 'XML/Beautifier.php';
ed444d1 @CloCkWeRX PHP5-ify
CloCkWeRX authored
44 $fmt = new XML_Beautifier( array( 'indent' => ' ' ) );
d94cdcf initial import on PEAR cvs
Stephan Schmidt authored
45 echo '<pre>';
46 echo htmlspecialchars( $fmt->formatString($doc->serialize()) );
47 echo '</pre>';
48 } elseif ($_GET['mode'] == 'source') {
49 highlight_file( __FILE__ );
50 } else {
51 $doc->send();
52 }
ed444d1 @CloCkWeRX PHP5-ify
CloCkWeRX authored
53 ?>
Something went wrong with that request. Please try again.