/** * Save changes to context. * @return int the context ID */ function execute() { $rtDao = DAORegistry::getDAO('RTDAO'); $context = $this->context; if (!isset($context)) { $context = new RTContext(); $context->setVersionId($this->versionId); } $context->setTitle($this->getData('title')); $context->setAbbrev($this->getData('abbrev')); $context->setCitedBy($this->getData('citedBy') == true); $context->setAuthorTerms($this->getData('authorTerms') == true); $context->setGeoTerms($this->getData('geoTerms') == true); $context->setDefineTerms($this->getData('defineTerms') == true); $context->setDescription($this->getData('description')); if (!isset($this->context)) { $context->setOrder(-1); } if (isset($this->context)) { $rtDao->updateContext($context); } else { $rtDao->insertContext($context); $this->contextId = $context->getContextId(); } return $this->contextId; }
/** * Return RTContext object from database row. * @param $row array * @return RTContext */ function &_returnContextFromRow(&$row) { $context = new RTContext(); $context->setContextId($row['context_id']); $context->setVersionId($row['version_id']); $context->setTitle($row['title']); $context->setAbbrev($row['abbrev']); $context->setDescription($row['description']); $context->setCitedBy($row['cited_by']); $context->setAuthorTerms($row['author_terms']); $context->setGeoTerms($row['geo_terms']); $context->setDefineTerms($row['define_terms']); $context->setOrder($row['seq']); if (!HookRegistry::call('RTDAO::_returnContextFromRow', array(&$context, &$row))) { $searchesIterator =& $this->getSearches($row['context_id']); $context->setSearches($searchesIterator->toArray()); } return $context; }