Skip to content

Commit

Permalink
Merge pull request compucorp#12 from compucorp/staging
Browse files Browse the repository at this point in the history
Staging
  • Loading branch information
vincent1892 authored Mar 20, 2017
2 parents 72a2950 + 20ecd43 commit 105bfe1
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 10 deletions.
21 changes: 18 additions & 3 deletions CRM/Activityreport/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ public static function get() {

$activities = civicrm_api3('Activity', 'get', array(
'sequential' => 1,
'is_current_revision' => 1,
'is_deleted' => 0,
'api.ActivityContact.get' => array(),
'return' => implode(',', array_keys(self::$fields)),
'options' => array('sort' => 'id ASC', 'limit' => 0),
Expand Down Expand Up @@ -120,6 +122,15 @@ protected static function formatResult($data, $dataKey = null, $level = 0) {
self::$multiValues[$baseKey][] = $key;
}
}
if ($level === 1) {
$result = array_merge($result, array(
'Activity Date' => null,
'Activity Start Date Months' => null,
'Activity is a test' => null,
'Activity Expire Date' => null,
));
ksort($result);
}
} else {
return self::formatValue($dataKey, $data);
}
Expand Down Expand Up @@ -231,9 +242,13 @@ protected static function getEmptyRow() {
protected static function getActivityFields() {
// Get standard Fields of Activity entity.
$fields = CRM_Activity_DAO_Activity::fields();
if (!empty($fields['source_record_id'])) {
$fields['source_record_id']['title'] = t('Source Record ID');
}
unset($fields['is_current_revision']);
unset($fields['activity_is_deleted']);
unset($fields['weight']);
unset($fields['source_contact_id']);
unset($fields['phone_id']);
unset($fields['relationship_id']);
unset($fields['source_record_id']);
if (!empty($fields['activity_type_id'])) {
$fields['activity_type_id']['title'] = t('Activity Type');
}
Expand Down
14 changes: 8 additions & 6 deletions activityreport.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,14 @@ function activityreport_civicrm_alterSettingsFolders(&$metaDataFolders = NULL) {
function activityreport_civicrm_pageRun($page) {
if ($page instanceof CRM_Activityreport_Page_ActivityReport) {
CRM_Core_Resources::singleton()
->addScriptFile('uk.co.compucorp.civicrm.activityreport', 'js/pivottable/jquery-migrate-1.4.1.min.js', 1, 'page-header')
->addScriptFile('uk.co.compucorp.civicrm.activityreport', 'js/pivottable/jquery-ui-1.9.2.custom.min.js', 2, 'page-header')
->addScriptFile('uk.co.compucorp.civicrm.activityreport', 'js/pivottable/pivot.min.js', 3, 'page-header')
->addScriptFile('uk.co.compucorp.civicrm.activityreport', 'js/pivottable/c3.min.js', 4, 'page-header')
->addScriptFile('uk.co.compucorp.civicrm.activityreport', 'js/pivottable/c3_renderers.js', 5, 'page-header')
->addScriptFile('uk.co.compucorp.civicrm.activityreport', 'js/pivottable/export_renderers.js', 6, 'page-header');
->addScriptFile('uk.co.compucorp.civicrm.activityreport', 'js/pivottable/jquery-migrate-1.4.1.min.js')
->addScriptFile('uk.co.compucorp.civicrm.activityreport', 'js/pivottable/jquery-ui.js')
->addScriptFile('uk.co.compucorp.civicrm.activityreport', 'js/pivottable/jquery-ui-1.9.2.custom.min.js')
->addScriptFile('uk.co.compucorp.civicrm.activityreport', 'js/pivottable/pivot.min.js', CRM_Core_Resources::DEFAULT_WEIGHT, 'page-header')
->addScriptFile('uk.co.compucorp.civicrm.activityreport', 'js/pivottable/d3.min.js')
->addScriptFile('uk.co.compucorp.civicrm.activityreport', 'js/pivottable/c3.min.js')
->addScriptFile('uk.co.compucorp.civicrm.activityreport', 'js/pivottable/c3_renderers.js')
->addScriptFile('uk.co.compucorp.civicrm.activityreport', 'js/pivottable/export_renderers.js');
CRM_Core_Resources::singleton()
->addStyleFile('uk.co.compucorp.civicrm.activityreport', 'css/pivottable/pivot.css')
->addStyleFile('uk.co.compucorp.civicrm.activityreport', 'css/pivottable/c3.min.css')
Expand Down
21 changes: 21 additions & 0 deletions css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,20 @@
}

/* Customizing CSS for PivotTable */
table.pvtUi {
max-width: 100%;
table-layout: fixed;
}

table.pvtUi td:first-child {
width: 20%;
overflow: hidden;
}

table.pvtUi td:last-child {
width: 80%;
}

.pvtAxisContainer li span.pvtAttr {
height: auto;
}
Expand All @@ -24,3 +38,10 @@ th.pvtAxisLabel, th.pvtRowLabel, th.pvtColLabel {
width: 191px;
}

.pvtRendererArea {
overflow-x: scroll;
}

select.pvtAggregator {
width: 100%;
}
2 changes: 1 addition & 1 deletion info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</urls>
<releaseDate>2016-02-25</releaseDate>
<version>1.0</version>
<develStage>alpha</develStage>
<develStage>Stable</develStage>
<compatibility>
<ver>4.6</ver>
<ver>4.7</ver>
Expand Down
5 changes: 5 additions & 0 deletions js/pivottable/d3.min.js

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions templates/CRM/Activityreport/Page/ActivityReport.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@
cols: [],
aggregatorName: "Count",
unusedAttrsVertical: false,
rendererOptions: {
c3: {
size: {
width: parseInt(jQuery('#reportPivotTable').width() * 0.78, 10)
}
},
},
derivedAttributes: {
"Activity Date": jQuery.pivotUtilities.derivers.dateFormat("Activity Date Time", "%y-%m-%d"),
"Activity Start Date Months": jQuery.pivotUtilities.derivers.dateFormat("Activity Date Time", "%y-%m"),
Expand Down

0 comments on commit 105bfe1

Please sign in to comment.