Initial xentral_oss_20.3.c9ffacf
This commit is contained in:
@@ -0,0 +1,866 @@
|
||||
<?php
|
||||
/*
|
||||
**** COPYRIGHT & LICENSE NOTICE *** DO NOT REMOVE ****
|
||||
*
|
||||
* Xentral (c) Xentral ERP Sorftware GmbH, Fuggerstrasse 11, D-86150 Augsburg, * Germany 2019
|
||||
*
|
||||
* This file is licensed under the Embedded Projects General Public License *Version 3.1.
|
||||
*
|
||||
* You should have received a copy of this license from your vendor and/or *along with this file; If not, please visit www.wawision.de/Lizenzhinweis
|
||||
* to obtain the text of the corresponding license version.
|
||||
*
|
||||
**** END OF COPYRIGHT & LICENSE NOTICE *** DO NOT REMOVE ****
|
||||
*/
|
||||
?>
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @deprecated Neue Chart-Klasse stattdessen verwenden
|
||||
* @see \Xentral\Widgets\Chart\Chart
|
||||
*/
|
||||
class Chart {
|
||||
public static $instancescount = 0;
|
||||
var $app;
|
||||
|
||||
var $rows;
|
||||
var $dataset;
|
||||
var $align;
|
||||
var $headings;
|
||||
var $lheadings;
|
||||
var $type;
|
||||
var $animate;
|
||||
var $colors;
|
||||
var $labels;
|
||||
var $background;
|
||||
var $colorcol;
|
||||
|
||||
function __construct(&$app, $type = 'line', $targetjquery = 'JQUERYREADY')
|
||||
{
|
||||
$this->app = &$app;
|
||||
$this->background = false;
|
||||
$this->labels = false;
|
||||
$this->animate = true;
|
||||
$this->type = $type;
|
||||
$this->sql ="";
|
||||
$this->limit ="";
|
||||
$this->stacked = false;
|
||||
$this->duration = 1000;
|
||||
$this->datasets = null;
|
||||
$this->headings = null;
|
||||
$this->lheadings = null;
|
||||
$this->yAxes = null;
|
||||
$this->colorcol = false;
|
||||
|
||||
|
||||
$this->colors = array(
|
||||
'45b9d3','a2c55a','0e8394','f69e06','f2c289','8dd4de','cbe0a4','c5e3e9',
|
||||
'0b8092', 'a9ca45', 'FF6600','f69e06', 'be3978', 'cb5a20', '41b3ce', '85cddb',
|
||||
'000000', '993300', '333300', '000080', '333399', '333333', '800000',
|
||||
'808000', '008000', '008080', '0000FF', '666699', '808080', 'FF0000', 'FF9900',
|
||||
'99CC00', '339966', '33CCCC', '3366FF', '800080', '999999', 'FF00FF', 'FFCC00',
|
||||
'FFFF00', '00FF00', '00FFFF', '00CCFF', '993366', 'C0C0C0', 'FF99CC', 'FFCC99',
|
||||
'FFFF99', 'CCFFFF', '99CCFF', '808cc8', 'FFFFFF');
|
||||
foreach($this->colors as $k => $v)$this->colors[$k] = '#'.$v;
|
||||
self::$instancescount++;
|
||||
if(false && self::$instancescount == 1)
|
||||
{
|
||||
$this->app->Tpl->Add($targetjquery,'
|
||||
|
||||
Chart.pluginService.register({
|
||||
beforeRender: function (chart) {
|
||||
if (chart.config.options.showAllTooltips) {
|
||||
chart.pluginTooltips = [];
|
||||
chart.config.data.datasets.forEach(function (dataset, i) {
|
||||
chart.getDatasetMeta(i).data.forEach(function (sector, j) {
|
||||
chart.pluginTooltips.push(new Chart.Tooltip({
|
||||
_chart: chart.chart,
|
||||
_chartInstance: chart,
|
||||
_data: chart.data,
|
||||
_options: chart.options.tooltips,
|
||||
_active: [sector]
|
||||
}, chart));
|
||||
});
|
||||
});
|
||||
|
||||
chart.options.tooltips.enabled = false;
|
||||
}
|
||||
},
|
||||
afterDraw: function (chart, easing) {
|
||||
if (chart.config.options.showAllTooltips) {
|
||||
if (!chart.allTooltipsOnce) {
|
||||
if (easing !== 1)
|
||||
return;
|
||||
chart.allTooltipsOnce = true;
|
||||
}
|
||||
|
||||
chart.options.tooltips.enabled = true;
|
||||
Chart.helpers.each(chart.pluginTooltips, function (tooltip) {
|
||||
tooltip.initialize();
|
||||
tooltip.update();
|
||||
tooltip.pivot();
|
||||
tooltip.transition(easing).draw();
|
||||
});
|
||||
chart.options.tooltips.enabled = false;
|
||||
}
|
||||
}
|
||||
});
|
||||
');
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function AddRow($rows)
|
||||
{
|
||||
$this->datasets[] = $rows;
|
||||
}
|
||||
|
||||
function Query($sql,$labels=false,$fuelleluecken = false,$limit="")
|
||||
{
|
||||
$this->labels = $labels;
|
||||
$this->sql = $sql;
|
||||
$this->limit= $limit;
|
||||
$this->headings=null;
|
||||
$xcol = 0;
|
||||
if($limit!=0){
|
||||
$page = $this->app->Secure->GetGET("page");
|
||||
if(!is_numeric($page)) $page = 1;
|
||||
|
||||
$this->page = $page;
|
||||
$this->start= ($page-1) * $this->limit;
|
||||
|
||||
if(!is_array($sql))$sql.= " LIMIT {$this->start},{$this->limit}";
|
||||
}
|
||||
$this->searchrow="";
|
||||
if(is_array($sql))
|
||||
{
|
||||
$daten = $sql;
|
||||
}else{
|
||||
$daten = $this->app->DB->SelectArr($sql);
|
||||
}
|
||||
if(count($daten)>0){
|
||||
foreach($daten[0] as $colkey=>$value)
|
||||
{
|
||||
$this->headings[]=ucfirst($colkey);
|
||||
$this->lheadings[] = $colkey;
|
||||
$empty[$colkey] = 0;
|
||||
}
|
||||
}
|
||||
$first = $daten[0][$this->lheadings[$xcol]];
|
||||
$mysqlformat = true;
|
||||
if(strpos($first,'.') !== false)$mysqlformat = false;
|
||||
$last = $daten[count($fuelleluecken) - 1][$this->lheadings[$xcol]];
|
||||
if($fuelleluecken && is_array($fuelleluecken) && isset($fuelleluecken['typ']))
|
||||
{
|
||||
$von = false;
|
||||
$bis = false;
|
||||
$zeitraum = false;
|
||||
if(isset($fuelleluecken['von']))
|
||||
{
|
||||
$von = $fuelleluecken['von'];
|
||||
}
|
||||
if(isset($fuelleluecken['bis']))
|
||||
{
|
||||
$bis = $fuelleluecken['bis'];
|
||||
}
|
||||
if(isset($fuelleluecken['zeitraum']))
|
||||
{
|
||||
$zeitraum = $fuelleluecken['zeitraum'];
|
||||
}
|
||||
if($von || $bis || $zeitraum)
|
||||
{
|
||||
switch($fuelleluecken['typ'])
|
||||
{
|
||||
case 'tag':
|
||||
case 'tage':
|
||||
if(!$von && !$bis)
|
||||
{
|
||||
$bis = date('Y-m-d');
|
||||
$date=new DateTime(date('Y-m-d'));
|
||||
$date->sub(new DateInterval('P'.$zeitraum.'D'));
|
||||
$von = $date->format('Y-m-d');
|
||||
|
||||
}elseif(!$von)
|
||||
{
|
||||
if(strpos($bis, '.') !== false)$bis = $this->app->String->Convert($bis, "%1.%2.%3","%3-%2-%1");
|
||||
$date=new DateTime($bis);
|
||||
$date->sub(new DateInterval('P'.$zeitraum.'D'));
|
||||
$von = $date->format('Y-m-d');
|
||||
}elseif(!$bis)
|
||||
{
|
||||
if(strpos($von, '.') !== false)$von = $this->app->String->Convert($von, "%1.%2.%3","%3-%2-%1");
|
||||
$date=new DateTime($von);
|
||||
$date->add(new DateInterval('P'.$zeitraum.'D'));
|
||||
$bis = $date->format('Y-m-d');
|
||||
}
|
||||
if($von && $bis)
|
||||
{
|
||||
$datetime1 = new DateTime($bis);
|
||||
$datetime2 = new DateTime($von);
|
||||
$interval = $datetime1->diff($datetime2);
|
||||
$zeitraum = $interval->format('%a');
|
||||
foreach($daten as $key => $data)
|
||||
{
|
||||
$aktdat = $data[$this->lheadings[$xcol]];
|
||||
if(strpos($aktdat,'.') !== false)$aktdat = $this->app->String->Convert($aktdat ,"%1.%2.%3","%3-%2-%1");
|
||||
$datumzuid[$aktdat] = $key;
|
||||
}
|
||||
$aktdat = $datetime2;
|
||||
for($i = 0; $i <= $zeitraum; $i++)
|
||||
{
|
||||
if($i > 0)$aktdat->add(new DateInterval('P1D'));
|
||||
$aktdatstr = $aktdat->format('Y-m-d');
|
||||
if(isset($datumzuid[$aktdatstr]))
|
||||
{
|
||||
$this->datasets[] = $daten[$datumzuid[$aktdatstr]];
|
||||
}else{
|
||||
if($mysqlformat)
|
||||
{
|
||||
$empty[$this->lheadings[$xcol]] = $aktdatstr;
|
||||
}else{
|
||||
$empty[$this->lheadings[$xcol]] = $this->app->String->Convert($aktdatstr,"%3-%2-%1","%1.%2.%3");
|
||||
}
|
||||
$this->datasets[] = $empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'monat':
|
||||
case 'monate':
|
||||
if(!$von && !$bis)
|
||||
{
|
||||
$bis = date('m/Y');
|
||||
$date=new DateTime(date("Y-m-d"));
|
||||
$date->sub(new DateInterval('P'.($zeitraum-1).'M'));
|
||||
$von = $date->format('m/Y');
|
||||
|
||||
}elseif(!$von)
|
||||
{
|
||||
if(strpos($bis, '.') !== false)$bis = $this->app->String->Convert($bis, "%1.%2.%3","%2\/%3");
|
||||
$date=new DateTime($bis);
|
||||
$date->sub(new DateInterval('P'.($zeitraum-1).'M'));
|
||||
$von = $date->format('m/Y');
|
||||
}elseif(!$bis)
|
||||
{
|
||||
if(strpos($von, '.') !== false)$von = $this->app->String->Convert($von, "%1.%2.%3","%2\/%3");
|
||||
$date=new DateTime($von);
|
||||
$date->add(new DateInterval('P'.($zeitraum-1).'M'));
|
||||
$bis = $date->format('m/Y');
|
||||
}
|
||||
if($von && $bis)
|
||||
{
|
||||
|
||||
$von = $this->app->String->Convert($von,"%2\/%3","%3-%2-01");
|
||||
$bis = $this->app->String->Convert($bis,"%2\/%3","%3-%2-01");
|
||||
$datetime1 = new DateTime($bis);
|
||||
$datetime2 = new DateTime($von);
|
||||
$interval = $datetime1->diff($datetime2);
|
||||
|
||||
$zeitraum = ($interval->format('%d') > 27?1:0)+$interval->format('%m')+12*$interval->format('%y');
|
||||
|
||||
$_zeitbis = new DateTime($bis);
|
||||
$_zeitbis->add(new DateInterval('P'.$zeitraum.'M'));
|
||||
if($datetime1->format('m/Y') != $_zeitbis->format('m/Y'))$zeitraum++;
|
||||
|
||||
foreach($daten as $key => $data)
|
||||
{
|
||||
$aktdat = $data[$this->lheadings[$xcol]];
|
||||
if(strpos($aktdat,'.') !== false)$aktdat = $this->app->String->Convert($aktdat ,"%1.%2.%3","%2\/%3");
|
||||
$datumzuid[$aktdat] = $key;
|
||||
}
|
||||
$aktdat = $datetime2;
|
||||
for($i = 0; $i < $zeitraum; $i++)
|
||||
{
|
||||
if($i > 0)$aktdat->add(new DateInterval('P1M'));
|
||||
$aktdatstr = $aktdat->format('m/Y');
|
||||
if(isset($datumzuid[$aktdatstr]))
|
||||
{
|
||||
$this->datasets[] = $daten[$datumzuid[$aktdatstr]];
|
||||
}else{
|
||||
if($mysqlformat)
|
||||
{
|
||||
$empty[$this->lheadings[$xcol]] = $aktdatstr;
|
||||
}else{
|
||||
$empty[$this->lheadings[$xcol]] = $this->app->String->Convert($aktdatstr,"%1.%2.%3","%2\/%3");
|
||||
}
|
||||
$this->datasets[] = $empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}else{
|
||||
$this->datasets = $daten;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->datasets = $daten;
|
||||
}
|
||||
}
|
||||
|
||||
function kommulieren()
|
||||
{
|
||||
if($this->datasets)
|
||||
{
|
||||
|
||||
foreach($this->datasets as $k => $row)
|
||||
{
|
||||
$first = true;
|
||||
foreach($row as $key => $v)
|
||||
{
|
||||
if($first)
|
||||
{
|
||||
$first = false;
|
||||
}else{
|
||||
if(!isset($sum[$key]))$sum[$key] = 0;
|
||||
$sum[$key] += $v;
|
||||
$this->datasets[$k][$key] = $sum[$key];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function replaceLabelsDate($label)
|
||||
{
|
||||
if(preg_match_all('/^[1-2]{1}[0-9]{3}\-[0-1]{1}[0-9]{1}\-[0-3]{1}[0-9]{1}$/', $label, $erg))$label = $this->app->String->Convert($label, '%1-%2-%3', '%3.%2.%1');
|
||||
return $label;
|
||||
}
|
||||
|
||||
// Fügt $value in $array ein, an der Stelle $index
|
||||
function array_insert($array, $index, $value)
|
||||
{
|
||||
return array_merge(array_slice($array, 0, $index), $value, array_slice($array, $index));
|
||||
}
|
||||
|
||||
function DisplayWithBox($parsetarget,$id,$name,$width = "300",$height = "250",$style="")
|
||||
{
|
||||
$this->calcbcolors();
|
||||
$_width = $width;
|
||||
$this->app->Tpl->Add($parsetarget, '<div class="dashbox dashbox_grey" id="db'.$id.'" style="width:98%; display:block;">
|
||||
'.($name?'<div class="dashbox_header" style="display:block;">'.$name.'</div>':'').'
|
||||
<div class="dashbox_content" width="100%" style="display:block;">');
|
||||
switch($this->type)
|
||||
{
|
||||
case 'polarArea':
|
||||
case 'doughnut':
|
||||
if(count($this->datasets) > 0 && $this->labels)
|
||||
{
|
||||
$this->app->Tpl->Add($parsetarget,'<ul class="chart_legendbox" style="display:block;position:relative;padding-top:2px;padding-right:2px;margin:0;min-height:50px;float:right;list-style-type:none;font-size:65%;">');
|
||||
$j = 0;
|
||||
$i = 1;
|
||||
$sum = 0;
|
||||
foreach($this->datasets as $row)
|
||||
{
|
||||
$el = (float)$row[$this->lheadings[$i]];
|
||||
$sum += $el;
|
||||
}
|
||||
|
||||
foreach($this->datasets as $row)
|
||||
{
|
||||
$_label = $row[$this->lheadings[0]];
|
||||
$wert = $row[$this->lheadings[$i]];
|
||||
$proz = 100*($sum > 0?($wert / $sum):0);
|
||||
if($this->colors && count($this->colors) > 0);
|
||||
|
||||
$farbe = $this->colors[$j % count($this->colors)];
|
||||
$this->app->Tpl->Add($parsetarget,'<li><span style="background-color:'.$farbe.';width:10px;left:20px;position:absolute;height:10px;margin:0;display:inline-block;"></span><span style="text-align:left;width:100%;display:inline-block;">'.$_label.' '.number_format($wert,2,',','.').' ('.round($proz,1).'%)</span></li>');
|
||||
$j++;
|
||||
}
|
||||
$this->app->Tpl->Add($parsetarget,'</ul>');
|
||||
}
|
||||
break;
|
||||
}
|
||||
$this->Display($parsetarget, $id, $width,(int)$height-50, $style);
|
||||
$this->app->Tpl->Add($parsetarget,'</div></div><div style="clear:both;"></div>');
|
||||
}
|
||||
|
||||
function calcbcolors($alpha = 0.1)
|
||||
{
|
||||
if($this->colorcol)
|
||||
{
|
||||
if(isset($this->lheadings[$this->colorcol-1]))
|
||||
{
|
||||
foreach($this->datasets as $k => $row)
|
||||
{
|
||||
if(isset($row[$this->lheadings[$this->colorcol-1]]) && $row[$this->lheadings[$this->colorcol-1]] && strtolower(str_replace('#','',$row[$this->lheadings[$this->colorcol-1]])) != 'ffffff')
|
||||
{
|
||||
|
||||
$this->colors[$k] = str_replace('#','',$row[$this->lheadings[$this->colorcol-1]]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach($this->colors as $key => $v)
|
||||
{
|
||||
$v = strtoupper(str_replace('#','',$v));
|
||||
if(strlen($v) == 3) $v = $v[0].$v[0].$v[1].$v[1].$v[2].$v[2];
|
||||
$this->colors[$key] = '#'.$v;
|
||||
$r = (int)hexdec($v[0].$v[1]);
|
||||
$g = (int)hexdec($v[2].$v[3]);
|
||||
$b = (int)hexdec($v[4].$v[5]);
|
||||
$this->bcolors[$key] = 'rgba('.$r.','.$g.','.$b.','.$alpha.')';
|
||||
}
|
||||
}
|
||||
|
||||
function Display($parsetarget,$id,$width = "300",$height = "200",$style="")
|
||||
{
|
||||
$this->calcbcolors();
|
||||
$this->app->Tpl->Add($parsetarget, '<canvas id="'.$id.'" width="'.$width.'" height="'.$height.'"></canvas>
|
||||
<script>
|
||||
var myChart'.$id.' = null;
|
||||
|
||||
var ctx'.$id.' = document.getElementById("'.$id.'");
|
||||
|
||||
setTimeout(function(){
|
||||
myChart'.$id.' = new Chart(ctx'.$id.', {
|
||||
type: \''.$this->type.'\',
|
||||
animation:{
|
||||
animateScale:'.($this->animate?'true':'false').',
|
||||
duration:'.$this->duration.'
|
||||
},
|
||||
|
||||
data: {
|
||||
');
|
||||
|
||||
switch($this->type)
|
||||
{
|
||||
case 'line':
|
||||
|
||||
if($this->labels)
|
||||
{
|
||||
$this->app->Tpl->Add($parsetarget,'labels: ["');
|
||||
if(count($this->datasets)>0){
|
||||
foreach($this->datasets as $row){
|
||||
foreach($row as $col)
|
||||
{
|
||||
$tmplabel[] = $this->replaceLabelsDate($col);
|
||||
break;
|
||||
}
|
||||
}
|
||||
$this->app->Tpl->Add($parsetarget, implode('","',$tmplabel));
|
||||
}
|
||||
|
||||
$this->app->Tpl->Add($parsetarget,'"],');
|
||||
}
|
||||
$this->app->Tpl->Add($parsetarget,'datasets: [');
|
||||
for($i = 0; $i < count($this->headings); $i++)
|
||||
{
|
||||
if($i > 0 || !$this->labels)
|
||||
{
|
||||
$this->app->Tpl->Add($parsetarget, '{
|
||||
label: "'.$this->headings[$i].'",
|
||||
|
||||
'.(!is_null($this->yAxes)?'
|
||||
yAxisID: "y-axis-'.$this->yAxes[$i-($this->labels?1:0)].'",
|
||||
':'').'
|
||||
|
||||
fill: '.($this->background?'true':'false').',
|
||||
lineTension: 0.1,
|
||||
|
||||
borderColor:"'.$this->colors[$i-($this->labels?1:0)].'",
|
||||
|
||||
borderCapStyle: "butt",
|
||||
borderDash: [],
|
||||
borderDashOffset: 0.0,
|
||||
borderJoinStyle: "miter",
|
||||
backgroundColor: "'.$this->bcolors[$i-($this->labels?1:0)].'",
|
||||
pointBackgroundColor: "'.$this->colors[$i-($this->labels?1:0)].'",
|
||||
pointBorderWidth: 1,
|
||||
pointHoverRadius: 5,
|
||||
|
||||
pointHoverBorderWidth: 2,
|
||||
pointRadius: 1,
|
||||
pointHitRadius: 10,
|
||||
data: [');
|
||||
if(count($this->datasets) > 0)
|
||||
{
|
||||
foreach($this->datasets as $row)
|
||||
{
|
||||
$els[] = $row[$this->lheadings[$i]];
|
||||
}
|
||||
|
||||
$this->app->Tpl->Add($parsetarget,implode(',', $els));
|
||||
unset($els);
|
||||
}
|
||||
|
||||
$this->app->Tpl->Add($parsetarget,"],}\r\n");
|
||||
if($i < count($this->headings) - 1)$this->app->Tpl->Add($parsetarget,',');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
$this->app->Tpl->Add($parsetarget,"]\r\n");
|
||||
$this->app->Tpl->Add($parsetarget,'},
|
||||
options: {
|
||||
xAxes: [{
|
||||
display: false
|
||||
}],responsive: true ,scales: {
|
||||
xAxes: [{
|
||||
'.($this->stacked?'stacked: true,':'').'
|
||||
}],
|
||||
yAxes: [
|
||||
'.(!is_null($this->yAxes)?'
|
||||
{
|
||||
position: "left",
|
||||
type:"linear",
|
||||
display:true,
|
||||
id: "y-axis-1"
|
||||
'.($this->stacked?',stacked: true':'').'
|
||||
|
||||
},{
|
||||
position: "right",
|
||||
type:"linear",
|
||||
display:true,
|
||||
id: "y-axis-2"
|
||||
'.($this->stacked?',stacked: true':'').'
|
||||
|
||||
}
|
||||
':'
|
||||
{
|
||||
'.($this->stacked?'stacked: true':'').'
|
||||
}
|
||||
').'
|
||||
|
||||
]
|
||||
}, tooltips: {
|
||||
callbacks: {
|
||||
label: function(tooltipItem, data) {
|
||||
var dataset = data.datasets[tooltipItem.datasetIndex];
|
||||
var total = dataset.data.reduce(function(previousValue, currentValue, currentIndex, array) {
|
||||
return previousValue + currentValue;
|
||||
});
|
||||
var currentValue = dataset.data[tooltipItem.index];
|
||||
var name = dataset.label;
|
||||
name = name +\': \';
|
||||
//name = \'\';
|
||||
|
||||
var x = parseFloat(currentValue);
|
||||
var k = (x.toFixed(2)).toString().replace(\'.\',\',\');
|
||||
var anzstellen = k.length;
|
||||
var vorzeichen = 0;
|
||||
if(k.substring(0,1) == \'-\')
|
||||
{
|
||||
vorzeichen = 1;
|
||||
}
|
||||
if(anzstellen - 1 <= 6){
|
||||
currentValue = k;
|
||||
}else{
|
||||
var vorzeichenstring = \'\';
|
||||
if(vorzeichen)vorzeichenstring = k.substring(0, 1);
|
||||
var vorkomma = k.substring(vorzeichen, anzstellen - 3);
|
||||
var ret = vorzeichenstring;
|
||||
var modstellen = vorkomma.length % 3;
|
||||
if(modstellen > 0)ret = ret + vorkomma.substring(0, modstellen)+\'.\';
|
||||
var nachkomma = k.substring(anzstellen - 3, anzstellen);
|
||||
|
||||
var i = 0;
|
||||
for(i = 0; i < Math.floor(vorkomma.length / 3); i++)
|
||||
{
|
||||
if(i > 0)ret = ret + \'.\';
|
||||
ret = ret + vorkomma.substring(i*3+modstellen, (i+1)*3+modstellen);
|
||||
}
|
||||
ret = ret+nachkomma;
|
||||
currentValue = ret;
|
||||
}
|
||||
|
||||
return name+currentValue;
|
||||
}
|
||||
},backgroundColor: "rgba(0,0,0,0.5)"
|
||||
}
|
||||
}
|
||||
|
||||
});');
|
||||
|
||||
break;
|
||||
case 'bar':
|
||||
if($this->labels)
|
||||
{
|
||||
$this->app->Tpl->Add($parsetarget,'labels: ["');
|
||||
if(count($this->datasets)>0){
|
||||
foreach($this->datasets as $row){
|
||||
foreach($row as $col)
|
||||
{
|
||||
$tmplabel[] = $this->replaceLabelsDate($col);
|
||||
break;
|
||||
}
|
||||
}
|
||||
$this->app->Tpl->Add($parsetarget, implode('","',$tmplabel));
|
||||
}
|
||||
|
||||
$this->app->Tpl->Add($parsetarget,'"],');
|
||||
}
|
||||
$this->app->Tpl->Add($parsetarget,'datasets: [');
|
||||
for($i = 0; $i < count($this->headings); $i++)
|
||||
{
|
||||
if($i > 0 || !$this->labels)
|
||||
{
|
||||
$this->app->Tpl->Add($parsetarget, '{
|
||||
label: "'.$this->headings[$i].'",
|
||||
backgroundColor:"'.$this->colors[$i-($this->labels?1:0)].'",
|
||||
|
||||
'.(!is_null($this->yAxes)?'
|
||||
yAxisID: "y-axis-'.$this->yAxes[$i-($this->labels?1:0)].'",
|
||||
':'').'
|
||||
data: [');
|
||||
if(count($this->datasets) > 0)
|
||||
{
|
||||
foreach($this->datasets as $row)
|
||||
{
|
||||
$els[] = $row[$this->lheadings[$i]];
|
||||
}
|
||||
|
||||
$this->app->Tpl->Add($parsetarget,implode(',', $els));
|
||||
unset($els);
|
||||
}
|
||||
|
||||
$this->app->Tpl->Add($parsetarget,"],}\r\n");
|
||||
if($i < count($this->headings) - 1)$this->app->Tpl->Add($parsetarget,',');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
$this->app->Tpl->Add($parsetarget,"]\r\n");
|
||||
$this->app->Tpl->Add($parsetarget,'},
|
||||
options: {
|
||||
xAxes: [{
|
||||
display: false
|
||||
}]
|
||||
|
||||
|
||||
,scales: {
|
||||
xAxes: [{
|
||||
'.($this->stacked?'stacked: true,':'').'
|
||||
}],
|
||||
yAxes: [
|
||||
'.(!is_null($this->yAxes)?'
|
||||
{
|
||||
position: "left",
|
||||
type:"linear",
|
||||
display:true,
|
||||
id: "y-axis-1"
|
||||
'.($this->stacked?',stacked: true':'').'
|
||||
|
||||
},{
|
||||
position: "right",
|
||||
type:"linear",
|
||||
display:true,
|
||||
id: "y-axis-2"
|
||||
'.($this->stacked?',stacked: true':'').'
|
||||
|
||||
}
|
||||
':'
|
||||
{
|
||||
'.($this->stacked?'stacked: true':'').'
|
||||
}
|
||||
').'
|
||||
|
||||
]
|
||||
}, tooltips: {
|
||||
callbacks: {
|
||||
label: function(tooltipItem, data) {
|
||||
var dataset = data.datasets[tooltipItem.datasetIndex];
|
||||
var total = dataset.data.reduce(function(previousValue, currentValue, currentIndex, array) {
|
||||
return previousValue + currentValue;
|
||||
});
|
||||
var currentValue = dataset.data[tooltipItem.index];
|
||||
var name = dataset.label;
|
||||
name = name +\': \';
|
||||
//name = \'\';
|
||||
|
||||
var x = parseFloat(currentValue);
|
||||
var k = (x.toFixed(2)).toString().replace(\'.\',\',\');
|
||||
var anzstellen = k.length;
|
||||
var vorzeichen = 0;
|
||||
if(k.substring(0,1) == \'-\')
|
||||
{
|
||||
vorzeichen = 1;
|
||||
}
|
||||
if(anzstellen - 1 <= 6){
|
||||
currentValue = k;
|
||||
}else{
|
||||
var vorzeichenstring = \'\';
|
||||
if(vorzeichen)vorzeichenstring = k.substring(0, 1);
|
||||
var vorkomma = k.substring(vorzeichen, anzstellen - 3);
|
||||
var ret = vorzeichenstring;
|
||||
var modstellen = vorkomma.length % 3;
|
||||
if(modstellen > 0)ret = ret + vorkomma.substring(0, modstellen)+\'.\';
|
||||
var nachkomma = k.substring(anzstellen - 3, anzstellen);
|
||||
|
||||
var i = 0;
|
||||
for(i = 0; i < Math.floor(vorkomma.length / 3); i++)
|
||||
{
|
||||
if(i > 0)ret = ret + \'.\';
|
||||
ret = ret + vorkomma.substring(i*3+modstellen, (i+1)*3+modstellen);
|
||||
}
|
||||
ret = ret+nachkomma;
|
||||
currentValue = ret;
|
||||
}
|
||||
|
||||
return name+currentValue;
|
||||
}
|
||||
},backgroundColor: "rgba(0,0,0,0.5)"
|
||||
}
|
||||
,responsive: true
|
||||
}
|
||||
|
||||
});');
|
||||
|
||||
break;
|
||||
case 'polarArea':
|
||||
case 'doughnut':
|
||||
$this->app->Tpl->Add($parsetarget,'labels: ["');
|
||||
if(count($this->datasets)>0){
|
||||
foreach($this->datasets as $row){
|
||||
foreach($row as $col)
|
||||
{
|
||||
$tmplabel[] = $col;
|
||||
break;
|
||||
}
|
||||
}
|
||||
$this->app->Tpl->Add($parsetarget, implode('","',$tmplabel));
|
||||
}
|
||||
|
||||
$this->app->Tpl->Add($parsetarget,'"],');
|
||||
$this->app->Tpl->Add($parsetarget,'datasets: [');
|
||||
if(count($this->datasets) > 0)
|
||||
{
|
||||
$i = 1;
|
||||
if($i > 0 || !$this->labels)
|
||||
{
|
||||
$this->app->Tpl->Add($parsetarget, '{
|
||||
label: "'.$this->headings[$i].'",
|
||||
data: [');
|
||||
if(count($this->datasets) > 0)
|
||||
{
|
||||
foreach($this->datasets as $row)
|
||||
{
|
||||
$els[] = $row[$this->lheadings[$i]];
|
||||
}
|
||||
|
||||
$this->app->Tpl->Add($parsetarget,implode(',', $els));
|
||||
unset($els);
|
||||
}
|
||||
|
||||
$this->app->Tpl->Add($parsetarget,"],\r\n");
|
||||
|
||||
|
||||
$this->app->Tpl->Add($parsetarget, 'backgroundColor:[');
|
||||
if(count($this->datasets) > 0)
|
||||
{
|
||||
$j = 0;
|
||||
foreach($this->datasets as $row)
|
||||
{
|
||||
if($this->colors && count($this->colors) > 0);
|
||||
if($j > 0)$this->app->Tpl->Add($parsetarget,',');
|
||||
$this->app->Tpl->Add($parsetarget,'"'.$this->colors[$j % count($this->colors)].'"');
|
||||
$j++;
|
||||
}
|
||||
}
|
||||
$this->app->Tpl->Add($parsetarget,"]}\r\n");
|
||||
//if($i < count($this->headings) - 1)$this->app->Tpl->Add($parsetarget,',');
|
||||
}
|
||||
}
|
||||
$this->app->Tpl->Add($parsetarget,"]\r\n");
|
||||
$this->app->Tpl->Add($parsetarget,'},
|
||||
options: {showAllTooltips: true,
|
||||
cutoutPercentage: 50');
|
||||
if(!$this->labels || true)
|
||||
{
|
||||
$this->app->Tpl->Add($parsetarget,'
|
||||
,legend:{display:false}
|
||||
');
|
||||
}else{
|
||||
$this->app->Tpl->Add($parsetarget,'
|
||||
,legend: {
|
||||
position: \'top\',
|
||||
}
|
||||
');
|
||||
}
|
||||
$this->app->Tpl->Add($parsetarget, '
|
||||
,showTooltips: true,
|
||||
|
||||
tooltips: {
|
||||
callbacks: {
|
||||
label: function(tooltipItem, data) {
|
||||
var dataset = data.datasets[tooltipItem.datasetIndex];
|
||||
var total = dataset.data.reduce(function(previousValue, currentValue, currentIndex, array) {
|
||||
return previousValue + currentValue;
|
||||
});
|
||||
var currentValue = dataset.data[tooltipItem.index];
|
||||
var precentage = Math.floor(((currentValue/total) * 100)+0.5);
|
||||
var name = data.labels[tooltipItem.index];
|
||||
name = name +\': \';
|
||||
//name = \'\';
|
||||
|
||||
var x = parseFloat(currentValue);
|
||||
var k = (x.toFixed(2)).toString().replace(\'.\',\',\');
|
||||
var anzstellen = k.length;
|
||||
var vorzeichen = 0;
|
||||
if(k.substring(0,1) == \'-\')
|
||||
{
|
||||
vorzeichen = 1;
|
||||
}
|
||||
if(anzstellen - 1 <= 6){
|
||||
currentValue = k;
|
||||
}else{
|
||||
var vorzeichenstring = \'\';
|
||||
if(vorzeichen)vorzeichenstring = k.substring(0, 1);
|
||||
var vorkomma = k.substring(vorzeichen, anzstellen - 3);
|
||||
var ret = vorzeichenstring;
|
||||
var modstellen = vorkomma.length % 3;
|
||||
if(modstellen > 0)ret = ret + vorkomma.substring(0, modstellen)+\'.\';
|
||||
var nachkomma = k.substring(anzstellen - 3, anzstellen);
|
||||
|
||||
var i = 0;
|
||||
for(i = 0; i < Math.floor(vorkomma.length / 3); i++)
|
||||
{
|
||||
if(i > 0)ret = ret + \'.\';
|
||||
ret = ret + vorkomma.substring(i*3+modstellen, (i+1)*3+modstellen);
|
||||
}
|
||||
ret = ret+nachkomma;
|
||||
currentValue = ret;
|
||||
}
|
||||
return name+currentValue+\' (\'+ precentage + "%)";
|
||||
}
|
||||
},backgroundColor: "rgba(0,0,0,0.5)"
|
||||
},responsive: true,responsiveAnimationDuration:'.$this->duration.'
|
||||
|
||||
|
||||
}
|
||||
|
||||
}); ');
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
$this->app->Tpl->Add($parsetarget, '
|
||||
|
||||
var aktc = 0
|
||||
$(\'.chart_legendbox\').each(function(){if(aktc < $(this).height())aktc = $(this).height();
|
||||
});
|
||||
if(aktc != 0)
|
||||
{
|
||||
$(\'.chart_legendbox\').each(function(){
|
||||
if(aktc < $(this).height())aktc = $(this).height();
|
||||
if($(this).height() < aktc)
|
||||
{
|
||||
$(this).css(\'height\',aktc+\'px\');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
,100);</script>');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,249 @@
|
||||
<?php
|
||||
/*
|
||||
**** COPYRIGHT & LICENSE NOTICE *** DO NOT REMOVE ****
|
||||
*
|
||||
* Xentral (c) Xentral ERP Sorftware GmbH, Fuggerstrasse 11, D-86150 Augsburg, * Germany 2019
|
||||
*
|
||||
* This file is licensed under the Embedded Projects General Public License *Version 3.1.
|
||||
*
|
||||
* You should have received a copy of this license from your vendor and/or *along with this file; If not, please visit www.wawision.de/Lizenzhinweis
|
||||
* to obtain the text of the corresponding license version.
|
||||
*
|
||||
**** END OF COPYRIGHT & LICENSE NOTICE *** DO NOT REMOVE ****
|
||||
*/
|
||||
?>
|
||||
<?php
|
||||
|
||||
/**
|
||||
* CHild Tabelle
|
||||
* Stellt eine -Formatierte Child Tabelle mit optionalem Zeilenmenü zur Verfügung.
|
||||
*
|
||||
* @package
|
||||
* @author Benedikt Sauter <sauter@ixbat.de>
|
||||
* @author coma ag <info@coma.de>
|
||||
* @author *105 - Multimediabüro <development@stern105.de>
|
||||
* @version 1.0
|
||||
* @since PHP 4.x
|
||||
*/
|
||||
class ChildTable {
|
||||
|
||||
/**
|
||||
* Target template to wich the table will be parsed. [Default: PAGE]
|
||||
* @type string
|
||||
*/
|
||||
var $parsetarget;
|
||||
|
||||
/**
|
||||
* HTMLTable. Apply format changes to this object.
|
||||
* @type Object
|
||||
* @access public
|
||||
*/
|
||||
var $table;
|
||||
|
||||
var $editdate;
|
||||
var $datasetssql;
|
||||
|
||||
|
||||
var $arrayuse;
|
||||
|
||||
/**
|
||||
* Constructor method
|
||||
*
|
||||
* @param $app Default application class
|
||||
*
|
||||
* @return Generated object ($this)
|
||||
* @access public
|
||||
*/
|
||||
function __construct(&$app, $name, $parsetarget="PAGE",$editdate=false) {
|
||||
$this->app = &$app;
|
||||
$this->parsetarget=$parsetarget;
|
||||
$this->name=$name;
|
||||
$this->editdate = $editdate;
|
||||
} // end of constructor
|
||||
|
||||
|
||||
// defines all datasets
|
||||
function DataSets($sql) {
|
||||
$this->datasetssql = $sql;
|
||||
} // end of function
|
||||
|
||||
function Register($pointer, $event, $function) {
|
||||
$this->events[$event] = $function;
|
||||
$this->pointer = $pointer;
|
||||
} // end of function
|
||||
|
||||
function CatchEvents() {
|
||||
$event=$this->app->Secure->GetPOST("{$this->name}_event");
|
||||
|
||||
if(is_array($event)){
|
||||
$function = $this->events[key($event)];
|
||||
$this->pointer->$function($event[key($event)]);
|
||||
} // end of if
|
||||
} // end of function
|
||||
|
||||
|
||||
function MarkLineIfColHasValue($col,$value,$replace,$exclude)
|
||||
{
|
||||
$this->mark_col = $col;
|
||||
$this->mark_value = $value;
|
||||
$this->mark_replace = $replace;
|
||||
$this->mark_exclude = $exclude;
|
||||
|
||||
$this->mark = true;
|
||||
}
|
||||
|
||||
/* Diese Funktion dient fuer tabellen in denen die sipchildtables zeilen verschiedene bedeutungen haben
|
||||
*/
|
||||
|
||||
function ShowMultiRow($contentArr){
|
||||
$this->arrayuse = true;
|
||||
|
||||
//$this->app->Table->CreateTable($this->datasetssql, $this->parsetarget, 400);
|
||||
//$contentArr = $this->app->DB->SelectArr( $this->datasetssql );
|
||||
$this->app->Table->CreateTableFromArray($contentArr, $this->parsetarget, 450);
|
||||
//$this->app->Table->FormatCondition(1, "", "<span style=\"color:red;\"class=\"inactive\">%value%</span>", array(5,6));
|
||||
|
||||
$this->Show();
|
||||
}
|
||||
|
||||
function Show() {
|
||||
$this->CatchEvents();
|
||||
if(!$this->arrayuse)
|
||||
$this->app->Table->CreateTable($this->datasetssql, $this->parsetarget, 400);
|
||||
|
||||
|
||||
$numberofdatasets = count($this->app->DB->SelectArr($this->datasetssql));
|
||||
$module = $this->app->Secure->GetGET("module");
|
||||
$id = $this->app->Secure->GetGET("id");
|
||||
|
||||
$delbutton = "<input type=\"submit\" class=\"bu_delete\" title=\"Eintrag löschen\" name=\"{$this->name}_event[delete]\" value=\"%value%\">";
|
||||
// $editbutton = "<input type=\"submit\" class=\"bu_edit\" title=\"Datum bearbeiten\" name=\"{$this->name}_event[editdate]\" value=\"%value%\">";
|
||||
$editbutton = "<input type=\"button\"
|
||||
onclick=\"window.location.href='index.php?module=$module&action=editdate&id=$id&value=%value%&childtable={$this->name}'\"
|
||||
class=\"bu_edit\" title=\"Datum bearbeiten\">";
|
||||
$downbutton = "<input type=\"submit\" class=\"bu_down\" title=\"Nach unten\" name=\"{$this->name}_event[down]\" value=\"%value%\">";
|
||||
$upbutton = "<input type=\"submit\" class=\"bu_up\" title=\"Nach oben\" name=\"{$this->name}_event[up]\" value=\"%value%\">";
|
||||
$addbutton = "<input type=\"button\"
|
||||
onclick=\"window.location.href='index.php?module=$module&action=addafter&id=$id&value=%value%&childtable={$this->name}'\"
|
||||
class=\"bu_add\" title=\"Nach diesem Eintrag einfügen\">";
|
||||
$addfbutton = "<input type=\"button\"
|
||||
onclick=\"window.location.href='index.php?module=$module&action=addfafter&hut=$id&value=%value%&childtable={$this->name}'\"
|
||||
class=\"bu_addf\" title=\"Nach diesem Eintrag einfügen\">";
|
||||
|
||||
|
||||
$menunew = $addbutton;
|
||||
$menusingle = $delbutton.$addbutton.$addfbutton;
|
||||
$menufirst = $delbutton.$addbutton.$addfbutton.$downbutton;
|
||||
$menu = $delbutton.$addbutton.$addfbutton.$downbutton.$upbutton;
|
||||
$menulast = $delbutton.$addbutton.$addfbutton.$upbutton;
|
||||
|
||||
// falls zeit relation berarbeitet werden soll
|
||||
if($this->editdate)
|
||||
{
|
||||
$menulast .= $editbutton;
|
||||
$menu .= $editbutton;
|
||||
$menufirst .= $editbutton;
|
||||
$menusingle .= $editbutton;
|
||||
|
||||
$header = '
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="divider">Nr.</th>
|
||||
<th class="divider">Name</th>
|
||||
<th class="divider">ID</th>
|
||||
<th class="divider">Gültig von - bis</th>
|
||||
';
|
||||
}
|
||||
else {
|
||||
$header = '
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="divider">Nr.</th>
|
||||
<th class="divider">Name</th>
|
||||
<th class="divider">ID</th>
|
||||
';
|
||||
}
|
||||
|
||||
|
||||
if(count($this->events)>0)
|
||||
$header .= '<th class="divider">Aktion</th>';
|
||||
|
||||
$header .= '
|
||||
</tr>
|
||||
</thead>';
|
||||
|
||||
$this->app->Table->HeadingTop($header);
|
||||
|
||||
|
||||
if($this->editdate){
|
||||
$arr = array(1, 2, 3, 4,6);
|
||||
}
|
||||
else{
|
||||
$arr = array(1, 2, 3, 5);
|
||||
}
|
||||
|
||||
// erstellen der richtigen menues
|
||||
for($i=1;$i<=$numberofdatasets;$i++) {
|
||||
if($numberofdatasets==1)
|
||||
$this->app->Table->FormatCondition(1, 1, $menusingle, $arr);
|
||||
else if($i==1)
|
||||
$this->app->Table->FormatCondition(1, 1, $menufirst, $arr);
|
||||
else if($i == $numberofdatasets)
|
||||
$this->app->Table->FormatCondition(1, $numberofdatasets, $menulast, $arr);
|
||||
else
|
||||
$this->app->Table->FormatCondition(1, $i, $menu, $arr);
|
||||
} // end of for
|
||||
|
||||
|
||||
if(count($this->events)==0) {
|
||||
if($this->editdate){
|
||||
$this->app->Table->FormatCondition(6, 0, "<span class=\"inactive\">%value%</span>", array(5,6));
|
||||
$this->app->Table->HideCol(6);
|
||||
}
|
||||
else {
|
||||
$this->app->Table->FormatCondition(5, 0, "<span class=\"inactive\">%value%</span>", array(4, 5));
|
||||
$this->app->Table->HideCol(5);
|
||||
$this->app->Table->HideCol(4); // menu ausblenden falls keine events registriert sind
|
||||
}
|
||||
} else {
|
||||
// inaktiv zeile
|
||||
if($this->editdate){
|
||||
$this->app->Table->FormatCondition(6, 0, "<span class=\"inactive\">%value%</span>", array(5, 6));
|
||||
$this->app->Table->HideCol(6);
|
||||
}
|
||||
else {
|
||||
$this->app->Table->FormatCondition(5, 0, "<span class=\"inactive\">%value%</span>", array(4, 5));
|
||||
$this->app->Table->HideCol(5);
|
||||
}
|
||||
} // end of if/else
|
||||
|
||||
|
||||
|
||||
if($this->mark && count($this->events)!=0) {
|
||||
$this->app->Table->FormatCondition($this->mark_col, $this->mark_value, $this->mark_replace,$this->mark_exclude);
|
||||
$this->app->Table->HideCol(6);
|
||||
}
|
||||
|
||||
|
||||
if ($numberofdatasets > 0)
|
||||
$this->app->Table->Show();
|
||||
else {
|
||||
$table = '
|
||||
<table width=400 cellpadding="0" cellspacing="0">
|
||||
[TABLEHEADER]
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>keine Elemente vorhanden</td>
|
||||
<td></td>';
|
||||
|
||||
if(count($this->events)!=0)
|
||||
$table .= '<td>'.$menunew.'</td>';
|
||||
|
||||
$table .= '</tr></table>';
|
||||
//$this->app->Tpl->Set(TABLEHEADER,$header);
|
||||
$this->app->Tpl->Set($this->parsetarget,$table, array('TABLEHEADER'));
|
||||
} // end of if
|
||||
} // end of function
|
||||
|
||||
} // end of class
|
||||
?>
|
||||
@@ -0,0 +1,428 @@
|
||||
<?php
|
||||
/*
|
||||
**** COPYRIGHT & LICENSE NOTICE *** DO NOT REMOVE ****
|
||||
*
|
||||
* Xentral (c) Xentral ERP Sorftware GmbH, Fuggerstrasse 11, D-86150 Augsburg, * Germany 2019
|
||||
*
|
||||
* This file is licensed under the Embedded Projects General Public License *Version 3.1.
|
||||
*
|
||||
* You should have received a copy of this license from your vendor and/or *along with this file; If not, please visit www.wawision.de/Lizenzhinweis
|
||||
* to obtain the text of the corresponding license version.
|
||||
*
|
||||
**** END OF COPYRIGHT & LICENSE NOTICE *** DO NOT REMOVE ****
|
||||
*/
|
||||
?>
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Class DownloadSpoolerTable
|
||||
*/
|
||||
class DownloadSpoolerTable
|
||||
{
|
||||
/** @var erpooSystem $app */
|
||||
protected $app;
|
||||
|
||||
/** @var int $printerId */
|
||||
protected $printerId;
|
||||
|
||||
/** @var array $columns */
|
||||
protected $columns = [];
|
||||
|
||||
/** @var array $filter */
|
||||
protected $filter = [];
|
||||
|
||||
/** @var array $order Initiale Sortierung */
|
||||
protected $order = [[0, 'asc']];
|
||||
|
||||
/** @var string $sqlTemplate */
|
||||
protected $sqlTemplate = '';
|
||||
|
||||
/** @var string $sqlCount */
|
||||
protected $sqlCount = '';
|
||||
|
||||
/**
|
||||
* @param erpooSystem $app
|
||||
* @param int $printerId
|
||||
*/
|
||||
public function __construct($app, $printerId)
|
||||
{
|
||||
$this->app = $app;
|
||||
$this->printerId = (int)$printerId;
|
||||
|
||||
$this->Init();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
protected function Init()
|
||||
{
|
||||
$table = $this->GetAdressenTable();
|
||||
|
||||
$this->sqlTemplate = $table['sql_template'];
|
||||
$this->sqlCount = $table['sql_count'];
|
||||
$this->columns = $table['columns'];
|
||||
$this->filter = $table['filter'];
|
||||
$this->order = $table['order'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $filterParams
|
||||
* @param string|null $searchQuery Suchbegriff
|
||||
* @param int $orderCol Spalten-Index
|
||||
* @param string $orderDir [asc|desc]
|
||||
* @param int $offset
|
||||
* @param int $limit
|
||||
* @param int $draw
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function GetData(
|
||||
$filterParams = [],
|
||||
$searchQuery = null,
|
||||
$orderCol = 0,
|
||||
$orderDir = 'asc',
|
||||
$offset = 0,
|
||||
$limit = 10,
|
||||
$draw = 1
|
||||
)
|
||||
{
|
||||
$where = [];
|
||||
|
||||
// Suche
|
||||
if ($searchQuery !== null){
|
||||
$searchParts = [];
|
||||
foreach ($this->columns as $column) {
|
||||
if (!isset($column['search'])) {
|
||||
continue;
|
||||
}
|
||||
$searchParts[] = sprintf(' %s LIKE \'%%%s%%\' ', $column['search'], $searchQuery);
|
||||
}
|
||||
$where[] = '(' . implode(' OR ', $searchParts) .')';
|
||||
}
|
||||
|
||||
// Filter
|
||||
if (!empty($filterParams)) {
|
||||
foreach ($filterParams as $filterName => $filterActive) {
|
||||
$where[] = $this->GenerateFilterSql($filterName, $filterActive);
|
||||
}
|
||||
}
|
||||
$whereString = implode(' AND ', $where);
|
||||
if (empty($whereString)) {
|
||||
$whereString = ' 1 ';
|
||||
}
|
||||
|
||||
// Sortierung
|
||||
$orderColumnName = !empty(array_column($this->columns, 'search')[$orderCol])?
|
||||
array_column($this->columns, 'search')[$orderCol]:
|
||||
array_column($this->columns, 'data')[$orderCol];
|
||||
$orderDirection = strtolower($orderDir) === 'desc' ? 'DESC' : 'ASC';
|
||||
$orderBy = !empty($orderColumnName) ? $orderColumnName . ' ' . $orderDirection . ' ' : '';
|
||||
|
||||
// SQL zusammenbauen
|
||||
$sql = $this->sqlTemplate;
|
||||
$sql = str_replace(
|
||||
['{{limit}}', '{{offset}}', '{{where}}', '{{orderby}}'],
|
||||
[(int)$limit, (int)$offset, $whereString, $orderBy],
|
||||
$sql
|
||||
);
|
||||
|
||||
// Ergebnisse abrufen
|
||||
$result = $this->app->DB->SelectArr($sql);
|
||||
$countFiltered = $this->app->DB->Select('SELECT FOUND_ROWS()');
|
||||
$countTotal = $this->app->DB->Select($this->sqlCount);
|
||||
|
||||
return [
|
||||
'draw' => (int)$draw,
|
||||
'recordsTotal' => (int)$countTotal,
|
||||
'recordsFiltered' => (int)$countFiltered,
|
||||
'data' => (array)$result,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $filtername
|
||||
* @param bool $active
|
||||
*
|
||||
* @return string|null Filter-SQL
|
||||
*/
|
||||
protected function GenerateFilterSql($filtername, $active = false)
|
||||
{
|
||||
foreach ($this->GetFilter() as $item) {
|
||||
if ($item['name'] === $filtername) {
|
||||
return (bool)$active ? $item['sql']['active'] : $item['sql']['inactive'];
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter für DataTable-Einstellungen
|
||||
*
|
||||
* @param string $ajaxUrl
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function GetSettings($ajaxUrl)
|
||||
{
|
||||
return [
|
||||
'ajax' => $ajaxUrl,
|
||||
'columns' => $this->GetColumns(),
|
||||
'order' => $this->order,
|
||||
'processing' => true,
|
||||
'serverSide' => true,
|
||||
'responsive' => true,
|
||||
'autoWidth' => true,
|
||||
'paging' => true,
|
||||
'language' => [
|
||||
'decimal' => ',',
|
||||
'thousands' => '.',
|
||||
'paginate' => [
|
||||
'first' => 'Erste',
|
||||
'last' => 'Letzte',
|
||||
'next' => '>>',
|
||||
'previous' => '<<',
|
||||
],
|
||||
'emptyTable' => 'Keine Daten vorhanden',
|
||||
'info' => 'Zeige _START_ bis _END_ von _TOTAL_ Einträgen',
|
||||
'infoEmpty' => 'Zeige 0 bis 0 von 0 Einträge',
|
||||
'infoFiltered' => '(gefiltert von _MAX_ Einträgen)',
|
||||
'infoPostFix' => '',
|
||||
'lengthMenu' => '_MENU_ Einträge pro Seite',
|
||||
'loadingRecords' => 'Loading...',
|
||||
'processing' => '',
|
||||
'search' => 'Suche:',
|
||||
'searchPlaceholder' => '',
|
||||
'zeroRecords' => 'Keine Einträge gefunden',
|
||||
'aria' => [
|
||||
'sortAscending' => ': activate to sort column ascending',
|
||||
'sortDescending' => ': activate to sort column descending',
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Konfiguration für DataTable-Spalten
|
||||
*
|
||||
* "Zuweisen"-Button als zusätzliche Spalte einfügen
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function GetColumns()
|
||||
{
|
||||
// Prüfen ob Spalte mit ID existiert; wird für Zuweisung benötigt
|
||||
$hasIdColumn = false;
|
||||
foreach ($this->columns as $column) {
|
||||
if ($column['data'] === 'id') {
|
||||
$hasIdColumn = true;
|
||||
}
|
||||
}
|
||||
if ($hasIdColumn === false) {
|
||||
throw new RuntimeException('ID-Spalte fehlt. Eine Spalte muss mit "data => id" ausgewiesen sein.');
|
||||
}
|
||||
|
||||
// "Zuweisen"-Button als zusätzliche Spalte einfügen
|
||||
$columns = (array)$this->columns;
|
||||
$columns[] = [
|
||||
'title' => 'Menü',
|
||||
'class' => 'dt-right',
|
||||
'width' => '1%',
|
||||
'data' => null,
|
||||
'sortable' => false,
|
||||
'searchable' => false,
|
||||
'defaultContent' => '',
|
||||
];
|
||||
|
||||
return $columns;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function GetFilter()
|
||||
{
|
||||
if (!is_array($this->filter)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return $this->filter;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string HTML
|
||||
*/
|
||||
public function GetContentHtml()
|
||||
{
|
||||
$html = <<<'HTML'
|
||||
<div class="row">
|
||||
<div class="row-height">
|
||||
<div class="col-md-12 col-md-height">
|
||||
<div class="inside-full-height">
|
||||
<div>
|
||||
<div class="info">Hinweis: Die Druckeraufträge werden automatisch nach 10 Tagen gelöscht.</div>
|
||||
HTML;
|
||||
$html .= $this->GetFilterHtml();
|
||||
$html .= '<form action="./index.php?module=welcome&action=spooler&id=' . $this->printerId . '" method="post">';
|
||||
$html .= $this->GetTableHtml();
|
||||
$html .= <<<'HTML'
|
||||
<fieldset>
|
||||
<legend>Stapelverarbeitung</legend>
|
||||
<label><input type="checkbox" id="markall_trigger"> alle markieren </label>
|
||||
<input type="submit" class="btnBlue" value="ZIP erstellen" name="makezip">
|
||||
<input type="submit" class="btnBlue" value="Sammel-PDF öffnen" name="makepdf">
|
||||
<input type="hidden" name="markall_selection" id="markall_selection">
|
||||
</fieldset>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
HTML;
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
protected function GetFilterHtml()
|
||||
{
|
||||
$html = '';
|
||||
$filter = $this->GetFilter();
|
||||
|
||||
if (!empty($filter)){
|
||||
$html .= '<fieldset>';
|
||||
$html .= '<legend>Filter</legend>';
|
||||
$html .= '<div class="row">';
|
||||
$html .= '<div class="col-md-9">';
|
||||
|
||||
foreach ($filter as $item) {
|
||||
$html .= sprintf(
|
||||
'<label><input type="checkbox" class="spooler-filter-checkbox" data-filter-name="%s" data-filter-column="%s" %s> %s</label>',
|
||||
$item['name'],
|
||||
$item['column'],
|
||||
((bool)$item['active'] === true) ? 'checked="checked"' : '',
|
||||
$item['label']
|
||||
);
|
||||
}
|
||||
$html .= '</div>';
|
||||
$html .= '</fieldset>';
|
||||
}
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
protected function GetTableHtml()
|
||||
{
|
||||
$columns = $this->GetColumns();
|
||||
|
||||
// Tabellenkopf
|
||||
$html = '<table id="downloadspooler-table" class="display" border="0" cellpadding="0" cellspacing="0">';
|
||||
$html .= '<thead><tr>';
|
||||
foreach ($columns as $column) {
|
||||
$html .= '<th>' . $column['title'] . '</th>';
|
||||
}
|
||||
$html .= '</tr></thead>';
|
||||
|
||||
// Tabellenfuß
|
||||
$html .= '<tfoot><tr>';
|
||||
foreach ($columns as $column) {
|
||||
$html .= '<th>' . $column['title'] . '</th>';
|
||||
}
|
||||
$html .= '</tr></tfoot>';
|
||||
$html .= '</table>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function GetAdressenTable()
|
||||
{
|
||||
$filter = [[
|
||||
'active' => true,
|
||||
'label' => 'Nur ungedruckte Dateien',
|
||||
'name' => 'ungedruckt',
|
||||
'column' => 5,
|
||||
'sql' => [
|
||||
'active' => 's.gedruckt = 0',
|
||||
'inactive' => '(s.gedruckt = 1 OR s.gedruckt = 0)',
|
||||
],
|
||||
]];
|
||||
|
||||
$columns = [
|
||||
[
|
||||
'title' => '',
|
||||
'data' => 'id',
|
||||
'visible' => true,
|
||||
'searchable' => false,
|
||||
'orderable' => false,
|
||||
'search' => 's.id',
|
||||
],
|
||||
[
|
||||
'title' => 'Zeit',
|
||||
'data' => 'zeit',
|
||||
'search' => 's.zeitstempel',
|
||||
'class' => 'dt-center',
|
||||
],
|
||||
[
|
||||
'title' => 'Dateiname',
|
||||
'data' => 'dateiname',
|
||||
'search' => 's.filename',
|
||||
'class' => 'dt-left',
|
||||
],
|
||||
[
|
||||
'title' => 'Drucker',
|
||||
'data' => 'drucker',
|
||||
'search' => 'd.name',
|
||||
'class' => 'dt-left',
|
||||
],
|
||||
[
|
||||
'title' => 'Bearbeiter',
|
||||
'data' => 'bearbeiter',
|
||||
'search' => 'a.name',
|
||||
'class' => 'dt-left',
|
||||
],
|
||||
[
|
||||
'title' => 'Gedruckt',
|
||||
'data' => 'gedruckt',
|
||||
'search' => 's.gedruckt',
|
||||
'class' => 'dt-center',
|
||||
],
|
||||
];
|
||||
|
||||
$sqlTemplate =
|
||||
"SELECT
|
||||
SQL_CALC_FOUND_ROWS s.id,
|
||||
DATE_FORMAT(s.zeitstempel,'%d.%m.%Y %H:%i:%s') AS zeit,
|
||||
d.name AS drucker,
|
||||
IF(s.filename != '', s.filename, 'Kein Dateiname vorhanden') AS dateiname,
|
||||
a.name AS bearbeiter,
|
||||
IF(s.gedruckt = 1, 'ja', 'nein') AS gedruckt
|
||||
FROM drucker_spooler AS s
|
||||
LEFT JOIN drucker AS d ON s.drucker = d.id
|
||||
LEFT JOIN `user` AS u ON u.id = s.user
|
||||
LEFT JOIN adresse AS a ON a.id = u.adresse
|
||||
WHERE d.id = {$this->printerId}
|
||||
AND {{where}}
|
||||
ORDER BY {{orderby}}
|
||||
LIMIT {{offset}}, {{limit}}";
|
||||
|
||||
$sqlCount = 'SELECT COUNT(s.id) AS num FROM drucker_spooler AS s WHERE 1';
|
||||
|
||||
return [
|
||||
'sql_template' => $sqlTemplate,
|
||||
'sql_count' => $sqlCount,
|
||||
'columns' => $columns,
|
||||
'filter' => $filter,
|
||||
'order' => [[1, 'desc']],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,201 @@
|
||||
<?php
|
||||
/*
|
||||
**** COPYRIGHT & LICENSE NOTICE *** DO NOT REMOVE ****
|
||||
*
|
||||
* Xentral (c) Xentral ERP Sorftware GmbH, Fuggerstrasse 11, D-86150 Augsburg, * Germany 2019
|
||||
*
|
||||
* This file is licensed under the Embedded Projects General Public License *Version 3.1.
|
||||
*
|
||||
* You should have received a copy of this license from your vendor and/or *along with this file; If not, please visit www.wawision.de/Lizenzhinweis
|
||||
* to obtain the text of the corresponding license version.
|
||||
*
|
||||
**** END OF COPYRIGHT & LICENSE NOTICE *** DO NOT REMOVE ****
|
||||
*/
|
||||
?>
|
||||
<?php
|
||||
|
||||
|
||||
class EasyCalendar {
|
||||
|
||||
var $app;
|
||||
var $year;
|
||||
var $rows;
|
||||
var $dataset;
|
||||
var $headings;
|
||||
var $cells;
|
||||
var $js;
|
||||
var $title;
|
||||
var $monatheading;
|
||||
var $maxcellcount;
|
||||
var $customcellcolor;
|
||||
var $additionalMonthInfo = [];
|
||||
var $holidays = [];
|
||||
function __construct(&$app, $jahr = null)
|
||||
{
|
||||
$this->app = $app;
|
||||
$this->year = date('Y');
|
||||
if($jahr)$this->year = $jahr;
|
||||
$this->sql ="";
|
||||
$this->maxcellcount = 1;
|
||||
$this->customcellcolor = '#0B8092';
|
||||
$this->limit ="";
|
||||
$this->headings[] = '{|Monat|}';
|
||||
for($i = 1; $i <= 31; $i++)$this->headings[] = $i;
|
||||
$this->monatheading = array(1=>'{|Januar|}',2=>'{|Februar|}',3=>'{|März|}',4=>'{|April|}',5=>'{|Mai|}',6=>'{|Juni|}',7=>'{|Juli|}',8=>'{|August|}',9=>'{|September|}',10=>'{|Oktober|}',11=>'{|November|}',12=>'{|Dezember|}');
|
||||
}
|
||||
|
||||
function AddHolidays($holidays){
|
||||
$this->holidays = $holidays;
|
||||
}
|
||||
|
||||
|
||||
function AddCell($datum, $el)
|
||||
{
|
||||
$datumu = strtotime($datum);
|
||||
|
||||
$jahr = (int)date('Y',$datumu);
|
||||
$tag = (int)date('d',$datumu);
|
||||
$monat = (int)date('m',$datumu);
|
||||
$this->cells[$jahr][$monat][$tag][] = $el;
|
||||
}
|
||||
|
||||
function AddOnCellClick($datum, $js)
|
||||
{
|
||||
$datumu = strtotime($datum);
|
||||
|
||||
$jahr = (int)date('Y',$datumu);
|
||||
$tag = (int)date('d',$datumu);
|
||||
$monat = (int)date('m',$datumu);
|
||||
$this->js[$jahr][$monat][$tag] = $js;
|
||||
}
|
||||
|
||||
function AddCellTitle($datum, $title)
|
||||
{
|
||||
$datumu = strtotime($datum);
|
||||
|
||||
$jahr = (int)date('Y',$datumu);
|
||||
$tag = (int)date('d',$datumu);
|
||||
$monat = (int)date('m',$datumu);
|
||||
$this->title[$jahr][$monat][$tag] = $title;
|
||||
}
|
||||
|
||||
function Display($parsetarget,$clickmodule="",$clickaction="",$clicklabel="",$newevent="")
|
||||
{
|
||||
|
||||
$htmltable = new HTMLTable(0,"100%","",3,1);
|
||||
$htmltable->width_headings = $this->width_headings;
|
||||
$htmltable->AddRowAsHeading($this->headings);
|
||||
|
||||
$htmltable->ChangingRowColors('#eee','#eee');
|
||||
|
||||
for($monat = 1; $monat <= 12 ; $monat++)
|
||||
{
|
||||
$htmltable->NewRow();
|
||||
if(isset($row))unset($row);
|
||||
$field = $this->monatheading[$monat];
|
||||
|
||||
if(!empty($this->additionalMonthInfo)){
|
||||
if(isset($this->additionalMonthInfo[$monat])){
|
||||
|
||||
$field = '<table class="vacationDayTable"><tr><td><b>'.$field.'</b></td></tr>';
|
||||
foreach($this->additionalMonthInfo[$monat] as $member){
|
||||
$field.='<tr><td>'.$member.'</td></tr>';
|
||||
}
|
||||
$field .='</table>';
|
||||
}
|
||||
else{
|
||||
$field = '<table class="vacationDayTable"><tr><td><b>'.$field.'</b></td></tr></table>';
|
||||
}
|
||||
}
|
||||
|
||||
$htmltable->AddCellClass('monat');
|
||||
$htmltable->AddCol($field);
|
||||
for($tag = 1; $tag <= 31; $tag++)
|
||||
{
|
||||
$css = 'standard';
|
||||
if(checkdate($monat , $tag , $this->year ))
|
||||
{
|
||||
$kalenderTag = date('w', mktime(0,0,0,$monat,$tag,$this->year));
|
||||
if ($kalenderTag == 0 || $kalenderTag == 6) {
|
||||
$css = 'wochenende';
|
||||
}
|
||||
} else {
|
||||
$css = 'keintag';
|
||||
}
|
||||
|
||||
if(!empty($this->holidays)){
|
||||
$curDate = $this->year.'-'.($monat<10?'0'.$monat:$monat).'-'.($tag<10?'0'.$tag:$tag);
|
||||
if(array_key_exists($curDate,$this->holidays)){
|
||||
$css = 'feiertag';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(is_array($this->cells) && isset($this->cells[$this->year]) && isset($this->cells[$this->year][$monat]) && isset($this->cells[$this->year][$monat][$tag]) && is_array($this->cells[$this->year][$monat][$tag]))
|
||||
{
|
||||
$anz = count($this->cells[$this->year][$monat][$tag]);
|
||||
|
||||
if($this->maxcellcount > 0)
|
||||
{
|
||||
if($anz < 1)
|
||||
{
|
||||
$field = '';
|
||||
}elseif($anz == 1){
|
||||
$field = $this->cells[$this->year][$monat][$tag][0];
|
||||
}elseif($anz <= $this->maxcellcount) {
|
||||
$zelle = '<table>';
|
||||
foreach($this->cells[$this->year][$monat][$tag] as $value)
|
||||
{
|
||||
$zelle .= '<tr><td>'.$value.'</td></tr>';
|
||||
}
|
||||
$zelle .= '</table>';
|
||||
$field = $zelle;
|
||||
} else {
|
||||
$zelle = '<table>';
|
||||
for($i = 0; $i < $this->maxcellcount; $i++)
|
||||
{
|
||||
$zelle .= '<tr><td>'.$this->cells[$this->year][$monat][$tag][$i].'</td></tr>';
|
||||
}
|
||||
$zelle .= '</table>';
|
||||
$field = $zelle;
|
||||
}
|
||||
} else {
|
||||
if($anz)
|
||||
{
|
||||
$field = '<span style="width:100%;display:inline-block;" title="';
|
||||
for($i = 0; $i < $anz; $i++)
|
||||
{
|
||||
if($i > 0)$field .= ', ';
|
||||
$field .= $this->cells[$this->year][$monat][$tag][$i];
|
||||
}
|
||||
|
||||
$field .= '">'.$anz.'</span>';
|
||||
$css = 'custom';
|
||||
}
|
||||
}
|
||||
|
||||
} else
|
||||
{
|
||||
$field = '';
|
||||
}
|
||||
|
||||
if($css)$htmltable->AddCellClass($css);
|
||||
if($css == 'standard'){
|
||||
$htmltable->AddCustomAttributes(['data-day'=>$tag,'data-month'=>$monat,'data-year'=>$this->year]);
|
||||
}
|
||||
if(isset($this->js[$this->year][$monat][$tag]) && $this->js[$this->year][$monat][$tag])$htmltable->AddCellonclick($this->js[$this->year][$monat][$tag]);
|
||||
if(isset($this->title[$this->year][$monat][$tag]) && $this->title[$this->year][$monat][$tag])$htmltable->AddCellTitle($this->title[$this->year][$monat][$tag]);
|
||||
$htmltable->AddCol($field);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$this->app->Tpl->Add($parsetarget,'<div class="easycalendar">');
|
||||
$this->app->Tpl->Add($parsetarget,$htmltable->Get());
|
||||
$this->app->Tpl->Add($parsetarget,'</div>');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,556 @@
|
||||
<?php
|
||||
/*
|
||||
**** COPYRIGHT & LICENSE NOTICE *** DO NOT REMOVE ****
|
||||
*
|
||||
* Xentral (c) Xentral ERP Sorftware GmbH, Fuggerstrasse 11, D-86150 Augsburg, * Germany 2019
|
||||
*
|
||||
* This file is licensed under the Embedded Projects General Public License *Version 3.1.
|
||||
*
|
||||
* You should have received a copy of this license from your vendor and/or *along with this file; If not, please visit www.wawision.de/Lizenzhinweis
|
||||
* to obtain the text of the corresponding license version.
|
||||
*
|
||||
**** END OF COPYRIGHT & LICENSE NOTICE *** DO NOT REMOVE ****
|
||||
*/
|
||||
?>
|
||||
<?php
|
||||
|
||||
|
||||
class EasyTable {
|
||||
/** @var ApplicationCore $app */
|
||||
var $app;
|
||||
/** @var array */
|
||||
var $rows;
|
||||
/** @var array */
|
||||
var $datasets;
|
||||
/** @var array */
|
||||
var $align;
|
||||
/** @var array */
|
||||
var $headings;
|
||||
/** @var array */
|
||||
public $width_headings;
|
||||
/** @var int|string */
|
||||
public $page;
|
||||
|
||||
/**
|
||||
* EasyTable constructor.
|
||||
*
|
||||
* @param ApplicationCore $app
|
||||
*/
|
||||
function __construct($app)
|
||||
{
|
||||
$this->app = $app;
|
||||
$this->sql ='';
|
||||
$this->limit ='';
|
||||
}
|
||||
|
||||
|
||||
function AddRow($rows)
|
||||
{
|
||||
$this->datasets[] = $rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|array $sql
|
||||
* @param string|int $limit
|
||||
* @param string $newevent
|
||||
*/
|
||||
function Query($sql,$limit='',$newevent='')
|
||||
{
|
||||
if(!is_array($sql)) {
|
||||
$this->sql = $sql;
|
||||
$this->limit = $limit;
|
||||
$this->headings = null;
|
||||
|
||||
if($limit != 0){
|
||||
$page = $this->app->Secure->GetGET('page');
|
||||
if(!is_numeric($page)){
|
||||
$page = 1;
|
||||
}
|
||||
|
||||
$this->page = $page;
|
||||
$this->start = ($page - 1) * $this->limit;
|
||||
|
||||
$sql .= " LIMIT {$this->start},{$this->limit}";
|
||||
}
|
||||
$this->searchrow = '';
|
||||
$jsarray = null;
|
||||
if(!empty($this->app->stringcleaner)){
|
||||
$jsarray = $this->app->stringcleaner->CheckSQLHtml($sql);
|
||||
}
|
||||
$this->app->DB->DisableHTMLClearing(true);
|
||||
$this->app->DB->DisableJSClearing(true);
|
||||
$this->datasets = $this->app->DB->SelectArr($sql);
|
||||
$this->app->DB->DisableHTMLClearing(false);
|
||||
$this->app->DB->DisableJSClearing(false);
|
||||
}
|
||||
else {
|
||||
$this->datasets = $sql;
|
||||
}
|
||||
|
||||
if($jsarray && $this->datasets)
|
||||
{
|
||||
foreach($this->datasets as $k => $arr)
|
||||
{
|
||||
$j = 0;
|
||||
foreach($arr as $k2 => $v)
|
||||
{
|
||||
if(isset($jsarray[$j]) && !$jsarray[$j])
|
||||
{
|
||||
$this->datasets[$k][$k2] = strip_tags($v);
|
||||
}elseif(isset($jsarray[$j]) && 1 == $jsarray[$j])
|
||||
{
|
||||
$this->datasets[$k][$k2] = $this->app->stringcleaner->xss_clean($v, false);//CleanString($v, 'nojs', $dummy);
|
||||
}
|
||||
$j++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!empty($this->datasets) && count($this->datasets)>0){
|
||||
foreach($this->datasets[0] as $colkey=>$value)
|
||||
{
|
||||
$this->headings[]=ucfirst($colkey);
|
||||
//$this->searchrow[0][$colkey]="<form action=\"\" method=\"post\"><input type=\"text\" style=\"width:100%; background-color:#fff;\"></form>";
|
||||
}
|
||||
}
|
||||
//$this->searchrow[0][id]="";
|
||||
|
||||
//if(count($this->datasets)>=$limit)
|
||||
// $this->datasets = $this->array_insert($this->datasets,0,$this->searchrow);
|
||||
|
||||
$this->searchrow='';
|
||||
if($newevent!=='noAction')
|
||||
{
|
||||
$this->headings[!empty($this->headings)?(count($this->headings)-1):0] = 'Aktion';
|
||||
$this->width_headings[count($this->headings)-1] = '120px'; //TMP fuer Belegtabelle
|
||||
}
|
||||
|
||||
}
|
||||
// Fügt $value in $array ein, an der Stelle $index
|
||||
function array_insert($array, $index, $value)
|
||||
{
|
||||
return array_merge(array_slice($array, 0, $index), $value, array_slice($array, $index));
|
||||
}
|
||||
|
||||
|
||||
function DisplayWithSort($parsetarget)
|
||||
{
|
||||
|
||||
$htmltable = new HTMLTable(0,"100%","",3,1);
|
||||
$htmltable->width_headings = $this->width_headings;
|
||||
$htmltable->AddRowAsHeading($this->app->Tpl->pruefeuebersetzung($this->headings,'table'));
|
||||
|
||||
$htmltable->ChangingRowColors('#e0e0e0','#fff');
|
||||
|
||||
if(count($this->datasets)>0){
|
||||
foreach($this->datasets as $row){
|
||||
$htmltable->NewRow();
|
||||
foreach($row as $field)
|
||||
$htmltable->AddCol($field);
|
||||
}
|
||||
}
|
||||
$module = $this->app->Secure->GetGET("module");
|
||||
$htmltable->ReplaceCol(count($this->headings),
|
||||
"<a href=\"index.php?module=$module&action=edit&id=%value%\"><img border=\"0\" src=\"./themes/[THEME]/images/edit.svg\"></a>
|
||||
<a href=\"index.php?module=$module&action=delete&id=%value%\"><img border=\"0\" src=\"./themes/[THEME]/images/new.png\"></a>
|
||||
<a href=\"index.php?module=$module&action=delete&id=%value%\"><img border=\"0\" src=\"./themes/[THEME]/images/delete.png\"></a>
|
||||
<a href=\"index.php?module=$module&action=delete&id=%value%\"><img border=\"0\" src=\"./themes/[THEME]/images/up.png\"></a>
|
||||
<a href=\"index.php?module=$module&action=delete&id=%value%\"><img border=\"0\" src=\"./themes/[THEME]/images/down.png\"></a>
|
||||
");
|
||||
|
||||
$this->app->Tpl->Set($parsetarget,$htmltable->Get());
|
||||
}
|
||||
|
||||
function DisplayWithDelivery($parsetarget)
|
||||
{
|
||||
|
||||
$htmltable = new HTMLTable(0,"100%","",3,1);
|
||||
$htmltable->width_headings = $this->width_headings;
|
||||
$htmltable->AddRowAsHeading(array($this->app->Tpl->pruefeuebersetzung('Suchen','table'),'','',''));
|
||||
|
||||
$htmltable->ChangingRowColors('#e0e0e0','#fff');
|
||||
|
||||
if(count($this->datasets)>0){
|
||||
foreach($this->datasets as $row){
|
||||
$htmltable->NewRow();
|
||||
$link="";
|
||||
$cols=0;
|
||||
foreach($row as $key=>$field){
|
||||
if($cols<3){
|
||||
$htmltable->AddCol($field);
|
||||
$cols++;
|
||||
}
|
||||
if($key!="id")
|
||||
$link = $link."window.opener.document.getElementsByName('$key')[0].value='$field';";
|
||||
}
|
||||
$htmltable->AddCol("<input type=\"button\" onclick=\"
|
||||
$link
|
||||
window.close();
|
||||
\" value=\"OK\">
|
||||
");
|
||||
|
||||
}
|
||||
}
|
||||
$module = $this->app->Secure->GetGET("module");
|
||||
/*
|
||||
$htmltable->ReplaceCol(4,
|
||||
"<input type=\"button\" onclick=\"
|
||||
$link
|
||||
window.close();
|
||||
\" value=\"OK\">
|
||||
");
|
||||
*/
|
||||
$this->app->Tpl->Set($parsetarget,$htmltable->Get());
|
||||
}
|
||||
|
||||
|
||||
function DisplayOwn($parsetarget,$click,$limit=30,$idlabel="id",$tmpid="")
|
||||
{
|
||||
$newevent = null;
|
||||
$pages = round(count($this->app->DB->SelectArr($this->sql)) / $this->limit);
|
||||
if($pages==0)$pages=1;
|
||||
|
||||
$module = $this->app->Secure->GetGET("module");
|
||||
$action = $this->app->Secure->GetGET("action");
|
||||
|
||||
if($tmpid>0)
|
||||
$id = $tmpid;
|
||||
else
|
||||
$id = $this->app->Secure->GetGET($idlabel);
|
||||
|
||||
|
||||
if($this->page ==0 || $this->page=="") $this->page = 1;
|
||||
if($this->page <=1) $before = $this->page; else $before=$this->page-1;
|
||||
if($this->page >=$pages) $next = $this->page; else $next=$this->page+1;
|
||||
|
||||
$colmenu = "<table width=\"100%\"><tr><td><a href=\"index.php?module=$module&action={$action}&$idlabel=$id&page=1\"><img border=\"0\" src=\"./themes/[THEME]/images/first.png\"></a>
|
||||
<a href=\"index.php?module=$module&action={$action}&$idlabel=$id&page=".$before."\"><img border=\"0\" src=\"./themes/[THEME]/images/before.png\"></a></td>";
|
||||
|
||||
//for($i=0;($i<$pages && $i< 10);$i++)
|
||||
//{
|
||||
/*
|
||||
if($this->page==($i+1))
|
||||
{
|
||||
$colmenu .= "<td><a href=\"index.php?module=$module&action={$action}&$idlabel=$id&page=".($i+1)."\"><b>".
|
||||
($i+1)."</b></a></td>";
|
||||
} else {
|
||||
$colmenu .= "<td><a href=\"index.php?module=$module&action={$action}&$idlabel=$id&page=".($i+1)."\">".
|
||||
($i+1)."</a></td>";
|
||||
}
|
||||
*/
|
||||
//}
|
||||
$colmenu .= "<td align=center>Seite {$this->page} von $pages</td>";
|
||||
|
||||
$colmenu .= "<td align=right><a href=\"index.php?module=$module&action={$action}&$idlabel=$id&page=".($next)."\"><img border=\"0\" src=\"./themes/[THEME]/images/next.png\"></a>
|
||||
<a href=\"index.php?module=$module&action={$action}&$idlabel=$id&page=$pages\"><img border=\"0\" src=\"./themes/[THEME]/images/last.png\"></a></td></tr></table>";
|
||||
|
||||
$this->app->Tpl->Set($parsetarget,$colmenu);
|
||||
|
||||
$htmltable = new HTMLTable(0,"100%","",3,1);
|
||||
$htmltable->width_headings = $this->width_headings;
|
||||
$htmltable->AddRowAsHeading($this->app->Tpl->pruefeuebersetzung($this->headings,'table'));
|
||||
|
||||
$htmltable->ChangingRowColors('#e0e0e0','#fff');
|
||||
|
||||
|
||||
if(count($this->datasets)>0){
|
||||
foreach($this->datasets as $row){
|
||||
$htmltable->NewRow();
|
||||
foreach($row as $field)
|
||||
$htmltable->AddCol($field);
|
||||
}
|
||||
$module = $this->app->Secure->GetGET("module");
|
||||
if($newevent!="noAction"){
|
||||
$htmltable->ReplaceCol(count($this->headings),$click);
|
||||
}
|
||||
$this->app->Tpl->Add($parsetarget,$htmltable->Get());
|
||||
}
|
||||
else {
|
||||
if($newevent=="noAction") $newevent="";
|
||||
$this->app->Tpl->Set($parsetarget,"<div class=\"info\">Keine Daten vorhanden! $newevent</div>");
|
||||
}
|
||||
/*
|
||||
if(count($this->datasets)>0){
|
||||
foreach($this->datasets as $row){
|
||||
$htmltable->NewRow();
|
||||
foreach($row as $field)
|
||||
$htmltable->AddCol($field);
|
||||
}
|
||||
|
||||
for($i=0;$i<count($menu);$i++)
|
||||
{
|
||||
$menustring .= "<a href=\"index.php?module=$module&action={$menu[$i]}&$idlabel=%value%&id=$id\">{$menu[$i]}</a> ";
|
||||
}
|
||||
|
||||
$htmltable->ReplaceCol(count($this->headings),$menustring);
|
||||
$this->app->Tpl->Add($parsetarget,$htmltable->Get());
|
||||
}
|
||||
else {
|
||||
$this->app->Tpl->Add($parsetarget,"Keine Daten vorhanden!");
|
||||
}
|
||||
*/
|
||||
$this->app->Tpl->Add($parsetarget,$colmenu);
|
||||
}
|
||||
|
||||
|
||||
function DisplayWidthInlineEdit($parsetarget,$click="",$newevent="",$nomenu="false")
|
||||
{
|
||||
$htmltable = new HTMLTable(0,"100%","",3,1);
|
||||
$htmltable->width_headings = $this->width_headings;
|
||||
$htmltable->AddRowAsHeading($this->app->Tpl->pruefeuebersetzung($this->headings,'table'));
|
||||
|
||||
$htmltable->ChangingRowColors('#e0e0e0','#fff');
|
||||
|
||||
if(count($this->datasets)>0){
|
||||
foreach($this->datasets as $row){
|
||||
$htmltable->NewRow();
|
||||
foreach($row as $field)
|
||||
$htmltable->AddCol($field);
|
||||
|
||||
$htmltable->NewRow();
|
||||
|
||||
$start = "<form>";
|
||||
foreach($row as $key=>$field){
|
||||
if($key!="id")
|
||||
$htmltable->AddCol($start."<input type=\"text\" size=\"10\" value=\"$field\">");
|
||||
else
|
||||
$htmltable->AddCol($field."</form>");
|
||||
|
||||
$start="";
|
||||
}
|
||||
}
|
||||
$module = $this->app->Secure->GetGET("module");
|
||||
if($newevent!="noAction"){
|
||||
$htmltable->ReplaceCol(count($this->headings),$click);
|
||||
}
|
||||
$this->app->Tpl->Add($parsetarget,$htmltable->Get(1));
|
||||
}
|
||||
else {
|
||||
$this->app->Tpl->Add($parsetarget,"Keine Daten vorhanden! $newevent");
|
||||
}
|
||||
}
|
||||
|
||||
function DisplayEditable($parsetarget,$click="",$newevent="",$nomenu="false",$arrayEditable="",$editlastrow=false,$nowarp=true)
|
||||
{
|
||||
$module = $this->app->Secure->GetGET("module");
|
||||
$this->app->erp->RunHook('EasyTableDisplayEditableClick', 3, $module, $click, $newevent);
|
||||
$htmltable = new HTMLTable(0,"100%","",3,1);
|
||||
|
||||
if(!$nowarp)$htmltable->nowrap="";
|
||||
// Letzte Spalte aendern
|
||||
if($newevent == "noAction")
|
||||
$this->headings[count($this->headings)-1] = $click;
|
||||
|
||||
$htmltable->width_headings = $this->width_headings;
|
||||
$htmltable->AddRowAsHeading($this->app->Tpl->pruefeuebersetzung($this->headings,'table'));
|
||||
$htmltable->ChangingRowColors('#e0e0e0','#fff');
|
||||
|
||||
$result = '';
|
||||
|
||||
$htmltable->nowrap = array(count($this->headings)-1);
|
||||
|
||||
if(count($this->datasets)>0){
|
||||
foreach($this->datasets as $row){
|
||||
$htmltable->NewRow();
|
||||
foreach($row as $field)
|
||||
$htmltable->AddCol($field);
|
||||
}
|
||||
|
||||
if($newevent!="noAction"){
|
||||
$htmltable->ReplaceCol(count($this->headings),$click);
|
||||
}
|
||||
if($parsetarget=="return")
|
||||
$result .= $htmltable->GetSpecialCSSClasses($arrayEditable,$editlastrow);
|
||||
else
|
||||
{
|
||||
if(is_array($arrayEditable))
|
||||
{
|
||||
$this->app->Tpl->Add($parsetarget,$htmltable->GetSpecialCSSClasses($arrayEditable,$editlastrow,2));
|
||||
}
|
||||
else {
|
||||
if($module=="lieferschein" || $module=="anfrage" || $module=="preisanfrage")
|
||||
$this->app->Tpl->Add($parsetarget,$htmltable->GetSpecialCSSClasses(array(4,5),$editlastrow,1));
|
||||
else if($module==='retoure'){
|
||||
$this->app->Tpl->Add($parsetarget, $htmltable->GetSpecialCSSClasses(array(4, 5, 7, 8, 10), $editlastrow, 1));
|
||||
}
|
||||
else if($module=="produktion")
|
||||
$this->app->Tpl->Add($parsetarget,$htmltable->GetSpecialCSSClasses(array(4),$editlastrow,1));
|
||||
else if($module=="arbeitsnachweis")
|
||||
$this->app->Tpl->Add($parsetarget,$htmltable->GetSpecialCSSClasses(array(2,3,4,5,6),$editlastrow,2));
|
||||
else if($module=="reisekosten")
|
||||
$this->app->Tpl->Add($parsetarget,$htmltable->GetSpecialCSSClasses(array(1,3),$editlastrow,2));
|
||||
else if($module=="kalkulation")
|
||||
$this->app->Tpl->Add($parsetarget,$htmltable->GetSpecialCSSClasses(array(2),$editlastrow,2));
|
||||
else if($module=="inventur")
|
||||
$this->app->Tpl->Add($parsetarget,$htmltable->GetSpecialCSSClasses(array(1,4,5),$editlastrow,2));
|
||||
else if($module=="auftrag" || $module=="rechnung" || $module=="gutschrift"|| $module=="bestellung" || $module=="angebot" || $module=="proformarechnung")
|
||||
{
|
||||
if($module=='bestellung')
|
||||
{
|
||||
$editcols = array(4,5,6,7);
|
||||
}else{
|
||||
$einkaufspreiseerlaubt = false;
|
||||
if($einkaufspreiseerlaubt)
|
||||
{
|
||||
$editcols =array(4,5,6,7,8,9);
|
||||
//$this->app->Tpl->Add($parsetarget,$htmltable->GetSpecialCSSClasses(array(4,5,6,7,8,9),$editlastrow,2));
|
||||
}else{
|
||||
$editcols = array(4,5,6,7,8);
|
||||
//$this->app->Tpl->Add($parsetarget,$htmltable->GetSpecialCSSClasses(array(4,5,6,7,8),$editlastrow,2));
|
||||
}
|
||||
}
|
||||
$clastRow = 2;
|
||||
$this->app->erp->RunHook('EasyTableDisplayEditable', 4, $module, $editcols, $editlastrow,$clastRow);
|
||||
$this->app->Tpl->Add($parsetarget,$htmltable->GetSpecialCSSClasses($editcols,$editlastrow,$clastRow));
|
||||
}
|
||||
else
|
||||
{
|
||||
$editcols = array(4,5,6);
|
||||
$clastRow = 2;
|
||||
$this->app->erp->RunHook('EasyTableDisplayEditable', 4, $module, $editcols, $editlastrow, $clastRow);
|
||||
$this->app->Tpl->Add($parsetarget,$htmltable->GetSpecialCSSClasses($editcols,$editlastrow,$clastRow));
|
||||
}
|
||||
//$this->app->Tpl->Add($parsetarget,$htmltable->GetSpecialCSSClasses(array(4,5,6),$editlastrow,2));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if($newevent=="noAction") $newevent="";
|
||||
|
||||
if($parsetarget=="return")
|
||||
$result .= "<div class=\"info\">Keine Daten vorhanden! $newevent</div>";
|
||||
else
|
||||
$this->app->Tpl->Set($parsetarget,"<div class=\"info\">Keine Daten vorhanden! $newevent</div>");
|
||||
}
|
||||
|
||||
if($parsetarget=="return") return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $parsetarget
|
||||
* @param string $click
|
||||
* @param string $newevent
|
||||
* @param string $nomenu
|
||||
* @param int $columns
|
||||
* @param int $rows
|
||||
* @param bool $nowrap
|
||||
*
|
||||
* @return string|void
|
||||
*/
|
||||
function DisplayNew($parsetarget,$click='',$newevent='',$nomenu='false',$columns=0,$rows=0,$nowrap=true)
|
||||
{
|
||||
$result = '';
|
||||
$secondline = isset($this->secondline)?$this->secondline:false;
|
||||
$htmltable = new HTMLTable(0,"99.9%","",3,1,"font-size: 90%; ");
|
||||
|
||||
if(!$nowrap) $htmltable->nowrap="";
|
||||
if($secondline) {
|
||||
unset($this->headings[count($this->headings)-1]);
|
||||
}
|
||||
// Letzte Spalte aendern
|
||||
if($newevent === 'noAction'){
|
||||
$this->headings[count($this->headings) - 1] = $click;
|
||||
}
|
||||
|
||||
$htmltable->width_headings = isset($this->width_headings)?$this->width_headings:null;
|
||||
$htmltable->AddRowAsHeading($this->app->Tpl->pruefeuebersetzung($this->headings,'table'));
|
||||
$htmltable->ChangingRowColors('#e0e0e0','#fff');
|
||||
|
||||
if(!empty($this->datasets) && count($this->datasets)>0){
|
||||
$rowcounter=0;
|
||||
foreach($this->datasets as $row){
|
||||
$htmltable->NewRow();
|
||||
$aligncounter=0;
|
||||
$c = 0;
|
||||
$crow = count($row);
|
||||
$_field = '';
|
||||
foreach($row as $field)
|
||||
{
|
||||
$c++;
|
||||
if($c < $crow || !$secondline) {
|
||||
if (isset($this->align[$aligncounter]))
|
||||
$htmltable->AddCol($field, $this->align[$aligncounter]);
|
||||
else
|
||||
$htmltable->AddCol($field);
|
||||
$aligncounter++;
|
||||
}elseif($secondline)$_field = $field;
|
||||
}
|
||||
if($secondline)
|
||||
{
|
||||
$htmltable->NewRow();
|
||||
$htmltable->AddCol('','','',$crow-1);
|
||||
$htmltable->NewRow();
|
||||
$field = $_field;
|
||||
if (isset($this->align[$aligncounter]))
|
||||
$htmltable->AddCol($field, $this->align[$aligncounter],'',$crow-1);
|
||||
else
|
||||
$htmltable->AddCol($field,'','',$crow-1);
|
||||
}
|
||||
$rowcounter++;
|
||||
}
|
||||
|
||||
if($rowcounter<=$rows){
|
||||
for($rowcounter;$rows > $rowcounter;$rowcounter++)
|
||||
{
|
||||
$htmltable->NewRow();
|
||||
for($i_c=0;$i_c<$columns;$i_c++)
|
||||
$htmltable->AddCol('');
|
||||
}
|
||||
}
|
||||
|
||||
$module = $this->app->Secure->GetGET("module");
|
||||
if($newevent!="noAction"){
|
||||
$htmltable->ReplaceCol(count($this->headings),$click);
|
||||
}
|
||||
if($parsetarget=="return")
|
||||
$result .= $htmltable->Get($secondline?3:false);
|
||||
else
|
||||
$this->app->Tpl->Add($parsetarget,$htmltable->Get($secondline?3:false));
|
||||
}
|
||||
else {
|
||||
if($newevent=="noAction") $newevent="";
|
||||
if($newevent=="Menü") $newevent="";
|
||||
|
||||
if($parsetarget=="return")
|
||||
$result .= "<div class=\"info\">Keine Daten vorhanden! $newevent</div>";
|
||||
else
|
||||
$this->app->Tpl->Set($parsetarget,"<div class=\"info\">Keine Daten vorhanden! $newevent</div>");
|
||||
}
|
||||
|
||||
if($parsetarget=="return") return $result;
|
||||
}
|
||||
|
||||
function Display($parsetarget,$clickmodule="",$clickaction="",$clicklabel="",$newevent="")
|
||||
{
|
||||
|
||||
$htmltable = new HTMLTable(0,"100%","",3,1);
|
||||
$htmltable->width_headings = $this->width_headings;
|
||||
$htmltable->AddRowAsHeading($this->app->Tpl->pruefeuebersetzung($this->headings,'table'));
|
||||
|
||||
$htmltable->ChangingRowColors('#e0e0e0','#fff');
|
||||
|
||||
if(count($this->datasets)>0){
|
||||
foreach($this->datasets as $row){
|
||||
$htmltable->NewRow();
|
||||
foreach($row as $field)
|
||||
$htmltable->AddCol($field);
|
||||
}
|
||||
$module = $this->app->Secure->GetGET("module");
|
||||
if($clickaction=="") {
|
||||
$htmltable->ReplaceCol(count($this->headings),
|
||||
"<a href=\"index.php?module=$module&action=edit&id=%value%\" alt=\"edit\"><img border=\"0\" src=\"./themes/[THEME]/images/edit.svg\"></a>
|
||||
<!--<a href=\"index.php?module=$module&action=copy&id=%value%\">copy</a>-->
|
||||
<a href=\"index.php?module=$module&action=delete&id=%value%\" alt=\"del\"><img border=\"0\" src=\"./themes/[THEME]/images/delete.svg\"></a>");
|
||||
} else {
|
||||
$htmltable->ReplaceCol(count($this->headings),
|
||||
"<a href=\"index.php?module=$clickmodule&action=$clickaction&id=%value%\">$clicklabel</a>");
|
||||
|
||||
}
|
||||
$this->app->Tpl->Add($parsetarget,$htmltable->Get());
|
||||
}
|
||||
else {
|
||||
$this->app->Tpl->Add($parsetarget,"Keine Daten vorhanden! $newevent");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,968 @@
|
||||
<?php
|
||||
/*
|
||||
**** COPYRIGHT & LICENSE NOTICE *** DO NOT REMOVE ****
|
||||
*
|
||||
* Xentral (c) Xentral ERP Sorftware GmbH, Fuggerstrasse 11, D-86150 Augsburg, * Germany 2019
|
||||
*
|
||||
* This file is licensed under the Embedded Projects General Public License *Version 3.1.
|
||||
*
|
||||
* You should have received a copy of this license from your vendor and/or *along with this file; If not, please visit www.wawision.de/Lizenzhinweis
|
||||
* to obtain the text of the corresponding license version.
|
||||
*
|
||||
**** END OF COPYRIGHT & LICENSE NOTICE *** DO NOT REMOVE ****
|
||||
*/
|
||||
?>
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Class FileTable
|
||||
*
|
||||
* @todo Berechtigungen prüfen
|
||||
*/
|
||||
class FileTable
|
||||
{
|
||||
/** @var array $validTypes */
|
||||
protected static $validTypes = ['adressen', 'bestellung', 'kasse', 'reisekosten', 'verbindlichkeit'];
|
||||
|
||||
/** @var erpooSystem $app */
|
||||
protected $app;
|
||||
|
||||
/** @var string $type */
|
||||
protected $type;
|
||||
|
||||
/** @var int $fileId */
|
||||
protected $fileId;
|
||||
|
||||
/** @var array $columns */
|
||||
protected $columns = [];
|
||||
|
||||
/** @var array $filter */
|
||||
protected $filter = [];
|
||||
|
||||
/** @var array $order Initiale Sortierung */
|
||||
protected $order = [[0, 'asc']];
|
||||
|
||||
/** @var string $sqlTemplate */
|
||||
protected $sqlTemplate = '';
|
||||
|
||||
/** @var string $sqlCount */
|
||||
protected $sqlCount = '';
|
||||
|
||||
/**
|
||||
* @param erpooSystem $app
|
||||
* @param string $documentType
|
||||
* @param int $fileId
|
||||
*/
|
||||
public function __construct($app, $documentType, $fileId)
|
||||
{
|
||||
$this->app = $app;
|
||||
$this->fileId = (int)$fileId;
|
||||
$this->type = strtolower($documentType);
|
||||
|
||||
$this->Init();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
protected function Init()
|
||||
{
|
||||
switch ($this->type) {
|
||||
case 'adressen':
|
||||
$table = $this->GetAdressenTable();
|
||||
break;
|
||||
|
||||
case 'bestellung':
|
||||
$table = $this->GetBestellungenTable();
|
||||
break;
|
||||
|
||||
case 'kasse':
|
||||
$table = $this->GetKassenbuchTable();
|
||||
break;
|
||||
|
||||
case 'reisekosten':
|
||||
$table = $this->GetReisekostenTable();
|
||||
break;
|
||||
|
||||
case 'verbindlichkeit':
|
||||
$table = $this->GetVerbindlichkeitenTable();
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new RuntimeException(sprintf(
|
||||
'Type "%s" is not valid. Valid types are: %s', $this->type, implode(', ', self::$validTypes)
|
||||
));
|
||||
break;
|
||||
}
|
||||
|
||||
$this->sqlTemplate = $table['sql_template'];
|
||||
$this->sqlCount = $table['sql_count'];
|
||||
$this->columns = $table['columns'];
|
||||
$this->filter = $table['filter'];
|
||||
$this->order = $table['order'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $filterParams
|
||||
* @param string|null $searchQuery Suchbegriff
|
||||
* @param int $orderCol Spalten-Index
|
||||
* @param string $orderDir [asc|desc]
|
||||
* @param int $offset
|
||||
* @param int $limit
|
||||
* @param int $draw
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function GetData(
|
||||
$filterParams = [],
|
||||
$searchQuery = null,
|
||||
$orderCol = 0,
|
||||
$orderDir = 'asc',
|
||||
$offset = 0,
|
||||
$limit = 10,
|
||||
$draw = 1
|
||||
)
|
||||
{
|
||||
$where = '';
|
||||
|
||||
// Suche
|
||||
if ($searchQuery !== null){
|
||||
$searchParts = [];
|
||||
foreach ($this->columns as $column) {
|
||||
if (!isset($column['search'])) {
|
||||
continue;
|
||||
}
|
||||
$searchParts[] = sprintf(' %s LIKE \'%%%s%%\' ', $column['search'], $searchQuery);
|
||||
}
|
||||
$where .= ' AND (' . implode(' OR ', $searchParts) .') ';
|
||||
}
|
||||
|
||||
// Filter
|
||||
if (!empty($filterParams)) {
|
||||
foreach ($filterParams as $filterName => $filterActive) {
|
||||
$where .= $this->GenerateFilterSql($filterName, $filterActive);
|
||||
}
|
||||
}
|
||||
|
||||
// Sortierung
|
||||
$orderColumnName = array_column($this->columns, 'data')[$orderCol];
|
||||
$orderDirection = strtolower($orderDir) === 'desc' ? 'DESC' : 'ASC';
|
||||
$orderBy = !empty($orderColumnName) ? $orderColumnName . ' ' . $orderDirection . ' ' : '';
|
||||
|
||||
// SQL zusammenbauen
|
||||
$sql = $this->sqlTemplate;
|
||||
$sql = str_replace(
|
||||
['{{limit}}', '{{offset}}', '{{where}}', '{{orderby}}'],
|
||||
[(int)$limit, (int)$offset, $where, $orderBy],
|
||||
$sql
|
||||
);
|
||||
|
||||
// Ergebnisse abrufen
|
||||
$result = $this->app->DB->SelectArr($sql);
|
||||
$countFiltered = $this->app->DB->Select('SELECT FOUND_ROWS()');
|
||||
$countTotal = $this->app->DB->Select($this->sqlCount);
|
||||
|
||||
return [
|
||||
'draw' => (int)$draw,
|
||||
'recordsTotal' => (int)$countTotal,
|
||||
'recordsFiltered' => (int)$countFiltered,
|
||||
'data' => (array)$result,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $filtername
|
||||
* @param bool $active
|
||||
*
|
||||
* @return string Filter-SQL
|
||||
*/
|
||||
protected function GenerateFilterSql($filtername, $active = false)
|
||||
{
|
||||
foreach ($this->GetFilter() as $item) {
|
||||
if ($item['name'] === $filtername) {
|
||||
return (bool)$active ? $item['sql']['active'] : $item['sql']['inactive'];
|
||||
}
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter für DataTable-Einstellungen
|
||||
*
|
||||
* @param string $ajaxUrl
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function GetSettings($ajaxUrl)
|
||||
{
|
||||
return [
|
||||
'ajax' => $ajaxUrl,
|
||||
'columns' => $this->GetColumns(),
|
||||
'order' => $this->order,
|
||||
'processing' => true,
|
||||
'serverSide' => true,
|
||||
'responsive' => true,
|
||||
'autoWidth' => true,
|
||||
'paging' => true,
|
||||
'language' => [
|
||||
'decimal' => ',',
|
||||
'thousands' => '.',
|
||||
'paginate' => [
|
||||
'first' => 'Erste',
|
||||
'last' => 'Letzte',
|
||||
'next' => '>>',
|
||||
'previous' => '<<',
|
||||
],
|
||||
'emptyTable' => 'Keine Daten vorhanden',
|
||||
'info' => 'Zeige _START_ bis _END_ von _TOTAL_ Einträgen',
|
||||
'infoEmpty' => 'Zeige 0 bis 0 von 0 Einträge',
|
||||
'infoFiltered' => '(gefiltert von _MAX_ Einträgen)',
|
||||
'infoPostFix' => '',
|
||||
'lengthMenu' => '_MENU_ Einträge pro Seite',
|
||||
'loadingRecords' => 'Loading...',
|
||||
'processing' => '',
|
||||
'search' => 'Suche:',
|
||||
'searchPlaceholder' => '',
|
||||
'zeroRecords' => 'Keine Einträge gefunden',
|
||||
'aria' => [
|
||||
'sortAscending' => ': activate to sort column ascending',
|
||||
'sortDescending' => ': activate to sort column descending',
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Konfiguration für DataTable-Spalten
|
||||
*
|
||||
* "Zuweisen"-Button als zusätzliche Spalte einfügen
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function GetColumns()
|
||||
{
|
||||
// Prüfen ob Spalte mit ID existiert; wird für Zuweisung benötigt
|
||||
$hasIdColumn = false;
|
||||
foreach ($this->columns as $column) {
|
||||
if ($column['data'] === 'id') {
|
||||
$hasIdColumn = true;
|
||||
}
|
||||
}
|
||||
if ($hasIdColumn === false) {
|
||||
throw new RuntimeException('ID-Spalte fehlt. Eine Spalte muss mit "data => id" ausgewiesen sein.');
|
||||
}
|
||||
|
||||
// "Zuweisen"-Button als zusätzliche Spalte einfügen
|
||||
$columns = (array)$this->columns;
|
||||
$columns[] = [
|
||||
'title' => 'Menü',
|
||||
'class' => 'dt-center',
|
||||
'data' => null,
|
||||
'sortable' => false,
|
||||
'searchable' => false,
|
||||
'defaultContent' => sprintf(
|
||||
'<a href="#" class="document-assign-action" title="Datei zuweisen">' .
|
||||
'<img src="themes/%s/images/forward.svg" align="center" alt="Datei zuweisen">' .
|
||||
'</a>',
|
||||
$this->app->Conf->WFconf['defaulttheme']),
|
||||
];
|
||||
|
||||
return $columns;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function GetFilter()
|
||||
{
|
||||
if (!is_array($this->filter)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return $this->filter;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function GetTabsHtml()
|
||||
{
|
||||
return
|
||||
'<div id="filetabs">
|
||||
<ul>
|
||||
<li data-type="verbindlichkeit"><a href="#verbindlichkeit-tab">Verbindlichkeiten</a></li>
|
||||
<li data-type="kasse"><a href="#kasse-tab">Kassenbuch</a></li>
|
||||
<li data-type="reisekosten"><a href="#reisekosten-tab">Reisekosten</a></li>
|
||||
<li data-type="bestellung"><a href="#bestellung-tab">Bestellungen</a></li>
|
||||
<li data-type="adressen"><a href="#adressen-tab">Adressen</a></li>
|
||||
</ul>
|
||||
<div id="adressen-tab"></div>
|
||||
<div id="bestellung-tab"></div>
|
||||
<div id="kasse-tab"></div>
|
||||
<div id="reisekosten-tab"></div>
|
||||
<div id="verbindlichkeit-tab"></div>
|
||||
</div>';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function GetTabContentHtml()
|
||||
{
|
||||
// Prüfen ob Modul vorhanden ist
|
||||
if (in_array($this->type, ['kasse', 'reisekosten', 'verbindlichkeit'], true)) {
|
||||
$moduleName = $this->type;
|
||||
if ($this->type === 'adressen') {
|
||||
$moduleName = 'adresse';
|
||||
}
|
||||
if(!$this->app->erp->ModulVorhanden($moduleName)){
|
||||
$html = '<div class="module-disabled">';
|
||||
$html .= sprintf(
|
||||
'<div class="info">Das Modul "%s" ist nicht vorhanden.</div>',
|
||||
ucfirst($moduleName)
|
||||
);
|
||||
$html .= '</div>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
}
|
||||
|
||||
$html = '<div class="document-table-container">';
|
||||
$html .= $this->GetFilterHtml();
|
||||
$html .= $this->GetTableHtml();
|
||||
$html .= '</div>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
protected function GetFilterHtml()
|
||||
{
|
||||
$html = '';
|
||||
$filter = $this->GetFilter();
|
||||
|
||||
if (!empty($filter)){
|
||||
$html .= '<fieldset>';
|
||||
$html .= '<legend>Filter</legend>';
|
||||
$html .= '<div class="row">';
|
||||
$html .= '<div class="col-md-9">';
|
||||
|
||||
foreach ($filter as $item) {
|
||||
$html .= sprintf(
|
||||
'<label><input type="checkbox" class="document-filter-checkbox" data-filter-name="%s" data-filter-column="%s" %s> %s</label>',
|
||||
$item['name'],
|
||||
$item['column'],
|
||||
((bool)$item['active'] === true) ? 'checked="checked"' : '',
|
||||
$item['label']
|
||||
);
|
||||
}
|
||||
$html .= '</div>';
|
||||
|
||||
if ($this->type === 'verbindlichkeit') {
|
||||
$html .= '<div class="col-md-3">';
|
||||
$html .= '<input type="button" class="btnGreen create-liability-button" value="Verbindlichkeit anlegen">';
|
||||
$html .= '</div>';
|
||||
}
|
||||
|
||||
$html .= '</fieldset>';
|
||||
}
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
protected function GetTableHtml()
|
||||
{
|
||||
$columns = $this->GetColumns();
|
||||
|
||||
// Tabellenkopf
|
||||
$html = '<table class="display" border="0" cellpadding="0" cellspacing="0">';
|
||||
$html .= '<thead><tr>';
|
||||
foreach ($columns as $column) {
|
||||
$html .= '<th>' . $column['title'] . '</th>';
|
||||
}
|
||||
$html .= '</tr></thead>';
|
||||
|
||||
// Tabellenfuß
|
||||
$html .= '<tfoot><tr>';
|
||||
foreach ($columns as $column) {
|
||||
$html .= '<th>' . $column['title'] . '</th>';
|
||||
}
|
||||
$html .= '</tr></tfoot>';
|
||||
$html .= '</table>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function GetAdressenTable()
|
||||
{
|
||||
$filter = [[
|
||||
'active' => true,
|
||||
'label' => 'Nur Adressen ohne Dateien',
|
||||
'name' => 'dateianzahl',
|
||||
'column' => 8,
|
||||
'sql' => [
|
||||
'active' => ' AND dateien.anzahl IS NULL ',
|
||||
'inactive' => '',
|
||||
],
|
||||
]];
|
||||
|
||||
$columns = [
|
||||
[
|
||||
'title' => '',
|
||||
'data' => 'id',
|
||||
'visible' => false,
|
||||
'searchable' => false,
|
||||
],
|
||||
[
|
||||
'title' => 'Name',
|
||||
'data' => 'name',
|
||||
'search' => 'a.name',
|
||||
'class' => 'dt-left',
|
||||
],
|
||||
[
|
||||
'title' => 'Kunde',
|
||||
'data' => 'kundennummer',
|
||||
'search' => 'a.kundennummer',
|
||||
'class' => 'dt-center',
|
||||
],
|
||||
[
|
||||
'title' => 'Lieferant',
|
||||
'data' => 'lieferantennummer',
|
||||
'search' => 'a.lieferantennummer',
|
||||
'class' => 'dt-center',
|
||||
],
|
||||
[
|
||||
'title' => 'Land',
|
||||
'data' => 'land',
|
||||
'search' => 'a.land',
|
||||
'class' => 'dt-left',
|
||||
],
|
||||
[
|
||||
'title' => 'PLZ',
|
||||
'data' => 'plz',
|
||||
'search' => 'a.plz',
|
||||
'class' => 'dt-left',
|
||||
],
|
||||
[
|
||||
'title' => 'Ort',
|
||||
'data' => 'ort',
|
||||
'search' => 'a.ort',
|
||||
'class' => 'dt-left',
|
||||
],
|
||||
[
|
||||
'title' => 'Projekt',
|
||||
'data' => 'projekt',
|
||||
'search' => 'p.name',
|
||||
'class' => 'dt-left',
|
||||
],
|
||||
[
|
||||
'title' => 'Dateien',
|
||||
'data' => 'dateianzahl',
|
||||
'class' => 'dt-center',
|
||||
'defaultContent' => 0,
|
||||
],
|
||||
];
|
||||
|
||||
$sqlTemplate =
|
||||
"SELECT SQL_CALC_FOUND_ROWS a.id,
|
||||
CONCAT(a.name, IF(a.ansprechpartner != '', '<br><i style=color:#999>',''), a.ansprechpartner, IF(a.ansprechpartner != '', '</i>', '')) AS name,
|
||||
if(a.kundennummer!='',a.kundennummer,'-') AS kundennummer,
|
||||
if(a.lieferantennummer!='',a.lieferantennummer,'-') AS lieferantennummer,
|
||||
a.land AS land,
|
||||
a.plz AS plz,
|
||||
a.ort AS ort,
|
||||
p.abkuerzung AS projekt,
|
||||
dateien.anzahl AS dateianzahl
|
||||
FROM adresse AS a
|
||||
LEFT JOIN projekt AS p ON p.id = a.projekt
|
||||
LEFT JOIN (
|
||||
SELECT ds.parameter AS adresse_id, COUNT(ds.datei) AS anzahl
|
||||
FROM datei_stichwoerter AS ds
|
||||
WHERE ds.objekt LIKE 'Adressen'
|
||||
GROUP BY ds.parameter, ds.objekt
|
||||
) AS dateien ON dateien.adresse_id = a.id
|
||||
WHERE a.geloescht = 0 " . $this->app->erp->ProjektRechte('p.id', true, 'a.vertrieb') . '
|
||||
{{where}}
|
||||
ORDER BY {{orderby}}
|
||||
LIMIT {{offset}}, {{limit}}';
|
||||
|
||||
$sqlCount =
|
||||
'SELECT COUNT(a.id) AS num FROM adresse a
|
||||
LEFT JOIN projekt p ON p.id = a.projekt
|
||||
WHERE a.geloescht = 0 ' . $this->app->erp->ProjektRechte('p.id', true, 'a.vertrieb');
|
||||
|
||||
return [
|
||||
'sql_count' => $sqlCount,
|
||||
'sql_template' => $sqlTemplate,
|
||||
'columns' => $columns,
|
||||
'filter' => $filter,
|
||||
'order' => [[1, 'asc']],
|
||||
];
|
||||
}
|
||||
|
||||
protected function GetBestellungenTable()
|
||||
{
|
||||
$filter = [[
|
||||
'active' => true,
|
||||
'label' => 'Nur Bestellungen ohne Dateien',
|
||||
'name' => 'dateianzahl',
|
||||
'column' => 9,
|
||||
'sql' => [
|
||||
'active' => ' AND dateien.anzahl IS NULL ',
|
||||
'inactive' => '',
|
||||
],
|
||||
]];
|
||||
|
||||
$columns = [
|
||||
[
|
||||
'title' => '',
|
||||
'data' => 'id',
|
||||
'searchable' => false,
|
||||
'visible' => false,
|
||||
],
|
||||
[
|
||||
'title' => 'Bestellung',
|
||||
'data' => 'belegnr',
|
||||
'search' => 'b.belegnr',
|
||||
'class' => 'dt-left',
|
||||
],
|
||||
[
|
||||
'title' => 'Vom',
|
||||
'data' => 'vom',
|
||||
'search' => 'DATE_FORMAT(b.datum, "%d.%m.%Y")',
|
||||
'class' => 'dt-center',
|
||||
],
|
||||
[
|
||||
'title' => 'Lf-Nr.',
|
||||
'data' => 'lieferantennummer',
|
||||
'search' => 'adr.lieferantennummer',
|
||||
'class' => 'dt-left',
|
||||
],
|
||||
[
|
||||
'title' => 'Lieferant',
|
||||
'data' => 'lieferant',
|
||||
'search' => 'CONCAT(b.name, " ", b.internebezeichnung)',
|
||||
'class' => 'dt-left',
|
||||
],
|
||||
[
|
||||
'title' => 'Land',
|
||||
'data' => 'land',
|
||||
'search' => 'b.land',
|
||||
'class' => 'dt-left',
|
||||
],
|
||||
[
|
||||
'title' => 'Projekt',
|
||||
'data' => 'projekt',
|
||||
'search' => 'p.name',
|
||||
'class' => 'dt-left',
|
||||
],
|
||||
[
|
||||
'title' => 'Betrag (brutto)',
|
||||
'data' => 'summe',
|
||||
'search' => $this->app->erp->FormatPreis('b.gesamtsumme',2),
|
||||
'class' => 'dt-right',
|
||||
],
|
||||
[
|
||||
'title' => 'Status',
|
||||
'data' => 'status',
|
||||
'search' => 'b.status',
|
||||
'class' => 'dt-center',
|
||||
],
|
||||
[
|
||||
'title' => 'Dateien',
|
||||
'data' => 'dateianzahl',
|
||||
'class' => 'dt-center',
|
||||
'defaultContent' => 0,
|
||||
],
|
||||
];
|
||||
|
||||
$extended_mysql55 = ", 'de_DE'";
|
||||
|
||||
$sqlTemplate =
|
||||
"SELECT SQL_CALC_FOUND_ROWS b.id,
|
||||
IF(b.status = 'storniert', CONCAT(b.belegnr), b.belegnr) AS belegnr,
|
||||
IF(b.status = 'storniert', CONCAT(DATE_FORMAT(b.datum,'%d.%m.%Y')), DATE_FORMAT(b.datum,'%d.%m.%Y')) AS vom,
|
||||
IF(b.status = 'storniert', CONCAT(adr.lieferantennummer), adr.lieferantennummer) AS lieferantennummer,
|
||||
IF(b.status = 'storniert', CONCAT(" . $this->app->erp->MarkerUseredit("b.name", "b.useredittimestamp") . ", IF(b.internebezeichnung != '', CONCAT('<br><i style=color:#999>', b.internebezeichnung, '</i>'), '')), CONCAT(" . $this->app->erp->MarkerUseredit("b.name", "b.useredittimestamp") . ", IF(b.internebezeichnung != '', CONCAT('<br><i style=color:#999>', b.internebezeichnung, '</i>'), ''))) AS lieferant,
|
||||
IF(b.status = 'storniert', CONCAT(b.land), b.land) AS land,
|
||||
IF(b.status = 'storniert', CONCAT(p.abkuerzung), p.abkuerzung) AS projekt,
|
||||
IF(b.status = 'storniert', CONCAT(FORMAT(b.gesamtsumme, 2{$extended_mysql55})), FORMAT(b.gesamtsumme, 2{$extended_mysql55})) AS summe,
|
||||
IF(b.status = 'storniert', CONCAT('<font color=red>', UPPER(b.status), '</font>'), UPPER(b.status)) AS status,
|
||||
dateien.anzahl AS dateianzahl
|
||||
FROM bestellung AS b
|
||||
LEFT JOIN projekt AS p ON p.id = b.projekt
|
||||
LEFT JOIN adresse AS adr ON b.adresse = adr.id
|
||||
LEFT JOIN (
|
||||
SELECT ds.parameter AS bestellung_id, COUNT(ds.datei) AS anzahl
|
||||
FROM datei_stichwoerter AS ds
|
||||
WHERE ds.objekt LIKE 'Bestellung'
|
||||
GROUP BY ds.parameter, ds.objekt
|
||||
) AS dateien ON dateien.bestellung_id = b.id
|
||||
WHERE b.id != '' AND b.status != 'angelegt' " . $this->app->erp->ProjektRechte() . '
|
||||
{{where}}
|
||||
ORDER BY {{orderby}}
|
||||
LIMIT {{offset}}, {{limit}}';
|
||||
|
||||
$sqlCount =
|
||||
'SELECT COUNT(b.id) AS num
|
||||
FROM bestellung AS b
|
||||
LEFT JOIN projekt AS p ON p.id = b.projekt
|
||||
WHERE b.status != \'angelegt\' ' . $this->app->erp->ProjektRechte();
|
||||
|
||||
return [
|
||||
'sql_count' => $sqlCount,
|
||||
'sql_template' => $sqlTemplate,
|
||||
'columns' => $columns,
|
||||
'filter' => $filter,
|
||||
'order' => [[1, 'desc']],
|
||||
];
|
||||
}
|
||||
|
||||
protected function GetKassenbuchTable()
|
||||
{
|
||||
$filter = [[
|
||||
'active' => true,
|
||||
'label' => 'Nur Kassenbuch-Einträge ohne Dateien',
|
||||
'name' => 'dateianzahl',
|
||||
'column' => 8,
|
||||
'sql' => [
|
||||
'active' => ' AND dateien.anzahl IS NULL ',
|
||||
'inactive' => '',
|
||||
],
|
||||
]];
|
||||
|
||||
$columns = [
|
||||
[
|
||||
'title' => '',
|
||||
'data' => 'id',
|
||||
'searchable' => false,
|
||||
'visible' => false,
|
||||
],
|
||||
[
|
||||
'title' => 'Nr.',
|
||||
'data' => 'nummer',
|
||||
'search' => 'k.nummer',
|
||||
'class' => 'dt-left',
|
||||
],
|
||||
[
|
||||
'title' => 'Kasse',
|
||||
'data' => 'bezeichnung',
|
||||
'search' => 'kon.bezeichnung',
|
||||
'class' => 'dt-left',
|
||||
],
|
||||
[
|
||||
'title' => 'Datum',
|
||||
'data' => 'datum',
|
||||
'search' => 'DATE_FORMAT(k.datum, "%d.%m.%Y")',
|
||||
'class' => 'dt-center',
|
||||
],
|
||||
[
|
||||
'title' => 'Firma',
|
||||
'data' => 'firmenname',
|
||||
'search' => 'a.name',
|
||||
'class' => 'dt-center',
|
||||
],
|
||||
[
|
||||
'title' => 'Name/Verwendungszweck',
|
||||
'data' => 'verwendungszweck',
|
||||
'search' => 'k.grund',
|
||||
'class' => 'dt-left',
|
||||
],
|
||||
[
|
||||
'title' => 'Konto',
|
||||
'data' => 'kontoname',
|
||||
'search' => 'CONCAT(k.sachkonto, " ", ko.beschriftung)',
|
||||
'class' => 'dt-left',
|
||||
],
|
||||
[
|
||||
'title' => 'Projekt',
|
||||
'data' => 'projekt',
|
||||
'search' => 'p.abkuerzung',
|
||||
'class' => 'dt-left',
|
||||
],
|
||||
[
|
||||
'title' => 'Dateien',
|
||||
'data' => 'dateianzahl',
|
||||
'class' => 'dt-center',
|
||||
'defaultContent' => 0,
|
||||
],
|
||||
];
|
||||
|
||||
// SQL statement
|
||||
$sqlTemplate =
|
||||
"SELECT SQL_CALC_FOUND_ROWS k.id,
|
||||
k.nummer,
|
||||
kon.bezeichnung,
|
||||
IF(k.wert < 0, CONCAT('<font color=red>', DATE_FORMAT(k.datum,'%d.%m.%Y'), '</font>'), DATE_FORMAT(k.datum,'%d.%m.%Y')) AS datum,
|
||||
a.name AS firmenname,
|
||||
CONCAT(
|
||||
k.grund,
|
||||
IF(k.adresse > 0, CONCAT(' (',if(a.kundennummer != '', a.kundennummer, a.mitarbeiternummer), ' ', a.name, ')<br>'), '<br>'),
|
||||
IF(k.storniert_grund != '', CONCAT('<i style=color:#999>', k.storniert_grund, '</i>'), '')
|
||||
) AS verwendungszweck,
|
||||
CONCAT(k.sachkonto, ' ', LEFT(ko.beschriftung, 30)) AS kontoname,
|
||||
p.abkuerzung AS projekt,
|
||||
dateien.anzahl AS dateianzahl
|
||||
FROM kasse AS k
|
||||
INNER JOIN konten AS kon ON k.konto = kon.id
|
||||
LEFT JOIN adresse AS a ON a.id = k.adresse
|
||||
LEFT JOIN kontorahmen AS ko ON ko.sachkonto = k.sachkonto
|
||||
LEFT JOIN projekt AS p ON p.id = k.projekt
|
||||
LEFT JOIN (
|
||||
SELECT ds.parameter AS kasse_id, COUNT(ds.datei) AS anzahl
|
||||
FROM datei_stichwoerter AS ds
|
||||
WHERE ds.objekt LIKE 'Kasse'
|
||||
GROUP BY ds.parameter, ds.objekt
|
||||
) AS dateien ON dateien.kasse_id = k.id
|
||||
WHERE 1 " . $this->app->erp->ProjektRechte() . '
|
||||
{{where}}
|
||||
ORDER BY {{orderby}}
|
||||
LIMIT {{offset}}, {{limit}}';
|
||||
|
||||
$sqlCount =
|
||||
'SELECT COUNT(k.id) AS num
|
||||
FROM kasse AS k
|
||||
LEFT JOIN projekt AS p ON p.id = k.projekt
|
||||
WHERE 1 ' . $this->app->erp->ProjektRechte();
|
||||
|
||||
return [
|
||||
'sql_count' => $sqlCount,
|
||||
'sql_template' => $sqlTemplate,
|
||||
'columns' => $columns,
|
||||
'filter' => $filter,
|
||||
'order' => [[1, 'desc']],
|
||||
];
|
||||
}
|
||||
|
||||
protected function GetReisekostenTable()
|
||||
{
|
||||
$filter = [[
|
||||
'active' => true,
|
||||
'label' => 'Nur Reisekosten ohne Dateien',
|
||||
'name' => 'dateianzahl',
|
||||
'column' => 9,
|
||||
'sql' => [
|
||||
'active' => ' AND dateien.anzahl IS NULL ',
|
||||
'inactive' => '',
|
||||
],
|
||||
]];
|
||||
|
||||
$columns = [
|
||||
[
|
||||
'title' => '',
|
||||
'data' => 'id',
|
||||
'searchable' => false,
|
||||
'visible' => false,
|
||||
],
|
||||
[
|
||||
'title' => 'Mitarbeiter',
|
||||
'data' => 'mitarbeiter',
|
||||
'search' => 'ma.name',
|
||||
'class' => 'dt-left',
|
||||
],
|
||||
[
|
||||
'title' => 'Reisekosten',
|
||||
'data' => 'belegnr',
|
||||
'search' => 'l.belegnr',
|
||||
'class' => 'dt-left',
|
||||
],
|
||||
[
|
||||
'title' => 'Vom',
|
||||
'data' => 'vom',
|
||||
'search' => 'DATE_FORMAT(l.datum, "%d.%m.%Y")',
|
||||
'class' => 'dt-center',
|
||||
],
|
||||
[
|
||||
'title' => 'Kd-Nr.',
|
||||
'data' => 'kundennummer',
|
||||
'search' => 'adr.kundennummer',
|
||||
'class' => 'dt-left',
|
||||
],
|
||||
[
|
||||
'title' => 'Kunde',
|
||||
'data' => 'kundenname',
|
||||
'search' => 'l.name',
|
||||
'class' => 'dt-left',
|
||||
],
|
||||
[
|
||||
'title' => 'Anlass',
|
||||
'data' => 'anlass',
|
||||
'search' => 'l.anlass',
|
||||
'class' => 'dt-left',
|
||||
],
|
||||
[
|
||||
'title' => 'Projekt',
|
||||
'data' => 'projekt',
|
||||
'search' => 'p.name',
|
||||
'class' => 'dt-left',
|
||||
],
|
||||
[
|
||||
'title' => 'Status',
|
||||
'data' => 'status',
|
||||
'search' => 'l.status',
|
||||
'class' => 'dt-center',
|
||||
],
|
||||
[
|
||||
'title' => 'Dateien',
|
||||
'data' => 'dateianzahl',
|
||||
'class' => 'dt-center',
|
||||
'defaultContent' => 0,
|
||||
],
|
||||
];
|
||||
|
||||
$sqlTemplate =
|
||||
"SELECT SQL_CALC_FOUND_ROWS l.id,
|
||||
ma.name AS mitarbeiter,
|
||||
l.belegnr,
|
||||
DATE_FORMAT(l.datum, '%d.%m.%Y') AS vom,
|
||||
adr.kundennummer AS kundennummer,
|
||||
l.name AS kundenname,
|
||||
l.anlass AS anlass,
|
||||
p.abkuerzung AS projekt,
|
||||
UPPER(l.status) AS status,
|
||||
dateien.anzahl AS dateianzahl
|
||||
FROM reisekosten AS l
|
||||
LEFT JOIN projekt AS p ON p.id = l.projekt
|
||||
LEFT JOIN adresse AS adr ON l.adresse = adr.id
|
||||
LEFT JOIN adresse AS ma ON ma.id = l.mitarbeiter
|
||||
LEFT JOIN (
|
||||
SELECT ds.parameter AS reisekosten_id, COUNT(ds.datei) AS anzahl
|
||||
FROM datei_stichwoerter AS ds
|
||||
WHERE ds.objekt LIKE 'Reisekosten'
|
||||
GROUP BY ds.parameter, ds.objekt
|
||||
) AS dateien ON dateien.reisekosten_id = l.id
|
||||
WHERE l.id != '' AND l.status != 'angelegt' " . $this->app->erp->ProjektRechte() . '
|
||||
{{where}}
|
||||
ORDER BY {{orderby}}
|
||||
LIMIT {{offset}}, {{limit}}';
|
||||
|
||||
$sqlCount =
|
||||
"SELECT COUNT(l.id) AS num
|
||||
FROM reisekosten AS l
|
||||
LEFT JOIN projekt AS p ON p.id = l.projekt
|
||||
WHERE l.id != '' AND l.status != 'angelegt' " . $this->app->erp->ProjektRechte();
|
||||
|
||||
return [
|
||||
'sql_count' => $sqlCount,
|
||||
'sql_template' => $sqlTemplate,
|
||||
'columns' => $columns,
|
||||
'filter' => $filter,
|
||||
'order' => [[2, 'desc']],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function GetVerbindlichkeitenTable()
|
||||
{
|
||||
$filter = [[
|
||||
'active' => true,
|
||||
'label' => 'Nur Verbindlichkeiten ohne Dateien',
|
||||
'name' => 'dateianzahl',
|
||||
'column' => 7,
|
||||
'sql' => [
|
||||
'active' => ' AND dateien.anzahl IS NULL ',
|
||||
'inactive' => '',
|
||||
],
|
||||
]];
|
||||
|
||||
$columns = [
|
||||
[
|
||||
'title' => '',
|
||||
'data' => 'id',
|
||||
'searchable' => false,
|
||||
'visible' => false,
|
||||
],
|
||||
[
|
||||
'title' => 'Nr.',
|
||||
'data' => 'verbindlichkeitnr',
|
||||
'search' => 'v.belegnr',
|
||||
'class' => 'dt-left',
|
||||
],
|
||||
[
|
||||
'title' => 'Lf-Nr.',
|
||||
'data' => 'lieferantennr',
|
||||
'search' => 'a.lieferantennummer',
|
||||
'class' => 'dt-center',
|
||||
],
|
||||
[
|
||||
'title' => 'Lieferant',
|
||||
'data' => 'lieferant',
|
||||
'search' => 'a.name',
|
||||
'class' => 'dt-left',
|
||||
],
|
||||
[
|
||||
'title' => 'RE-Datum',
|
||||
'data' => 'rechnungsdatum',
|
||||
'search' => 'DATE_FORMAT(v.rechnungsdatum, "%d.%m.%Y")',
|
||||
'class' => 'dt-center',
|
||||
],
|
||||
[
|
||||
'title' => 'RE-Nr.',
|
||||
'data' => 'rechnungsnr',
|
||||
'search' => 'v.rechnung',
|
||||
'class' => 'dt-center',
|
||||
],
|
||||
[
|
||||
'title' => 'Betrag',
|
||||
'data' => 'betrag',
|
||||
'search' => $this->app->erp->FormatPreis('v.betrag',2),
|
||||
'class' => 'dt-right',
|
||||
],
|
||||
[
|
||||
'title' => 'Dateien',
|
||||
'data' => 'dateianzahl',
|
||||
'class' => 'dt-center',
|
||||
'defaultContent' => 0,
|
||||
],
|
||||
];
|
||||
|
||||
$sqlTemplate =
|
||||
"SELECT SQL_CALC_FOUND_ROWS v.id,
|
||||
if(v.status <> 'storniert', v.belegnr, concat('<s>', v.belegnr, '</s>')) AS verbindlichkeitnr,
|
||||
if(v.status <> 'storniert', a.lieferantennummer,concat('<s>', a.lieferantennummer, '</s>')) AS lieferantennr,
|
||||
if(v.status <> 'storniert', a.name, concat('<s>', a.name, '</s>')) AS lieferant,
|
||||
DATE_FORMAT(v.rechnungsdatum, '%d.%m.%Y') AS rechnungsdatum,
|
||||
IF(v.betrag < 0, CONCAT('<font color=red>', v.verwendungszweck, ' ', IF(v.rechnung != '', 'RE ' ,''), v.rechnung, '</font>'), v.rechnung) AS rechnungsnr,
|
||||
(".$this->app->erp->FormatPreis('v.betrag', 2).") AS betrag,
|
||||
dateien.anzahl AS dateianzahl
|
||||
FROM verbindlichkeit v
|
||||
LEFT JOIN adresse AS a ON v.adresse = a.id
|
||||
LEFT JOIN zahlungsweisen AS z ON v.zahlungsweise = z.type
|
||||
LEFT JOIN projekt AS p ON p.id = v.projekt
|
||||
LEFT JOIN (
|
||||
SELECT ds.parameter AS verbindlichkeit_id, COUNT(ds.datei) AS anzahl
|
||||
FROM datei_stichwoerter AS ds
|
||||
WHERE ds.objekt LIKE 'Verbindlichkeit'
|
||||
GROUP BY ds.parameter, ds.objekt
|
||||
) AS dateien ON dateien.verbindlichkeit_id = v.id
|
||||
WHERE v.id > 0 " . $this->app->erp->ProjektRechte() . '
|
||||
{{where}}
|
||||
ORDER BY {{orderby}}
|
||||
LIMIT {{offset}}, {{limit}}';
|
||||
|
||||
$sqlCount =
|
||||
'SELECT COUNT(v.id) AS num
|
||||
FROM verbindlichkeit AS v
|
||||
LEFT JOIN projekt AS p ON p.id = v.projekt
|
||||
WHERE v.id > 0 ' . $this->app->erp->ProjektRechte();
|
||||
|
||||
return [
|
||||
'sql_count' => $sqlCount,
|
||||
'sql_template' => $sqlTemplate,
|
||||
'columns' => $columns,
|
||||
'filter' => $filter,
|
||||
'order' => [[0, 'desc']],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,202 @@
|
||||
<?php
|
||||
/*
|
||||
**** COPYRIGHT & LICENSE NOTICE *** DO NOT REMOVE ****
|
||||
*
|
||||
* Xentral (c) Xentral ERP Sorftware GmbH, Fuggerstrasse 11, D-86150 Augsburg, * Germany 2019
|
||||
*
|
||||
* This file is licensed under the Embedded Projects General Public License *Version 3.1.
|
||||
*
|
||||
* You should have received a copy of this license from your vendor and/or *along with this file; If not, please visit www.wawision.de/Lizenzhinweis
|
||||
* to obtain the text of the corresponding license version.
|
||||
*
|
||||
**** END OF COPYRIGHT & LICENSE NOTICE *** DO NOT REMOVE ****
|
||||
*/
|
||||
?>
|
||||
<?php
|
||||
|
||||
|
||||
class GroupTable{
|
||||
|
||||
var $app;
|
||||
|
||||
var $rows;
|
||||
var $dataset;
|
||||
var $headings;
|
||||
var $sourceitemsdataset;
|
||||
var $sourceitemsheadings;
|
||||
|
||||
function __construct(&$app)
|
||||
{
|
||||
$this->app = $app;
|
||||
}
|
||||
|
||||
function DatabaseTable($table)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
function Group($groupid)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
function Search($searchwidget)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
function Table(&$listwidget)
|
||||
{
|
||||
}
|
||||
|
||||
function SourceItems($sql)
|
||||
{
|
||||
$this->sourceitemsdatasets = $this->app->DB->SelectArr($sql);
|
||||
foreach($this->sourceitemsdatasets[0] as $colkey=>$value)
|
||||
$this->sourceitemsheadings[]=ucfirst($colkey);
|
||||
//$this->sourceitemsheadings[count($this->sourceitemsheadings)-1] = 'Aktion';
|
||||
}
|
||||
|
||||
|
||||
function DynamicTable($sql)
|
||||
{
|
||||
|
||||
//$sql.= " LIMIT 1,10";
|
||||
$sql.= " order by position";
|
||||
$this->datasets = $this->app->DB->SelectArr($sql);
|
||||
foreach($this->datasets[0] as $colkey=>$value)
|
||||
$this->headings[]=ucfirst($colkey);
|
||||
|
||||
$this->headings[count($this->headings)-1] = 'Aktion';
|
||||
}
|
||||
|
||||
function GetTableWithArrows()
|
||||
{
|
||||
$htmltable = new HTMLTable(0,"100%","",3,1);
|
||||
$htmltable->AddRowAsHeading($this->headings);
|
||||
|
||||
$htmltable->ChangingRowColors('#FFf1c5','#FFcc99');
|
||||
|
||||
foreach($this->datasets as $row){
|
||||
$htmltable->NewRow();
|
||||
foreach($row as $field)
|
||||
$htmltable->AddCol($field);
|
||||
}
|
||||
|
||||
$module = $this->app->Secure->GetGET("module");
|
||||
$action = $this->app->Secure->GetGET("action");
|
||||
$id = $this->app->Secure->GetGET("id");
|
||||
|
||||
$htmltable->ReplaceCol(count($this->headings),
|
||||
"<a href=\"index.php?module=$module&action=$action&eventid=%value%&event=del&id=$id\">del</a>
|
||||
<a href=\"index.php?module=$module&action=$action&eventid=%value%&event=new&id=$id\">new</a>
|
||||
<a href=\"index.php?module=$module&action=$action&eventid=%value%&event=up&id=$id\">nauf</a>
|
||||
<a href=\"index.php?module=$module&action=$action&eventid=%value%&event=down&id=$id\">nunda</a>
|
||||
");
|
||||
|
||||
return $htmltable->Get();
|
||||
}
|
||||
|
||||
function Step($step,$widget,$method,$parsetarget)
|
||||
{
|
||||
$mywidget = $this->app->Widget->Get($widget,$parsetarget);
|
||||
$mywidget->$method();
|
||||
}
|
||||
|
||||
function SaveItem($widget,$method,$formvar)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
function SaveValue($widget,$method,$formvar)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
function Execute($verknuepftabelle,$hauptpunkttabelle,$hauptpunkttabelleid,
|
||||
$untertabelle,$parsetarget=PAGE)
|
||||
{
|
||||
$event = $this->app->Secure->GetGET("event");
|
||||
$eventid = $this->app->Secure->GetGET("eventid");
|
||||
$module = $this->app->Secure->GetGET("module");
|
||||
$action = $this->app->Secure->GetGET("action");
|
||||
|
||||
$id = $this->app->Secure->GetGET("id");
|
||||
|
||||
switch($event) {
|
||||
case "new":
|
||||
//echo "nach $id und item $eventid";
|
||||
$eventnewitem = $this->app->Secure->GetPOST("eventnewitem");
|
||||
if(is_numeric($eventnewitem))
|
||||
{
|
||||
/* speichern */
|
||||
//wenn nichts dann als erstes
|
||||
$this->app->DB->Insert("INSERT INTO $verknuepftabelle (id,$hauptpunkttabelle,
|
||||
$untertabelle,position) VALUES ('','$hauptpunkttabelleid','$eventnewitem',1)");
|
||||
//echo $eventnewitem." ".$id;
|
||||
//sonst alles nachrutschen
|
||||
|
||||
/* redirect auf module und action + id */
|
||||
header("Location: index.php?module=$module&action=$action&id=$id");
|
||||
|
||||
} else
|
||||
{
|
||||
$htmltable = new HTMLTable(0,"100%","",3,1);
|
||||
$htmltable->AddRowAsHeading($this->sourceitemsheadings);
|
||||
|
||||
$htmltable->ChangingRowColors('#FFf1c5','#FFcc99');
|
||||
|
||||
foreach($this->sourceitemsdatasets as $row){
|
||||
$htmltable->NewRow();
|
||||
foreach($row as $field)
|
||||
$htmltable->AddCol($field);
|
||||
}
|
||||
$htmltable->ReplaceCol(1,
|
||||
"<input type=\"radio\" name=\"eventnewitem\" value=\"%value%\">");
|
||||
|
||||
/* anzeige */
|
||||
$this->app->Tpl->Set($parsetarget,$htmltable->Get());
|
||||
}
|
||||
break;
|
||||
|
||||
case "del":
|
||||
echo "hau ab!";
|
||||
$this->app->Tpl->Set($parsetarget,$this->GetTableWithArrows());
|
||||
break;
|
||||
|
||||
case "up":
|
||||
echo "nauf";
|
||||
$this->app->Tpl->Set($parsetarget,$this->GetTableWithArrows());
|
||||
break;
|
||||
|
||||
case "down":
|
||||
echo "nunda";
|
||||
$this->app->Tpl->Set($parsetarget,$this->GetTableWithArrows());
|
||||
break;
|
||||
|
||||
default:
|
||||
// entweder fertige tabelle mit pfeilen
|
||||
if(count($this->datasets[0])>0)
|
||||
$this->app->Tpl->Set($parsetarget,$this->GetTableWithArrows());
|
||||
else
|
||||
$this->app->Tpl->Set($parsetarget,
|
||||
"Keine Datensätze vorhanden -> Datensatz
|
||||
<a href=\"index.php?module=$module&action=$action&event=new&id=$id\">
|
||||
einfügen</a>.");
|
||||
//$this->app->Tpl->Parse($parsetarget,"dialog.tpl");
|
||||
}
|
||||
|
||||
// oder suche + tabelle mit radiobuttons
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,774 @@
|
||||
<?php
|
||||
/*
|
||||
**** COPYRIGHT & LICENSE NOTICE *** DO NOT REMOVE ****
|
||||
*
|
||||
* Xentral (c) Xentral ERP Sorftware GmbH, Fuggerstrasse 11, D-86150 Augsburg, * Germany 2019
|
||||
*
|
||||
* This file is licensed under the Embedded Projects General Public License *Version 3.1.
|
||||
*
|
||||
* You should have received a copy of this license from your vendor and/or *along with this file; If not, please visit www.wawision.de/Lizenzhinweis
|
||||
* to obtain the text of the corresponding license version.
|
||||
*
|
||||
**** END OF COPYRIGHT & LICENSE NOTICE *** DO NOT REMOVE ****
|
||||
*/
|
||||
?>
|
||||
<?php
|
||||
|
||||
/**
|
||||
* SIP Tabelle
|
||||
* Stellt eine SIP-Formatierte Tabelle mit optionalem Zeilenmenü zur Verfügung.
|
||||
*
|
||||
* @package SIP
|
||||
* @author Benedikt Sauter <sauter@sistecs.de>
|
||||
* @author coma ag <info@coma.de>
|
||||
* @author *105 - Multimediabüro <development@stern105.de>
|
||||
* @version 1.0
|
||||
* @since PHP 4.x
|
||||
*/
|
||||
class Table {
|
||||
|
||||
/**
|
||||
* Target template to wich the table will be parsed. [Default: PAGE]
|
||||
* @type string
|
||||
*/
|
||||
var $parsetarget;
|
||||
|
||||
/**
|
||||
* HTMLTable. Apply format changes to this object.
|
||||
* @type Object
|
||||
* @access public
|
||||
*/
|
||||
var $table;
|
||||
|
||||
/**
|
||||
* SQL statement to fill table content. Altrnatively use CreateTableFromArray().
|
||||
* @type string
|
||||
* @access private
|
||||
*/
|
||||
var $sql;
|
||||
|
||||
/**
|
||||
* Data array to fill table content. Altrnatively use CreateTableFromSQL().
|
||||
* @type string
|
||||
* @access private
|
||||
*/
|
||||
var $contentArr;
|
||||
|
||||
/**
|
||||
* Indicates whether data is gathered from SQL statement od provided array
|
||||
* @type bool
|
||||
* @access private
|
||||
*/
|
||||
var $fromSQL = true;
|
||||
|
||||
var $searchform=false; // normally true
|
||||
var $sortheading=true;
|
||||
var $html;
|
||||
var $menu;
|
||||
var $rowlimit=0;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor method
|
||||
*
|
||||
* @param $app Default application class
|
||||
*
|
||||
* @return Generated object ($this)
|
||||
* @access public
|
||||
*/
|
||||
function __construct($app) {
|
||||
$this->app = $app;
|
||||
$this->app->Tpl->Set('TABLEHEADER', "");
|
||||
$this->app->Tpl->Set('TABLEFOOTER', "");
|
||||
} // end of constructor
|
||||
|
||||
/**
|
||||
* Standard method to create a table. The data is gathered
|
||||
* from provided sql statement and formatted, finally printed
|
||||
* to screen.
|
||||
*
|
||||
* <br /><br /><strong>
|
||||
* NOTE: Method is deprecated. Use CreateTableFromArray() or
|
||||
* CreateTableFromSQL() instead!
|
||||
* </strong>
|
||||
*
|
||||
* @param $sql SQL stemenet (Select) to fill the table content
|
||||
* @param $parsetarget Target template to where the content is parsed [Default: PAGE]
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function CreateTable($sql, $parsetarget='PAGE',$size="") {
|
||||
$this->CreateTableFromSQL($sql, $parsetarget,$size);
|
||||
} // end of function
|
||||
|
||||
/**
|
||||
* Standard method to create a table: The data is gathered
|
||||
* from provided sql statement and formatted, finally printed
|
||||
* to screen.
|
||||
*
|
||||
* @param $sql SQL stemenet (Select) to fill the table content
|
||||
* @param $parsetarget Target template to where the content is parsed [Default: PAGE]
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function CreateTableFromSQL($sql, $parsetarget='PAGE', $size="")
|
||||
{
|
||||
$order=$this->app->Secure->GetGET("order");
|
||||
if($order!="")
|
||||
$sql = $sql." ORDER By $order";
|
||||
|
||||
$this->parsetarget = $parsetarget;
|
||||
$this->sql = $sql;
|
||||
$this->contentArr = $this->app->DB->SelectArr($this->sql);
|
||||
$this->html = "";
|
||||
$this->fromSQL = true;
|
||||
$this->InitTable($size);
|
||||
} // end of function
|
||||
|
||||
/**
|
||||
* Alternative method to create a table: The data is gathered
|
||||
* from provided data array, then formatted and finally printed
|
||||
* to screen.
|
||||
*
|
||||
* @param $contentArr SQL stemenet (Select) to fill the table content
|
||||
* @param $parsetarget Target template to where the content is parsed [Default: PAGE]
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function CreateTableFromArray($contentArr, $parsetarget=PAGE, $size="")
|
||||
{
|
||||
/*
|
||||
echo "<pre>";
|
||||
print_r($contentArr[0]);
|
||||
echo "</pre>";
|
||||
*/
|
||||
|
||||
|
||||
$order=$this->app->Secure->GetGET("order");
|
||||
if($order!="")
|
||||
$contentArr = $this->SortTableArray($contentArr,$order);
|
||||
|
||||
$this->parsetarget = $parsetarget;
|
||||
$this->contentArr = $contentArr;
|
||||
$this->fromSQL = false;
|
||||
$this->InitTable($size);
|
||||
} // end of function
|
||||
|
||||
|
||||
function SortTableArray($data,$order)
|
||||
{
|
||||
|
||||
// to be sure, that we have a numeric array
|
||||
for ($i=0; $i<count($data); $i++) {
|
||||
foreach($data[$i] as $key=>$value)
|
||||
{
|
||||
$numarr[$i][]=$value;
|
||||
}
|
||||
}
|
||||
$data = $numarr;
|
||||
|
||||
// Obtain a list of columns
|
||||
// We have an array of rows, but array_multisort() requires an array of columns,
|
||||
// so we use the below code to obtain the columns, then perform the sorting.
|
||||
if(count($data)>0)
|
||||
foreach ($data as $key => $row) {
|
||||
for($i=0;$i<count($row);$i++)
|
||||
{
|
||||
$sort[$i][$key] = $row[$i];
|
||||
}
|
||||
//$stueck[$key] = $row[7];
|
||||
}
|
||||
// print_r($sort);
|
||||
// Sort the data with volume descending, edition ascending
|
||||
// Add $data as the last parameter, to sort by the common key
|
||||
@array_multisort($sort[$order],SORT_ASC,SORT_NUMERIC,$data);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes an HTML table
|
||||
*
|
||||
* @param $size width table [Default: 700]
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
function InitTable($size=700) {
|
||||
// Create html table
|
||||
$this->table = new HTMLTable("0",$size,"","0","0");
|
||||
$this->table->SetTDClass("divider");
|
||||
$this->table->ChangingRowColors('#F5F5F5', '');
|
||||
$this->Generate();
|
||||
} // end of function
|
||||
|
||||
/**
|
||||
* Use Array $contentArr to fill table with data
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
function Generate($fromSQL=true) {
|
||||
// Check for empty array
|
||||
if (count($this->contentArr) < 1)
|
||||
return;
|
||||
|
||||
// Build table
|
||||
while (list($key, $row) = @each($this->contentArr)) {
|
||||
|
||||
$this->table->NewRow();
|
||||
while (list($col, $val) = @each($row)) {
|
||||
|
||||
if(count($this->cols)==0) {
|
||||
$this->table->AddCol($val);
|
||||
} else {
|
||||
if(isset($this->cols[$col]))
|
||||
$this->table->AddCol($val);
|
||||
} // end of if
|
||||
} // end of inner while
|
||||
} // end of outer while
|
||||
} // end of function
|
||||
|
||||
|
||||
function DeleteAsk($colnumber,$msg,$module,$action){
|
||||
$link = "<a href=\"#\" onclick=\"str = confirm('{$msg}');
|
||||
if(str!='' & str!=null)
|
||||
window.document.location.href='index.php?module=$module&action=$action&id=%value%';\">
|
||||
loeschen</a>";
|
||||
|
||||
$this->table->ReplaceCol($colnumber,$link);
|
||||
} // end of function
|
||||
|
||||
|
||||
function ReplaceCol($colnumber,$link) {
|
||||
$this->table->ReplaceCol($colnumber,$link);
|
||||
} // end of function
|
||||
|
||||
|
||||
function RowMenu($col, $menu) {
|
||||
$this->menu = $menu;
|
||||
|
||||
switch($menu) {
|
||||
case 'special':
|
||||
// $this->RowMenuSpecial($col, "personenform");
|
||||
break;
|
||||
|
||||
case 'personen':
|
||||
$this->RowMenuGeneric($col, "personenform", true, true);
|
||||
break;
|
||||
|
||||
case 'formel':
|
||||
$this->RowMenuGeneric($col, "formelform", false, true);
|
||||
break;
|
||||
|
||||
case 'produkt':
|
||||
$this->RowMenuGeneric($col, "produktform", true, true);
|
||||
break;
|
||||
|
||||
case 'hut':
|
||||
$this->RowMenuHut($col, "hutform", true, true);
|
||||
break;
|
||||
|
||||
case 'statistikauswertung_ordner':
|
||||
$this->RowMenuAuswertung($col, "statistikauswerten");
|
||||
break;
|
||||
|
||||
case 'statistikverwaltung_ordner':
|
||||
$this->RowMenuVerwaltungOrdner($col, "statistikverwalten");
|
||||
break;
|
||||
|
||||
case 'statistikverwaltung_formeln':
|
||||
$this->RowMenuVerwaltungFormeln($col, "statistikverwaltenformel");
|
||||
break;
|
||||
|
||||
default:
|
||||
$this->RowMenuGeneric($col, $menu."form", true);
|
||||
} // end of switch
|
||||
|
||||
} // end of function
|
||||
|
||||
/* spalten nummer ( von 1 gezaehlt), dann der if wert also wenn value gleich
|
||||
dem aktuellen Wert in der Zelle ist, dann wird der text in der
|
||||
Zeile durch replacestring ersetzt. Im replacestring muss
|
||||
sich %value% befinden, an der Stelle wird der alte Wert eingefuegt.
|
||||
|
||||
Falls bestimmte Spalten nicht ersetzt werden sollen, koennen diese
|
||||
im array dontreplacecols angegeben werden.
|
||||
*/
|
||||
|
||||
function FormatCondition($col, $value, $replacestring, $dontreplacecols=array()) {
|
||||
$rows = count($this->table->Table);
|
||||
for($i=0;$i<$rows;$i++) {
|
||||
|
||||
// check ob der wert in der spalte mit dem $value uebereinstimmt
|
||||
// wenn ja ersetze jede zeile auser die aus dem array dontreplacecols
|
||||
if($this->table->Table[$i][$col-1]==$value) {
|
||||
|
||||
// ersetze spalten auser die in dontreplacecols
|
||||
$cols = count($this->table->Table[$i]);
|
||||
|
||||
for($j=0;$j<$cols;$j++) {
|
||||
if(!in_array($j+1,$dontreplacecols)) {
|
||||
$content = $this->table->Table[$i][$j];
|
||||
$this->table->Table[$i][$j] = str_replace("%value%", $content, $replacestring);
|
||||
} // end of if
|
||||
} // end of for
|
||||
} // end of if
|
||||
} // end of for
|
||||
} // end of function
|
||||
|
||||
/**
|
||||
* Formats a table coolumn with SIP specific format options.
|
||||
* Available options are listed below:
|
||||
* <ul>
|
||||
* <li>numeric: aligns right</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param Int $col Column number for menu
|
||||
* @param String $sipStyle use options from available list (see above)
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function FormatColumn($col, $sipStyle) {
|
||||
switch ($sipStyle){
|
||||
case "numeric":
|
||||
$cssStyle = "divider alignRight";
|
||||
break;
|
||||
|
||||
case "currency":
|
||||
$cssStyle = "divider alignRight number";
|
||||
break;
|
||||
|
||||
default:
|
||||
$cssStyle = "divider";
|
||||
} // end of switch
|
||||
|
||||
$this->table->FormatCol($col, $cssStyle);
|
||||
} // end of function
|
||||
|
||||
/**
|
||||
* Creates a generic menu for each table row.
|
||||
* Presets for this generic menu are:
|
||||
* <ul>
|
||||
* <li>the menu column contains the data records id (primary key)</li>
|
||||
* <li>1st column contains the same id as above</li>
|
||||
* <li>2nd column contains 0 or 1 as relevant value for activate and deactivate (zustand / active) if param $showActivate is set to true</li>
|
||||
* <li>3rd column contains 0 or 1 as relevant value for delete (deletable or not) if param $showDelete is set to true</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param Int $col Column number for menu
|
||||
* @param String $module Modulename used to build links (e.g. personenform, hutform, etc.)
|
||||
* @param Bool $showActivate Show active/deactivate buttons depending on value in 2nd column
|
||||
* @param Bool $showDelete Show delete button if value indicates that (value in 3rd column)
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function RowMenuGeneric($col, $module, $showActivate=true, $showDelete=false) {
|
||||
$rows = count($this->table->Table);
|
||||
|
||||
for($i=0;$i<$rows;$i++) {
|
||||
$cols = count($this->table->Table[$i]);
|
||||
|
||||
for($j=0;$j<$cols;$j++) {
|
||||
|
||||
if($j==($col-1)){
|
||||
$id = $this->table->Table[$i][$j];
|
||||
$menu = "";
|
||||
//historie
|
||||
$menu .= "<a href=\"index.php?module=".$module."&action=history&id=$id\">";
|
||||
$menu .= "<img src=\"./sip/themes/[THEME]/images/buttons/bu_history.gif\" border=\"0\" alt=\"Historie\">";
|
||||
$menu .= "</a> ";
|
||||
|
||||
// bearbeiten wenn aktiv
|
||||
if ($this->table->Table[$i][1] != 0) {
|
||||
$menu .= "<a href=\"index.php?module=".$module."&action=edit&id=$id\">";
|
||||
$menu .= "<img src=\"./sip/themes/[THEME]/images/buttons/bu_edit.gif\" border=\"0\" alt=\"bearbeiten\">";
|
||||
$menu .= "</a> ";
|
||||
} // end of if
|
||||
|
||||
// aktivieren wenn inaktiv, sonst deaktivieren
|
||||
if (($this->table->Table[$i][1] == 0) && ($showActivate)){
|
||||
$menu .= "<a href=\"index.php?module=".$module."&action=activate&id=$id&order=[ORDER]\">";
|
||||
$menu .= "<img src=\"./sip/themes/[THEME]/images/buttons/bu_reactivate.gif\" border=\"0\" alt=\"reaktivieren\">";
|
||||
$menu .= "</a> ";
|
||||
} else {
|
||||
if($showActivate) {
|
||||
$menu .= "<a href=\"index.php?module=".$module."&action=deactivate&id=$id&order=[ORDER]\">";
|
||||
$menu .= "<img src=\"./sip/themes/[THEME]/images/buttons/bu_deactivate.gif\" border=\"0\" alt=\"deaktivieren\">";
|
||||
$menu .= "</a> ";
|
||||
} // end of if
|
||||
} // end of if - anzeige von deaktivieren ODER aktivieren
|
||||
|
||||
// l�sch button einblenden wenn delete kriterium 1
|
||||
if ($showDelete) {
|
||||
// print_r($this->table->Table);
|
||||
if ($this->table->Table[$i][2] == 1) {
|
||||
$menu .= "<a href=\"index.php?module=".$module."&action=delete&id=$id\">";
|
||||
$menu .= "<img src=\"./sip/themes/[THEME]/images/buttons/bu_delete.gif\" border=\"0\" alt=\"löschen\">";
|
||||
$menu .= "</a> ";
|
||||
} // end of if - anzeige des l�schen buttons oder nicht nach wert
|
||||
} // end of if - anzeige von l�schen oder nicht nach funktionsparmeter
|
||||
|
||||
// wenn noch nicht verlinkt
|
||||
$this->table->Table[$i][$j] = $menu;
|
||||
|
||||
} // end of outer if
|
||||
} // end of inner for
|
||||
} // end pof outer for
|
||||
} // end of function
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Creates a specific form for Hut
|
||||
*
|
||||
* @param Int $col Column number for menu
|
||||
* @param String $module Modulename used to build links (e.g. personenform, hutform, etc.)
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function RowMenuHut($col, $module, $showActivate=true, $showDelete=false) {
|
||||
$rows = count($this->table->Table);
|
||||
|
||||
for($i=0;$i<$rows;$i++) {
|
||||
$cols = count($this->table->Table[$i]);
|
||||
|
||||
for($j=0;$j<$cols;$j++) {
|
||||
|
||||
if($j==($col-1)){
|
||||
$id = $this->table->Table[$i][$j];
|
||||
$menu = "";
|
||||
//historie
|
||||
$menu .= "<a href=\"index.php?module=".$module."&action=history&id=$id\">";
|
||||
$menu .= "<img src=\"./sip/themes/[THEME]/images/buttons/bu_history.gif\" border=\"0\" alt=\"Historie\">";
|
||||
$menu .= "</a> ";
|
||||
|
||||
// bearbeiten wenn aktiv
|
||||
if ($this->table->Table[$i][1] != 0) {
|
||||
$menu .= "<a href=\"index.php?module=".$module."&action=edit&id=$id\">";
|
||||
$menu .= "<img src=\"./sip/themes/[THEME]/images/buttons/bu_edit.gif\" border=\"0\" alt=\"bearbeiten\">";
|
||||
$menu .= "</a> ";
|
||||
} // end of if
|
||||
|
||||
// aktivieren wenn inaktiv, sonst deaktivieren
|
||||
if (($this->table->Table[$i][1] == 0) && ($showActivate)){
|
||||
$menu .= "<a href=\"index.php?module=".$module."&action=activate&id=$id\">";
|
||||
$menu .= "<img src=\"./sip/themes/[THEME]/images/buttons/bu_reactivate.gif\" border=\"0\" alt=\"reaktivieren\">";
|
||||
$menu .= "</a> ";
|
||||
} else {
|
||||
if($showActivate) {
|
||||
if (strlen($this->table->Table[$i][8]) == 51) {
|
||||
$menu .= "<a href=\"index.php?module=".$module."&action=deactivate&id=$id\">";
|
||||
$menu .= "<img src=\"./sip/themes/[THEME]/images/buttons/bu_deactivate.gif\" border=\"0\" alt=\"deaktivieren\">";
|
||||
$menu .= "</a> ";
|
||||
} // end of if
|
||||
} // end of if
|
||||
} // end of if - anzeige von deaktivieren ODER aktivieren
|
||||
|
||||
// l�sch button einblenden wenn delete kriterium 1
|
||||
if ($showDelete) {
|
||||
// print_r($this->table->Table);
|
||||
if ($this->table->Table[$i][2] == 1) {
|
||||
$menu .= "<a href=\"index.php?module=".$module."&action=delete&id=$id\">";
|
||||
$menu .= "<img src=\"./sip/themes/[THEME]/images/buttons/bu_delete.gif\" border=\"0\" alt=\"löschen\">";
|
||||
$menu .= "</a> ";
|
||||
} // end of if - anzeige des l�schen buttons oder nicht nach wert
|
||||
} // end of if - anzeige von l�schen oder nicht nach funktionsparmeter
|
||||
|
||||
// wenn noch nicht verlinkt
|
||||
$this->table->Table[$i][$j] = $menu;
|
||||
|
||||
} // end of outer if
|
||||
} // end of inner for
|
||||
} // end pof outer for
|
||||
} // end of function
|
||||
|
||||
|
||||
/**
|
||||
* Creates a specific form for OIC Module Statistik Auswertung / Ordner�bersicht
|
||||
*
|
||||
* @param Int $col Column number for menu
|
||||
* @param String $module Modulename used to build links (e.g. personenform, hutform, etc.)
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function RowMenuAuswertung($col, $module) {
|
||||
$rows = count($this->table->Table);
|
||||
|
||||
for($i=0;$i<$rows;$i++) {
|
||||
$cols = count($this->table->Table[$i]);
|
||||
|
||||
for($j=0;$j<$cols;$j++) {
|
||||
|
||||
if($j==($col-1)){
|
||||
$id = $this->table->Table[$i][$j];
|
||||
$menu = "";
|
||||
|
||||
if ($this->table->Table[$i][3] != 0) {
|
||||
// Detailansicht
|
||||
$menu .= "<a href=\"index.php?module=".$module."&action=showordner&id=$id\">";
|
||||
$menu .= "<img src=\"./sip/themes/[THEME]/images/buttons/bu_view.gif\" border=\"0\" alt=\"Detailansicht\">";
|
||||
$menu .= "</a> ";
|
||||
|
||||
// Graph
|
||||
$menu .= "<a href=\"#\" onclick=\"GesamtGraphOrdnerID($id)\">";
|
||||
$menu .= "<img src=\"./sip/themes/[THEME]/images/buttons/bu_statgraph.gif\" border=\"0\" alt=\"Graph\">";
|
||||
$menu .= "</a> ";
|
||||
|
||||
} else {
|
||||
$menu .= "keine Formeln vorhanden";
|
||||
} // end of if - nicht anzeigen wenn keine Formeln im Ordner sind
|
||||
|
||||
// wenn noch nicht verlinkt
|
||||
$this->table->Table[$i][$j] = $menu;
|
||||
|
||||
} // end of outer if
|
||||
} // end of inner for
|
||||
} // end pof outer for
|
||||
} // end of function
|
||||
|
||||
|
||||
/**
|
||||
* Creates a specific form for OIC Module Statistik Verwaltung / Ordner�bersicht
|
||||
*
|
||||
* @param Int $col Column number for menu
|
||||
* @param String $module Modulename used to build links (e.g. personenform, hutform, etc.)
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function RowMenuVerwaltungOrdner($col, $module) {
|
||||
$rows = count($this->table->Table);
|
||||
|
||||
for($i=0; $i<$rows; $i++) {
|
||||
$cols = count($this->table->Table[$i]);
|
||||
|
||||
for($j=0; $j<$cols; $j++) {
|
||||
|
||||
if($j==($col-1)){
|
||||
$id = $this->table->Table[$i][$j];
|
||||
$menu = "";
|
||||
|
||||
// Edit
|
||||
$menu .= "<a href=\"index.php?module=".$module."&action=edit&id=$id\">";
|
||||
$menu .= "<img src=\"./sip/themes/[THEME]/images/buttons/bu_edit.gif\" border=\"0\" alt=\"Ordner bearbeiten\">";
|
||||
$menu .= "</a> ";
|
||||
|
||||
// Formeln bearbeiten
|
||||
$menu .= "<a href=\"index.php?module=".$module."formel&action=list&id=$id\">";
|
||||
$menu .= "<img src=\"./sip/themes/[THEME]/images/buttons/bu_formeln.gif\" border=\"0\" alt=\"Formeln bearbeiten\">";
|
||||
$menu .= "</a> ";
|
||||
|
||||
// Nach unten (wenn nicht letztes in Liste)
|
||||
if ($i != $rows-1) {
|
||||
$menu .= "<a href=\"index.php?module=".$module."&action=movedown&id=$id\">";
|
||||
$menu .= "<img src=\"./sip/themes/[THEME]/images/buttons/bu_down.gif\" border=\"0\" alt=\"Nach unten\">";
|
||||
$menu .= "</a> ";
|
||||
} // end of if
|
||||
|
||||
// Nach oben (wenn nicht erstes in Liste)
|
||||
if ($i != 0) {
|
||||
$menu .= "<a href=\"index.php?module=".$module."&action=moveup&id=$id\">";
|
||||
$menu .= "<img src=\"./sip/themes/[THEME]/images/buttons/bu_up.gif\" border=\"0\" alt=\"Nach oben\">";
|
||||
$menu .= "</a> ";
|
||||
} // end of if
|
||||
|
||||
// Delete - Wenn in Spalte 3 eine 0 steht (keine Formeln mehr im Ordner)
|
||||
if ($this->table->Table[$i][3] == 0) {
|
||||
$menu .= "<a href=\"index.php?module=".$module."&action=delete&id=$id\">";
|
||||
$menu .= "<img src=\"./sip/themes/[THEME]/images/buttons/bu_delete.gif\" border=\"0\" alt=\"löschen\">";
|
||||
$menu .= "</a> ";
|
||||
} // end of if - anzeige des l�schen buttons oder nicht nach wert
|
||||
|
||||
// wenn noch nicht verlinkt
|
||||
$this->table->Table[$i][$j] = $menu;
|
||||
|
||||
} // end of outer if
|
||||
} // end of inner for
|
||||
} // end pof outer for
|
||||
} // end of function
|
||||
|
||||
/**
|
||||
* Creates a specific form for OIC Module Statistik Verwaltung / Formel�bersicht innerhalb eines Ordners
|
||||
*
|
||||
* @param Int $col Column number for menu
|
||||
* @param String $module Modulename used to build links (e.g. personenform, hutform, etc.)
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function RowMenuVerwaltungFormeln($col, $module) {
|
||||
$rows = count($this->table->Table);
|
||||
|
||||
if ($rows == 0) {
|
||||
$this->table->Table[] = Array("", "", "", "Bisher existiert kein Eintrag in dieser Liste.", "", "", "", "-1");
|
||||
$rows = count($this->table->Table);
|
||||
} // end of if
|
||||
|
||||
for($i=0; $i<$rows; $i++) {
|
||||
$cols = count($this->table->Table[$i]);
|
||||
|
||||
for($j=0; $j<$cols; $j++) {
|
||||
|
||||
if($j==($col-1)){
|
||||
$id = $this->table->Table[$i][$j];
|
||||
$menu = "";
|
||||
|
||||
// Ansicht (1 oder 1/4)
|
||||
if ($this->table->Table[$i][1] == 4 && $id != -1) {
|
||||
$menu .= "<a href=\"index.php?module=".$module."&action=viewfull&id=$id\">";
|
||||
$menu .= "<img src=\"./sip/themes/[THEME]/images/buttons/bu_ansicht_1_1.gif\" border=\"0\" alt=\"Ansicht Vollformat\">";
|
||||
$menu .= "</a> ";
|
||||
} else if ($this->table->Table[$i][0] != "") {
|
||||
$menu .= "<a href=\"index.php?module=".$module."&action=viewquarter&id=$id\">";
|
||||
$menu .= "<img src=\"./sip/themes/[THEME]/images/buttons/bu_ansicht_1_4.gif\" border=\"0\" alt=\"Ansicht Viertelformat\">";
|
||||
$menu .= "</a> ";
|
||||
} // end of if - Ansicht 1 oder 1/4
|
||||
|
||||
// Delete - Wenn in Spalte 3 eine 0 steht (keine Formeln mehr im Ordner)
|
||||
//echo $this->table->Table[$i][1]."<br>";
|
||||
//if ($this->table->Table[$i][1] == 0 && $id != -1) {
|
||||
if ($id != -1) {
|
||||
$menu .= "<a href=\"index.php?module=".$module."&action=delete&id=$id\">";
|
||||
$menu .= "<img src=\"./sip/themes/[THEME]/images/buttons/bu_delete.gif\" border=\"0\" alt=\"löschen\">";
|
||||
$menu .= "</a> ";
|
||||
} // end of if - anzeige des l�schen buttons oder nicht nach wert
|
||||
|
||||
// Formeln hinzuf�gen
|
||||
if ($id != -1) {
|
||||
$menu .= "<a href=\"index.php?module=".$module."&action=addafter&id=$id\">";
|
||||
$menu .= "<img src=\"./sip/themes/[THEME]/images/buttons/bu_add.gif\" border=\"0\" alt=\"Nach diesem hinzuf�gen\">";
|
||||
$menu .= "</a> ";
|
||||
} else {
|
||||
$menu .= "<a href=\"index.php?module=".$module."&action=add&id=$id\">";
|
||||
$menu .= "<img src=\"./sip/themes/[THEME]/images/buttons/bu_add.gif\" border=\"0\" alt=\"Formel hinzuf�gen\">";
|
||||
$menu .= "</a> ";
|
||||
} // end of if
|
||||
|
||||
// Nach unten (wenn nicht letztes in Liste)
|
||||
if ($i != $rows-1 && $id != -1) {
|
||||
$menu .= "<a href=\"index.php?module=".$module."&action=movedown&id=$id\">";
|
||||
$menu .= "<img src=\"./sip/themes/[THEME]/images/buttons/bu_down.gif\" border=\"0\" alt=\"Nach unten\">";
|
||||
$menu .= "</a> ";
|
||||
} // end of if
|
||||
|
||||
// Nach oben (wenn nicht erstes in Liste)
|
||||
if ($i != 0 && $id != -1) {
|
||||
$menu .= "<a href=\"index.php?module=".$module."&action=moveup&id=$id\">";
|
||||
$menu .= "<img src=\"./sip/themes/[THEME]/images/buttons/bu_up.gif\" border=\"0\" alt=\"Nach oben\">";
|
||||
$menu .= "</a> ";
|
||||
} // end of if
|
||||
|
||||
// wenn noch nicht verlinkt
|
||||
$this->table->Table[$i][$j] = $menu;
|
||||
|
||||
} // end of outer if
|
||||
} // end of inner for
|
||||
} // end pof outer for
|
||||
|
||||
/*
|
||||
<tr class="odd">
|
||||
<td class="divider alignRight">1</td>
|
||||
<td class="divider"><a href="#">Abgeschlossene Verträge </a></td>
|
||||
<td class="divider">F3</td>
|
||||
<td class="divider">Pkt/Stk</td>
|
||||
<td class="divider">1</td>
|
||||
<td><a href=""><img src="images/buttons/bu_ansicht_1_4.gif" alt="Ansicht 1/4" width="18" height="18" class="icon" title="Ansicht 1/4" /></a> <a href=""><img src="images/buttons/bu_delete.gif" alt="löschen" class="icon" title="löschen" /></a> <a href=""><img src="images/buttons/bu_add.gif" alt="nach dieser hinzufügen" class="icon" title="nach dieser hinzufügen" /></a> <a href=""><img src="images/buttons/bu_down.gif" alt="nach unten" class="icon" title="nach unten" /></a> </td>
|
||||
</tr>
|
||||
*/
|
||||
|
||||
} // end of function
|
||||
|
||||
|
||||
/**
|
||||
* Shows the siptable
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function Show() {
|
||||
$this->html = "";
|
||||
if($this->searchform)
|
||||
$this->html .= $this->SortAndSearchForm();
|
||||
|
||||
//$this->html .= $this->table->Get(" ","");
|
||||
$this->html .= $this->table->Get(" ",$this->headingtop);
|
||||
$this->app->Tpl->Add($this->parsetarget, $this->html);
|
||||
} // end of function
|
||||
|
||||
|
||||
function RowLimit($number) {
|
||||
$this->rowlimit=$number;
|
||||
}
|
||||
|
||||
|
||||
function Cols($fields)
|
||||
{
|
||||
$this->cols=array_flip($fields);
|
||||
}
|
||||
|
||||
function HideCol($number)
|
||||
{
|
||||
$this->table->HideCol($number);
|
||||
}
|
||||
|
||||
function HeadingTop($value)
|
||||
{
|
||||
$this->headingtop=$value;
|
||||
|
||||
}
|
||||
|
||||
function Headings($descriptions)
|
||||
{
|
||||
$this->table->AddRowAsHeading($descriptions);
|
||||
$this->descriptions=$descriptions;
|
||||
}
|
||||
|
||||
function SetSortAndSearchForm($bool)
|
||||
{
|
||||
$this->searchform=$bool;
|
||||
}
|
||||
|
||||
function SetSortHeading($bool)
|
||||
{
|
||||
$this->sortheading=$bool;
|
||||
}
|
||||
|
||||
|
||||
function SortAndSearchForm()
|
||||
{
|
||||
$select = new HTMLSelect("sort",1);
|
||||
if(count($this->cols)==0)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
while (list($col, $val) = @each($this->cols))
|
||||
{
|
||||
if($this->descriptions[$col]!="")
|
||||
$select->AddOption("Nach {$this->descriptions[$col]} Sortieren",$col);
|
||||
else
|
||||
$select->AddOption("Nach $col Sortieren",$col);
|
||||
|
||||
}
|
||||
}
|
||||
$html = $select->Get();
|
||||
|
||||
$search = new HTMLInput("search","text","",20);
|
||||
$html .= $search->Get();
|
||||
|
||||
$html .="<input type=\"submit\" value=\"Suchen\">";
|
||||
|
||||
$html .="<br>";
|
||||
|
||||
$alphabet = range('A', 'Z');
|
||||
$html .="<table width=\"100%\" cellpadding=\"7\"><tr>";
|
||||
foreach ($alphabet as $letter)
|
||||
$html .= "<td><a href=\"\">$letter</a></td>";
|
||||
|
||||
$html .="</tr></table>";
|
||||
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
} // end of class
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,5 @@
|
||||
[SEARCH]
|
||||
<br>
|
||||
<br>
|
||||
[TABLE]
|
||||
|
||||
Reference in New Issue
Block a user