55 lines
1.9 KiB
PHP
55 lines
1.9 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
/**
|
|
* The zen file of doc module of ZenTaoPMS.
|
|
*
|
|
* @copyright Copyright 2009-2023 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.zentao.net)
|
|
* @license ZPL(https://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
|
|
* @author Shujie Tian<tianshujie@easycorp.ltd>
|
|
* @package doc
|
|
* @link https://www.zentao.net
|
|
*/
|
|
class docZen extends doc
|
|
{
|
|
/**
|
|
* Process file field for table.
|
|
*
|
|
* @param array $files
|
|
* @param array $fileIcon
|
|
* @param array $sourcePairs
|
|
* @access protected
|
|
* @return arary
|
|
*/
|
|
protected function processFiles(array $files, array $fileIcon, array $sourcePairs): array
|
|
{
|
|
$this->loadModel('file');
|
|
foreach($files as $fileID => $file)
|
|
{
|
|
if(empty($file->pathname))
|
|
{
|
|
unset($files[$fileID]);
|
|
continue;
|
|
}
|
|
|
|
$file->fileIcon = isset($fileIcon[$file->id]) ? $fileIcon[$file->id] : '';
|
|
$file->fileName = str_replace('.' . $file->extension, '', $file->title);
|
|
$file->sourceName = isset($sourcePairs[$file->objectType][$file->objectID]) ? $sourcePairs[$file->objectType][$file->objectID] : '';
|
|
$file->sizeText = number_format($file->size / 1024, 1) . 'K';
|
|
|
|
$imageSize = $this->file->getImageSize($file);
|
|
$file->imageWidth = isset($imageSize[0]) ? $imageSize[0] : 0;
|
|
if($file->objectType == 'requirement')
|
|
{
|
|
$file->objectName = $this->lang->URCommon . ' : ';
|
|
}
|
|
else
|
|
{
|
|
if(!isset($this->lang->{$file->objectType}->common)) $this->app->loadLang($file->objectType);
|
|
$file->objectName = $this->lang->{$file->objectType}->common . ' : ';
|
|
}
|
|
}
|
|
return $files;
|
|
}
|
|
}
|
|
|