本文整理汇总了PHP中Report::addDrillDownDisplayAttribute方法的典型用法代码示例。如果您正苦于以下问题:PHP Report::addDrillDownDisplayAttribute方法的具体用法?PHP Report::addDrillDownDisplayAttribute怎么用?PHP Report::addDrillDownDisplayAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Report
的用法示例。
在下文中一共展示了Report::addDrillDownDisplayAttribute方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: makeSummationWithDrillDownReport
public static function makeSummationWithDrillDownReport()
{
$report = new Report();
$report->setDescription('A test summation report with drill down description');
$report->setModuleClassName('ReportsTestModule');
$report->setName('A test summation report with drill down');
$report->setType(Report::TYPE_SUMMATION);
$report->setOwner(Yii::app()->user->userModel);
$report->setFiltersStructure('1');
$report->setCurrencyConversionType(Report::CURRENCY_CONVERSION_TYPE_BASE);
$filter = new FilterForReportForm('ReportsTestModule', 'ReportModelTestItem', $report->getType());
$filter->attributeIndexOrDerivedType = 'string';
$filter->value = '123';
$filter->operator = OperatorRules::TYPE_EQUALS;
$report->addFilter($filter);
$groupBy = new GroupByForReportForm('ReportsTestModule', 'ReportModelTestItem', $report->getType());
$groupBy->attributeIndexOrDerivedType = 'owner__User';
$groupBy->axis = 'x';
$report->addGroupBy($groupBy);
$displayAttribute = new DisplayAttributeForReportForm('ReportsTestModule', 'ReportModelTestItem', $report->getType());
$displayAttribute->attributeIndexOrDerivedType = 'owner__User';
$report->addDisplayAttribute($displayAttribute);
$displayAttribute = new DisplayAttributeForReportForm('ReportsTestModule', 'ReportModelTestItem', $report->getType());
$displayAttribute->attributeIndexOrDerivedType = 'Count';
$report->addDisplayAttribute($displayAttribute);
$displayAttribute = new DisplayAttributeForReportForm('ReportsTestModule', 'ReportModelTestItem', $report->getType());
$displayAttribute->attributeIndexOrDerivedType = 'currencyValue__Summation';
$report->addDisplayAttribute($displayAttribute);
$drillDownDisplayAttribute = new DrillDownDisplayAttributeForReportForm('ReportsTestModule', 'ReportModelTestItem', $report->getType());
$drillDownDisplayAttribute->attributeIndexOrDerivedType = 'string';
$report->addDrillDownDisplayAttribute($drillDownDisplayAttribute);
$drillDownDisplayAttribute = new DrillDownDisplayAttributeForReportForm('ReportsTestModule', 'ReportModelTestItem', $report->getType());
$drillDownDisplayAttribute->attributeIndexOrDerivedType = 'hasOne___name';
$report->addDrillDownDisplayAttribute($drillDownDisplayAttribute);
$drillDownDisplayAttribute = new DrillDownDisplayAttributeForReportForm('ReportsTestModule', 'ReportModelTestItem', $report->getType());
$drillDownDisplayAttribute->attributeIndexOrDerivedType = 'currencyValue';
$report->addDrillDownDisplayAttribute($drillDownDisplayAttribute);
$drillDownDisplayAttribute = new DrillDownDisplayAttributeForReportForm('ReportsTestModule', 'ReportModelTestItem', $report->getType());
$drillDownDisplayAttribute->attributeIndexOrDerivedType = 'date';
$report->addDrillDownDisplayAttribute($drillDownDisplayAttribute);
$chart = new ChartForReportForm();
$chart->type = 'Pie2D';
$chart->firstSeries = 'owner__User';
$chart->firstRange = 'currencyValue__Summation';
$report->setChart($chart);
$savedReport = new SavedReport();
SavedReportToReportAdapter::resolveReportToSavedReport($report, $savedReport);
$saved = $savedReport->save();
if (!$saved) {
throw new FailedToSaveModelException();
}
return $savedReport;
}
示例2: testCanCurrentUserProperlyRenderResults
//.........这里部分代码省略.........
$filter->value = 'aValue';
$filter->operator = 'equals';
$report->addFilter($filter);
$this->assertTrue($report->canCurrentUserProperlyRenderResults());
//A filter on contacts is not ok for Billy to see
$filter2 = new FilterForReportForm('AccountsModule', 'Account', $report->getType());
$filter2->attributeIndexOrDerivedType = 'contacts___lastName';
$filter2->value = 'aValue';
$filter2->operator = 'equals';
$report->addFilter($filter2);
$this->assertFalse($report->canCurrentUserProperlyRenderResults());
//A related filter on opportunities would be ok for Billy to see
$report->removeAllFilters();
$filter = new FilterForReportForm('AccountsModule', 'Account', $report->getType());
$filter->attributeIndexOrDerivedType = 'opportunities___name';
$filter->value = 'aValue';
$filter->operator = 'equals';
$report->addFilter($filter);
$this->assertTrue($report->canCurrentUserProperlyRenderResults());
$report->removeAllFilters();
//Billy can see a groupBy on Accounts
$groupBy = new GroupByForReportForm('AccountsModule', 'Account', $report->getType());
$groupBy->attributeIndexOrDerivedType = 'name';
$groupBy->axis = 'y';
$report->addGroupBy($groupBy);
$this->assertTrue($report->canCurrentUserProperlyRenderResults());
//Billy cannot see a related groupBy on Contacts
$groupBy = new GroupByForReportForm('AccountsModule', 'Account', $report->getType());
$groupBy->attributeIndexOrDerivedType = 'contacts___lastName';
$groupBy->axis = 'y';
$report->addGroupBy($groupBy);
$this->assertFalse($report->canCurrentUserProperlyRenderResults());
//Billy can see a related groupBy on Opportunities
$report->removeAllGroupBys();
$groupBy = new GroupByForReportForm('AccountsModule', 'Account', $report->getType());
$groupBy->attributeIndexOrDerivedType = 'opportunities___name';
$groupBy->axis = 'y';
$report->addGroupBy($groupBy);
$this->assertTrue($report->canCurrentUserProperlyRenderResults());
$report->removeAllGroupBys();
//Billy can see an orderBy on Accounts
$orderBy = new OrderByForReportForm('AccountsModule', 'Account', $report->getType());
$orderBy->attributeIndexOrDerivedType = 'name';
$orderBy->order = 'desc';
$report->addOrderBy($orderBy);
$this->assertTrue($report->canCurrentUserProperlyRenderResults());
//Billy cannot see a related orderBy on Contacts
$orderBy = new OrderByForReportForm('AccountsModule', 'Account', $report->getType());
$orderBy->attributeIndexOrDerivedType = 'contacts___lastName';
$orderBy->order = 'desc';
$report->addOrderBy($orderBy);
$this->assertFalse($report->canCurrentUserProperlyRenderResults());
//Billy can see a related orderBy on Opportunities
$report->removeAllOrderBys();
$orderBy = new OrderByForReportForm('AccountsModule', 'Account', $report->getType());
$orderBy->attributeIndexOrDerivedType = 'opportunities___name';
$orderBy->order = 'desc';
$report->addOrderBy($orderBy);
$this->assertTrue($report->canCurrentUserProperlyRenderResults());
$report->removeAllOrderBys();
//Billy can see a displayAttribute on Accounts
$displayAttribute = new DisplayAttributeForReportForm('AccountsModule', 'Account', $report->getType());
$displayAttribute->attributeIndexOrDerivedType = 'name';
$displayAttribute->label = 'someNewLabel';
$report->addDisplayAttribute($displayAttribute);
$this->assertTrue($report->canCurrentUserProperlyRenderResults());
//Billy cannot see a related displayAttribute on Contacts
$displayAttribute = new DisplayAttributeForReportForm('AccountsModule', 'Account', $report->getType());
$displayAttribute->attributeIndexOrDerivedType = 'contacts___firstName';
$displayAttribute->label = 'someNewLabel';
$report->addDisplayAttribute($displayAttribute);
$this->assertFalse($report->canCurrentUserProperlyRenderResults());
//Billy can see a related displayAttribute on Opportunities
$report->removeAllDisplayAttributes();
$displayAttribute = new DisplayAttributeForReportForm('AccountsModule', 'Account', $report->getType());
$displayAttribute->attributeIndexOrDerivedType = 'opportunities___name';
$displayAttribute->label = 'someNewLabel';
$report->addDisplayAttribute($displayAttribute);
$this->assertTrue($report->canCurrentUserProperlyRenderResults());
$report->removeAllDisplayAttributes();
//Billy can see a drillDownDisplayAttribute on Accounts
$drillDownDisplayAttribute = new DrillDownDisplayAttributeForReportForm('AccountsModule', 'Account', $report->getType());
$drillDownDisplayAttribute->attributeIndexOrDerivedType = 'name';
$drillDownDisplayAttribute->label = 'someNewLabel';
$report->addDrillDownDisplayAttribute($drillDownDisplayAttribute);
$this->assertTrue($report->canCurrentUserProperlyRenderResults());
//Billy cannot see a related drillDownDisplayAttribute on Contacts
$drillDownDisplayAttribute = new DrillDownDisplayAttributeForReportForm('AccountsModule', 'Account', $report->getType());
$drillDownDisplayAttribute->attributeIndexOrDerivedType = 'contacts___firstName';
$drillDownDisplayAttribute->label = 'someNewLabel';
$report->addDrillDownDisplayAttribute($drillDownDisplayAttribute);
$this->assertFalse($report->canCurrentUserProperlyRenderResults());
//Billy can see a related drillDownDisplayAttribute on Opportunities
$report->removeAllDrillDownDisplayAttributes();
$drillDownDisplayAttribute = new DrillDownDisplayAttributeForReportForm('AccountsModule', 'Account', $report->getType());
$drillDownDisplayAttribute->attributeIndexOrDerivedType = 'opportunities___name';
$drillDownDisplayAttribute->label = 'someNewLabel';
$report->addDrillDownDisplayAttribute($drillDownDisplayAttribute);
$this->assertTrue($report->canCurrentUserProperlyRenderResults());
}
示例3: resolveDrillDownDisplayAttributes
/**
* @param array $data
* @param Report $report
*/
protected static function resolveDrillDownDisplayAttributes($data, Report $report)
{
$report->removeAllDrillDownDisplayAttributes();
DrillDownDisplayAttributeForReportForm::resetCount();
$moduleClassName = $report->getModuleClassName();
if (count($drillDownDisplayAttributesData = ArrayUtil::getArrayValue($data, ComponentForReportForm::TYPE_DRILL_DOWN_DISPLAY_ATTRIBUTES)) > 0) {
foreach ($drillDownDisplayAttributesData as $key => $drillDownDisplayAttributeData) {
$drillDownDisplayAttribute = new DrillDownDisplayAttributeForReportForm($moduleClassName, $moduleClassName::getPrimaryModelName(), $report->getType(), $key);
$drillDownDisplayAttribute->setAttributes($drillDownDisplayAttributeData);
$report->addDrillDownDisplayAttribute($drillDownDisplayAttribute);
}
} else {
$report->removeAllDrillDownDisplayAttributes();
}
}
示例4: makeClosedWonOpportunitiesByOwner
public static function makeClosedWonOpportunitiesByOwner()
{
$report = new Report();
$report->setDescription('A report showing closed won opportunties by owner');
$report->setModuleClassName('OpportunitiesModule');
$report->setName('Opportunities By Owner');
$report->setType(Report::TYPE_SUMMATION);
$report->setOwner(Yii::app()->user->userModel);
$report->setFiltersStructure('1');
$report->setCurrencyConversionType(Report::CURRENCY_CONVERSION_TYPE_BASE);
$filter = new FilterForReportForm('OpportunitiesModule', 'Opportunity', $report->getType());
$filter->attributeIndexOrDerivedType = 'stage';
$filter->value = 'Closed Won';
$filter->operator = OperatorRules::TYPE_EQUALS;
$report->addFilter($filter);
$groupBy = new GroupByForReportForm('OpportunitiesModule', 'Opportunity', $report->getType());
$groupBy->attributeIndexOrDerivedType = 'owner__User';
$groupBy->axis = 'x';
$report->addGroupBy($groupBy);
$displayAttribute = new DisplayAttributeForReportForm('OpportunitiesModule', 'Opportunity', $report->getType());
$displayAttribute->attributeIndexOrDerivedType = 'owner__User';
$report->addDisplayAttribute($displayAttribute);
$displayAttribute = new DisplayAttributeForReportForm('OpportunitiesModule', 'Opportunity', $report->getType());
$displayAttribute->attributeIndexOrDerivedType = 'Count';
$report->addDisplayAttribute($displayAttribute);
$displayAttribute = new DisplayAttributeForReportForm('OpportunitiesModule', 'Opportunity', $report->getType());
$displayAttribute->attributeIndexOrDerivedType = 'amount__Summation';
$report->addDisplayAttribute($displayAttribute);
$drillDownDisplayAttribute = new DrillDownDisplayAttributeForReportForm('OpportunitiesModule', 'Opportunity', $report->getType());
$drillDownDisplayAttribute->attributeIndexOrDerivedType = 'name';
$report->addDrillDownDisplayAttribute($drillDownDisplayAttribute);
$drillDownDisplayAttribute = new DrillDownDisplayAttributeForReportForm('OpportunitiesModule', 'Opportunity', $report->getType());
$drillDownDisplayAttribute->attributeIndexOrDerivedType = 'account___name';
$drillDownDisplayAttribute->label = 'Account Name';
$report->addDrillDownDisplayAttribute($drillDownDisplayAttribute);
$drillDownDisplayAttribute = new DrillDownDisplayAttributeForReportForm('OpportunitiesModule', 'Opportunity', $report->getType());
$drillDownDisplayAttribute->attributeIndexOrDerivedType = 'amount';
$report->addDrillDownDisplayAttribute($drillDownDisplayAttribute);
$drillDownDisplayAttribute = new DrillDownDisplayAttributeForReportForm('OpportunitiesModule', 'Opportunity', $report->getType());
$drillDownDisplayAttribute->attributeIndexOrDerivedType = 'closeDate';
$report->addDrillDownDisplayAttribute($drillDownDisplayAttribute);
$chart = new ChartForReportForm();
$chart->type = 'Pie2D';
$chart->firstSeries = 'owner__User';
$chart->firstRange = 'amount__Summation';
$report->setChart($chart);
$savedReport = new SavedReport();
SavedReportToReportAdapter::resolveReportToSavedReport($report, $savedReport);
//set explicit
$saved = $savedReport->save();
assert('$saved');
$explicitReadWriteModelPermissions = ExplicitReadWriteModelPermissionsUtil::makeBySecurableItem($savedReport);
$explicitReadWriteModelPermissions->addReadWritePermitable(Group::getByName(Group::EVERYONE_GROUP_NAME));
$success = ExplicitReadWriteModelPermissionsUtil::resolveExplicitReadWriteModelPermissions($savedReport, $explicitReadWriteModelPermissions);
assert('$success');
$saved = $savedReport->save();
assert('$saved');
}
示例5: testResolveReportToSavedReport
public function testResolveReportToSavedReport()
{
$billy = User::getByUsername('billy');
$report = new Report();
$report->setDescription('aDescription');
$report->setModuleClassName('ReportsTestModule');
$report->setName('myFirstReport');
$report->setType(Report::TYPE_ROWS_AND_COLUMNS);
$report->setOwner($billy);
$report->setFiltersStructure('1 and 2 or 3');
$report->setCurrencyConversionType(Report::CURRENCY_CONVERSION_TYPE_SPOT);
$report->setSpotConversionCurrencyCode('CAD');
$filter = new FilterForReportForm('ReportsTestModule', 'ReportModelTestItem', $report->getType());
$filter->attributeIndexOrDerivedType = 'string';
$filter->value = 'aValue';
$filter->operator = 'equals';
$filter->availableAtRunTime = true;
$report->addFilter($filter);
$filter = new FilterForReportForm('ReportsTestModule', 'ReportModelTestItem', $report->getType());
$filter->attributeIndexOrDerivedType = 'currencyValue';
$filter->value = 'aValue';
$filter->secondValue = 'bValue';
$filter->operator = 'between';
$filter->currencyIdForValue = '4';
$filter->availableAtRunTime = true;
$report->addFilter($filter);
$filter = new FilterForReportForm('ReportsTestModule', 'ReportModelTestItem', $report->getType());
$filter->attributeIndexOrDerivedType = 'owner__User';
$filter->value = 'aValue';
$filter->stringifiedModelForValue = 'someName';
$filter->availableAtRunTime = false;
$report->addFilter($filter);
$filter = new FilterForReportForm('ReportsTestModule', 'ReportModelTestItem', $report->getType());
$filter->attributeIndexOrDerivedType = 'createdDateTime';
$filter->value = 'aValue';
$filter->secondValue = 'bValue';
$filter->operator = null;
$filter->currencyIdForValue = null;
$filter->availableAtRunTime = true;
$filter->valueType = 'Between';
$report->addFilter($filter);
$groupBy = new GroupByForReportForm('ReportsTestModule', 'ReportModelTestItem', $report->getType());
$groupBy->attributeIndexOrDerivedType = 'lastName';
$groupBy->axis = 'y';
$report->addGroupBy($groupBy);
$orderBy = new OrderByForReportForm('ReportsTestModule', 'ReportModelTestItem', $report->getType());
$orderBy->attributeIndexOrDerivedType = 'url';
$orderBy->order = 'desc';
$report->addOrderBy($orderBy);
$displayAttribute = new DisplayAttributeForReportForm('ReportsTestModule', 'ReportModelTestItem', $report->getType());
$displayAttribute->attributeIndexOrDerivedType = 'phone';
$displayAttribute->label = 'someNewLabel';
$report->addDisplayAttribute($displayAttribute);
$drillDownDisplayAttribute = new DrillDownDisplayAttributeForReportForm('ReportsTestModule', 'ReportModelTestItem', $report->getType());
$drillDownDisplayAttribute->attributeIndexOrDerivedType = 'firstName';
$drillDownDisplayAttribute->label = 'someNewLabel';
$report->addDrillDownDisplayAttribute($drillDownDisplayAttribute);
$savedReport = new SavedReport();
$this->assertNull($savedReport->serializedData);
SavedReportToReportAdapter::resolveReportToSavedReport($report, $savedReport);
$this->assertEquals('ReportsTestModule', $savedReport->moduleClassName);
$this->assertEquals('myFirstReport', $savedReport->name);
$this->assertEquals('aDescription', $savedReport->description);
$this->assertEquals(Report::TYPE_ROWS_AND_COLUMNS, $savedReport->type);
$this->assertEquals('1 and 2 or 3', $report->getFiltersStructure());
$this->assertTrue($savedReport->owner->isSame($billy));
$compareData = array('Filters' => array(array('availableAtRunTime' => true, 'currencyIdForValue' => null, 'value' => 'aValue', 'secondValue' => null, 'stringifiedModelForValue' => null, 'valueType' => null, 'attributeIndexOrDerivedType' => 'string', 'operator' => 'equals'), array('availableAtRunTime' => true, 'currencyIdForValue' => '4', 'value' => 'aValue', 'secondValue' => 'bValue', 'stringifiedModelForValue' => null, 'valueType' => null, 'attributeIndexOrDerivedType' => 'currencyValue', 'operator' => 'between'), array('availableAtRunTime' => false, 'currencyIdForValue' => null, 'value' => 'aValue', 'secondValue' => null, 'stringifiedModelForValue' => 'someName', 'valueType' => null, 'attributeIndexOrDerivedType' => 'owner__User', 'operator' => null), array('availableAtRunTime' => true, 'value' => 'aValue', 'secondValue' => 'bValue', 'stringifiedModelForValue' => null, 'valueType' => 'Between', 'attributeIndexOrDerivedType' => 'createdDateTime', 'operator' => null, 'currencyIdForValue' => null)), 'OrderBys' => array(array('order' => 'desc', 'attributeIndexOrDerivedType' => 'url')), 'GroupBys' => array(array('axis' => 'y', 'attributeIndexOrDerivedType' => 'lastName')), 'DisplayAttributes' => array(array('label' => 'someNewLabel', 'attributeIndexOrDerivedType' => 'phone', 'columnAliasName' => 'col0', 'queryOnly' => false, 'valueUsedAsDrillDownFilter' => false, 'madeViaSelectInsteadOfViaModel' => false)), 'DrillDownDisplayAttributes' => array(array('label' => 'someNewLabel', 'attributeIndexOrDerivedType' => 'firstName', 'columnAliasName' => 'col0', 'queryOnly' => false, 'valueUsedAsDrillDownFilter' => false, 'madeViaSelectInsteadOfViaModel' => false)));
$unserializedData = unserialize($savedReport->serializedData);
$this->assertEquals($compareData['Filters'], $unserializedData['Filters']);
$this->assertEquals($compareData['OrderBys'], $unserializedData['OrderBys']);
$this->assertEquals($compareData['GroupBys'], $unserializedData['GroupBys']);
$this->assertEquals($compareData['DisplayAttributes'], $unserializedData['DisplayAttributes']);
$this->assertEquals($compareData['DrillDownDisplayAttributes'], $unserializedData['DrillDownDisplayAttributes']);
$this->assertEquals('1 and 2 or 3', $unserializedData['filtersStructure']);
$this->assertEquals(Report::CURRENCY_CONVERSION_TYPE_SPOT, $unserializedData['currencyConversionType']);
$this->assertEquals('CAD', $unserializedData['spotConversionCurrencyCode']);
$saved = $savedReport->save();
$this->assertTrue($saved);
}