mirror of
https://github.com/OpenXE-org/OpenXE.git
synced 2024-11-15 04:27:14 +01:00
Berichte create report from preview
This commit is contained in:
parent
567976ecda
commit
169a5c34c5
@ -53,9 +53,19 @@
|
|||||||
<div class="row" id="report_list_main">
|
<div class="row" id="report_list_main">
|
||||||
<div class="row-height">
|
<div class="row-height">
|
||||||
<div class="col-xs-12 col-sm-10 col-sm-height">
|
<div class="col-xs-12 col-sm-10 col-sm-height">
|
||||||
<legend>
|
<legend style="float:left">
|
||||||
Tabelle [TABLENAME]
|
Tabelle [TABLENAME]
|
||||||
</legend>
|
</legend>
|
||||||
|
<form method="post" action="#tabs-3">
|
||||||
|
<fieldset style="float: right;">
|
||||||
|
<input type="text" name="table" value="[TABLENAME]" hidden></input>
|
||||||
|
<table width="100%" border="0" class="mkTableFormular">
|
||||||
|
<tr>
|
||||||
|
<td><button name="submit" value="erzeugen" class="ui-button-icon" style="width:100%;float:right;">Bericht erzeugen</button></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</fieldset>
|
||||||
|
</form>
|
||||||
<div>
|
<div>
|
||||||
[TAB3]
|
[TAB3]
|
||||||
</div>
|
</div>
|
||||||
|
@ -542,6 +542,7 @@ class Report
|
|||||||
}
|
}
|
||||||
|
|
||||||
$heading = $columns;
|
$heading = $columns;
|
||||||
|
$heading[] = '';
|
||||||
$findcols = $columns;
|
$findcols = $columns;
|
||||||
$searchsql = $columns;
|
$searchsql = $columns;
|
||||||
|
|
||||||
@ -3232,6 +3233,7 @@ class Report
|
|||||||
if (!empty($selectedtable)) {
|
if (!empty($selectedtable)) {
|
||||||
|
|
||||||
$this->app->User->SetParameter('report_databaseview_selectedtable',$selectedtable);
|
$this->app->User->SetParameter('report_databaseview_selectedtable',$selectedtable);
|
||||||
|
$submit = $this->app->Secure->GetPost('submit');
|
||||||
$selectedcolumns = $this->app->Secure->GetPost('auswahl');
|
$selectedcolumns = $this->app->Secure->GetPost('auswahl');
|
||||||
|
|
||||||
$sql = "SHOW COLUMNS FROM `".$selectedtable."`";
|
$sql = "SHOW COLUMNS FROM `".$selectedtable."`";
|
||||||
@ -3245,7 +3247,6 @@ class Report
|
|||||||
$checked = 'checked';
|
$checked = 'checked';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$row = array();
|
$row = array();
|
||||||
$row[] = '<input type="checkbox" name="auswahl[]" '.$checked.' value="'.$column['Field'].'">';
|
$row[] = '<input type="checkbox" name="auswahl[]" '.$checked.' value="'.$column['Field'].'">';
|
||||||
$row = array_merge($row,$column);
|
$row = array_merge($row,$column);
|
||||||
@ -3254,12 +3255,42 @@ class Report
|
|||||||
$column_easytable->DisplayNew('TAB2');
|
$column_easytable->DisplayNew('TAB2');
|
||||||
$this->app->Tpl->Set('TABLENAME',ucfirst($selectedtable));
|
$this->app->Tpl->Set('TABLENAME',ucfirst($selectedtable));
|
||||||
|
|
||||||
|
switch($submit) {
|
||||||
|
case 'vorschau':
|
||||||
if (!empty($selectedcolumns)) {
|
if (!empty($selectedcolumns)) {
|
||||||
$this->app->User->SetParameter('report_databaseview_selectedcolumns',implode(',',$selectedcolumns));
|
$this->app->User->SetParameter('report_databaseview_selectedcolumns',implode(',',$selectedcolumns));
|
||||||
|
} else {
|
||||||
|
$this->app->YUI->Message('warning','Spalten wählen');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->app->YUI->TableSearch('TAB3', 'databaseview', 'show', '', '', basename(__FILE__), __CLASS__);
|
$this->app->YUI->TableSearch('TAB3', 'databaseview', 'show', '', '', basename(__FILE__), __CLASS__);
|
||||||
|
break;
|
||||||
|
case 'erzeugen':
|
||||||
|
$selectedcolumns = $this->app->User->GetParameter('report_databaseview_selectedcolumns');
|
||||||
|
$columns = explode(',',$selectedcolumns);
|
||||||
|
$sql = "SELECT `".implode("`,`",$columns)."` from `".$selectedtable."`";
|
||||||
|
$name = $this->service->generateIncrementedReportName(ucfirst($selectedtable));
|
||||||
|
$userId = $this->app->User->GetID();
|
||||||
|
$report = ReportData::fromFormData(['name' => $name, 'sql_query' => $sql, 'description' => 'Erzeugt aus Datenbankansicht Tabelle '.ucfirst($selectedtable)]);
|
||||||
|
$newId = $this->service->saveReport($report);
|
||||||
|
if ($newId > 0) {
|
||||||
|
$this->service->saveReportUserArray([
|
||||||
|
'report_id' => $newId,
|
||||||
|
'user_id' => $userId,
|
||||||
|
'name' => $this->app->User->GetName(),
|
||||||
|
'chart_enabled' => 0,
|
||||||
|
'file_enabled' => 0,
|
||||||
|
'menu_enabled' => 0,
|
||||||
|
'tab_enabled' => 0,
|
||||||
|
]);
|
||||||
|
$report = $this->gateway->getReportById($newId);
|
||||||
|
$newReport = $this->service->autoCreateColumns($report);
|
||||||
|
$newId = $this->service->saveReport($newReport);
|
||||||
|
header('Location: index.php?module=report&action=edit&id='.$newId);
|
||||||
|
} else {
|
||||||
|
$this->app->YUI->Message('error','Bericht konnte nicht erzeugt werden');
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$this->app->YUI->Message('warning','Tabelle wählen');
|
$this->app->YUI->Message('warning','Tabelle wählen');
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user