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 (Moderator: Donald Lobo) »
  • Creating a Custom Dashlet
Pages: [1]

Author Topic: Creating a Custom Dashlet  (Read 1129 times)

brandonbryan12

  • I’m new here
  • *
  • Posts: 10
  • Karma: 2
  • CiviCRM version: 4.4
  • CMS version: Drupal 7
  • MySQL version: 5.5
  • PHP version: 5.5
Creating a Custom Dashlet
September 09, 2014, 01:05:04 pm
Hello all,

I have two questions:

  • I am currently attempting to create a custom Civi report. I've spent some time searching through the code, but the amount of abstraction in this process leaves me a tad confused. So, I'd like to know, programatically, how a report is created and added to the dash as a dashlet.
  • Is there any way to hijack the code of dashlets and insert, say, a Drupal View or other custom views?

Thank you for your time.

EDIT:
We at Skvare have created a Drupal module that integrates Views into dashlets.
You can read the blog post here: https://civicrm.org/blogs/brandonferrell/drupal-views-civicrm-dashlets
And you can view the project page here: https://www.drupal.org/sandbox/brandonferrell/2389543

« Last Edit: December 12, 2014, 03:14:26 pm by brandonbryan12 »

totten

  • Administrator
  • Ask me questions
  • *****
  • Posts: 695
  • Karma: 64
Re: Creating a Custom Dashlet
September 09, 2014, 04:07:56 pm
I'm not certain how the report<=>dashlet mechanism works, but the dashlets are registered in table called "civicrm_dashboard". Basically, you provide a name, title, and some AJAX callback URLs. You might experiment a bit inserting a record to see what happens.

If your goal is to write a Drupal module or Civi extension which defines a dashlet, then you can use the "Dashboard API" in v4.4+ to register the dashlet. See also:

 * civicrm/api/explorer (e.g. "http://my-site.org/civicrm/api/explorer")
 * civicrm/api/doc (e.g. "http://my-site.org/civicrm/api/doc")
 * https://civicrm.org/blogs/totten/api-and-art-installation

If you need to influence the dashlets that are activated for users, then these might be interesting:

 * Declarative defaults: hook_civicrm_dashboard_defaults - https://github.com/civicrm/civicrm-core/blob/4.4/CRM/Utils/Hook.php#L1392
 * Procedural manipulation: https://github.com/civicrm/civicrm-buildkit/blob/master/app/config/drupal-demo/install-dashboard.php

Michael McAndrew

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1274
  • Karma: 55
    • Third Sector Design
  • CiviCRM version: various
  • CMS version: Nearly always Drupal
  • MySQL version: 5.5
  • PHP version: 5.3
Re: Creating a Custom Dashlet
September 10, 2014, 04:08:00 am
Hey brandonbryan12,

If you do manage to get a drupal view in there, I would be really interested to know how you did it. Feel free to post your code here if you do.

Michael
Service providers: Grow your business, build your reputation and support CiviCRM. Become a partner today

brandonbryan12

  • I’m new here
  • *
  • Posts: 10
  • Karma: 2
  • CiviCRM version: 4.4
  • CMS version: Drupal 7
  • MySQL version: 5.5
  • PHP version: 5.5
Re: Creating a Custom Dashlet
September 10, 2014, 11:28:53 am
Quote from: totten on September 09, 2014, 04:07:56 pm
I'm not certain how the report<=>dashlet mechanism works, but the dashlets are registered in table called "civicrm_dashboard". Basically, you provide a name, title, and some AJAX callback URLs. You might experiment a bit inserting a record to see what happens.

If your goal is to write a Drupal module or Civi extension which defines a dashlet, then you can use the "Dashboard API" in v4.4+ to register the dashlet. See also:

 * civicrm/api/explorer (e.g. "http://my-site.org/civicrm/api/explorer")
 * civicrm/api/doc (e.g. "http://my-site.org/civicrm/api/doc")
 * https://civicrm.org/blogs/totten/api-and-art-installation

If you need to influence the dashlets that are activated for users, then these might be interesting:

 * Declarative defaults: hook_civicrm_dashboard_defaults - https://github.com/civicrm/civicrm-core/blob/4.4/CRM/Utils/Hook.php#L1392
 * Procedural manipulation: https://github.com/civicrm/civicrm-buildkit/blob/master/app/config/drupal-demo/install-dashboard.php

Thank you for the help! This will definitely help me out in many ways.
If I do get Drupal Views available as dashlets, I will post a link to the repo for sure.

brandonbryan12

  • I’m new here
  • *
  • Posts: 10
  • Karma: 2
  • CiviCRM version: 4.4
  • CMS version: Drupal 7
  • MySQL version: 5.5
  • PHP version: 5.5
Re: Creating a Custom Dashlet
December 12, 2014, 11:05:52 am
We at Skvare have created a Drupal module that integrates Views into dashlets.
You can read the blog post here: https://civicrm.org/blogs/brandonferrell/drupal-views-civicrm-dashlets
And you can view the project page here: https://www.drupal.org/sandbox/brandonferrell/2389543
« Last Edit: December 12, 2014, 01:30:48 pm by brandonbryan12 »

commonpike

  • I’m new here
  • *
  • Posts: 12
  • Karma: 1
  • CiviCRM version: 4.4.6
  • CMS version: drupal 7.13
  • MySQL version: 5
  • PHP version: 5
Re: Creating a Custom Dashlet
December 12, 2014, 12:33:39 pm
Quote from: brandonbryan12 on December 12, 2014, 11:05:52 am
I have created a Drupal module that integrates Views into dashlets.

Karma+++! Very cool, will check it out.

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: Creating a Custom Dashlet
December 13, 2014, 02:55:38 pm
great to see more views integration - thanks for publishing
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Creating a Custom Dashlet

This forum was archived on 2017-11-26.