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) »
  • Discussion »
  • Extensions (Moderators: mathieu, totten, kasiawaka) »
  • Forms and Database updates
Pages: [1]

Author Topic: Forms and Database updates  (Read 1040 times)

awasson

  • I post frequently
  • ***
  • Posts: 230
  • Karma: 7
  • Living in a world of Drupal / CiviCRM
    • My Company: Luna Design
  • CiviCRM version: Latest
  • CMS version: Drupal 6/7/8
  • MySQL version: 5.x
  • PHP version: 5.3.x
Forms and Database updates
December 13, 2012, 10:56:57 pm
I'm moving along with my continuing professional development extension module as detailed in this wiki entry: http://wiki.civicrm.org/confluence/pages/viewpage.action?pageId=76677197

It's taking the backburner to "real work" but I'm still working on it after work and on the weekends.

Anyway, the module will provide a place within civi for members to log continuing education activities under various categories which will enable the administrators of these memberships to pull up reports. Pretty simple stuff.

I'm using civix for developing the module and I've got a couple of database tables to manage logging Activities and defining Categories. I seeded my Categories table with a single record so that I could loop it out into a categories page and play around wit it. Now I'm building the interface to add, update & delete categories.

I know I can hack through the page.php and page.tpl files that civix creates to create my forms for adding and updating but I wonder if there isn't a more MVC method to build my forms and process the results... I've seen some formbuilder info but nothing that equates to working with the Smarty MV stuff.

Any tips or direction?

I'm happy to plod along and stuff forms within my page.tpl and write my own processing code because after all. I am working with tables well outside of civiCRM core but it occured to me that there might be some nice controls within core that will automatically provide me with nice status messages on successful database transactions and that sort of thing.

Thanks,
Andrew
« Last Edit: December 13, 2012, 11:01:03 pm by awasson »
My CiviCRM Extension Workshop: https://github.com/awasson

totten

  • Administrator
  • Ask me questions
  • *****
  • Posts: 695
  • Karma: 64
Re: Forms and Database updates
December 14, 2012, 01:09:54 pm
There are some conventions/infrastructure/helpers for putting together CRUD forms. I've started to call these tools CiviCRM-QuickForms (CQF) -- the core form processing system is PEAR QuickForm, but CiviCRM also adds  bunch of extra stuff on top of it. Unfortunately, CQF is generally undocumented, and in the long-term (think CiviCRM 5.x) we will probably deprecate it and replace it with newer, external libraries.

http://wiki.civicrm.org/confluence/display/CRM/Symfony+Roadmap

Realistically, that feels far out. In the mean time, you can check this wiki page for links and documentation:

http://wiki.civicrm.org/confluence/display/CRMDOC42/QuickForm+Reference

That stuff mostly covers background about form-rendering mechanics -- it doesn't answer your question about building basic CRUD UI's. For that, there are some undocumented practices around "CRM_Core_Page_Basic". I don't fully understand it myself. To investigate, you can look at an example, "Administer: Communications: Pring Page (PDF) Formats". Some key files are:

 * http://svn.civicrm.org/civicrm/branches/v4.2/CRM/Admin/Page/PdfFormats.php provides the "listing" page.
 * http://svn.civicrm.org/civicrm/branches/v4.2/CRM/Admin/Form/PdfFormats.php provides the "add/edit" page.

If you do investigate this, it would be helpful if you document answers to a few questions that would enable us to solidify things:

 * What are good examples?
 * What files (PHP, TPL, XML,  etc) are needed to make a new example -- how are the files "glued" or "linked" to each other?
 * What would be a good "civix" command (or commands) to help new developers use CRM_Core_Page_Basic?
 * What are the strengths/weaknesses of CRM_Core_Page_Basic? How would a developer know if it's a good idea or a bad idea to use it?

awasson

  • I post frequently
  • ***
  • Posts: 230
  • Karma: 7
  • Living in a world of Drupal / CiviCRM
    • My Company: Luna Design
  • CiviCRM version: Latest
  • CMS version: Drupal 6/7/8
  • MySQL version: 5.x
  • PHP version: 5.3.x
Re: Forms and Database updates
December 14, 2012, 04:51:40 pm
Thanks totten,

This reinforces some hunches I had. I'll review the links you posted and help out with the documentation as much as I can.

I think once I've got my extension (alpha version) in a complete enough state that it's useful for testing, I'll be able to look back at the development process with some clarity and maybe come up with some pointers on how to make it easier to navigate for the newbie.

Thanks and have good weekend!

Andrew


My CiviCRM Extension Workshop: https://github.com/awasson

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Discussion »
  • Extensions (Moderators: mathieu, totten, kasiawaka) »
  • Forms and Database updates

This forum was archived on 2017-11-26.