1 | <?php |
---|
2 | |
---|
3 | /** |
---|
4 | * CommunityTopic filter form. |
---|
5 | * |
---|
6 | * @package OpenPNE |
---|
7 | * @subpackage filter |
---|
8 | * @author Eitarow Fukamachi <fukamachi@tejimaya.net> |
---|
9 | */ |
---|
10 | class PluginCommunityTopicFormFilter extends BaseCommunityTopicFormFilter |
---|
11 | { |
---|
12 | public function __construct($defaults = array(), $options = array(), $CSRFSecret = null) |
---|
13 | { |
---|
14 | return parent::__construct($defaults, $options, false); |
---|
15 | } |
---|
16 | |
---|
17 | public function configure() |
---|
18 | { |
---|
19 | $i18n = sfContext::getInstance()->getI18N(); |
---|
20 | $types = array( |
---|
21 | 'topic' => $i18n->__('Topic'), |
---|
22 | 'event' => $i18n->__('Event'), |
---|
23 | ); |
---|
24 | |
---|
25 | $widgets = array( |
---|
26 | 'keyword' => new sfWidgetFormInput(array( |
---|
27 | 'label' => $i18n->__('Keyword', array(), 'form_community'), |
---|
28 | )), |
---|
29 | 'type' => new sfWIdgetFormChoice(array( |
---|
30 | 'expanded' => true, |
---|
31 | 'choices' => $types, |
---|
32 | 'label' => $i18n->__('Target', array(), 'form_community'), |
---|
33 | )), |
---|
34 | ); |
---|
35 | |
---|
36 | $validators = array( |
---|
37 | 'keyword' => new opValidatorSearchQueryString(array('required' => false)), |
---|
38 | 'type' => new sfValidatorChoice(array('choices' => array_keys($types), 'required' => false)), |
---|
39 | ); |
---|
40 | |
---|
41 | $this->setWidgets($widgets); |
---|
42 | $this->setValidators($validators); |
---|
43 | } |
---|
44 | } |
---|