当前位置: 首页>>代码示例>>PHP>>正文


PHP TextField::setMaxYear方法代码示例

本文整理汇总了PHP中TextField::setMaxYear方法的典型用法代码示例。如果您正苦于以下问题:PHP TextField::setMaxYear方法的具体用法?PHP TextField::setMaxYear怎么用?PHP TextField::setMaxYear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TextField的用法示例。


在下文中一共展示了TextField::setMaxYear方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getSearchPresentationClass

 /**
  * Returns all available presentations
  *
  * @return array<string>
  */
 public function getSearchPresentationClass($presentation, $fieldName, $configs = array())
 {
     $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' => 'search', 'presentation' => $presentation, 'fieldName' => $fieldName, 'configs' => $configs));
     OW::getEventManager()->trigger($event);
     $class = $event->getData();
     if (empty($class)) {
         switch ($presentation) {
             case self::QUESTION_PRESENTATION_TEXT:
             case self::QUESTION_PRESENTATION_TEXTAREA:
                 $class = new TextField($fieldName);
                 break;
             case self::QUESTION_PRESENTATION_CHECKBOX:
                 $class = new CheckboxField($fieldName);
                 break;
             case self::QUESTION_PRESENTATION_RADIO:
             case self::QUESTION_PRESENTATION_SELECT:
             case self::QUESTION_PRESENTATION_MULTICHECKBOX:
                 $class = new CheckboxGroup($fieldName);
                 break;
             case self::QUESTION_PRESENTATION_BIRTHDATE:
             case self::QUESTION_PRESENTATION_AGE:
                 $class = new AgeRange($fieldName);
                 break;
             case self::QUESTION_PRESENTATION_RANGE:
                 $class = new Range($fieldName);
                 break;
             case self::QUESTION_PRESENTATION_DATE:
                 $class = new DateRange($fieldName);
                 break;
             case self::QUESTION_PRESENTATION_URL:
                 $class = new TextField($fieldName);
                 $class->addValidator(new UrlValidator());
                 break;
         }
         $value = $this->getQuestionConfig($configs, 'year_range');
         if (!empty($value['from']) && !empty($value['to'])) {
             $class->setMinYear($value['from']);
             $class->setMaxYear($value['to']);
         }
     }
     if (!empty($label)) {
         $class->setLabel($label);
     }
     return $class;
 }
开发者ID:hardikamutech,项目名称:hammu,代码行数:54,代码来源:question_service(19-5-2015).php

示例2: getSearchPresentationClass

 /**
  * Returns all available presentations
  *
  * @return array<string>
  */
 public function getSearchPresentationClass($presentation, $fieldName, $configs = array())
 {
     $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' => 'search', 'presentation' => $presentation, 'fieldName' => $fieldName, 'configs' => $configs));
     OW::getEventManager()->trigger($event);
     $class = $event->getData();
     if (empty($class)) {
         switch ($presentation) {
             case self::QUESTION_PRESENTATION_TEXT:
             case self::QUESTION_PRESENTATION_TEXTAREA:
                 $class = new TextField($fieldName);
                 break;
             case self::QUESTION_PRESENTATION_CHECKBOX:
                 $class = new CheckboxField($fieldName);
                 break;
             case self::QUESTION_PRESENTATION_RADIO:
             case self::QUESTION_PRESENTATION_SELECT:
             case self::QUESTION_PRESENTATION_MULTICHECKBOX:
                 $class = new CheckboxGroup($fieldName);
                 break;
             case self::QUESTION_PRESENTATION_BIRTHDATE:
             case self::QUESTION_PRESENTATION_AGE:
                 $class = new AgeRange($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($this->birthdayConfig)) {
                     $birthday = $this->findQuestionByName("birthdate");
                     if (!empty($birthday)) {
                         $this->birthdayConfig = $birthday->custom;
                     }
                 }
                 $rangeValidator = new RangeValidator();
                 if (!empty($this->birthdayConfig) && mb_strlen(trim($this->birthdayConfig)) > 0) {
                     $configsList = json_decode($this->birthdayConfig, true);
                     foreach ($configsList as $name => $value) {
                         if ($name = 'year_range' && isset($value['from']) && isset($value['to'])) {
                             $class->setMinValue(date("Y") - $value['to']);
                             $class->setMaxValue(date("Y") - $value['from']);
                             $rangeValidator->setMinValue(date("Y") - $value['to']);
                             $rangeValidator->setMaxValue(date("Y") - $value['from']);
                         }
                     }
                 }
                 $class->addValidator($rangeValidator);
                 break;
             case self::QUESTION_PRESENTATION_DATE:
                 $class = new DateRange($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_URL:
                 $class = new TextField($fieldName);
                 $class->addValidator(new UrlValidator());
                 break;
         }
         $value = $this->getQuestionConfig($configs, 'year_range');
         if (!empty($value['from']) && !empty($value['to'])) {
             $class->setMinYear($value['from']);
             $class->setMaxYear($value['to']);
         }
     }
     if (!empty($label)) {
         $class->setLabel($label);
     }
     return $class;
 }
开发者ID:Taissas,项目名称:oxwall,代码行数:93,代码来源:question_service.php


注:本文中的TextField::setMaxYear方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。