timeline.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. global $context;
  3. $actions = array();
  4. $rows = Bugs::$sql->query("
  5. SELECT id,name
  6. FROM actions
  7. ")->assoc_results;
  8. foreach($rows as $action){
  9. $actions[intval($action['id'])] = $action['name'];
  10. }
  11. $activities = Bugs::$sql->query("
  12. SELECT date,
  13. a_id,
  14. data
  15. FROM activities
  16. ORDER BY date DESC
  17. LIMIT ?,?
  18. ",'ii',$context->page,$context->amount)->assoc_results;
  19. ?>
  20. <!doctype html>
  21. <head>
  22. <meta charset="utf8"/>
  23. <title>Bugs - Timeline</title>
  24. <script src="<?=Router::$base?>/js/juju/core.js"></script>
  25. <script src="<?=Router::$base?>/js/juju/page.js"></script>
  26. <script src="<?=Router::$base?>/js/juju/dom.js"></script>
  27. <script src="<?=Router::$base?>/js/juju/keyboard.js"></script>
  28. <script src="<?=Router::$base?>/js/juju/mouse.js"></script>
  29. <link rel="stylesheet" href="<?=Router::$base?>/css/main.css"></link>
  30. <link rel="stylesheet" href="<?=Router::$base?>/css/timeline.css"></link>
  31. </head>
  32. <body>
  33. <a href="<?=Router::url(Router::$base)?>">Home</a>
  34. <div class="timeline">
  35. <?php
  36. foreach($activities as $activity){
  37. $activity = new Arguments(array(
  38. 'date'=> strtotime($activity['date']),
  39. 'action'=> $actions[intval($activity['a_id'])],
  40. 'data'=> new Arguments(json_decode($activity['data'],true)),
  41. 'template'=> 'default'
  42. ));
  43. if(file_exists("templates/activities/{$activity->action}.php")){
  44. $activity->template = $activity->action;
  45. }
  46. echo Bugs::template("activities/{$activity->template}")
  47. ->run($activity);
  48. }
  49. ?>
  50. </div>
  51. </body>
  52. </html>