Added linework export with progress bar
This commit is contained in:
@@ -30,7 +30,7 @@
|
|||||||
<div class="card-body mb-3">
|
<div class="card-body mb-3">
|
||||||
<h4 class="header-title mb-3">Filter</h4>
|
<h4 class="header-title mb-3">Filter</h4>
|
||||||
|
|
||||||
<form method="get" action="<?=self::getUrl("Linework")?>">
|
<form method="get" id="filterform" action="<?=self::getUrl("Linework")?>">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-1">
|
<div class="col-1">
|
||||||
<label class="form-label" for="filter_network_id">Netzgebiet</label>
|
<label class="form-label" for="filter_network_id">Netzgebiet</label>
|
||||||
@@ -99,11 +99,23 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="row mt-2">
|
<div class="row mt-2">
|
||||||
<div class="col">
|
<div>
|
||||||
<button type="submit" class="btn btn-primary">Filter anwenden</button>
|
<button type="submit" class="btn btn-primary">Filter anwenden</button>
|
||||||
<a class="btn btn-secondary" href="<?=self::getUrl("Linework")?>">Filter zurücksetzen</a>
|
<a class="btn btn-secondary" href="<?=self::getUrl("Linework")?>">Filter zurücksetzen</a>
|
||||||
|
</div>
|
||||||
|
<div style="width: 512px;">
|
||||||
<?php if($me->isAdmin()): ?>
|
<?php if($me->isAdmin()): ?>
|
||||||
<button type="submit" name="export" value="1" class="btn btn-outline-success ml-2"><i class="fas fa-download mr-1"></i> Download als .xls</button>
|
<div class="row">
|
||||||
|
<div class="col-6">
|
||||||
|
<button type="button" id="export-button" class="form-control btn btn-outline-success ml-2"><i class="fas fa-download mr-1"></i> Download als .xls</button>
|
||||||
|
</div>
|
||||||
|
<div class="col-6">
|
||||||
|
<div id="progress-bar-wrapper" class="progress progress-xl mt-2 hidden">
|
||||||
|
<div id="progress-bar" class="progress-bar progress-bar-striped progress-bar-animated bg-primary text-secondary" style="width: 0%;">Bitte warten... 0%</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -665,6 +677,87 @@ function validateWorkflowItem(id) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var export_uid = "";
|
||||||
|
var export_progress = 0;
|
||||||
|
|
||||||
|
$('#export-button').click(function() {
|
||||||
|
var form = $('#filterform');
|
||||||
|
var actionUrl = '<?=self::getUrl("Linework", "export")?>';
|
||||||
|
/*var formdata = new FormData(form);
|
||||||
|
for (const [key, value] of formdata) {
|
||||||
|
//console.log(key + ": " + value);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
console.log(form.serialize());
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: actionUrl,
|
||||||
|
data: form.serialize(),
|
||||||
|
dataType: "json",
|
||||||
|
success: function(success) {
|
||||||
|
if(success.status = "OK") {
|
||||||
|
if(success.uid) {
|
||||||
|
export_uid = success.uid;
|
||||||
|
export_progress = success.progress;
|
||||||
|
$('#progress-bar-wrapper').show();
|
||||||
|
setTimeout(updateExportProgress, 200);
|
||||||
|
} else {
|
||||||
|
console.log("no uid returned");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
function updateExportProgress() {
|
||||||
|
if(!export_uid) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$.get("<?=self::getUrl("Linework", "exportProgress")?>",
|
||||||
|
{
|
||||||
|
uid: export_uid
|
||||||
|
},
|
||||||
|
function(success) {
|
||||||
|
if(success.status == "OK") {
|
||||||
|
updateProgressBar(success.progress);
|
||||||
|
if(success.progress >= 100) {
|
||||||
|
setTimeout(() => {document.location.href = '<?=self::getUrl("Linework","downloadExport")?>?uid=' + export_uid}, 200);
|
||||||
|
setTimeout(clearProgressBar, 5000);
|
||||||
|
} else {
|
||||||
|
setTimeout(updateExportProgress, 200);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"json"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateProgressBar(progress) {
|
||||||
|
$('#progress-bar').css("width", progress + "%");
|
||||||
|
$('#progress-bar').text("Bitte warten... " + progress + "%");
|
||||||
|
|
||||||
|
if(progress > 50) {
|
||||||
|
$('#progress-bar').removeClass("text-secondary");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(progress >= 100) {
|
||||||
|
$('#progress-bar').addClass("bg-success").removeClass("bg-primary");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function clearProgressBar() {
|
||||||
|
$('#progress-bar-wrapper').hide();
|
||||||
|
$('#progress-bar').css("width", "0%");
|
||||||
|
$('#progress-bar').text("Bitte warten... 0%");
|
||||||
|
$('#progress-bar').addClass("bg-primary").removeClass("bg-success");
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
363
Layout/default/Linework/export_progress.xls.php
Normal file
363
Layout/default/Linework/export_progress.xls.php
Normal file
@@ -0,0 +1,363 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
// progress
|
||||||
|
$lineMax = 0;
|
||||||
|
foreach($networks as $terminations) {
|
||||||
|
$lineMax += count($terminations);
|
||||||
|
}
|
||||||
|
|
||||||
|
$filename = "leitungsbau-".date('Y-m-d_H-i-s')."-".uniqid().".xlsx";
|
||||||
|
|
||||||
|
if($export_uid) {
|
||||||
|
$progress = new WorkflowExport();
|
||||||
|
$progress->loadByUid($export_uid);
|
||||||
|
$progress->filename = $filename;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$col = array('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','AA','AB','AC','AD','AE','AF','AG','AH','AI','AJ','AK','AL','AM','AN','AO','AP','AQ','AR','AS','AT','AU','AV','AW','AX','AY','AZ','BA',
|
||||||
|
'BB','BC','BD','BE','BF','BG','BH','BI','BJ','BK','BL','BM','BN','BO','BP','BQ','BR','BS','BT','BU','BV','BW','BX','BY','BZ'
|
||||||
|
);
|
||||||
|
|
||||||
|
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||||
|
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
||||||
|
use PhpOffice\PhpSpreadsheet\Style\Alignment;
|
||||||
|
use PhpOffice\PhpSpreadsheet\Style\Border;
|
||||||
|
use PhpOffice\PhpSpreadsheet\Style\Color;
|
||||||
|
|
||||||
|
$lightgreen = "f5ffeb";
|
||||||
|
|
||||||
|
$xls = new Spreadsheet();
|
||||||
|
$sheet = $xls->getActiveSheet();
|
||||||
|
|
||||||
|
// header
|
||||||
|
$i = 0;
|
||||||
|
|
||||||
|
$sheet->setCellValue($col[$i++].'1', "id");
|
||||||
|
$sheet->setCellValue($col[$i++].'1', "Netzgebiet");
|
||||||
|
$sheet->setCellValue($col[$i++].'1', "Bauabschnitt");
|
||||||
|
$sheet->setCellValue($col[$i++].'1', "Gebäudecode");
|
||||||
|
$sheet->setCellValue($col[$i++].'1', "Straße");
|
||||||
|
$sheet->setCellValue($col[$i++].'1', "GPS Breite");
|
||||||
|
$sheet->setCellValue($col[$i++].'1', "GPS Länge");
|
||||||
|
$sheet->setCellValue($col[$i++].'1', "Gebäudestatus Code");
|
||||||
|
$sheet->setCellValue($col[$i++].'1', "Gebäudestatus");
|
||||||
|
|
||||||
|
$sheet->setCellValue($col[$i++].'1', "Anschlusscode");
|
||||||
|
$sheet->setCellValue($col[$i++].'1', "Anschlussname");
|
||||||
|
$sheet->setCellValue($col[$i++].'1', "Anschlussstatus Code");
|
||||||
|
$sheet->setCellValue($col[$i++].'1', "Anschlussstatus");
|
||||||
|
$sheet->setCellValue($col[$i++].'1', "Kontakt");
|
||||||
|
$sheet->setCellValue($col[$i++].'1', "Telefon");
|
||||||
|
$sheet->setCellValue($col[$i++].'1', "Email");
|
||||||
|
|
||||||
|
$sheet->setCellValue($col[$i++].'1', "Doku-Aufschub");
|
||||||
|
$sheet->setCellValue($col[$i++].'1', "Baufreigabe");
|
||||||
|
|
||||||
|
$sheet->setCellValue($col[$i++].'1', "AP-Typ");
|
||||||
|
$sheet->setCellValue($col[$i++].'1', "AP-Name");
|
||||||
|
$sheet->setCellValue($col[$i++].'1', "AP GPS Breite");
|
||||||
|
$sheet->setCellValue($col[$i++].'1', "AP GPS Länge");
|
||||||
|
$sheet->setCellValue($col[$i++].'1', "Rohrverband");
|
||||||
|
$sheet->setCellValue($col[$i++].'1', "Rohrtyp");
|
||||||
|
$sheet->setCellValue($col[$i++].'1', "Rohrfarbe");
|
||||||
|
|
||||||
|
$sheet->setCellValue($col[$i++].'1', "POP (Planung)");
|
||||||
|
$sheet->setCellValue($col[$i++].'1', "POP (Ist-Zustand)");
|
||||||
|
$sheet->setCellValue($col[$i++].'1', "Schrank (Planung)");
|
||||||
|
$sheet->setCellValue($col[$i++].'1', "Schrank (Ist-Zustand)");
|
||||||
|
$sheet->setCellValue($col[$i++].'1', "HE/Einschub (Planung)");
|
||||||
|
$sheet->setCellValue($col[$i++].'1', "HE/Einschub (Ist-Zustand)");
|
||||||
|
$sheet->setCellValue($col[$i++].'1', "Modul (Planung)");
|
||||||
|
$sheet->setCellValue($col[$i++].'1', "Modul (Ist-Zustand)");
|
||||||
|
$sheet->setCellValue($col[$i++].'1', "Ports (Planung)");
|
||||||
|
$sheet->setCellValue($col[$i++].'1', "Ports (Ist-Zustand)");
|
||||||
|
$sheet->setCellValue($col[$i++].'1', "Abschlusstyp (Planung)");
|
||||||
|
$sheet->setCellValue($col[$i++].'1', "Abschlusstyp (Ist-Zustand)");
|
||||||
|
$sheet->setCellValue($col[$i++].'1', "BB-Kabel (Planung)");
|
||||||
|
$sheet->setCellValue($col[$i++].'1', "BB-Kabel (Ist-Zustand)");
|
||||||
|
$sheet->setCellValue($col[$i++].'1', "BB-Kabel Typ (Planung)");
|
||||||
|
$sheet->setCellValue($col[$i++].'1', "BB-Kabel Typ (Ist-Zustand)");
|
||||||
|
$sheet->setCellValue($col[$i++].'1', "BB-Fasern (Planung)");
|
||||||
|
$sheet->setCellValue($col[$i++].'1', "BB-Fasern (Ist-Zustand)");
|
||||||
|
$sheet->setCellValue($col[$i++].'1', "Kundenkabel-Typ (Planung)");
|
||||||
|
$sheet->setCellValue($col[$i++].'1', "Kundenkabel-Typ (Ist-Zustand)");
|
||||||
|
$sheet->setCellValue($col[$i++].'1', "Fasern im KU-Kabel (Planung)");
|
||||||
|
$sheet->setCellValue($col[$i++].'1', "Fasern im KU-Kabel (Ist-Zustand)");
|
||||||
|
|
||||||
|
$sheet->setCellValue($col[$i++].'1', "Backbone hergestellt");
|
||||||
|
$sheet->setCellValue($col[$i++].'1', "BB-Bautermin");
|
||||||
|
$sheet->setCellValue($col[$i++].'1', "KU-Bautermin");
|
||||||
|
|
||||||
|
$sheet->setCellValue($col[$i++].'1', "BEP montiert");
|
||||||
|
$sheet->setCellValue($col[$i++].'1', "Kundenkabel eingeblasen");
|
||||||
|
$sheet->setCellValue($col[$i++].'1', "Spleiß Netz");
|
||||||
|
$sheet->setCellValue($col[$i++].'1', "Spleiß Kunde");
|
||||||
|
|
||||||
|
$sheet->setCellValue($col[$i++].'1', "ONT montiert");
|
||||||
|
$sheet->setCellValue($col[$i++].'1', "ONT Seriennummer");
|
||||||
|
$sheet->setCellValue($col[$i++].'1', "Kunde passiv fertiggestellt");
|
||||||
|
|
||||||
|
$sheet->setCellValue($col[$i++].'1', "Kommentar Tiefbau");
|
||||||
|
$sheet->setCellValue($col[$i++].'1', "Kommentar Leitungsbau");
|
||||||
|
|
||||||
|
$sheet->getStyle("A1:".$col[$i]."1")->getFont()->setBold(true);
|
||||||
|
|
||||||
|
$sheet->getRowDimension(1)->setRowHeight(16);
|
||||||
|
|
||||||
|
|
||||||
|
$line = 2;
|
||||||
|
|
||||||
|
foreach($networks as $networkname => $terminations) {
|
||||||
|
|
||||||
|
foreach($terminations as $term) {
|
||||||
|
$i = 0;
|
||||||
|
|
||||||
|
$building = $term->building;
|
||||||
|
|
||||||
|
$sheet->setCellValue($col[$i].$line, $term->id)->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10);
|
||||||
|
$sheet->getStyle($col[$i].$line)->getAlignment()->setVertical(Alignment::VERTICAL_CENTER);
|
||||||
|
$i++;
|
||||||
|
$sheet->setCellValue($col[$i].$line, $networkname);
|
||||||
|
$i++;
|
||||||
|
$sheet->setCellValue($col[$i].$line, $building->networksection->name);
|
||||||
|
$i++;
|
||||||
|
$sheet->setCellValue($col[$i].$line, $building->code)->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10);
|
||||||
|
$sheet->getStyle($col[$i].$line)->getAlignment()->setVertical(Alignment::VERTICAL_CENTER);
|
||||||
|
$i++;
|
||||||
|
$sheet->setCellValue($col[$i].$line, $building->street);
|
||||||
|
$i++;
|
||||||
|
$sheet->setCellValue($col[$i].$line, $building->gps_lat)->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10);
|
||||||
|
$sheet->getStyle($col[$i].$line)->getAlignment()->setVertical(Alignment::VERTICAL_CENTER);
|
||||||
|
$i++;
|
||||||
|
$sheet->setCellValue($col[$i].$line, $building->gps_long)->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10);
|
||||||
|
$sheet->getStyle($col[$i].$line)->getAlignment()->setVertical(Alignment::VERTICAL_CENTER);
|
||||||
|
$i++;
|
||||||
|
$sheet->setCellValue($col[$i].$line, $building->status->code)->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10);
|
||||||
|
$sheet->getStyle($col[$i].$line)->getAlignment()->setVertical(Alignment::VERTICAL_CENTER);
|
||||||
|
$i++;
|
||||||
|
$sheet->setCellValue($col[$i].$line, $building->status->name)->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10);
|
||||||
|
$sheet->getStyle($col[$i].$line)->getAlignment()->setVertical(Alignment::VERTICAL_CENTER);
|
||||||
|
$i++;
|
||||||
|
$sheet->setCellValue($col[$i].$line, $term->code)->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10);
|
||||||
|
$sheet->getStyle($col[$i].$line)->getAlignment()->setVertical(Alignment::VERTICAL_CENTER);
|
||||||
|
$i++;
|
||||||
|
$sheet->setCellValue($col[$i].$line, $term->name);
|
||||||
|
$i++;
|
||||||
|
$sheet->setCellValue($col[$i].$line, $term->status->code)->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10);
|
||||||
|
$sheet->getStyle($col[$i].$line)->getAlignment()->setVertical(Alignment::VERTICAL_CENTER);
|
||||||
|
$i++;
|
||||||
|
$sheet->setCellValue($col[$i].$line, $term->status->name)->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10);
|
||||||
|
$sheet->getStyle($col[$i].$line)->getAlignment()->setVertical(Alignment::VERTICAL_CENTER);
|
||||||
|
$i++;
|
||||||
|
$sheet->setCellValue($col[$i].$line, $term->contact);
|
||||||
|
$i++;
|
||||||
|
$sheet->setCellValue($col[$i].$line, $term->phone);
|
||||||
|
$i++;
|
||||||
|
$sheet->setCellValue($col[$i].$line, $term->email);
|
||||||
|
$i++;
|
||||||
|
$sheet->setCellValue($col[$i].$line, $term->linework_doku_delay);
|
||||||
|
$i++;
|
||||||
|
$sheet->setCellValue($col[$i].$line, $term->linework_enabled);
|
||||||
|
$i++;
|
||||||
|
|
||||||
|
$sheet->setCellValue($col[$i].$line, ($term->building->getWorkflowvalue("ist_anschlusspunkt_typ")) ? $term->building->getWorkflowvalue("ist_anschlusspunkt_typ") : $term->building->getWorkflowvalue("anschlusspunkt_typ"));
|
||||||
|
$i++;
|
||||||
|
$sheet->setCellValue($col[$i].$line, ($term->building->getWorkflowvalue('ist_anschlusspunkt_name')) ? $term->building->getWorkflowvalue('ist_anschlusspunkt_name') : $term->building->getWorkflowvalue('anschlusspunkt_name'));
|
||||||
|
$i++;
|
||||||
|
|
||||||
|
|
||||||
|
$gps = explode(";", ($term->building->getWorkflowvalue('ist_anschlusspunkt_gps')) ? $term->building->getWorkflowvalue('ist_anschlusspunkt_gps') : $term->building->getWorkflowvalue('anschlusspunkt_gps'));
|
||||||
|
if(is_array($gps) & count($gps) == 2) {
|
||||||
|
$sheet->setCellValue($col[$i].$line, $gps[0])->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10);
|
||||||
|
$sheet->getStyle($col[$i].$line)->getAlignment()->setVertical(Alignment::VERTICAL_CENTER);
|
||||||
|
$sheet->setCellValue($col[$i+1].$line, $gps[1])->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10);
|
||||||
|
$sheet->getStyle($col[$i+1].$line)->getAlignment()->setVertical(Alignment::VERTICAL_CENTER);
|
||||||
|
}
|
||||||
|
$i += 2;
|
||||||
|
|
||||||
|
$sheet->setCellValue($col[$i].$line, ($term->building->getWorkflowvalue('ist_rohrverband_name')) ? $term->building->getWorkflowvalue('ist_rohrverband_name') : $term->building->getWorkflowvalue('rohrverband_name'));
|
||||||
|
$i++;
|
||||||
|
$sheet->setCellValue($col[$i].$line, ($term->building->getWorkflowvalue('ist_rohrtype')) ? $term->building->getWorkflowvalue('ist_rohrtype') : $term->building->getWorkflowvalue('rohrtype'));
|
||||||
|
$i++;
|
||||||
|
|
||||||
|
|
||||||
|
$color = ($term->building->getWorkflowvalue('ist_rohrfarbe')) ? $term->building->getWorkflowvalue('ist_rohrfarbe') : $term->building->getWorkflowvalue('rohrfarbe');
|
||||||
|
if($color) {
|
||||||
|
if(TT_CABLE_COLORS[$color]["mark"]) {
|
||||||
|
$sheet->setCellValue($col[$i].$line, "----- ".ucfirst($color)." -----");
|
||||||
|
} else {
|
||||||
|
$sheet->setCellValue($col[$i].$line, ucfirst($color));
|
||||||
|
}
|
||||||
|
$sheet->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10)->getColor()->setARGB(TT_CABLE_COLORS[$color]["hexfg"]);
|
||||||
|
$sheet->getStyle($col[$i].$line)->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB(TT_CABLE_COLORS[$color]["hex"]);
|
||||||
|
$sheet->getStyle($col[$i].$line)->getAlignment()->setVertical(Alignment::VERTICAL_CENTER);
|
||||||
|
$sheet->getStyle($col[$i].$line)->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER);
|
||||||
|
}
|
||||||
|
$i++;
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Linework data
|
||||||
|
*/
|
||||||
|
$sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('pop_id'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10);
|
||||||
|
$sheet->getStyle($col[$i].$line)->getAlignment()->setVertical(Alignment::VERTICAL_CENTER);
|
||||||
|
$i++;
|
||||||
|
$sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('ist_pop_id'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10);
|
||||||
|
$sheet->getStyle($col[$i].$line)->getAlignment()->setVertical(Alignment::VERTICAL_CENTER);
|
||||||
|
$sheet->getStyle($col[$i].$line)->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB($lightgreen);
|
||||||
|
$i++;
|
||||||
|
|
||||||
|
$sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('schrank'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10);
|
||||||
|
$i++;
|
||||||
|
$sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('ist_schrank'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10);
|
||||||
|
$sheet->getStyle($col[$i].$line)->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB($lightgreen);
|
||||||
|
$i++;
|
||||||
|
|
||||||
|
$sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('baugruppe'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10);
|
||||||
|
$i++;
|
||||||
|
$sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('ist_baugruppe'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10);
|
||||||
|
$sheet->getStyle($col[$i].$line)->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB($lightgreen);
|
||||||
|
$i++;
|
||||||
|
|
||||||
|
$sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('modul'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10);
|
||||||
|
$i++;
|
||||||
|
$sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('ist_modul'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10);
|
||||||
|
$sheet->getStyle($col[$i].$line)->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB($lightgreen);
|
||||||
|
$i++;
|
||||||
|
|
||||||
|
$sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('ports'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10);
|
||||||
|
$i++;
|
||||||
|
$sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('ist_ports'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10);
|
||||||
|
$sheet->getStyle($col[$i].$line)->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB($lightgreen);
|
||||||
|
$i++;
|
||||||
|
|
||||||
|
$sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('abschlusstyp'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10);
|
||||||
|
$i++;
|
||||||
|
$sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('ist_abschlusstyp'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10);
|
||||||
|
$sheet->getStyle($col[$i].$line)->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB($lightgreen);
|
||||||
|
$i++;
|
||||||
|
|
||||||
|
$sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('bb_kabel'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10);
|
||||||
|
$i++;
|
||||||
|
$sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('ist_bb_kabel'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10);
|
||||||
|
$sheet->getStyle($col[$i].$line)->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB($lightgreen);
|
||||||
|
$i++;
|
||||||
|
|
||||||
|
$sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('bb_kabel_steps'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10);
|
||||||
|
$i++;
|
||||||
|
$sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('ist_bb_kabel_steps'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10);
|
||||||
|
$sheet->getStyle($col[$i].$line)->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB($lightgreen);
|
||||||
|
$i++;
|
||||||
|
|
||||||
|
$sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('bb_fasern'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10);
|
||||||
|
$i++;
|
||||||
|
$sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('ist_bb_fasern'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10);
|
||||||
|
$sheet->getStyle($col[$i].$line)->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB($lightgreen);
|
||||||
|
$i++;
|
||||||
|
|
||||||
|
$sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('kundenkabel_typ'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10);
|
||||||
|
$i++;
|
||||||
|
$sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('ist_kundenkabel_typ'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10);
|
||||||
|
$sheet->getStyle($col[$i].$line)->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB($lightgreen);
|
||||||
|
$i++;
|
||||||
|
|
||||||
|
$sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('kundenkabel_fasern'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10);
|
||||||
|
$i++;
|
||||||
|
$sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('ist_kundenkabel_fasern'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10);
|
||||||
|
$sheet->getStyle($col[$i].$line)->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB($lightgreen);
|
||||||
|
$i++;
|
||||||
|
|
||||||
|
$sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('backbone_finished'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10);
|
||||||
|
$sheet->getStyle($col[$i].$line)->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB($lightgreen);
|
||||||
|
$i++;
|
||||||
|
|
||||||
|
$sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('backbone_setup_date'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10);
|
||||||
|
$sheet->getStyle($col[$i].$line)->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB($lightgreen);
|
||||||
|
$i++;
|
||||||
|
|
||||||
|
$sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('customer_setup_date'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10);
|
||||||
|
$sheet->getStyle($col[$i].$line)->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB($lightgreen);
|
||||||
|
$i++;
|
||||||
|
|
||||||
|
$sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('bep_deployed'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10);
|
||||||
|
$sheet->getStyle($col[$i].$line)->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB($lightgreen);
|
||||||
|
$i++;
|
||||||
|
|
||||||
|
$sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('customer_cable_injected'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10);
|
||||||
|
$sheet->getStyle($col[$i].$line)->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB($lightgreen);
|
||||||
|
$i++;
|
||||||
|
|
||||||
|
$sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('spliced_network'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10);
|
||||||
|
$sheet->getStyle($col[$i].$line)->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB($lightgreen);
|
||||||
|
$i++;
|
||||||
|
|
||||||
|
$sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('spliced_customer'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10);
|
||||||
|
$sheet->getStyle($col[$i].$line)->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB($lightgreen);
|
||||||
|
$i++;
|
||||||
|
|
||||||
|
$sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('ont_deployed'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10);
|
||||||
|
$sheet->getStyle($col[$i].$line)->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB($lightgreen);
|
||||||
|
$i++;
|
||||||
|
|
||||||
|
$sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('ont_sn'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10);
|
||||||
|
$sheet->getStyle($col[$i].$line)->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB($lightgreen);
|
||||||
|
$i++;
|
||||||
|
|
||||||
|
$sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('customer_passive_finished'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10);
|
||||||
|
$sheet->getStyle($col[$i].$line)->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB($lightgreen);
|
||||||
|
$i++;
|
||||||
|
|
||||||
|
|
||||||
|
$sheet->setCellValue($col[$i].$line, $building->workflow_comment);
|
||||||
|
$sheet->getStyle($col[$i].$line)->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB($lightgreen);
|
||||||
|
$i++;
|
||||||
|
|
||||||
|
$sheet->setCellValue($col[$i].$line, $term->workflow_comment);
|
||||||
|
$sheet->getStyle($col[$i].$line)->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB($lightgreen);
|
||||||
|
$i++;
|
||||||
|
|
||||||
|
$sheet->getRowDimension($line)->setRowHeight(16);
|
||||||
|
$line++;
|
||||||
|
|
||||||
|
|
||||||
|
// progress
|
||||||
|
if($progress) {
|
||||||
|
$progress_percent = floor(($line * 100) / $lineMax);
|
||||||
|
$progress->progress = $progress_percent;
|
||||||
|
if($progress_percent >= 100) {
|
||||||
|
$progress->progress = 99;
|
||||||
|
}
|
||||||
|
$progress->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$sheet->freezePane("A2");
|
||||||
|
//$sheet->getStyle("A2:".$col[$i].$line)->getFont()->setName("monospace")->setSize(10);
|
||||||
|
$sheet->getStyle("A2:".$col[$i].$line)->getBorders()->getAllBorders()->setBorderStyle(Border::BORDER_HAIR)->setColor(new Color("C0C0C0"));
|
||||||
|
//$sheet->getStyle("A2:".$col[$i].$line)->getBorders()->getBottom()->setBorderStyle(Border::BORDER_MEDIUM);
|
||||||
|
//$sheet->getStyle("A2:".$col[$i].$line)->getBorders()->getLeft()->setBorderStyle(Border::BORDER_MEDIUM);
|
||||||
|
//$sheet->getStyle("A2:".$col[$i].$line)->getBorders()->getRight()->setBorderStyle(Border::BORDER_MEDIUM);
|
||||||
|
|
||||||
|
|
||||||
|
for($c = 0; $c < $i-2; $c++) {
|
||||||
|
$sheet->getColumnDimension($col[$c])->setAutoSize(true);
|
||||||
|
}
|
||||||
|
$sheet->getColumnDimension($col[$c])->setWidth(6, "in");
|
||||||
|
$sheet->getColumnDimension($col[$c+1])->setWidth(6, "in");
|
||||||
|
|
||||||
|
//$writer = new Xls($xls);
|
||||||
|
$writer = new Xlsx($xls);
|
||||||
|
|
||||||
|
//header("Content-type: application/vnd.ms-excel");
|
||||||
|
//header("Content-type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||||
|
|
||||||
|
//header('Content-disposition: attachment; filename="leitungsbau-'.date('Y-m-d_H-i-s').'-'.uniqid().'.xlsx"');
|
||||||
|
$writer->save($path."/".$filename);
|
||||||
|
|
||||||
|
$progress->progress = 100;
|
||||||
|
$progress->save();
|
||||||
|
|
||||||
|
exit;
|
||||||
|
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
class LineworkController extends mfBaseController {
|
class LineworkController extends mfBaseController {
|
||||||
|
|
||||||
protected function init() {
|
protected function init() {
|
||||||
$this->needlogin=true;
|
$this->needlogin = true;
|
||||||
$me = mfValuecache::singleton()->get("me");
|
$me = mfValuecache::singleton()->get("me");
|
||||||
if(!$me) {
|
if(!$me) {
|
||||||
$me = new User();
|
$me = new User();
|
||||||
@@ -32,14 +32,24 @@ class LineworkController extends mfBaseController {
|
|||||||
$pagination['count'] = 20;
|
$pagination['count'] = 20;
|
||||||
$pagination['maxItems'] = 0;
|
$pagination['maxItems'] = 0;
|
||||||
|
|
||||||
if($this->request->export) {
|
|
||||||
$this->layout()->setTemplate("Linework/export.xls");
|
|
||||||
$pagination = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(is_numeric($this->request->s)) {
|
if(is_numeric($this->request->s)) {
|
||||||
$pagination['start'] = intval($this->request->s);
|
$pagination['start'] = intval($this->request->s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($this->request->export) {
|
||||||
|
$this->layout()->setTemplate("Linework/export.xls");
|
||||||
|
$pagination = [];
|
||||||
|
}
|
||||||
|
if($this->request->export_progress) {
|
||||||
|
$this->layout()->setTemplate("Linework/export_progress.xls");
|
||||||
|
if($this->request->uid) {
|
||||||
|
$this->layout()->set("export_uid", $this->request->uid);
|
||||||
|
$this->layout()->set("path", BASEDIR."/var/temp/export");
|
||||||
|
}
|
||||||
|
$pagination = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//var_dump($pagination);exit;
|
//var_dump($pagination);exit;
|
||||||
$my_networks = [];
|
$my_networks = [];
|
||||||
|
|
||||||
@@ -103,7 +113,6 @@ class LineworkController extends mfBaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$networks = [];
|
$networks = [];
|
||||||
|
|
||||||
$pagination['maxItems'] = TerminationModel::count($termination_search);
|
$pagination['maxItems'] = TerminationModel::count($termination_search);
|
||||||
foreach(TerminationModel::search($termination_search, $pagination) as $term) {
|
foreach(TerminationModel::search($termination_search, $pagination) as $term) {
|
||||||
if(!array_key_exists($term->building->network->name, $networks)) {
|
if(!array_key_exists($term->building->network->name, $networks)) {
|
||||||
@@ -138,9 +147,7 @@ class LineworkController extends mfBaseController {
|
|||||||
$this->layout()->set("networks", $networks);
|
$this->layout()->set("networks", $networks);
|
||||||
$this->layout()->set("pagination", $pagination);
|
$this->layout()->set("pagination", $pagination);
|
||||||
//var_dump($networks);exit;
|
//var_dump($networks);exit;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getPreparedFilter($filter) {
|
private function getPreparedFilter($filter) {
|
||||||
@@ -165,6 +172,115 @@ class LineworkController extends mfBaseController {
|
|||||||
return $new_filter;
|
return $new_filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function startExport($request) {
|
||||||
|
$this->request = new mfRequest($request);
|
||||||
|
//var_dump($request);exit;
|
||||||
|
return $this->indexAction();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function exportAction() {
|
||||||
|
$uid = "wfExport_".uniqid()."-".mt_rand(10000,99999);
|
||||||
|
|
||||||
|
$method = "http";
|
||||||
|
if($_SERVER['HTTPS'] == "on") {
|
||||||
|
$method = "https";
|
||||||
|
}
|
||||||
|
|
||||||
|
$get = $this->request->get();
|
||||||
|
unset($get['mod']);
|
||||||
|
unset($get['action']);
|
||||||
|
$get['export_progress'] = 1;
|
||||||
|
$get['uid'] = $uid;
|
||||||
|
$url = $method."://".$_SERVER['HTTP_HOST'].$this->getUrl("Linework", "Index", $get);
|
||||||
|
$url = escapeshellarg($url);
|
||||||
|
//var_dump($url);exit;
|
||||||
|
|
||||||
|
$progress = new WorkflowExport();
|
||||||
|
$progress->uid = $uid;
|
||||||
|
$progress->create_by = $this->me->id;
|
||||||
|
$progress->edit_by = $this->me->id;
|
||||||
|
$progress->save();
|
||||||
|
/*
|
||||||
|
$cmd = "nohup curl ".$url." >/dev/null 2>&1 &";
|
||||||
|
var_dump($cmd);exit;
|
||||||
|
// start excel generation in background and dont wait
|
||||||
|
exec($cmd);
|
||||||
|
*/
|
||||||
|
|
||||||
|
$cmd = BASEDIR."/scripts/start_workflow_export.php";
|
||||||
|
$args = "";
|
||||||
|
|
||||||
|
foreach($get['filter'] as $key => $value) {
|
||||||
|
$args .= " ".escapeshellarg("--$key")." ". escapeshellarg($value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$cmd = "$cmd --uid ". escapeshellarg($uid)." $args >/dev/null 2>&1 &";
|
||||||
|
exec($cmd);
|
||||||
|
|
||||||
|
// return progress
|
||||||
|
$this->returnJson(['status' => "OK", 'uid' => $uid, "progress" => 0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function exportProgressAction() {
|
||||||
|
$uid = $this->request->uid;
|
||||||
|
if(!$uid) {
|
||||||
|
$this->returnJson(['status' => "error", "msg" => "no uid"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$progress = new WorkflowExport();
|
||||||
|
$progress->loadByUid($this->request->uid);
|
||||||
|
if(!$progress->id) {
|
||||||
|
$this->returnJson(['status' => "error", "msg" => "export not found"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->returnJson(['status' => "OK", 'export_uid ' => $uid, 'progress' => $progress->progress]);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function downloadExportAction() {
|
||||||
|
$uid = $this->request->uid;
|
||||||
|
if(!$uid) {
|
||||||
|
$this->returnJson(['status' => "error", "msg" => "no uid"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$progress = new WorkflowExport();
|
||||||
|
$progress->loadByUid($this->request->uid);
|
||||||
|
if(!$progress->id) {
|
||||||
|
$this->returnJson(['status' => "error", "msg" => "export not found"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$file = BASEDIR."/var/temp/export/".$progress->filename;
|
||||||
|
|
||||||
|
if (!$fh = fopen($file, 'r')) {
|
||||||
|
$this->layout()->setFlash("Fehler beim Export.", "error");
|
||||||
|
$this->redirect("Linework");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
set_time_limit(36000);
|
||||||
|
header("Content-type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||||
|
header('Content-disposition: attachment; filename="' . $progress->filename . '"');
|
||||||
|
|
||||||
|
$size = exec('stat -c %s '.escapeshellarg($file));
|
||||||
|
|
||||||
|
$this->log->debug("filename: ".$file);
|
||||||
|
$this->log->debug("filesize: ".$size);
|
||||||
|
|
||||||
|
if(strlen($size)) {
|
||||||
|
if($size < (pow(2,31))-1) {
|
||||||
|
header('Content-Length: ' . $size);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
while (!feof($fh)) {
|
||||||
|
$data = fread($fh, 8192);
|
||||||
|
echo $data;
|
||||||
|
}
|
||||||
|
exit;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
protected function saveAction() {
|
protected function saveAction() {
|
||||||
$r = $this->request;
|
$r = $this->request;
|
||||||
//var_dump($r->get());exit;
|
//var_dump($r->get());exit;
|
||||||
|
|||||||
@@ -127,6 +127,8 @@ class TerminationModel {
|
|||||||
private function getSqlFilter($filter) {
|
private function getSqlFilter($filter) {
|
||||||
$where = "1=1 ";
|
$where = "1=1 ";
|
||||||
|
|
||||||
|
//var_dump($filter);exit;
|
||||||
|
|
||||||
if(array_key_exists("building_id", $filter)) {
|
if(array_key_exists("building_id", $filter)) {
|
||||||
$building_id = $filter['building_id'];
|
$building_id = $filter['building_id'];
|
||||||
|
|
||||||
|
|||||||
17
application/WorkflowExport/WorkflowExport.php
Normal file
17
application/WorkflowExport/WorkflowExport.php
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class WorkflowExport extends mfBaseModel {
|
||||||
|
|
||||||
|
public function loadByUid($uid) {
|
||||||
|
if(!$uid) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$uid = $this->db->escape($uid);
|
||||||
|
|
||||||
|
$res = $this->db->select("WorkflowExport", "*", "uid='$uid' ORDER BY id DESC LIMIT 1");
|
||||||
|
if($this->db->num_rows($res)) {
|
||||||
|
$this->load($this->db->fetch_object($res));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
67
scripts/start_workflow_export.php
Executable file
67
scripts/start_workflow_export.php
Executable file
@@ -0,0 +1,67 @@
|
|||||||
|
#!/usr/bin/php
|
||||||
|
<?php
|
||||||
|
|
||||||
|
//require 'vendor/autoload.php';
|
||||||
|
require("../config/config.php");
|
||||||
|
|
||||||
|
define('FRONKDB_SQLDEBUG',false);
|
||||||
|
error_reporting(E_ALL & ~(E_NOTICE | E_STRICT | E_DEPRECATED));
|
||||||
|
|
||||||
|
require_once(LIBDIR."/mvcfronk/mfRouter/mfRouter.php");
|
||||||
|
require_once(LIBDIR."/mvcfronk/mfBase/mfBaseModel.php");
|
||||||
|
require_once(LIBDIR."/mvcfronk/mfBase/mfBaseController.php");
|
||||||
|
|
||||||
|
$me = new User(1);
|
||||||
|
mfValuecache::singleton()->set("me", $me);
|
||||||
|
|
||||||
|
$request=array();
|
||||||
|
|
||||||
|
// Put commandline arguments into $request
|
||||||
|
if(count($argv)) {
|
||||||
|
$args=$argv;
|
||||||
|
array_shift($args); // shift scriptname off of args array
|
||||||
|
|
||||||
|
foreach($args as $i => $arg) {
|
||||||
|
if(preg_match('/^--([^ ]+)/',$arg,$m)) {
|
||||||
|
if(!preg_match('/^--/',$args[$i+1])) {
|
||||||
|
$request[$m[1]]=$args[$i+1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//var_dump($request);exit;
|
||||||
|
|
||||||
|
|
||||||
|
if(array_key_exists("uid", $request)) {
|
||||||
|
if($request['uid']) {
|
||||||
|
$uid = $request['uid'];
|
||||||
|
unset($request['uid']);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
die("uid missing\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$filter = [];
|
||||||
|
|
||||||
|
foreach($request as $key => $value) {
|
||||||
|
if(strlen($value)) {
|
||||||
|
$filter[$key] = $value;
|
||||||
|
} else {
|
||||||
|
if($key == "status_id" || $key == "network_id" || $key == "networksection_id") {
|
||||||
|
$filter[$key] = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$params = ['export_progress' => 1, 'uid' => $uid, 'filter' => $filter];
|
||||||
|
|
||||||
|
//var_dump($uid, $filter);exit;
|
||||||
|
|
||||||
|
$Layout=Layout::singleton();
|
||||||
|
|
||||||
|
$lc = new LineworkController();
|
||||||
|
$lc->startExport($params);
|
||||||
|
|
||||||
|
$Layout->display();
|
||||||
Reference in New Issue
Block a user