本文整理汇总了PHP中Report::setType方法的典型用法代码示例。如果您正苦于以下问题:PHP Report::setType方法的具体用法?PHP Report::setType怎么用?PHP Report::setType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Report
的用法示例。
在下文中一共展示了Report::setType方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: makeReportBySavedCalendar
/**
* @param $savedCalendar
* @return Report
*/
public static function makeReportBySavedCalendar(SavedCalendar $savedCalendar)
{
$report = new Report();
if ($savedCalendar->id > 0) {
$report->setId((int) $savedCalendar->id);
}
$report->setDescription($savedCalendar->description);
if ($savedCalendar->moduleClassName != null) {
$report->setModuleClassName($savedCalendar->moduleClassName);
}
if ($savedCalendar->name != null) {
$report->setName($savedCalendar->name);
}
$report->setOwner($savedCalendar->owner);
$report->setType(Report::TYPE_ROWS_AND_COLUMNS);
$explicitReadWriteModelPermissions = ExplicitReadWriteModelPermissionsUtil::makeBySecurableItem($savedCalendar);
$report->setExplicitReadWriteModelPermissions($explicitReadWriteModelPermissions);
if ($savedCalendar->serializedData != null) {
$unserializedData = unserialize($savedCalendar->serializedData);
if (isset($unserializedData['filtersStructure'])) {
$report->setFiltersStructure($unserializedData['filtersStructure']);
}
CalendarUtil::makeComponentFormAndPopulateReportFromData($unserializedData[ComponentForReportForm::TYPE_FILTERS], $report, 'Filter');
}
return $report;
}
示例2: testRunQueryAndGrandTotalsData
public function testRunQueryAndGrandTotalsData()
{
ContactTestHelper::createContactByNameForOwner('testContact', $this->super);
$report = new Report();
$report->setType(Report::TYPE_SUMMATION);
$report->setModuleClassName('ContactsModule');
$report->setFiltersStructure('');
$groupBy = new GroupByForReportForm('ContactsModule', 'Contact', Report::TYPE_SUMMATION);
$groupBy->attributeIndexOrDerivedType = 'createdDateTime__Day';
$report->addGroupBy($groupBy);
$displayAttribute = new DisplayAttributeForReportForm('ContactsModule', 'Contact', Report::TYPE_SUMMATION);
$displayAttribute->attributeIndexOrDerivedType = 'createdDateTime__Day';
$report->addDisplayAttribute($displayAttribute);
$dataProvider = new SummationReportDataProvider($report);
$this->assertEmpty($dataProvider->runQueryAndGrandTotalsData());
}
示例3: testExportRelationAttributes
public function testExportRelationAttributes()
{
$report = new Report();
$report->setType(Report::TYPE_ROWS_AND_COLUMNS);
$report->setModuleClassName('EmailMessagesModule');
$report->setFiltersStructure('');
$emailMessage = new EmailMessage();
$emailMessage->owner = Yii::app()->user->userModel;
$emailMessage->subject = 'A test email';
$emailContent = new EmailMessageContent();
$emailContent->textContent = 'A test text message from Zurmo.';
$emailContent->htmlContent = 'A test text message from Zurmo.';
$emailMessage->content = $emailContent;
$sender = new EmailMessageSender();
$sender->fromAddress = 'super@zurmo.com';
$sender->fromName = 'super';
$sender->personsOrAccounts->add(Yii::app()->user->userModel);
$emailMessage->sender = $sender;
$recipient = new EmailMessageRecipient();
$recipient->toAddress = 'billy@joe.com';
$recipient->toName = 'Test Recipient';
$recipient->type = EmailMessageRecipient::TYPE_TO;
$emailMessage->recipients->add($recipient);
$box = EmailBox::resolveAndGetByName(EmailBox::NOTIFICATIONS_NAME);
$emailMessage->folder = EmailFolder::getByBoxAndType($box, EmailFolder::TYPE_SENT);
$this->assertTrue($emailMessage->save());
$displayAttribute1 = new DisplayAttributeForReportForm('EmailMessagesModule', 'EmailMessage', Report::TYPE_ROWS_AND_COLUMNS);
$displayAttribute1->setModelAliasUsingTableAliasName('relatedModel');
$displayAttribute1->attributeIndexOrDerivedType = 'sender___User__personsOrAccounts__Inferred___firstName';
$report->addDisplayAttribute($displayAttribute1);
$displayAttribute2 = new DisplayAttributeForReportForm('EmailMessagesModule', 'EmailMessage', Report::TYPE_ROWS_AND_COLUMNS);
$displayAttribute2->setModelAliasUsingTableAliasName('relatedModel');
$displayAttribute2->attributeIndexOrDerivedType = 'sender___Contact__personsOrAccounts__Inferred___firstName';
$report->addDisplayAttribute($displayAttribute2);
$dataProvider = new RowsAndColumnsReportDataProvider($report);
$adapter = ReportToExportAdapterFactory::createReportToExportAdapter($report, $dataProvider);
$compareHeaderData = array('Sender >> Users >> First Name', 'Sender >> Contacts >> First Name');
$compareRowData = array(array('Clark', ''));
$this->assertEquals($compareHeaderData, $adapter->getHeaderData());
$this->assertEquals($compareRowData, $adapter->getData());
}
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:41,代码来源:EmailMessagesRowsAndColumnsReportToExportAdapterTest.php
示例4: makeReportBySavedReport
/**
* @param $savedReport
* @return Report
*/
public static function makeReportBySavedReport($savedReport)
{
$report = new Report();
if ($savedReport->id > 0) {
$report->setId((int) $savedReport->id);
}
$report->setDescription($savedReport->description);
$report->setModuleClassName($savedReport->moduleClassName);
$report->setName($savedReport->name);
$report->setOwner($savedReport->owner);
$report->setType($savedReport->type);
$explicitReadWriteModelPermissions = ExplicitReadWriteModelPermissionsUtil::makeBySecurableItem($savedReport);
$report->setExplicitReadWriteModelPermissions($explicitReadWriteModelPermissions);
if ($savedReport->serializedData != null) {
$unserializedData = unserialize($savedReport->serializedData);
if (isset($unserializedData['filtersStructure'])) {
$report->setFiltersStructure($unserializedData['filtersStructure']);
}
if (isset($unserializedData['currencyConversionType'])) {
$report->setCurrencyConversionType((int) $unserializedData['currencyConversionType']);
}
if (isset($unserializedData['spotConversionCurrencyCode'])) {
$report->setSpotConversionCurrencyCode($unserializedData['spotConversionCurrencyCode']);
}
self::makeComponentFormAndPopulateReportFromData($unserializedData[ComponentForReportForm::TYPE_FILTERS], $report, 'Filter');
self::makeComponentFormAndPopulateReportFromData($unserializedData[ComponentForReportForm::TYPE_ORDER_BYS], $report, 'OrderBy');
self::makeComponentFormAndPopulateReportFromData($unserializedData[ComponentForReportForm::TYPE_GROUP_BYS], $report, 'GroupBy');
self::makeComponentFormAndPopulateReportFromData($unserializedData[ComponentForReportForm::TYPE_DISPLAY_ATTRIBUTES], $report, 'DisplayAttribute');
self::makeComponentFormAndPopulateReportFromData($unserializedData[ComponentForReportForm::TYPE_DRILL_DOWN_DISPLAY_ATTRIBUTES], $report, 'DrillDownDisplayAttribute');
if (isset($unserializedData['chart'])) {
$moduleClassName = $report->getModuleClassName();
$modelClassName = $moduleClassName::getPrimaryModelName();
$adapter = ModelRelationsAndAttributesToSummationReportAdapter::make($moduleClassName, $modelClassName, $report->getType());
$chart = new ChartForReportForm(ReportUtil::makeDataAndLabelsForSeriesOrRange($adapter->getAttributesForChartSeries($report->getGroupBys(), $report->getDisplayAttributes())), ReportUtil::makeDataAndLabelsForSeriesOrRange($adapter->getAttributesForChartRange($report->getDisplayAttributes())));
$chart->setAttributes($unserializedData['chart']);
$report->setChart($chart);
}
}
return $report;
}
示例5: report
/**
* Log a message
* @param bool $success
* @param string $msg A message to you ho... :)
*/
public function report($success, $msg)
{
$report = new Report();
$report->setType($this->_type)->setSuccess($success)->setMsg($msg);
$this->_reports[] = $report;
}
示例6: makeSimpleContactRowsAndColumnsReport
public static function makeSimpleContactRowsAndColumnsReport()
{
$report = new Report();
$report->setDescription('A test contact report');
$report->setModuleClassName('ContactsModule');
$report->setName('A rows and columns report');
$report->setType(Report::TYPE_ROWS_AND_COLUMNS);
$report->setOwner(Yii::app()->user->userModel);
$report->setCurrencyConversionType(Report::CURRENCY_CONVERSION_TYPE_BASE);
$report->setFiltersStructure('');
$displayAttribute = new DisplayAttributeForReportForm('ContactsModule', 'Contact', $report->getType());
$displayAttribute->attributeIndexOrDerivedType = 'lastName';
$report->addDisplayAttribute($displayAttribute);
$savedReport = new SavedReport();
SavedReportToReportAdapter::resolveReportToSavedReport($report, $savedReport);
$saved = $savedReport->save();
if (!$saved) {
throw new FailedToSaveModelException();
}
return $savedReport;
}
示例7: makeMeetingsCategoryAndMonthStartTimeByOwner
public static function makeMeetingsCategoryAndMonthStartTimeByOwner()
{
$report = new Report();
$report->setModuleClassName('MeetingsModule');
$report->setName('Meettings Category And Month Start Time By Owner');
$report->setType(Report::TYPE_MATRIX);
$report->setOwner(Yii::app()->user->userModel);
$report->setFiltersStructure('');
$report->setCurrencyConversionType(Report::CURRENCY_CONVERSION_TYPE_BASE);
$groupBy = new GroupByForReportForm('MeetingsModule', 'Meeting', $report->getType());
$groupBy->attributeIndexOrDerivedType = 'startDateTime__Month';
$groupBy->axis = 'x';
$report->addGroupBy($groupBy);
$groupBy = new GroupByForReportForm('MeetingsModule', 'Meeting', $report->getType());
$groupBy->attributeIndexOrDerivedType = 'category';
$groupBy->axis = 'x';
$report->addGroupBy($groupBy);
$groupBy = new GroupByForReportForm('MeetingsModule', 'Meeting', $report->getType());
$groupBy->attributeIndexOrDerivedType = 'owner__User';
$groupBy->axis = 'y';
$report->addGroupBy($groupBy);
$displayAttribute = new DisplayAttributeForReportForm('MeetingsModule', 'Meeting', $report->getType());
$displayAttribute->attributeIndexOrDerivedType = 'Count';
$report->addDisplayAttribute($displayAttribute);
$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');
}
示例8: testRemoveRuntimeFilters
public function testRemoveRuntimeFilters()
{
$report = new Report();
$report->setModuleClassName('ContactsModule');
$report->setType(Report::TYPE_ROWS_AND_COLUMNS);
//A filter available at runtime
$filter = new FilterForReportForm('AccountsModule', 'Account', $report->getType());
$filter->availableAtRunTime = true;
$filter->attributeIndexOrDerivedType = 'officePhone';
$filter->value = 'aValue';
$filter->operator = 'equals';
$report->addFilter($filter);
//A filter not available at runtime
$filter2 = new FilterForReportForm('AccountsModule', 'Account', $report->getType());
$filter2->availableAtRunTime = false;
$filter2->attributeIndexOrDerivedType = 'contacts___lastName';
$filter2->value = 'aValue';
$filter2->operator = 'equals';
$report->addFilter($filter2);
$report->removeRuntimeFilters();
$filters = $report->getFilters();
$this->assertCount(1, $filters);
$this->assertEquals($filter2, $filters[0]);
}
示例9: testCalculateTotalGroupingsCount
public function testCalculateTotalGroupingsCount()
{
Yii::app()->user->userModel = User::getByUsername('super');
$report = new Report();
$report->setType(Report::TYPE_MATRIX);
$report->setModuleClassName('ReportsTestModule');
$report->setFiltersStructure('');
$displayAttribute = new DisplayAttributeForReportForm('ReportsTestModule', 'ReportModelTestItem', Report::TYPE_MATRIX);
$displayAttribute->attributeIndexOrDerivedType = 'integer__Maximum';
$report->addDisplayAttribute($displayAttribute);
$reportDataProvider = new MatrixReportDataProvider($report);
$count = $reportDataProvider->calculateTotalGroupingsCount();
$this->assertEquals(0, $count);
}
示例10: resolveSavedReportAndReportByPostData
protected function resolveSavedReportAndReportByPostData(array $postData, &$savedReport, &$report, $type, $id = null, $isBeingCopied = false)
{
if ($id == null) {
$this->resolveCanCurrentUserAccessReports();
$savedReport = new SavedReport();
$report = new Report();
$report->setType($type);
} elseif ($isBeingCopied) {
$savedReport = new SavedReport();
$oldReport = SavedReport::getById(intval($id));
ControllerSecurityUtil::resolveAccessCanCurrentUserReadModel($oldReport);
SavedReportCopyModelUtil::copy($oldReport, $savedReport);
$report = SavedReportToReportAdapter::makeReportBySavedReport($savedReport);
} else {
$savedReport = SavedReport::getById(intval($id));
ControllerSecurityUtil::resolveAccessCanCurrentUserWriteModel($savedReport);
$report = SavedReportToReportAdapter::makeReportBySavedReport($savedReport);
}
DataToReportUtil::resolveReportByWizardPostData($report, $postData, ReportToWizardFormAdapter::getFormClassNameByType($type));
}
示例11: testSqlQueryWithLinkTypeSpecificOnRelatedModels
public function testSqlQueryWithLinkTypeSpecificOnRelatedModels()
{
$quote = DatabaseCompatibilityUtil::getQuote();
Yii::app()->user->userModel = User::getByUsername('super');
$reportModelTestItem2 = new ReportModelTestItem2();
$reportModelTestItem2->name = 'name';
$this->assertTrue($reportModelTestItem2->save());
$reportModelTestItem = new ReportModelTestItem();
$reportModelTestItem->lastName = 'lastName';
$reportModelTestItem->string = 'string';
$reportModelTestItem->hasOne = $reportModelTestItem2;
$this->assertTrue($reportModelTestItem->save());
$report = new Report();
$report->setType(Report::TYPE_ROWS_AND_COLUMNS);
$report->setModuleClassName('ReportsTest2Module');
$report->setFiltersStructure('');
$displayAttribute1 = new DisplayAttributeForReportForm('ReportsTest2Module', 'ReportModelTestItem2', Report::TYPE_ROWS_AND_COLUMNS);
$displayAttribute1->setModelAliasUsingTableAliasName('relatedModel');
$displayAttribute1->attributeIndexOrDerivedType = 'hasMany2___FullName';
$report->addDisplayAttribute($displayAttribute1);
$dataProvider = new RowsAndColumnsReportDataProvider($report);
$content = $dataProvider->makeSqlQueryForDisplay();
$compareContent = "select {$quote}reportmodeltestitem{$quote}.{$quote}id{$quote} reportmodeltestitemid " . "from {$quote}reportmodeltestitem2{$quote} " . "left join {$quote}reportmodeltestitem{$quote} on " . "{$quote}reportmodeltestitem{$quote}.{$quote}hasone_reportmodeltestitem2_id{$quote} " . "= {$quote}reportmodeltestitem2{$quote}.{$quote}id{$quote} limit 10 offset 0";
$this->assertEquals($compareContent, $content);
}
示例12: 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);
}
示例13: makeOpportunitiesByStage
public static function makeOpportunitiesByStage()
{
$report = new Report();
$report->setModuleClassName('OpportunitiesModule');
$report->setName('Opportunities by Stage');
$report->setType(Report::TYPE_SUMMATION);
$report->setOwner(Yii::app()->user->userModel);
$report->setFiltersStructure('');
$report->setCurrencyConversionType(Report::CURRENCY_CONVERSION_TYPE_BASE);
$groupBy = new GroupByForReportForm('OpportunitiesModule', 'Opportunity', $report->getType());
$groupBy->attributeIndexOrDerivedType = 'stage';
$groupBy->axis = 'x';
$report->addGroupBy($groupBy);
$displayAttribute = new DisplayAttributeForReportForm('OpportunitiesModule', 'Opportunity', $report->getType());
$displayAttribute->attributeIndexOrDerivedType = 'stage';
$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);
$chart = new ChartForReportForm();
$chart->type = 'Column2D';
$chart->firstSeries = 'stage';
$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');
}
示例14: testGetCalculationOrModifierType
/**
* @depends testResolveRealAttributeName
*/
public function testGetCalculationOrModifierType()
{
$model = new ReportModelTestItem();
$rules = new ReportsTestReportRules();
//ReportsTestModule rules
$report = new Report();
$report->setType(Report::TYPE_SUMMATION);
$report->setModuleClassName('ReportsTestModule');
$adapter = new ModelRelationsAndAttributesToSummationReportAdapter($model, $rules, $report->getType());
$this->assertEquals('Maximum', $adapter->getCalculationOrModifierType('integer__Maximum'));
$this->assertEquals('something', $adapter->getCalculationOrModifierType('something'));
}
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:15,代码来源:ModelRelationsAndAttributesToSummationReportAdapterTest.php
示例15: testGetLeadingHeadersDataFromMatrixReportDataProviderWithALinkableAttribute
public function testGetLeadingHeadersDataFromMatrixReportDataProviderWithALinkableAttribute()
{
$reportModelTestItem2 = new ReportModelTestItem2();
$reportModelTestItem2->name = 'report name';
$reportModelTestItem2->phone = '123456789';
$this->assertTrue($reportModelTestItem2->save());
$reportModelTestItem2 = new ReportModelTestItem2();
$reportModelTestItem2->name = 'report name';
$reportModelTestItem2->phone = '987654321';
$this->assertTrue($reportModelTestItem2->save());
$report = new Report();
$report->setType(Report::TYPE_MATRIX);
$report->setModuleClassName('ReportsTest2Module');
$report->setFiltersStructure('');
$displayAttribute = new DisplayAttributeForReportForm('ReportsTest2Module', 'ReportModelTestItem2', Report::TYPE_MATRIX);
$displayAttribute->attributeIndexOrDerivedType = 'Count';
$report->addDisplayAttribute($displayAttribute);
$groupBy = new GroupByForReportForm('ReportsTest2Module', 'ReportModelTestItem2', Report::TYPE_MATRIX);
$groupBy->attributeIndexOrDerivedType = 'phone';
$report->addGroupBy($groupBy);
$groupBy = new GroupByForReportForm('ReportsTest2Module', 'ReportModelTestItem2', Report::TYPE_MATRIX);
$groupBy->attributeIndexOrDerivedType = 'name';
$groupBy->axis = 'y';
$report->addGroupBy($groupBy);
$dataProvider = new MatrixReportDataProvider($report);
$adapter = ReportToExportAdapterFactory::createReportToExportAdapter($report, $dataProvider);
$compareRowData = array(array(null, '123456789', '987654321', 'Total'), array('Name', 'Count', 'Count', 'Count'), array('report name', 1, 1, 2), array('Total', 1, 1));
$this->assertEmpty($adapter->getHeaderData());
$this->assertEquals($compareRowData, $adapter->getData());
$report = new Report();
$report->setType(Report::TYPE_MATRIX);
$report->setModuleClassName('ReportsTest2Module');
$report->setFiltersStructure('');
$displayAttribute = new DisplayAttributeForReportForm('ReportsTest2Module', 'ReportModelTestItem2', Report::TYPE_MATRIX);
$displayAttribute->attributeIndexOrDerivedType = 'Count';
$report->addDisplayAttribute($displayAttribute);
$groupBy = new GroupByForReportForm('ReportsTest2Module', 'ReportModelTestItem2', Report::TYPE_MATRIX);
$groupBy->attributeIndexOrDerivedType = 'name';
$report->addGroupBy($groupBy);
$groupBy = new GroupByForReportForm('ReportsTest2Module', 'ReportModelTestItem2', Report::TYPE_MATRIX);
$groupBy->attributeIndexOrDerivedType = 'phone';
$groupBy->axis = 'y';
$report->addGroupBy($groupBy);
$dataProvider = new MatrixReportDataProvider($report);
$adapter = ReportToExportAdapterFactory::createReportToExportAdapter($report, $dataProvider);
$compareRowData = array(array(null, 'report name', 'Total'), array('Phone', 'Count', 'Count'), array('123456789', 1, 1), array('987654321', 1, 1), array('Total', 2));
$this->assertEmpty($adapter->getHeaderData());
$this->assertEquals($compareRowData, $adapter->getData());
}