* Adjust for export2csv export2html export2xml.
This commit is contained in:
+95
-20
@@ -186,9 +186,26 @@ class file extends control
|
||||
*/
|
||||
public function export2CSV()
|
||||
{
|
||||
$this->view->fields = $this->post->fields;
|
||||
$this->view->rows = $this->post->rows;
|
||||
$output = $this->parse('file', 'export2csv');
|
||||
$fields = $this->post->fields;
|
||||
$rows = $this->post->rows;
|
||||
|
||||
/* Build csv content. */
|
||||
$output = '';
|
||||
if($rows)
|
||||
{
|
||||
$output .= '"'. implode('","', $fields) . '"' . "\n";
|
||||
foreach($rows as $row)
|
||||
{
|
||||
$output .= '"';
|
||||
foreach($fields as $fieldName => $fieldLabel)
|
||||
{
|
||||
$output .= isset($row->$fieldName) ? str_replace(array('"', ' '), array('“', ' '), htmlspecialchars_decode(strip_tags($row->$fieldName, '<img>'))) : '';
|
||||
$output .= '","';
|
||||
}
|
||||
$output .= '"' . "\n";
|
||||
}
|
||||
if($this->post->kind == 'task' && $this->config->vision != 'lite') $output .= $this->lang->file->childTaskTips;
|
||||
}
|
||||
if($this->post->encode != "utf-8") $output = helper::convertEncoding($output, 'utf-8', $this->post->encode . '//TRANSLIT');
|
||||
|
||||
$this->sendDownHeader($this->post->fileName, 'csv', $output);
|
||||
@@ -202,10 +219,26 @@ class file extends control
|
||||
*/
|
||||
public function export2XML()
|
||||
{
|
||||
$this->view->fields = $this->post->fields;
|
||||
$this->view->rows = $this->post->rows;
|
||||
$fields = $this->post->fields;
|
||||
$rows = $this->post->rows;
|
||||
$output = "<?xml version='1.0' encoding='utf-8'?><xml>\n";
|
||||
|
||||
$output = $this->parse('file', 'export2XML');
|
||||
$output .= "<fields>";
|
||||
foreach($fields as $fieldName => $fieldLabel) $output .= " <$fieldName>$fieldLabel</$fieldName>\n";
|
||||
$output .= "</fields>";
|
||||
|
||||
$output .= "<rows>";
|
||||
foreach($rows as $row)
|
||||
{
|
||||
$output .= " <row>\n";
|
||||
foreach($fields as $fieldName => $fieldLabel)
|
||||
{
|
||||
$fieldValue = isset($row->$fieldName) ? htmlSpecialString($row->$fieldName) : '';
|
||||
$output .= " <$fieldName>$fieldValue</$fieldName>\n";
|
||||
}
|
||||
$output .= " </row>\n";
|
||||
}
|
||||
$output .= "</rows></xml>";
|
||||
|
||||
$this->sendDownHeader($this->post->fileName, 'xml', $output);
|
||||
}
|
||||
@@ -218,25 +251,67 @@ class file extends control
|
||||
*/
|
||||
public function export2HTML()
|
||||
{
|
||||
$this->view->fields = $this->post->fields;
|
||||
$this->view->rows = $this->post->rows;
|
||||
$this->host = common::getSysURL();
|
||||
$kind = $this->post->kind;
|
||||
$fields = $this->post->fields;
|
||||
$rows = $this->post->rows;
|
||||
$rowspans = $this->post->rowspan ? $this->post->rowspan : array();
|
||||
$colspans = $this->post->colspan ? $this->post->colspan : array();
|
||||
$host = common::getSysURL();
|
||||
$kind = $this->post->kind;
|
||||
$fileName = $this->post->fileName;
|
||||
|
||||
foreach($this->view->rows as $row)
|
||||
$output = "<html xmlns='http://www.w3.org/1999/xhtml'>";
|
||||
$output .= "<head>";
|
||||
$output .= "<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />";
|
||||
$output .= "<style>table, th, td {font-size: 12px; border: 1px solid gray; border-collapse: collapse;} table th, table td {padding: 5px;}</style>";
|
||||
$output .= "<title>{$fileName}</title>";
|
||||
$output .= "</head>";
|
||||
|
||||
$output .= "<body>";
|
||||
if($this->post->kind == 'task') $output .= "<div style='color:red'>" . $this->lang->file->childTaskTips . '</div>';
|
||||
|
||||
$output .= "<table>";
|
||||
$output .= "<tr>";
|
||||
$output .= implode("\n", array_map(function($fieldLabel){return "<th><nobr>$fieldLabel</nobr></th>";}, $fields));
|
||||
$output .= "</tr>";
|
||||
|
||||
$i = 0;
|
||||
foreach($rows as $row)
|
||||
{
|
||||
foreach($row as &$field)
|
||||
if(in_array($kind, array('story', 'bug', 'testcase'))) $row->title = html::a($host . $this->createLink($kind, 'view', "{$kind}ID=$row->id"), $row->title);
|
||||
if($kind == 'task') $row->name = html::a($host . $this->createLink('task', 'view', "taskID=$row->id"), $row->name);
|
||||
|
||||
$output .= "<tr valign='top'>\n";
|
||||
$col = 0;
|
||||
$endColspan = 0;
|
||||
foreach($fields as $fieldName => $fieldLabel)
|
||||
{
|
||||
if(empty($field)) continue;
|
||||
$field = preg_replace('/ src="{([0-9]+)(\.(\w+))?}" /', ' src="' . $this->host . helper::createLink('file', 'read', "fileID=$1", "$3") . '" ', $field);
|
||||
$col ++;
|
||||
if(!empty($endColspan) && $col < $endColspan) continue;
|
||||
if(isset($endRowspan[$fieldName]) && $i < $endRowspan[$fieldName]) continue;
|
||||
|
||||
$fieldValue = isset($row->$fieldName) ? $row->$fieldName : '';
|
||||
|
||||
$rowspan = '';
|
||||
if(isset($rowspans[$i]) && isset($rowspans[$i]['rows'][$fieldName]))
|
||||
{
|
||||
$rowspan = "rowspan='{$rowspans[$i]['rows'][$fieldName]}'";
|
||||
$endRowspan[$fieldName] = $i + $rowspans[$i]['rows'][$fieldName];
|
||||
}
|
||||
|
||||
$colspan = '';
|
||||
if(isset($colspans[$i]) && isset($colspans[$i]['cols'][$fieldName]))
|
||||
{
|
||||
$colspan = "colspan='{$colspans[$i]['cols'][$fieldName]}'";
|
||||
$endColspan = $col + $colspans[$i]['cols'][$fieldName];
|
||||
}
|
||||
|
||||
if($fieldValue) $fieldValue = preg_replace('/ src="{([0-9]+)(\.(\w+))?}" /', ' src="' . $host . helper::createLink('file', 'read', "fileID=$1", "$3") . '" ', $fieldValue);
|
||||
$output .= "<td $rowspan $colspan><nobr>$fieldValue</nobr></td>\n";
|
||||
}
|
||||
|
||||
if(in_array($kind, array('story', 'bug', 'testcase'))) $row->title = html::a($this->host . $this->createLink($kind, 'view', "{$kind}ID=$row->id"), $row->title);
|
||||
if($kind == 'task') $row->name = html::a($this->host . $this->createLink('task', 'view', "taskID=$row->id"), $row->name);
|
||||
$output .= "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
|
||||
$this->view->fileName = $this->post->fileName;
|
||||
$output = $this->parse('file', 'export2Html');
|
||||
$output .= "</table></body></html>";
|
||||
|
||||
$this->sendDownHeader($this->post->fileName, 'html', $output);
|
||||
}
|
||||
|
||||
@@ -1230,7 +1230,7 @@ class fileModel extends model
|
||||
|
||||
$objectType = zget($this->config->file->objectType, $file->objectType);
|
||||
|
||||
$html .= "<li class='file' title='{$uploadDate}'>" . html::a($downloadLink, $fileTitle . " <span class='text-muted'>({$fileSize})</span>", '_blank', "id='fileTitle$file->id' onclick=\"return downloadFile($file->id, '$file->extension', $imageWidth, '$file->title')\"");
|
||||
$html .= "<li class='file' title='{$uploadDate}'>" . html::a($downloadLink, $fileTitle . " <span class='text-gray'>({$fileSize})</span>", '_blank', "id='fileTitle$file->id' onclick=\"return downloadFile($file->id, '$file->extension', $imageWidth, '$file->title')\"");
|
||||
if(strpos('view,edit', $method) !== false)
|
||||
{
|
||||
if(common::hasPriv($objectType, 'view', $object)) $html = $this->buildFileActions($html, $downloadLink, $imageWidth, $showEdit, $showDelete, $file, $object);
|
||||
|
||||
@@ -85,7 +85,7 @@ if($isCustomExport)
|
||||
set::type('picker'),
|
||||
set::name('exportFields[]'),
|
||||
set::items($exportFieldPairs),
|
||||
set::defaultValue($selectedFields),
|
||||
set::value($selectedFields),
|
||||
set::multiple(true),
|
||||
set::required(true),
|
||||
),
|
||||
|
||||
@@ -1,88 +0,0 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* The UI file of file 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 Wangy Yidong <yidong@easycorp.ltd>
|
||||
* @package file
|
||||
* @link https://www.zentao.net
|
||||
*/
|
||||
|
||||
namespace zin;
|
||||
|
||||
$sessionString = session_name() . '=' . session_id();
|
||||
|
||||
$liItems = array();
|
||||
foreach($files as $file)
|
||||
{
|
||||
if(!common::hasPriv('file', 'download')) continue;
|
||||
|
||||
$uploadDate = $lang->file->uploadDate . substr($file->addedDate, 0, 10);
|
||||
$fileTitle = $file->title;
|
||||
if(strpos($file->title, ".{$file->extension}") === false && $file->extension != 'txt') $fileTitle .= ".{$file->extension}";
|
||||
|
||||
$imageWidth = 0;
|
||||
if(stripos('jpg|jpeg|gif|png|bmp', $file->extension) !== false)
|
||||
{
|
||||
$imageSize = $this->file->getImageSize($file);
|
||||
$imageWidth = $imageSize[0];
|
||||
}
|
||||
|
||||
$fileSize = $this->file->convertFileSize($file->size);
|
||||
|
||||
$downloadLink = $this->createLink('file', 'download', "fileID=$file->id");
|
||||
$downloadLink .= strpos($downloadLink, '?') === false ? '?' : '&';
|
||||
$downloadLink .= $sessionString;
|
||||
|
||||
$objectType = zget($this->config->file->objectType, $file->objectType);
|
||||
|
||||
$liItems[] = h::li
|
||||
(
|
||||
set::title($uploadDate),
|
||||
a(set::href($downloadLink), set('onclick', "return downloadFile({$file->id}, '{$file->extension}', $imageWidth, '{$file->title}')"), icon('file-text'), $fileTitle, span(setClass('text-gray'), $fileSize)),
|
||||
common::hasPriv($objectType, 'edit', $object) ? span
|
||||
(
|
||||
setClass('right-icon'),
|
||||
common::hasPriv('file', 'edit') ? a(set::style(array('color', '#0c64eb')), set::href(helper::createLink('file', 'edit', "fileID={$file->id}")), set::title($lang->file->edit), set('data-toggle', 'modal'), set('data-size', 'sm'), $lang->file->edit) : null,
|
||||
common::hasPriv('file', 'delete') ? a(set::style(array('color', '#0c64eb')), set::href(helper::createLink('file', 'delete', "fileID={$file->id}")), set::title($lang->delete), setClass('ajax-submit'), $lang->delete) : null,
|
||||
) : null,
|
||||
);
|
||||
}
|
||||
|
||||
h::ul
|
||||
(
|
||||
setClass('files-list'),
|
||||
$liItems,
|
||||
);
|
||||
|
||||
h::js
|
||||
(
|
||||
<<<JAVASCRIPT
|
||||
window.downloadFile = function(fileID, extension, imageWidth, fileTitle)
|
||||
{
|
||||
if(!fileID) return;
|
||||
let fileTypes = 'txt,jpg,jpeg,gif,png,bmp';
|
||||
let windowWidth = $(window).width();
|
||||
let width = (windowWidth > imageWidth) ? ((imageWidth < windowWidth * 0.5) ? windowWidth * 0.5 : imageWidth) : windowWidth;
|
||||
let checkExtension = fileTitle.lastIndexOf('.' + extension) == (fileTitle.length - extension.length - 1);
|
||||
|
||||
let url = $.createLink('file', 'download', 'fileID=' + fileID + '&mouse=left');
|
||||
url += url.indexOf('?') >= 0 ? '&' : '?';
|
||||
url += '{$sessionString}';
|
||||
|
||||
if(fileTypes.indexOf(extension) >= 0 && checkExtension && config.onlybody != 'yes')
|
||||
{
|
||||
$('<a>').modalTrigger({url: url, type: 'iframe', width: width}).trigger('click');
|
||||
}
|
||||
else
|
||||
{
|
||||
window.open(url, '_blank');
|
||||
}
|
||||
return false;
|
||||
};
|
||||
JAVASCRIPT
|
||||
);
|
||||
|
||||
render();
|
||||
@@ -1,238 +0,0 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* The UI file of file 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 Wangy Yidong <yidong@easycorp.ltd>
|
||||
* @package file
|
||||
* @link https://www.zentao.net
|
||||
*/
|
||||
namespace zin;
|
||||
|
||||
$sessionString = session_name() . '=' . session_id();
|
||||
|
||||
h::css
|
||||
(
|
||||
<<<CSS
|
||||
.file {padding-top: 2px;}
|
||||
ul.files-list {margin-bottom: unset}
|
||||
.files-list>li>a {display: inline; word-wrap: break-word;}
|
||||
.files-list>li>.right-icon {opacity: 1;}
|
||||
.fileAction {color: #0c64eb !important;}
|
||||
.renameFile {display: flex;}
|
||||
.renameFile .input-group {margin-left: 10px;}
|
||||
.renameFile .icon {margin-top: 8px;}
|
||||
.renameFile .input-group-addon {width: 60px;}
|
||||
.backgroundColor {background: #eff5ff; }
|
||||
.icon.icon-file-text {padding-left: 7px}
|
||||
.right-icon .btn {padding: 0 6px;}
|
||||
CSS
|
||||
);
|
||||
|
||||
$liItems = array();
|
||||
foreach($files as $file)
|
||||
{
|
||||
if(!common::hasPriv('file', 'download')) continue;
|
||||
|
||||
$uploadDate = $lang->file->uploadDate . substr($file->addedDate, 0, 10);
|
||||
$fileTitle = $file->title;
|
||||
$fileSize = $this->file->convertFileSize($file->size);
|
||||
if(strpos($file->title, ".{$file->extension}") === false && $file->extension != 'txt') $fileTitle .= ".{$file->extension}";
|
||||
|
||||
$imageWidth = 0;
|
||||
if(stripos('jpg|jpeg|gif|png|bmp', $file->extension) !== false)
|
||||
{
|
||||
$imageSize = $this->file->getImageSize($file);
|
||||
$imageWidth = $imageSize[0];
|
||||
}
|
||||
|
||||
$downloadLink = $this->createLink('file', 'download', "fileID=$file->id");
|
||||
$downloadLink .= strpos($downloadLink, '?') === false ? '?' : '&';
|
||||
$downloadLink .= $sessionString;
|
||||
|
||||
$objectType = zget($this->config->file->objectType, $file->objectType);
|
||||
|
||||
/* Determines whether the file supports preview. */
|
||||
if($file->extension == 'txt')
|
||||
{
|
||||
$extension = 'txt';
|
||||
if(($postion = strrpos($file->title, '.')) !== false) $extension = substr($file->title, $postion + 1);
|
||||
if($extension != 'txt') $mode = 'down';
|
||||
$file->extension = $extension;
|
||||
}
|
||||
|
||||
$canPreview = false;
|
||||
if(stripos('txt|jpg|jpeg|gif|png|bmp', $file->extension) !== false) $canPreview = true;
|
||||
if(isset($this->config->file->libreOfficeTurnon) and $this->config->file->libreOfficeTurnon == 1)
|
||||
{
|
||||
$officeTypes = 'doc|docx|xls|xlsx|ppt|pptx|pdf';
|
||||
if(stripos($officeTypes, $file->extension) !== false) $canPreview = true;
|
||||
}
|
||||
|
||||
if(strrpos($file->title, '.') !== false)
|
||||
{
|
||||
/* Fix the file name exe.exe */
|
||||
$title = explode('.', $file->title);
|
||||
$extension = end($title);
|
||||
if($file->extension == 'txt' && $extension != $file->extension) $file->extension = $extension;
|
||||
array_pop($title);
|
||||
$file->title = implode('.', $title);
|
||||
}
|
||||
|
||||
$liItems[] = h::li
|
||||
(
|
||||
setClass('file'),
|
||||
set::title($uploadDate),
|
||||
span
|
||||
(
|
||||
setID("fileTitle{$file->id}"),
|
||||
icon('file-text'),
|
||||
$fileTitle,
|
||||
span(setClass('text-gray'), $fileSize),
|
||||
),
|
||||
common::hasPriv($objectType, 'view', $object) ? span
|
||||
(
|
||||
setClass('right-icon hidden'),
|
||||
($canPreview) ? a(set::style(array('color', '#0c64eb')), set::href($downloadLink), set('onclick', "return downloadFile({$file->id}, '{$file->extension}', $imageWidth, '{$file->title}')"), set::title($lang->file->preview), icon('eye')) : null,
|
||||
common::hasPriv('file', 'download') ? a(set::style(array('color', '#0c64eb')), set::href(helper::createLink('file', 'download', "fileID={$file->id}")), set::target('_blank'), set::title($lang->file->downloadFile), icon('download')) : null,
|
||||
common::hasPriv($objectType, 'edit', $object) && $showEdit && common::hasPriv('file', 'edit') ? a(set::style(array('color', '#0c64eb')), set::href('###'), setClass('edit'), setID("renameFile{$file->id}"), set::title($lang->file->edit), set('onclick', "showRenameBox{$file->id}"), icon('pencil-alt')) : null,
|
||||
common::hasPriv($objectType, 'edit', $object) && $showDelete && common::hasPriv('file', 'delete') ? a(set::style(array('color', '#0c64eb')), set::href('###'), set::title($lang->delete), set('onclick', "deleteFile($file->id, this)"), icon('trash')) : null,
|
||||
) : null,
|
||||
on::mouseover('showFileActions'),
|
||||
on::mouseout('hideFileActions'),
|
||||
);
|
||||
$liItems[] = h::li
|
||||
(
|
||||
setClass('file hidden'),
|
||||
div
|
||||
(
|
||||
setClass('renameFile'),
|
||||
setID("renameBox{$file->id}"),
|
||||
icon('file-text'),
|
||||
inputGroup
|
||||
(
|
||||
input(setID("fileName{$file->id}"), setValue($file->title)),
|
||||
input(set::type('hidden'), setID("extension{$file->id}"), setValue($file->extension)),
|
||||
h::strong(setClass('input-group-addon'), ".{$file->extension}"),
|
||||
),
|
||||
div
|
||||
(
|
||||
setClass('input-group-btn'),
|
||||
btn(setClass('success file-name-confirm'), set::style(array('border-radius' => '0px 2px 2px 0px', 'border-left-color' => 'transparent')), set('onclick', "setFileName($file->id)"), icon('check')),
|
||||
btn(setClass('gray file-name-cancel'), set::style(array('border-radius' => '0px 2px 2px 0px', 'border-left-color' => 'transparent')), set('onclick', "showFile($file->id)"), icon('close')),
|
||||
)
|
||||
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if($fieldset == 'true')
|
||||
{
|
||||
sectionList
|
||||
(
|
||||
set::title($lang->file->common),
|
||||
set::content
|
||||
(
|
||||
h::ul
|
||||
(
|
||||
setClass('files-list'),
|
||||
$liItems,
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
h::ul
|
||||
(
|
||||
setClass('files-list'),
|
||||
$liItems,
|
||||
);
|
||||
}
|
||||
|
||||
$deleteUseForm = ($showDelete && $method == 'edit');
|
||||
$isInModal = isInModal();
|
||||
h::js
|
||||
(
|
||||
<<<JAVASCRIPT
|
||||
window.showFileActions = function(e)
|
||||
{
|
||||
$(e.target).find('span.right-icon').removeClass("hidden");
|
||||
$(e.target).addClass('backgroundColor');
|
||||
};
|
||||
|
||||
window.hiddenFileActions = function(e)
|
||||
{
|
||||
$(e.target).find('span.right-icon').addClass("hidden");
|
||||
$(e.target).removeClass('backgroundColor');
|
||||
};
|
||||
|
||||
window.deleteFile = function(fileID, obj)
|
||||
{
|
||||
if(!fileID) return;
|
||||
|
||||
if({$deleteUseForm})
|
||||
{
|
||||
$('<input />').attr('type', 'hidden').attr('name', 'deleteFiles[' + fileID + ']').attr('value', fileID).appendTo('ul.files-list');
|
||||
$(obj).closest('li.file').addClass('hidden');
|
||||
}
|
||||
else
|
||||
{
|
||||
$.ajaxSubmit($.createLink('file', 'delete', 'fileID=' + fileID));
|
||||
}
|
||||
};
|
||||
|
||||
window.downloadFile = function(fileID, extension, imageWidth, fileTitle)
|
||||
{
|
||||
if(!fileID) return;
|
||||
let fileTypes = 'txt,jpg,jpeg,gif,png,bmp';
|
||||
let windowWidth = $(window).width();
|
||||
let width = (windowWidth > imageWidth) ? ((imageWidth < windowWidth * 0.5) ? windowWidth * 0.5 : imageWidth) : windowWidth;
|
||||
let checkExtension = fileTitle.lastIndexOf('.' + extension) == (fileTitle.length - extension.length - 1);
|
||||
|
||||
let url = $.createLink('file', 'download', 'fileID=' + fileID + '&mouse=left');
|
||||
url += url.indexOf('?') >= 0 ? '&' : '?';
|
||||
url += '{$sessionString}';
|
||||
|
||||
if(fileTypes.indexOf(extension) >= 0 && checkExtension && {$isInModal})
|
||||
{
|
||||
$('<a>').modalTrigger({url: url, type: 'iframe', width: width}).trigger('click');
|
||||
}
|
||||
else
|
||||
{
|
||||
window.open(url, '_blank');
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
window.showRenameBox = function(fileID)
|
||||
{
|
||||
$('#renameFile' + fileID).closest('li').addClass('hidden');
|
||||
$('#renameBox' + fileID).closest('li').removeClass('hidden');
|
||||
};
|
||||
|
||||
window.showFile = function(fileID)
|
||||
{
|
||||
$('#renameBox' + fileID).closest('li').addClass('hidden');
|
||||
$('#renameFile' + fileID).closest('li').removeClass('hidden');
|
||||
}
|
||||
|
||||
window.setFileName = function(fileID)
|
||||
{
|
||||
let fileName = $('#fileName' + fileID).val();
|
||||
let extension = $('#extension' + fileID).val();
|
||||
let postData = {'fileName' : fileName, 'extension' : extension};
|
||||
$.post($.createLink('file', 'edit', 'fileID=' + fileID), postData, function(data)
|
||||
{
|
||||
data = JSON.parse(data);
|
||||
$('#fileTitle' + fileID).html("<i class='icon icon-file-text'></i> " + data['title']);
|
||||
$('#renameFile' + fileID).closest('li').removeClass('hidden');
|
||||
$('#renameBox' + fileID).closest('li').addClass('hidden');
|
||||
})
|
||||
}
|
||||
JAVASCRIPT
|
||||
);
|
||||
|
||||
render();
|
||||
@@ -1,28 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* The export2csv view file of file module of ZenTaoPMS.
|
||||
*
|
||||
* @copyright Copyright 2009-2015 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.cnezsoft.com)
|
||||
* @license ZPL(http://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
|
||||
* @author Congzhi Chen <congzhi@cnezsoft.com>
|
||||
* @package file
|
||||
* @version $Id$
|
||||
* @link http://www.zentao.net
|
||||
*/
|
||||
?>
|
||||
<?php
|
||||
echo '"'. implode('","', $fields) . '"' . "\n";
|
||||
if($rows)
|
||||
{
|
||||
foreach($rows as $row)
|
||||
{
|
||||
echo '"';
|
||||
foreach($fields as $fieldName => $fieldLabel)
|
||||
{
|
||||
isset($row->$fieldName) ? print(str_replace(array('"', ' '), array('“', ' '), htmlspecialchars_decode(strip_tags($row->$fieldName, '<img>')))) : print('');
|
||||
echo '","';
|
||||
}
|
||||
echo '"' . "\n";
|
||||
}
|
||||
}
|
||||
if($this->post->kind == 'task' && $config->vision != 'lite') echo $this->lang->file->childTaskTips;
|
||||
@@ -1,68 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* The export2html view file of file module of ZenTaoPMS.
|
||||
*
|
||||
* @copyright Copyright 2009-2015 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.cnezsoft.com)
|
||||
* @license ZPL(http://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
|
||||
* @author Congzhi Chen <congzhi@cnezsoft.com>
|
||||
* @package file
|
||||
* @version $Id$
|
||||
* @link http://www.zentao.net
|
||||
*/
|
||||
?>
|
||||
<html xmlns='http://www.w3.org/1999/xhtml'>
|
||||
<head>
|
||||
<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
|
||||
<style>
|
||||
table, th, td {font-size: 12px; border: 1px solid gray; border-collapse: collapse;}
|
||||
table th, table td {padding: 5px;}
|
||||
</style>
|
||||
<title><?php echo $fileName;?></title>
|
||||
<body>
|
||||
<?php if($this->post->kind == 'task') echo "<font color='red'>" . $this->lang->file->childTaskTips . '</font>';?>
|
||||
<table>
|
||||
<tr>
|
||||
<?php
|
||||
foreach($fields as $fieldLabel)
|
||||
{
|
||||
echo "<th><nobr>$fieldLabel</nobr></th>\n";
|
||||
}
|
||||
?>
|
||||
</tr>
|
||||
<?php
|
||||
$rowspans = $this->post->rowspan ? $this->post->rowspan : array();
|
||||
$colspans = $this->post->colspan ? $this->post->colspan : array();
|
||||
$i = 0;
|
||||
foreach($rows as $row)
|
||||
{
|
||||
echo "<tr valign='top'>\n";
|
||||
$col = 0;
|
||||
$endColspan = 0;
|
||||
foreach($fields as $fieldName => $fieldLabel)
|
||||
{
|
||||
$col ++;
|
||||
if(!empty($endColspan) and $col < $endColspan) continue;
|
||||
if(isset($endRowspan[$fieldName]) and $i < $endRowspan[$fieldName]) continue;
|
||||
$fieldValue = isset($row->$fieldName) ? $row->$fieldName : '';
|
||||
$rowspan = '';
|
||||
if(isset($rowspans[$i]) and isset($rowspans[$i]['rows'][$fieldName]))
|
||||
{
|
||||
$rowspan = "rowspan='{$rowspans[$i]['rows'][$fieldName]}'";
|
||||
$endRowspan[$fieldName] = $i + $rowspans[$i]['rows'][$fieldName];
|
||||
}
|
||||
$colspan = '';
|
||||
if(isset($colspans[$i]) and isset($colspans[$i]['cols'][$fieldName]))
|
||||
{
|
||||
$colspan = "colspan='{$colspans[$i]['cols'][$fieldName]}'";
|
||||
$endColspan = $col + $colspans[$i]['cols'][$fieldName];
|
||||
}
|
||||
echo "<td $rowspan $colspan><nobr>$fieldValue</nobr></td>\n";
|
||||
|
||||
}
|
||||
echo "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,36 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* The export2xml view file of file module of ZenTaoPMS.
|
||||
*
|
||||
* @copyright Copyright 2009-2015 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.cnezsoft.com)
|
||||
* @license ZPL(http://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
|
||||
* @author Congzhi Chen <congzhi@cnezsoft.com>
|
||||
* @package file
|
||||
* @version $Id$
|
||||
* @link http://www.zentao.net
|
||||
*/
|
||||
?>
|
||||
<?php echo "<?xml version='1.0' encoding='utf-8'?><xml>\n";?>
|
||||
<fields>
|
||||
<?php
|
||||
foreach($fields as $fieldName => $fieldLabel)
|
||||
{
|
||||
echo " <$fieldName>$fieldLabel</$fieldName>\n";
|
||||
}
|
||||
?>
|
||||
</fields>
|
||||
<rows>
|
||||
<?php
|
||||
foreach($rows as $row)
|
||||
{
|
||||
echo " <row>\n";
|
||||
foreach($fields as $fieldName => $fieldLabel)
|
||||
{
|
||||
$fieldValue = isset($row->$fieldName) ? htmlSpecialString($row->$fieldName) : '';
|
||||
echo " <$fieldName>$fieldValue</$fieldName>\n";
|
||||
}
|
||||
echo " </row>\n";
|
||||
}
|
||||
?>
|
||||
</rows>
|
||||
</xml>
|
||||
Reference in New Issue
Block a user