当前位置: 首页>>代码示例>>PHP>>正文


PHP Report::setDescription方法代码示例

本文整理汇总了PHP中Report::setDescription方法的典型用法代码示例。如果您正苦于以下问题:PHP Report::setDescription方法的具体用法?PHP Report::setDescription怎么用?PHP Report::setDescription使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Report的用法示例。


在下文中一共展示了Report::setDescription方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:39,代码来源:DataToReportUtil.php

示例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;
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:30,代码来源:SavedCalendarToReportAdapter.php

示例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;
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:44,代码来源:SavedReportToReportAdapter.php

示例4: addReport

 private function addReport($options, $connection)
 {
     $report = new Report();
     $report->setDescription(self::generateDescription());
     $report->setTitle(implode(', ', array_keys($options['queries'])));
     $report->save();
     foreach ($options['queries'] as $key => $value) {
         $query = new Query();
         $query->setQuery($key);
         $query->save();
         $report_query = new ReportQuery();
         $report_query->setQuery($query);
         $report_query->setTitle($key);
         $report_query->setReport($report);
         $report_query->save();
         $date_start = strtotime($options['start_date']);
         $date_end = strtotime($options['end_date']);
         $start = $value['rand_start'];
         while ($date_start < $date_end) {
             if (rand(0, 100) > $value['rand']) {
                 $query_result = new QueryResultBulk();
                 $query_result->setQuery($query);
                 $start += rand($value['rand_min'], $value['rand_max']) * $value['rand_diff'];
                 $query_result->setResultSize($start);
                 $query_result->setCreatedAt($date_start);
                 $query_result->save();
             }
             $date_start = strtotime(date('Y-m-d', $date_start) . ' +1 days');
         }
         $sql = "DELETE FROM %s where date(%s) = '%s' and %s = %s";
         $sql = sprintf($sql, QueryResultPeer::TABLE_NAME, QueryResultPeer::RESULT_DATE, date('Y-m-d'), QueryResultPeer::QUERY_ID, $query->getId());
         $statement = $connection->prepareStatement($sql);
         $statement->executeQuery();
     }
     $tags = self::generateTags();
     foreach ($tags as $tag) {
         $tag->setReport($report);
         $tag->save();
     }
 }
开发者ID:hoydaa,项目名称:googlevolume.com,代码行数:40,代码来源:TestDataTask.class.php

示例5: 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);
 }
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:96,代码来源:ReportingController.class.php

示例6: makeClosedWonOpportunitiesByMonth

 public static function makeClosedWonOpportunitiesByMonth()
 {
     $report = new Report();
     $report->setDescription('A report showing closed won opportunities by month');
     $report->setModuleClassName('OpportunitiesModule');
     $report->setName('Closed won opportunities by month');
     $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 = 'closeDate__Month';
     $groupBy->axis = 'x';
     $report->addGroupBy($groupBy);
     $displayAttribute = new DisplayAttributeForReportForm('OpportunitiesModule', 'Opportunity', $report->getType());
     $displayAttribute->attributeIndexOrDerivedType = 'closeDate__Month';
     $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 = 'Bar2D';
     $chart->firstSeries = 'closeDate__Month';
     $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');
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:45,代码来源:ReportsDemoDataMaker.php

示例7: testDelete

 public function testDelete()
 {
     $rep = new Report();
     $now = date("Y-m-d H:i:s");
     $rep->setDescription("tester");
     $rep->setInvolvementKindID(2);
     $rep->setReportKindID(1);
     $rep->setLocationID(1);
     $rep->setPersonID(1);
     $rep->setDepartmentID(2);
     $rep->setDateTime($now);
     $rep->setStatusID(2);
     $rep->setActionTaken("nothing");
     $rep->save();
     $this->assertTrue(Report::reportExists($rep->getPersonID(), $rep->getDateTime()) != false);
     $rep->delete();
     $this->assertTrue(!Report::reportExists($rep->getPersonID(), $rep->getDateTime()));
 }
开发者ID:JakeDawkins,项目名称:NiceCatch,代码行数:18,代码来源:reportTest.php

示例8: 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();
             $member_ids = json_decode(array_var($_POST, 'members'));
             if (!is_array($member_ids) || count($member_ids) == 0) {
                 flash_error(lang('must choose at least one member'));
                 ajx_current("empty");
                 return;
             }
             $members = Members::findAll(array("conditions" => array("`id` IN(?)", $member_ids)));
             if (!$newReport->canAdd(logged_user(), $members)) {
                 flash_error(lang('no access permissions'));
                 ajx_current("empty");
                 return;
             }
             // if
             $newReport->setObjectName($report_data['name']);
             $newReport->setDescription($report_data['description']);
             $newReport->setReportObjectTypeId($report_data['report_object_type_id']);
             $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['report_object_type_id'], 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();
                     }
                 }
                 $object_controller = new ObjectController();
                 $object_controller->add_to_members($newReport, $member_ids);
                 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")));
     $object_types = ObjectTypes::getAvailableObjectTypes();
//.........这里部分代码省略.........
开发者ID:rorteg,项目名称:fengoffice,代码行数:101,代码来源:ReportingController.class.php

示例9: 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);
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:79,代码来源:SavedReportToReportAdapterTest.php

示例10: 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;
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:21,代码来源:SavedReportTestHelper.php

示例11: reportPost

 private function reportPost()
 {
     $report = new Report();
     //update if an id exists
     if (isset($this->request['id'])) {
         $report->setID($this->request['id']);
     }
     $report->setDescription($this->request['description']);
     //given name. get id
     $report->setInvolvementKindID(getInvolvementKindID($this->request['involvementKind']));
     //given name. get id
     $report->setReportKindID(getReportKindID($this->request['reportKind']));
     //set up location
     if (!$this->requestFieldsSubmitted(["buildingName"])) {
         $this->response['message'] = "error: missing location information";
         $this->response['code'] = 400;
     }
     $locID = $this->setUpLocation();
     if ($locID != -1) {
         $report->setLocationID($locID);
     } else {
         $this->response['message'] = "error: invalid location information";
         $this->response['code'] = 400;
     }
     //set up person
     if (!$this->requestFieldsSubmitted(["personKind", "username", "name", "phone"])) {
         $this->response['message'] = "error: missing person information";
         $this->response['code'] = 400;
     }
     $personID = $this->setUpPerson();
     if ($personID != -1) {
         $report->setPersonID($personID);
     } else {
         $this->response['message'] = "error: invalid person data";
         $this->response['code'] = 400;
     }
     //given dept name. get id
     $report->setDepartmentID(getDepartmentID($this->request['department']));
     $report->setDateTime($this->request['dateTime']);
     $report->setStatusID($this->request['statusID']);
     $report->setActionTaken($this->request['actionTaken']);
     $report->save();
     //return the report item in array format
     return $report->toArray();
 }
开发者ID:JakeDawkins,项目名称:NiceCatch,代码行数:45,代码来源:class.NiceCatchAPI.php

示例12: foreach

 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)) {
         foreach ($report_data as $k => &$v) {
             $v = remove_scripts($v);
         }
         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();
             $member_ids = json_decode(array_var($_POST, 'members'));
             $notAllowedMember = '';
             if (!logged_user()->isManager() && !logged_user()->isAdminGroup() && !$newReport->canAdd(logged_user(), active_context(), $notAllowedMember)) {
                 if (str_starts_with($notAllowedMember, '-- req dim --')) {
                     flash_error(lang('must choose at least one member of', str_replace_first('-- req dim --', '', $notAllowedMember, $in)));
                 } else {
                     trim($notAllowedMember) == "" ? flash_error(lang('you must select where to keep', lang('the report'))) : flash_error(lang('no context permissions to add', lang("report"), $notAllowedMember));
                 }
                 ajx_current("empty");
                 return;
             }
             $newReport->setObjectName($report_data['name']);
             $newReport->setDescription($report_data['description']);
             $newReport->setReportObjectTypeId($report_data['report_object_type_id']);
             $newReport->setOrderBy($report_data['order_by']);
             $newReport->setIsOrderByAsc($report_data['order_by_asc'] == 'asc');
             $newReport->setIgnoreContext(array_var($report_data, 'ignore_context') == 'checked');
             try {
                 DB::beginWork();
                 $newReport->save();
                 $allowed_columns = $this->get_allowed_columns($report_data['report_object_type_id'], 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) ? '1' : '0');
                             } 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();
                     }
                 }
                 $no_need_to_add_to_members = count($member_ids) == 0 && (logged_user()->isManager() || logged_user()->isAdminGroup());
                 if (!$no_need_to_add_to_members) {
                     $object_controller = new ObjectController();
                     $object_controller->add_to_members($newReport, $member_ids);
                 } else {
                     $newReport->addToSharingTable();
                 }
                 DB::commit();
                 flash_success(lang('custom report created'));
                 ajx_current('back');
             } catch (Exception $e) {
                 DB::rollback();
                 flash_error($e->getMessage());
//.........这里部分代码省略.........
开发者ID:abhinay100,项目名称:feng_app,代码行数:101,代码来源:ReportingController.class.php


注:本文中的Report::setDescription方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。