data.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. // in the reply we must fill in the request id that came with the request
  3. $reqId = getReqId();
  4. echo "
  5. google.visualization.Query.setResponse({
  6. version:'0.6',
  7. reqId:'$reqId',
  8. status:'ok',
  9. table:{
  10. cols:[{id:'start',
  11. label:'',
  12. type:'datetime'},
  13. {id:'end',
  14. label:'',
  15. type:'datetime'},
  16. {id:'content',
  17. label:'',
  18. type:'string'}
  19. ],
  20. rows:[{c:[{v:new Date(2010, 7, 19)}, {v:null}, {v:'Conversation'}]},
  21. {c:[{v:new Date(2010, 7, 20)}, {v:null}, {v:'Official start'}]},
  22. {c:[{v:new Date(2010, 7, 23)}, {v:null}, {v:'Memo'}]},
  23. {c:[{v:new Date(2010, 8, 2, 12, 0, 0)}, {v:null}, {v:'Report'}]},
  24. {c:[{v:new Date(2010, 8, 6)}, {v:new Date(2010, 8, 12)}, {v:'Bla bla'}]}
  25. ]
  26. }
  27. });
  28. ";
  29. /**
  30. * Retrieve the request id from the get/post data
  31. * @return {number} $reqId The request id, or 0 if not found
  32. */
  33. function getReqId() {
  34. $reqId = 0;
  35. foreach ($_REQUEST as $req) {
  36. if (substr($req, 0,6) == "reqId:") {
  37. $reqId = substr($req, 6);
  38. }
  39. }
  40. return $reqId;
  41. }
  42. ?>