Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-13892

Dashboard: Allow manipulation of default dashlets

    Details

    • Type: Improvement
    • Status: Done/Fixed
    • Priority: Major
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.4.0
    • Fix Version/s: 4.4.4
    • Component/s: CiviHR, Extension System
    • Labels:
      None

      Description

      For CiviHR, we need to configure the default elements in "civicrm/dashboard".

      == Add column civicrm_dashboard.name ==

      • Add column to schema for (a) new installations and (b) upgraded installations.
      • Set dashlet names for (a) new installations and (b) upgraded installations. The names for core dashlets should be set to "blog", "activity", "myCases","allCases", "casedashboard" (which happens to match the paths). The names for report dashlets can be anything alphanumeric/unique.
      • In CRM_Core_BAO_Dashboard::addDashlet(), set a default name on any new dashlets (but preserve existing names for updated dashlets).
      • Test that the name works well when creating/updating/deleting reports on the dashboard.

      == Add hook_civirm_dashboard_defaults ==

      To facilitate this, add a hook that determines the default list of dashlets.

      /**

      • @param array $availableDashlets list of dashlets; each is formatted per api/v3/Dashboard
      • @param array $activeDashlets list of dashlets; each is formatted per api/v3/DashboardContact
        */
        function hook_civicrm_dashboard_defaults($availableDashlets, &$defaultDashlets);

      This will primarily require updating CRM_Core_BAO_Dashboard::getContactDashlets. Currently, getContactDashlets is hard-coded to insert the blog. It should instead do something like this pseudocode:

      function initializeDashlets()

      { $getDashlets = civicrm_api3("Dashboard", "get", array(domain_id => currentDomain)); $allDashlets = CRM_Utils_Array::index(array('name'), $getDashlets['values']); $defaultDashlets = array(); $defaultDashlets[] = array( 'dashboard_id' => $allDashlets['blog'], 'is_active' => 1, 'column_no' => 1, ); CRM_Utils_Hook::dashboard_defaults($allDashlets, $defaultDashlets); // Fill in missing "contact_id" for any items in $defaultDashlets // Save all items in $defaultDashlets - preferrably using civicrm_api3(). }

      Be sure to:

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                vivek.arora Vivek Arora
                Reporter:
                timotten Tim Otten
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 4 hours
                  4h