Пример #1
0
 public function addAction()
 {
     SxCms_Acl::requireAcl('event', 'event.add');
     $mapper = new SxCms_Event_DataMapper();
     $regions = $mapper->getDistinctRegions();
     $this->view->regions = $regions;
     if ($this->getRequest()->isGet()) {
         $this->_event = new SxCms_Event();
         $settings = SxCms_Event_Setting_DataMapper::getAllSettings();
         $this->_event->setMailConfirmation($settings['mailConfirmation']->getValue())->setMailRemember($settings['mailRemember']->getValue());
     }
     if ($this->getRequest()->isPost()) {
         $this->_event->setSubscriptionAllow($this->_getParam('subscriptionAllow'))->setSubscriptionMax($this->_getParam('subscriptionMax'))->setNotifyEmail($this->_getParam('notifyEmail'))->setDateStart($this->_getParam('dateStart'))->setDateEnd($this->_getParam('dateEnd'))->setRememberDays($this->_getParam('rememberDays'))->setConfirmationLink($this->_getParam('confirmationLink'))->setValidateIntern($this->_getParam('validateIntern'));
         $timeEvent = $this->_getParam('datetimeH') . ':' . $this->_getParam('datetimeI') . ':00';
         $this->_event->setDateEvent($this->_getParam('dateEvent'))->setTimeEvent($timeEvent)->setLocation($this->_getParam('location'))->setTitle($this->_getParam('title'))->setDescription($this->_getParam('description'));
         $this->_event->setMailRemember($this->_getParam('mailRemember'))->setMailConfirmation($this->_getParam('mailConfirmation'));
         if ($this->_event->isValid()) {
             $this->_event->save();
             $flashMessenger = $this->_helper->getHelper('FlashMessenger');
             $flashMessenger->addMessage($this->admin_tmx->_('eventcreated'));
             $this->_helper->redirector->gotoSimple('index', 'event');
         }
     }
     $this->view->messages = Sanmax_MessageStack::getInstance('SxCms_Event');
     $this->view->event = $this->_event;
     $this->view->field = new SxCms_Event_Field();
     $this->view->list = new SxCms_Event_Field_List();
 }
Пример #2
0
 public function indexAction()
 {
     $settings = SxCms_Event_Setting_DataMapper::getAllSettings();
     if ($this->getRequest()->isPost()) {
         foreach ($this->_getAllParams() as $key => $value) {
             if (array_key_exists($key, $settings)) {
                 $setting = new SxCms_Event_Setting();
                 $setting->setVariable($key)->setValue($value)->setLanguage($_SESSION['System']['lng']);
                 $setting->save();
             }
         }
         $flashMessenger = $this->_helper->getHelper('FlashMessenger');
         $flashMessenger->addMessage($this->admin_tmx->_('settingsedited'));
         $this->_helper->redirector->gotoSimple('index', 'event_settings');
     }
     $this->view->settings = $settings;
 }