|
The links you see here are partly for instructional examples, but mostly for object debugging.
HOME |
Coredoc |
accordian | single | tile | form | expandytable | gantt | tickets-xml | nest | chart | tabs | prefs | misc | data | table | bandwidth | css | state | database | csv | free | texttable | tickets | multicell | refresh | gauge | cypher | jquery | tableform
* Display a simple array
* data objects can be echoed. echo $d;
| 2005-09-16 |
5 |
10 |
| 2005-10-16 |
50 |
15 |
| 2005-11-16 |
35 |
20 |
| 2005-12-16 |
40 |
25 |
|
* data objects are passed to outputTable, and Displayed(), which allows for titles and other improvements. $o = new outputTable($d);
Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'peak10'@'localhost' (using password: YES) /home/bartniedner_com/core.bartniedner.com/htdocs/include/db.inc.php, line 120 (Array)
Error: Connect: Access denied for user 'peak10'@'localhost' (using password: YES)
Error: Existing database connection not found
* data can be loaded from the database and displayed (setting a veritcal size creates a scrollbar): Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'root'@'localhost' (using password: NO) /home/bartniedner_com/core.bartniedner.com/htdocs/include/db.inc.php, line 120 (Array)
Error: Connect: Access denied for user 'root'@'localhost' (using password: NO)
Error: Existing database connection not found
Error: Existing database connection not found
* data can be displayed in a complex manner, with a filter, footers, sorting, grouping (by location), paging, page-by-lettering, hyperlinks and arbitrary cell function formatting:
| Browse by letter (indexed by company), limited to Florida
|
|
|
See the source for more examples
| /home/bartniedner_com/core.bartniedner.com/htdocs/examples/table.php
|
<?
/**
* Core Example File
*
* @author Mark Young
* @version $Id$
* @copyright MarkYoung, 19 February, 2007
* @package examples
**/
include("head.php");
echo "* Display a simple array";
$data['row1']=array('col1'=>1,'col2'=>2,'col3'=>3);
$data['row2']=array('col1'=>4,'col2'=>5,'col3'=>6);
$data['row3']=array('col1'=>7,'col2'=>8,'col3'=>9);
$d = new data($data);
$o = new outputTable($d);
$o->Title = "Single dimensional array";
$o->HoverHilight = true;
$o->AlternateRowColors = true;
$o->Sorting = true; // enable sorting. Doesn't work with every query or any arrays, so it's not automatic yet.
$o->Display();
unset($data);
$data[]=array("xlabel"=>'2005-09-16', 'in'=>5, 'out'=>10);
$data[]=array("xlabel"=>'2005-10-16', 'in'=>50, 'out'=>15);
$data[]=array("xlabel"=>'2005-11-16', 'in'=>35, 'out'=>20);
$data[]=array("xlabel"=>'2005-12-16', 'in'=>40, 'out'=>25);
$d = new data($data);
echo '* data objects can be echoed. <pre>echo $d;</pre>';
echo $d;
echo '* data objects are passed to outputTable, and Displayed(), which allows for titles and other improvements. <pre>$o = new outputTable($d);</pre>';
$o = new outputTable($d);
$o->Title = "Output data to table. Data is in 'grid' form";
$o->Display();
Connect(DATA_SHERPA);
$d = new data("SELECT pro.billing_id, pro.proposal_type as `Type`, pro.proposal_id AS pid,
CONCAT('<a href=\"proposals/view.php?p=',pro.proposal_id,'\">',pro.proposal_id,'</a> ',' r.', pro.revision) AS `Proposal_#`,
COUNT(pi.proposal_item_id) AS `#_Items`, CONCAT(u.fname, ' ', u.lname) AS `Sales_Rep`, pro.mrc_total AS `MRC`,
DATE_FORMAT(pro.date_status, '%Y-%m-%d') AS `Signed`
FROM proposals pro, users u, proposal_items pi, persons p
WHERE pro.person_id = p.person_id
AND pro.user_id = u.user_id
AND pro.proposal_id = pi.proposal_id
AND pro.revision = pi.revision
AND p.company_id = 335
AND pro.signature_confirmed = 'TRUE'
AND pro.status = 'SIGNED'
AND pro.date_status >= (SELECT MAX(pro2.date_status)
FROM proposals pro2
WHERE pro2.billing_id = pro.billing_id
AND pro2.status = 'SIGNED'
AND pro2.proposal_type = 'PROPOSAL'
AND pro2.signature_confirmed = 'TRUE')
GROUP BY pro.proposal_id
ORDER BY pro.billing_id, pro.date_status");
$o = new outputTable($d);
$o->Title="Proposals";
$o->GroupBy="billing_id";
$o->Sorting=true;
$o->Display();
echo '* data can be loaded from the database and displayed (setting a veritcal size creates a scrollbar): ';
Connect(DATA_EM7);
SelectDatabase("master");
$d = new dataTable(false);
$d->Tables = "legend_customer"; // this can be an array, like $d->Tables=array("if_billing", "if_someothingelse") and the object will craete a left join
$d->Fields = array( "roa_id as id", // aliasing
"'edit' as cmd", // fixed text
"concat(city, ', ', state) as location", // sql functions
"company", // plain ol columns
"rand() as random"
);
$d->OrderBy = array("location desc", "company"); // these go right into the ORder By clause, so the 'desc' modifier is allowed
$d->Where = array("state='FL'", "(city='Clearwater' or city='Cape Coral')"); // elements of this array are AND'd together.
$o = new outputTable($d);
$o->Title = 'straight out of the database';
$o->Height = 200;
$o->HideRepeatingData = true;
$o->Display();
echo '* data can be displayed in a complex manner, with a filter, footers, sorting, grouping (by location), paging, page-by-lettering, hyperlinks and arbitrary cell function formatting:';
// create a "table" output using the above data object
$o = new outputTable($d);
$o->Title = "Table Example 1"; // sets the title of the table
$o->Description = "Browse by letter (indexed by company), limited to Florida"; // set the descriptive header
$o->Footer = "Neat, huh?";
$o->PageByLetter = 'company'; // enable the by-letter pager, and index it on Company
$o->perpage = 20; // limit things to 50 per page. it'll show a pager
$o->Filter = true; // turn on the filter
$o->Types['id'] = "header"; // set these columns as header
$o->Types['cmd'] = "header";
$o->Format['location'] = 'strtoupper($location)'; // run the cell through an arbitrary function
$o->hyperlinks['id'] = '/login.php?action=cheat&uid=$id'; // tell the "id" column to hyperlink to this. (note the single quotes, so $id isn't evaluated)
$o->hyperlinks['cmd'] = 'http://www.google.com?uid=$id'; //
$o->Sorting = true; // enable sorting. Doesn't work with every query or any arrays, so it's not automatic yet.
$o->Summary['location'] = 'Average: ';
$o->Summary['random'] = 'avg';
$o->GroupBy = 'location';
$o->Display(); // puke!
echo "<hr>See the source for more examples";
/*
//hese particular examples don't play well together, as the sorting by letter commands from one example are "heard" by the next example, so just uncomment
$o = new outputTable($d);
$o->Title = "Table Example 2"; // sets the title of the table
$o->Description = "Browse by page"; // set the descriptive header
$o->is_header['id'] = true; // tell the "ID" column to act like a <th> vs a <td>
$o->perpage = 5; // show 5 records per page, and enable the pager
$o->hyperlinks['id'] = '/login.php?action=cheat&uid=$id'; // tell the "id" column to hyperlink to this. (note the single quotes, so $id isn't evaluated)
$o->Display(); // puke!
$o = new outputTable($d);
$o->Title = "Table Example 3"; // sets the title of the table
$o->Description = "Everything"; // set the descriptive header
$o->is_header['id'] = true; // tell the "ID" column to act like a <th> vs a <td>
$o->hyperlinks['id'] = '/login.php?action=cheat&uid=$id'; // tell the "id" column to hyperlink to this. (note the single quotes, so $id isn't evaluated)
$o->Display(); // puke!
*/
include("foot.php");
?>
|
Debug Log:
Memory Usage: 756.48k, Number of Queries: 0
- [0.0000]db.inc.php File included include_once, line 21 home/bartniedner_com/core.bartniedner.com/htdocs/include/db.inc.php
- [0.0684]include End head.php include, line 52 home/bartniedner_com/core.bartniedner.com/htdocs/examples/head.php
- [0.0065]LoadData LoadData() called when data was already loaded! You dummy!! LoadData, line 302 home/bartniedner_com/core.bartniedner.com/htdocs/include/classes/data.php
- [0.0001]LoadJavascript Loaded http://core.bartniedner.com/include/javascript/ajax.js LoadJavascript, line 854 home/bartniedner_com/core.bartniedner.com/htdocs/include/core_functions.php
- [0.0000]DrawTopPart outputTable - Single dimensional array
DrawTopPart, line 205 home/bartniedner_com/core.bartniedner.com/htdocs/include/classes/output.php
- [0.0000]DrawTopPart AJAX enabled DrawTopPart, line 206 home/bartniedner_com/core.bartniedner.com/htdocs/include/classes/output.php
- [0.0001]LoadJavascript Loaded http://core.bartniedner.com/include/javascript/jquery.js LoadJavascript, line 854 home/bartniedner_com/core.bartniedner.com/htdocs/include/core_functions.php
- [0.0000]LoadJavascript Loaded http://core.bartniedner.com/include/javascript/core.js LoadJavascript, line 854 home/bartniedner_com/core.bartniedner.com/htdocs/include/core_functions.php
- [0.0000]LoadJavascript Loaded http://core.bartniedner.com/include/javascript/firebug/firebug.js LoadJavascript, line 854 home/bartniedner_com/core.bartniedner.com/htdocs/include/core_functions.php
- [0.0008]DrawBottomPart cached: /tmp/singledimensionalarraylKsvfK DrawBottomPart, line 378 home/bartniedner_com/core.bartniedner.com/htdocs/include/classes/output.php
- [0.0000]DrawBottomPart End
outputTable - Single dimensional array DrawBottomPart, line 381 home/bartniedner_com/core.bartniedner.com/htdocs/include/classes/output.php
- [0.0002]LoadData LoadData() called when data was already loaded! You dummy!! LoadData, line 302 home/bartniedner_com/core.bartniedner.com/htdocs/include/classes/data.php
- [0.0001]DrawTopPart outputTable -
DrawTopPart, line 205 home/bartniedner_com/core.bartniedner.com/htdocs/include/classes/output.php
- [0.0030]DrawBottomPart cached: /tmp/object2qxLyHV DrawBottomPart, line 378 home/bartniedner_com/core.bartniedner.com/htdocs/include/classes/output.php
- [0.0000]DrawBottomPart End
outputTable - DrawBottomPart, line 381 home/bartniedner_com/core.bartniedner.com/htdocs/include/classes/output.php
- [0.0001]__destruct __destruct, line 181 home/bartniedner_com/core.bartniedner.com/htdocs/include/classes/data.php
- [0.0001]LoadData LoadData() called when data was already loaded! You dummy!! LoadData, line 302 home/bartniedner_com/core.bartniedner.com/htdocs/include/classes/data.php
- [0.0000]DrawTopPart outputTable - Output data to table. Data is in 'grid' form
DrawTopPart, line 205 home/bartniedner_com/core.bartniedner.com/htdocs/include/classes/output.php
- [0.0000]DrawTopPart AJAX enabled DrawTopPart, line 206 home/bartniedner_com/core.bartniedner.com/htdocs/include/classes/output.php
- [0.0005]DrawBottomPart cached: /tmp/outputdatatotabledataisingridformt4LY96 DrawBottomPart, line 378 home/bartniedner_com/core.bartniedner.com/htdocs/include/classes/output.php
- [0.0000]DrawBottomPart End
outputTable - Output data to table. Data is in 'grid' form DrawBottomPart, line 381 home/bartniedner_com/core.bartniedner.com/htdocs/include/classes/output.php
- [0.0000]Connect mysql://peak10:peakmeup@localhost/peak10 Connect, line 113 home/bartniedner_com/core.bartniedner.com/htdocs/include/db.inc.php
- [0.0004]PrintWarning WARNING: mysql_connect() [function.mysql-connect]: Access denied for user 'peak10'@'localhost' (using password: YES)
/home/bartniedner_com/core.bartniedner.com/htdocs/include/db.inc.php, line 120 (Array) PrintWarning, line 380 home/bartniedner_com/core.bartniedner.com/htdocs/include/core_functions.php
- [0.0000]PrintError ERROR: Connect: Access denied for user 'peak10'@'localhost' (using password: YES) PrintError, line 344 home/bartniedner_com/core.bartniedner.com/htdocs/include/core_functions.php
- [0.0005]PrintError ERROR: Existing database connection not found PrintError, line 344 home/bartniedner_com/core.bartniedner.com/htdocs/include/core_functions.php
- [0.0000]Query $SQL_CURRENT_CONNECTION is not the expected object. Query, line 210 home/bartniedner_com/core.bartniedner.com/htdocs/include/db.inc.php
- [0.0001]ErrorHandler mysql_num_rows(): supplied argument is not a valid MySQL result resource
/home/bartniedner_com/core.bartniedner.com/htdocs/include/db.inc.php, line 354 (Array) ErrorHandler, line 140 home/bartniedner_com/core.bartniedner.com/htdocs/include/core_functions.php
- [0.0000]JumpToRow jumping to row 0 JumpToRow, line 380 home/bartniedner_com/core.bartniedner.com/htdocs/include/db.inc.php
- [0.0001]__destruct __destruct, line 181 home/bartniedner_com/core.bartniedner.com/htdocs/include/classes/data.php
- [0.0000]LoadData LoadData() called when data was already loaded! You dummy!! LoadData, line 302 home/bartniedner_com/core.bartniedner.com/htdocs/include/classes/data.php
- [0.0000]DrawTopPart outputTable - Proposals
DrawTopPart, line 205 home/bartniedner_com/core.bartniedner.com/htdocs/include/classes/output.php
- [0.0000]DrawTopPart AJAX enabled DrawTopPart, line 206 home/bartniedner_com/core.bartniedner.com/htdocs/include/classes/output.php
- [0.0002]JumpToRow jumping to row 0 JumpToRow, line 380 home/bartniedner_com/core.bartniedner.com/htdocs/include/db.inc.php
- [0.0003]DrawBottomPart cached: /tmp/proposalsdbCgDi DrawBottomPart, line 378 home/bartniedner_com/core.bartniedner.com/htdocs/include/classes/output.php
- [0.0000]DrawBottomPart End
outputTable - Proposals DrawBottomPart, line 381 home/bartniedner_com/core.bartniedner.com/htdocs/include/classes/output.php
- [0.0000]Connect mysql://root:@localhost/master_data Connect, line 113 home/bartniedner_com/core.bartniedner.com/htdocs/include/db.inc.php
- [0.0002]PrintWarning WARNING: mysql_connect() [function.mysql-connect]: Access denied for user 'root'@'localhost' (using password: NO)
/home/bartniedner_com/core.bartniedner.com/htdocs/include/db.inc.php, line 120 (Array) PrintWarning, line 380 home/bartniedner_com/core.bartniedner.com/htdocs/include/core_functions.php
- [0.0000]PrintError ERROR: Connect: Access denied for user 'root'@'localhost' (using password: NO) PrintError, line 344 home/bartniedner_com/core.bartniedner.com/htdocs/include/core_functions.php
- [0.0000]SelectDatabase master SelectDatabase, line 161 home/bartniedner_com/core.bartniedner.com/htdocs/include/db.inc.php
- [0.0000]PrintError ERROR: Existing database connection not found PrintError, line 344 home/bartniedner_com/core.bartniedner.com/htdocs/include/core_functions.php
- [0.0000]Query $SQL_CURRENT_CONNECTION is not the expected object. Query, line 210 home/bartniedner_com/core.bartniedner.com/htdocs/include/db.inc.php
- [0.0006]__destruct __destruct, line 181 home/bartniedner_com/core.bartniedner.com/htdocs/include/classes/data.php
- [0.0002]PrintError ERROR: Existing database connection not found PrintError, line 344 home/bartniedner_com/core.bartniedner.com/htdocs/include/core_functions.php
- [0.0000]Query $SQL_CURRENT_CONNECTION is not the expected object. Query, line 210 home/bartniedner_com/core.bartniedner.com/htdocs/include/db.inc.php
- [0.0000]ErrorHandler mysql_num_rows(): supplied argument is not a valid MySQL result resource
/home/bartniedner_com/core.bartniedner.com/htdocs/include/db.inc.php, line 354 (Array) ErrorHandler, line 140 home/bartniedner_com/core.bartniedner.com/htdocs/include/core_functions.php
- [0.0000]JumpToRow jumping to row 0 JumpToRow, line 380 home/bartniedner_com/core.bartniedner.com/htdocs/include/db.inc.php
- [0.0001]DrawTopPart outputTable - straight out of the database
DrawTopPart, line 205 home/bartniedner_com/core.bartniedner.com/htdocs/include/classes/output.php
- [0.0000]DrawTopPart AJAX enabled DrawTopPart, line 206 home/bartniedner_com/core.bartniedner.com/htdocs/include/classes/output.php
- [0.0002]JumpToRow jumping to row 0 JumpToRow, line 380 home/bartniedner_com/core.bartniedner.com/htdocs/include/db.inc.php
- [0.0002]DrawBottomPart cached: /tmp/straightoutofthedatabaseyh9x7t DrawBottomPart, line 378 home/bartniedner_com/core.bartniedner.com/htdocs/include/classes/output.php
- [0.0000]DrawBottomPart End
outputTable - straight out of the database DrawBottomPart, line 381 home/bartniedner_com/core.bartniedner.com/htdocs/include/classes/output.php
- [0.0001]LoadData LoadData() called when data was already loaded! You dummy!! LoadData, line 302 home/bartniedner_com/core.bartniedner.com/htdocs/include/classes/data.php
- [0.0000]DrawTopPart outputTable - Table Example 1
DrawTopPart, line 205 home/bartniedner_com/core.bartniedner.com/htdocs/include/classes/output.php
- [0.0000]DrawTopPart AJAX enabled DrawTopPart, line 206 home/bartniedner_com/core.bartniedner.com/htdocs/include/classes/output.php
- [0.0002]JumpToRow jumping to row 0 JumpToRow, line 380 home/bartniedner_com/core.bartniedner.com/htdocs/include/db.inc.php
- [0.0003]DrawBottomPart cached: /tmp/tableexample1kh8bCF DrawBottomPart, line 378 home/bartniedner_com/core.bartniedner.com/htdocs/include/classes/output.php
- [0.0000]DrawBottomPart End
outputTable - Table Example 1 DrawBottomPart, line 381 home/bartniedner_com/core.bartniedner.com/htdocs/include/classes/output.php
- [0.0002]include Begin foot.php include, line 10 home/bartniedner_com/core.bartniedner.com/htdocs/examples/foot.php
- [0.0007]DrawTopPart outputFreeText - Source code
DrawTopPart, line 205 home/bartniedner_com/core.bartniedner.com/htdocs/include/classes/output.php
- [0.1606]DrawBottomPart cached: /tmp/sourcecodeIWVoaS DrawBottomPart, line 378 home/bartniedner_com/core.bartniedner.com/htdocs/include/classes/output.php
- [0.0000]DrawBottomPart End
outputFreeText - Source code DrawBottomPart, line 381 home/bartniedner_com/core.bartniedner.com/htdocs/include/classes/output.php |