Ejemplo n.º 1
0
 public function createAction()
 {
     if (!$this->_helper->requireSubject('event')->isValid()) {
         return $this->_helper->requireSubject->forward();
     }
     $this->view->form = $form = new Ynevent_Form_Announcement_Create();
     $this->view->event = $event = Engine_Api::_()->core()->getSubject();
     $viewer = Engine_Api::_()->user()->getViewer();
     if ($this->getRequest()->isPost() && $form->isValid($this->getRequest()->getPost())) {
         $params = $form->getValues();
         $params['user_id'] = Engine_Api::_()->user()->getViewer()->getIdentity();
         $params['event_id'] = $event->getIdentity();
         $announcement = Engine_Api::_()->getDbtable('announcements', 'ynevent')->createRow();
         $announcement->setFromArray($params);
         $announcement->save();
         //un-highlight another announcement
         $announcement->setUnHighlight();
         return $this->_helper->redirector->gotoRoute(array('controller' => 'announcement', 'action' => 'manage', 'event_id' => $event->getIdentity()), 'event_extended', true);
     }
 }
Ejemplo n.º 2
0
 public function init()
 {
     parent::init();
     $this->setTitle('Edit Announcement');
     $this->submit->setLabel('Edit Announcement');
 }