本文整理汇总了PHP中DateField::setMinYear方法的典型用法代码示例。如果您正苦于以下问题:PHP DateField::setMinYear方法的具体用法?PHP DateField::setMinYear怎么用?PHP DateField::setMinYear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DateField
的用法示例。
在下文中一共展示了DateField::setMinYear方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct()
{
parent::__construct('goal-edit-form');
$this->setEnctype(Form::ENCTYPE_MULTYPART_FORMDATA);
$lang = OW::getLanguage();
$id = new HiddenField('projectId');
$id->setRequired(true);
$this->addElement($id);
$name = new TextField('name');
$name->setRequired(true);
$name->setLabel($lang->text('ocsfundraising', 'name'));
$this->addElement($name);
$btnSet = array(BOL_TextFormatService::WS_BTN_IMAGE, BOL_TextFormatService::WS_BTN_VIDEO, BOL_TextFormatService::WS_BTN_HTML);
$desc = new WysiwygTextarea('description', $btnSet);
$desc->setRequired(true);
$sValidator = new StringValidator(1, 50000);
$desc->addValidator($sValidator);
$desc->setLabel($lang->text('ocsfundraising', 'description'));
$this->addElement($desc);
$category = new Selectbox('category');
$category->setLabel($lang->text('ocsfundraising', 'category'));
$list = OCSFUNDRAISING_BOL_Service::getInstance()->getCategoryList();
if ($list) {
foreach ($list as $cat) {
$category->addOption($cat->id, $lang->text('ocsfundraising', 'category_' . $cat->id));
}
}
$this->addElement($category);
$target = new TextField('target');
$target->setRequired(true);
$target->setLabel($lang->text('ocsfundraising', 'target_amount'));
$this->addElement($target);
$min = new TextField('min');
$min->setLabel($lang->text('ocsfundraising', 'min_amount'));
$min->setValue(1);
$this->addElement($min);
$end = new DateField('end');
$end->setMinYear(date('Y'));
$end->setMaxYear(date('Y') + 2);
$end->setLabel($lang->text('ocsfundraising', 'end_date'));
$this->addElement($end);
$imageField = new FileField('image');
$imageField->setLabel($lang->text('ocsfundraising', 'image_label'));
$this->addElement($imageField);
$submit = new Submit('edit');
$submit->setLabel($lang->text('ocsfundraising', 'edit'));
$this->addElement($submit);
}
示例2: getPresentationClass
/**
* Returns all available presentations
*
* @return array<string>
*/
public function getPresentationClass($presentation, $fieldName, $configs = null)
{
$event = new OW_Event('base.questions_field_get_label', array('presentation' => $presentation, 'fieldName' => $fieldName, 'configs' => $configs, 'type' => 'edit'));
OW::getEventManager()->trigger($event);
$label = $event->getData();
$class = null;
$event = new OW_Event('base.questions_field_init', array('type' => 'main', 'presentation' => $presentation, 'fieldName' => $fieldName, 'configs' => $configs));
OW::getEventManager()->trigger($event);
$class = $event->getData();
if (empty($class)) {
switch ($presentation) {
case self::QUESTION_PRESENTATION_TEXT:
$class = new TextField($fieldName);
break;
case self::QUESTION_PRESENTATION_SELECT:
$class = new Selectbox($fieldName);
break;
case self::QUESTION_PRESENTATION_TEXTAREA:
$class = new Textarea($fieldName);
break;
case self::QUESTION_PRESENTATION_CHECKBOX:
$class = new CheckboxField($fieldName);
break;
case self::QUESTION_PRESENTATION_RADIO:
$class = new RadioField($fieldName);
break;
case self::QUESTION_PRESENTATION_MULTICHECKBOX:
$class = new CheckboxGroup($fieldName);
break;
case self::QUESTION_PRESENTATION_BIRTHDATE:
case self::QUESTION_PRESENTATION_AGE:
case self::QUESTION_PRESENTATION_DATE:
$class = new DateField($fieldName);
if (!empty($configs) && mb_strlen(trim($configs)) > 0) {
$configsList = json_decode($configs, true);
foreach ($configsList as $name => $value) {
if ($name = 'year_range' && isset($value['from']) && isset($value['to'])) {
$class->setMinYear($value['from']);
$class->setMaxYear($value['to']);
}
}
}
$class->addValidator(new DateValidator($class->getMinYear(), $class->getMaxYear()));
break;
case self::QUESTION_PRESENTATION_RANGE:
$class = new Range($fieldName);
if (!empty($configs) && mb_strlen(trim($configs)) > 0) {
$configsList = json_decode($configs, true);
foreach ($configsList as $name => $value) {
$minMax = explode("-", $value);
if ($name = 'range' && isset($minMax[0]) && isset($minMax[1])) {
$class->setMinValue($minMax[0]);
$class->setMaxValue($minMax[1]);
}
}
}
$class->addValidator(new RangeValidator());
break;
case self::QUESTION_PRESENTATION_URL:
$class = new TextField($fieldName);
$class->addValidator(new UrlValidator());
break;
case self::QUESTION_PRESENTATION_PASSWORD:
$class = new PasswordField($fieldName);
break;
}
}
if (!empty($label)) {
$class->setLabel($label);
}
return $class;
}
示例3: __construct
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);
}
示例4: __construct
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');
//.........这里部分代码省略.........