1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12:
13: class Agora_Form_Search extends Horde_Form {
14:
15: 16: 17:
18: function getForumsType($scope)
19: {
20: $forums = $GLOBALS['injector']->getInstance('Agora_Factory_Driver')->create($scope);
21: $forumlist = $forums->getBareForums();
22:
23: return array('multienum', array($forumlist));
24: }
25:
26: 27: 28:
29: function __construct(&$vars, $scope)
30: {
31: parent::Horde_Form($vars, _("Search Forums"));
32:
33: if ($scope == 'agora') {
34: list($forumstype, $forumsparams) = $this->getForumsType($scope);
35: $this->addVariable(_("Search in these forums"), 'forums', $forumstype,
36: false, false, null, $forumsparams);
37: } else {
38: $this->addHidden('', 'scope', 'text', false);
39: }
40:
41: $this->addVariable(_("Keywords"), 'keywords', 'text', false);
42: $var = &$this->addVariable(_("Require all keywords?"), 'allkeywords',
43: 'boolean', false);
44: $var->setDefault(true);
45:
46: $var = &$this->addVariable(_("Search in subjects?"),
47: 'searchsubjects', 'boolean', false);
48: $var->setDefault(true);
49:
50: $this->addVariable(_("Search in message contents?"), 'searchcontents',
51: 'boolean', false);
52:
53: $this->addVariable(_("Author"), 'author', 'text', false);
54:
55: $this->setButtons(_("Search"));
56: }
57:
58: 59: 60:
61: function getInfo($vars, &$info)
62: {
63: parent::getInfo($vars, $info);
64:
65: if (!$this->isSubmitted()) {
66: foreach ($info as $key => $val) {
67: $info[$key] = $vars->get($key);
68: }
69: }
70: }
71: }
72: