I was just wondering if anyone out there has looked into creating a date facet module based on the date module? I would if I could but it would be nice to search by, for example, starting date of an event.

CommentFileSizeAuthor
#5 date_facets.module.zip3.36 KBjpp

Comments

David Lesieur’s picture

Status: Active » Fixed

Yes, see CCK Facets.

jpp’s picture

However it's not very useful due to no timezone support

fletch11’s picture

Thanks David. I don't need timezone support so this is perfect.

David Lesieur’s picture

@jpp: Help is welcome to develop the module further. :-)

jpp’s picture

StatusFileSize
new3.36 KB

I'm slammed with work however I did hack timezone support a while back

basically I added a call to the get_timezone code in date_authored_facet (why re-invent the wheel :-)

     *   The query object to update.
     */
    function build_results_query(&$query) {
+     $timezone = _date_authored_facet_get_user_timezone(); // hack !
      $db_info = _cck_facets_db_info($this->_field);
      $main_column = array_shift($db_info['columns']);
      // Since the same table might be joined multiple times in the query, we use
***************

and then added "+ $timezone" to all the places where a date is being added to the query

$query->add_where("($table.${main_column['column']} + $timezone >= UNIX_TIMESTAMP($from))");

There are about 20 similar lines - I'd send a patch but my hacked version is 2 revs back from the current dev and I don't have time to untangle the changes.

Hacked file attached - use extreme cautuon it's not the current version

David Lesieur’s picture

Title: Date facet? » Timezone support for Date Facets
Project: Faceted Search » CCK Facets
Component: Miscellaneous » Date Facets
Status: Fixed » Needs work

@fletch11: Sorry, your issue has been hijacked. :-)

fletch11’s picture

No problem... I welcome the assault.

Brn’s picture

I don't know if that can help, but we met problems of timezone on our site and found this solution :
http://drupalfr.org/forum/support/developpement/27462-cck-date-et-cck-fa...
Thank you for your work, this is a very useful module!
Brn