/[cvs]/nfo/php/libs/com.newsblob.phphtmllib/examples/widget14.php
ViewVC logotype

Contents of /nfo/php/libs/com.newsblob.phphtmllib/examples/widget14.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations)
Thu May 6 16:57:23 2004 UTC (20 years, 2 months ago) by jonen
Branch: MAIN
CVS Tags: HEAD
 updated all to v2.4.1 - Apr 01, 2004

1 <?php
2
3 /**
4 * This example illustrates the use of the
5 * permissions checking mechanism built into the
6 * PageWidget object.
7 *
8 *
9 * $Id: widget14.php,v 1.4 2004/02/03 23:46:51 hemna Exp $
10 *
11 * @author Walter A. Boring IV <waboring@buildabetterweb.com>
12 * @package phpHtmlLib
13 * @subpackage widget-examples
14 * @version 2.4.0
15 *
16 */
17
18 /**
19 * Include the phphtmllib libraries
20 *
21 */
22 include_once("includes.inc");
23
24 require_once($phphtmllib."/widgets/TabWidget.inc");
25
26 class FirstTab extends TabWidget {
27 function FirstTab($title='First Tab Title') {
28 $this->TabWidget($title);
29 }
30
31 function content() {
32 return 'testing 123';
33 }
34 }
35
36 class FooTab extends TabWidget {
37 function FooTab() {
38 $this->TabWidget('Foo');
39 }
40
41 function content() {
42 $dialog = new MessageBoxWidget("Some title", "400",
43 container("This is a message",
44 html_br(2),
45 "Want to see a permissions error?",
46 html_br(),
47 html_a($_SERVER["PHP_SELF"]."?failed=1",
48 "Click Here"))
49 );
50 return container(html_br(),$dialog, html_br());
51 }
52 }
53
54 class test extends TabWidget {
55 function content() {
56 return "test ".$this->get_title();
57 }
58 }
59
60 class WidgetListPage extends PageWidget {
61
62
63 function WidgetListPage($title) {
64 $this->PageWidget($title, HTML);
65
66 //we need this for the css defined for the InfoTable
67 //for the DialogWidget. The DialogWidget uses InfoTable.
68 $this->add_css_link("/phphtmllib/css/defaulttheme.php");
69 }
70
71 /**
72 * This will only get called if we have permissions to
73 * build and render the content for this page object.
74 *
75 * @return object
76 */
77 function body_content() {
78 $tablist = new TabList("Scan");
79 $tablist->add( new FirstTab );
80 $tablist->add( new FooTab );
81 $tablist->add( new FirstTab('Third tab!') );
82
83 $subtab = new TabList("list");
84 $subtab->add( new test("sub 1") );
85 $subtab->add( new test("sub 2") );
86 $subtab->add( new test("sub 3") );
87 $subtab->add( new test("sub 4") );
88
89 $tablist->add( $subtab );
90
91
92 $div = html_div('', $tablist);
93 $div->set_style('width: 600px');
94 return $div;
95 }
96 }
97
98 //build the Page object and try and
99 //render it's content.
100 //the permissions checking happens at
101 //'constructor' time.
102 $page = new WidgetListPage("testing");
103
104 //the render method will not call the
105 //content building methods if the permissions
106 //fail.
107 print $page->render();
108 ?>

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed