/src/system/application/views/event/main.php

https://github.com/jfoucher/joind.in · PHP · 87 lines · 79 code · 8 blank · 0 comment · 18 complexity · 258b754f5c768b48a5264df9d9c6da66 MD5 · raw file

  1. <?php
  2. if (!isset($type)) {
  3. $type = 'all';
  4. }
  5. switch ($type) {
  6. case 'hot':
  7. $title = 'Hot Events';
  8. break;
  9. case 'upcoming':
  10. $title = 'Upcoming Events';
  11. break;
  12. case 'past':
  13. $title = 'Past Events';
  14. break;
  15. default:
  16. $title = 'Events';
  17. break;
  18. }
  19. menu_pagetitle($title);
  20. $subtitle = '';
  21. if (!empty($year) && !empty($month)) {
  22. if (!empty($day)) {
  23. $subtitle .= ' for ' . date('F j, Y', mktime(0, 0, 0, $month, $day, $year));
  24. } else {
  25. $subtitle .= ' for ' . date('F Y', mktime(0, 0, 0, $month, 1, $year));
  26. }
  27. }
  28. ?>
  29. <h1 class="icon-event">
  30. <?php if(user_is_admin()){ ?>
  31. <span style="float:left">
  32. <?php } ?>
  33. <?php echo $title; ?><?php echo $subtitle; ?>
  34. <?php if(user_is_admin()){ ?>
  35. </span>
  36. <?php } ?>
  37. <?php if(user_is_admin()){ ?>
  38. <a class="btn" style="float:right" href="/event/add">Add new event</a>
  39. <div class="clear"></div>
  40. <?php } ?>
  41. </h1>
  42. <p class="filter">
  43. <a href="/event/all">All</a> |
  44. <a href="/event/hot">Hot</a> |
  45. <a href="/event/upcoming">Upcoming</a> |
  46. <a href="/event/past">Past</a>
  47. </p>
  48. <?php
  49. foreach($events as $k=>$v){
  50. $this->load->view('event/_event-row', array('event'=>$v));
  51. }
  52. if($current_page && $total_count){
  53. $this->load->view('event/modules/_event-paginate', array(
  54. 'current_page' => $current_page,
  55. 'total_count' => $total_count
  56. ));
  57. }
  58. if (count($events) == 0) {
  59. if (!empty($year) && !empty($month)) {
  60. if (!empty($day)) {
  61. echo '<h2>No events found for this day!</h2>';
  62. } else {
  63. echo '<h2>No events found for this month!</h2>';
  64. }
  65. } else {
  66. echo '<h2>No events found!</h2>';
  67. }
  68. ?>
  69. <p>
  70. Know of an event happening this month? <a href="/event/submit">Let us know!</a>
  71. We love to get the word out about events the community would be interested in and
  72. you can help us spread the word!
  73. </p>
  74. <p>
  75. <a href="/event/submit/" class="btn-big">Submit your event!</a>
  76. </p>
  77. <?php
  78. }
  79. ?>