Exemplo n.º 1
0
 public function search($module, $columns, $terms = null)
 {
     try {
         $mod = new IMuModule($module, $this->session);
         if (isset($terms)) {
             $mod->findTerms($terms);
         } else {
             $mod->findTerms("irn", "-1", '>');
             //Should match everything
         }
         $itt = 50;
         //Fetch all
         $bigresult = new stdClass();
         $bigresult->rows = array();
         $offset = 0;
         do {
             $result = $mod->fetch('start', $offset, $itt, $columns);
             $bigresult->rows = array_merge($bigresult->rows, $result->rows);
             $offset += $itt;
         } while ($result->count == $itt);
         return $bigresult;
     } catch (Exception $e) {
         throw $e;
     }
     return null;
 }
Exemplo n.º 2
0
 public function makeAllIrnFile()
 {
     $irns = null;
     $catalogue = new \IMuModule('ecatalogue', $this->session);
     $catalogue_terms = new \IMuTerms();
     $catalogue->findTerms($catalogue_terms);
     $results = $catalogue->fetch('start', 0, -1, ['irn']);
     foreach ($results->rows as $row) {
         $irn = $row['irn'];
         $irns[] = $irn;
     }
     file_put_contents(__DIR__ . "/../data/emu-all-irns.json", json_encode($irns));
 }
Exemplo n.º 3
0
 /**
  * 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;
 }
Exemplo n.º 4
0
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);
    }
}
Exemplo n.º 5
0
 /**
  * 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];
     }
 }
Exemplo n.º 6
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;
 }
Exemplo n.º 7
0
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;
}