Class Proposal DB_Grid

From: Date: Thu, 19 Sep 2002 13:09:36 +0000
Subject: Class Proposal DB_Grid
Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-9202@lists.php.net to get a copy of this message
I was thinking about a class to provide dynamic binding betwin a database (table or sql) and a table (html or plain text). I did some work on it and it can bind a database table to a text or html table. I am at work and cannot provide the code now, but I wanted to get some opinions from the group. Features * Bind a database to a table, table can be either a text (for console) or html (for web), It should provide easy methods for showing a list of records, detail of a single record and update and delete of either all records (using paging or not) or a single record. * Expandable operation modes, one generic class with the base functionality and additional classes to provide the custom functionallity, text and html displays would be extra classes. Invoked either from a ::factory method or directly. I have planned three displays modes text, html and smarty (bind to a smarty template, well i just love smarty what can I say) * Work transparently of the programmer, for example to use the html mode, the programmer would only have to instansiate the class provide it with the options and call the display method. the class would have to do extra work to read from the url and know what it is supposed to do, show a list of record, single record, update of record etc. * events,filters and modifiers, events - a programmer would be able to add event handleres to get executed at some points of the execution, some events possible are beforefetch (before the data is retrieved from the database), afterfetch (after the data is retrieved from the database), beforedisplay (before the data is displayed), well you get the idea, different events would have differend data passed to them for example the beforefetch would get the dsn string and the source (tablename or sql), the after fetch would get the table metadata (columns primary keys etc), the beforedisplay would get the data in an associative array. fileters - you would be able to specify filters to exclude some data if a condition fals, ex if price < 10 modifiers - you might want to change some columns, you might want to format dates differently, you might want to change font color say if a number is negative it's color would be red otherwise it would be green, display all even rows with one color and odd with onother, format numbers and currency I'll try and post some code tonight for people to see if anyone is interested Yavor

« previous php.pear.dev (#9202) next »