3
* This file contains all Horde_Form extensions required for searching.
5
* See the enclosed file COPYING for license information (GPL). If you
6
* did not receive this file, see http://www.horde.org/licenses/gpl.
12
* The Nag_Form_Search class provides the form for searching.
14
* @author Michael J Rubinsky <mrubinsk@horde.org>
18
class Nag_Form_Search extends Horde_Form
21
public function __construct(&$vars, $title = '')
23
parent::__construct($vars, $title);
25
$GLOBALS['page_output']->addScriptFile('form_helpers.js', 'horde');
26
$this->addHidden('', 'smart_id', 'text', false);
27
$this->addHidden('', 'actionID', 'text', false);
28
$vars->set('actionID', 'search_tasks');
29
$this->addVariable(_("Search Text:"), 'search_pattern', 'text', false);
30
$v = $this->addVariable(
37
array('values' => array(
38
'search_name' => _("Name"),
39
'search_desc' => _("Description")
42
$v->setDefault(array('search_name', 'search_desc'));
44
$this->addVariable(_("Tagged with:"), 'search_tags', 'Nag:NagTags', false);
45
$v = $this->addVariable(
52
array('values' => array(
53
Nag::VIEW_ALL => _("All"),
54
Nag::VIEW_COMPLETE => _("Completed"),
55
Nag::VIEW_INCOMPLETE => _("Incomplete")
58
$v->setDefault(Nag::VIEW_ALL);
60
$this->addVariable(_("Due date:"), 'due_date', 'Nag:NagSearchDue', false);
62
// If editing a SmartList, allow deletion.
63
if ($vars->get('smart_id')) {
64
$this->addVariable(_("SmartList Name:"), 'smartlist_name', 'text', false);
65
$this->setButtons(_("Save"), _("Reset"));
66
$this->appendButtons(array(array('value' => _("Delete Smart List"), 'name' => 'deletebutton', 'class' => 'horde-delete')));
68
$this->addVariable(_("Save this search as a Smart List?"), 'save_smartlist', 'boolean', false);
69
$sl_name = $this->addVariable(_("Smart List Name:"), 'smartlist_name', 'text', false);
70
$save_action = new Horde_Form_Action_ConditionalEnable(array('target' => 'save_smartlist', 'enabled' => true, 'values' => 'on'));
71
$sl_name->setAction($save_action);
72
$this->setButtons(_("Search"), _("Reset"));
77
public function renderActive()
79
$url = Horde::url('list.php');
80
if ($this->_vars->get('smart_id')) {
81
// Editing an existing smartlist.
82
$url->add(array('actionID' => 'smart', 'list' => $this->_vars->get('smart_id'), 'tab_name' => $this->_vars->get('smart_id')));
84
return parent::renderActive(
85
$this->getRenderer(array('varrenderer_driver' => array('nag', 'nag'))),
b'\\ No newline at end of file'