Displaying record sets (browse?)
| From: | Ronald van Raaphorst | Date: | Tue, 16 Dec 2003 09:31:31 +0000 |
| Subject: | Displaying record sets (browse?) | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-9551@lists.php.net to get a copy of this message | ||
Hi all,
I'm trying to figure out pear, but what I'm really missing is a browse
class:
How do you guys do someting this essential?
I find loops fetching a bunch of records everywhere, but I want a single,
neat and full feature browse class...
(I find it very hard to get the overview for pear: too much details, and
nowhere an overview to be found)
Attached is a picture of what I have in mind. I have drawn the needed screen
elements, but there should be a template involved, which translates the
record set (and all its options and navigation elements) to a nice picture.
Basically, the class performs a fetch loop, and saves the fetched data in an
array to be processed by a template. But then, it also needs to process and
set url parameters.
I think I will need these url parameters:
table= sets the primary table
id= marks the id of the selected record
page= pager: current page
pagesize= pager: number of records per page
filter= [field, operator, value] user set filter i.e.: article.name>='b',
multiple filters should be supported
sort= [field [,field]] user sort (by clicking on a header)
of course, if a record is selected (id=x), then the page should be
calculated, based on the records position in the current sort. if id=x is
absent, then the page= parameter sets the page.
Optionally, I want (in a later stadium) that users may select their own
columns to display, so, at first, the browse (and the templates used) do not
know which fields to display (i.e.: specific names can not be mentioned in
the template: an array with the fields should be processed by the template).
Other goals are:
1) One script/class to fetch all the records per page
(A simple parameter (like browse.php?table=Article) should be enough. The
class should auto load the DB/DB_Dataobject classes and run)
The script/class should call itself (either by url or by post) , and figure
out what's changed, and retrieve and display the result set again.
2) Auto fetch of related (parent) records ( Article.CategoryID < < ---- >
Category.ID )
3) Ability to set the fields to be displayed ( what order from left to
right, which width ) In a later stage, users may want to select their own
fields to display
4) Ability to translate header fields to a meaningful text
(Article.ThisArticleName could be set to 'Name' or 'Article'), optional
depending on a language.
5) Ability to tag records (and thus, process tagged records for deletion)
6) Ability to sort ( asc / desc ) by clicking a header field.
However, by resorting the record set, the selected record ('selected row')
can be on a total different page, and that page should be loaded again.
7) Ability to prevent certain fields to be displayed, depening on a user
authentication level/user type.
This should IMHO be set in the derived DB_DataObject class:
If userlevel > 5, he can see additional fields, else, he can't.
8) Ability to filter records not to be displayed, based on a user
authentication level/user type
I.E. if userlevel < 3, it can only see suitable records for that level
9) Ability to filter records if the list displayed represents child records
of a previously selected parent record.
So, Say I already selected the category 'Ideas category', I want to display
only articles of that category
10) Of course, output can be displayed using a template or, if no template
is available, directly.
But, I certainly do not want to create a template for every table
11) Find could find the next record, or apply a filter to show only the
records that match the find field.
Any ideas? Anything I'm missing at this point?
TIA
Ronald
Compad