On Tue, Apr 3, 2012 at 4:03 AM, Ammar Yasir ayax88@gmail.com wrote:
Hi,
The noticed that the table search scripts(tbl_select.php, tbl_zoom_select.php) and multi-table query(db_qbe.php) basically display a 'Query-by-Example' form. I think we can design a qbeForm class through which we can customize a QBE form for each of the three scripts.
The basic elements of a QBE form are columns and details about each column. Considering column as an entity, we can assign HTML content of each column element like datatype, collation, operator, sort, criteria as the attributes of 'column' entity. To be more specific, a 'column' entity would contain, S.No. | Attribute | HTML | Script 1 | Data-type | text | tbl_select.php, tbl_zoom_select.php 2 | Collation | text | tbl_select.php, tbl_zoom_select.php 3 | Sort | HTML Select | db_qbe.php 4 | Ins/Del | HTML input | db_qbe.php 5 | Modify | output of S.No 4 | db_qbe.php 6 | Show | HTML checkbox | db_qbe.php 7 | Criteria | (a) HTML input | db_qbe.php | (b) HTML Select | tbl_select.php, tbl_zoom_select.php 8 | Value | (a) HTML input | tbl_select.php, tbl_zoom_select.php | (b) multiselect | tbl_select.php, tbl_zoom_select.php | Foreign Values | tbl_select.php, tbl_zoom_select.php, browse_foreigners.php
We can decide on what HTML we want to display for each 'column' entity(depending on the script in consideration) and customize our QBE form. One thing to note is that, from 'column' entity we will generate an empty HTML skeleton (say column block). The values of HTML select and others(for example operators) will be updated using AJAX calls. I guess that could also be included as a procedure in the QBE class (or column class). A QBE form can consist of various column blocks ( tbl_zoom_select.php has 2, db_qbe.php initially has 3 and tbl_select.php has count($fields) ). For, db_qbe.php 'column' blocks can be added dynamically just by creating an instance of 'column' entity. One issue could be that in tbl_zoom_select.php and db_qbe.php we need to select columns, i.e, columns are displayed in a select box, while in tbl_select.php all the columns are listed. But I guess, it can be worked out in time.
Regards, Ammar Yasir
Would such OOP be feasible?