Example #1
0
 public function getEvents()
 {
     if (!$this->_events) {
         $event = new Event_Model_Event_Custom();
         $this->_events = $event->findAll(array('agenda_id' => $this->getCurrentEvent()->getId()));
     }
     return $this->_events;
 }
Example #2
0
 public function deleteAction()
 {
     if (!$this->getRequest()->getParam('id')) {
         throw new Exception($this->_("An error occurred while loading this event"));
     }
     $id = $this->getRequest()->getParam("id");
     $html = '';
     try {
         $event = new Event_Model_Event_Custom();
         $event->find($id);
         if ($event->getAgenda()->getValueId() != $this->getCurrentOptionValue()->getId()) {
             throw new Exception($this->_("An error occurred while deleting the event"));
         }
         $event->delete();
         $html = array('event_id' => $id, 'success' => 1, 'success_message' => $this->_('Event successfully deleted'), 'message_timeout' => 2, 'message_button' => 0, 'message_loader' => 0);
         $cache = Zend_Registry::get('cache');
         $cache->remove('AGENDA_OVI_' . sha1($this->getCurrentOptionValue()->getId()));
     } catch (Exception $e) {
         $html = array('message' => $e->getMessage(), 'url' => '/event/admin/list');
     }
     $this->getLayout()->setHtml(Zend_Json::encode($html));
 }
Example #3
0
 public function createDummyContents($option_value, $design, $category)
 {
     $dummy_content_xml = $this->_getDummyXml($design, $category);
     foreach ($dummy_content_xml->events->event as $event) {
         $this->unsData();
         $this->setValueId($option_value->getId())->addData((array) $event->content)->save();
         if ($event->custom_contents) {
             foreach ($event->custom_contents->custom_content as $custom_content) {
                 $custom = new Event_Model_Event_Custom();
                 $custom->addData((array) $custom_content)->setAgendaId($this->getId())->save();
             }
         }
     }
 }
Example #4
0
 protected function _parseCustomAgenda($custom_agenda_id)
 {
     $event = new Event_Model_Event_Custom();
     $custom_events = $event->findAll(array('agenda_id' => $custom_agenda_id));
     foreach ($custom_events as $custom_event) {
         if (strtotime($custom_event->getEndAt()) > strtotime(date("Y-m-d H:i:s", time()))) {
             $image = $custom_event->getPictureUrl();
             if (!$image) {
                 $image = $this->_getNoImage();
             }
             $custom_event->setPicture($image);
             $this->_list[] = $custom_event->getData();
         }
     }
 }