예제 #1
0
 public function indexAction()
 {
     $calendarMapper = new CalendarMapper();
     $userMapper = new UserMapper();
     $eventsMapper = new EventsMapper();
     $this->getLayout()->getHmenu()->add($this->getTranslator()->trans('menuCalendar'), array('controller' => 'index'));
     $this->getView()->set('calendarList', $calendarMapper->getEntries());
     $this->getView()->set('birthdayList', $userMapper->getUserList());
     if ($calendarMapper->existsTable('events') == true) {
         $this->getView()->set('eventList', $eventsMapper->getEntries(array('show' => 1)));
     }
 }
예제 #2
0
 public function delAction()
 {
     if ($this->getRequest()->isSecure()) {
         $eventMapper = new EventMapper();
         $eventMapper->delete($this->getRequest()->getParam('id'));
         $this->addMessage('deleteSuccess');
     }
     $this->redirect(array('action' => 'index'));
 }
예제 #3
0
 /**
  * @return \Modules\Events\Mappers\Events[]
  */
 public function getEventListPast($limit = null)
 {
     $eventMapper = new EventMapper();
     $sql = 'SELECT *
             FROM `[prefix]_events`
             WHERE start < CURDATE()
             ORDER BY start DESC';
     if ($limit !== null) {
         $sql .= ' LIMIT ' . $limit;
     }
     $rows = $this->db()->queryArray($sql);
     if (empty($rows)) {
         return null;
     }
     $events = array();
     foreach ($rows as $row) {
         $events[] = $eventMapper->getEventById($row['id']);
     }
     return $events;
 }
예제 #4
0
 public function render()
 {
     $date = new \Ilch\Date();
     $eventMapper = new EventMapper();
     $this->getView()->set('eventList', $eventMapper->getEventListUpcoming(5));
 }
예제 #5
0
 public function myAction()
 {
     $eventMapper = new EventMapper();
     $this->getLayout()->getHmenu()->add($this->getTranslator()->trans('menuEvents'), array('controller' => 'index', 'action' => 'index'))->add($this->getTranslator()->trans('naviEventsMy'), array('action' => 'my'));
     $this->getView()->set('eventListMy', $eventMapper->getEntries(array('user_id' => $this->getUser()->getId())));
 }