From b2cc1a122e283ce12af77917e857a863b26a7db2 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Fri, 14 Feb 2025 08:22:12 +0100 Subject: [PATCH 1/2] support for skipping default columns --- inc/inc.ClassDownloadMgr.php | 37 ++++++++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/inc/inc.ClassDownloadMgr.php b/inc/inc.ClassDownloadMgr.php index b77d1aac8..d809e0526 100644 --- a/inc/inc.ClassDownloadMgr.php +++ b/inc/inc.ClassDownloadMgr.php @@ -93,6 +93,12 @@ class SeedDMS_Download_Mgr { */ protected $filenames; + /** + * @var boolean $skipdefaultcols skip default columns, will only export extracols + * @access protected + */ + protected $skipdefaultcols; + function __construct($tmpdir = '') { $this->tmpdir = $tmpdir; $this->items = array(); @@ -105,8 +111,13 @@ class SeedDMS_Download_Mgr { $this->extraheader = array(); $this->folder_extraheader = array(); $this->filenames = array(); + $this->skipdefaultcols = false; } + public function setSkipDefaultCols($v) { /* {{{ */ + $this->skipdefaultcols = (bool) $v; + } /* }}} */ + public function addHeader($extraheader) { /* {{{ */ $this->extraheader = $extraheader; } /* }}} */ @@ -137,8 +148,9 @@ class SeedDMS_Download_Mgr { $i = 1; $col = 1; - foreach($this->header as $h) - $sheet->setCellValue([$col++, $i], $h); + if(!$this->skipdefaultcols) + foreach($this->header as $h) + $sheet->setCellValue([$col++, $i], $h); foreach($this->extraheader as $h) $sheet->setCellValue([$col++, $i], $h); $i++; @@ -151,13 +163,14 @@ class SeedDMS_Download_Mgr { $approvalStatus = $item->getApprovalStatus(); $col = 1; + $l = $i; // Number of reviewers + $k = $i; // Number of approvers + if(!$this->skipdefaultcols) { $sheet->setCellValue([$col++, $i], $document->getID()); $sheet->setCellValue([$col++, $i], $document->getName()); $sheet->setCellValue([$col++, $i], $document->getID()."-".$item->getOriginalFileName()); $sheet->setCellValue([$col++, $i], getOverallStatusText($status['status'])); $sheet->setCellValue([$col++, $i], $item->getVersion()); - $l = $i; - $k = $i; if($reviewStatus) { foreach ($reviewStatus as $r) { switch ($r["type"]) { @@ -181,7 +194,7 @@ class SeedDMS_Download_Mgr { $tcol = $col; $sheet->setCellValue([$tcol++, $l], $reqName); $sheet->setCellValue([$tcol, $l], ($r['status']==1 || $r['status']==-1) ? \PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel(new DateTime($r['date'])) : null); - $sheet->getStyleByColumnAndRow($tcol++, $l)->getNumberFormat()->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_DATETIME); + $sheet->getStyle([$tcol++, $l])->getNumberFormat()->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_DATETIME); $sheet->setCellValue([$tcol++, $l], $r['comment']); $sheet->setCellValue([$tcol++, $l], getReviewStatusText($r["status"])); $l++; @@ -212,7 +225,7 @@ class SeedDMS_Download_Mgr { $tcol = $col; $sheet->setCellValue([$tcol++, $k], $reqName); $sheet->setCellValue([$tcol, $k], ($r['status']==1 || $r['status']==-1) ? \PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel(new DateTime($r['date'])) : null); - $sheet->getStyleByColumnAndRow($tcol++, $k)->getNumberFormat()->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_DATETIME); + $sheet->getStyle([$tcol++, $k])->getNumberFormat()->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_DATETIME); $sheet->setCellValue([$tcol++, $k], $r['comment']); $sheet->setCellValue([$tcol++, $k], getApprovalStatusText($r["status"])); $k++; @@ -220,6 +233,7 @@ class SeedDMS_Download_Mgr { $k--; } $col += 4; + } if(isset($this->extracols[$item->getID()]) && $this->extracols[$item->getID()]) { foreach($this->extracols[$item->getID()] as $column) $sheet->setCellValue([$col++, $i], is_array($column) ? implode("\n", $column) : $column ); @@ -239,8 +253,9 @@ class SeedDMS_Download_Mgr { $i = 1; $col = 1; - foreach($this->folder_header as $h) - $sheet->setCellValue([$col++, $i], $h); + if(!$this->skipdefaultcols) + foreach($this->folder_header as $h) + $sheet->setCellValue([$col++, $i], $h); foreach($this->folder_extraheader as $h) $sheet->setCellValue([$col++, $i], $h); $i++; @@ -251,8 +266,10 @@ class SeedDMS_Download_Mgr { $dms = $folder->_dms; $col = 1; - $sheet->setCellValue([$col++, $i], $folder->getID()); - $sheet->setCellValue([$col++, $i], $folder->getName()); + if(!$this->skipdefaultcols) { + $sheet->setCellValue([$col++, $i], $folder->getID()); + $sheet->setCellValue([$col++, $i], $folder->getName()); + } if(isset($this->folder_extracols[$item->getID()]) && $this->folder_extracols[$item->getID()]) { foreach($this->folder_extracols[$item->getID()] as $column) $sheet->setCellValue([$col++, $i], is_array($column) ? implode("\n", $column) : $column ); From d4bfb539b7a08e5714c7ca0e507f5a73cee941d2 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Fri, 14 Feb 2025 08:22:40 +0100 Subject: [PATCH 2/2] eval parameter 'order' in config settings for select menus --- views/bootstrap/class.Settings.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/views/bootstrap/class.Settings.php b/views/bootstrap/class.Settings.php index f8dd86740..c3f4f9dab 100644 --- a/views/bootstrap/class.Settings.php +++ b/views/bootstrap/class.Settings.php @@ -693,9 +693,10 @@ if(($kkk = $this->callHook('getFullSearchEngine')) && is_array($kkk)) case 'select': $allowempty = empty($conf['allow_empty']) ? false : $conf['allow_empty']; $multiple = empty($conf['multiple']) ? false : $conf['multiple']; + $order = empty($conf['order']) ? '' : $conf['order']; if(!empty($conf['options'])) { $selections = empty($settings->_extensions[$extname][$confkey]) ? array() : explode(",", $settings->_extensions[$extname][$confkey]); - echo ""; if(is_array($conf['options'])) { $options = $conf['options']; } elseif(is_string($conf['options']) && $conf['options'] == 'hook') { @@ -709,7 +710,12 @@ if(($kkk = $this->callHook('getFullSearchEngine')) && is_array($kkk)) echo ""; + if(is_array($opt)) { + echo " data-subtitle=\"".htmlspecialchars($opt['subtitle'])."\">".htmlspecialchars($opt['value']); + } else { + echo ">".htmlspecialchars(getMLText($extname.'_'.$opt, array(), $opt)); + } + echo ""; } echo ""; } elseif(!empty($conf['internal'])) {