本文整理汇总了PHP中Report::getErrors方法的典型用法代码示例。如果您正苦于以下问题:PHP Report::getErrors方法的具体用法?PHP Report::getErrors怎么用?PHP Report::getErrors使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Report
的用法示例。
在下文中一共展示了Report::getErrors方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGetErrorsReturnsPreviousAddedProcessingError
/**
* testGetErrorsReturnsPreviousAddedProcessingError
*
* @return void
* @since 1.2.1
*/
public function testGetErrorsReturnsPreviousAddedProcessingError()
{
$report = new Report();
$report->addError(new ProcessingError('Failing file "/foo.php".'));
$this->assertSame(1, iterator_count($report->getErrors()));
}
示例2: report
public function report($params = array())
{
extract($params);
if (isset($user_id) && isset($to_report) && $to_report) {
$report_arr = array('user_id' => $user_id, 'to_report' => $to_report);
if (isset($content) && $content) {
$report_arr['content'] = $content;
}
if (isset($type) && $type) {
$report_arr['type'] = $type;
}
if (isset($style) && $style) {
$report_arr['style'] = $style;
}
$model = new Report();
$model->attributes = $report_arr;
if ($model->validate() && $model->save()) {
$id = $model->getPrimaryKey();
$ret = $this->notice('OK', 0, '成功', ['id' => $id]);
} else {
$ret = $this->notice('ERR', 307, '数据插入失败', $model->getErrors());
}
} else {
$ret = $this->notice('OK', 301, '缺少参数', []);
}
return $ret;
}
示例3: importFile
/**
* Import a report
*
*/
public static function importFile($filename, $showMessage = true, $removeExistingReport = false)
{
$localErrors = array();
$allAccounts = array();
$dom = new domDocument();
if (!$dom->load($filename)) {
if ($showMessage) {
throw new CException(Yii::t('lazy8', 'input file could not be xml parsed'));
} else {
throw new CException('input file could not be xml parsed');
}
}
$root = $dom->documentElement;
if ($root->nodeName != "lazy8webportreport") {
if ($showMessage) {
$localErrors = array(array(Yii::t('lazy8', 'Upload failed. This is not a valid file.'), Yii::t('lazy8', 'Select a file and try again')));
}
return $localErrors;
}
if ($root->getAttribute('version') > 1.0) {
if ($showMessage) {
$localErrors = array(array(Yii::t('lazy8', 'There maybe problems because this is a file version greater then this programs version'), Yii::t('lazy8', 'Select a file and try again')));
}
}
$nodeReports = $root->getElementsByTagName('report');
unset($root);
unset($dom);
foreach ($nodeReports as $nodeReport) {
if ($removeExistingReport) {
$deleteReports = Report::model()->findAll(array('condition' => 'name=\'' . $nodeReport->getAttribute('name') . '\''));
if ($deleteReports != null) {
foreach ($deleteReports as $deleteReport) {
$deleteReport->delete();
}
}
}
$report = new Report();
$report->name = $nodeReport->getAttribute('name');
$report->desc = ReportController::getNodeText($nodeReport, "desc");
$report->selectSql = ReportController::getNodeText($nodeReport, "selectsql");
$report->sortOrder = ReportController::getNodeText($nodeReport, "sortOrder");
$report->cssColorFileName = ReportController::getNodeText($nodeReport, "csscolorfilename");
$report->cssBwFileName = ReportController::getNodeText($nodeReport, "cssbwfilename");
$nodeParams = $nodeReport->getElementsByTagName('parameter');
if (!$report->save()) {
if ($showMessage) {
$localErrors = $report->getErrors();
}
return $localErrors;
}
foreach ($nodeParams as $nodeParam) {
$reportParam = new ReportParameters();
$reportParam->reportId = $report->id;
$reportParam->sortOrder = $nodeParam->getAttribute('sortorder');
$reportParam->name = $nodeParam->getAttribute('name');
$reportParam->alias = $nodeParam->getAttribute('alias');
$reportParam->dataType = $nodeParam->getAttribute('datatype');
$reportParam->isDefaultPhp = $nodeParam->getAttribute('isdefaultphp') == 'true' ? 1 : 0;
$reportParam->isDate = $nodeParam->getAttribute('isdate') == 'true' ? 1 : 0;
$reportParam->isDecimal = $nodeParam->getAttribute('isdecimal') == 'true' ? 1 : 0;
$reportParam->desc = ReportController::getNodeText($nodeParam, "desc");
$reportParam->phpSecondaryInfo = ReportController::getNodeText($nodeParam, "phpsecondaryinfo");
$reportParam->defaultValue = ReportController::getNodeText($nodeParam, "defaultvalue");
if (!$reportParam->save()) {
if ($showMessage) {
$localErrors = $reportParam->getErrors();
}
}
}
unset($nodeParams);
$nodeGroups = $nodeReport->getElementsByTagName('group');
foreach ($nodeGroups as $nodeGroup) {
$reportGroup = new ReportGroups();
$reportGroup->reportId = $report->id;
$reportGroup->sortOrder = $nodeGroup->getAttribute('sortorder');
$reportGroup->breakingField = $nodeGroup->getAttribute('breakingfield');
$reportGroup->pageBreak = $nodeGroup->getAttribute('pagebreak') == 'true' ? 1 : 0;
$reportGroup->showGrid = $nodeGroup->getAttribute('showgrid') == 'true' ? 1 : 0;
$reportGroup->showHeader = $nodeGroup->getAttribute('showheader') == 'true' ? 1 : 0;
$reportGroup->continueSumsOverGroup = $nodeGroup->getAttribute('continuesumsovergroup') == 'true' ? 1 : 0;
if (!$reportGroup->save()) {
if ($showMessage) {
$localErrors = $reportGroup->getErrors();
}
}
$nodeGroupFields = $nodeGroup->getElementsByTagName('field');
foreach ($nodeGroupFields as $nodeGroupField) {
$reportGroupField = new ReportGroupFields();
$reportGroupField->reportGroupId = $reportGroup->id;
$reportGroupField->sortOrder = $nodeGroupField->getAttribute('sortorder');
$reportGroupField->fieldName = $nodeGroupField->getAttribute('fieldname');
$reportGroupField->fieldWidth = $nodeGroupField->getAttribute('fieldwidth');
$reportGroupField->row = $nodeGroupField->getAttribute('row');
$reportGroupField->isDate = $nodeGroupField->getAttribute('isdate') == 'true' ? 1 : 0;
$reportGroupField->isDecimal = $nodeGroupField->getAttribute('isdecimal') == 'true' ? 1 : 0;
$reportGroupField->fieldCalc = ReportController::getNodeText($nodeGroupField, "fieldcalc");
//.........这里部分代码省略.........
示例4: actionReports
public function actionReports()
{
$report = new Report();
if ($postReport = Yii::app()->request->getParam('Report')) {
$report->setAttributes($postReport);
$emails = array();
if (count($emails = explode(PHP_EOL, $postReport['email'])) <= 1) {
$emails = array($postReport['email']);
}
foreach ($emails as $e) {
if (strlen($e) <= 0) {
continue;
}
$newReport = new Report();
$newReport->email = $e;
$newReport->period = $postReport['period'];
if (!$newReport->save()) {
throw new Exception(print_r($newReport->getErrors(), true));
}
}
$this->refresh();
}
$this->render('reports', array('report' => $report));
}