/** * Save changes to search. * @return int the search ID */ function execute() { $rtDao =& DAORegistry::getDAO('RTDAO'); $search = $this->search; if (!isset($search)) { $search = new RTSearch(); $search->setContextId($this->contextId); } $search->setTitle($this->getData('title')); $search->setUrl($this->getData('url')); $search->setSearchUrl($this->getData('searchUrl')); $search->setSearchPost($this->getData('searchPost')); $search->setDescription($this->getData('description')); if (!isset($this->search)) { $search->setOrder(0); } if (isset($this->search)) { $rtDao->updateSearch($search); } else { $rtDao->insertSearch($search); $this->searchId = $search->getSearchId(); } return $this->searchId; }
/** * Return RTSearch object from database row. * @param $row array * @return RTSearch */ function &_returnSearchFromRow(&$row) { $search = new RTSearch(); $search->setSearchId($row['search_id']); $search->setContextId($row['context_id']); $search->setTitle($row['title']); $search->setDescription($row['description']); $search->setUrl($row['url']); $search->setSearchUrl($row['search_url']); $search->setSearchPost($row['search_post']); $search->setOrder($row['seq']); HookRegistry::call('RTDAO::_returnSearchFromRow', array(&$search, &$row)); return $search; }