mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-10-18 15:00:59 +00:00
printTimeline() retrieves data from ajax
This commit is contained in:
parent
88e0a57135
commit
f83ae3eda1
|
@ -2018,35 +2018,14 @@ mayscript>
|
||||||
*
|
*
|
||||||
* @param object $document document
|
* @param object $document document
|
||||||
*/
|
*/
|
||||||
protected function printTimeline($timeline, $height=300, $start='', $end='', $skip=array()) { /* {{{ */
|
protected function printTimeline($timelineurl, $height=300, $start='', $end='', $skip=array()) { /* {{{ */
|
||||||
if(!$timeline)
|
if(!$timelineurl)
|
||||||
return;
|
return;
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var timeline;
|
var timeline;
|
||||||
var data;
|
var data;
|
||||||
|
|
||||||
data = [
|
|
||||||
<?php
|
|
||||||
foreach($timeline as $item) {
|
|
||||||
if($item['type'] == 'status_change')
|
|
||||||
$classname = $item['type']."_".$item['status'];
|
|
||||||
else
|
|
||||||
$classname = $item['type'];
|
|
||||||
if(!$skip || !in_array($classname, $skip)) {
|
|
||||||
$s = explode(' ', $item['date']);
|
|
||||||
$d = explode('-', $s[0]);
|
|
||||||
$t = explode(':', $s[1]);
|
|
||||||
echo "{'start': new Date(".$d[0].",".($d[1]-1).",".$d[2].",".$t[0].",".$t[1].",".$t[2]."), 'content': '".$item['msg']."', 'className': '".$classname."'},\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
/* {
|
|
||||||
'start': new Date(),
|
|
||||||
'content': 'Today'
|
|
||||||
} */
|
|
||||||
];
|
|
||||||
|
|
||||||
// specify options
|
// specify options
|
||||||
var options = {
|
var options = {
|
||||||
'width': '100%',
|
'width': '100%',
|
||||||
|
@ -2061,17 +2040,36 @@ mayscript>
|
||||||
echo "'\t\t\tmax': new Date(".$tmp[0].", ".($tmp[1]-1).", ".$tmp[2]."),\n";
|
echo "'\t\t\tmax': new Date(".$tmp[0].", ".($tmp[1]-1).", ".$tmp[2]."),\n";
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
'_editable': false,
|
'editable': false,
|
||||||
'selectable': false,
|
'selectable': true,
|
||||||
'style': 'box',
|
'style': 'box',
|
||||||
'locale': 'de_DE'
|
'locale': 'de_DE'
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function onselect() {
|
||||||
|
var sel = timeline.getSelection();
|
||||||
|
if (sel.length) {
|
||||||
|
if (sel[0].row != undefined) {
|
||||||
|
var row = sel[0].row;
|
||||||
|
console.log(timeline.getItem(sel[0].row));
|
||||||
|
item = timeline.getItem(sel[0].row);
|
||||||
|
$('div.ajax').trigger('update', {documentid: item.docid, version: item.version, statusid: item.statusid, statuslogid: item.statuslogid, fileid: item.fileid});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
// Instantiate our timeline object.
|
// Instantiate our timeline object.
|
||||||
timeline = new links.Timeline(document.getElementById('timeline'), options);
|
timeline = new links.Timeline(document.getElementById('timeline'), options);
|
||||||
|
links.events.addListener(timeline, 'select', onselect);
|
||||||
timeline.draw(data);
|
$.getJSON(
|
||||||
|
'<?= $timelineurl ?>',
|
||||||
|
function(data) {
|
||||||
|
$.each( data, function( key, val ) {
|
||||||
|
val.start = new Date(val.start);
|
||||||
|
});
|
||||||
|
timeline.draw(data);
|
||||||
|
}
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user