예제 #1
0
 /** Render data for view on index action
  */
 public function indexAction()
 {
     $format = $this->_getParam('format');
     if (!isset($format)) {
         $eventsList = new Events();
         $eventsListed = $eventsList->getUpcomingEvents();
         $calendar = new Calendar();
         $lists = array();
         foreach ($eventsListed as $value) {
             $lists[] = $value['eventStartDate'];
         }
         $listedDates = $lists;
         $calendar->highlighted_dates = $listedDates;
         $first_day = $calendar->year . "-" . $calendar->month . "-01";
         $prev_year = date("Y", strtotime("+2 month", strtotime($first_day)));
         $prev_month = date("m", strtotime("+2 month", strtotime($first_day)));
         $next_year = date("Y", strtotime("+1 month", strtotime($first_day)));
         $next_month = date("m", strtotime("+1 month", strtotime($first_day)));
         $url = $this->view->url(array('module' => 'events', 'controller' => 'upcoming', 'action' => 'index'), 'upcoming', true);
         $calendar->formatted_link_to = $url . '/%Y-%m-%d';
         $this->view->curr = $calendar->output_calendar();
         $this->view->nextplusone = $calendar->output_calendar($prev_year, $prev_month);
         $this->view->next = $calendar->output_calendar($next_year, $next_month);
         $events = new Events();
         if ($this->_getParam('date') == NULL) {
             $this->view->events = $eventsList->getUpcomingEventsList();
             $this->view->eventdate = Zend_Date::now()->toString('yyyy-MM-dd');
         } else {
             $this->view->events = $events->getEventbyDay($this->_getParam('date'));
             $this->view->eventdate = $this->_getParam('date');
         }
     } else {
         if ($format == 'xml' || $format == 'json') {
             $this->_helper->layout->disableLayout();
             $events = new Events();
             $this->view->events = $events->getUpcomingEventsList();
         } else {
             if (in_array($format, array('rss', 'atom')) ? $format : 'rss') {
                 $events = new Events();
                 $events = $events->getUpcomingEventsList();
                 $feedArray = array('title' => 'Finds from the Scheme', 'link' => $this->view->CurUrl(), 'charset' => 'utf-8', 'description' => 'The latest Portable Antiquities Scheme events', 'author' => 'The Portable Antiquities Scheme', 'image' => Zend_Registry::get('siteurl') . '/images/logos/pas.gif', 'email' => '*****@*****.**', 'copyright' => 'Creative Commons Licenced', 'generator' => 'The Scheme database powered by Zend Framework and Dan\'s magic', 'language' => 'en', 'entries' => array());
                 foreach ($events as $event) {
                     $feedArray['entries'][] = array('title' => $event['eventTitle'], 'link' => Zend_Registry::get('siteurl') . '/events/info/index/id/' . $event['id'], 'guid' => Zend_Registry::get('siteurl') . '/events/info/index/id/' . $event['id'], 'description' => strip_tags($event['eventDescription']), 'lastUpdate' => strtotime($event['updated']), 'content' => $event['eventDescription'], 'georss' => $event['latitude'] . ',' . $event['longitude']);
                 }
                 $feed = Zend_Feed::importArray($feedArray, $format);
                 $feed->send();
             }
         }
     }
 }
예제 #2
0
 /**
  * Render data for view on index action
  */
 function indexAction()
 {
     $this->view->headTitle('Events at the Scheme');
     $content = new Content();
     $this->view->contents = $content->getFrontContent('events');
     $year = strftime("%Y", strtotime(Zend_Date::now()->toString('yyyy-MM-dd')));
     $this->view->year = $year;
     $adults = new Events();
     $this->view->adults = $adults->getAttendanceAdults($year . '-01-01', $year . '-12-31');
     $eventsList = new Events();
     $eventsListed = $eventsList->getUpcomingEvents();
     $calendar = new Calendar();
     $lists = array();
     foreach ($eventsListed as $value) {
         $lists[] = $value['eventStartDate'];
     }
     $listedDates = $lists;
     $calendar->highlighted_dates = $listedDates;
     $url = $this->view->url(array('module' => 'events', 'controller' => 'upcoming', 'action' => 'index'), 'upcoming', true);
     $calendar->formatted_link_to = $url . '/%Y-%m-%d';
     $cal = '<div id="calendars" style="float:right;margin-top:100px;margin-left:10px;">' . $calendar->output_calendar() . '</div>';
     $this->view->cal = $cal;
 }
예제 #3
0
 /** Render data for upcoming events
  * @access public
  * @return void
  */
 public function upcomingAction()
 {
     $this->view->events = $this->_events->getUpcomingEvents();
 }
예제 #4
0
 /** The index page for the admin section
  * @access public
  * @return void
  */
 public function indexAction()
 {
     $events = new Events();
     $this->view->events = $events->getUpcomingEvents();
 }