do not output timeline if no data is available

This commit is contained in:
Uwe Steinmann 2015-09-22 10:32:33 +02:00
parent 109f814fa9
commit 6a91429711
3 changed files with 37 additions and 31 deletions

View File

@ -2018,6 +2018,8 @@ mayscript>
* @param object $document document
*/
protected function printTimeline($timeline, $height=300, $start='', $end='') { /* {{{ */
if(!$timeline)
return;
?>
<script type="text/javascript">
var timeline;

View File

@ -87,6 +87,7 @@ echo "</div>\n";
echo "<div class=\"span9\">\n";
$this->contentHeading(getMLText("timeline"));
if($data) {
foreach($data as &$item) {
switch($item['type']) {
case 'add_version':
@ -104,6 +105,7 @@ $this->contentHeading(getMLText("timeline"));
$item['msg'] = $msg;
}
$this->printTimeline($data, 550, date('Y-m-d', $from), date('Y-m-d', $to+1));
}
echo "</div>\n";
echo "</div>\n";

View File

@ -1115,6 +1115,7 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Bootstrap_Style {
if($user->isAdmin()) {
$this->contentHeading(getMLText("timeline"));
$timeline = $document->getTimeline();
if($timeline) {
foreach($timeline as &$item) {
switch($item['type']) {
case 'add_version':
@ -1133,6 +1134,7 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Bootstrap_Style {
}
$this->printTimeline($timeline, 300, '', date('Y-m-d'));
}
}
?>
</div>
</div>