示例#1
0
 public function __construct($name)
 {
     parent::__construct($name);
     $militaryTime = Ow::getConfig()->getValue('base', 'military_time');
     $language = OW::getLanguage();
     $currentYear = date('Y', time());
     $title = new TextField('title');
     $title->setRequired();
     $title->setLabel($language->text('event', 'add_form_title_label'));
     $event = new OW_Event(self::EVENT_NAME, array('name' => 'title'), $title);
     OW::getEventManager()->trigger($event);
     $title = $event->getData();
     $this->addElement($title);
     $startDate = new DateField('start_date');
     $startDate->setMinYear($currentYear);
     $startDate->setMaxYear($currentYear + 5);
     $startDate->setRequired();
     $event = new OW_Event(self::EVENT_NAME, array('name' => 'start_date'), $startDate);
     OW::getEventManager()->trigger($event);
     $startDate = $event->getData();
     $this->addElement($startDate);
     $startTime = new EventTimeField('start_time');
     $startTime->setMilitaryTime($militaryTime);
     if (!empty($_POST['endDateFlag'])) {
         $startTime->setRequired();
     }
     $event = new OW_Event(self::EVENT_NAME, array('name' => 'start_time'), $startTime);
     OW::getEventManager()->trigger($event);
     $startTime = $event->getData();
     $this->addElement($startTime);
     $endDate = new DateField('end_date');
     $endDate->setMinYear($currentYear);
     $endDate->setMaxYear($currentYear + 5);
     $event = new OW_Event(self::EVENT_NAME, array('name' => 'end_date'), $endDate);
     OW::getEventManager()->trigger($event);
     $endDate = $event->getData();
     $this->addElement($endDate);
     $endTime = new EventTimeField('end_time');
     $endTime->setMilitaryTime($militaryTime);
     $event = new OW_Event(self::EVENT_NAME, array('name' => 'end_time'), $endTime);
     OW::getEventManager()->trigger($event);
     $endTime = $event->getData();
     $this->addElement($endTime);
     $location = new TextField('location');
     $location->setRequired();
     $location->setLabel($language->text('event', 'add_form_location_label'));
     $event = new OW_Event(self::EVENT_NAME, array('name' => 'location'), $location);
     OW::getEventManager()->trigger($event);
     $location = $event->getData();
     $this->addElement($location);
     $whoCanView = new RadioField('who_can_view');
     $whoCanView->setRequired();
     $whoCanView->addOptions(array('1' => $language->text('event', 'add_form_who_can_view_option_anybody'), '2' => $language->text('event', 'add_form_who_can_view_option_invit_only')));
     $whoCanView->setLabel($language->text('event', 'add_form_who_can_view_label'));
     $event = new OW_Event(self::EVENT_NAME, array('name' => 'who_can_view'), $whoCanView);
     OW::getEventManager()->trigger($event);
     $whoCanView = $event->getData();
     $this->addElement($whoCanView);
     $whoCanInvite = new RadioField('who_can_invite');
     $whoCanInvite->setRequired();
     $whoCanInvite->addOptions(array(EVENT_BOL_EventService::CAN_INVITE_PARTICIPANT => $language->text('event', 'add_form_who_can_invite_option_participants'), EVENT_BOL_EventService::CAN_INVITE_CREATOR => $language->text('event', 'add_form_who_can_invite_option_creator')));
     $whoCanInvite->setLabel($language->text('event', 'add_form_who_can_invite_label'));
     $event = new OW_Event(self::EVENT_NAME, array('name' => 'who_can_invite'), $whoCanInvite);
     OW::getEventManager()->trigger($event);
     $whoCanInvite = $event->getData();
     $this->addElement($whoCanInvite);
     $submit = new Submit('submit');
     $submit->setValue($language->text('event', 'add_form_submit_label'));
     $this->addElement($submit);
     $desc = new WysiwygTextarea('desc');
     $desc->setLabel($language->text('event', 'add_form_desc_label'));
     $desc->setRequired();
     $event = new OW_Event(self::EVENT_NAME, array('name' => 'desc'), $desc);
     OW::getEventManager()->trigger($event);
     $desc = $event->getData();
     $this->addElement($desc);
     $imageField = new FileField('image');
     $imageField->setLabel($language->text('event', 'add_form_image_label'));
     $this->addElement($imageField);
     $event = new OW_Event(self::EVENT_NAME, array('name' => 'image'), $imageField);
     OW::getEventManager()->trigger($event);
     $imageField = $event->getData();
     $this->setEnctype(Form::ENCTYPE_MULTYPART_FORMDATA);
 }
示例#2
0
文件: base.php 项目: vazahat/dudex
 public function __construct($name)
 {
     parent::__construct($name);
     $militaryTime = Ow::getConfig()->getValue('base', 'military_time');
     $language = OW::getLanguage();
     $currentYear = date('Y', time());
     $title = new TextField('title');
     $title->setRequired();
     $title->setLabel($language->text('eventx', 'add_form_title_label'));
     $event = new OW_Event(self::EVENTX_NAME, array('name' => 'title'), $title);
     OW::getEventManager()->trigger($event);
     $title = $event->getData();
     $this->addElement($title);
     $startDate = new DateField('start_date');
     $startDate->setMinYear($currentYear);
     $startDate->setMaxYear($currentYear + 5);
     $startDate->setRequired();
     $event = new OW_Event(self::EVENTX_NAME, array('name' => 'start_date'), $startDate);
     OW::getEventManager()->trigger($event);
     $startDate = $event->getData();
     $this->addElement($startDate);
     $startTime = new EventTimeField('start_time');
     $startTime->setMilitaryTime($militaryTime);
     if (!empty($_POST['endDateFlag'])) {
         $startTime->setRequired();
     }
     $event = new OW_Event(self::EVENTX_NAME, array('name' => 'start_time'), $startTime);
     OW::getEventManager()->trigger($event);
     $startTime = $event->getData();
     $this->addElement($startTime);
     $endDate = new DateField('end_date');
     $endDate->setMinYear($currentYear);
     $endDate->setMaxYear($currentYear + 5);
     $event = new OW_Event(self::EVENTX_NAME, array('name' => 'end_date'), $endDate);
     OW::getEventManager()->trigger($event);
     $endDate = $event->getData();
     $this->addElement($endDate);
     $endTime = new EventTimeField('end_time');
     $endTime->setMilitaryTime($militaryTime);
     $event = new OW_Event(self::EVENTX_NAME, array('name' => 'end_time'), $endTime);
     OW::getEventManager()->trigger($event);
     $endTime = $event->getData();
     $this->addElement($endTime);
     if (OW::getConfig()->getValue('eventx', 'enableCategoryList') == '1') {
         if (OW::getConfig()->getValue('eventx', 'enableMultiCategories') == 1) {
             $element = new CheckboxGroup('event_category');
             $element->setColumnCount(3);
         } else {
             $element = new SelectBox('event_category');
         }
         $element->setRequired(true);
         $element->setLabel($language->text('eventx', 'event_category_label'));
         foreach (EVENTX_BOL_EventService::getInstance()->getCategoriesList() as $category) {
             $element->addOption($category->id, $category->name);
         }
         $this->addElement($element);
     }
     $maxInvites = new TextField('max_invites');
     $maxInvites->setRequired();
     $validator = new IntValidator(0);
     $validator->setErrorMessage($language->text('eventx', 'invalid_integer_value'));
     $maxInvites->addValidator($validator);
     $maxInvites->setLabel($language->text('eventx', 'add_form_maxinvites_label'));
     $this->addElement($maxInvites);
     $location = new TextField('location');
     $location->setRequired();
     $location->setId('location');
     $location->setLabel($language->text('eventx', 'add_form_location_label'));
     $event = new OW_Event(self::EVENTX_NAME, array('name' => 'location'), $location);
     OW::getEventManager()->trigger($event);
     $location = $event->getData();
     $this->addElement($location);
     $whoCanView = new RadioField('who_can_view');
     $whoCanView->setRequired();
     $whoCanView->addOptions(array('1' => $language->text('eventx', 'add_form_who_can_view_option_anybody'), '2' => $language->text('eventx', 'add_form_who_can_view_option_invit_only')));
     $whoCanView->setLabel($language->text('eventx', 'add_form_who_can_view_label'));
     $event = new OW_Event(self::EVENTX_NAME, array('name' => 'who_can_view'), $whoCanView);
     OW::getEventManager()->trigger($event);
     $whoCanView = $event->getData();
     $this->addElement($whoCanView);
     $whoCanInvite = new RadioField('who_can_invite');
     $whoCanInvite->setRequired();
     $whoCanInvite->addOptions(array(EVENTX_BOL_EventService::CAN_INVITE_PARTICIPANT => $language->text('eventx', 'add_form_who_can_invite_option_participants'), EVENTX_BOL_EventService::CAN_INVITE_CREATOR => $language->text('eventx', 'add_form_who_can_invite_option_creator')));
     $whoCanInvite->setLabel($language->text('eventx', 'add_form_who_can_invite_label'));
     $event = new OW_Event(self::EVENTX_NAME, array('name' => 'who_can_invite'), $whoCanInvite);
     OW::getEventManager()->trigger($event);
     $whoCanInvite = $event->getData();
     $this->addElement($whoCanInvite);
     $desc = new WysiwygTextarea('desc');
     $desc->setLabel($language->text('eventx', 'add_form_desc_label'));
     $desc->setRequired();
     $event = new OW_Event(self::EVENTX_NAME, array('name' => 'desc'), $desc);
     OW::getEventManager()->trigger($event);
     $desc = $event->getData();
     $this->addElement($desc);
     $imageField = new FileField('image');
     $imageField->setLabel($language->text('eventx', 'add_form_image_label'));
     $this->addElement($imageField);
     if (OW::getConfig()->getValue('eventx', 'enableTagsList') == '1') {
         $tags = new TagsInputField('tags');
         $tags->setId('tags');
         $tags->setLabel($language->text('base', 'tags_cloud_cap_label'));
         $this->addElement($tags);
     }
     $submit = new Submit('submit');
     $submit->setValue($language->text('eventx', 'add_form_submit_label'));
     $this->addElement($submit);
     $event = new OW_Event(self::EVENTX_NAME, array('name' => 'image'), $imageField);
     OW::getEventManager()->trigger($event);
     $imageField = $event->getData();
     $this->setEnctype(Form::ENCTYPE_MULTYPART_FORMDATA);
 }