本文整理汇总了PHP中Report::setName方法的典型用法代码示例。如果您正苦于以下问题:PHP Report::setName方法的具体用法?PHP Report::setName怎么用?PHP Report::setName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Report
的用法示例。
在下文中一共展示了Report::setName方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: resolveReportByWizardPostData
/**
* @param Report $report
* @param array $postData
* @param string $wizardFormClassName
*/
public static function resolveReportByWizardPostData(Report $report, $postData, $wizardFormClassName)
{
assert('is_array($postData)');
assert('is_string($wizardFormClassName)');
$data = ArrayUtil::getArrayValue($postData, $wizardFormClassName);
if (isset($data['description'])) {
$report->setDescription($data['description']);
}
if (isset($data['moduleClassName'])) {
$report->setModuleClassName($data['moduleClassName']);
}
if (isset($data['name'])) {
$report->setName($data['name']);
}
self::resolveFiltersStructure($data, $report);
if (null != ArrayUtil::getArrayValue($data, 'ownerId')) {
$owner = User::getById((int) $data['ownerId']);
$report->setOwner($owner);
} else {
$report->setOwner(new User());
}
if (isset($data['currencyConversionType'])) {
$report->setCurrencyConversionType((int) $data['currencyConversionType']);
}
if (isset($data['spotConversionCurrencyCode'])) {
$report->setSpotConversionCurrencyCode($data['spotConversionCurrencyCode']);
}
self::resolveFilters($data, $report);
self::resolveOrderBys($data, $report);
self::resolveDisplayAttributes($data, $report);
self::resolveDrillDownDisplayAttributes($data, $report);
self::resolveGroupBys($data, $report);
self::resolveChart($data, $report);
}
示例2: 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;
}
示例3: 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;
}
示例4: array
function add_custom_report()
{
if (logged_user()->isGuest()) {
flash_error(lang('no access permissions'));
ajx_current("empty");
return;
}
tpl_assign('url', get_url('reporting', 'add_custom_report'));
$report_data = array_var($_POST, 'report');
if (is_array($report_data)) {
tpl_assign('report_data', $report_data);
$conditions = array_var($_POST, 'conditions');
if (!is_array($conditions)) {
$conditions = array();
}
tpl_assign('conditions', $conditions);
$columns = array_var($_POST, 'columns');
if (is_array($columns) && count($columns) > 0) {
tpl_assign('columns', $columns);
$newReport = new Report();
if (!$newReport->canAdd(logged_user())) {
flash_error(lang('no access permissions'));
ajx_current("empty");
return;
}
// if
$newReport->setName($report_data['name']);
$newReport->setDescription($report_data['description']);
$newReport->setObjectType($report_data['object_type']);
$newReport->setOrderBy($report_data['order_by']);
$newReport->setIsOrderByAsc($report_data['order_by_asc'] == 'asc');
try {
DB::beginWork();
$newReport->save();
$allowed_columns = $this->get_allowed_columns($report_data['object_type'], true);
foreach ($conditions as $condition) {
if ($condition['deleted'] == "1") {
continue;
}
foreach ($allowed_columns as $ac) {
if ($condition['field_name'] == $ac['id']) {
$newCondition = new ReportCondition();
$newCondition->setReportId($newReport->getId());
$newCondition->setCustomPropertyId($condition['custom_property_id']);
$newCondition->setFieldName($condition['field_name']);
$newCondition->setCondition($condition['condition']);
$condValue = array_key_exists('value', $condition) ? $condition['value'] : '';
if ($condition['field_type'] == 'boolean') {
$newCondition->setValue(array_key_exists('value', $condition));
} else {
if ($condition['field_type'] == 'date') {
if ($condValue != '') {
$dtFromWidget = DateTimeValueLib::dateFromFormatAndString(user_config_option('date_format'), $condValue);
$newCondition->setValue(date("m/d/Y", $dtFromWidget->getTimestamp()));
}
} else {
$newCondition->setValue($condValue);
}
}
$newCondition->setIsParametrizable(isset($condition['is_parametrizable']));
$newCondition->save();
}
}
}
asort($columns);
//sort the array by column order
foreach ($columns as $column => $order) {
if ($order > 0) {
$newColumn = new ReportColumn();
$newColumn->setReportId($newReport->getId());
if (is_numeric($column)) {
$newColumn->setCustomPropertyId($column);
} else {
$newColumn->setFieldName($column);
}
$newColumn->save();
}
}
DB::commit();
flash_success(lang('custom report created'));
ajx_current('back');
} catch (Exception $e) {
DB::rollback();
flash_error($e->getMessage());
ajx_current("empty");
}
}
}
$selected_type = array_var($_GET, 'type', '');
$types = array(array("", lang("select one")), array("Companies", lang("companies")), array("Contacts", lang("contacts")), array("MailContents", lang("email type")), array("ProjectEvents", lang("events")), array("ProjectFiles", lang("file")), array("ProjectMilestones", lang("milestone")), array("ProjectMessages", lang("message")), array("ProjectTasks", lang("task")), array("Users", lang("user")), array("ProjectWebpages", lang("webpage")), array("Projects", lang("workspace")));
if ($selected_type != '') {
tpl_assign('allowed_columns', $this->get_allowed_columns($selected_type));
}
tpl_assign('object_types', $types);
tpl_assign('selected_type', $selected_type);
}
示例5: 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');
}
示例6: 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');
}
示例7: 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);
}
示例8: catch
} catch (Exception $e) {
$t->pass('A chartBuilder must be set in order to call defineCharts()');
}
$report->setChartBuilder('ChartBuilderPChart');
$t->isa_ok($report->defineChart($params), 'ChartBuilderPChart', 'defineChart() returns an instance of chart builder for the given parameters');
$t->diag('defineCharts()');
$t->isa_ok($report->defineCharts(), 'array', 'defineCharts() returns an array containing the definition of all the charts included in a report');
$t->diag('countCharges()');
$t->cmp_ok($report->countCharges(), '===', 15, 'countCharges() returns the number of charges considered to build the report');
$t->diag('hasCharges()');
$t->cmp_ok($report->hasCharges(), '===', true, 'hasCharges() returns "true" if the report has at least one related charge');
$t->diag('generatePdf() - data available');
$t->cmp_ok(file_exists($report->getPdfFileFullPath()), '===', false, 'Before calling generatePdf(), the pdf report doesn\'t exist');
$report->generatePdf($context, 'ChartBuilderPChart', $report->getPdfFileFullPath());
$t->cmp_ok(file_exists($report->getPdfFileFullPath()), '===', true, 'generatePdf() creates a pdf version of the report');
$vehicles_query = Doctrine_Core::getTable('Vehicle')->createQuery('v')->leftJoin('v.User u')->andWhere('u.username = ?', 'user_reports')->limit(1);
$report = new Report();
$report->setName('report_test_3');
$report->setUserId($ut->getUserId('user_reports'));
$report->setVehicles($vehicles_query->execute());
$t->diag('countCharges()');
$t->cmp_ok($report->countCharges(), '===', 0, 'countCharges() returns the number of charges considered to build the report');
$t->diag('hasCharges()');
$t->cmp_ok($report->hasCharges(), '===', false, 'hasCharges() returns "false" if no charges can be loaded for the report');
$t->diag('generatePdf() - no data available');
$status = $report->generatePdf($context, 'ChartBuilderPChart', $report->getPdfFileFullPath());
$t->cmp_ok($status, '===', false, 'If no charges are available, the pdf report is not generated');
sfToolkit::clearDirectory($pdf_dir);
rmdir($pdf_dir);
sfToolkit::clearDirectory($chart_dir);
rmdir($chart_dir);
示例9: 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;
}
示例10: saveReport
/**
* Saves a report
* @param <type> $reportName
* @param <type> $reportGroupId
* @param <type> $useFilterField
* @param <type> $type
* @return Report
*/
public function saveReport($reportName, $reportGroupId, $useFilterField, $type)
{
try {
$report = new Report();
$report->setName($reportName);
$report->setReportGroupId($reportGroupId);
$report->setUseFilterField($useFilterField);
$report->setType($type);
$report->save();
return $report;
} catch (Exception $ex) {
throw new DaoException($ex->getMessage());
}
}