/** * (non-PHPdoc) * @see \library\BaseModel::getElementsRender() */ public function getElementsRender() { $nowTime = date('Y-m-d H:i:s'); $output = array('poll_id' => array('__tid__' => 'main', 'type' => 'hidden', 'label' => Text::_('MOD_POLL_POLLS_POLL_ID_LABEL'), 'hint' => Text::_('MOD_POLL_POLLS_POLL_ID_HINT')), 'poll_name' => array('__tid__' => 'main', 'type' => 'text', 'label' => Text::_('MOD_POLL_POLLS_POLL_NAME_LABEL'), 'hint' => Text::_('MOD_POLL_POLLS_POLL_NAME_HINT'), 'required' => true), 'poll_key' => array('__tid__' => 'main', 'type' => 'text', 'label' => Text::_('MOD_POLL_POLLS_POLL_KEY_LABEL'), 'hint' => Text::_('MOD_POLL_POLLS_POLL_KEY_HINT'), 'required' => true), 'allow_unregistered' => array('__tid__' => 'main', 'type' => 'switch', 'label' => Text::_('MOD_POLL_POLLS_ALLOW_UNREGISTERED_LABEL'), 'hint' => Text::_('MOD_POLL_POLLS_ALLOW_UNREGISTERED_HINT'), 'options' => DataPolls::getAllowUnregisteredEnum(), 'value' => DataPolls::ALLOW_UNREGISTERED_Y), 'm_rank_ids' => array('__tid__' => 'main', 'type' => 'checkbox', 'label' => Text::_('MOD_POLL_POLLS_M_RANK_IDS_LABEL'), 'hint' => Text::_('MOD_POLL_POLLS_M_RANK_IDS_HINT'), 'options' => DataMembers::getRanksEnum()), 'join_type' => array('__tid__' => 'main', 'type' => 'radio', 'label' => Text::_('MOD_POLL_POLLS_JOIN_TYPE_LABEL'), 'hint' => Text::_('MOD_POLL_POLLS_JOIN_TYPE_HINT'), 'options' => DataPolls::getJoinTypeEnum(), 'value' => DataPolls::JOIN_TYPE_FOREVER), 'interval' => array('__tid__' => 'main', 'type' => 'text', 'label' => Text::_('MOD_POLL_POLLS_INTERVAL_LABEL'), 'hint' => Text::_('MOD_POLL_POLLS_INTERVAL_HINT'), 'required' => true, 'value' => 0), 'is_published' => array('__tid__' => 'main', 'type' => 'switch', 'label' => Text::_('MOD_POLL_POLLS_IS_PUBLISHED_LABEL'), 'hint' => Text::_('MOD_POLL_POLLS_IS_PUBLISHED_HINT'), 'options' => DataPolls::getIsPublishedEnum(), 'value' => DataPolls::IS_PUBLISHED_Y), 'dt_publish_up' => array('__tid__' => 'main', 'type' => 'datetimepicker', 'label' => Text::_('MOD_POLL_POLLS_DT_PUBLISH_UP_LABEL'), 'hint' => Text::_('MOD_POLL_POLLS_DT_PUBLISH_UP_HINT'), 'value' => $nowTime), 'dt_publish_down' => array('__tid__' => 'main', 'type' => 'datetimepicker', 'label' => Text::_('MOD_POLL_POLLS_DT_PUBLISH_DOWN_LABEL'), 'hint' => Text::_('MOD_POLL_POLLS_DT_PUBLISH_DOWN_HINT')), 'is_visible' => array('__tid__' => 'main', 'type' => 'switch', 'label' => Text::_('MOD_POLL_POLLS_IS_VISIBLE_LABEL'), 'hint' => Text::_('MOD_POLL_POLLS_IS_VISIBLE_HINT'), 'options' => DataPolls::getIsVisibleEnum(), 'value' => DataPolls::IS_VISIBLE_Y), 'is_multiple' => array('__tid__' => 'main', 'type' => 'switch', 'label' => Text::_('MOD_POLL_POLLS_IS_MULTIPLE_LABEL'), 'hint' => Text::_('MOD_POLL_POLLS_IS_MULTIPLE_HINT'), 'options' => DataPolls::getIsMultipleEnum(), 'value' => DataPolls::IS_MULTIPLE_Y), 'max_choices' => array('__tid__' => 'main', 'type' => 'text', 'label' => Text::_('MOD_POLL_POLLS_MAX_CHOICES_LABEL'), 'hint' => Text::_('MOD_POLL_POLLS_MAX_CHOICES_HINT'), 'required' => true, 'value' => 0), 'description' => array('__tid__' => 'main', 'type' => 'textarea', 'label' => Text::_('MOD_POLL_POLLS_DESCRIPTION_LABEL'), 'hint' => Text::_('MOD_POLL_POLLS_DESCRIPTION_HINT')), 'ext_info' => array('__tid__' => 'main', 'type' => 'textarea', 'label' => Text::_('MOD_POLL_POLLS_EXT_INFO_LABEL'), 'hint' => Text::_('MOD_POLL_POLLS_EXT_INFO_HINT')), 'dt_created' => array('__tid__' => 'system', 'type' => 'text', 'label' => Text::_('MOD_POLL_POLLS_DT_CREATED_LABEL'), 'hint' => Text::_('MOD_POLL_POLLS_DT_CREATED_HINT'), 'disabled' => true), 'polloptions' => array('label' => Text::_('MOD_POLL_URLS_POLLOPTIONS_INDEX'))); return $output; }
/** * 获取“是否多选”验证规则 * @param mixed $value * @return array */ public function getIsMultipleRule($value) { $enum = DataPolls::getIsMultipleEnum(); return array('InArray' => new validator\InArrayValidator($value, array_keys($enum), sprintf(Lang::_('SRV_FILTER_POLLS_IS_MULTIPLE_INARRAY'), implode(', ', $enum)))); }
/** * 获取“是否允许非会员参加” * @param string $allowUnregistered * @return string */ public function getAllowUnregisteredByAllowUnregistered($allowUnregistered) { $enum = DataPolls::getAllowUnregisteredEnum(); return isset($enum[$allowUnregistered]) ? $enum[$allowUnregistered] : ''; }