westdc-zf1/application/default/views/scripts/data/timeline.phtml

64 lines
2.3 KiB
PHTML
Executable File

<?php
$this->headTitle($this->config->title->site);
$this->headTitle($this->config->title->data);
$this->headTitle('时间轴导航');
if (!empty($this->codename)) $this->headTitle($this->codename);
$this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/metadata.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/data">'.$this->config->title->data.'</a>');
$this->breadcrumb('<a href="/data/timeline">时间轴导航</a>');
$this->breadcrumb()->setSeparator(' > ');
$this->headScript()->appendFile('http://simile.mit.edu/timeline/api/timeline-api.js');
$this->headScript()->captureStart();
?>
var tl;
var date = "Nov 22 2007 13:00:00";
var theme = Timeline.ClassicTheme.create();
theme.event.label.width = 250; // px
theme.event.bubble.width = 250;
theme.event.bubble.height = 200;
window.onload=function() {
var eventSource = new Timeline.DefaultEventSource();
var bandInfos = [
Timeline.createBandInfo({
width: "70%",
intervalUnit: Timeline.DateTime.MONTH,
eventSource: eventSource,
date: date,
intervalPixels: 100,
theme: theme
}),
Timeline.createBandInfo({
width: "30%",
intervalUnit: Timeline.DateTime.YEAR,
eventSource: eventSource,
date: date,
showEventText: false,
intervalPixels: 200,
theme:theme
})
];
bandInfos[1].syncWith = 0;
bandInfos[1].highlight = true;
tl = Timeline.create(document.getElementById("tl"), bandInfos);
tl.loadXML("/time.xml", function(xml, url) {
eventSource.loadXML(xml, url);
});
}
var resizeTimerID = null;
window.onresize=function() {
if (resizeTimerID == null) {
resizeTimerID = window.setTimeout(function() {
resizeTimerID = null;
tl.layout();
}, 500);
}
}
<?php $this->headScript()->captureEnd() ?>
<div id='tools'><?= $this->partial('data/tools.phtml'); ?></div>
<div id="tl" class="timeline-default" style="clear:left;height: 400px;"> </div>