Subversion-Projekte lars-tiefland.prado

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<?php
2
 
3
class SearchBox extends TTemplateControl
4
{
5
	public function getText()
6
	{
7
        $this->ensureChildControls();
8
        return $this->getRegisteredObject('search')->getText();
9
    }
10
 
11
    public function getTextBox()
12
    {
13
        $this->ensureChildControls();
14
        return $this->getRegisteredObject('search');
15
    }
16
 
17
	public function getButton()
18
	{
19
		$this->ensureChildControls();
20
        return $this->getRegisteredObject('find');
21
	}
22
 
23
	public function onInit($param)
24
	{
25
		parent::onInit($param);
26
		if(strlen($q = $this->Page->Request['q']) > 0)
27
			$this->search->setText($q);
28
	}
29
 
30
	public function doSearch($sender, $param)
31
	{
32
		if(strlen($query = $this->search->getText()) >0)
33
		{
34
			$ps = $this->getApplication()->getService();
35
			$page = $ps->constructUrl('Search', array('q' => $query), false);
36
			$this->getApplication()->getResponse()->redirect($page);
37
		}
38
	}
39
}
40
 
41
?>