Commit 209e517471edd1ae10a53558635a769ce99a699b
1 parent
21a5ec22
KTS-2874
"New column for document type in browse view" Fixed. Added a new column class. Committed by: Megan Watson Reviewed by: Conrad Vermeulen git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@7954 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
2 changed files
with
29 additions
and
0 deletions
plugins/ktcore/KTColumns.inc.php
| @@ -448,6 +448,34 @@ class CheckedOutByColumn extends AdvancedColumn { | @@ -448,6 +448,34 @@ class CheckedOutByColumn extends AdvancedColumn { | ||
| 448 | } | 448 | } |
| 449 | } | 449 | } |
| 450 | 450 | ||
| 451 | +class DocumentTypeColumn extends AdvancedColumn { | ||
| 452 | + var $namespace = 'ktcore.columns.document_type'; | ||
| 453 | + var $sortable = false; | ||
| 454 | + | ||
| 455 | + function DocumentTypeColumn() { | ||
| 456 | + $this->label = _kt('Document Type'); | ||
| 457 | + $this->sortable = false; | ||
| 458 | + } | ||
| 459 | + | ||
| 460 | + function renderData($aDataRow) { | ||
| 461 | + // only show this for documents. | ||
| 462 | + if ($aDataRow['type'] === 'folder') { | ||
| 463 | + return ' '; | ||
| 464 | + } | ||
| 465 | + | ||
| 466 | + // Check if document is checked out | ||
| 467 | + $iDocTypeId = $aDataRow['document']->getDocumentTypeID(); | ||
| 468 | + | ||
| 469 | + if(!empty($iDocTypeId)){ | ||
| 470 | + $oDocumentType = DocumentType::get($iDocTypeId); | ||
| 471 | + $sType = $oDocumentType->getName(); | ||
| 472 | + | ||
| 473 | + return '<span class="descriptive">'.htmlentities($sType, ENT_NOQUOTES, 'UTF-8').'</span>'; | ||
| 474 | + } | ||
| 475 | + return '—'; | ||
| 476 | + } | ||
| 477 | +} | ||
| 478 | + | ||
| 451 | class AdvancedDownloadColumn extends AdvancedColumn { | 479 | class AdvancedDownloadColumn extends AdvancedColumn { |
| 452 | 480 | ||
| 453 | var $namespace = 'ktcore.columns.download'; | 481 | var $namespace = 'ktcore.columns.download'; |
plugins/ktcore/KTCorePlugin.php
| @@ -141,6 +141,7 @@ class KTCorePlugin extends KTPlugin { | @@ -141,6 +141,7 @@ class KTCorePlugin extends KTPlugin { | ||
| 141 | $this->registerColumn(_kt('Download File'), 'ktcore.columns.download', 'AdvancedDownloadColumn', 'KTColumns.inc.php'); | 141 | $this->registerColumn(_kt('Download File'), 'ktcore.columns.download', 'AdvancedDownloadColumn', 'KTColumns.inc.php'); |
| 142 | $this->registerColumn(_kt('Document ID'), 'ktcore.columns.docid', 'DocumentIDColumn', 'KTColumns.inc.php'); | 142 | $this->registerColumn(_kt('Document ID'), 'ktcore.columns.docid', 'DocumentIDColumn', 'KTColumns.inc.php'); |
| 143 | $this->registerColumn(_kt('Open Containing Folder'), 'ktcore.columns.containing_folder', 'ContainingFolderColumn', 'KTColumns.inc.php'); | 143 | $this->registerColumn(_kt('Open Containing Folder'), 'ktcore.columns.containing_folder', 'ContainingFolderColumn', 'KTColumns.inc.php'); |
| 144 | + $this->registerColumn(_kt('Document Type'), 'ktcore.columns.document_type', 'DocumentTypeColumn', 'KTColumns.inc.php'); | ||
| 144 | 145 | ||
| 145 | $this->registerView(_kt('Browse Documents'), 'ktcore.views.browse'); | 146 | $this->registerView(_kt('Browse Documents'), 'ktcore.views.browse'); |
| 146 | $this->registerView(_kt('Search'), 'ktcore.views.search'); | 147 | $this->registerView(_kt('Search'), 'ktcore.views.search'); |