/** * * @param string $id * @param integer $batch_id * @param array $options * @return RP_Evidence */ public function get_with_options($id, $batch_id, $options) { $this->transaction = new RP_Transaction($this->credentials, true); $evi = RP_Dao_Factory::get_rp_source_dao($this->credentials->prefix)->get_source($id, $batch_id, $options); $this->transaction->close(); return $evi; }
/** * * @param RP_Source_Record $source */ function add_src($source) { $need_update = false; $src = new RP_Source(); $src->id = $source->id; $src->batch_id = $this->batch_id; $src->originator = $source->author; $src->source_title = $source->title; $src->abbr = $source->abbreviated_title; $src->publication_facts = $source->publication_facts; $src->text = $source->text; $src->auto_rec_id = $source->auto_rec_id; $src->ged_change_date = $source->change_date->date; try { RP_Dao_Factory::get_rp_source_dao($this->credentials->prefix)->insert($src); } catch (Exception $e) { if (stristr($e->getMessage(), 'Duplicate entry') >= 0) { $need_update = true; } else { error_log($e->getMessage() . "::" . RP_Persona_Helper::trace_caller(), 0); echo $e->getMessage(); throw $e; } } if ($need_update) { try { RP_Dao_Factory::get_rp_source_dao($this->credentials->prefix)->update($src); } catch (Exception $e) { error_log($e->getMessage() . "::" . RP_Persona_Helper::trace_caller(), 0); echo $e->getMessage(); throw $e; } } $this->update_src_notes($source); }
/** * * @param array $options * @return string */ function add_evidence_pages($options, $batch_id) { $this->transaction = new RP_Transaction($this->credentials, false); $sources = RP_Dao_Factory::get_rp_source_dao($this->credentials->prefix)->get_source_no_page($batch_id); foreach ($sources as $src) { $content = sprintf("[rootsEvidencePage sourceId='%s' batchId='%s'/]", $src['id'], $batch_id); $page_id = RP_Persona_Helper::create_evidence_page($src['title'], $content, $options); RP_Dao_Factory::get_rp_source_dao($this->credentials->prefix)->update_page($src['id'], $batch_id, $page_id); set_time_limit(60); } $this->transaction->commit(); return count($sources) . ' ' . sprintf(__('source page(s) added for batchId %s', 'rootspersona'), $batch_id) . '.<br/>'; }