/** * (non-PHPdoc) * @see \library\BaseModel::getElementsRender() */ public function getElementsRender() { $output = array('type_id' => array('__tid__' => 'main', 'type' => 'hidden', 'label' => Text::_('MOD_ADVERT_ADVERT_TYPES_TYPE_ID_LABEL'), 'hint' => Text::_('MOD_ADVERT_ADVERT_TYPES_TYPE_ID_HINT')), 'type_name' => array('__tid__' => 'main', 'type' => 'text', 'label' => Text::_('MOD_ADVERT_ADVERT_TYPES_TYPE_NAME_LABEL'), 'hint' => Text::_('MOD_ADVERT_ADVERT_TYPES_TYPE_NAME_HINT'), 'required' => true), 'type_key' => array('__tid__' => 'main', 'type' => 'text', 'label' => Text::_('MOD_ADVERT_ADVERT_TYPES_TYPE_KEY_LABEL'), 'hint' => Text::_('MOD_ADVERT_ADVERT_TYPES_TYPE_KEY_HINT'), 'required' => true), 'picture' => array('__tid__' => 'main', '__object__' => 'views\\bootstrap\\advert\\AdvertTypesRadioElement', 'type' => 'radio', 'label' => Text::_('MOD_ADVERT_ADVERT_TYPES_PICTURE_LABEL'), 'hint' => Text::_('MOD_ADVERT_ADVERT_TYPES_PICTURE_HINT'), 'options' => DataTypes::getPictureEnum(), 'value' => DataTypes::PICTURE_DEFAULT), 'description' => array('__tid__' => 'main', 'type' => 'textarea', 'label' => Text::_('MOD_ADVERT_ADVERT_TYPES_DESCRIPTION_LABEL'), 'hint' => Text::_('MOD_ADVERT_ADVERT_TYPES_DESCRIPTION_HINT')), 'advert_count' => array('label' => Text::_('MOD_ADVERT_ADVERT_TYPES_ADVERT_COUNT_LABEL')), 'adverts' => array('label' => Text::_('MOD_ADVERT_URLS_ADVERTS_INDEX'))); return $output; }
/** * 通过“示例图片”,获取“示例图片名” * @param string $picture * @return string */ public function getPictureLangByPicture($picture) { $enum = DataTypes::getPictureEnum(); return isset($enum[$picture]) ? $enum[$picture] : ''; }
/** * 获取“示例图片”验证规则 * @param mixed $value * @return array */ public function getPictureRule($value) { $enum = DataTypes::getPictureEnum(); return array('InArray' => new validator\InArrayValidator($value, array_keys($enum), sprintf(Lang::_('SRV_FILTER_ADVERT_TYPES_PICTURE_INARRAY'), implode(', ', $enum)))); }