Fork me on GitHub

Filter by URL in PostCalendar 6.2?  Bottom

  • Hi,

    PostCalendar 6.2's release notes say:

    Quote

    Added ability to filter by category via URL (from GET) (thanks espaan)
    Does this mean I can pass a URL to the browser that, for example, filters the events shown by a particular category? I used to do this in the 4.* versions by hovering over the link of an event in a filtered list and noting the pc_category value. I don't see this feature explained in 6.2's documentation.

    Help?
  • yes, that is the intent.

    take a look at the original ticket for more information.

    http://code.zikula.org/soundwebdevelopment/ticket/152
  • This helps but I haven't been able to get the URL correct. I either get an empty list or an unfiltered list. My site's PostCalendar is here: http://www.gfccnet.org/index.php?module=postcalendar. I've tried:

    http://www.gfccnet.org/index.php?module=PostCalendar&func=view&postcalendar_events[__CATEGORIES__][Ministries]=10106

    and

    http://www.gfccnet.org/index.php?module=PostCalendar&func=view&cat=10106

    Both yield unfiltered lists. What am I doing wrong?

    -Thanks
  • I got the following to work by sniffing it out with FireFox's Live HTTP Headers plugin:

    Quote

    http://www.gfccnet.org/index.php?module=postcalendar&func=view&postcalendar_events[__CATEGORIES__][OLDMain]=0&postcalendar_events[__CATEGORIES__][Main]=10106&submit=Filter&pc_username=-1&jumpMonth=12&jumpDay=06&jumpYear=2010&viewtype=list


    This can probably be shortened but it's a start.

    -Thanks



    Edited by DonGawgon on Dec 06, 2010 - 07:48 AM.
  • Quote

    This can probably be shortened but it's a start.

    yes, that does look wrong to me. I'm hoping Erik Spaan chimes in here, because I've never used this functionality.
  • Hi DonGawgon

    you are talking about 2 different things. I added the ticket to PC for calling postcalendar from the Content module. Within Content you can call a module directly via its API and then you need the module to use the function call arguments. With a URL you can already select a category directly like what you did above.

    So using the category property from the registry and the category ID:

    Code

    index.php?module=PostCalendar&func=view&postcalendar_events[__CATEGORIES__][RegistryPropertyName]=10009


    You can also use:

    Code

    index.php?module=PostCalendar&func=view&prop=RegistryPropertyName&cat=10009

    this is the same way it is being used in News for a single category selection, somewhat cleaner then the __categories__ call and less prone to string issues in getting the parameters from the URL. But this is only for 1 category under a certain property.

    BTW, see also this ticket: http://code.zikula.org/soundwebdevelopment/ticket/173 where I added code for the Date and viewtype as well. I needed to filter via the Content module on the year as well, so that is why I needed the Date as API function argument as well.

    --
    campertoday.nl, Module development, Dutch Zikula Community

This list is based on users active over the last 60 minutes.