vpn : implement search by date range

26/04/12

Permalink 12:13:17 pm, by sarneil, 223 words, 39 views   English (CA)
Categories: Activity log; Mins. worked: 180

vpn : implement search by date range

Finally figured out how to successfully implement a data range search.

In plugins/vpn-search/form_advanced.php page, I added the two elements to the search form.

In plugins/vpn-search/vpn-search.php, I modified the getAdvancedConditons method (which constructs the conditions for the WHERE clause in the SQL query) by adding special cases to deal with table.field values of poems.po_date and poems.po_date2. There is no po_date2 field in the poems table, so the special case code inserts "po_date" instead of "po_date2". The reason I'm using a bogus table.field identifier is explained below

In plugins/vpn-search/classes/VPNFormBuilder.php, the fieldMap array uses a table.field name as the key and the id of the element in the GUI as the value. Code assumes a one-to-one relationship between GUI elements and table.field specifier. I needed to add two new key-value pairs, but the two new elements both are associated with the same table.field. I can't use the same key for more than one value, so I created a bogus table.field value (poems.po_date2) and then special-cased that value in the code in vpn-search.

At the moment, the date-range-start and date-range-end fields accept four digit years, and if crazy values are inserted, no checking is done and the user just gets 0 hits.

Pingbacks:

No Pingbacks for this post yet...

Depts

This blog is for work done for academic departments which does not fall under other categories.

Reports

Categories

May 2013
Sun Mon Tue Wed Thu Fri Sat
 << <   > >>
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31  

XML Feeds