CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Joomla module-based search access and API access to custom searches
Pages: [1]

Author Topic: Joomla module-based search access and API access to custom searches  (Read 1021 times)

Jeremy Proffitt

  • I post occasionally
  • **
  • Posts: 63
  • Karma: 2
    • Mobius New Media
  • CiviCRM version: 4.4.x
  • CMS version: Joomla 2.5.x/3.x / D7
  • MySQL version: 5.1.x
  • PHP version: 5.3.10+, 5.4.x
Joomla module-based search access and API access to custom searches
June 13, 2012, 02:58:07 pm
I'm currently working on a project for an industry association that is requiring a front-end tag search for public users and running into a number of roadblocks trying to send content from the POST array into a profile listing and provide some custom ordering of the result list via ORDER CASE in the query. The user searching is being done directly from the frontpage of the client's website using Harvest's Chosen plugin to restructure a multiple select box that receives the tag list from the API.

While it makes sense not to expose UI driven access to the advanced and custom search, the full search capability needs to be available via the API with an option for profile listings to receive search parameters that are provided outside of Quickform. It seems that the buildForm hook might be able to provide an entry point for getting data into the form, but that still doesn't address being able to access the full functionality of the advanced search and the stored queries in the custom search. That needs to be addressed via API methods.

Jeremy Proffitt
Mobius New Media
IRC: JP_EzoD

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Joomla module-based search access and API access to custom searches
June 13, 2012, 08:12:03 pm

The api team could definitely use some help in expanding and strenghtening the API. Might want to contact eileen, xavier or erik on the irc channel to get started

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Jeremy Proffitt

  • I post occasionally
  • **
  • Posts: 63
  • Karma: 2
    • Mobius New Media
  • CiviCRM version: 4.4.x
  • CMS version: Joomla 2.5.x/3.x / D7
  • MySQL version: 5.1.x
  • PHP version: 5.3.10+, 5.4.x
Re: Joomla module-based search access and API access to custom searches
June 14, 2012, 04:03:33 am
In the meantime...

Thoughts on how a non-CiviCRM form could invoke the Custom Search and trigger output of a public profile listing? _buildForm and _postProcess don't seem to be helping since I am technically not using a CiviCRM form at all, as I am using the force to go straight to the listing. Even if I was to enable the normal profile search, I would need to make sure the users never actually saw it.


See: http://mvs003-010.directrouter.com/~tmpaadm/targetprograms.com/ for the initial search, which submits to http://mvs003-010.directrouter.com/~tmpaadm/targetprograms.com/program-administrators

I need to:
- Have the input from the initial search filter that profile listing (currently showing standard profile listing)
- Have the listing results either ordered via ORDER Case criteria in my custom search -- OR -- have the listing order randomized so that all listed profiles get visibility.
Jeremy Proffitt
Mobius New Media
IRC: JP_EzoD

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Joomla module-based search access and API access to custom searches
June 14, 2012, 06:08:55 am
Hi,

What filter are missing from the api contact.get? you can pretty much filter as much as you can from the advanced search.

Not sure I follow what you are trying to achieve. Can you explain what's the goal of the search, what you want to list and what are the filters?
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Jeremy Proffitt

  • I post occasionally
  • **
  • Posts: 63
  • Karma: 2
    • Mobius New Media
  • CiviCRM version: 4.4.x
  • CMS version: Joomla 2.5.x/3.x / D7
  • MySQL version: 5.1.x
  • PHP version: 5.3.10+, 5.4.x
Re: Joomla module-based search access and API access to custom searches
June 14, 2012, 06:28:58 am
Hi Xavier,

The source for the search is a smart group of organizations who have a certain active membership. I need to have public, frontend users (Joomla) choose keywords from a multiple-select box that is integrated in a module on the front page.

The search result should be a list of the matching organizations who have assigned tags that match any of the user selected tags -- OR -- fulfill a LIKE pattern match on organization_name.

Also, as results are a list of companies that the user would potentially like to get contacted by, the order of the result list needs to be adjusted using an order case where:

- all of the user selections are IN tag list
- one of the user selections IN tag list
- user selection is LIKE the organization_name

I've tried using the buildForm hook to set the tags as defaults, but it doesn't affect the result. I've also tried looking in the CRM_Page_Profile_Listings class, but I can't seem to find where the query for the contacts is actually being fired. I would have assumed it was in getProfileContact(), but I can't seem to dump or debug from that method at all.
Jeremy Proffitt
Mobius New Media
IRC: JP_EzoD

Jeremy Proffitt

  • I post occasionally
  • **
  • Posts: 63
  • Karma: 2
    • Mobius New Media
  • CiviCRM version: 4.4.x
  • CMS version: Joomla 2.5.x/3.x / D7
  • MySQL version: 5.1.x
  • PHP version: 5.3.10+, 5.4.x
Re: Joomla module-based search access and API access to custom searches
June 15, 2012, 09:23:00 am
Thanks to some suggestions from DLobo, I was able to get the recordset I was looking via the Contact API class. I still am trying to deal with the sorting issues though.

I noticed that there is a mention in the 4.0 API docs of an option.sort parameter which seems to take the entire ORDER clause. If that were available, I could feed in the Case statements and do all of that searching with only contact.get. The example using option.sort was removed from the 4.1 API wiki page, which has me a bit concerned that the parameter was dropped. Clarification on that would be helpful.

Also, I am currently doing my API call in the Listings template, which while functional seems like a bad idea. I've been able to follow my way through the CRM_Profile_Page_Listings and CRM_Core_Selector_Controller, but I still can't see where the getProfileContact() method is being called. If I had that, I'd know either that I could edit getProfileContact, or could write my own methods to build the form params list and to grab the dataset via the contact.get call.
Jeremy Proffitt
Mobius New Media
IRC: JP_EzoD

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Joomla module-based search access and API access to custom searches
June 15, 2012, 01:36:25 pm

you can do:

grep -r getProfileContact CRM

Seems like its only called from:

CRM/Contact/Form/Task/Map.php

which kinda makes sense, since mapping is the only 'task' we've integrated into profile. For that case, we really dont care about the order of ids since we display it on a map

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Joomla module-based search access and API access to custom searches

This forum was archived on 2017-11-26.