本文整理汇总了PHP中Report::getDisplayAttributes方法的典型用法代码示例。如果您正苦于以下问题:PHP Report::getDisplayAttributes方法的具体用法?PHP Report::getDisplayAttributes怎么用?PHP Report::getDisplayAttributes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Report
的用法示例。
在下文中一共展示了Report::getDisplayAttributes方法的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: resolveDisplayAttributes
/**
* @return array
*/
public function resolveDisplayAttributes()
{
return $this->report->getDisplayAttributes();
}
示例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: testGetAvailableAttributesForSummationOrderBysThatAreDisplayCalculations
/**
* @depends testGetAvailableAttributesForSummationOrderBys
*/
public function testGetAvailableAttributesForSummationOrderBysThatAreDisplayCalculations()
{
//You can only order what is grouped on or a display calculation attribute
$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->getAttributesForOrderBys($report->getGroupBys(), $report->getDisplayAttributes());
$this->assertEquals(0, count($attributes));
$displayAttribute = new DisplayAttributeForReportForm('ReportsTestModule', 'ReportModelTestItem', Report::TYPE_SUMMATION);
$this->assertNull($displayAttribute->label);
$displayAttribute->attributeIndexOrDerivedType = 'createdDateTime__Minimum';
$report->addDisplayAttribute($displayAttribute);
$adapter = new ModelRelationsAndAttributesToSummationReportAdapter($model, $rules, $report->getType());
$attributes = $adapter->getAttributesForOrderBys($report->getGroupBys(), $report->getDisplayAttributes());
$this->assertEquals(1, count($attributes));
$this->assertTrue(isset($attributes['createdDateTime__Minimum']));
$compareData = array('label' => 'Created Date Time -(Min)');
$this->assertEquals($compareData, $attributes['createdDateTime__Minimum']);
$displayAttribute = new DisplayAttributeForReportForm('ReportsTestModule', 'ReportModelTestItem', Report::TYPE_SUMMATION);
$this->assertNull($displayAttribute->label);
$displayAttribute->attributeIndexOrDerivedType = 'integer__Minimum';
$report->addDisplayAttribute($displayAttribute);
$adapter = new ModelRelationsAndAttributesToSummationReportAdapter($model, $rules, $report->getType());
$attributes = $adapter->getAttributesForOrderBys($report->getGroupBys(), $report->getDisplayAttributes());
$this->assertEquals(2, count($attributes));
$this->assertTrue(isset($attributes['integer__Minimum']));
$compareData = array('label' => 'Integer -(Min)');
$this->assertEquals($compareData, $attributes['integer__Minimum']);
//This should not add because we are at the wrong point in the chain
$displayAttribute = new DisplayAttributeForReportForm('ReportsTestModule', 'ReportModelTestItem', Report::TYPE_SUMMATION);
$this->assertNull($displayAttribute->label);
$displayAttribute->attributeIndexOrDerivedType = 'hasOne___createdDateTime__Minimum';
$report->addDisplayAttribute($displayAttribute);
$adapter = new ModelRelationsAndAttributesToSummationReportAdapter($model, $rules, $report->getType());
$attributes = $adapter->getAttributesForOrderBys($report->getGroupBys(), $report->getDisplayAttributes());
$this->assertEquals(2, count($attributes));
$this->assertFalse(isset($attributes['hasOne___createdDateTime__Minimum']));
}
示例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: testGetAttributesForChartRange
/**
* @depends testGetAttributesForChartSeries
*/
public function testGetAttributesForChartRange()
{
$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->getAttributesForChartRange($report->getDisplayAttributes());
$this->assertEquals(0, count($attributes));
//Add a display attribute that cannot be a range
$displayAttribute = new DisplayAttributeForReportForm('ReportsTestModule', 'ReportModelTestItem', $report->getType());
$displayAttribute->attributeIndexOrDerivedType = 'dropDown';
$report->setModuleClassName('ReportsTestModule');
$report->addDisplayAttribute($displayAttribute);
$attributes = $adapter->getAttributesForChartRange($report->getDisplayAttributes());
$this->assertEquals(0, count($attributes));
//Add a display attribute that can be a range
$displayAttribute = new DisplayAttributeForReportForm('ReportsTestModule', 'ReportModelTestItem', $report->getType());
$displayAttribute->attributeIndexOrDerivedType = 'float__Summation';
$report->setModuleClassName('ReportsTestModule');
$report->addDisplayAttribute($displayAttribute);
$attributes = $adapter->getAttributesForChartRange($report->getDisplayAttributes());
$this->assertEquals(1, count($attributes));
$compareData = array('label' => 'Float -(Sum)');
$this->assertEquals($compareData, $attributes['float__Summation']);
//Add a second display attribute that can be a range
$displayAttribute = new DisplayAttributeForReportForm('ReportsTestModule', 'ReportModelTestItem', $report->getType());
$displayAttribute->attributeIndexOrDerivedType = 'float__Average';
$report->setModuleClassName('ReportsTestModule');
$report->addDisplayAttribute($displayAttribute);
$attributes = $adapter->getAttributesForChartRange($report->getDisplayAttributes());
$this->assertEquals(2, count($attributes));
$compareData = array('label' => 'Float -(Sum)');
$this->assertEquals($compareData, $attributes['float__Summation']);
$compareData = array('label' => 'Float -(Avg)');
$this->assertEquals($compareData, $attributes['float__Average']);
}
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:41,代码来源:ModelRelationsAndAttributesToSummationReportAdapterTest.php