$section = 1;
$chart = "&charts=" . $params['charts'];
}
-
- $dashletParams['url'] = "civicrm/report/instance/{$instance->id}&reset=1§ion={$section}&snippet=5{$chart}&context=dashlet";
- $dashletParams['fullscreen_url'] = "civicrm/report/instance/{$instance->id}&reset=1§ion={$section}&snippet=5{$chart}&context=dashletFullscreen";
+ $limitResult = NULL;
+ if (CRM_Utils_Array::value('row_count', $params)) {
+ $limitResult = '&rowCount=' . $params['row_count'];
+ }
+ $dashletParams['url'] = "civicrm/report/instance/{$instance->id}&reset=1§ion={$section}&snippet=5{$chart}&context=dashlet" . $limitResult;
+ $dashletParams['fullscreen_url'] = "civicrm/report/instance/{$instance->id}&reset=1§ion={$section}&snippet=5{$chart}&context=dashletFullscreen" . $limitResult;
$dashletParams['instanceURL'] = "civicrm/report/instance/{$instance->id}";
CRM_Core_BAO_Dashboard::addDashlet($dashletParams);
}
public $_whereClauses = array();
public $_havingClauses = array();
+ /**
+ * dashBoardRowCount Dashboard row count
+ * @var Integer
+ */
+ public $_dashBoardRowCount;
+
/**
* Is this being called without a form controller (ie. the report is being render outside the normal form
* - e.g the api is retrieving the rows
'Boolean',
CRM_Core_DAO::$_nullObject
);
+
+ $this->_dashBoardRowCount =
+ CRM_Utils_Request::retrieve(
+ 'rowCount',
+ 'Integer',
+ CRM_Core_DAO::$_nullObject
+ );
$this->_section = CRM_Utils_Request::retrieve('section', 'Integer', CRM_Core_DAO::$_nullObject);
function limit($rowCount = self::ROW_COUNT_LIMIT) {
// lets do the pager if in html mode
$this->_limit = NULL;
+
+ // CRM-14115, over-ride row count if rowCount is specified in URL
+ if ($this->_dashBoardRowCount) {
+ $rowCount = $this->_dashBoardRowCount;
+ }
if ($this->_outputMode == 'html' || $this->_outputMode == 'group') {
$this->_select = str_ireplace('SELECT ', 'SELECT SQL_CALC_FOUND_ROWS ', $this->_select);
}
function setPager($rowCount = self::ROW_COUNT_LIMIT) {
+
+ // CRM-14115, over-ride row count if rowCount is specified in URL
+ if ($this->_dashBoardRowCount) {
+ $rowCount = $this->_dashBoardRowCount;
+ }
+
if ($this->_limit && ($this->_limit != '')) {
$sql = "SELECT FOUND_ROWS();";
$this->_rowsFound = CRM_Core_DAO::singleValueQuery($sql);
function limit($rowCount = CRM_Report_Form::ROW_COUNT_LIMIT) {
// lets do the pager if in html mode
$this->_limit = NULL;
+
+ // CRM-14115, over-ride row count if rowCount is specified in URL
+ if ($this->_dashBoardRowCount) {
+ $rowCount = $this->_dashBoardRowCount;
+ }
if ($this->_outputMode == 'html' || $this->_outputMode == 'group') {
//replace only first occurence of SELECT
$this->_select = preg_replace('/SELECT/', 'SELECT SQL_CALC_FOUND_ROWS ', $this->_select, 1);
ts('CC'),
$attributes['email_subject']
);
-
+
+ $form->add('text',
+ 'row_count',
+ ts('Limit Dashboard Results'),
+ array('maxlength' => 64,
+ 'size' => 5
+ )
+ );
+
$form->add('textarea',
'report_header',
ts('Report Header'),
array('onclick' => "return showHideByValue('is_navigation','','navigation_menu','table-row','radio',false);")
);
- $form->addElement('checkbox', 'addToDashboard', ts('Available for Dashboard?'));
+ $form->addElement('checkbox', 'addToDashboard', ts('Available for Dashboard?'), NULL,
+ array('onclick' => "return showHideByValue('addToDashboard','','limit_result','table-row','radio',false);"));
$form->addElement('checkbox', 'is_reserved', ts('Reserved Report?'));
if (!CRM_Core_Permission::check('administer reserved reports')) {
$form->freeze('is_reserved');
<span class="description">{ts}Users with appropriate permissions can add this report to their dashboard.{/ts}</span>
</td>
</tr>
+ <tr id ="limit_result" class="crm-report-instanceForm-form-block-limitUser">
+ <td class="report-label">{$form.row_count.label}</td>
+ <td>{$form.row_count.html}</td>
+ </tr>
</table>
{include file="CRM/common/showHideByFieldValue.tpl"
field_type ="radio"
invert = 0
}
+{include file="CRM/common/showHideByFieldValue.tpl"
+ trigger_field_id ="addToDashboard"
+ trigger_value =""
+ target_element_id ="limit_result"
+ target_element_type ="table-row"
+ field_type ="radio"
+ invert = 0
+}
{if $is_navigation}
<script type="text/javascript">