Skip to content

Commit 4c20afc

Browse files
committed
migration of excel package
1 parent f0d76d6 commit 4c20afc

11 files changed

Lines changed: 93 additions & 96 deletions

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"league/oauth2-client": "^2.4",
2222
"omines/oauth2-gitlab": "^3.2",
2323
"league/oauth2-github": "^2.0",
24-
"league/oauth2-google": "^3.0"
24+
"league/oauth2-google": "^3.0",
25+
"phpoffice/phpspreadsheet": "^1.29"
2526
}
2627
}

lib/functions/common.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1464,9 +1464,9 @@ function getWebEditorCfg($feature='all')
14641464
function downloadXls($fname,$xlsType,$gui,$filePrefix)
14651465
{
14661466
$sets = array();
1467-
$sets['Excel2007'] = array('ext' => '.xlsx',
1467+
$sets['Xlsx'] = array('ext' => '.xlsx',
14681468
'Content-Type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
1469-
$sets['Excel5'] = array('ext' => '.xls',
1469+
$sets['Xls'] = array('ext' => '.xls',
14701470
'Content-Type' => 'application/vnd.ms-excel');
14711471

14721472

lib/results/baselinel1l2.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
require('../../config.inc.php');
1010

1111
// Must be included BEFORE common.php
12-
require_once('../../third_party/codeplex/PHPExcel.php');
12+
require_once('../../vendor/autoload.php');
1313

1414
require_once('common.php');
1515
require_once('displayMgr.php');
@@ -262,7 +262,7 @@ function createSpreadsheet($gui,$args,&$tplanMgr) {
262262
}
263263
$dataHeaderMetrics[] = $lbl['completed_perc'];
264264

265-
$objPHPExcel = new PHPExcel();
265+
$objPHPExcel = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
266266
$lines2write = xlsStepOne($objPHPExcel,$style,$lbl,$gui);
267267

268268
$oneLevel = array();
@@ -474,8 +474,8 @@ function createSpreadsheet($gui,$args,&$tplanMgr) {
474474
// Final step
475475
$tmpfname = tempnam(config_get('temp_dir'),"TestLink_GTMP.tmp");
476476
$objPHPExcel->setActiveSheetIndex(0);
477-
$xlsType = 'Excel5';
478-
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, $xlsType);
477+
$xlsType = 'Xls';
478+
$objWriter = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($objPHPExcel, $xlsType);
479479
$objWriter->save($tmpfname);
480480

481481
downloadXls($tmpfname,$xlsType,$gui,'TestLink_GTMP_');
@@ -534,32 +534,32 @@ function initStyleSpreadsheet() {
534534
array('font' => array('bold' => true),
535535
'borders' =>
536536
array('outline' =>
537-
array('style' => PHPExcel_Style_Border::BORDER_MEDIUM),
537+
array('style' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_MEDIUM),
538538
'vertical' =>
539-
array('style' => PHPExcel_Style_Border::BORDER_THIN)),
540-
'fill' => array('type' => PHPExcel_Style_Fill::FILL_SOLID,
539+
array('style' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN)),
540+
'fill' => array('type' => \PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID,
541541
'startcolor' => array( 'argb' => 'FF9999FF'))
542542
);
543543

544544
$style['rowA'] =
545545
array('borders' =>
546546
array(
547547
'outline' =>
548-
array('style' => PHPExcel_Style_Border::BORDER_THIN),
548+
array('style' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN),
549549
'vertical' =>
550-
array('style' => PHPExcel_Style_Border::BORDER_THIN)),
551-
'fill' => array('type' => PHPExcel_Style_Fill::FILL_SOLID,
550+
array('style' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN)),
551+
'fill' => array('type' => \PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID,
552552
'startcolor' => array( 'argb' => 'FFFFFFFF'))
553553
);
554554

555555
$style['rowB'] =
556556
array('borders' =>
557557
array(
558558
'outline' =>
559-
array('style' => PHPExcel_Style_Border::BORDER_THIN),
559+
array('style' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN),
560560
'vertical' =>
561-
array('style' => PHPExcel_Style_Border::BORDER_THIN)),
562-
'fill' => array('type' => PHPExcel_Style_Fill::FILL_SOLID,
561+
array('style' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN)),
562+
'fill' => array('type' => \PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID,
563563
'startcolor' => array( 'argb' => 'DCDCDCDC'))
564564
);
565565

lib/results/execTimelineStats.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
require('../../config.inc.php');
1010

1111
// Must be included BEFORE common.php
12-
require_once('../../third_party/codeplex/PHPExcel.php');
12+
require_once('../../vendor/autoload.php');
1313

1414
require_once('common.php');
1515
require_once('displayMgr.php');
@@ -184,7 +184,7 @@ function createSpreadsheet($gui,$args,&$tplanMgr)
184184
break;
185185
}
186186

187-
$objPHPExcel = new PHPExcel();
187+
$objPHPExcel = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
188188
$lines2write = xlsStepOne($objPHPExcel,$style,$lbl,$gui);
189189
$startingRow = count($lines2write); // MAGIC
190190
$dataHeader = array();
@@ -226,8 +226,8 @@ function createSpreadsheet($gui,$args,&$tplanMgr)
226226
// Final step
227227
$tmpfname = tempnam(config_get('temp_dir'),"TL_ExecTimelineStats.tmp");
228228
$objPHPExcel->setActiveSheetIndex(0);
229-
$xlsType = 'Excel5';
230-
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, $xlsType);
229+
$xlsType = 'Xls';
230+
$objWriter = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($objPHPExcel, $xlsType);
231231
$objWriter->save($tmpfname);
232232

233233
downloadXls($tmpfname,$xlsType,$gui,'TL_ExecTimelineStats_');
@@ -285,32 +285,32 @@ function initStyleSpreadsheet() {
285285
array('font' => array('bold' => true),
286286
'borders' =>
287287
array('outline' =>
288-
array('style' => PHPExcel_Style_Border::BORDER_MEDIUM),
288+
array('style' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_MEDIUM),
289289
'vertical' =>
290-
array('style' => PHPExcel_Style_Border::BORDER_THIN)),
291-
'fill' => array('type' => PHPExcel_Style_Fill::FILL_SOLID,
290+
array('style' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN)),
291+
'fill' => array('type' => \PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID,
292292
'startcolor' => array( 'argb' => 'FF9999FF'))
293293
);
294294

295295
$style['rowA'] =
296296
array('borders' =>
297297
array(
298298
'outline' =>
299-
array('style' => PHPExcel_Style_Border::BORDER_THIN),
299+
array('style' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN),
300300
'vertical' =>
301-
array('style' => PHPExcel_Style_Border::BORDER_THIN)),
302-
'fill' => array('type' => PHPExcel_Style_Fill::FILL_SOLID,
301+
array('style' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN)),
302+
'fill' => array('type' => \PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID,
303303
'startcolor' => array( 'argb' => 'FFFFFFFF'))
304304
);
305305

306306
$style['rowB'] =
307307
array('borders' =>
308308
array(
309309
'outline' =>
310-
array('style' => PHPExcel_Style_Border::BORDER_THIN),
310+
array('style' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN),
311311
'vertical' =>
312-
array('style' => PHPExcel_Style_Border::BORDER_THIN)),
313-
'fill' => array('type' => PHPExcel_Style_Fill::FILL_SOLID,
312+
array('style' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN)),
313+
'fill' => array('type' => \PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID,
314314
'startcolor' => array( 'argb' => 'DCDCDCDC'))
315315
);
316316

lib/results/neverRunByPP.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
require('../../config.inc.php');
1616

1717
// Must be included BEFORE common.php
18-
require_once('../../third_party/codeplex/PHPExcel.php');
18+
require_once('../../vendor/autoload.php');
1919

2020
require_once('common.php');
2121
require_once('displayMgr.php');
@@ -386,7 +386,7 @@ function createSpreadsheet($gui,$args,$media) {
386386
$cellRange = range('A','Z');
387387
$style = initStyleSpreadsheet();
388388

389-
$objPHPExcel = new PHPExcel();
389+
$objPHPExcel = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
390390
$lines2write = xlsStepOne($objPHPExcel,$style,$lbl,$gui);
391391

392392
// Step 2
@@ -437,8 +437,8 @@ function createSpreadsheet($gui,$args,$media) {
437437
// Final step
438438
$objPHPExcel->setActiveSheetIndex(0);
439439

440-
$xlsType = 'Excel5';
441-
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, $xlsType);
440+
$xlsType = 'Xls';
441+
$objWriter = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($objPHPExcel, $xlsType);
442442

443443
$codex = 'neverRunByPP';
444444
$tmpfname = tempnam(config_get('temp_dir'),"$codex.tmp");
@@ -502,9 +502,9 @@ function initStyleSpreadsheet() {
502502
$sty = array();
503503
$sty['ReportContext'] = array('font' => array('bold' => true));
504504
$sty['DataHeader'] = array('font' => array('bold' => true),
505-
'borders' => array('outline' => array('style' => PHPExcel_Style_Border::BORDER_MEDIUM),
506-
'vertical' => array('style' => PHPExcel_Style_Border::BORDER_THIN)),
507-
'fill' => array('type' => PHPExcel_Style_Fill::FILL_SOLID,
505+
'borders' => array('outline' => array('style' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_MEDIUM),
506+
'vertical' => array('style' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN)),
507+
'fill' => array('type' => \PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID,
508508
'startcolor' => array( 'argb' => 'FF9999FF'))
509509
);
510510

lib/results/resultsByStatus.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
require('../../config.inc.php');
1818

1919
// Must be included BEFORE common.php
20-
require_once('../../third_party/codeplex/PHPExcel.php');
20+
require_once('../../vendor/autoload.php');
2121

2222
require_once('common.php');
2323
require_once('displayMgr.php');
@@ -716,7 +716,7 @@ function createSpreadsheet($gui,$args,$media,$customFieldColumns=null)
716716
$cellRange = range('A','Z');
717717
$style = initStyleSpreadsheet();
718718

719-
$objPHPExcel = new PHPExcel();
719+
$objPHPExcel = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
720720
$lines2write = xlsStepOne($objPHPExcel,$style,$lbl,$gui);
721721

722722
// Step 2
@@ -823,8 +823,8 @@ function createSpreadsheet($gui,$args,$media,$customFieldColumns=null)
823823
// Final step
824824
$objPHPExcel->setActiveSheetIndex(0);
825825

826-
$xlsType = 'Excel5';
827-
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, $xlsType);
826+
$xlsType = 'Xls';
827+
$objWriter = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($objPHPExcel, $xlsType);
828828

829829
$tmpfname = tempnam(config_get('temp_dir'),"resultsByStatus.tmp");
830830
$objWriter->save($tmpfname);
@@ -911,9 +911,9 @@ function initStyleSpreadsheet()
911911
$sty = array();
912912
$sty['ReportContext'] = array('font' => array('bold' => true));
913913
$sty['DataHeader'] = array('font' => array('bold' => true),
914-
'borders' => array('outline' => array('style' => PHPExcel_Style_Border::BORDER_MEDIUM),
915-
'vertical' => array('style' => PHPExcel_Style_Border::BORDER_THIN)),
916-
'fill' => array('type' => PHPExcel_Style_Fill::FILL_SOLID,
914+
'borders' => array('outline' => array('style' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_MEDIUM),
915+
'vertical' => array('style' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN)),
916+
'fill' => array('type' => \PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID,
917917
'startcolor' => array( 'argb' => 'FF9999FF'))
918918
);
919919

lib/results/resultsByTSuite.php

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@
88
*/
99
require('../../config.inc.php');
1010

11-
// Must be included BEFORE common.php
12-
require_once('../../third_party/codeplex/PHPExcel.php');
13-
11+
require_once('../../vendor/autoload.php');
1412
require_once('common.php');
1513
require_once('displayMgr.php');
1614

@@ -241,7 +239,7 @@ function createSpreadsheet($gui,$args,&$tplanMgr) {
241239
}
242240
$dataHeaderMetrics[] = $lbl['completed_perc'];
243241

244-
$objPHPExcel = new PHPExcel();
242+
$objPHPExcel = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
245243
$lines2write = xlsStepOne($objPHPExcel,$style,$lbl,$gui);
246244

247245
$oneLevel = array();
@@ -453,8 +451,8 @@ function createSpreadsheet($gui,$args,&$tplanMgr) {
453451
// Final step
454452
$tmpfname = tempnam(config_get('temp_dir'),"TestLink_GTMP.tmp");
455453
$objPHPExcel->setActiveSheetIndex(0);
456-
$xlsType = 'Excel5';
457-
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, $xlsType);
454+
$xlsType = 'Xls';
455+
$objWriter = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($objPHPExcel, $xlsType);
458456
$objWriter->save($tmpfname);
459457

460458
downloadXls($tmpfname,$xlsType,$gui,'TestLink_GTMP_');
@@ -513,32 +511,32 @@ function initStyleSpreadsheet() {
513511
array('font' => array('bold' => true),
514512
'borders' =>
515513
array('outline' =>
516-
array('style' => PHPExcel_Style_Border::BORDER_MEDIUM),
514+
array('style' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_MEDIUM),
517515
'vertical' =>
518-
array('style' => PHPExcel_Style_Border::BORDER_THIN)),
519-
'fill' => array('type' => PHPExcel_Style_Fill::FILL_SOLID,
516+
array('style' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN)),
517+
'fill' => array('type' => \PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID,
520518
'startcolor' => array( 'argb' => 'FF9999FF'))
521519
);
522520

523521
$style['rowA'] =
524522
array('borders' =>
525523
array(
526524
'outline' =>
527-
array('style' => PHPExcel_Style_Border::BORDER_THIN),
525+
array('style' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN),
528526
'vertical' =>
529-
array('style' => PHPExcel_Style_Border::BORDER_THIN)),
530-
'fill' => array('type' => PHPExcel_Style_Fill::FILL_SOLID,
527+
array('style' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN)),
528+
'fill' => array('type' => \PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID,
531529
'startcolor' => array( 'argb' => 'FFFFFFFF'))
532530
);
533531

534532
$style['rowB'] =
535533
array('borders' =>
536534
array(
537535
'outline' =>
538-
array('style' => PHPExcel_Style_Border::BORDER_THIN),
536+
array('style' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN),
539537
'vertical' =>
540-
array('style' => PHPExcel_Style_Border::BORDER_THIN)),
541-
'fill' => array('type' => PHPExcel_Style_Fill::FILL_SOLID,
538+
array('style' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN)),
539+
'fill' => array('type' => \PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID,
542540
'startcolor' => array( 'argb' => 'DCDCDCDC'))
543541
);
544542

lib/results/resultsGeneral.php

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@
88
*/
99
require('../../config.inc.php');
1010

11-
// Must be included BEFORE common.php
12-
require_once('../../third_party/codeplex/PHPExcel.php');
13-
11+
require_once('../../vendor/autoload.php');
1412
require_once('common.php');
1513
require_once('displayMgr.php');
1614

@@ -314,7 +312,7 @@ function createSpreadsheet($gui,$args,&$tplanMgr) {
314312
}
315313
$dataHeaderMetrics[] = $lbl['completed_perc'];
316314

317-
$objPHPExcel = new PHPExcel();
315+
$objPHPExcel = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
318316
$lines2write = xlsStepOne($objPHPExcel,$style,$lbl,$gui);
319317

320318
$oneLevel = array();
@@ -528,8 +526,8 @@ function createSpreadsheet($gui,$args,&$tplanMgr) {
528526
// Final step
529527
$tmpfname = tempnam(config_get('temp_dir'),"TestLink_GTMP.tmp");
530528
$objPHPExcel->setActiveSheetIndex(0);
531-
$xlsType = 'Excel5';
532-
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, $xlsType);
529+
$xlsType = 'Xls';
530+
$objWriter = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($objPHPExcel, $xlsType);
533531
$objWriter->save($tmpfname);
534532

535533
downloadXls($tmpfname,$xlsType,$gui,'TestLink_GTMP_');
@@ -588,32 +586,32 @@ function initStyleSpreadsheet() {
588586
array('font' => array('bold' => true),
589587
'borders' =>
590588
array('outline' =>
591-
array('style' => PHPExcel_Style_Border::BORDER_MEDIUM),
589+
array('style' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_MEDIUM),
592590
'vertical' =>
593-
array('style' => PHPExcel_Style_Border::BORDER_THIN)),
594-
'fill' => array('type' => PHPExcel_Style_Fill::FILL_SOLID,
591+
array('style' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN)),
592+
'fill' => array('type' => \PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID,
595593
'startcolor' => array( 'argb' => 'FF9999FF'))
596594
);
597595

598596
$style['rowA'] =
599597
array('borders' =>
600598
array(
601599
'outline' =>
602-
array('style' => PHPExcel_Style_Border::BORDER_THIN),
600+
array('style' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN),
603601
'vertical' =>
604-
array('style' => PHPExcel_Style_Border::BORDER_THIN)),
605-
'fill' => array('type' => PHPExcel_Style_Fill::FILL_SOLID,
602+
array('style' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN)),
603+
'fill' => array('type' => \PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID,
606604
'startcolor' => array( 'argb' => 'FFFFFFFF'))
607605
);
608606

609607
$style['rowB'] =
610608
array('borders' =>
611609
array(
612610
'outline' =>
613-
array('style' => PHPExcel_Style_Border::BORDER_THIN),
611+
array('style' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN),
614612
'vertical' =>
615-
array('style' => PHPExcel_Style_Border::BORDER_THIN)),
616-
'fill' => array('type' => PHPExcel_Style_Fill::FILL_SOLID,
613+
array('style' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN)),
614+
'fill' => array('type' => \PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID,
617615
'startcolor' => array( 'argb' => 'DCDCDCDC'))
618616
);
619617

0 commit comments

Comments
 (0)