1 |
jonen |
1.1 |
<?php |
2 |
|
|
|
3 |
|
|
/** |
4 |
|
|
* This example illustrates the use of the |
5 |
|
|
* DataList object classes. This object |
6 |
|
|
* can show a list of data from any data source |
7 |
|
|
* and have any GUI layout and provide the |
8 |
|
|
* features of: |
9 |
|
|
* searching, sorting, paging of the data. |
10 |
|
|
* |
11 |
|
|
* This page shows the Data coming a CSV |
12 |
|
|
* (comma seperated values) file on disk. |
13 |
|
|
* |
14 |
jonen |
1.3 |
* $Id: widget7.php,v 1.4 2003/07/28 17:02:03 hemna Exp $ |
15 |
jonen |
1.1 |
* |
16 |
|
|
* @author Walter A. Boring IV <waboring@buildabetterweb.com> |
17 |
|
|
* @package phpHtmlLib |
18 |
|
|
* @subpackage widget-examples |
19 |
|
|
* @version 2.0 |
20 |
|
|
* |
21 |
|
|
*/ |
22 |
|
|
|
23 |
|
|
/** |
24 |
|
|
* Include the phphtmllib libraries |
25 |
|
|
* |
26 |
|
|
*/ |
27 |
|
|
include_once("includes.inc"); |
28 |
|
|
include_once("db_defines.inc"); |
29 |
|
|
|
30 |
|
|
include_once($phphtmllib."/widgets/data_list/includes.inc"); |
31 |
|
|
include_once($phphtmllib."/widgets/data_list/CSVFILEDataListSource.inc"); |
32 |
|
|
|
33 |
|
|
/** |
34 |
|
|
* This class shows how to use the data coming |
35 |
|
|
* from a CSV Formatted file |
36 |
|
|
* |
37 |
|
|
*/ |
38 |
|
|
class csvfilelist extends DefaultGUIDataList { |
39 |
|
|
|
40 |
|
|
function get_data_source() { |
41 |
|
|
$source = new CSVFILEDataListSource("test.csv"); |
42 |
|
|
$this->set_data_source( &$source ); |
43 |
|
|
} |
44 |
|
|
|
45 |
|
|
function user_setup() { |
46 |
|
|
$this->add_header_item("First Name", "200", "FName", SORTABLE, SEARCHABLE); |
47 |
|
|
$this->add_header_item("Last Name", "200", "LName", SORTABLE, SEARCHABLE); |
48 |
|
|
$this->add_header_item("Email", "200", "Email", SORTABLE, SEARCHABLE, "center"); |
49 |
|
|
} |
50 |
|
|
} |
51 |
|
|
|
52 |
|
|
|
53 |
|
|
//create the page object |
54 |
|
|
$page = new HTMLPageClass("phpHtmlLib Widgets - DataList Example", |
55 |
|
|
XHTML_TRANSITIONAL); |
56 |
|
|
|
57 |
|
|
//enable output debugging. |
58 |
jonen |
1.3 |
if (isset($_GET['debug'])) { |
59 |
|
|
$page->set_text_debug( TRUE ); |
60 |
|
|
} |
61 |
jonen |
1.1 |
|
62 |
|
|
//add the css |
63 |
|
|
$page->add_head_css( new DefaultGUIDataListCSS ); |
64 |
|
|
|
65 |
|
|
//build the csv file data list object. |
66 |
|
|
$csvlist = new csvfilelist("CSV File list", 600, "LName"); |
67 |
jonen |
1.3 |
$csvlist->set_align("right"); |
68 |
jonen |
1.1 |
|
69 |
|
|
$page->add( html_span("font10", "View the source ", |
70 |
|
|
html_a("test.csv", "test.csv file.")), |
71 |
|
|
html_br(2), |
72 |
|
|
$csvlist ); |
73 |
|
|
|
74 |
|
|
print $page->render(); |
75 |
|
|
?> |