From 30eddf57c8de433e8ea02b9e552c8e1744a505a7 Mon Sep 17 00:00:00 2001 From: wei <> Date: Sun, 7 May 2006 03:34:25 +0000 Subject: Add search to quickstart demo. --- demos/quickstart/protected/controls/Layout.tpl | 3 ++ demos/quickstart/protected/controls/SearchBox.php | 41 +++++++++++++++++++++++ demos/quickstart/protected/controls/SearchBox.tpl | 3 ++ demos/quickstart/protected/controls/TopicList.tpl | 10 ++++++ 4 files changed, 57 insertions(+) create mode 100644 demos/quickstart/protected/controls/SearchBox.php create mode 100644 demos/quickstart/protected/controls/SearchBox.tpl (limited to 'demos/quickstart/protected/controls') diff --git a/demos/quickstart/protected/controls/Layout.tpl b/demos/quickstart/protected/controls/Layout.tpl index a69d8f50..6fbd1380 100644 --- a/demos/quickstart/protected/controls/Layout.tpl +++ b/demos/quickstart/protected/controls/Layout.tpl @@ -14,6 +14,9 @@ +
+ +
Home | PradoSoft.com | PDF Version | diff --git a/demos/quickstart/protected/controls/SearchBox.php b/demos/quickstart/protected/controls/SearchBox.php new file mode 100644 index 00000000..b579cd91 --- /dev/null +++ b/demos/quickstart/protected/controls/SearchBox.php @@ -0,0 +1,41 @@ +ensureChildControls(); + return $this->getRegisteredObject('search')->getText(); + } + + public function getTextBox() + { + $this->ensureChildControls(); + return $this->getRegisteredObject('search'); + } + + public function getButton() + { + $this->ensureChildControls(); + return $this->getRegisteredObject('find'); + } + + public function onInit($param) + { + parent::onInit($param); + if(strlen($q = $this->Page->Request['q']) > 0) + $this->search->setText($q); + } + + public function doSearch($sender, $param) + { + if(strlen($query = $this->search->getText()) >0) + { + $ps = $this->getApplication()->getPageService(); + $page = $ps->constructUrl('Search', array('q' => $query)); + $this->getApplication()->getResponse()->redirect($page); + } + } +} + +?> \ No newline at end of file diff --git a/demos/quickstart/protected/controls/SearchBox.tpl b/demos/quickstart/protected/controls/SearchBox.tpl new file mode 100644 index 00000000..b3339d19 --- /dev/null +++ b/demos/quickstart/protected/controls/SearchBox.tpl @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/demos/quickstart/protected/controls/TopicList.tpl b/demos/quickstart/protected/controls/TopicList.tpl index d2cde711..5ffc7098 100644 --- a/demos/quickstart/protected/controls/TopicList.tpl +++ b/demos/quickstart/protected/controls/TopicList.tpl @@ -78,4 +78,14 @@ + + \ No newline at end of file -- cgit v1.2.3