本文整理汇总了PHP中Report::getType方法的典型用法代码示例。如果您正苦于以下问题:PHP Report::getType方法的具体用法?PHP Report::getType怎么用?PHP Report::getType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Report
的用法示例。
在下文中一共展示了Report::getType方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: makeByReport
/**
* @param Report $report
* @param $pageSize
* @return MatrixReportDataProvider|RowsAndColumnsReportDataProvider|SummationReportDataProvider
* @throws NotSupportedException
*/
public static function makeByReport(Report $report, $pageSize)
{
$config = array('pagination' => array('pageSize' => $pageSize));
if ($report->getType() == Report::TYPE_ROWS_AND_COLUMNS) {
$dataProvider = new RowsAndColumnsReportDataProvider($report, $config);
} elseif ($report->getType() == Report::TYPE_SUMMATION) {
$dataProvider = new SummationReportDataProvider($report, $config);
} elseif ($report->getType() == Report::TYPE_MATRIX) {
$dataProvider = new MatrixReportDataProvider($report);
} else {
throw new NotSupportedException();
}
return $dataProvider;
}
示例2: makeByReportAndDataProvider
/**
* @param Report $report
* @param ReportDataProvider $dataProvider
* @return ReportResultsGridView based object
* @throws NotSupportedException if the report type is not valid or null
*/
public static function makeByReportAndDataProvider($controllerId, $moduleId, Report $report, ReportDataProvider $dataProvider = null)
{
assert('is_string($controllerId)');
assert('is_string($moduleId)');
if ($report->getType() == Report::TYPE_ROWS_AND_COLUMNS) {
$className = 'RowsAndColumnsReportResultsGridView';
} elseif ($report->getType() == Report::TYPE_SUMMATION) {
$className = 'SummationReportResultsGridView';
} elseif ($report->getType() == Report::TYPE_MATRIX) {
$className = 'MatrixReportResultsGridView';
} else {
throw new NotSupportedException();
}
return new $className($controllerId, $moduleId, $dataProvider);
}
示例3: 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();
}
示例4: createReportToExportAdapter
public static function createReportToExportAdapter(Report $report, ReportDataProvider $dataProvider)
{
$dataProviderClassName = get_class($dataProvider);
if ($dataProviderClassName == 'SummationDrillDownReportDataProvider') {
$className = 'SummationDrillDownReportToExportAdapter';
} else {
$className = $report->getType() . 'ReportToExportAdapter';
}
return new $className($dataProvider, $report);
}
示例5: resolveFilterForVariableStateAttributeIndex
/**
* @param string $attributeIndexOrDerivedTypePrefix
* @param array $variableStateData
* @return FilterForReportForm
*/
protected function resolveFilterForVariableStateAttributeIndex($attributeIndexOrDerivedTypePrefix, $variableStateData)
{
assert('is_string($attributeIndexOrDerivedTypePrefix) || $attributeIndexOrDerivedTypePrefix == null');
assert('is_array($variableStateData) && count($variableStateData) == 2');
$moduleClassName = $this->report->getModuleClassName();
$filter = new FilterForReportForm($moduleClassName, $moduleClassName::getPrimaryModelName(), $this->report->getType());
$filter->attributeIndexOrDerivedType = $attributeIndexOrDerivedTypePrefix . $variableStateData[0];
$filter->operator = OperatorRules::TYPE_ONE_OF;
$filter->value = $variableStateData[1];
return $filter;
}
示例6: makeStepsAndProgressBarViewFromReport
/**
* @param Report $report
* @return MatrixReportStepsAndProgressBarForWizardView|
* RowsAndColumnsReportStepsAndProgressBarForWizardView|
* SummationReportStepsAndProgressBarForWizardView
* @throws NotSupportedException
*/
public static function makeStepsAndProgressBarViewFromReport(Report $report)
{
$type = $report->getType();
if ($type == Report::TYPE_ROWS_AND_COLUMNS) {
return new RowsAndColumnsReportStepsAndProgressBarForWizardView();
} elseif ($type == Report::TYPE_SUMMATION) {
return new SummationReportStepsAndProgressBarForWizardView();
} elseif ($type == Report::TYPE_MATRIX) {
return new MatrixReportStepsAndProgressBarForWizardView();
} else {
throw new NotSupportedException();
}
}
示例7: 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);
}
示例8: testWhereNestedGroupBysAndGettingDataForOrderBy
/**
* @depends testNextedGroupBys
*/
public function testWhereNestedGroupBysAndGettingDataForOrderBy()
{
$report = new Report();
$report->setType(Report::TYPE_SUMMATION);
$groupBy = new GroupByForReportForm('ReportsTestModule', 'ReportModelTestItem', $report->getType());
$groupBy->attributeIndexOrDerivedType = 'hasOne___name';
$groupBy->axis = 'x';
$report->addGroupBy($groupBy);
$report->setModuleClassName('ReportsTestModule');
$adapter = new ReportRelationsAndAttributesToTreeAdapter($report, ComponentForReportForm::TYPE_ORDER_BYS);
$data = $adapter->getData(ComponentForReportForm::TYPE_ORDER_BYS . '_hasOne');
$this->assertEquals('OrderBys_hasOne___name', $data[0]['id']);
$this->assertEquals('OrderBys_hasOne___createdByUser', $data[1]['id']);
$this->assertEquals('OrderBys_hasOne___hasMany3', $data[2]['id']);
$this->assertEquals('OrderBys_hasOne___modifiedByUser', $data[3]['id']);
$this->assertEquals('OrderBys_hasOne___owner', $data[4]['id']);
}
示例9: processAttributeAdditionFromTree
/**
* Process attribute addition from tree and than renders it.
*
* @param string $nodeId
* @param string $treeType
* @param Report $report
* @param int $rowNumber
* @param bool $trackableStructurePosition
*/
public static function processAttributeAdditionFromTree($nodeId, $treeType, Report $report, $rowNumber, $trackableStructurePosition)
{
$nodeIdWithoutTreeType = ReportRelationsAndAttributesToTreeAdapter::removeTreeTypeFromNodeId($nodeId, $treeType);
$moduleClassName = $report->getModuleClassName();
$modelClassName = $moduleClassName::getPrimaryModelName();
$form = new WizardActiveForm();
$form->id = 'edit-form';
$form->enableAjaxValidation = true;
//ensures error validation populates correctly
$wizardFormClassName = ReportToWizardFormAdapter::getFormClassNameByType($report->getType());
$model = ComponentForReportFormFactory::makeByComponentType($moduleClassName, $modelClassName, $report->getType(), $treeType);
$form->modelClassNameForError = $wizardFormClassName;
$attribute = ReportRelationsAndAttributesToTreeAdapter::resolveAttributeByNodeId($nodeIdWithoutTreeType);
$model->attributeIndexOrDerivedType = ReportRelationsAndAttributesToTreeAdapter::resolveAttributeByNodeId($nodeIdWithoutTreeType);
$inputPrefixData = ReportRelationsAndAttributesToTreeAdapter::resolveInputPrefixData($wizardFormClassName, $treeType, (int) $rowNumber);
$adapter = new ReportAttributeToElementAdapter($inputPrefixData, $model, $form, $treeType);
$view = new AttributeRowForReportComponentView($adapter, (int) $rowNumber, $inputPrefixData, $attribute, (bool) $trackableStructurePosition, true, $treeType);
$content = $view->render();
$form->renderAddAttributeErrorSettingsScript($view::getFormId());
Yii::app()->getClientScript()->setToAjaxMode();
Yii::app()->getClientScript()->render($content);
echo $content;
}
示例10: 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');
}
示例11: processFiltersAndStructureForMeetingsThatEndAfterRange
protected function processFiltersAndStructureForMeetingsThatEndAfterRange(&$filters, &$structure, &$filtersCount, SavedCalendar $savedCalendar, Report $report)
{
if (count($filters) != 0) {
$structure .= ' OR ';
}
$moduleClassName = $savedCalendar->moduleClassName;
$startFilter = new FilterForReportForm($moduleClassName, $moduleClassName::getPrimaryModelName(), $report->getType());
$startFilter->attributeIndexOrDerivedType = $savedCalendar->startAttributeName;
$startFilter->value = $this->endDate;
$startFilter->valueType = MixedDateTypesSearchFormAttributeMappingRules::TYPE_BEFORE;
$filters[] = $startFilter;
$endFilter = new FilterForReportForm($moduleClassName, $moduleClassName::getPrimaryModelName(), $report->getType());
if ($savedCalendar->endAttributeName != null) {
$endFilter->attributeIndexOrDerivedType = $savedCalendar->endAttributeName;
} else {
$endFilter->attributeIndexOrDerivedType = $savedCalendar->startAttributeName;
}
$endFilter->value = $this->endDate;
$endFilter->valueType = MixedDateTypesSearchFormAttributeMappingRules::TYPE_AFTER;
$filters[] = $endFilter;
$structure .= '(' . ($filtersCount + 1) . ' AND ' . ($filtersCount + 2) . ')';
$filtersCount += 2;
}
示例12: saveCalendarWithSerializedData
/**
* Save calendar with serialized data.
* @param Report $report
* @param SavedCalendar $savedCalendar
* @param array $wizardFormPostData
* @throws FailedToSaveModelException
*/
public static function saveCalendarWithSerializedData(Report $report, SavedCalendar $savedCalendar, $wizardFormPostData)
{
$filtersData = ArrayUtil::getArrayValue($wizardFormPostData, ComponentForReportForm::TYPE_FILTERS);
if ($filtersData != null) {
$sanitizedFiltersData = DataToReportUtil::sanitizeFiltersData($report->getModuleClassName(), $report->getType(), $filtersData);
$unserializedData = array(ComponentForReportForm::TYPE_FILTERS => $sanitizedFiltersData, 'filtersStructure' => $report->getFiltersStructure());
$savedCalendar->serializedData = serialize($unserializedData);
}
if (!$savedCalendar->save()) {
throw new FailedToSaveModelException();
}
}
示例13: makeComponentFormAndPopulateReportFromData
/**
* @param array $componentFormsData
* @param Report $report
* @param null|string $componentPrefix
*/
protected static function makeComponentFormAndPopulateReportFromData($componentFormsData, Report $report, $componentPrefix)
{
$moduleClassName = $report->getModuleClassName();
$addMethodName = 'add' . $componentPrefix;
$componentClassName = $componentPrefix . 'ForReportForm';
$rowKey = 0;
foreach ($componentFormsData as $componentFormData) {
$component = new $componentClassName($moduleClassName, $moduleClassName::getPrimaryModelName(), $report->getType(), $rowKey);
$component->setAttributes($componentFormData);
$report->{$addMethodName}($component);
$rowKey++;
}
}
示例14: testIsRelationASingularRelation
/**
* @depends testIsRelation
*/
public function testIsRelationASingularRelation()
{
$model = new ReportModelTestItem();
$rules = new ReportsTestReportRules();
$report = new Report();
$report->setType(Report::TYPE_ROWS_AND_COLUMNS);
$report->setModuleClassName('ReportsTestModule');
$adapter = new ModelRelationsAndAttributesToRowsAndColumnsReportAdapter($model, $rules, $report->getType());
$this->assertTrue($adapter->isRelationASingularRelation('hasOne'));
$this->assertFalse($adapter->isRelationASingularRelation('hasMany'));
$model = new ReportModelTestItem5();
$rules = new ReportsTestReportRules();
$report = new Report();
$report->setType(Report::TYPE_ROWS_AND_COLUMNS);
$report->setModuleClassName('ReportsTestModule');
$adapter = new ModelRelationsAndAttributesToRowsAndColumnsReportAdapter($model, $rules, $report->getType());
$this->assertFalse($adapter->isRelationASingularRelation('ReportModelTestItem2__reportItems__Inferred'));
$this->assertFalse($adapter->isRelationASingularRelation('ReportModelTestItem__reportItems__Inferred'));
}
示例15: 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]);
}