| 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 |
|
|
* $Id: widget7.php,v 1.2 2002/11/05 02:19:47 hemna Exp $ |
| 15 |
|
|
* |
| 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 |
|
|
$page->set_text_debug( $_GET["debug"] ); |
| 59 |
|
|
|
| 60 |
|
|
//add the css |
| 61 |
|
|
$page->add_head_css( new DefaultGUIDataListCSS ); |
| 62 |
|
|
|
| 63 |
|
|
//build the csv file data list object. |
| 64 |
|
|
$csvlist = new csvfilelist("CSV File list", 600, "LName"); |
| 65 |
|
|
|
| 66 |
|
|
$page->add( html_span("font10", "View the source ", |
| 67 |
|
|
html_a("test.csv", "test.csv file.")), |
| 68 |
|
|
html_br(2), |
| 69 |
|
|
$csvlist ); |
| 70 |
|
|
|
| 71 |
|
|
print $page->render(); |
| 72 |
|
|
?> |