本文整理汇总了PHP中EventManager::getAllTypes方法的典型用法代码示例。如果您正苦于以下问题:PHP EventManager::getAllTypes方法的具体用法?PHP EventManager::getAllTypes怎么用?PHP EventManager::getAllTypes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EventManager
的用法示例。
在下文中一共展示了EventManager::getAllTypes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: EventManager
function __construct($controller, $name, $use_actions = true)
{
$event_manager = new EventManager($this->repository, new EventRegistrationRequestFactory(), null, new SapphireEventPublishingService(), new EventValidatorFactory(), SapphireTransactionManager::getInstance());
$fields = new FieldList();
//point of contact
$fields->push(new TextField('point_of_contact_name', 'Name'));
$fields->push(new EmailField('point_of_contact_email', 'Email'));
//main info
$fields->push(new TextField('title', 'Title'));
$fields->push(new TextField('url', 'Url'));
$types = $event_manager->getAllTypes();
foreach ($types as $type) {
$options[$type] = $type;
}
$categoryField = new DropdownField('category', 'Category', $options);
$categoryField->setEmptyString('-- select a category --');
$fields->push($categoryField);
//location
$fields->push(new TextField('city', 'City'));
$fields->push(new TextField('state', 'State'));
$countryField = new CountryDropdownField('country', 'Country');
$countryField->setEmptyString('-- select a country --');
$fields->push($countryField);
//duration
$fields->push($start_date = new TextField('start_date', 'Start Date'));
$fields->push($end_date = new TextField('end_date', 'End Date'));
$start_date->addExtraClass('date');
$end_date->addExtraClass('date');
// Guard against automated spam registrations by optionally adding a field
// that is supposed to stay blank (and is hidden from most humans).
// The label and field name are intentionally common ("username"),
// as most spam bots won't resist filling it out. The actual username field
// on the forum is called "Nickname".
$fields->push(new TextField('user_name', 'UserName'));
// Create action
$actions = new FieldList();
if ($use_actions) {
$actions->push(new FormAction('saveEventRegistrationRequest', 'Save'));
}
// Create validators
$validator = new ConditionalAndValidationRule(array(new HtmlPurifierRequiredValidator('title', 'city'), new RequiredFields('point_of_contact_name', 'point_of_contact_email', 'start_date', 'end_date', 'country')));
parent::__construct($controller, $name, $fields, $actions, $validator);
}