修改time1.xml时间格式

This commit is contained in:
wlx 2010-01-14 08:23:02 +00:00
parent 6e24602fe3
commit 70e2592c5b
2 changed files with 7 additions and 6 deletions

View File

@ -308,13 +308,13 @@ class DataController extends Zend_Controller_Action
*/ */
function timelineAction() function timelineAction()
{ {
$fn="time.xml"; $fn="time1.xml";
if (!file_exists($fn) || (time()-filemtime($fn)>3600*24)) if (!file_exists($fn) || (time()-filemtime($fn)>3600*24))
{ {
$dateformat="D M j Y G:i:s O"; $dateformat="M j Y";
$md = new MetadataTable(); $md = new MetadataTable();
$db=$md->getAdapter(); $db=$md->getAdapter();
$state=$db->query('select id,uuid,description,title,timebegin,timeend from metadata where timebegin is not null'); $state=$db->query('select id,uuid,description,title,timebegin,timeend from metadata where timebegin is not null order by timebegin');
$rows=$state->fetchAll(); $rows=$state->fetchAll();
$timexml='<data>'; $timexml='<data>';
foreach($rows as $row) { foreach($rows as $row) {
@ -324,7 +324,8 @@ class DataController extends Zend_Controller_Action
$desc_length=mb_strlen($row['description'],"UTF-8"); $desc_length=mb_strlen($row['description'],"UTF-8");
$desc=mb_substr($row['description'],0,($desc_length>300)?300:$desc_length,"UTF-8"); $desc=mb_substr($row['description'],0,($desc_length>300)?300:$desc_length,"UTF-8");
if ($desc_length>300) $desc.=" ..."; if ($desc_length>300) $desc.=" ...";
$timexml.=htmlspecialchars($desc).'</event>'; $timexml.=htmlspecialchars($desc);
$timexml.="</event>\n";
} }
$timexml.='</data>'; $timexml.='</data>';
$fp=fopen($fn,'w'); $fp=fopen($fn,'w');

View File

@ -23,14 +23,14 @@ window.onload=function() {
date: date, date: date,
overview: true, overview: true,
intervalPixels: 200, intervalPixels: 200,
theme:theme theme: theme
}) })
]; ];
bandInfos[1].syncWith = 0; bandInfos[1].syncWith = 0;
bandInfos[1].highlight = true; bandInfos[1].highlight = true;
tl = Timeline.create(document.getElementById("tl"), bandInfos); tl = Timeline.create(document.getElementById("tl"), bandInfos);
tl.loadXML("/time.xml", function(xml, url) { tl.loadXML("/time1.xml", function(xml, url) {
eventSource.loadXML(xml, url); eventSource.loadXML(xml, url);
}); });
} }