Re: New HTML or Maintain DB class needed?

From: Date: Fri, 17 Jan 2003 08:58:42 +0000
Subject: Re: New HTML or Maintain DB class needed?
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-3331@lists.php.net to get a copy of this message
Hi Stefan Your idea sounds a bit like the DataGrid I saw in ASP.NET (if I understand what you want correctly). I don't think you really need to start from scratch with your idea, because DataObject and Quickforms together already make manipulating rows really easy, you can come a long way just using those two. With quickforms you can easily build, populate and validate forms and DataObject make inserting and updating rows as easy as calling : $dataobject->setFrom($_REQUEST) $dataobject->insert(); Oh and for templates you could use QuickForm's toArray() together with a IT or Smarty or something.. So I'm not sure if you would need a new class for this. I think some sort of wrapper around quickform and DataObjects could do the trick I think although it will be quite a challenge.. Jeroen Stefan Fountain wrote: > For those of you willing to have a look at this I am wondering how and if > creating this new class is useful so please give some feedback as to the > architecture and use of such a class. Any feedback is welcome let me know if > there are known classes that already address the issues my 'new' class will > try to solve. > > Thanks for your help/feedback, > Stefan Fountain > > > >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> > > >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> > > I've been looking at creating a new class with the main purpose of being the > core section of a CMS that edits tables. I'm wondering if it is wise to > extend an existing class or make a new one. There are a lot of DB classes > already in the PEAR and one more might cause some confusion (if even it gets > added to PEAR) I would like to discuss the possibility to add > functionalities to existing PEAR classes or if necessary indeed create a new > one. Maybe there already is a DB class (or another class) that holds the > functions I want but could not find it in the PEAR browser. In a sense my > class is a HTML interface to edit DB tables. > > An example of how such a class could look like : > > Description: > Class that will get defined fields from a db table and return them in an > HTML list with the possibilities to edit or delete. The list will show an > add function as well. Edit will return a form with the specified record and > validate upon submit (maybe using PEAR::Quick_Form?) Add will do the same > but with blank fields. It would work similar to a script that uses a $cmd > variable to switch between commands (list, edit, add, delete). The class > would return HTML to the script that calls it, optionally this could be > extended in the future to deliver XML feeds of database results or whatever. > > Class attributes: > > Db connection parameters > array->(db_host, db_name, db_user, db_passw) > > Table parameters > array->(table_name, array(table_fields, table_field_types), key_field) > > HTML Templates > array->(list_template, edit/add template, delete_template) > > (Also 'private' attributes like item_from_db_array etc.) > > Class methods: > Constructor($cmd) // switches between wanted command > List_items() // calls db and lists items in local array > Add_new_item() // does as the name implies > Edit_specific_item() // does as the name implies > Delete_specific_item() // does as the name implies > > Obviously there will have to be get and set methods as well as a good way of > setting up the interaction between different methods (for example edit being > the same as add but with default values returned from db) > > That's the idea. > > > >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> > > >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> > > -- > PEAR General Mailing List (http://pear.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.pear.general (#3331) next »