Search

Hey there,

I'm building a small module to get used to Symphony's core but having some difficulty understanding some of the functionality.

The event manager module adds a setting in preferences to select a section which has a datetime field - similar to the members module where you are only shown sections with a 'member' field. It then populates a 'Schedule' navigation group, which has three pages; Upcoming, Recent, Archived; with the entries of these sections.

I would like to filter the sections based on a checkbox 'Archive', as well by the datetime field. Most code is copied/modified from content.publish.php - so the Section could be user selectable - I'm just having trouble finding out how to add the conditional statements when the data is pulled.

$entries = $entryManager->fetchByPage($current_page, $section_id, Symphony::Configuration()->get('pagination_maximum_rows', 'symphony'), $where, $joins);

Everything was going so well until hear :*( I'm stumped how I would do this, any passing comments would be greatly appreciated.

Might I suggest a much simpler way of achieving this? Take a look at the Publish Filtering extension and you'll see it provides a UI on top of a standard filtering syntax in the Symphony backend:

/?filter[field-handle]=value

I suggest you add three items to the navigation, but instead link to the normal /symphony/publish/:section-handle/ page but pass filters based on the field names you are using. For example:

Upcoming: /symphony/publish/:section/?filter[date]=later+than+today
Recent: /symphony/publish/:section/?filter[date]=later+than+last+month
Archived: /symphony/publish/:section/?filter[your-checkbox]=Yes

This filtering syntax is baked into content.publish.php and supports the same syntax as data source filtering. Multiple filters are supported in 2.2.3 using the above syntax. If you're on a version earlier, such as Symphony 2.2 then you can only have one filter using the syntax /?filter=field-name:value.

If you really must use EntryManager then you'll need to build your JOIN and WHERE clauses yourself to complete the SQL and pass these to the fetchByPage method. So best avoid replicating existing functionality if you can avoid it.

Thanks for your reply Nick, I had thought I maybe going in the wrong direction.

I'll update to the latest version and try out your module.

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details