mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-03-12 00:45:34 +00:00
add ajax function for returning the timeline data
This commit is contained in:
parent
2c79669c94
commit
88e0a57135
|
@ -71,6 +71,45 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Bootstrap_Style {
|
|||
}
|
||||
} /* }}} */
|
||||
|
||||
function timelinedata() { /* {{{ */
|
||||
$dms = $this->params['dms'];
|
||||
$user = $this->params['user'];
|
||||
$document = $this->params['document'];
|
||||
|
||||
$jsondata = array();
|
||||
if($user->isAdmin()) {
|
||||
$data = $document->getTimeline();
|
||||
|
||||
foreach($data as &$item) {
|
||||
switch($item['type']) {
|
||||
case 'add_version':
|
||||
$msg = getMLText('timeline_'.$item['type'], array('document'=>htmlspecialchars($item['document']->getName()), 'version'=> $item['version']));
|
||||
break;
|
||||
case 'add_file':
|
||||
$msg = getMLText('timeline_'.$item['type'], array('document'=>htmlspecialchars($item['document']->getName())));
|
||||
break;
|
||||
case 'status_change':
|
||||
$msg = getMLText('timeline_'.$item['type'], array('document'=>htmlspecialchars($item['document']->getName()), 'version'=> $item['version'], 'status'=> getOverallStatusText($item['status'])));
|
||||
break;
|
||||
default:
|
||||
$msg = '???';
|
||||
}
|
||||
$item['msg'] = $msg;
|
||||
}
|
||||
|
||||
foreach($data as $item) {
|
||||
if($item['type'] == 'status_change')
|
||||
$classname = $item['type']."_".$item['status'];
|
||||
else
|
||||
$classname = $item['type'];
|
||||
$d = makeTsFromLongDate($item['date']);
|
||||
$jsondata[] = array('start'=>date('c', $d)/*$item['date']*/, 'content'=>$item['msg'], 'className'=>$classname);
|
||||
}
|
||||
}
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode($jsondata);
|
||||
} /* }}} */
|
||||
|
||||
function show() { /* {{{ */
|
||||
$dms = $this->params['dms'];
|
||||
$user = $this->params['user'];
|
||||
|
@ -1132,7 +1171,7 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Bootstrap_Style {
|
|||
}
|
||||
$item['msg'] = $msg;
|
||||
}
|
||||
$this->printTimeline($timeline, 300, '', date('Y-m-d'));
|
||||
$this->printTimeline('out.ViewDocument.php?action=timelinedata&documentid='.$document->getID(), 300, '', date('Y-m-d'));
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
Loading…
Reference in New Issue
Block a user