本文整理汇总了PHP中Report::getGroupBys方法的典型用法代码示例。如果您正苦于以下问题:PHP Report::getGroupBys方法的具体用法?PHP Report::getGroupBys怎么用?PHP Report::getGroupBys使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Report
的用法示例。
在下文中一共展示了Report::getGroupBys方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setCommonAttributes
/**
* @param ReportWizardForm $formModel
*/
protected function setCommonAttributes(ReportWizardForm $formModel)
{
$formModel->id = $this->report->getId();
$formModel->description = $this->report->getDescription();
$formModel->moduleClassName = $this->report->getModuleClassName();
if ($this->report->getOwner()->id > 0) {
$formModel->ownerId = (int) $this->report->getOwner()->id;
$formModel->ownerName = strval($this->report->getOwner());
}
$formModel->name = $this->report->getName();
$formModel->type = $this->report->getType();
$formModel->filtersStructure = $this->report->getFiltersStructure();
$formModel->currencyConversionType = $this->report->getCurrencyConversionType();
$formModel->spotConversionCurrencyCode = $this->report->getSpotConversionCurrencyCode();
if ($this->report->isNew()) {
$formModel->setIsNew();
}
$formModel->setExplicitReadWriteModelPermissions($this->report->getExplicitReadWriteModelPermissions());
$formModel->filters = $this->report->getFilters();
$formModel->orderBys = $this->report->getOrderBys();
$formModel->groupBys = $this->report->getGroupBys();
$formModel->displayAttributes = $this->report->getDisplayAttributes();
$formModel->drillDownDisplayAttributes = $this->report->getDrillDownDisplayAttributes();
$formModel->chart = $this->report->getChart();
}
示例2: getAttributesData
/**
* @param ModelRelationsAndAttributesToReportAdapter $modelToReportAdapter
* @param RedBeanModel $precedingModel
* @param null|string $precedingRelation
* @throws NotSupportedException if the treeType is invalid or null
*/
protected function getAttributesData(ModelRelationsAndAttributesToReportAdapter $modelToReportAdapter, RedBeanModel $precedingModel = null, $precedingRelation = null)
{
if ($this->treeType == ComponentForReportForm::TYPE_FILTERS) {
return $modelToReportAdapter->getAttributesForFilters();
} elseif ($this->treeType == ComponentForReportForm::TYPE_DISPLAY_ATTRIBUTES) {
return $modelToReportAdapter->getAttributesForDisplayAttributes($this->report->getGroupBys(), $precedingModel, $precedingRelation);
} elseif ($this->treeType == ComponentForReportForm::TYPE_ORDER_BYS) {
return $modelToReportAdapter->getAttributesForOrderBys($this->report->getGroupBys(), $this->report->getDisplayAttributes(), $precedingModel, $precedingRelation);
} elseif ($this->treeType == ComponentForReportForm::TYPE_GROUP_BYS) {
return $modelToReportAdapter->getAttributesForGroupBys($precedingModel, $precedingRelation);
} elseif ($this->treeType == ComponentForReportForm::TYPE_DRILL_DOWN_DISPLAY_ATTRIBUTES) {
return $modelToReportAdapter->getForDrillDownAttributes($precedingModel, $precedingRelation);
} else {
throw new NotSupportedException();
}
}
示例3: resolveGroupBys
/**
* @return array
*/
public function resolveGroupBys()
{
return $this->report->getGroupBys();
}
示例4: resolveChart
/**
* @param array $data
* @param Report $report
*/
protected static function resolveChart($data, Report $report)
{
if ($report->getType() != Report::TYPE_SUMMATION) {
return;
}
$moduleClassName = $report->getModuleClassName();
if ($moduleClassName != null) {
$modelClassName = $moduleClassName::getPrimaryModelName();
$adapter = ModelRelationsAndAttributesToSummationReportAdapter::make($moduleClassName, $modelClassName, $report->getType());
$seriesDataAndLabels = ReportUtil::makeDataAndLabelsForSeriesOrRange($adapter->getAttributesForChartSeries($report->getGroupBys(), $report->getDisplayAttributes()));
$rangeDataAndLabels = ReportUtil::makeDataAndLabelsForSeriesOrRange($adapter->getAttributesForChartRange($report->getDisplayAttributes()));
} else {
$seriesDataAndLabels = array();
$rangeDataAndLabels = array();
}
$chart = new ChartForReportForm($seriesDataAndLabels, $rangeDataAndLabels);
if (null != ($chartData = ArrayUtil::getArrayValue($data, 'ChartForReportForm'))) {
$chart->setAttributes($chartData);
}
$report->setChart($chart);
}
示例5: testGetAvailableAttributesForMatrixDisplayAttributes
/**
* @depends testGetAvailableAttributesForMatrixGroupBys
*/
public function testGetAvailableAttributesForMatrixDisplayAttributes()
{
//Without any group by displayed, nothing is available
$model = new ReportModelTestItem();
$rules = new ReportsTestReportRules();
$report = new Report();
$report->setType(Report::TYPE_MATRIX);
$report->setModuleClassName('ReportsTestModule');
$adapter = new ModelRelationsAndAttributesToMatrixReportAdapter($model, $rules, $report->getType());
$attributes = $adapter->getAttributesForDisplayAttributes($report->getGroupBys());
$this->assertEquals(0, count($attributes));
//Select dropDown as the groupBy attribute
$groupBy = new GroupByForReportForm('ReportsTestModule', 'ReportModelTestItem', $report->getType());
$groupBy->attributeIndexOrDerivedType = 'dropDown';
$report = new Report();
$report->setType(Report::TYPE_MATRIX);
$report->setModuleClassName('ReportsTestModule');
$report->addGroupBy($groupBy);
$adapter = new ModelRelationsAndAttributesToMatrixReportAdapter($model, $rules, $report->getType());
$attributes = $adapter->getAttributesForDisplayAttributes($report->getGroupBys());
$this->assertEquals(21, count($attributes));
$compareData = array('label' => 'Count');
$this->assertEquals($compareData, $attributes['Count']);
$compareData = array('label' => 'Created Date Time -(Min)');
$this->assertEquals($compareData, $attributes['createdDateTime__Minimum']);
$compareData = array('label' => 'Created Date Time -(Max)');
$this->assertEquals($compareData, $attributes['createdDateTime__Maximum']);
$compareData = array('label' => 'Modified Date Time -(Min)');
$this->assertEquals($compareData, $attributes['modifiedDateTime__Minimum']);
$compareData = array('label' => 'Modified Date Time -(Max)');
$this->assertEquals($compareData, $attributes['modifiedDateTime__Maximum']);
$compareData = array('label' => 'Date -(Min)');
$this->assertEquals($compareData, $attributes['date__Minimum']);
$compareData = array('label' => 'Date -(Max)');
$this->assertEquals($compareData, $attributes['date__Maximum']);
$compareData = array('label' => 'Date Time -(Min)');
$this->assertEquals($compareData, $attributes['dateTime__Minimum']);
$compareData = array('label' => 'Date Time -(Max)');
$this->assertEquals($compareData, $attributes['dateTime__Maximum']);
$compareData = array('label' => 'Float -(Min)');
$this->assertEquals($compareData, $attributes['float__Minimum']);
$compareData = array('label' => 'Float -(Max)');
$this->assertEquals($compareData, $attributes['float__Maximum']);
$compareData = array('label' => 'Float -(Sum)');
$this->assertEquals($compareData, $attributes['float__Summation']);
$compareData = array('label' => 'Float -(Avg)');
$this->assertEquals($compareData, $attributes['float__Average']);
$compareData = array('label' => 'Integer -(Min)');
$this->assertEquals($compareData, $attributes['integer__Minimum']);
$compareData = array('label' => 'Integer -(Max)');
$this->assertEquals($compareData, $attributes['integer__Maximum']);
$compareData = array('label' => 'Integer -(Sum)');
$this->assertEquals($compareData, $attributes['integer__Summation']);
$compareData = array('label' => 'Integer -(Avg)');
$this->assertEquals($compareData, $attributes['integer__Average']);
$compareData = array('label' => 'Currency Value -(Min)');
$this->assertEquals($compareData, $attributes['currencyValue__Minimum']);
$compareData = array('label' => 'Currency Value -(Max)');
$this->assertEquals($compareData, $attributes['currencyValue__Maximum']);
$compareData = array('label' => 'Currency Value -(Sum)');
$this->assertEquals($compareData, $attributes['currencyValue__Summation']);
$compareData = array('label' => 'Currency Value -(Avg)');
$this->assertEquals($compareData, $attributes['currencyValue__Average']);
}
示例6: resolveReportToSavedReport
/**
* @param Report $report
* @param SavedReport$savedReport
*/
public static function resolveReportToSavedReport(Report $report, SavedReport $savedReport)
{
$savedReport->description = $report->getDescription();
$savedReport->moduleClassName = $report->getModuleClassName();
$savedReport->name = $report->getName();
$savedReport->owner = $report->getOwner();
$savedReport->type = $report->getType();
$data = array();
$data['filtersStructure'] = $report->getFiltersStructure();
$data['currencyConversionType'] = $report->getCurrencyConversionType();
$data['spotConversionCurrencyCode'] = $report->getSpotConversionCurrencyCode();
$data[ComponentForReportForm::TYPE_FILTERS] = self::makeArrayFromComponentFormsAttributesData($report->getFilters());
$data[ComponentForReportForm::TYPE_ORDER_BYS] = self::makeArrayFromComponentFormsAttributesData($report->getOrderBys());
$data[ComponentForReportForm::TYPE_GROUP_BYS] = self::makeArrayFromComponentFormsAttributesData($report->getGroupBys());
$data[ComponentForReportForm::TYPE_DISPLAY_ATTRIBUTES] = self::makeArrayFromComponentFormsAttributesData($report->getDisplayAttributes());
$data[ComponentForReportForm::TYPE_DRILL_DOWN_DISPLAY_ATTRIBUTES] = self::makeArrayFromComponentFormsAttributesData($report->getDrillDownDisplayAttributes());
if ($report->getChart()->type != null) {
$data['chart'] = self::makeArrayFromChartForReportFormAttributesData($report->getChart());
}
$savedReport->serializedData = serialize($data);
}
示例7: testGetAttributesForChartSeries
/**
* @depends testGetAttributesForOrderBysOnUser
*/
public function testGetAttributesForChartSeries()
{
$model = new ReportModelTestItem();
$rules = new ReportsTestReportRules();
$report = new Report();
$report->setType(Report::TYPE_SUMMATION);
$report->setModuleClassName('ReportsTestModule');
$adapter = new ModelRelationsAndAttributesToSummationReportAdapter($model, $rules, $report->getType());
$attributes = $adapter->getAttributesForChartSeries($report->getGroupBys());
$this->assertEquals(0, count($attributes));
//Add a group by, but not as a display attribute
$groupBy = new GroupByForReportForm('ReportsTestModule', 'ReportModelTestItem', $report->getType());
$groupBy->attributeIndexOrDerivedType = 'dropDown';
$report->setModuleClassName('ReportsTestModule');
$report->addGroupBy($groupBy);
$attributes = $adapter->getAttributesForChartSeries($report->getGroupBys());
$this->assertEquals(0, count($attributes));
//Add a group by as a display attribute
$groupBy = new GroupByForReportForm('ReportsTestModule', 'ReportModelTestItem', $report->getType());
$groupBy->attributeIndexOrDerivedType = 'dropDown';
$report->setModuleClassName('ReportsTestModule');
$report->addGroupBy($groupBy);
$displayAttribute = new DisplayAttributeForReportForm('ReportsTestModule', 'ReportModelTestItem', $report->getType());
$displayAttribute->attributeIndexOrDerivedType = 'dropDown';
$report->addDisplayAttribute($displayAttribute);
$attributes = $adapter->getAttributesForChartSeries($report->getGroupBys(), $report->getDisplayAttributes());
$this->assertEquals(1, count($attributes));
$compareData = array('label' => 'Drop Down');
$this->assertEquals($compareData, $attributes['dropDown']);
//Add a second group by as a display attribute
$groupBy = new GroupByForReportForm('ReportsTestModule', 'ReportModelTestItem', $report->getType());
$groupBy->attributeIndexOrDerivedType = 'radioDropDown';
$report->setModuleClassName('ReportsTestModule');
$report->addGroupBy($groupBy);
$displayAttribute = new DisplayAttributeForReportForm('ReportsTestModule', 'ReportModelTestItem', $report->getType());
$displayAttribute->attributeIndexOrDerivedType = 'radioDropDown';
$report->addDisplayAttribute($displayAttribute);
$attributes = $adapter->getAttributesForChartSeries($report->getGroupBys(), $report->getDisplayAttributes());
$this->assertEquals(2, count($attributes));
$compareData = array('label' => 'Drop Down');
$this->assertEquals($compareData, $attributes['dropDown']);
$compareData = array('label' => 'Radio Drop Down');
$this->assertEquals($compareData, $attributes['radioDropDown']);
//Add a third group by that is likeContactState as a display attribute
$groupBy = new GroupByForReportForm('ReportsTestModule', 'ReportModelTestItem', $report->getType());
$groupBy->attributeIndexOrDerivedType = 'likeContactState';
$report->setModuleClassName('ReportsTestModule');
$report->addGroupBy($groupBy);
$displayAttribute = new DisplayAttributeForReportForm('ReportsTestModule', 'ReportModelTestItem', $report->getType());
$displayAttribute->attributeIndexOrDerivedType = 'likeContactState';
$report->addDisplayAttribute($displayAttribute);
$attributes = $adapter->getAttributesForChartSeries($report->getGroupBys(), $report->getDisplayAttributes());
$this->assertEquals(3, count($attributes));
$compareData = array('label' => 'Drop Down');
$this->assertEquals($compareData, $attributes['dropDown']);
$compareData = array('label' => 'Radio Drop Down');
$this->assertEquals($compareData, $attributes['radioDropDown']);
$compareData = array('label' => 'A name for a state');
$this->assertEquals($compareData, $attributes['likeContactState']);
}
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:63,代码来源:ModelRelationsAndAttributesToSummationReportAdapterTest.php