public function __construct($config, $type) { $this->update_since = $this->setUpdateTimestamp($config['update_since']); $this->export_path = $config['export_path']; $session = new \IMuSession($config['host'], $config['port']); $session->connect(); $this->catalogue = new \IMuModule('ecatalogue', $session); $terms = new \IMuTerms(); if ($type == 'update') { $terms->add('AdmDateModified', $this->update_since, '>'); } $this->count = $this->catalogue->findTerms($terms); $this->fields = $config['fields']; $this->catalogue->addFetchSet('exportFields', $this->fields); $this->start = $config['start']; $this->chunk = $config['chunk']; $this->transform = $config['transform_data']; }
/** * Finds total count of records to retrieve. * * @return void */ public function findCount() { // Create a Session. $session = new \IMuSession(config('emuconfig.emuserver'), config('emuconfig.emuport')); $module = new \IMuModule('emultimedia', $session); // Adding our search terms. $terms = new \IMuTerms(); $terms->add('MulMultimediaCreatorRef_tab', '177281'); // Fetching results. $hits = $module->findTerms($terms); $results = $module->fetch('start', 0, -1, 'irn'); $this->count = $results->count; $message = "We have " . $this->count . " records to process." . PHP_EOL; Log::info($message); print $message; }
function searchEvent() { $mySession = IMuConnect(); $terms = new IMuTerms(); $columns = array('SummaryData', 'image.resource{height:100,source:master}'); if (isset($_GET["name"])) { $terms->add('EveEventTitle', trim($_GET["name"])); } if (isset($_GET["evnum"])) { $terms->add('EveEventNumber', trim($_GET["evnum"])); } if (isset($_GET["irn"])) { $terms->add('irn', trim($_GET["irn"])); } $start = 0; if (isset($_GET["start"])) { $start = intval($_GET["start"]); } $number = 15; if (isset($_GET["n"])) { $number = intval($_GET["n"]); } $events = new IMuModule('eevents', $mySession); try { $hits = $events->findTerms($terms); $result = $events->fetch('start', $start, $number, $columns); $result = processResult($result); print json_encode($result); } catch (Exception $e) { var_dump($e); } }
/** * Retrieves the Habitat information from the Sites record attached via Collection Events. * * @param array $record * The Catalogue EMu record. * * @return string $habitat * Returns a string of the Habitat value. */ public function getHabitat($record) { // First, we need to verify that we have a Collection Record attached to the Catalogue. if (empty($record['ColCollectionEventRef']['ColSiteRef']['irn'])) { return ""; } // Now, let's get the Site record info from EMu. $session = new \IMuSession(config('emuconfig.emuserver'), config('emuconfig.emuport')); $module = new \IMuModule('esites', $session); // Adding our search terms. $terms = new \IMuTerms(); $terms->add('irn', $record['ColCollectionEventRef']['ColSiteRef']['irn']); // Fetching results. $module->findTerms($terms); $columns = config('emuconfig.site_fields'); $result = $module->fetch('start', 0, 1, $columns); // Return the Habitat if we have it. if (empty($result->rows[0]['AquHabitat_tab'][0])) { return ""; } else { return $result->rows[0]['AquHabitat_tab'][0]; } }
/** * Checks each Multimedia detail page's subset categories to ensure * we have links for a category before we display them on the detail page. * * @param int $taxonomyIRN * The IRN of the Taxonomy record. * * @return array * Returns an array of subset items checked values (true|false) */ public function checkSubsets($taxonomyIRN) : array { $subsets = config('emuconfig.subsets_to_check'); $session = new \IMuSession(config('emuconfig.emuserver'), config('emuconfig.emuport')); $module = new \IMuModule('emultimedia', $session); foreach ($subsets as $key => $value) { $terms = new \IMuTerms(); $terms->add('MulOtherNumber_tab', $taxonomyIRN); $terms->add('DetSubject_tab', $key); // Fetching results. $hits = $module->findTerms($terms); $results = $module->fetch('start', 0, 1, 'irn'); $count = $results->count; if ($count > 0) { $subsets[$key] = true; } else { $subsets[$key] = false; } } return $subsets; }
function recordObject($irn) { $mySession = IMuConnect(); $terms = new IMuTerms(); $cat = new IMuModule('ecatalogue', $mySession); $columns = array('irn', 'Creator=CreCreatorRef_tab.(Name=NamFullName)', 'Role=CreRole_tab', 'AccNo=TitAccessionNo', 'Medium=PhyMediumComments', 'Title=TitMainTitle', 'Year=CreDateCreated', 'Location=LocCurrentLocationRef.(LocLocationName,LocBarcode)', 'Children=<ecatalogue:AssParentObjectRef>.(irn, AccNo=TitAccessionNo, Title=TitMainTitle, Location=LocCurrentLocationRef.(LocLocationName, LocBarcode), TitBarcode)', 'MesType=MesMeasurementType_tab', 'H=MesTotalInchFrac_tab', 'W=MesTotWidthInchFrac_tab', 'D=MesTotDepthInchFrac_tab', 'Barcode=TitBarcode', 'image.resource{height:300,source:master}', 'NotesA=ConHandlingInstructions', 'NotesB=InsInstallationNotes'); $terms->add('irn', trim($irn)); $start = 0; $number = 100; try { $hits = $cat->findTerms($terms); $result = $cat->fetch('start', $start, $number, $columns); $result = formatResults($result); createRecords($result); return $result; } catch (Exception $e) { throwError($e); } return null; }