Overview

Packages

  • Agora
  • None

Classes

  • Agora
  • Agora_Api
  • Agora_Driver
  • Agora_Driver_SplitSql
  • Agora_Driver_Sql
  • Agora_Exception
  • Agora_Factory_Driver
  • Agora_Form_Forum
  • Agora_Form_Message
  • Agora_Form_Search
  • Agora_View
  • Horde_Form_Renderer_MessageForm
  • Overview
  • Package
  • Class
  • Tree
 1: <?php
 2: /**
 3:  * Agora_Form_Search:: class provides the functions & forms for search.
 4:  *
 5:  * Copyright 2005-2012 Horde LLC (http://www.horde.org/)
 6:  *
 7:  * See the enclosed file COPYING for license information (GPL). If you
 8:  * did not receive this file, see http://www.horde.org/licenses/gpl.
 9:  *
10:  * @author  Jason Felice <jason.m.felice@gmail.com>
11:  * @package Agora
12:  */
13: class Agora_Form_Search extends Horde_Form {
14: 
15:     /**
16:      * Get list of available forums
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:      * Set up forum object
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:      * Trick getInfo to catch pager parameters
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: 
API documentation generated by ApiGen