Пример #1
0
 public function getListByField(SxCms_Event_Field &$field)
 {
     $db = Zend_Registry::get('db');
     $select = $db->select()->from('EventFieldList', array('*'))->where('event_field_id = ?', $field->getId());
     $results = $db->fetchAll($select);
     foreach ($results as $result) {
         $fieldlist = new SxCms_Event_Field_List();
         $fieldlist->setId($result['list_id'])->setEventFieldId($result['event_field_id'])->setLabel($result['label'])->setValue($result['value']);
         $field->addList($fieldlist, $result['list_id']);
     }
     return;
 }
Пример #2
0
 public function getFieldsByEvent($event_id)
 {
     $db = Zend_Registry::get('db');
     $select = $db->select()->from('EventField', array('*'))->where('event_id = ?', $event_id);
     $results = $db->fetchAll($select);
     $fields = array();
     foreach ($results as $result) {
         $eventfield = new SxCms_Event_Field();
         $eventfield->setId($result['field_id'])->setEventId($result['event_id'])->setLanguage($result['language'])->setLabel($result['label'])->setName($result['name'])->setType($result['type']);
         $fields[] = $eventfield;
     }
     return $fields;
 }
Пример #3
0
 public function addFieldAction()
 {
     $key = $this->_getParam('key', null);
     if ($key != '') {
         $field = $this->_event->getFields($key);
     } else {
         $field = new SxCms_Event_Field();
     }
     if ($this->getRequest()->isPost()) {
         $field->setLabel(trim($this->_getParam('label')))->setName(trim($this->_getParam('name')))->setType($this->_getParam('type'));
         $this->_event->addFields($field, $key);
     }
     $this->view->event = $this->_event;
     $this->view->field = $field;
     $this->_helper->layout()->disableLayout();
     $this->render('fieldtable');
 }