From fd4b8d9f45d1707035021bc19b8d5bc17ede66ce Mon Sep 17 00:00:00 2001 From: wei <> Date: Mon, 12 Feb 2007 12:46:11 +0000 Subject: Add IBM DB2 driver for active record. --- .../Data/ActiveRecord/Scaffold/TScaffoldSearch.php | 89 ++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 framework/Data/ActiveRecord/Scaffold/TScaffoldSearch.php (limited to 'framework/Data/ActiveRecord/Scaffold/TScaffoldSearch.php') diff --git a/framework/Data/ActiveRecord/Scaffold/TScaffoldSearch.php b/framework/Data/ActiveRecord/Scaffold/TScaffoldSearch.php new file mode 100644 index 00000000..a47a1a47 --- /dev/null +++ b/framework/Data/ActiveRecord/Scaffold/TScaffoldSearch.php @@ -0,0 +1,89 @@ +_list===null && ($id = $this->getListViewID()) !== null) + { + $this->_list = $this->getParent()->findControl($id); + if($this->_list ===null) + throw new TConfigurationException('scaffold_unable_to_find_list_view', $id); + } + return $this->_list; + } + + public function setListView($value) + { + $this->_list = $value; + } + + public function setListViewID($value) + { + $this->setViewState('ListViewID', $value); + } + + public function getListViewID() + { + return $this->getViewState('ListViewID'); + } + + public function bubbleEvent($sender, $param) + { + if(strtolower($param->getCommandName())==='search') + { + if(($list = $this->getListView()) !== null) + { + $list->setSearchCondition($this->createSearchCondition()); + $list->setSearchParameters(array()); + return false; + } + } + $this->raiseBubbleEvent($this, $param); + return true; + } + + protected function createSearchCondition() + { + $table = $this->getTableMetaData(); + if(strlen($str=$this->getSearchText()->getText()) > 0) + return $table->getSearchRegExpCriteria($this->getFields(), $str); + } + + protected function getFields() + { + if(strlen(trim($str=$this->getSearchableFields()))>0) + $fields = preg_split('/\s*,\s*/', $str); + else + $fields = array_keys($this->getTableMetaData()->getColumns()); + return $fields; + } + + public function getSearchableFields() + { + return $this->getViewState('SearchableFields',''); + } + + public function setSearchableFields($value) + { + $this->setViewState('SearchableFields', $value, ''); + } + + public function getSearchButton() + { + $this->ensureChildControls(); + return $this->getRegisteredObject('_search'); + } + + public function getSearchText() + { + $this->ensureChildControls(); + return $this->getRegisteredObject('_textbox'); + } +} + +?> \ No newline at end of file -- cgit v1.2.3